11
11
| | | '_ \| '__/ _ \/ _` | __|| | '__/ _` |/ __/ _ \ '__|
12
12
| | | | | | | | __/ (_| | |_ | | | | (_| | (_| __/ |
13
13
|_| |_| |_|_| \___|\__,_|\__||_|_| \__,_|\___\___|_| Version 2.1
14
- A Script to identify CVE & Public Exploit by product/component's name & version
14
+ A Script to identify CVE using CPE by name & version
15
15
Credit: @FR13ND0x7F @0xCaretaker @meppohak5
16
16
"""
17
17
@@ -25,7 +25,7 @@ def find_cpes(component, version):
25
25
}
26
26
27
27
response = requests .get (base_url , params = params )
28
- print (f"URL Used: { response .url } " ) # Print the URL used to find CPE
28
+ # print(f"URL Used: {response.url}") Print the URL used to find CPE
29
29
content = response .text
30
30
31
31
cpe_matches = re .findall (r'cpe:(.*?)<' , content )
@@ -53,7 +53,7 @@ def fetch_cve_details(cpe_string):
53
53
data = response .json ()
54
54
except json .JSONDecodeError :
55
55
print (colored (f"Error decoding JSON for CPE: { cpe_string } . Skipping." , "red" ))
56
- return []
56
+ return [] # Return an empty list to indicate the error
57
57
58
58
if "result" in data :
59
59
cves = data ["result" ]["CVE_Items" ]
@@ -81,9 +81,9 @@ def fetch_cve_details(cpe_string):
81
81
pEdb .openFile ()
82
82
exploit_status = pEdb .searchCve (cve_id )
83
83
if exploit_status :
84
- exploit_status = "Public Exploit Found"
84
+ exploit_status = "Public Exploit Found over Exploit-DB "
85
85
else :
86
- exploit_status = "No Public Exploit Found"
86
+ exploit_status = "No Public Exploit Found over Exploit-DB "
87
87
88
88
cve_details = {
89
89
"CVE ID" : cve_id ,
@@ -98,6 +98,17 @@ def fetch_cve_details(cpe_string):
98
98
99
99
return results
100
100
101
+ def fetch_github_urls (cve_id ):
102
+ api_url = f"https://poc-in-github.motikan2010.net/api/v1/?cve_id={ cve_id } "
103
+ response = requests .get (api_url )
104
+
105
+ if response .status_code == 200 :
106
+ data = response .json ()
107
+ if "pocs" in data and data ["pocs" ]:
108
+ github_urls = [poc ["html_url" ] for poc in data ["pocs" ]]
109
+ return github_urls
110
+ return []
111
+
101
112
if __name__ == "__main__" :
102
113
print (colored ("CPE Finder Script" , "green" , attrs = ["bold" ]))
103
114
print ("This script searches for the CPEs of a component and version.\n " )
@@ -116,17 +127,24 @@ def fetch_cve_details(cpe_string):
116
127
if results :
117
128
print (colored ("\n CVE Details" , "cyan" , attrs = ["underline" ]))
118
129
for result in results :
119
- print (colored (f"CVE ID: { result ['CVE ID' ]} " , "white" ))
130
+ cve_id = result ["CVE ID" ]
131
+ print (colored (f"\n CVE ID: { cve_id } " , "white" ))
120
132
if result ["Short Name" ]:
121
133
print (colored (f"Short Name: { result ['Short Name' ]} " , "light_blue" ))
122
134
print (colored (f"Description: { result ['Description' ]} " , "yellow" ))
123
135
if result ["Weaknesses" ]:
124
136
print (colored (f"Weaknesses: { result ['Weaknesses' ]} " , "magenta" ))
125
137
print (colored (f"Link: { result ['Link' ]} " , "blue" ))
138
+ github_urls = fetch_github_urls (cve_id ) # Print GitHub URLs for this CVE
139
+ if github_urls :
140
+ print (colored ("Public Exploit/ POC Over Github found:" , "red" ))
141
+ for url in github_urls :
142
+ print (colored (f" { url } " , "blue" ))
143
+ else :
144
+ print (colored ("Public Exploit/ POC Over Github not found, you might need to check manually" , "green" ))
126
145
if result ["Exploit Status" ] == "Public Exploit Found" :
127
- print (colored (f"Exploit Status: { result ['Exploit Status' ]} \n " , "red" ))
146
+ print (colored (f"Exploit Status: { result ['Exploit Status' ]} " , "red" ))
128
147
else :
129
- print (colored (f"Exploit Status: { result ['Exploit Status' ]} \n " , "green" ))
148
+ print (colored (f"Exploit Status: { result ['Exploit Status' ]} " , "green" ))
130
149
else :
131
150
print (colored ("CPEs not found for the provided component and version." , "red" ))
132
-
0 commit comments