Created
January 10, 2014 11:38
-
-
Save emonti/8350517 to your computer and use it in GitHub Desktop.
quick/dirty tool to extract embeded gzip files out of the evasi0n7 jailbreak binary -- requires otool so probably OSX
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/env ruby | |
fname = ARGV.shift | |
fname || exit! | |
sections = `otool -l \"#{fname}\" |grep -A11 ^Section`.split(/^--$/).map do |sect_txt| | |
lines = sect_txt.lines.map(&:chomp) | |
Hash[ lines.map{|ln| ln.strip.split(' ', 2) } ] | |
end.select{|sect| sect["segname"] == "__DATA" and sect["sectname"] =~ /^data_\d+$/ } | |
dats = sections.map do |sect| | |
{ | |
name: sect["sectname"], | |
fileoffset: sect["offset"].to_i, | |
size: sect["size"].hex, | |
} | |
end | |
f = File.open(fname, "r") | |
dats.each do |dat| | |
f.pos = dat[:fileoffset] | |
File.open(dat[:name] + ".gz", 'w'){|o| o.write(f.read(dat[:size])) } | |
end |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
FWIW: TaiG was data_10.gz inside the version I used this on...