modified: client/dnssender.py
modified: database/initdb.py new file: database/test.py modified: server/xiaomiandns.py
This commit is contained in:
@@ -1,6 +1,6 @@
|
||||
import sqlite3
|
||||
|
||||
db_file = 'dns.db'
|
||||
db_file = 'database/dns.db'
|
||||
if __name__ == '__main__':
|
||||
conn = sqlite3.connect(db_file)
|
||||
cursor = conn.cursor()
|
||||
|
||||
23
database/test.py
Normal file
23
database/test.py
Normal file
@@ -0,0 +1,23 @@
|
||||
import sqlite3
|
||||
|
||||
db_file = 'database/dns.db'
|
||||
if __name__ == '__main__':
|
||||
conn = sqlite3.connect(db_file)
|
||||
cursor = conn.cursor()
|
||||
domain = 'mamahaha.wor12'
|
||||
ip = "1.1.1.11"
|
||||
pubkey = "asdfasdfadfsdf"
|
||||
cursor.execute("SELECT * FROM xiaomiandns WHERE domain = ? OR ip = ? OR pubkey = ?",
|
||||
(domain, ip, pubkey))
|
||||
existing_data = cursor.fetchall()
|
||||
if existing_data:
|
||||
print("qqqqqq")
|
||||
else:
|
||||
# Insert the new data
|
||||
cursor.execute(
|
||||
"INSERT INTO xiaomiandns (domain, ip, pubkey) VALUES (?, ?, ?)", (domain, ip, pubkey))
|
||||
print("Data inserted successfully")
|
||||
|
||||
conn.commit()
|
||||
cursor.close()
|
||||
conn.close()
|
||||
Reference in New Issue
Block a user