Skip to content

Commit

Permalink
Update main.py
Browse files Browse the repository at this point in the history
  • Loading branch information
xiaozhu2007 authored Sep 3, 2024
1 parent 340ef85 commit 8bf3875
Showing 1 changed file with 5 additions and 6 deletions.
11 changes: 5 additions & 6 deletions main.py
Original file line number Diff line number Diff line change
Expand Up @@ -80,12 +80,11 @@ def get_blocked_ip():
get_blocked_ip()

def get_comment(it):
return f"""IP {it['clientIP']} [{it['clientCountryName']}] triggered Cloudflare WAF ({it['source']}).
return f"""IP:{it['clientIP']} [Country: {it['clientCountryName']}] triggered Cloudflare WAF ({it['source']}).
Action: {it['action']}
ASN: {it['clientAsn']}
HTTP Method: {it['clientRequestHTTPMethodName']}
Request Path: {it['clientRequestPath']}
Request Query: {it['clientRequestQuery']}
Protocol: {it['clientRequestHTTPProtocol']} (method {it['clientRequestHTTPMethodName']})
Endpoint: {it['clientRequestPath']}{it['clientRequestQuery']}
Time: {it['datetime']}
User-Agent: {it['userAgent']}
Report generated by CFWAF2AbuseIPDB.
Expand Down Expand Up @@ -117,10 +116,10 @@ def report_bad_ip(it):
print("error:",e)

# 排除配置错误的规则
excepted_ruleId = ["fa01280809254f82978e827892db4e46"]
excepted_ruleId = ["9b9dc6522cb14b0e98e4f841e8242abd"]

print("==================== Start ====================")
print(str(time.strftime("%Y-%m-%d %H:%M:%S", time.localtime(time.time()-60*60*8))))
# print(str(time.strftime("%Y-%m-%d %H:%M:%S", time.localtime(time.time()-60*60*8))))
a=get_blocked_ip()
print(str(type(a)))
if str(type(a)) == "<class 'dict'>" and len(a)>0:
Expand Down

0 comments on commit 8bf3875

Please sign in to comment.