-
-
Save 0x4243/1f43ce4a4a0afbc573e269887abb2f72 to your computer and use it in GitHub Desktop.
Convert bin to shellcode.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/env python | |
import sys | |
if __name__ == "__main__": | |
if len(sys.argv) < 2: | |
print "usage: %s file.bin\n" % (sys.argv[0],) | |
sys.exit(0) | |
shellcode = "\"" | |
ctr = 1 | |
maxlen = 15 | |
for b in open(sys.argv[1], "rb").read(): | |
shellcode += "\\x" + b.encode("hex") | |
if ctr == maxlen: | |
shellcode += "\" +\n\"" | |
ctr = 0 | |
ctr += 1 | |
shellcode += "\"" | |
print shellcode |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment