Skip to content

Instantly share code, notes, and snippets.

@al3xtjames al3xtjames/psv.tcl
Last active Dec 7, 2018

Embed
What would you like to do?
Hex Fiend binary template for PSV dumps (https://gist.github.com/yifanlu/d546e687f751f951b1109ffc8dd8d903)
little_endian
requires 0 "50 53 56 00" ; # "PSV\0"
ascii 4 "Signature"
set version [uint32 "Version"]
set flags [uint32 "Flags"]
set key1 [hex 16 "Key 1"]
set key2 [hex 16 "Key 2"]
set signature [hex 20 "Signature"]
set hash [hex 32 "Image Hash"]
set image_size [uint64 "Image Size"]
set image_offset_sector [uint64 "Image Offset Sector"]
set flag_trimmed [expr 1 << 0]
set flag_digital [expr 1 << 1]
set flag_compressed [expr 1 << 2]
set flag_license_only [expr $flag_trimmed | $flag_digital]
if {$flags > 1} {
section "Optional Headers" {
if {$flags & $flag_digital} {
section "Digital Header" {
set opt_type [uint32 "Type"]
set opt_flags [uint32 "Flags"]
set opt_license_size [uint64 "License Size"]
set opt_rif [hex $opt_license_size "RIF"]
}
}
if {$flags & $flag_compressed} {
section "Compression Header" {
set opt_type [uint32 "Type"]
set opt_compression_algorithm [uint32 "Compression Algorithm"]
set opt_uncompressed_size [uint64 "Uncompressed Size"]
}
}
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.