;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
;;
;; F64 Basic Script Trainer 1.2
;; 
;;   Spaces are not allowed when searching for hex or string
;;   Replace spaces with wildcard *
;;
;;   Maximum Length for task_title is 64 characters
;;
;;   Maximum Length for a hex_patch is 2048 bytes
;;
;;   Maximum Length for string_patch is 2048 characters (case sensitive)
;;
;;   Each Task can only process one specific partition
;;   Make separate Tasks for each unique partition
;;
;;   Upto 32 consecutive Tasks can be processed in a single script file
;;   
;;
;;                       D I S C L A I M E R
;;
;;    We are not responsible for the legality of the tasks contained 
;;    within these script files. Additionally, we accept no liability 
;;    for any damages that may result from their use. Please proceed 
;;    with caution and modify these script files at your own risk. 
;;    If you are not fully familiar with their functionality, we 
;;    strongly advise against using them.  
;;
;; October 18, 2025 @ X-Shadow
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;




; TASK 1
; This first Task Example will demonstrate how to erase a specific partition
; Difficulty Level: Beginner

start 						; Task start boundary

task_title="Script Task 1: FRP Erase"           ; Optional Task Title that will be displayed on the software log

target_partition="persistent"                   ; Reads partition "persistent" from EMMC/UFS and saves a backup binary file

erase_full					; Sends an erase command for the area used by the target partition

blank_check					; Reads the target partition and checks whether it is blank

display_message="Partition persistent Erased!"  ; Displays a message in Yellow Font Color in the Logs

finish 						; Task finish boundary




; TASK 2
; This second Task Example will demonstrate how to replace the entire contents of a specific partition with a single hex byte value
; Difficulty Level: Basic

start 						; Task start boundary

task_title="Script Task 2: FRP Zero Fill"       ; Optional Task Title that will be displayed on the software log

target_partition="persistent"                   ; Reads partition "persistent" from EMMC/UFS and saves a backup binary file

hex_fill="00"					; Replaces entire binary contents of partition with "00" 

write_partition                                 ; Writes empty/erased partition "persistent" to EMMC/UFS

display_message="Partition persistent Erased!"  ; Displays a message in Yellow Font Color in the Logs

finish 						; Task finish boundary




; TASK 3
; This third Task Example will demonstrate how to apply simple patches to partitions
; Difficulty Level: Intermediate

start 						; Task start boundary

task_title="Script Task 3: Patch persist"       ; Optional Task Title that will be displayed on the software log

target_partition="persistent"                   ; Reads partition "persistent" from EMMC/UFS and saves a backup binary file

hex_patch="0011223344556677","8899AABBCCDDEEFF" ; Searches for all matches of hexadecimal sequence "0011223344556677" and replaces it with hexadecimal sequence "8899AABBCCDDEEFF"

hex_patch="BEEFCAFE**4567","BABEFACE**1234"     ; Searches for all matches of hexadecimal sequence with wildcard ** "BEEFCAFE**4567" and replaces it with hexadecimal sequence with wildcard ** "BABEFACE**4567"
                                                ; Take note that wildcard value will not be patched

string_patch="Hello","World"			; Searches for all matches of case sensitive string "Hello" and replaces it with case sensitive string "World"

string_patch="unlock**me","relock**me"          ; Searches for all matches of case sensitive string with wildcard "unlock**me" and replaces it with case sensitive string with wildcard "relock**me"
						; Take note that wildcard value will not be patched

write_partition                                 ; Writes patched partition "persistent" to EMMC/UFS

display_message="Patching Done!"                ; Displays a message in Yellow Font Color in the Logs

popup_message="Enter Recovery and Wipe Data!"   ; Displays a pop-up message with an 'OK' button

finish 						; Task finish boundary



; TASK 4
; This fourth Task Example will demonstrate how to patch using a temporary variable stored in hex_variable.
; The first step is to search for the string "serialNumber":"???????????" where "???????????" will be stored in the hex_variable in hexademical format.
; Difficulty Level: Advanced

start 						; Task start boundary

task_title="Script Task 4: Change sec_efs SN"   ; Optional Task Title that will be displayed on the software log

target_partition="sec_efs"                      ; Reads partition "sec_efs" from EMMC/UFS and saves a backup binary file

hex_variable="2273657269616C4E756D626572223A22**********************22"
                                                ; Searches for hexadecimal representation of "serialNumber":"???????????" which is "2273657269616C4E756D626572223A22**********************22" 
                                                ; and then stores the 11 bytes at the wildcard position ********************** into the local variable.
                                                ; Take note that wildcards represented by "*" does not need to match the search.
                                                ; Only the bytes represented by the wildcard "*" are stored as the value of hex_variable.
                                                ; If the wildcard count is an odd number or if they don't align in 8-bit byte boundaries, you will get an error message.  

hex_variable_patch="**************41414141"     ; Searches for all matches of hexadecimal sequence stored in the hex_variable and replaces it with the hexadecimal sequence "**************41414141"
                                                ; In this example, only the last 4 bytes of the hex_variable is patched and the first 7 bytes are not changed since they are wildcards "*".  

                                                ; So basically what this script does is to search for the serial number inside the sec_efs and then replaces all
                                                ; instances of the serial number with a modified serial number that changes the last 4 characters as "AAAA".
                                                
write_partition                                 ; Writes patched partition "sec_efs" to EMMC/UFS

display_message="Patching Done!"                ; Displays a message in Yellow Font Color in the Logs

finish 						; Task finish boundary