Path: blob/master/payloads/extensions/self_destruct.txt
2968 views
EXTENSION SELF_DESTRUCT1REM VERSION 1.02REM AUTHOR: Korben34REM_BLOCK Documentation5This extension is used to "SELF DESTRUCT" a payload in one of two ways67TARGET:8Any910USAGE:11Place this extension at top of your payload.121314CONFIGURATION:15Set the #DESTRUCT_METHOD to one of the following methods:16REVERT_TO_THUMBDRIVE()17- delete payload and enter storage mode.18To return to normal usage simply add a new inject.bin1920SOFT_BRICK()21- keeps payload in order to force OFF w/ disabled button.22To return to normal usage the SD card will need to be removed and23the inject.bin replaced.2425Set #RUNS_BEFORE_DESTROY to an integer - the number of times the payload26must run before it self destructs2728#REQUIRES_FINISH if set to TRUE will require you to call PAYLOAD_FINISHED()29at the end of the payload for the deployment to count towards #RUNS_BEFORE_DESTROY3031Since this extension replaces "boot", #BOOT_ATTACKMODE defines the32the default mode to enter after this extension has run33END_REM34DEFINE #REQUIRES_FINISH FALSE35DEFINE #RUNS_BEFORE_DESTROY 136DEFINE #DESTRUCT_METHOD REVERT_TO_THUMBDRIVE()37DEFINE #BOOT_ATTACKMODE ATTACKMODE HID3839ATTACKMODE OFF4041FUNCTION PERSIST()42REM_BLOCK note43this takes advantage of a sideaffect of hide/restore procedure and44_how_ we initialize the variable we want to persist.45END_REM46HIDE_PAYLOAD47DELAY 10048RESTORE_PAYLOAD49END_FUNCTION5051FUNCTION SOFT_BRICK()52ATTACKMODE OFF53LED_OFF54DISABLE_BUTTON55STOP_PAYLOAD56END_FUNCTION5758FUNCTION REVERT_TO_THUMBDRIVE()59LED_OFF60HIDE_PAYLOAD61DELAY 50062ATTACKMODE STORAGE63END_FUNCTION6465FUNCTION PAYLOAD_FINISHED()66$TIMES_RAN = ($TIMES_RAN + 1)67PERSIST()68IF ($TIMES_RAN < #RUNS_BEFORE_DESTROY) THEN69#DESTRUCT_METHOD70END_IF71END_FUNCTION7273IF ($TIMES_RAN < #RUNS_BEFORE_DESTROY) THEN74IF_NOT_DEFINED_TRUE #REQUIRES_FINISH75VAR $TIMES_RAN = ($TIMES_RAN + 1)76PERSIST()77END_IF_DEFINED78#BOOT_ATTACKMODE79ELSE80#DESTRUCT_METHOD81END_IF82END_EXTENSION838485