Path: blob/master/payloads/examples/Loops/Loops-example1.txt
2971 views
REM Example while loop - blink LED 42 times12VAR $FOO = 423WHILE ( $FOO > 0 )4LED_G5DELAY 5006LED_OFF7DELAY 5008$FOO = ( $FOO - 1 )9END_WHILE1011LED_R121314REM The variable $FOO is set to 42.15REM The WHILE loop begins, evaluating the condition "is $FOO greater than 0".16REM Every time the condition is TRUE, the block of code between WHILE and END_WHILE will run.17REM The LED will blink green: half a second on, half a second off.18REM The variable $FOO will decrement by one.19REM Once $FOO reaches zero, the WHILE condition will no longer evaluate to TRUE. The payload will continue execution after the END_WHILE statement, where the LED will light red.20REM If the button is pressed at any time during the payload execution, the WHILE loop will end and the USB Rubber Ducky will enter ATTACKMODE STORAGE since that is the default behavior when no BUTTON_DEF has been initiated.2122