forked from laramies/theHarvester
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathstash.py
51 lines (45 loc) · 1.6 KB
/
stash.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
import sqlite3
import datetime
class stash_manager:
def __init__(self):
self.db = "stash.sqlite"
self.results = ""
self.totalresults = ""
def do_init(self):
conn = sqlite3.connect(self.db)
c = conn.cursor()
c.execute ('CREATE TABLE results (domain text, resource text, type text, find_date date, source text)')
conn.commit()
conn.close()
return
def store(self,domain, resource,res_type,source):
self.domain = domain
self.resource = resource
self.type = res_type
self.source = source
self.date = datetime.date.today()
try:
conn = sqlite3.connect(self.db)
c = conn.cursor()
c.execute ('INSERT INTO results (domain,resource, type, find_date, source) VALUES (?,?,?,?,?)',(self.domain,self.resource,self.type,self.date,self.source))
conn.commit()
conn.close()
except Exception, e:
print e
return
def store_all(self,domain,all,res_type,source):
self.domain = domain
self.all = all
self.type = res_type
self.source = source
self.date = datetime.date.today()
for x in self.all:
try:
conn = sqlite3.connect(self.db)
c = conn.cursor()
c.execute ('INSERT INTO results (domain,resource, type, find_date, source) VALUES (?,?,?,?,?)',(self.domain,x,self.type,self.date,self.source))
conn.commit()
conn.close()
except Exception, e:
print e
return