Skip to content

Instantly share code, notes, and snippets.

@DoMINAToR98
Created July 2, 2019 11:19
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save DoMINAToR98/df324668b40a498acd8dc57059d950f0 to your computer and use it in GitHub Desktop.
Save DoMINAToR98/df324668b40a498acd8dc57059d950f0 to your computer and use it in GitHub Desktop.
This simple script finds all the pre existing vulnerabilities present in different softwares installed in your windows machine.
import requests,urllib2,re #for python3 replace urllib2 with urllib.request
from bs4 import BeautifulSoup
from subprocess import Popen,PIPE
URL="https://cve.mitre.org/cgi-bin/cvekey.cgi?keyword="
cmd="wmic product get name,version"
subprocess.call(cmd.split(),shell=True)
p = Popen(cmd, stdin=PIPE, stdout=PIPE, stderr=PIPE)
output, err = p.communicate(b"input data that is passed to subprocess' stdin")
rc = p.returncode
st=output.decode()
versions=re.findall(r"(\d+.\d+.\d+.\d+)\s+",st)
print (versions)
# versions=['3.7.3150.0', '5.5.5.0','9.0.30729.6161','7.57']
# print(soup.prettify())
cve_list=[]
for i in versions:
contents = urllib2.urlopen(URL+i).read()
soup = BeautifulSoup(contents, 'html.parser')
new_cve=soup.find_all(text=re.compile("^CVE-[0-9]{4}-"));
cve_list.append(new_cve)
print (cve_list)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment