Skip to content

Instantly share code, notes, and snippets.

@ItsCrocoSwine
Last active September 29, 2024 03:34
Show Gist options
  • Save ItsCrocoSwine/f802f6dd2af3ea6fde550ff9ef42d9e0 to your computer and use it in GitHub Desktop.
Save ItsCrocoSwine/f802f6dd2af3ea6fde550ff9ef42d9e0 to your computer and use it in GitHub Desktop.
gm9 scripts to calculate the ID0 of several different forms of backups
#This script calculates the ID0 of several different files containing your movable.sed
#Could potentialy be useful to quickly check if all your backups are the same, but mostly I was just having fun
#Backups should be placed in 0:/gm9/out or set your own with the BACKPATH variable
#ItsCrocoSwine
set PREVIEW_COLOR_COMMENT 32CD32 #Lime green
set PREVIEW_COLOR_ACTIVE 5D3FD3 #Iris
set PREVIEW_COLOR_CODE E37383 #Watermelon pink
set BACKPATH 0:/gm9/out # <-Can change your backup directory by changing this variable
findnot 0:/gm9/out/temp?? TEMP
mkdir $[TEMP]
set private_ID0 "CRITICAL: Not found"
set embed_ID0 "Warning: Not found"
set movable_ID0 "N/A"
set essential_ID0 "N/A"
set sysnand_ID0 "N/A"
set sysnandprivate_ID0 "N/A"
#1:/private/movable.sed
if find 1:/private/movable.sed 1_MOVABLE
#SHA256 keyY
shaget $[1_MOVABLE]@110:10 $[TEMP]/P_KeyY.sha
#get parts and flip bytes
fget -e $[TEMP]/P_KeyY.sha@0:4 Ppart1
fget -e $[TEMP]/P_KeyY.sha@4:4 Ppart2
fget -e $[TEMP]/P_KeyY.sha@8:4 Ppart3
fget -e $[TEMP]/P_KeyY.sha@C:4 Ppart4
set private_ID0 $[Ppart1]$[Ppart2]$[Ppart3]$[Ppart4]
end
#S:/essential.exefs
if find S:/essential.exefs S_essential
shaget $[S_essential]@710:10 $[TEMP]/SE_KeyY.sha
fget -e $[TEMP]/SE_KeyY.sha@0:4 SEpart1
fget -e $[TEMP]/SE_KeyY.sha@4:4 SEpart2
fget -e $[TEMP]/SE_KeyY.sha@8:4 SEpart3
fget -e $[TEMP]/SE_KeyY.sha@C:4 SEpart4
set embed_ID0 $[SEpart1]$[SEpart2]$[SEpart3]$[SEpart4]
end
#Movable.sed
if find $[BACKPATH]/*ovabl*.sed movable
shaget $[movable]@110:10 $[TEMP]/M_KeyY.sha
fget -e $[TEMP]/M_KeyY.sha@0:4 Mpart1
fget -e $[TEMP]/M_KeyY.sha@4:4 Mpart2
fget -e $[TEMP]/M_KeyY.sha@8:4 Mpart3
fget -e $[TEMP]/M_KeyY.sha@C:4 Mpart4
set movable_ID0 $[Mpart1]$[Mpart2]$[Mpart3]$[Mpart4]
end
#essential.exefs
if find $[BACKPATH]/*ssentia*.exefs essential
shaget $[essential]@710:10 $[TEMP]/E_KeyY.sha
fget -e $[TEMP]/E_KeyY.sha@0:4 Epart1
fget -e $[TEMP]/E_KeyY.sha@4:4 Epart2
fget -e $[TEMP]/E_KeyY.sha@8:4 Epart3
fget -e $[TEMP]/E_KeyY.sha@C:4 Epart4
set essential_ID0 $[Epart1]$[Epart2]$[Epart3]$[Epart4]
end
#sysnand.bin embedded essential backup
if find $[BACKPATH]/*ysnan*.bin sysnand
shaget $[sysnand]@910:10 $[TEMP]/S_KeyY.sha
fget -e $[TEMP]/S_KeyY.sha@0:4 Spart1
fget -e $[TEMP]/S_KeyY.sha@4:4 Spart2
fget -e $[TEMP]/S_KeyY.sha@8:4 Spart3
fget -e $[TEMP]/S_KeyY.sha@C:4 Spart4
set sysnand_ID0 $[Spart1]$[Spart2]$[Spart3]$[Spart4]
imgmount $[sysnand]
if find 7:/private/movable.sed 7_MOVABLE #now the private movable as well if we can see it
shaget $[7_MOVABLE]@110:10 $[TEMP]/SP_KeyY.sha
fget -e $[TEMP]/SP_KeyY.sha@0:4 SPpart1
fget -e $[TEMP]/SP_KeyY.sha@4:4 SPpart2
fget -e $[TEMP]/SP_KeyY.sha@8:4 SPpart3
fget -e $[TEMP]/SP_KeyY.sha@C:4 SPpart4
set sysnandprivate_ID0 $[SPpart1]$[SPpart2]$[SPpart3]$[SPpart4]
end
imgumount
end
#cleanup
rm -o -s $[TEMP]
echo " [sysnand]\nSYSID0 var : $[SYSID0]\nmovable : $[private_ID0]\nessential : $[embed_ID0]\n \n [backups]\nmovable : $[movable_ID0]\nessential : $[essential_ID0]\n \n [sysnand backups]\nmovable : $[sysnandprivate_ID0]\nessential : $[sysnand_ID0]"
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment