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.
- Identifier mutation: Every function, variable, and macro name is meaningless junk;
mainis now a trampoline intom0xF1aB. - 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
switchdriven state machine loop; conventionalif/whilelogic 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:
- One time decode step rebuilds key and message tables, rotates them back, then XOR decrypts to get usable strings.
- 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.
- Verify with
make clobber,make, and./try.shor manually; the generated bundle faithfully reproduces the files byte for byte against the originals.