Eval
This function returns the results of executing a piece of javascript or simple mathematical equations. $Eval is a Math Function.
A javascript enabled website must be open in the main browser in order for the eval function to run.
A blank browser will return blank results.
Expression: the math or javascript expression being evaluated.
Please keep in mind that the maximum number that a 32 bit integer can be is 2,147,483,647.
For example, this calculation will result in a number that is greater than the maximum number:
alert($multiply(1162261467,2))
The result is a negative number.
Please keep that in mind when processing calculation with the eval command.
Example 1: Math Expressions
navigate("http://www.ubotstudio.com/playground/simple-form", "Wait") type text(<about me textarea>, $eval($add(4, 4)), "Standard")
Typing 4+4 into the eval function brings up a new function called the add function.
$eval($add(4, 4))
navigate("http://www.ubotstudio.com/playground/simple-form", "Wait") type text(<about me textarea>, $eval($subtract(4, 4)), "Standard")
The subtract function appears when 4-5 is typed into the eval function.
$eval($subtract(4, 4))
Going back to our original script:
Running the script will fill the field with the correct answer for 4-4.
Example 2: Running Javascript
Eval can also be used to run javascript.
In this example, the function runs a piece of javascript that returns set cookies from a website and sets the cookies to a variable. The cookies are also displayed in full in an alert window.
ui text box("Website URL:", #website) navigate(#website, "Wait") wait(2) set(#blue, $eval("document.cookie"), "Global") alert($eval("document.cookie"))
Type in a url to see what cookies the set command and the alert returns.