Need help replicating this

How would I replicate this in openbullet ACCURATELY using a function or a execute js block?

document.getElementById(‘crvtoken’).setAttribute(‘value’, (Math.random()+"").replace(“0.”,""));

Any help appreciated!

Pretty sure you can just paste this into an execute js block and it will work

I tried couldn’t get it to work but I dont know js at all :confused:

When the browser is open (not in headless mode) open the dev tools (F12) and paste that line in the js console, then see if it gives you some exception.

The config isn’t selenium im just trying to use the execute js block to gen that certain token.

I figured it out, just math.random and then parse after 0.

You cannot use js if the config is done through only http requests. Anyways I’m guessing crvtoken is just a field of an input form that you need to send through a POST request or something like that. So maybe you just want to obtain a random number? In this case just use the Random Integer block and set high minimum and maximum values to generate a big number (see how many digits are generated by the Math.random() in js) and then pass that in the POST data.

Its like it has to be generated with math.random() for some reason, just generating a 16 digit code will return ‘invalid crvtoken’.

Easy solution

BLOCK:Script
INTERPRETER:Jint
INPUT 
BEGIN SCRIPT
var result = (Math.random()+"").replace("0.","");
return result;
END SCRIPT
OUTPUT String @result
ENDBLOCK

If you’re using OB1 you can do something very similar using the BEGIN SCRIPT statement, look in the LoliScript documentation.

1 Like