-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Showing
4 changed files
with
101 additions
and
18 deletions.
There are no files selected for viewing
Empty file.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,54 @@ | ||
import tkinter as tk | ||
import requests | ||
|
||
def fetch_data(): | ||
choice = choice_var.get() | ||
user_input = entry_var.get() | ||
|
||
if choice == '1': | ||
url = f"https://zy.xywlapi.cc/qqapi?qq={user_input}" | ||
elif choice == '2': | ||
url = f"https://zy.xywlapi.cc/lolname?name={user_input}" | ||
elif choice == '3': | ||
url = f"https://zy.xywlapi.cc/wbapi?id={user_input}" | ||
else: | ||
output_label.config(text="无效选择,请输入1、2、3或4以选择操作。") | ||
return | ||
|
||
response = requests.get(url) | ||
if response.status_code == 200: | ||
output_label.config(text=response.text) | ||
else: | ||
output_label.config(text=f"请求失败,状态码: {response.status_code}") | ||
|
||
# Create main window | ||
root = tk.Tk() | ||
root.title("API查询工具") | ||
root.geometry("400x300") # Set the size of the window | ||
|
||
# Create input widgets | ||
choice_label = tk.Label(root, text="请选择操作:") | ||
choice_label.pack() | ||
|
||
choice_var = tk.StringVar() | ||
choice_var.set('1') | ||
choices = [("QQ查询phone", '1'), ("LOL名称查询QQ", '2'), ("微博查询phone", '3')] | ||
for text, value in choices: | ||
radio = tk.Radiobutton(root, text=text, variable=choice_var, value=value) | ||
radio.pack() | ||
|
||
entry_label = tk.Label(root, text="请输入查询内容:") | ||
entry_label.pack() | ||
|
||
entry_var = tk.StringVar() | ||
entry_entry = tk.Entry(root, textvariable=entry_var) | ||
entry_entry.pack() | ||
|
||
fetch_button = tk.Button(root, text="查询", command=fetch_data) | ||
fetch_button.pack() | ||
|
||
# Create output widget | ||
output_label = tk.Label(root, text="") | ||
output_label.pack() | ||
|
||
root.mainloop() |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,23 +1,28 @@ | ||
import requests | ||
import cv2 | ||
from pyzbar.pyzbar import decode | ||
|
||
def fetch_and_replace(url, replacements): | ||
try: | ||
response = requests.get(url) | ||
response.raise_for_status() | ||
def read_qr_code(image_path): | ||
# 读取图像 | ||
image = cv2.imread(image_path) | ||
# 解码二维码 | ||
decoded_objects = decode(image) | ||
for obj in decoded_objects: | ||
# 打印二维码内容和类型 | ||
print("Data:", obj.data) | ||
print("Type:", obj.type) | ||
|
||
content = response.text | ||
for original, replacement in replacements.items(): | ||
content = content.replace(original, replacement) | ||
if __name__ == "__main__": | ||
image_path = "path_to_your_image.jpg" # 你的图片路径 | ||
read_qr_code(image_path) | ||
from urllib.parse import urlparse | ||
|
||
# 输出替换后的内容 | ||
print(content) | ||
except requests.exceptions.RequestException as e: | ||
print(f"Failed to fetch content from {url}. Error: {e}") | ||
def parse_url_from_qr_code(qr_data): | ||
parsed_url = urlparse(qr_data) | ||
print("Scheme:", parsed_url.scheme) | ||
print("Netloc:", parsed_url.netloc) | ||
print("Path:", parsed_url.path) | ||
print("Query:", parsed_url.query) | ||
|
||
if __name__ == "__main__": | ||
# 示例网页,替换规则 | ||
webpage_url = "http://guihe.23pqzn.cfd/ddps.php" | ||
replacement_rules = {"电话号码参数未提供": "1", "Hello": "Hi"} | ||
|
||
# 获取网页内容并进行替换 | ||
fetch_and_replace(webpage_url, replacement_rules) | ||
qr_data = "your_qr_code_data" # 二维码内容 | ||
parse_url_from_qr_code(qr_data) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,24 @@ | ||
import bcrypt | ||
|
||
def hash_password(password): | ||
# 生成哈希值 | ||
hashed_password = bcrypt.hashpw(password.encode('utf-8'), bcrypt.gensalt()) | ||
return hashed_password | ||
|
||
def verify_password(hashed_password, input_password): | ||
# 验证输入的密码是否与哈希值匹配 | ||
return bcrypt.checkpw(input_password.encode('utf-8'), hashed_password) | ||
|
||
# 示例用法 | ||
if __name__ == "__main__": | ||
# 假设这是从数据库或其他地方获取的哈希值 | ||
stored_hashed_password = b'$2b$12$uNyb.B3srrCH3Hrck/mnDu92Rc/ARJMX7eyehhbz5fnmeFk5tRddi' | ||
|
||
# 用户输入的密码 | ||
input_password = input("Enter your password: ") | ||
|
||
# 验证密码是否匹配 | ||
if verify_password(stored_hashed_password, input_password): | ||
print("Password matched!") | ||
else: | ||
print("Password incorrect!") |