Shell Compiler
Shell compiler source code can be found at this repo https://github.com/neurobin/shc.
You may need to read the README.md at their repo carefully .
Quick Start
A quickstart for usage the shc
a.k.a shell compiler from me:
Build from source using GitHub codespace
Go to github codespace https://github.com/codespaces and create new, or you may go to https://github.com/neurobin/shc and select create codespace.
Then input this command to configure.
|
|
Create simple file named as test.sh
:
|
|
Then use shc
with this command :
|
|
We got two file, test.sh.x
and test.sh.c
, for now while type this article, i dont know at much what is test.sh.c
file for.
Lets chmod for allow executing the binary.
|
|
Then execute the binary :
|
|
Sample output :
|
|
Trying to read the file with cat ./test.sh.x | head -n 2
:
|
|
Then using file test.sh.x
:
|
|
Deobfuscate / Decompile
Found how to decompile the binary from https://github.com/neurobin/shc/issues/99.
Quick Start
Lets try the quickstart from me using this snippet :
|
|
At this point, we got new modified ./bash
file, now move this bash file to the system :
|
|
Dont worry, your original bash is backup to /bin/bash.bak
, I dont need told you about this.
Now we try to deobfuscate ./test.sh.x
files :
|
|
And result is failed to deobfuscate ( -_- ).
It seems the shc update their code, shxdumper doesnt work again.
I have another trick to show the running code from process, while you run a shx code, you can see the source with ps -aux | grep ./test.sh.x
the code is showing in process list, but you cant see again if process already killed, thats all I know.
I wont write much more because I’m boring and this blog is for my personal note.