Skip to content

Instantly share code, notes, and snippets.

@dkmonaghan
Last active January 15, 2021 17:59
Show Gist options
  • Save dkmonaghan/0c792028c6cbc711a92425a7301bc860 to your computer and use it in GitHub Desktop.
Save dkmonaghan/0c792028c6cbc711a92425a7301bc860 to your computer and use it in GitHub Desktop.
Searches a given network range for the now revoked QuoVadis Global SSL ICA G3 intermediate certificate and reports a list of hosts still presenting the old Intermediate
#!/usr/bin/python3
import ipaddress
import subprocess
import socket
import sys
import multiprocessing
bad_quo = "8W8hdONuKKpe9zKedhBFAvuxhDgKmnySglYc"
# Replace with your IP ranges!
ranges = ["355.355.355.0/24", "355.355.355.0/24"]
def check_host(ip):
p = subprocess.Popen(["timeout", "3", "openssl", "s_client", "-showcerts",
"-connect", ip + ":443"],
stdin=subprocess.PIPE,
stdout=subprocess.PIPE,
stderr=subprocess.PIPE)
result = str(p.communicate()).strip("\\\n")
if bad_quo in result:
f = open("QuoFound.txt", "a")
ptr, alias, sock = socket.gethostbyaddr(ip)
f.write("%s - %s\n" % (ptr, ip))
f.close()
print("%s - %s\n" % (ptr, ip))
return True
return False
ips = []
for range in ranges:
for ip in ipaddress.IPv4Network(range):
ips.append(str(ip))
pool = multiprocessing.Pool(100)
pool.map(check_host, ips)
pool.terminate()
@ripline
Copy link

ripline commented Jan 15, 2021

Hi, I get the following error :-/ Can you point me at what I'm missing (yes, I have configured my address range, I think, correctly). Ta.

Traceback (most recent call last):
File "./QuoSearch.py", line 33, in
ips.append(str(ip))
NameError: name 'ips' is not defined

@dkmonaghan
Copy link
Author

dkmonaghan commented Jan 15, 2021

Hi, I get the following error :-/ Can you point me at what I'm missing (yes, I have configured my address range, I think, correctly). Ta.

Traceback (most recent call last):
File "./QuoSearch.py", line 33, in
ips.append(str(ip))
NameError: name 'ips' is not defined

Sorry - I was tidying up the script on GitHub and didn't test my changes! Have updated with a fix and tested - try again now.

Cheers.

@ripline
Copy link

ripline commented Jan 15, 2021

Cheers, will give that a try shortly :)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment