Giter Site home page Giter Site logo

blacktop / ipsw-py Goto Github PK

View Code? Open in Web Editor NEW
23.0 3.0 0.0 139 KB

A Python library for the ipsw daemon API

License: MIT License

Python 98.55% Shell 1.09% Makefile 0.36%
apple-security dyld-shared-cache ipsw macho-parser python security-research ios kernelcache macos

ipsw-py's Introduction

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
}

Get dylib inside DSC info

libswiftCore = dsc.dylib("libswiftCore.dylib")
print(libswiftCore)
<Dylib: '64-bit MachO AARCH64 (ARM64e)'>

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

ipsw-py's People

Contributors

blacktop avatar dependabot[bot] avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.