forked from oooldtoy/SSTAP_ip_crawl_tool
-
Notifications
You must be signed in to change notification settings - Fork 0
/
sqlite3_mod.py
32 lines (27 loc) · 947 Bytes
/
sqlite3_mod.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
import sqlite3,config
data_base = config.data_base
def create_table():
con = sqlite3.connect(data_base)
cu = con.cursor()
cu.execute('create table rules (rules str not null,process str not null,ip str not null,time int not null,version str not null)')
con.commit()
cu.close()
con.close()
def insert_data(rules,process,ip,time,version):
con = sqlite3.connect(data_base)
cu = con.cursor()
cu.execute("insert into rules(rules,process,ip,time,version) values(\"%s\",\"%s\",\"%s\",\"%d\",\"%s\")" %(rules,process,ip,time,version))
con.commit()
cu.close()
con.close()
def delete_data(i):
con = sqlite3.connect(data_base)
cu = con.cursor()
data = cu.execute("delete from rules where time = {}".format(i))
con.commit()
cu.close()
con.close()
if __name__ == '__main__':
pass
#create_table()
#insert_data('dsafas','fdsafas',23124.1234)