2024-12-03 00:03:14 +08:00
|
|
|
import signal
|
|
|
|
from datetime import datetime
|
|
|
|
import sys
|
|
|
|
import time
|
2024-12-03 17:33:37 +08:00
|
|
|
from SendBot import SendToFeishu
|
2024-12-03 00:03:14 +08:00
|
|
|
from media.common import run
|
|
|
|
from media.freebuf import freebuf_main
|
|
|
|
from media.xianzhi import xianzhi_main
|
|
|
|
|
|
|
|
|
|
|
|
def crab_job():
|
|
|
|
print("正在启动各爬虫并获取资源中...")
|
|
|
|
run()
|
|
|
|
xianzhi_main()
|
|
|
|
freebuf_main()
|
|
|
|
|
|
|
|
def signal_handler(sig, frame):
|
|
|
|
print("接收到退出信号,程序即将退出...")
|
|
|
|
sys.exit(0)
|
|
|
|
|
|
|
|
|
|
|
|
signal.signal(signal.SIGINT, signal_handler) # Ctrl+C
|
|
|
|
signal.signal(signal.SIGTERM, signal_handler) # kill命令
|
|
|
|
|
|
|
|
def main_loop():
|
|
|
|
while True:
|
|
|
|
try:
|
|
|
|
# 获取当前时间
|
|
|
|
now = datetime.now()
|
|
|
|
# 检查是否为特定时间点
|
2024-12-03 17:33:37 +08:00
|
|
|
if now.hour == 11 and now.minute == 5:
|
2024-12-03 00:03:14 +08:00
|
|
|
crab_job()
|
|
|
|
print("执行完毕,等待下一次执行...")
|
|
|
|
else:
|
|
|
|
print("正在等待执行...")
|
|
|
|
time.sleep(35) # 每隔35秒执行一次
|
|
|
|
except Exception as e:
|
2024-12-03 17:33:37 +08:00
|
|
|
print(f"发生错误: {e} ,程序已暂停")
|
|
|
|
SendToFeishu(f"发生错误: {e} ,程序已退出", "报错信息")
|
2024-12-03 00:03:14 +08:00
|
|
|
exit()
|
|
|
|
|
|
|
|
if __name__ == "__main__":
|
|
|
|
main_loop()
|