new file: .vscode/settings.json
deleted: client/clientconf.yaml deleted: client/dnssender.py deleted: client/main.py modified: database/initdb.py deleted: database/test.py deleted: node/main.py deleted: node/nodeconf.yaml deleted: node/proxy.py modified: server/xiaomiandns.py
This commit is contained in:
@@ -1,13 +1,13 @@
|
||||
import sqlite3
|
||||
|
||||
# 用于创建
|
||||
db_file = 'database/dns.db'
|
||||
if __name__ == '__main__':
|
||||
conn = sqlite3.connect(db_file)
|
||||
cursor = conn.cursor()
|
||||
try:
|
||||
cursor.execute(
|
||||
'''CREATE TABLE xiaomiandns(domain TEXT PRIMARY KEY, ip TEXT, pubkey TEXT, nodetype TEXT,timestamp DATETIME)''')
|
||||
# node type contain 3 types: client, node, server
|
||||
'''CREATE TABLE xiaomiandns(domain TEXT PRIMARY KEY, ip TEXT,timestamp DATETIME)''')
|
||||
except sqlite3.OperationalError:
|
||||
print("table xiaomiandns already exists")
|
||||
conn.commit()
|
||||
|
@@ -1,23 +0,0 @@
|
||||
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