Path: blob/master/payloads/examples/Functions/Functions-example2.txt
2968 views
REM Example FUNCTION with RETURN1ATTACKMODE HID2DELAY 200034BUTTON_DEF5STRING !6END_BUTTON78FUNCTION TEST_BUTTON()9STRING Press the button within the next 5 seconds.10VAR $TIMER = 511WHILE ($TIMER > 0)12STRING .13DELAY 100014$TIMER = ($TIMER - 1)15END_WHILE16ENTER17IF ($_BUTTON_PUSH_RECEIVED == TRUE) THEN18RETURN TRUE19ELSE IF ($_BUTTON_PUSH_RECEIVED == FALSE) THEN20RETURN FALSE21END_IF22END_FUNCTION2324IF (TEST_BUTTON() == TRUE) THEN25STRINGLN The button was pressed!26ELSE27STRINGLN The button was not pressed!28END_IF2930REM When the IF statement on line 26 checks the condition of the function TEST_BUTTON, the function is called and executed.31REM Based on whether or not the button is pressed, the RETURN value (lines 19 and 21) will be set to TRUE or FALSE.32REM The IF statement on line 26 evaluates the RETURN of the function TEST_BUTTON and types the result accordingly.333435