Skip to content

gaidardzhiev/bundle

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

23 Commits
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

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.

About

A self extracting archive generator that reads files and emits a POSIX shell script which, when executed, reconstructs the originals byte for byte.

Topics

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

 
 
 

Contributors