Prevent accidental execution of binaries by prepending a "unique header" to the binary.
- Python3
- Prepend "deadcafe" to binaries in a specific directory.
./safeheader.py --patch --dir ./test_bins/\*
./safeheader.py -p -d ./test_bins/\*
Note, you must specify an extension or add '' to prepend a header to all files.*
- Remove "deadcafe" from binaries in a specific directory.
./safeheader.py --rm --dir test_bins/\*
Executing python -m unittest
should result in
.[+] Successfully patched ./test_bins/test.bin with header b'\xde\xad\xca\xfe'
.[!] Error, you cannot remove and patch the magicheader!
.[!] Error, you cannot remove and patch the magicheader!
.[!] Magic header has already been removed
.
----------------------------------------------------------------------
Ran 4 tests in 0.004s
OK
If anything else is produced, please create an issue.