DACS
1
Hello !
After a get request to a webpage, i get this payload:
<html><head><script type="text/javascript"><!--
function leastFactor(n) {
if (isNaN(n) || !isFinite(n)) return NaN;
if (typeof phantom !== 'undefined') return 'phantom';
if (typeof module !== 'undefined' && module.exports) return 'node';
if (n==0) return 0;
if (n%1 || n*n<2) return 1;
if (n%2==0) return 2;
if (n%3==0) return 3;
if (n%5==0) return 5;
var m=Math.sqrt(n);
for (var i=7;i<=m;i+=30) {
if (n%i==0) return i;
if (n%(i+4)==0) return i+4;
if (n%(i+6)==0) return i+6;
if (n%(i+10)==0) return i+10;
if (n%(i+12)==0) return i+12;
if (n%(i+16)==0) return i+16;
if (n%(i+22)==0) return i+22;
if (n%(i+24)==0) return i+24;
}
return n;
}
function go() {
var p=1058094687093573; var s=2957309918; var n;
if ((s >> 9) & 1)/*
p+= */p+= 204339537* 10;/*
*13;
*/else p-=
328590816*/*
*13;
*/10;/*
p+= */if ((s >> 7) & 1) p+=/* 120886108*
*/319371412*/*
else p-=
*/8;/*
else p-=
*/else /*
*13;
*/p-=/*
*13;
*/393117117*8;/*
else p-=
*/if ((s >> 12) & 1)/*
p+= */p+=/*
p+= */123742375* 15; else /*
else p-=
*/p-= 146531012* 13;/*
else p-=
*/if ((s >> 8) & 1)/*
*13;
*/p+=/* 120886108*
*/306370082*/*
*13;
*/11;/*
else p-=
*/else
p-=463335023*/* 120886108*
*/9; if ((s >> 8) & 1)
p+= 141696228*11;/*
else p-=
*/else p-=/* 120886108*
*/389526403*/*
*13;
*/9; p-=12052483901;
n=leastFactor(p);
{ document.cookie="KEY="+n+"*"+p/n+":"+s+":386345883:1;path=/;";
document.location.reload(true); }
}
//--></script></head>
<body onload="go()">
Loading...
</body>
</html>
After this the next page is loaded, so, my question is how to put this in OB2 so that it can load the next page?
I hope someone can help me.
Thanks in advance.
snipes
2
You could add a parse block like this:
BLOCK:Parse
input = @data.SOURCE
leftDelim = "<script type=\"text/javascript\">"
rightDelim = "</script>"
MODE:LR
=> VAR @parseOutput
ENDBLOCK
Then replace “document.cookie” with “const grabcookie”
BLOCK:Replace
original = @parseOutput
toReplace = "document.cookie"
replacement = "const grabcookie "
=> VAR @replaceOutput
ENDBLOCK
Set document.location.reload to false
BLOCK:Replace
original = @replaceOutput
toReplace = "document.location.reload(true)"
replacement = "document.location.reload(false)"
=> VAR @replaceOutput
ENDBLOCK
Add a Script block and run the code we just edited and grab the const grabcookie:
BLOCK:Script
INTERPRETER:Jint
INPUT replaceOutput
BEGIN SCRIPT
eval(replaceOutput); var result = grabcookie;
END SCRIPT
OUTPUT String @result
ENDBLOCK
Add the same Request block as before but this time you have to insert the result of the script as custom cookie. Example:
BLOCK:HttpRequest
url = "https://yoursite.com/"
customCookies = @result
TYPE:STANDARD
$""
"application/x-www-form-urlencoded"
ENDBLOCK
And at least you have to jump back to the Parse Block to make it happen again and again.
So you can add:
#JUMPHERE
to the LoliCode before the first Parse block begins..
And put this at the very end of the LoliCode:
JUMP #JUMPHERE
Hope this helps. Good luck.
1 Like
DACS
3
Hello!
Thanks for your time and help.
This is the script i’m getting after all the replacements.
function leastFactor(n) {
if (isNaN(n) || !isFinite(n)) return NaN;
if (typeof phantom !== 'undefined') return 'phantom';
if (typeof module !== 'undefined' && module.exports) return 'node';
if (n==0) return 0;
if (n%1 || n*n<2) return 1;
if (n%2==0) return 2;
if (n%3==0) return 3;
if (n%5==0) return 5;
var m=Math.sqrt(n);
for (var i=7;i<=m;i+=30) {
if (n%i==0) return i;
if (n%(i+4)==0) return i+4;
if (n%(i+6)==0) return i+6;
if (n%(i+10)==0) return i+10;
if (n%(i+12)==0) return i+12;
if (n%(i+16)==0) return i+16;
if (n%(i+22)==0) return i+22;
if (n%(i+24)==0) return i+24;
}
return n;
}
function go() {
var p=2410867245704; var s=4189513668; var n;
if ((s >> 10) & 1)/* 120886108*
*/p+= 237767472*/*
*13;
*/13;/*
p+= */else /*
p+= */p-= 159088156*11;if ((s >> 3) & 1)/* 120886108*
*/p+=/*
p+= */1044234098*4;/* 120886108*
*/else /*
else p-=
*/p-=/*
*13;
*/867143931*/* 120886108*
*/4;/*
*13;
*/if ((s >> 4) & 1)
p+=/*
p+= */132666482*/* 120886108*
*/7;/* 120886108*
*/else /* 120886108*
*/p-=/*
*13;
*/568646034*/*
else p-=
*/5;/*
*13;
*/if ((s >> 8) & 1)p+=/*
p+= */229831489*/*
*13;
*/11;/* 120886108*
*/else
p-=241505879* 9;/* 120886108*
*/if ((s >> 9) & 1)/*
else p-=
*/p+=340284830*10;
else p-=
260861640*/*
else p-=
*/10; p-=2939454514;
n=leastFactor(p);
{ const grabcookie ="KEY="+n+"*"+p/n+":"+s+":1590629358:1;path=/;";
document.location.reload(false); }
}
The problem is that i’m getting an error now:
InvocationException: grabcookie is not defined
ReferenceError: grabcookie is not defined
What could be the issue? I use nodejs, not jint.
Regards.
DACS
4
Update:
I have been trying to make this work by modifying things and asking for the help to chatgpt ecc ecc.
So, i am almost near to the solution. I have edited the code like this now:
function leastFactor(n) {
if (isNaN(n) || !isFinite(n)) return NaN;
if (typeof phantom !== 'undefined') return 'phantom';
if (typeof module !== 'undefined' && module.exports) return 'node';
if (n==0) return 0;
if (n%1 || n*n<2) return 1;
if (n%2==0) return 2;
if (n%3==0) return 3;
if (n%5==0) return 5;
var m=Math.sqrt(n);
for (var i=7;i<=m;i+=30) {
if (n%i==0) return i;
if (n%(i+4)==0) return i+4;
if (n%(i+6)==0) return i+6;
if (n%(i+10)==0) return i+10;
if (n%(i+12)==0) return i+12;
if (n%(i+16)==0) return i+16;
if (n%(i+22)==0) return i+22;
if (n%(i+24)==0) return i+24;
}
return n;
}
function go() {
var p=2137091201063; var s=3056241243; var n;
if ((s >> 15) & 1)/* 120886108*
*/p+=/* 120886108*
*/10105114* 16;
else /*
p+= */p-= 26501258*16; if ((s >> 7) & 1)/*
*13;
*/p+=
272238351* 8;else p-=/* 120886108*
*/195496758*/*
*13;
*/8;/*
else p-=
*/if ((s >> 3) & 1) p+= 998542189*4;/*
*13;
*/else /*
*13;
*/p-= 936240433* 4;if ((s >> 0) & 1) p+=/*
p+= */695775590*/*
p+= */3;else
p-=
-479910972*/* 120886108*
*/1;/*
p+= */if ((s >> 2) & 1)/*
p+= */p+= 550564367* 5;/*
*13;
*/else
p-= 497579318*/* 120886108*
*/3; p-=3655043868;
n=leastFactor(p);
{ return +n+"*"+p/n+":"+s+":296726373:1;path=/;";
}
}
console.log(go());
const KEY = go();
The result i’m getting is:
>> Script (InvokeNode) <<
Executed NodeJS script with result: {"KEY":"NaN*NaN:3056241243:296726373:1;path=/;"}
Somehow some variables aren’t working as they should, may be you can help me, i’m also trying to find the solution.
This isn’t needed and will be replaced.
;path=/;"
DACS
5
Replying if someone has the same problem and isn’t good like me in coding ecc ecc.
i just deleted these lines too and i am able to get the result which i need.
if (isNaN(n) || !isFinite(n)) return NaN;
if (typeof phantom !== 'undefined') return 'phantom';
if (typeof module !== 'undefined' && module.exports) return 'node';
Regards.
1 Like
What is the site’s URL?
Which values change with each request?
Don’t bother.
Use HttpLibrary CurlImpersonate.
But if you absolutely want a solution, this will work: first, parse all the JS code
calculate the code cookie
and send the header cookie in the same GET request
Cookie: <result>
Note: But you have to use the same IP address to do this; rotating proxy won’t work either.
BLOCK:Parse
input = @data.SOURCE
leftDelim = "<html><head><script type=\\"text/javascript\\"><!--"
rightDelim = "//--></script></head>"
MODE:LR
=> VAR @jsCode
ENDBLOCK
BLOCK:Script
INTERPRETER:NodeJS
INPUT jsCode
BEGIN SCRIPT
var document = {
cookie: '',
location: { reload: function(){} }
};
var fn = new Function('document', jsCode + '\\ngo();\\nreturn document.cookie;');
var result = fn(document);
END SCRIPT
OUTPUT String @result
ENDBLOCK
BLOCK:HttpRequest
url = ""
customHeaders = ${("User-Agent", "Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/83.0.4103.116 Safari/537.36"), ("Pragma", "no-cache"), ("Accept", "\*/\*"), ("Accept-Language", "en-US,en;q=0.8"), ("Cookie", "<result>")}
TYPE:STANDARD
$""
"application/x-www-form-urlencoded"
ENDBLOCK
1 Like
DACS
8
Hi!
Thanks for your help, i wasn’t aware of this function, will try this too.
Regards.