Skip to content

Instantly share code, notes, and snippets.

@baotang2118
Last active June 14, 2021 09:39
Show Gist options
  • Save baotang2118/ab2f50cc82ba9d1d3c151db638001e92 to your computer and use it in GitHub Desktop.
Save baotang2118/ab2f50cc82ba9d1d3c151db638001e92 to your computer and use it in GitHub Desktop.
<html>
<head>
</head>
<body>
<h1>js deobfuscator</h1>
<pre>
<script>
//########################### Given sourcecode #####################################################
var ð= "\x71\x11\x24\x59\x8d\x6d\x71\x11\x35\x16\x8c\x6d\x71\x0d\x39\x47\x1f\x36\xf1\x2f\x39\x36\x8e\x3c\x4b\x39\x35\x12\x87\x7c\xa3\x10\x74\x58\x16\xc7\x71\x56\x68\x51\x2c\x8c\x73\x45\x32\x5b\x8c\x2a\xf1\x2f\x3f\x57\x6e\x04\x3d\x16\x75\x67\x16\x4f\x6d\x1c\x6e\x40\x01\x36\x93\x59\x33\x56\x04\x3e\x7b\x3a\x70\x50\x16\x04\x3d\x18\x73\x37\xac\x24\xe1\x56\x62\x5b\x8c\x2a\xf1\x45\x7f\x86\x07\x3e\x63\x47";
function _(x,y){
//console.log("function 1");
return x^y;
}
function __(y){ //not use
//console.log("function 2");
var z = 0;
for(var i=0;i<y;i++){
z += Math.pow(2,i);
}
return z;
}
function ___(y){
//console.log("function 3");
var z = 0;
for(var i=8-y;i<8;i++){
z += Math.pow(2,i);
}
return z
}
function ____(x,y){ //not use
//console.log("function 4");
y = y % 8;
Ï = __(y);
Ï = (x & Ï) << (8-y);
return (Ï) + (x >> y);
}
function _____(x,y){
//console.log("function 5");
y = y % 8;
Ï = ___(y);
Ï = (x & Ï) >> (8-y);
return ((Ï) + (x << y)) & 0x00ff;
}
function ______(x,y){
//console.log("function 6");
return _____(x,y)
}
function _______(_________,key){
//console.log("> function 7");
________ = "";
________2 = ""; //not use
for(var i=0;i<_________.length;i++){//ð.length
c = _________.charCodeAt(i);//ð.charCodeAt[i]
if(i != 0){//other ð charCode
t = ________.charCodeAt(i-1)%2;
//console.log(________.charCodeAt(i-1));
switch(t){
case 0:
//function 1
cr = _(c, key.charCodeAt(i % key.length));
break;
case 1:
//function 6
cr = ______(c, key.charCodeAt(i % key.length));
break;
}
}else{//first charCode
//function 1
cr = _(c, key.charCodeAt(i % key.length));
}
//Addition if phase
//if(cr >=32 && cr <=126){
________ += String.fromCharCode(cr);
//}else{
// return ________;
//}
}
return ________;
}
function __________(þ){
//console.log("function 10");
var ŋ=0;
for(var i=0;i<þ.length;i++){
ŋ+=þ["charCodeAt"](i)
}
//console.log(ŋ);
//ŋ sum of charCode
if(ŋ==8932){
var ç=window.open("","","width=300,height=2 0");
ç.document.write(þ);
console.log(þ);
}
}
document.writeln("<h2>begin debugging</h2>");
//########################### First character #####################################################
/*
var possible = "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789-=~!@#$%^&*()_+[]\{}|;':\",./<>?";
for(var i=0; i<possible.length; i++){
X = _______(ð,possible[i]);
if(X != void 0)
if(X.length >= 1)
console.log(possible[i], X);
}
*/
//########################### Two first character #####################################################
/*
position_1 = "ABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789-=!@#$%^&*()_+[]\;':\",./<>?";
var possible = "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789-=~!@#$%^&*()_+[]\{}|;':\",./<>?";
for(var i=0; i<position_1.length; i++){
for(var j=0; j<possible.length; j++){
X = _______(ð,position_1[i]+possible[j]);
if(X != void 0)
if(X.length >= 2)
console.log(position_1[i]+possible[j], X);
}
}
*/
//########################### Three first character #####################################################
/*
position_1 = "M";
var possible = "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789-=~!@#$%^&*()_+[]\{}|;':\",./<>?";
for(var i=0; i<possible.length; i++){
for(var j=0; j<possible.length; j++){
X = _______(ð,position_1+possible[i]+possible[j]);
if(X != void 0)
if(X.length >= 3)
console.log(position_1+possible[i]+possible[j], X);
}
}
*/
//########################### Four first character #####################################################
/*
position = "MyP";
var possible = "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789-=~!@#$%^&*()_+[]\{}|;':\",./<>?";
for(var i=0; i<possible.length; i++){
X = _______(ð,position+possible[i]);
if(X != void 0)
if(X.length >= 4)
console.log(position+possible[i], X);
}
*/
//########################### Five first character #####################################################
/*
position = "MyP4";
var possible = "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789-=~!@#$%^&*()_+[]\{}|;':\",./<>?";
for(var i=0; i<possible.length; i++){
X = _______(ð,position+possible[i]);
if(X != void 0)
if(X.length >= 5)
console.log(position+possible[i], X);
}
*/
//########################### Six first character #####################################################
/*
position = ["MyP4C", "MyP4K", "MyP4S", "MyP4c", "MyP4k", "MyP4s", "MyP43", "MyP4#", "MyP4+", "MyP4[", "MyP4{", "MyP4;"];
var possible = "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789-=~!@#$%^&*()_+[]\{}|;':\",./<>?";
for(var i=0; i<position.length; i++){
for(var j=0; j<possible.length; j++){
X = _______(ð,position[i]+possible[j]);
if(X != void 0)
if(X.length >= 6)
console.log(position[i]+possible[j], X);
}
}
*/
__________(_______(ð,prompt("Mot de passe?")));
document.writeln("<h2>finish debugging</h2>");
</script>
</pre>
</body>
</html>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment