Js code

hi

i want to know whats exactly this to do in ob,

btoa("u="+encodeURIComponent(username)+"&p="+encodeURIComponent(password))

the username is a “var” that tooked from username value element,neither the “password”
its a function that make a encrypted code and this code is the instruction that i extracted but i want to use in requests and normal config without selenium

thank if guide me

Example:

username=1
password=1

var key = btoa("u="+encodeURIComponent(username)+"&p="+encodeURIComponent(password))

then key : dT0xJnA9MQ==

I honestly didn’t understand anything of what you said, but it looks like you need a script block with Jint interpreter, pass the username and password as input variables (it won’t work if you pass input.USERNAME and input.PASSWORD directly, you need to put their values in other variables without the dot) and then extract the “key” variable from the script as output variable.

sry if my lang is not ok

let me explain like this :

MY post data is :

username=<USER>&password=<PASS>&hra-key=<key>

about “hra-key” i found a “Js Request” in inspecting that do this to make the “hra” key:

(function () {
    document.addEventListener('DOMContentLoaded', function () {
        document.getElementById('loginform').addEventListener('submit', function (e) {
            var username = document.getElementById('username').value;
            var password = document.getElementById('password').value;
            var key = btoa("u="+encodeURIComponent(username)+"&p="+encodeURIComponent(password))

            var form = document.getElementById('loginform')
            var input = document.createElement('input');
            input.setAttribute('name', 'hra-key');
            input.setAttribute('value', key);
            input.setAttribute('type', 'hidden');

            form.appendChild(input);

            setTimeout(function () { document.getElementById('loginform').submit() }, 1);

            e.preventDefault();
        });
    });
})();

so if we see,the website grab the value of username and password input,and make them a hash that call `“URIencode” by this code :

var key = btoa("u="+encodeURIComponent(username)+"&p="+encodeURIComponent(password))

i want to know,how i can do this in openbullet?i dont want use EXECUTE JS cause im not making selenium.

i want to know,that code i attached,exactly what it do to i do that too,i know just it encodeURI the username and passwrod and…

that i guess not there be a URIencode in openbullet

the example was if username be 1, and password be 1, the hra key will be : dT0xJnA9MQ==

In OB1 you can use the BEGIN SCRIPT statement (look in LoliScript documentation) but I will not help more than this because OB1 is not supported anymore. Switch to OB2, there is the script block in OB2 and it’s really easy to use.

1 Like

btoa encodes the string in base64, you must use the function block

FUNCTION Base64Encode "u=1&p=1" -> VAR "result"  ##dT0xJnA9MQ==
1 Like