Skip to main content

A Python library for the ipsw Engine API.

Project description

ipsw-py

ipsw SDK for Python 🚧

PyPI - Downloads


NOTE: This is a work in progress ⚠️

Getting Started

Start the ipsw daemon:

macOS

brew install blacktop/tap/ipswd
brew services start blacktop/tap/ipswd

Linux

⚠️ UNTESTED ⚠️

sudo snap install ipswd

Docker

docker run -d -p 3993:3993 -v `pwd`:/data blacktop/ipswd start

Installing

The latest stable version is available on PyPI. Either add ipsw to your requirements.txt file or install with pip:

pip install ipsw

Geting Started

Get IPSW info

import ipsw

client = ipsw.IpswClient(base_url='tcp://127.0.0.1:3993')

info = client.info.get("iPhone15,2_16.5_20F5028e_Restore.ipsw")
print(f'{info.version} ({info.build})')
for device in info.devices:
    print(f'- {device}')
16.5 (20F5028e)
- iPhone 14 Pro

Get DSC info

import ipsw

client = ipsw.IpswClient(base_url='tcp://127.0.0.1:3993')

dsc = client.dsc.open("20F5028e__iPhone15,2/dyld_shared_cache_arm64e")
print(dsc)
print(dsc.dylibs[0])
<DSC: '(dyld_v1  arm64e) - iOS - FAEC7714-4CCD-3B99-B18F-F5EAB60DE31E'>
{'index': 1, 'name': '/usr/lib/libobjc.A.dylib', 'version': '876.0.0.0.0', 'uuid': '085A190C-6214-38EA-ACCB-428C3E8AFA65', 'load_address': 6443204608}

<Dylib: '64-bit MachO AARCH64 (ARM64e)'>

Get dylib inside DSC info

libswiftCore = dsc.dylib("libswiftCore.dylib")
print(libswiftCore)

Get DSC symbol addresses

syms = dsc.sym_addrs([{'pattern': '.*zero.*', 'image': 'libsystem_c.dylib'}])
print(syms)

Convert between DSC offsets and addresses

off = dsc.a2o(7624591060)
adr = dsc.o2a(61146836)

Lookup DSC symbol by address

print(next(dsc.a2s([7624591060])))
{"address":7624591060,"symbol":"__exit","demanged":"__exit","mapping":"__TEXT","uuid":"3AB55994-1201-3908-BE27-52BB7EFA7573","ext":".21","image":"/usr/lib/system/libsystem_kernel.dylib","section":"__text","segment":"__TEXT"}

Get MachO info

import ipsw

client = ipsw.IpswClient(base_url='tcp://127.0.0.1:3993')

macho = client.macho.open("/bin/ls", arch="arm64e")
print(macho)
<Macho: '64-bit MachO AARCH64 (ARM64e)'>

Community

You have questions, need support and or just want to talk about ipsw-py?

Here are ways to get in touch with the ipsw-py community:

Join Discord Follow Twitter Follow Mastodon GitHub Discussions

License

MIT Copyright (c) 2023 blacktop

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

ipsw-0.1.4.tar.gz (36.7 kB view hashes)

Uploaded Source

Built Distribution

ipsw-0.1.4-py3-none-any.whl (35.4 kB view hashes)

Uploaded Python 3

Supported by

AWS AWS Cloud computing and Security Sponsor Datadog Datadog Monitoring Fastly Fastly CDN Google Google Download Analytics Microsoft Microsoft PSF Sponsor Pingdom Pingdom Monitoring Sentry Sentry Error logging StatusPage StatusPage Status page