expdevBadChars
expdevBadChars copied to clipboard
Getting a bunch of errors when using the tool
Hello, this is the command syntax I am using and the error I am getting:
dev@ubuntu:~/Desktop/exp/expdevBadChars$ python3 ./badchars.py allchars.txt stack.txt
:: BadChars.py (v:0.4) - Exploit Development Bad Characters hunting tool.
Equipped with Corelan.be Mona's buffers comparison LCS-based algorithm
Traceback (most recent call last):
File "./badchars.py", line 1063, in <module>
sys.exit(main(sys.argv))
File "./badchars.py", line 977, in main
buffers[0].extend(fetch_file(filenames[0], 'good_buffer', options.format1))
File "./badchars.py", line 871, in fetch_file
b = BytesParser(buff, name, format)
File "./badchars.py", line 132, in __init__
self.recognize_format()
File "./badchars.py", line 186, in recognize_format
if not all(c in string.printable for c in self.input):
File "./badchars.py", line 186, in <genexpr>
if not all(c in string.printable for c in self.input):
TypeError: 'in <string>' requires string as left operand, not int
Am I missing something? Thanks.
Hi!
Thanks for reporting the bug. Can you show a minimized, anonymized excerpt of both of your input files?
Regards, Mariusz
hello,
I am comparing GDB's stack view to a file containing all chars:
file1:
0xbfffee50: 0x04030201 0x08070605 0xbfffef00 0x00400533
0xbfffee60: 0xb7fe7970 0xbfffee80 0x00000000 0xb7df6fa1
0xbfffee70: 0xb7fb6000 0xb7fb6000 0x00000000 0xb7df6fa1
0xbfffee80: 0x00000004 0xbfffef14 0xbfffef28 0xbfffeea4
0xbfffee90: 0x00000004 0xbfffef14 0xb7fb6000 0xb7fe771a
0xbfffeea0: 0xbfffef10 0x00000000 0xb7fb6000 0x00000000
0xbfffeeb0: 0x00000000 0xf54c7305 0xb44fb515 0x00000000
0xbfffeec0: 0x00000000 0x00000000 0x00000040 0xb7fff024
0xbfffeed0: 0x00000000 0x00000000 0xb7fe7829 0x00401fd8
0xbfffeee0: 0x00000004 0x004003e0 0x00000000 0x00400411
0xbfffeef0: 0x0040051d 0x00000004 0xbfffef14 0x004005a0
0xbfffef00: 0x00400600 0xb7fe7970 0xbfffef0c 0xb7fff940
0xbfffef10: 0x00000004 0xbffff0e6 0xbffff107 0xbffff220
0xbfffef20: 0xbffff236 0x00000000 0xbffff316 0xbffff32c
0xbfffef30: 0xbffff918 0xbffff93a 0xbffff951 0xbffff960
0xbfffef40: 0xbffff971 0xbffff97c 0xbffff9a8 0xbffff9c8
0xbfffef50: 0xbffff9e7 0xbffff9fb 0xbffffa08 0xbffffa13
0xbfffef60: 0xbffffa3c 0xbffffa72 0xbffffa83 0xbffffa8c
0xbfffef70: 0xbffffaa3 0xbffffab5 0xbffffad6 0xbffffb2c
0xbfffef80: 0xbffffb5f 0xbffffb80 0xbffffb9a 0xbffffba3
0xbfffef90: 0xbffffbb2 0xbffffbc7 0xbffffbda 0xbffffbed
0xbfffefa0: 0xbffffc02 0xbffffc57 0xbffffc72 0xbffffc8a
0xbfffefb0: 0xbffffca6 0xbffffcb2 0xbffffcbf 0xbffffcd0
0xbfffefc0: 0xbffffce0 0xbffffcf4 0xbffffd06 0xbffffd1a
0xbfffefd0: 0xbffffd2c 0xbffffd4d 0xbffffd81 0xbffffd9e
0xbfffefe0: 0xbffffda6 0xbffffdb5 0xbffffdc7 0xbffffdf3
0xbfffeff0: 0xbffffdff 0xbffffe35 0xbffffe54 0xbffffe7d
0xbffff000: 0xbffffeaa 0xbfffff35 0xbfffff56 0xbfffffa8
0xbffff010: 0xbfffffc8 0x00000000 0x00000020 0xb7fd6d00
0xbffff020: 0x00000021 0xb7fd6000 0x00000010 0x178bfbff
0xbffff030: 0x00000006 0x00001000 0x00000011 0x00000064
0xbffff040: 0x00000003 0x00400034 0x00000004 0x00000020
0xbffff050: 0x00000005 0x00000009 0x00000007 0xb7fd8000
0xbffff060: 0x00000008 0x00000000 0x00000009 0x004003e0
0xbffff070: 0x0000000b 0x000003e8 0x0000000c 0x000003e8
0xbffff080: 0x0000000d 0x000003e8 0x0000000e 0x000003e8
0xbffff090: 0x00000017 0x00000000 0x00000019 0xbffff0cb
0xbffff0a0: 0x0000001a 0x00000000 0x0000001f 0xbfffffdb
0xbffff0b0: 0x0000000f 0xbffff0db 0x00000000 0x00000000
0xbffff0c0: 0x00000000 0x00000000 0x45000000 0xb9d1b868
0xbffff0d0: 0x223d0548 0x45ecee36 0x69014383 0x00363836
0xbffff0e0: 0x00000000 0x682f0000 0x2f656d6f 0x2f766564
0xbffff0f0: 0x6b736544 0x2f706f74 0x2f707865 0x6e6c7576
0xbffff100: 0x62617265 0x4100656c 0x41414141 0x41414141
0xbffff110: 0x41414141 0x41414141 0x41414141 0x41414141
0xbffff120: 0x41414141 0x41414141 0x41414141 0x41414141
0xbffff130: 0x41414141 0x41414141 0x41414141 0x41414141
0xbffff140: 0x41414141 0x41414141 0x41414141 0x41414141
0xbffff150: 0x41414141 0x41414141 0x41414141 0x41414141
0xbffff160: 0x41414141 0x41414141 0x41414141 0x41414141
0xbffff170: 0x41414141 0x41414141 0x41414141 0x41414141
0xbffff180: 0x41414141 0x41414141 0x41414141 0x41414141
0xbffff190: 0x41414141 0x41414141 0x41414141 0x41414141
0xbffff1a0: 0x41414141 0x41414141 0x41414141 0x41414141
0xbffff1b0: 0x41414141 0x41414141 0x41414141 0x41414141
0xbffff1c0: 0x41414141 0x41414141 0x41414141 0x41414141
0xbffff1d0: 0x41414141 0x41414141 0x41414141 0x41414141
0xbffff1e0: 0x41414141 0x41414141 0x41414141 0x41414141
0xbffff1f0: 0x41414141 0x41414141 0x41414141 0x41414141
0xbffff200: 0x41414141 0x41414141 0x41414141 0x41414141
0xbffff210: 0x42414141 0x01424242 0x05040302 0x00080706
0xbffff220: 0x0e0d0c0b 0x1211100f 0x16151413 0x1a191817
0xbffff230: 0x1e1d1c1b 0x2221001f 0x26252423 0x2a292827
0xbffff240: 0x2e2d2c2b 0x3231302f 0x36353433
file2:
\x00\x01\x02\x03\x04\x05\x06\x07\x08\x09\x0a\x0b\x0c\x0d\x0e\x0f\x10\x11\x12\x13\x14\x15\x16\x17\x18\x19\x1a\x1b\x1c\x1d\x1e\x1f\x20\x21\x22\x23\x24\x25\x26\x27\x28\x29\x2a\x2b\x2c\x2d\x2e\x2f\x30\x31\x32\x33\x34\x35\x36\x37\x38\x39\x3a\x3b\x3c\x3d\x3e\x3f\x40\x41\x42\x43\x44\x45\x46\x47\x48\x49\x4a\x4b\x4c\x4d\x4e\x4f\x50\x51\x52\x53\x54\x55\x56\x57\x58\x59\x5a\x5b\x5c\x5d\x5e\x5f\x60\x61\x62\x63\x64\x65\x66\x67\x68\x69\x6a\x6b\x6c\x6d\x6e\x6f\x70\x71\x72\x73\x74\x75\x76\x77\x78\x79\x7a\x7b\x7c\x7d\x7e\x7f\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
Am I missing something?
Hey! Just pushed the fix for your issue. Let me know if it problem remains :)
Regards, Mariusz.
hey there, thanks a a lot! I've tried the new versions, it still spits out errors but now it shows the green lines about recognizing the files' formats

Hi!
Sorry it took me so long to address your issue. I'm crazily busy lately.
Can you please try now? I've attempted to fix this issue in commit e86dd25e.