Ship your shell script as executable binary!
This tool doesn't need additional tools like compilers or assemblers to generate a binary.
The generated binary invokes the system
function to execute the specified script. Keep in mind that some anti-malware software may flag binaries due to this behavior.
The generated binary uses the execve
syscall to execute the specified shell script, calling /bin/bash
to run the script.
Note that you can cross-compile your script, allowing you to compile a Bash script for Linux while using Windows, for example.
$ shellbin -s "echo testing for windows! && ping bun.rip" -o output.exe -t windows
Successfully wrote 16384 bytes to: output.exe
$ .\output.exe
testing for windows!
Pinging bun.rip [104.21.28.78] with 32 bytes of data:
Reply from 104.21.28.78: bytes=32 time=64ms TTL=48
Reply from 104.21.28.78: bytes=32 time=66ms TTL=48
Reply from 104.21.28.78: bytes=32 time=70ms TTL=48
Reply from 104.21.28.78: bytes=32 time=63ms TTL=48
Ping statistics for 104.21.28.78:
Packets: Sent = 4, Received = 4, Lost = 0 (0% loss),
Approximate round trip times in milli-seconds:
Minimum = 63ms, Maximum = 70ms, Average = 65ms
$ shellbin -s "echo testing for linux! && dir" -o output -t linux-amd64
Successfully wrote 288 bytes to: output
$ ./output
testing for linux!
Cargo.lock Cargo.toml LICENSE README.md output src target testing
ShellBin is licensed under the MIT license.