ReverseBox


NameReverseBox JSON
Version 0.7.0 PyPI version JSON
download
home_pagehttps://github.com/bartlomiejduda/ReverseBox
SummaryA set of functions useful in reverse engineering.
upload_time2024-04-14 22:12:51
maintainerNone
docs_urlNone
authorBartlomiej Duda
requires_python>=3.6
licenseNone
keywords reversebox reverse engineering re crc hash encryption compression checksum python
VCS
bugtrack_url
requirements bitstring black center_tk_window crc faker hashbase lzokay mypy numpy Pillow polib pre-commit pylint pytest setuptools twine types-setuptools
Travis-CI No Travis.
coveralls test coverage No coveralls.
            # Info

**ReverseBox** is a Python package with a set of functions
useful in software reverse engineering.

**Why ReverseBox?** <br>
It's designed to help with:
1. Decompressing / compressing data
2. Decrypting / encrypting data
3. Tedious reverse engineering tasks
e.g. testing different checksum algorithms to find the one that was
used in the software or file format
4. Figuring out file formats
5. Parsing data structures
6. Wrapping functions for input/output operations
7. Searching for raw images

**Who should use ReverseBox?** <br>
Mostly developers and reverse engineers (e.g. file format researchers
or software researchers).

# List of functionalities

* Checksum
  - Adler-32 ✔️
  - BSD-16 ✔️
  - Fletcher-16 ✔️
  - Fletcher-32 ✔️

* CRC
  - CRC-8 ✔️
  - CRC-8/CDMA2000 ✔️
  - CRC-8/DARC ✔️ <span style="color:yellow">(wrapper only)</span>
  - CRC-16 (ARC) ✔️
  - CRC-16 (Modbus) ✔️
  - CRC-16 (Sick) ✔️
  - CRC-16 (DNP) ✔️
  - CRC-16-CCITT (XModem) ✔️
  - CRC-16-CCITT (0xFFFF) ✔️
  - CRC-16-CCITT (0x1D0F) ✔️
  - CRC-16-CCITT (Kermit) ✔️
  - CRC-32 (ISO/HDLC) ✔️
  - CRC-32 (Asobo) ✔️
  - CRC-64 (Asobo) ✔️

* Compression
  - Asobo (TODO) ❌
  - BZE/BZZ (TODO) ❌
  - BZIP2 (TODO) ❌
  - GZIP (TODO) ❌
  - JCALG1 (TODO) ❌
  - LZMA (TODO) ❌
  - LZO / LZO1X ✔️ <span style="color:yellow">(wrapper only)</span>
  - LZSS (TODO) ❌
  - NitroSDK (TODO) ❌
  - Oodle (TODO) ❌
  - Refpack (EA) (TODO) ❌
  - RNC (TODO) ❌
  - ZLIB ✔️ <span style="color:yellow">(wrapper only)</span>

* Encryption
  - AES (TODO) ❌
  - DES (TODO) ❌
  - Lucifer / DTD-1 (TODO) ❌
  - ROT13 ✔️
  - XOR Cipher (Basic) ✔️
  - XOR Cipher (Basic) Guesser ✔️
  - (game-specific) XOR Cipher (Retro64 ECO) ✔️
  - (game-specific) XOR Cipher (Giana’s Return ZDA) ✔️

* Hash
  - FNV0-32 ✔️
  - FNV0-64 ✔️
  - FNV1-32 ✔️
  - FNV1-64 ✔️
  - FNV1A-32 ✔️
  - FNV1A-64 ✔️
  - SHA-1 ✔️ <span style="color:yellow">(wrapper only)</span>
  - SHA-2 (256 bits) ✔️ <span style="color:yellow">(wrapper only)</span>
  - MD2 ✔️ <span style="color:yellow">(wrapper only)</span>
  - MD5 ✔️ <span style="color:yellow">(wrapper only)</span>
  - (game-specific) Hercules (TODO) ❌
  - (game-specific) E-racer (TODO) ❌

* Image
  - Image Finder  (IN PROGRESS) ❌
  - Convert b8g8r8a8 (bgra8888) to r8b8g8a8 (rgba8888) (TODO) ❌
  - Convert r5g5b5p1 (rgb5551) to r8b8g8a8 (rgba888) (TODO) ❌
  - 3DS Swizzling/Twiddling ✔️
  - CMPR Swizzling/Twiddling ✔️
  - PS2 Swizzling/Twiddling ✔️
  - PSP Swizzling/Twiddling ✔️
  - PSVITA Swizzling/Twiddling ✔️
  - Switch Swizzling/Twiddling ✔️
  - XBOX Swizzling/Twiddling (Morton Order) ❌

