Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
quick/dirty tool to extract embeded gzip files out of the evasi0n7 jailbreak binary -- requires otool so probably OSX
#!/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
@emonti

This comment has been minimized.

Copy link
Owner Author

commented Jan 10, 2014

FWIW: TaiG was data_10.gz inside the version I used this on...

@enzocaggiano

This comment has been minimized.

Copy link

commented Jan 10, 2014

how to use?

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.