The CVE Lookup module (modules/cve_lookup.py) queries public CVE databases to identify known vulnerabilities in discovered services. It provides CVSS scoring, exploit availability checking, and risk assessment.
Searches CVE databases for vulnerabilities affecting a specific product and version.
cve_lookup.py:20-64
def search_cve_by_product(self, product, version=""): """Search for CVEs by product name and version""" # Clean product name product_clean = product.lower().strip() product_clean = re.sub(r'[^\w\s-]', '', product_clean) # Query CVE CIRCL API search_url = f"{self.api_url}/search/{product_clean}" response = requests.get(search_url, timeout=10) if response.status_code == 200: data = response.json() # Limit to top 10 most relevant results for cve_entry in data[:10]: cve_info = self.parse_cve_entry(cve_entry) # Filter by version if specified if version and self.version_matches(cve_entry, version): cves.append(cve_info) else: cves.append(cve_info) return cves
Determines if public exploits are available for a CVE.
cve_lookup.py:126-142
def check_exploit_availability(self, cve_id, cve_entry): """Check if exploit is publicly available""" # Check in CVE data if 'exploit-db' in str(cve_entry).lower(): return True if 'metasploit' in str(cve_entry).lower(): return True # Check references if 'references' in cve_entry: for ref in cve_entry['references']: ref_str = str(ref).lower() if any(keyword in ref_str for keyword in ['exploit', 'poc', 'metasploit', 'exploit-db']): return True return False
Looks up CVEs for all discovered services from port scan.
cve_lookup.py:160-185
def lookup_services(self, services): """Look up CVEs for list of services""" all_cves = [] for service in services: port = service.get('port') service_name = service.get('service', '') version = service.get('version', '') # Skip generic services if not service_name or service_name in ['unknown', 'tcpwrapped']: continue # Search for CVEs cves = self.search_cve_by_product(service_name, version) # Attach port information for cve in cves: cve['port'] = port cve['service'] = service_name cve['version'] = version all_cves.append(cve) return all_cves
The module automatically skips generic services like “unknown” or “tcpwrapped” to reduce false positives.