Skip to content

Instantly share code, notes, and snippets.

@BombekeQuinten
Last active May 6, 2019 09:10
Show Gist options
  • Save BombekeQuinten/047802dfb18000a89b94775ab84e59e7 to your computer and use it in GitHub Desktop.
Save BombekeQuinten/047802dfb18000a89b94775ab84e59e7 to your computer and use it in GitHub Desktop.

Revisions

  1. BombekeQuinten revised this gist May 6, 2019. 2 changed files with 12 additions and 10 deletions.
    12 changes: 12 additions & 0 deletions challenge.html
    Original file line number Diff line number Diff line change
    @@ -0,0 +1,12 @@
    <script>
    const url = new URL(decodeURIComponent(document.location.hash.substr(1))).href.replace(/script|<|>/gi, "forbidden");
    const iframe = document.createElement("iframe"); iframe.src = url; document.body.appendChild(iframe);
    iframe.onload = function(){ window.addEventListener("message", executeCtx, false);}
    function executeCtx(e) {
    if(e.source == iframe.contentWindow){
    e.data.location = window.location;
    Object.assign(window, e.data);
    eval(url);
    }
    }
    </script>
    10 changes: 0 additions & 10 deletions challenge.js
    Original file line number Diff line number Diff line change
    @@ -1,10 +0,0 @@
    const url = new URL(decodeURIComponent(document.location.hash.substr(1))).href.replace(/script|<|>/gi, "forbidden");
    const iframe = document.createElement("iframe"); iframe.src = url; document.body.appendChild(iframe);
    iframe.onload = function(){ window.addEventListener("message", executeCtx, false);}
    function executeCtx(e) {
    if(e.source == iframe.contentWindow){
    e.data.location = window.location;
    Object.assign(window, e.data);
    eval(url);
    }
    }
  2. BombekeQuinten revised this gist May 6, 2019. 2 changed files with 10 additions and 12 deletions.
    12 changes: 0 additions & 12 deletions challenge.html
    Original file line number Diff line number Diff line change
    @@ -1,12 +0,0 @@
    <script>
    const url = new URL(decodeURIComponent(document.location.hash.substr(1))).href.replace(/script|<|>/gi, "forbidden");
    const iframe = document.createElement("iframe"); iframe.src = url; document.body.appendChild(iframe);
    iframe.onload = function(){ window.addEventListener("message", executeCtx, false);}
    function executeCtx(e) {
    if(e.source == iframe.contentWindow){
    e.data.location = window.location;
    Object.assign(window, e.data);
    eval(url);
    }
    }
    </script>
    10 changes: 10 additions & 0 deletions challenge.js
    Original file line number Diff line number Diff line change
    @@ -0,0 +1,10 @@
    const url = new URL(decodeURIComponent(document.location.hash.substr(1))).href.replace(/script|<|>/gi, "forbidden");
    const iframe = document.createElement("iframe"); iframe.src = url; document.body.appendChild(iframe);
    iframe.onload = function(){ window.addEventListener("message", executeCtx, false);}
    function executeCtx(e) {
    if(e.source == iframe.contentWindow){
    e.data.location = window.location;
    Object.assign(window, e.data);
    eval(url);
    }
    }
  3. BombekeQuinten created this gist May 6, 2019.
    12 changes: 12 additions & 0 deletions challenge.html
    Original file line number Diff line number Diff line change
    @@ -0,0 +1,12 @@
    <script>
    const url = new URL(decodeURIComponent(document.location.hash.substr(1))).href.replace(/script|<|>/gi, "forbidden");
    const iframe = document.createElement("iframe"); iframe.src = url; document.body.appendChild(iframe);
    iframe.onload = function(){ window.addEventListener("message", executeCtx, false);}
    function executeCtx(e) {
    if(e.source == iframe.contentWindow){
    e.data.location = window.location;
    Object.assign(window, e.data);
    eval(url);
    }
    }
    </script>