beehivecybersecurity / waf-ipdb Goto Github PK
View Code? Open in Web Editor NEWAutomation to report malicious actors to AbuseIPDB for users of Cloudflare WAF
License: MIT License
Automation to report malicious actors to AbuseIPDB for users of Cloudflare WAF
License: MIT License
hello
this your script still working?
I have check but the script no get data
{"success":false,"errors":[{"code":10000,"message":"Authentication error"}]}
I have check with cloudflare docs
You don’t need X-Auth-Key or X-Auth-Email header if you are using an API token. There is an issue with the docs about it
and I have change with
headers = {
"Content-Type": "application/json",
"Authorization": f"Bearer {YOUR_API_TOKEN}"
}
and still no get data.
I have the run manually with
curl -X POST \
-H "Content-Type: application/json" \
-H "Authorization: Bearer YOUR_API_TOKEN" \
-d '{
"query": "query ListFirewallEvents($zoneTag: string, $filter: FirewallEventsAdaptiveFilter_InputObject) { viewer { zones(filter: { zoneTag: $zoneTag }) { firewallEventsAdaptive(filter: $filter, limit: 2500, orderBy: [datetime_DESC]) { action clientASNDescription clientAsn clientCountryName clientIP clientRequestHTTPHost clientRequestHTTPMethodName clientRequestHTTPProtocol clientRequestPath clientRequestQuery datetime rayName ruleId source userAgent } } } }",
"variables": {
"zoneTag": "YOUR_CLOUDFLARE_ZONE_ID",
"filter": {
"datetime_geq": "2024-03-19T21:16:51Z",
"datetime_leq": "2024-03-19T23:46:51Z",
"AND": [
{"action_neq": "allow"},
{"action_neq": "skip"},
{"action_neq": "challenge_solved"},
{"action_neq": "challenge_failed"},
{"action_neq": "challenge_bypassed"},
{"action_neq": "jschallenge_solved"},
{"action_neq": "jschallenge_failed"},
{"action_neq": "jschallenge_bypassed"},
{"action_neq": "managed_challenge_skipped"},
{"action_neq": "managed_challenge_non_interactive_solved"},
{"action_neq": "managed_challenge_interactive_solved"},
{"action_neq": "managed_challenge_bypassed"}
]
}
}
}' \
https://api.cloudflare.com/client/v4/graphql
I got the data.
please advice
There is this code in get_blocked_ip
:
except Exception as e:
# If there is an exception, call the function recursively
get_blocked_ip()
I think this should be return get_blocked_ip()
rather than `get_blocked_ip() because otherwise it will retry but return nothing.
Workflow config:
name: Report on: push: schedule: - cron: '15 * * * *' watch: types: [started] workflow_dispatch: jobs: build: if: github.repository == 'DIVISIONSolar/WAF-IPDB' runs-on: ubuntu-latest steps: - name: Checkout uses: actions/checkout@main - name: Set up python uses: actions/setup-python@v1 with: python-version: 3.8 - name: Install requirements run: pip install -r requirements.txt - name: Report run: python main.py ${{ secrets.CLOUDFLARE_ZONE_ID }} ${{ secrets.CLOUDFLARE_EMAIL }} ${{ secrets.CLOUDFLARE_API_KEY }} ${{ secrets.ABUSEIPDB_API_KEY }}
##[debug]Evaluating condition for step: 'Report' ##[debug]Evaluating: success() ##[debug]Evaluating success: ##[debug]=> true ##[debug]Result: true ##[debug]Starting: Report ##[debug]Loading inputs ##[debug]Evaluating: format('python main.py {0} {1} {[2](https://github.com/DIVISIONSolar/WAF-IPDB/actions/runs/5338245148/jobs/9675357089#step:5:2)} {[3](https://github.com/DIVISIONSolar/WAF-IPDB/actions/runs/5338245148/jobs/9675357089#step:5:3)}', secrets.CLOUDFLARE_ZONE_ID, secrets.CLOUDFLARE_EMAIL, secrets.CLOUDFLARE_API_KEY, secrets.ABUSEIPDB_API_KEY) ##[debug]Evaluating format: ##[debug]..Evaluating String: ##[debug]..=> 'python main.py {0} {1} {2} {3}' ##[debug]..Evaluating Index: ##[debug]....Evaluating secrets: ##[debug]....=> Object ##[debug]....Evaluating String: ##[debug]....=> 'CLOUDFLARE_ZONE_ID' ##[debug]..=> '***' ##[debug]..Evaluating Index: ##[debug]....Evaluating secrets: ##[debug]....=> Object ##[debug]....Evaluating String: ##[debug]....=> 'CLOUDFLARE_EMAIL' ##[debug]..=> '***' ##[debug]..Evaluating Index: ##[debug]....Evaluating secrets: ##[debug]....=> Object ##[debug]....Evaluating String: ##[debug]....=> 'CLOUDFLARE_API_KEY' ##[debug]..=> '***' ##[debug]..Evaluating Index: ##[debug]....Evaluating secrets: ##[debug]....=> Object ##[debug]....Evaluating String: ##[debug]....=> 'ABUSEIPDB_API_KEY' ##[debug]..=> '***' ##[debug]=> 'python main.py *** *** *** ***' ##[debug]Result: 'python main.py *** *** *** ***' ##[debug]Loading env Run python main.py *** *** *** *** ##[debug]/usr/bin/bash -e /home/runner/work/_temp/2b103762-17ce-[4](https://github.com/DIVISIONSolar/WAF-IPDB/actions/runs/5338245148/jobs/9675357089#step:5:4)3[5](https://github.com/DIVISIONSolar/WAF-IPDB/actions/runs/5338245148/jobs/9675357089#step:5:5)c-a470-[6](https://github.com/DIVISIONSolar/WAF-IPDB/actions/runs/5338245148/jobs/9675357089#step:5:6)25[7](https://github.com/DIVISIONSolar/WAF-IPDB/actions/runs/5338245148/jobs/9675357089#step:5:7)7e070[8](https://github.com/DIVISIONSolar/WAF-IPDB/actions/runs/5338245148/jobs/9675357089#step:5:8)2f.sh ==================== Start ==================== 2023-06-21 1[9](https://github.com/DIVISIONSolar/WAF-IPDB/actions/runs/5338245148/jobs/9675357089#step:5:9):40:40 2023-06-21 [11](https://github.com/DIVISIONSolar/WAF-IPDB/actions/runs/5338245148/jobs/9675357089#step:5:11):40:40 ttl: 59 <class 'dict'> Traceback (most recent call last): File "main.py", line [16](https://github.com/DIVISIONSolar/WAF-IPDB/actions/runs/5338245148/jobs/9675357089#step:5:16)4, in <module> ip_bad_list=a["data"]["viewer"]["zones"][0]["firewallEventsAdaptive"] KeyError: 'data' Error: Process completed with exit code 1. ##[debug]Finishing: Report
Any ideas on why this happens?
A declarative, efficient, and flexible JavaScript library for building user interfaces.
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google ❤️ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.