-
-
Save liligot/e1c41fa0e64b297d3a1fff50485829c3 to your computer and use it in GitHub Desktop.
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
URL="https://dl.google.com/dl/android/aosp/ryu-opm4.171019.021.n1-factory-1f31fdce.zip" | |
TMP="tmp.zip" | |
OUT="output.zip" | |
# fetch the important "PK" region from the remote zip by specifying offsets* | |
curl --header "Range: bytes=1842-3820027" -k $URL > $TMP | |
# restore "corrupted" zip data (answer yes to question it prompts) | |
echo y | zip -FF $TMP --out $OUT | |
# extract from fixed zip | |
unzip $OUT | |
# to find this "PK" region, it will have to be discovered ahead of time, but it corresponds to | |
# the region of the zip file between two stretches of "PK" headers (0x504B01) that contain the | |
# filename of the target file to be extracted (in this case, they surround the first instance | |
# the string "bootloader-dragon-google_smaug.7900.126.0.img" appears in the HEX) | |
# to understand this better, you can look at the region from the curl command in a hex | |
# editor for the above URL, as they are hardcoded for that zip (in hex, offsets: 0x732 - 0x3a49fb) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment