ips.py
A Python library for handling IPS patches.
I wanted to create this as there was no suitable library for how I wanted to manipulate IPS patches, which at the time was just changing the offsets in the records. Since then I have wanted to extend it for my own needs, and for the potential needs of others.
The logic for creating patches from two file objects is taken from flips, which creates very good, small patches.
How to use
To import the library, do
import ips
To get a Patch object from an IPS file, do
with open("path/to/patch.ips", "rb") as f:
p = ips.Patch.load(f)
If you already have the bytes of the IPS file, you can do
with open("path/to/patch.ips", "rb") as f:
cont = f.read()
...
p = ips.Patch.load(cont)
To apply a Patch object, do
with open("path/to/original/file.bin", "rb") as old, open("path/to/new/file.bin", "wb") as new:
p.apply(old, new)
If you don't want to necessarily write it to a new file, you can do
import io
new = io.BytesIO()
with open("path/to/original/file.bin", "rb") as old:
p.apply(old, new)
To create a Patch object from two file objects, do
with open("path/to/original/file.bin", "rb") as old, open("path/to/new/file.bin", "rb") as new:
p = ips.Patch.create(old, new)
To pack a Patch object into a bytes object, do
bytes(p)
To add a record to a Patch object, use the add_record method.
To get a list of records in a Patch object, use the records attribute.
To get whether a Patch object is using the IPS32 format, which allows for offsets up to 4 GiB, check the ips32 attribute.
Release files for ips.py 0.1.2
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | |
|---|---|---|---|
| ips.py-0.1.2.tar.gz | 3.7 kB | Details |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Reset |
|---|---|---|---|---|
| ips.py-0.1.2-py3-none-any.whl | Python 3 | none | any | Details |
Total release size: 19.8 kB
Release files / ips.py-0.1.2.tar.gz
| Download URL | ips.py-0.1.2.tar.gz |
|---|---|
| Size | 3.7 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
b91ddde1ea146937b8e60b8c5bf724ab5b1000909b588c66f268e6160581591d
|
|
BLAKE2b-256 checksum How to use checksums |
16566e74cdaac9f774beeacc85b61e5f2845cb92f7337a78a9739498ff8b9f4a
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/3.2.0 pkginfo/1.6.1 requests/2.25.1 setuptools/51.1.0 requests-toolbelt/0.9.1 tqdm/4.54.1 CPython/3.9.1
|
Release files / ips.py-0.1.2-py3-none-any.whl
| Download URL | ips.py-0.1.2-py3-none-any.whl |
|---|---|
| Size | 16.1 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
59c29d8646e00f2aa034b248832af11b6d147d68d85ae27d23c33489393b40bb
|
|
BLAKE2b-256 checksum How to use checksums |
b876441bff94f9fe852bed1c4e1e7d5c7535704b04dc88de218e41e49bea2678
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/3.2.0 pkginfo/1.6.1 requests/2.25.1 setuptools/51.1.0 requests-toolbelt/0.9.1 tqdm/4.54.1 CPython/3.9.1
|