-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathfilter.py
36 lines (31 loc) · 991 Bytes
/
filter.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
import sqlite3
conn = sqlite3.connect("filter.db")
cur = conn.cursor()
def senderFilter(sender):
query = "SELECT EXISTS(SELECT ID FROM sender WHERE address = '" + sender + "')"
cur.execute(query)
if cur.fetchone()[0] == 1:
return True
else:
return False
def senderDomainFilter(sender_domain):
query = "SELECT EXISTS(SELECT ID FROM sender_domain WHERE domain = '" + sender_domain + "')"
cur.execute(query)
if cur.fetchone()[0] == 1:
return True
else:
return False
def senderIPFilter(sender_ip):
query = "SELECT EXISTS(SELECT ID FROM sender_ip WHERE IP = '" + sender_ip + "')"
cur.execute(query)
if cur.fetchone()[0] == 1:
return True
else:
return False
def contentsURLFilter(contents_url):
query = "SELECT EXISTS(SELECT ID FROM contents_url WHERE url = '" + contents_url + "')"
cur.execute(query)
if cur.fetchone()[0] == 1:
return True
else:
return False