DanMcInerney / net-creds

Sniffs sensitive data from interface or pcap
GNU General Public License v3.0
1.7k stars 438 forks source link

Crash decoding incomplete base64 #14

Closed sha0coder closed 9 years ago

sha0coder commented 9 years ago

The incorrect base64 padding exception must be controlled, for avoiding crashes:

POST load: Traceback (most recent call last): File "./net-creds.py", line 995, in main(parse_args()) File "./net-creds.py", line 972, in main pkt_parser(pkt) File "./net-creds.py", line 195, in pkt_parser other_parser(src_ip_port, dst_ip_port, full_load, ack, seq, pkt, parse_args().verbose) File "./net-creds.py", line 644, in other_parser parse_basic_auth(src_ip_port, dst_ip_port, headers, authorization_header) File "./net-creds.py", line 689, in parse_basic_auth basic_auth_creds = base64.decodestring(basic_auth_b64) File "/usr/lib/python2.7/base64.py", line 321, in decodestring return binascii.a2b_base64(s) binascii.Error: Incorrect padding

DanMcInerney commented 9 years ago

Great, thanks for the work. I will try to fix this probably with a simple try/except in the near future.

DanMcInerney commented 9 years ago

Fixed with a try/except on line 689.