* IO
  - File Reader ✔️
  - File Writer ✔️
  - Bytes Handler ✔️
  - Translation Text Handler ✔️
  - Mod Handler ✔️
  - File extension checking ✔️
  - Padding calculation ✔️
  - File size checking ✔️

# Checksum calculation - example

// CRC32 calculation
```
from reversebox.crc import crc32_iso_hdlc
from reversebox.common import common

test_data = b'123456789'
crc32_handler = crc32_iso_hdlc.CRC32Handler()
crc32 = crc32_handler.calculate_crc32(test_data)
print("CRC32_INT: ", crc32)
print("CRC32_STR: ", common.convert_int_to_hex_string(crc32))
```
// CRC32 output
```
CRC32_INT:  3421780262
CRC32_STR:  0xCBF43926
```


# XOR encryption - example

// XOR Cipher (Basic)
```
from reversebox.encryption.encryption_xor_basic import xor_cipher_basic


test_data = b'abcd'
test_key = b'\x3D'
xor_result = xor_cipher_basic(test_data, test_key)
print(xor_result)
```

// XOR Cipher output
```
b'\\_^Y'
```


# File Handler - example

// File reading
```
import os
from reversebox.io_files.file_handler import FileHandler


file_path = os.path.join(os.path.dirname(__file__), "file.bin")
file_reader = FileHandler(file_path, "rb")
file_reader.open()
value = file_reader.read_str(4, "utf8")
print(value)
```

// File Reader Output
```
ABCD
```


# Hash calculation - example

// SHA-1 calculation
```
from reversebox.hash.hash_sha1 import SHA1Handler

test_data = b'abcd'
sha1_handler = SHA1Handler()
sha1 = sha1_handler.calculate_sha1_hash(test_data)
print("SHA-1 hash: ", sha1)
```

// SHA-1 Output
```
SHA-1 hash:  b'\x81\xfe\x8b\xfe\x87Wl>\xcb"Bo\x8eW\x84s\x82\x91z\xcf'
```

# More Examples

