shc
shc copied to clipboard
I lost my shell script but have my C Code can i reverse it.
compile the c code, run it and get the source (to know how you may do a bit google search)
As long as your script takes a little bit to run, you can easily dump the code with something like this: ./shctest.bin & PID=$!; sleep 0.2; ps -wwq $PID -o cmd= | sed -E 's/-c \s+(#!)/\1/'
Basically it will run it in the background, wait 200ms to make sure the wrapper has done the call to exec
, then find the full command in the process list and trim away the million spaces it adds to pretend that the code is not there. You'll have to add in the newlines again manually. There are probably more ways still to reverse it in a more readable form, but it's a way to do it.