-
Notifications
You must be signed in to change notification settings - Fork 218
/
retrieve.py
43 lines (32 loc) · 772 Bytes
/
retrieve.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
# python retrive.py {url}
import os
import psycopg2
import base64
import sys
url = sys.argv[1]
conn = psycopg2.connect(
host="db",
database="test_db",
user="test_user",
password="test_password"
)
cur = conn.cursor()
cur.execute(f"select result from output where domain = '{url}'")
t = cur.fetchall()
res = t[0][0]
final = base64.standard_b64decode(res)
final = final.decode('utf-8')
f = open('/app/results/{}-output.txt'.format(url), 'w')
f.write(final)
f.close()
conn.commit()
cur.execute(f"select gau from output where domain = '{url}'")
t = cur.fetchall()
res = t[0][0]
final = base64.standard_b64decode(res)
final = final.decode('utf-8')
f = open('/app/results/{}-gau.txt'.format(url), 'w')
f.write(final)
f.close()
cur.close()
conn.close()