Need more examples? <br>
Check out list of tools written using ReverseBox:
- [Giana's Return ZDA Tool](https://github.com/bartlomiejduda/Tools/blob/master/NEW%20Tools/Gianas%20Return/Gianas_Return_ZDA_Tool.py)
- [ObsCure 2 HVP Extractor](https://github.com/bartlomiejduda/Tools/blob/master/NEW%20Tools/ObsCure%202/ObsCure%202%20HVP%20Tools/Obscure_2_hvp_extractor.py)
- [Tail Concerto Translation Tools](https://github.com/bartlomiejduda/Tools/tree/master/NEW%20Tools/Tail%20Concerto/Tail%20Concerto%20Tools)
- [EA Graphics Manager](https://github.com/bartlomiejduda/EA-Graphics-Manager)
- and more...

            

Raw data

            {
    "_id": null,
    "home_page": "https://github.com/bartlomiejduda/ReverseBox",
    "name": "ReverseBox",
    "maintainer": null,
    "docs_url": null,
    "requires_python": ">=3.6",
    "maintainer_email": null,
    "keywords": "ReverseBox, reverse engineering, RE, CRC, Hash, Encryption, Compression, Checksum, Python",
    "author": "Bartlomiej Duda",
    "author_email": "ikskoks@gmail.com",
    "download_url": "https://files.pythonhosted.org/packages/0d/ae/bb62846616532eba334d2638fb3dcdc0b56584d0ba899a48611a02e1d375/ReverseBox-0.7.0.tar.gz",
    "platform": null,
    "description": "# Info\r\n\r\n**ReverseBox** is a Python package with a set of functions\r\nuseful in software reverse engineering.\r\n\r\n**Why ReverseBox?** <br>\r\nIt's designed to help with:\r\n1. Decompressing / compressing data\r\n2. Decrypting / encrypting data\r\n3. Tedious reverse engineering tasks\r\ne.g. testing different checksum algorithms to find the one that was\r\nused in the software or file format\r\n4. Figuring out file formats\r\n5. Parsing data structures\r\n6. Wrapping functions for input/output operations\r\n7. Searching for raw images\r\n\r\n**Who should use ReverseBox?** <br>\r\nMostly developers and reverse engineers (e.g. file format researchers\r\nor software researchers).\r\n\r\n# List of functionalities\r\n\r\n* Checksum\r\n  - Adler-32 \u2714\ufe0f\r\n  - BSD-16 \u2714\ufe0f\r\n  - Fletcher-16 \u2714\ufe0f\r\n  - Fletcher-32 \u2714\ufe0f\r\n\r\n* CRC\r\n  - CRC-8 \u2714\ufe0f\r\n  - CRC-8/CDMA2000 \u2714\ufe0f\r\n  - CRC-8/DARC \u2714\ufe0f <span style=\"color:yellow\">(wrapper only)</span>\r\n  - CRC-16 (ARC) \u2714\ufe0f\r\n  - CRC-16 (Modbus) \u2714\ufe0f\r\n  - CRC-16 (Sick) \u2714\ufe0f\r\n  - CRC-16 (DNP) \u2714\ufe0f\r\n  - CRC-16-CCITT (XModem) \u2714\ufe0f\r\n  - CRC-16-CCITT (0xFFFF) \u2714\ufe0f\r\n  - CRC-16-CCITT (0x1D0F) \u2714\ufe0f\r\n  - CRC-16-CCITT (Kermit) \u2714\ufe0f\r\n  - CRC-32 (ISO/HDLC) \u2714\ufe0f\r\n  - CRC-32 (Asobo) \u2714\ufe0f\r\n  - CRC-64 (Asobo) \u2714\ufe0f\r\n\r\n* Compression\r\n  - Asobo (TODO) \u274c\r\n  - BZE/BZZ (TODO) \u274c\r\n  - BZIP2 (TODO) \u274c\r\n  - GZIP (TODO) \u274c\r\n  - JCALG1 (TODO) \u274c\r\n  - LZMA (TODO) \u274c\r\n  - LZO / LZO1X \u2714\ufe0f <span style=\"color:yellow\">(wrapper only)</span>\r\n  - LZSS (TODO) \u274c\r\n  - NitroSDK (TODO) \u274c\r\n  - Oodle (TODO) \u274c\r\n  - Refpack (EA) (TODO) \u274c\r\n  - RNC (TODO) \u274c\r\n  - ZLIB \u2714\ufe0f <span style=\"color:yellow\">(wrapper only)</span>\r\n\r\n* Encryption\r\n  - AES (TODO) \u274c\r\n  - DES (TODO) \u274c\r\n  - Lucifer / DTD-1 (TODO) \u274c\r\n  - ROT13 \u2714\ufe0f\r\n  - XOR Cipher (Basic) \u2714\ufe0f\r\n  - XOR Cipher (Basic) Guesser \u2714\ufe0f\r\n  - (game-specific) XOR Cipher (Retro64 ECO) \u2714\ufe0f\r\n  - (game-specific) XOR Cipher (Giana\u2019s Return ZDA) \u2714\ufe0f\r\n\r\n* Hash\r\n  - FNV0-32 \u2714\ufe0f\r\n  - FNV0-64 \u2714\ufe0f\r\n  - FNV1-32 \u2714\ufe0f\r\n  - FNV1-64 \u2714\ufe0f\r\n  - FNV1A-32 \u2714\ufe0f\r\n  - FNV1A-64 \u2714\ufe0f\r\n  - SHA-1 \u2714\ufe0f <span style=\"color:yellow\">(wrapper only)</span>\r\n  - SHA-2 (256 bits) \u2714\ufe0f <span style=\"color:yellow\">(wrapper only)</span>\r\n  - MD2 \u2714\ufe0f <span style=\"color:yellow\">(wrapper only)</span>\r\n  - MD5 \u2714\ufe0f <span style=\"color:yellow\">(wrapper only)</span>\r\n  - (game-specific) Hercules (TODO) \u274c\r\n  - (game-specific) E-racer (TODO) \u274c\r\n\r\n* Image\r\n  - Image Finder  (IN PROGRESS) \u274c\r\n  - Convert b8g8r8a8 (bgra8888) to r8b8g8a8 (rgba8888) (TODO) \u274c\r\n  - Convert r5g5b5p1 (rgb5551) to r8b8g8a8 (rgba888) (TODO) \u274c\r\n  - 3DS Swizzling/Twiddling \u2714\ufe0f\r\n  - CMPR Swizzling/Twiddling \u2714\ufe0f\r\n  - PS2 Swizzling/Twiddling \u2714\ufe0f\r\n  - PSP Swizzling/Twiddling \u2714\ufe0f\r\n  - PSVITA Swizzling/Twiddling \u2714\ufe0f\r\n  - Switch Swizzling/Twiddling \u2714\ufe0f\r\n  - XBOX Swizzling/Twiddling (Morton Order) \u274c\r\n\r\n* IO\r\n  - File Reader \u2714\ufe0f\r\n  - File Writer \u2714\ufe0f\r\n  - Bytes Handler \u2714\ufe0f\r\n  - Translation Text Handler \u2714\ufe0f\r\n  - Mod Handler \u2714\ufe0f\r\n  - File extension checking \u2714\ufe0f\r\n  - Padding calculation \u2714\ufe0f\r\n  - File size checking \u2714\ufe0f\r\n\r\n# Checksum calculation - example\r\n\r\n// CRC32 calculation\r\n```\r\nfrom reversebox.crc import crc32_iso_hdlc\r\nfrom reversebox.common import common\r\n\r\ntest_data = b'123456789'\r\ncrc32_handler = crc32_iso_hdlc.CRC32Handler()\r\ncrc32 = crc32_handler.calculate_crc32(test_data)\r\nprint(\"CRC32_INT: \", crc32)\r\nprint(\"CRC32_STR: \", common.convert_int_to_hex_string(crc32))\r\n```\r\n// CRC32 output\r\n```\r\nCRC32_INT:  3421780262\r\nCRC32_STR:  0xCBF43926\r\n```\r\n\r\n\r\n# XOR encryption - example\r\n\r\n// XOR Cipher (Basic)\r\n```\r\nfrom reversebox.encryption.encryption_xor_basic import xor_cipher_basic\r\n\r\n\r\ntest_data = b'abcd'\r\ntest_key = b'\\x3D'\r\nxor_result = xor_cipher_basic(test_data, test_key)\r\nprint(xor_result)\r\n```\r\n\r\n// XOR Cipher output\r\n```\r\nb'\\\\_^Y'\r\n```\r\n\r\n\r\n# File Handler - example\r\n\r\n// File reading\r\n```\r\nimport os\r\nfrom reversebox.io_files.file_handler import FileHandler\r\n\r\n\r\nfile_path = os.path.join(os.path.dirname(__file__), \"file.bin\")\r\nfile_reader = FileHandler(file_path, \"rb\")\r\nfile_reader.open()\r\nvalue = file_reader.read_str(4, \"utf8\")\r\nprint(value)\r\n```\r\n\r\n// File Reader Output\r\n```\r\nABCD\r\n```\r\n\r\n\r\n# Hash calculation - example\r\n\r\n// SHA-1 calculation\r\n```\r\nfrom reversebox.hash.hash_sha1 import SHA1Handler\r\n\r\ntest_data = b'abcd'\r\nsha1_handler = SHA1Handler()\r\nsha1 = sha1_handler.calculate_sha1_hash(test_data)\r\nprint(\"SHA-1 hash: \", sha1)\r\n```\r\n\r\n// SHA-1 Output\r\n```\r\nSHA-1 hash:  b'\\x81\\xfe\\x8b\\xfe\\x87Wl>\\xcb\"Bo\\x8eW\\x84s\\x82\\x91z\\xcf'\r\n```\r\n\r\n# More Examples\r\n\r\nNeed more examples? <br>\r\nCheck out list of tools written using ReverseBox:\r\n- [Giana's Return ZDA Tool](https://github.com/bartlomiejduda/Tools/blob/master/NEW%20Tools/Gianas%20Return/Gianas_Return_ZDA_Tool.py)\r\n- [ObsCure 2 HVP Extractor](https://github.com/bartlomiejduda/Tools/blob/master/NEW%20Tools/ObsCure%202/ObsCure%202%20HVP%20Tools/Obscure_2_hvp_extractor.py)\r\n- [Tail Concerto Translation Tools](https://github.com/bartlomiejduda/Tools/tree/master/NEW%20Tools/Tail%20Concerto/Tail%20Concerto%20Tools)\r\n- [EA Graphics Manager](https://github.com/bartlomiejduda/EA-Graphics-Manager)\r\n- and more...\r\n",
    "bugtrack_url": null,
    "license": null,
    "summary": "A set of functions useful in reverse engineering.",
    "version": "0.7.0",
    "project_urls": {
        "Homepage": "https://github.com/bartlomiejduda/ReverseBox"
    },
    "split_keywords": [
        "reversebox",
        " reverse engineering",
        " re",
        " crc",
        " hash",
        " encryption",
        " compression",
        " checksum",
        " python"
    ],
    "urls": [
        {
            "comment_text": "",
            "digests": {
                "blake2b_256": "0daebb62846616532eba334d2638fb3dcdc0b56584d0ba899a48611a02e1d375",
                "md5": "59669d244a51c9fea7aa8ad683999b52",
                "sha256": "edcc83c74c35125c5ab185ff3c72f7cb672ebb61261b017043b33b397606180c"
            },
            "downloads": -1,
            "filename": "ReverseBox-0.7.0.tar.gz",
            "has_sig": false,
            "md5_digest": "59669d244a51c9fea7aa8ad683999b52",
            "packagetype": "sdist",
            "python_version": "source",
            "requires_python": ">=3.6",
            "size": 41925,
            "upload_time": "2024-04-14T22:12:51",
            "upload_time_iso_8601": "2024-04-14T22:12:51.068713Z",
            "url": "https://files.pythonhosted.org/packages/0d/ae/bb62846616532eba334d2638fb3dcdc0b56584d0ba899a48611a02e1d375/ReverseBox-0.7.0.tar.gz",
            "yanked": false,
            "yanked_reason": null
        }
    ],
    "upload_time": "2024-04-14 22:12:51",
    "github": true,
    "gitlab": false,
    "bitbucket": false,
    "codeberg": false,
    "github_user": "bartlomiejduda",
    "github_project": "ReverseBox",
    "travis_ci": false,
    "coveralls": false,
    "github_actions": false,
    "requirements": [
        {
            "name": "bitstring",
            "specs": [
                [
                    "==",
                    "4.0.2"
                ]
            ]
        },
        {
            "name": "black",
            "specs": [
                [
                    "==",
                    "22.3.0"
                ]
            ]
        },
        {
            "name": "center_tk_window",
            "specs": [
                [
                    "==",
                    "1.0.0"
                ]
            ]
        },
        {
            "name": "crc",
            "specs": [
                [
                    "==",
                    "4.3.0"
                ]
            ]
        },
        {
            "name": "faker",
            "specs": [
                [
                    "==",
                    "13.13.0"
                ]
            ]
        },
        {
            "name": "hashbase",
            "specs": [
                [
                    "==",
                    "1.1.5"
                ]
            ]
        },
        {
            "name": "lzokay",
            "specs": [
                [
                    "==",
                    "1.1.2"
                ]
            ]
        },
        {
            "name": "mypy",
            "specs": [
                [
                    "==",
                    "0.960"
                ]
            ]
        },
        {
            "name": "numpy",
            "specs": [
                [
                    "==",
                    "1.25.1"
                ]
            ]
        },
        {
            "name": "Pillow",
            "specs": [
                [
                    "==",
                    "9.3.0"
                ]
            ]
        },
        {
            "name": "polib",
            "specs": [
                [
                    "==",
                    "1.2.0"
                ]
            ]
        },
        {
            "name": "pre-commit",
            "specs": [
                [
                    "==",
                    "2.20.0"
                ]
            ]
        },
        {
            "name": "pylint",
            "specs": [
                [
                    "==",
                    "2.14.0"
                ]
            ]
        },
        {
            "name": "pytest",
            "specs": [
                [
                    "==",
                    "7.1.2"
                ]
            ]
        },
        {
            "name": "setuptools",
            "specs": [
                [
                    "==",
                    "68.2.2"
                ]
            ]
        },
        {
            "name": "twine",
            "specs": [
                [
                    "==",
                    "4.0.1"
                ]
            ]
        },
        {
            "name": "types-setuptools",
            "specs": [
                [
                    "==",
                    "63.2.0"
                ]
            ]
        }
    ],
    "lcname": "reversebox"
}
        
Elapsed time: 0.24862s