Created
August 31, 2017 02:33
-
-
Save multiplex3r/468eb3d277317ac0c2a868281fe66c5c to your computer and use it in GitHub Desktop.
Shellcode encoder
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 | |
def chunks(l, n): | |
for i in range(0, len(l), n): | |
yield l[i:i + n] | |
shellcode = "your" | |
shellcode += "shellcode" | |
shellcode += "here" | |
key = [] | |
key.append(0xDE) | |
key.append(0xAD) | |
key.append(0xBE) | |
key.append(0xEF) | |
out = [] | |
for i in range(0, len(shellcode)): | |
b1 = ord(shellcode[i]) ^ key[i % 4] | |
out.append(b1) | |
for line in chunks(out, 16): | |
b = ''.join(["\\x{0:02x}".format(c) for c in line]) | |
sys.stdout.write('\n"{0}"'.format(b)) | |
sys.stdout.write(';\n') | |
sys.stdout.flush() |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment