-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathedb_advanced_proxy.py
56 lines (47 loc) · 2.13 KB
/
edb_advanced_proxy.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
#/usr/bin/python3
import atoma, requests, re, pandas as pd
feed_name = "Exploit-DB.com RSS Feed"
url = "https://www.exploit-db.com/rss.xml"
proxies = {
"http": "http://proxy.com:8080", # Change this
"https": "https://proxy.com:8080", # Change this
}
response = requests.get(url, proxies=proxies)
feed = atoma.parse_rss_bytes(response.content)
date1 = feed.pub_date.strftime('(%Y-%m-%d)')
print ("Feed: " + feed.title)
print ("Description: " + feed.description)
print ("Link: " + feed.link)
print ("Feed Update: " + date1)
new_items = []
bad_chars = [';', ':', '!', "*", "'", "[", "]","(",")","-"]
for exploit in feed.items:
new_item = {}
new_item['Published'] = exploit.pub_date.strftime('%Y-%m-%d')
new_item['Title'] = re.findall(r"(.*)\-",exploit.description)
new_item['Link'] = exploit.link
new_item['Attack Vector'] = re.findall(r'\[(.*?)\]',exploit.title)
new_item['Attack Description'] = re.findall(r'\-(.*?)\(',exploit.description)
new_item['Attack Type'] = re.findall(r'\((.*?)\)',exploit.description)
new_items.append(new_item)
print (new_items)
df = pd.DataFrame(new_items,columns=['Published','Title','Attack Vector','Attack Description','Attack Type','Link'])
#Convert dtype to str
df["Published"]= df["Published"].astype(str)
df["Title"]= df["Title"].astype(str)
df["Attack Vector"]= df["Attack Vector"].astype(str)
df["Attack Description"]= df["Attack Description"].astype(str)
df["Attack Type"]= df["Attack Type"].astype(str)
df["Link"]= df["Link"].astype(str)
#Replace special characters
df1 = pd.DataFrame(columns=['PUBLISHED','TITLE','ATTACK VECTOR','ATTACK DESCRIPTION','ATTACK TYPE','LINK'])
df1['PUBLISHED'] = df['Published']
df1['TITLE'] = df['Title'].str.replace("\[|\]|\'", "")
df1['ATTACK VECTOR'] = df['Attack Vector'].str.replace("\[|\]|\'", "")
df1['ATTACK DESCRIPTION'] = df['Attack Description'].str.replace("\[|\]|\'", "")
df1['ATTACK TYPE'] = df['Attack Type'].str.replace("\[|\]|\'", "")
df1['LINK'] = df['Link']
df1.head()
#Export to CSV file and as HTML page
df1.to_csv('/var/www/exploitdb/EDB.csv',index=False, encoding = 'utf-8')
df1.to_html('/var/www/exploitdb/EDB.html')