批量一键检测网站源码是否含有指定字符
批量一键检测网站源码是否含有指定字符PY程序,小白白写的,勿喷!!!!!!!大佬没必要看
附成品,不用放是否有毒了,。一共不到100行代码。
软件懒得放加载中的实例窗口,想玩的,自己加一个
我用的垃圾百度账号申请的百度网盘账号,随时失效
(吐槽:他妈的,随便一个网盘都要他妈的实名)
链接: https://pan.baidu.com/s/1GumdzU0y5AUK7Vay7NYSxQ 提取码: w947
import requests
import os
from datetime import datetime
if not os.path.isfile('bzurl.txt'):
print('找不到bzurl.txt文件,请先创建该文件。')
exit()
with open('bzurl.txt', 'r') as f:
urls =
if not os.path.isfile('sousuo.txt'):
print('找不到sousuo.txt文件,请先创建该文件。')
exit()
with open('sousuo.txt', 'r') as f:
search_strings =
current_date = datetime.now().strftime('%Y%m%d')
output_file = f'output_{current_date}.txt'
with open(output_file, 'w') as f_out:
f_out.write('')
all_successful = True
with open(output_file, 'a') as f_out:
for url in urls:
try:
response = requests.get(url, timeout=25)
if response.status_code != 200:
f_out.write(f"{url} 获取失败,状态码:{response.status_code}\n")
all_successful = False
continue
source_code = response.text
found_all_strings = True
for search_string in search_strings:
if source_code.find(search_string) == -1:
found_all_strings = False
break
if not found_all_strings:
f_out.write(f"{url} 不包含以下搜索字符串:\n")
for search_string in search_strings:
if source_code.find(search_string) == -1:
f_out.write(f"- {search_string}\n")
all_successful = False
except requests.exceptions.RequestException as e:
f_out.write(f"{url} 获取失败,错误信息:{e}\n")
all_successful = False
if all_successful:
f_out.write("全部查询成功\n")
os.startfile(os.path.dirname(output_file))
不到一百行就敢说大佬没必要看,这谦虚得我都有点不适应了。倒是那句网盘实名吐槽,比代码本身还真实。
页:
[1]