mirror of
https://github.com/VoidSec/Exploit-Development
synced 2026-06-08 12:50:18 +00:00
8ffd068080
will help find gadgets that does not contains bad chars
31 lines
1.1 KiB
Python
31 lines
1.1 KiB
Python
import struct, re
|
|
|
|
f = open("rop.txt", "r")
|
|
content = f.read()
|
|
f.close()
|
|
bchars=["00","0a","0d","83","85","87","88","89","8a","8b","8c","8e","91","95","96","97","9b","9f","b7","bb","bc","bf","c0","c1","c3","c4","c7","c8","c9","ca","cc","cd","ce","cf","d0","d1","d2","d3","d4","d5","d6","d7","d8","d9","da","db","dc","dd","de","df","e0","e1","e3","e4","e5","e6","e7","e8","e9","ea","eb","ec","ed","ee","ef","f0","f1","f2","f3","f4","f5","f6","f7","f8","f9","fa","fb","fc","fd","fe","ff"]
|
|
|
|
matches = re.findall(r"0x[0-9a-f]{8} :", content)
|
|
|
|
m_final = []
|
|
for match in matches:
|
|
m_clean = match.replace(":","").rstrip()
|
|
m_final.append(m_clean)
|
|
|
|
good_addr = []
|
|
for addr in m_final:
|
|
flag=True
|
|
for bad in bchars:
|
|
for index in range(0, len(addr), 2):
|
|
if str(bad) in str(addr[index : index + 2]):
|
|
flag=False
|
|
break
|
|
if flag == True:
|
|
good_addr.append(addr)
|
|
|
|
clean = open("rop_clean.txt", "w")
|
|
rop = open("rop.txt", "r")
|
|
for line in rop:
|
|
for item in good_addr:
|
|
if str(item) in str(line):
|
|
clean.write(line) |