blacktop / ipsw

iOS/macOS Research Swiss Army Knife
https://blacktop.github.io/ipsw
MIT License
1.79k stars 139 forks source link

Option to tag build number onto extracted binaries #278

Open jonpalmisc opened 1 year ago

jonpalmisc commented 1 year ago

When extracting binaries with ipsw extract -f --pattern it would be handy if there was an additional option to append (or prepend) the build number onto the binaries that are extracted.

In other words, if one did ipsw extract -f --tag --pattern Example, a file called Example-21A5277h would be created instead of just Example.

blacktop commented 1 year ago
❯ ipsw extract -f --pattern '.im4p$' test-caches/IPSWs/iPhone15,2_17.0_21A5277j_Restore.ipsw
   • Extracting files matching pattern ".im4p$"
      • Mounting DMG 096-00881-069.dmg
      • Mounting DMG 096-01005-048.dmg
      • Mounting DMG 096-01403-044.dmg
         • Extracting to 21A5277j__iPhone15,2/usr/standalone/update/all_flash/applelogo@2556~iphone.im4p
         • Extracting to 21A5277j__iPhone15,2/usr/standalone/update/all_flash/batterycharging0@2556~iphone.im4p
         • Extracting to 21A5277j__iPhone15,2/usr/standalone/update/all_flash/batterycharging1@2556~iphone.im4p
         • Extracting to 21A5277j__iPhone15,2/usr/standalone/update/all_flash/batteryfull@2556~iphone.im4p
         • Extracting to 21A5277j__iPhone15,2/usr/standalone/update/all_flash/batterylow0@2556~iphone.im4p
         • Extracting to 21A5277j__iPhone15,2/usr/standalone/update/all_flash/batterylow1@2556~iphone.im4p
         • Extracting to 21A5277j__iPhone15,2/usr/standalone/update/all_flash/glyphplugin@2556~iphone-lightning.im4p
         • Extracting to 21A5277j__iPhone15,2/usr/standalone/update/all_flash/liquiddetect@2556~iphone-lightning.im4p
         • Extracting to 21A5277j__iPhone15,2/usr/standalone/update/all_flash/lowpowerfindmymode@2556~iphone-lightning.im4p
         • Extracting to 21A5277j__iPhone15,2/usr/standalone/update/all_flash/lowpowermode@2556~iphone-lightning.im4p
         • Extracting to 21A5277j__iPhone15,2/usr/standalone/update/all_flash/recoverymode@2556~iphone-lightning.im4p
      • Created 21A5277j__iPhone15,2/Firmware/AOP/aopfw-iphone15aop.im4p
      • Created 21A5277j__iPhone15,2/Firmware/D73_HapticAssets.im4p
      • Created 21A5277j__iPhone15,2/Firmware/D73_LeapHapticsFirmware.im4p
      • Created 21A5277j__iPhone15,2/Firmware/D73_MtpFirmware.im4p
      • Created 21A5277j__iPhone15,2/Firmware/D73_Multitouch.im4p
      • Created 21A5277j__iPhone15,2/Firmware/SmartIOFirmware_ASCv6.im4p
      • Created 21A5277j__iPhone15,2/Firmware/WirelessPower/WirelessPower.iphone15.im4p
<SNIP>

So I already use the metadata in the IPSW to auto create a logical folder to extract into.

Are you saying to allow the user to customize that name?

jonpalmisc commented 1 year ago

Customizing the folder name would be a separate (nice to have) feature, but isn't what I had in mind when creating this issue.

For my workflow, I might want to extract Example.framework from 10 different IPSWs into the same folder and have them each tagged with the IPSW they came from, hence why appending/prepending the build number to the file name would be handy.

Thinking about it now... prepending might make more sense (compared to appending) so that file extensions aren't clobbered.