From 06581e8e2e33ba9ceda3313ff6e954c5a61ba667 Mon Sep 17 00:00:00 2001 From: MasonLiu <2857911564@qq.com> Date: Wed, 4 Dec 2024 09:14:50 +0800 Subject: [PATCH] =?UTF-8?q?=E4=BC=98=E5=8C=96?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- Core.py | 85 +++++++++++++++++- __pycache__/GotoSend_4hou.cpython-312.pyc | Bin 5659 -> 5705 bytes __pycache__/GotoSend_anquanke.cpython-312.pyc | Bin 5583 -> 5581 bytes __pycache__/GotoSend_doonsec.cpython-312.pyc | Bin 0 -> 5825 bytes 4 files changed, 82 insertions(+), 3 deletions(-) create mode 100644 __pycache__/GotoSend_doonsec.cpython-312.pyc diff --git a/Core.py b/Core.py index d7cb600..8b8b238 100644 --- a/Core.py +++ b/Core.py @@ -3,7 +3,8 @@ from datetime import datetime import sys import time import yaml -# from SendBot import SendToFeishu +import requests +from SendBot import SendToFeishu from media.common import run from media.freebuf import freebuf_main from media.xianzhi import xianzhi_main @@ -15,7 +16,7 @@ from GotoSend_doonsec import Src_doonsec def get_params(): with open('./config.yaml', 'r', encoding="utf-8") as file: config = yaml.safe_load(file) - sleep_time = f"{config['sleep_time']}" + sleep_time = int(f"{config['sleep_time']}") s_hour = int(f"{config['s_hour']}") e_hour = int(f"{config['e_hour']}") c_hour = int(f"{config['c_hour']}") @@ -57,12 +58,90 @@ def main_loop(): pass # print("正在等待执行...") # print("等待间隔:", int(sleep_time)) - time.sleep(int(sleep_time)) # 每隔35秒执行一次 + time.sleep(sleep_time) # 每隔35秒执行一次 except Exception as e: print(f"发生错误: {e} ,程序已暂停") # SendToFeishu(f"发生错误: {e} ,程序已退出", "报错信息") exit() +# 探测rss源状态 +def check_rss_status(url): + try: + response = requests.get(url, timeout=10) + if response.status_code == 200 and len(response.content) > 0: + return True + else: + return f"状态码: {response.status_code}, 内容长度: {len(response.content)}" + except requests.RequestException as e: + return f"请求异常: {str(e)}" + +def test_rss_source(): + rss_info = "" + url_1 = check_rss_status("https://forum.butian.net/Rss") + if url_1 == True: + rss_info += "奇安信 源正常\n" + else: + rss_info += f"奇安信 源异常: {url_1}\n" + + url_2 = check_rss_status("https://wechat.doonsec.com/bayes_rss.xml") + if url_2 == True: + rss_info += "洞见 源正常\n" + else: + rss_info += f"洞见 源异常: {url_2}\n" + + url_3 = check_rss_status("https://www.huawei.com/cn/rss-feeds/psirt/rss") + if url_3 == True: + rss_info += "华为 源正常\n" + else: + rss_info += f"华为 源异常: {url_3}\n" + + url_4 = check_rss_status("https://www.sec_wiki.com/news/rss") + if url_4 == True: + rss_info += "安全维基 源正常\n" + else: + rss_info += f"安全维基 源异常: {url_4}\n" + + url_5 = check_rss_status("https://api.anquanke.com/data/v1/rss") + if url_5 == True: + rss_info += "安全客 源正常\n" + else: + rss_info += f"安全客 源异常: {url_5}\n" + + url_6 = check_rss_status("https://www.4hou.com/feed") + if url_6 == True: + rss_info += "嘶吼 源正常\n" + else: + rss_info += f"嘶吼 源异常: {url_6}\n" + + url_7 = check_rss_status("https://paper.seebug.org/rss/") + if url_7 == True: + rss_info += "Seebug社区 源正常\n" + else: + rss_info += f"Seebug社区 源异常: {url_7}\n" + + url_8 = check_rss_status("https://www.freebuf.com/feed") + if url_8 == True: + rss_info += "FreeBuf社区 源正常\n" + else: + rss_info += f"FreeBuf社区 源异常: {url_8}\n" + + url_9 = check_rss_status("https://xz.aliyun.com/feed") + if url_9 == True: + rss_info += "先知社区 源正常\n" + else: + rss_info += f"先知社区 源异常: {url_9}\n" + + return rss_info + if __name__ == "__main__": print("程序正在运行当中。") + rss_info = test_rss_source() + start_info = "" + start_info += "程序已启动,当前时间为:" + datetime.now().strftime("%Y-%m-%d %H:%M:%S") + "\n" + start_info += "程序作者:MasonLiu \t 开源地址:[GM-gitea](https://git.masonliu.com/MasonLiu/PyBot)" + "\n" + start_info += "时间配置:前一天 " + str(s_hour) + " 点到当天 " + str(e_hour) + " 点,每" + str(sleep_time) + "秒执行一次" + ";每日11点开始推送。" + "\n" + SendToFeishu(start_info, "程序信息") + # print(start_info) + SendToFeishu(rss_info, "RSS源状态") + # print(rss_info) main_loop() \ No newline at end of file diff --git a/__pycache__/GotoSend_4hou.cpython-312.pyc b/__pycache__/GotoSend_4hou.cpython-312.pyc index efa4b0af8d940af1a90fccdf342082d1d0e45e7b..231a2681ebbb1df29d109524fa9ae1ca8a7ed15f 100644 GIT binary patch delta 923 zcmbtSO=uHA6rS1tCfOvLP12-bDfZAri+BiPOIuBgKNW1XQ3@hmmu6EN(pD#1YRd-e zO%Oz#ON)oLr=~=y(n~K=1rLfBwR$iVJSc+bp`_qJ5S-a$TRi(<-n{Rdc|Y^sJZyd4 z+VV!0U4Td~)<5#o55N}+9N}ul&g}h`T-3z?Lr#0ro)S~#A()2KFfKnWUT{MO|8e)Q zjK$z9Vh|tq*FhHRo|ZPw6rFGum$h>_xVjV8^Dje@#o-s8;E)AMwIWQ#xs+xeu_ahV zGbCVv|DP0o3pyzZg2iT4oK#hwv-oU?S~BmXvVRq!w~-GNU=uKt@{AkvTe?GxF#p zxs<2QO;iy5J7p<_hHWo2NMM%U7$IsFY~jzrgt#7l9^Qg zw3-E?qC^m;GKF~!%W6gluL|g>T4q9~@WV~1WvOAz5(b&f%v!@dxsX?sn+;}G4GV}b z3FoIVt%iDxkpZYnd~zX=G%ITjLzX0vB_#k9WDRD}WcMoq`Qat^WEQ@)ylh3luwf|T z1`&3X&+#dOUhcWjb4Bs`@|EQ~ zm@W%i@5ww7c*V~DqM(0+*B3Sh0f`yR^Eqa6EKpvqxlnUO@cQtT;Tw`J^ILA7&7aE1 zaYC^AdAYKDa_vDYF8myv>!k_de T%ZW+xw0eDDW?+#j0y!H1mQRm+ diff --git a/__pycache__/GotoSend_anquanke.cpython-312.pyc b/__pycache__/GotoSend_anquanke.cpython-312.pyc index 17c5966b9630082c9149187f2df6f99dc9839db4..0066d62983003e07a3541e510492117a1531abba 100644 GIT binary patch delta 97 zcmX@FeO8Ab=R1?<^QkdE z;TPY0im!o@Ef}bw*czxzVRM1N6h_9V&8$L2OpM8!D@4>8S%n#eKWR-~BB~7lc9t9L delta 99 zcmX@BeO{aIG%qg~0}#Aa^G`Py*vOa6$9Q0JBda{$7d8fN;eMS?oo>Ab=O>fr^Qo}{ zg#;uvpWtg?WD5mqDYgbGRM?y+FolsZW;3%;5ffwT<}wj=MpjWq;ZJl~>E0FPfA A;Q#;t diff --git a/__pycache__/GotoSend_doonsec.cpython-312.pyc b/__pycache__/GotoSend_doonsec.cpython-312.pyc new file mode 100644 index 0000000000000000000000000000000000000000..26bb6d8923bc7a163abdb97a3fddb76f2da6b922 GIT binary patch literal 5825 zcmdT|eQ*=U72ng{NhisY@wW{moFOEZv7r#Y)8MgLm&&zwY!27!f|6ZB9U1q0M3frHvC7@^J(Oi)`y zt6+Y)1R-qFA<-ga2pLy&@%bqfq=J;qGD996Hl4}|ZbekQZK7%cHHgPVPe2iYAhor56_xe)Bw4(y zQyIdF$`S~+2lMFI@7=)_!0n^hszvGpjvYt9z`fU9z@HKl9A+i3SkbcC-F_4 z>^^j6_fd3=-iMA-Hj@LBtxydKMeN90zOQ_FTlsRqwY+xo^7_roo%d5DK1u2brYwM% zO`XGOZ*UR2**V9gG}|cSi8++G3>FAbNP5j$&$Qd^3y5}%C5*{_VGF6OP}%e< zLsT9wAQW=)Dl7UG98@`2J+TH+&2E-(n_E#tp(#m|^}tECgy%6iLe=aA9KwobK6oim z^57@`5vs?UPFCJ5vanvNi;d|F#x)ZKOYRhuj1-g%<_!i%Y?~s_IidwSyJ|lvw%sXS zGg7=J@@!4Ccv~dn$(RWlGkdJv))=A-Gh%v_ncKUq+utt^)SPP@+%@$4NO@(XdRJu6 zfyhB|WKVO%a`^8C+UTWXd1SuW;zv#NpZ9Xmf`zk4XI%41@zVprk>b@K!9*-P-g2$Vnz z%vJUZIdUlLP$yDScH5e=iTEg~Lnvjz#7)Cr+7^|RJ-b_7z%QK>5NI`$siQgy?L!p&ow<}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