Created
June 22, 2012 09:07
-
-
Save damoxc/2971524 to your computer and use it in GitHub Desktop.
Naive BEAST vulnerability checker
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import ssl | |
import socket | |
import argparse | |
PASS = '\033[92m' | |
FAIL = '\033[91m' | |
ENDC = '\033[0m' | |
parser = argparse.ArgumentParser() | |
parser.add_argument('hostname', type=str, action='store') | |
parser.add_argument('port', type=int, action='store', nargs='?', default=443) | |
args = parser.parse_args() | |
print '=' * 80 | |
print 'SSL/TLS BEAST Vulnerability checker' | |
print '=' * 80 + '\n' | |
print 'Target: %s:%d' % (args.hostname, args.port) | |
s = socket.socket() | |
s.connect((args.hostname, args.port)) | |
ss = ssl.wrap_socket(s) | |
cipher, sslver, bitlen = ss.cipher() | |
if 'RC4' in cipher: | |
msg = PASS + 'NOT vulnerable to BEAST attack' + ENDC | |
vuln = PASS + 'NO' + ENDC | |
else: | |
msg = FAIL + 'PRONE to BEAST attack.' + ENDC | |
vuln = FAIL + 'YES' + ENDC | |
print '\n## %s ##\n' % msg | |
print 'Protocol: %s' % sslver | |
print 'Preferred Cipher: %s' % cipher | |
print 'Vulnerable: %s' % vuln |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
cool code. still useful after all these years.