-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathdatabase.py
More file actions
129 lines (85 loc) · 3.62 KB
/
Copy pathdatabase.py
File metadata and controls
129 lines (85 loc) · 3.62 KB
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
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
#lesson.py
import sqlite3
import subprocess
import gosh
# create table
# curs.execute("CREATE TABLE customer(name TEXT, username TEXT, password TEXT)")
def searchid(disname):
subprocess.check_call("cat encdata | python3 decrypt.py > user.sqlite", shell=True)
subprocess.check_call("rm -rf ./encdata", shell=True)
# データベースにアクセス
conn = sqlite3.connect("user.sqlite")
curs = conn.cursor()
disname = str(disname)
# id = curs.execute("select username from customer where name = ?",[disname])
for row in curs.execute("select username from customer where name = ?",[disname]):
print(row)
id = row
conn.commit()
conn.close()
subprocess.check_call("cat user.sqlite | python3 encrypt.py > encdata", shell=True)
subprocess.check_call("rm -rf ./user.sqlite", shell=True)
return id
def searchpass(disname):
subprocess.check_call("cat encdata | python3 decrypt.py > user.sqlite", shell=True)
subprocess.check_call("rm -rf ./encdata", shell=True)
# データベースにアクセス
conn = sqlite3.connect("user.sqlite")
curs = conn.cursor()
disname = str(disname)
# password = curs.execute("select password from customer where name = ?", [disname])
for row in curs.execute("select password from customer where name = ?",[disname]):
print(row)
password = row
conn.commit()
conn.close()
subprocess.check_call("cat user.sqlite | python3 encrypt.py > encdata", shell=True)
subprocess.check_call("rm -rf ./user.sqlite", shell=True)
return password
def insert(disname, id, password):
# resetDatabase()
subprocess.check_call("cat encdata | python3 encrypt.py > user.sqlite", shell=True)
subprocess.call("rm -rf ./encdata", shell=True)
# データベースにアクセス
conn = sqlite3.connect("user.sqlite")
curs = conn.cursor()
disname = str(disname)
id = str(id)
password = str(password)
print(disname, id, password)
curs.execute("insert into customer values(?, ?, ?)", [disname, id, password])
select_sql = 'select * from customer'
for row in curs.execute(select_sql):
print(row)
conn.commit()
conn.close()
subprocess.check_call("cat user.sqlite | python3 encrypt.py > encdata", shell=True)
subprocess.check_call("rm -rf ./user.sqlite", shell=True)
def searchurl(disname):
subprocess.check_call("cat encdata | python3 encrypt.py > user.sqlite", shell=True)
subprocess.check_call("rm -rf ./encdata", shell=True)
# データベースにアクセス
conn = sqlite3.connect("url.sqlite")
curs = conn.cursor()
print(disname)
#curs.execute("drop table customer")
curs.execute("create table customer(name text, url text);")
curs.execute("insert into customer values(?, ?)",[disname, "https://discordapp.com/api/webhooks/574167277071761429/mr74pyM_WNR5usMuWZAxf7uX2W10Gv7CS6EsjCQq-uun99mYrdUiM3JVSqKgVwMfFFj7"])
for row in curs.execute("select * from customer"):
print(row)
for row in curs.execute("select url from customer where name = ?",[disname]):
print(row)
d = str(row)
# print(d)
conn.commit()
conn.close()
subprocess.check_call("cat user.sqlite | python3 encrypt.py > encdata", shell=True)
subprocess.check_call("rm -rf ./user.sqlite", shell=True)
return d
def resetDatabase():
conn = sqlite3.connect("user.sqlite")
curs = conn.cursor()
curs.execute("drop table customer")
curs.execute("create table customer(name text, username text, password text);")
for row in curs.execute("select * from customer"):
print(row)