SCRIPT:#!/bin/bash
# PsDev 2012. this script extract the PUP magic.
#Edit from PsiColio lv1.self extractrion
#just extracts the header info from a vita pup, good for comparison kinda useless atm and most likely always.
# File names to extract from the PUP
Extract=( “Magic” “PUPVersion” “License.xml” “PackageVersion” “ImageVersion” “FileCount” “HeaderLength” “PakageLength” “UNKNOWN” “FileTable” “HashTable” “HeaderHash” )
#length starting from the offset and it ending in the offsets total length
length=( 0×8 0×10 0x724B4 0×8 0×8 0×8 0×8 0×8 0×50 0×20 0×40 0×20) #how many long the file is how much to copy, for example the Magic starts at 0×0 and the length is 0×8 bytes.
#offset of the Magic, Version and License
offset=( 0×0 0x9FF 0xC00 0×8 0×10 0×18 0×20 0×28 0×30 0×80 0×100 0×130 ) #where the file dump begins in the hex.
cont=0
printf “____________________________n”
printf ” PsDev n”
printf ” Magic Reader n”
printf “____________________________ nn”
for file in “$Extract[@]” #tells it for a file look in Extract = the the file names
do
printf “____________________________ n”
printf ” %sn” “$file” #file name
printf “____________________________ n”
printf “offset= %sn” “$offset[$cont]” #tells offset of file
printf “length= %sn” “$length[$cont]” #tells total offset length of file
printf “%sn” “$cont”
dd if=$1 of=$file bs=1 obs=1 skip=$(($offset[$cont])) count=$(($length[$cont]))
cont=$(($cont+1)) # make sure the usage is “./Magic-reader.sh PSP2UPDAT.PUP”
done
Tweet this!









