https://github.com/gaidardzhiev/bundle
A self extracting archive generator that reads files and emits a POSIX shell script which, when executed, reconstructs the originals byte for byte.
https://github.com/gaidardzhiev/bundle
archiver ioccc obfuscated posix self-extracting-script shell
Last synced: 20 days ago
JSON representation
A self extracting archive generator that reads files and emits a POSIX shell script which, when executed, reconstructs the originals byte for byte.
- Host: GitHub
- URL: https://github.com/gaidardzhiev/bundle
- Owner: gaidardzhiev
- License: gpl-3.0
- Created: 2026-02-21T17:33:47.000Z (4 months ago)
- Default Branch: main
- Last Pushed: 2026-06-07T09:10:33.000Z (24 days ago)
- Last Synced: 2026-06-07T09:21:38.866Z (24 days ago)
- Topics: archiver, ioccc, obfuscated, posix, self-extracting-script, shell
- Language: Shell
- Homepage:
- Size: 40 KB
- Stars: 0
- Watchers: 0
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: readme.md
- License: COPYING
Awesome Lists containing this project
README
### BUNDLE
This program reads one or more files from the command line and emits a self extracting POSIX shell script that, when executed, reconstructs the input files with their original contents intact.
It functions as a bundle generator, embedding file contents within executable archives that restore originals upon execution.
### Obfuscation layers (applied cumulatively)
- Identifier mutation: Every function, variable, and macro name is meaningless junk; `main` is now a trampoline into `m0xF1aB`.
- Encrypted strings: All human readable text is XORed with a key; the key and ciphertexts themselves are stored base64 encoded after a rotate right by 3 on each byte, then decoded and decrypted once at startup.
- Control flow flattening: The entire program runs as a single `switch` driven state machine loop; conventional `if`/`while` logic is replaced with explicit state transitions plus opaque predicates to obscure reachability.
- Data obfuscation: Buffer sizes are defined via bit soup macros; constants are assembled from split bitfields. A hidden, unreachable state contains a secret signature as an Easter egg.
- Macro layer: Macros wrap flow keywords (`LOOP`, `SWITCH`, `CASE`, `NEXT`, `RET`) and inject a red herring XOR macro (`A/B`) plus unused predicate scaffolding (`Z`, `W`, `PRED`) to complicate static reading.
Runtime flow:
1) One time decode step rebuilds key and message tables, rotates them back, then XOR decrypts to get usable strings.
2) State machine path:
- States 0–3: argument count check, usage print, optional self shebang replay, exit.
- States 4–13: emit shell header, iterate inputs, emit here doc wrappers, stream file bytes, close docs; missing files trigger a decrypted warning; the hidden unreachable 13th state contains the Easter egg code.
### Testing
- Verify with `make clobber`, `make`, and `./try.sh` or manually; the generated bundle faithfully reproduces the files byte for byte against the originals.