Last active
July 5, 2017 14:58
-
-
Save apisurfer/d776c8f4d1117a9ee280 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<!doctype html> | |
<html lang="en"> | |
<head> | |
<meta charset="utf-8"> | |
<title>Execute script from image</title> | |
<meta name="author" content="popc0rn - Luka Vidakovic"> | |
</head> | |
<body> | |
<div id="x"></div> | |
<script> | |
(function decode(t){"use strict";function n(t,n){var e=document.createElement("canvas");return e.width=t,e.height=n,e}function e(t){var n=t.getContext("2d");return{context:n,getData:function(){return n.getImageData(0,0,t.width,t.height).data},draw:function(t){return n.drawImage(t,0,0)}}}function r(t){var n,e=[],r="";for(n=0;n<t.length;n+=4)e.push(t[n],t[n+1],t[n+2]);for(e.length%2!==0&&e.pop(),0===e[e.length-1]&&0===e[e.length-2]&&(e.pop(),e.pop()),n=0;n<e.length;n+=2)r+=String.fromCharCode((e[n]<<8)+e[n+1]);return r}return new Promise(function(o,a){var i=new Image;i.crossOrigin="Anonymous",i.onload=function(){var t=e(n(i.width,i.height));t.draw(i),o(r(t.getData()))},i.src=t})} | |
decode(location.hash.replace('#','')).then(function(m){console.log(m)}); | |
})() | |
</script> | |
</body> | |
</html> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment