Metadata-Version: 2.4
Name: exe2jar
Version: 0.1.0
Summary: Recover JAR files and launcher metadata from Java application EXEs.
Project-URL: Homepage, https://github.com/cnfatal/exe2jar
Project-URL: Repository, https://github.com/cnfatal/exe2jar
Project-URL: Issues, https://github.com/cnfatal/exe2jar/issues
Author-email: cnfatal <cnfatal@gmail.com>
License-Expression: MIT
License-File: LICENSE
Keywords: exe2jar,exe4j,install4j,jar2exe,java,reverse-engineering
Classifier: Development Status :: 3 - Alpha
Classifier: Environment :: Console
Classifier: Intended Audience :: Developers
Classifier: License :: OSI Approved :: MIT License
Classifier: Operating System :: OS Independent
Classifier: Programming Language :: Python :: 3
Classifier: Programming Language :: Python :: 3 :: Only
Classifier: Programming Language :: Python :: 3.10
Classifier: Programming Language :: Python :: 3.11
Classifier: Programming Language :: Python :: 3.12
Classifier: Programming Language :: Python :: 3.13
Classifier: Topic :: Software Development :: Build Tools
Classifier: Topic :: Utilities
Requires-Python: >=3.10
Requires-Dist: pycryptodomex>=3.20
Description-Content-Type: text/markdown

# exe2jar

Recover `.jar` files and launcher metadata from Java application `.exe` files.

`exe2jar` unpacks Jar2Exe and install4j/exe4j Windows launchers into usable
`.jar` files and restore metadata.

## Features

| `.exe` Type     | Restore | Rebuild |
| --------------- | ------- | ------- |
| Jar2Exe         | ✅      | ✅      |
| install4j/exe4j | ✅      | ❓      |
| launch4j        | ❓      | ❓      |

- Restore: unpack the `.exe` into `.jar` files and launcher information.
- Rebuild: create a new `.exe` from an existing `.exe` and a replacement `.jar`.

## Usage

Install from PyPI:

```bash
pip install exe2jar
```

Inspect an `.exe`:

```console
$ exe2jar inspect game.exe
path: game.exe
format: Jar2Exe
size: 7,896,046
config: offset=0x76ea00 size=117
tail_loader: offset=0x76ea89 size=102,757 digest=fc92cddf7ff10154eb3bf5f5aa8a538b
rc_data: offset=0x7d828 size=7,277,729 mode=l3
serial: 000102757t2845x
mainclass: com.riot.main.Main
jre_order: bcsie
jre: ./bin/
libs: bin/lib/libs
app_jar: size=3,412,924 entries=1,901
```

Restore `.jar` files:

```console
$ exe2jar restore game.exe
[restore] mode=l3 entries=1901
[restore] L3 AES entry decrypt: 1900
[restore] classes: 1841
[restore] protected classes (J2EMAP): 57
[restore] resources: 2
[restore] restored jar: game_restored/app.jar
[restore] map:          game_restored/restore-map.json

$ ls game_restored
app.jar
jar2exe-config.json
restore-map.json
```

Restore outputs:

- `app.jar`: the recovered application jar.
- `jar2exe-config.json`: the parsed Jar2Exe launcher configuration.
- `restore-map.json`: class and resource name recovery metadata.

Rebuild a Jar2Exe `.exe` with a replacement `.jar`:

```console
$ exe2jar rebuild game.exe game_restored/app.jar -o game_mod.exe
[build] repacked app.jar entries to Jar2Exe hash names: 1,901
[build] prepared app.jar: 3,411,574 bytes
[build] encrypted jar: 3,411,574 bytes (mode=l3)
[build] digest: 2cf193e28fc3f9dd70760d60d3ba941d
[build] output: game_mod.exe (4,029,934 bytes)

$ ls game_mod.exe
game_mod.exe
```

## Development

```bash
uv sync --group dev
uv run python -m unittest discover -s tests
uv build --no-sources
```

## Disclaimer

`exe2jar` is intended for research and authorized analysis only. Do not use it
to violate software licenses, bypass access controls, or redistribute
proprietary application files without permission. You are responsible for
complying with applicable laws and license terms.

## License

MIT
