forked from NullMode/code-snippets-python
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy patheip_ascii_reverse.py
More file actions
41 lines (28 loc) · 758 Bytes
/
eip_ascii_reverse.py
File metadata and controls
41 lines (28 loc) · 758 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
#!/usr/bin/python
# Author: NullMode
# Description: Takes overwritten EIP value, changes to ASCII, reverses it, spits it out (doesn't swallow)
from sys import argv, exit, stdout
def usage():
print "[!] ./eipoffset.py <EIP VALUE>"
print "This function will take the EIP value, convert it to ASCII, then reverse it."
def err(msg):
print "[!] " + msg
try:
script, eip = argv
except ValueError:
usage()
exit(1)
if len(eip) != 8:
err("EIP wrong length, check your input value.")
exit(1)
try:
eip = eip.decode("hex")
except TypeError:
err("Error converting, check the value to make sure it's hex.")
exit(1)
eip_list = [i for i in eip]
eip_list.reverse()
for i in eip_list:
stdout.write(i)
print
exit(0)