Skip to content

Commit

Permalink
abuseipdb-reporter.py 0.4.4 add additional lfd trigger category overr…
Browse files Browse the repository at this point in the history
…ides

for

LF_HTACCESS_CATEGORY = 21
LF_IMAPD_CATEGORY = 18
LF_POP3D_CATEGORY = 18
  • Loading branch information
centminmod committed Jul 29, 2023
1 parent 308246a commit b9fae93
Show file tree
Hide file tree
Showing 2 changed files with 25 additions and 1 deletion.
20 changes: 19 additions & 1 deletion abuseipdb-reporter.py
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,7 @@
import datetime
from urllib.parse import quote

VERSION = "0.4.3"
VERSION = "0.4.4"
# Set the DEBUG and LOG_API_REQUEST variables here (True or False)
# DEBUG doesn't send to AbuseIPDB. Only logs to file
# LOG_API_REQUEST, when True, logs API requests to file
Expand Down Expand Up @@ -106,6 +106,9 @@
CT_LIMIT_CATEGORY = '4'
LF_DIRECTADMIN_CATEGORY = '21'
LF_CUSTOMTRIGGER_CATEGORY = '21'
LF_HTACCESS_CATEGORY = '21'
LF_IMAPD_CATEGORY = '18'
LF_POP3D_CATEGORY = '18'

# Get the absolute path of the script
script_dir = os.path.dirname(os.path.abspath(__file__))
Expand Down Expand Up @@ -209,6 +212,15 @@
if config.has_option('settings', 'LF_CUSTOMTRIGGER_CATEGORY'):
LF_CUSTOMTRIGGER_CATEGORY = config.get('settings', 'LF_CUSTOMTRIGGER_CATEGORY')

if config.has_option('settings', 'LF_HTACCESS_CATEGORY'):
LF_HTACCESS_CATEGORY = config.get('settings', 'LF_HTACCESS_CATEGORY')

if config.has_option('settings', 'LF_IMAPD_CATEGORY'):
LF_IMAPD_CATEGORY = config.get('settings', 'LF_IMAPD_CATEGORY')

if config.has_option('settings', 'LF_POP3D_CATEGORY'):
LF_POP3D_CATEGORY = config.get('settings', 'LF_POP3D_CATEGORY')

# Parse command line arguments
parser = argparse.ArgumentParser(description='AbuseIPDB reporter script.')
parser.add_argument('-log', dest='log_file', default=DEFAULT_LOG_FILE, help='Path to the log file.')
Expand Down Expand Up @@ -463,6 +475,12 @@ def get_all_public_ips():
categories = LF_CUSTOMTRIGGER_CATEGORY
elif 'LF_PERMBLOCK_COUNT' in trigger:
categories = LF_PERMBLOCK_COUNT_CATEGORY
elif 'LF_HTACCESS' in trigger:
categories = LF_HTACCESS_CATEGORY
elif 'LF_IMAPD' in trigger:
categories = LF_IMAPD_CATEGORY
elif 'LF_POP3D' in trigger:
categories = LF_POP3D_CATEGORY

url_encoded_ip = quote(args.arguments[0])

Expand Down
6 changes: 6 additions & 0 deletions readme.md
Original file line number Diff line number Diff line change
Expand Up @@ -313,6 +313,9 @@ LF_DISTSMTP_CATEGORY = 18
CT_LIMIT_CATEGORY = 4
LF_DIRECTADMIN_CATEGORY = 21
LF_CUSTOMTRIGGER_CATEGORY = 21
LF_HTACCESS_CATEGORY = 21
LF_IMAPD_CATEGORY = 18
LF_POP3D_CATEGORY = 18
```

### Override AbuseIPDB Categories
Expand All @@ -333,6 +336,9 @@ LF_DISTSMTP_CATEGORY = 18
CT_LIMIT_CATEGORY = 4
LF_DIRECTADMIN_CATEGORY = 21
LF_CUSTOMTRIGGER_CATEGORY = 21
LF_HTACCESS_CATEGORY = 21
LF_IMAPD_CATEGORY = 18
LF_POP3D_CATEGORY = 18
```

Here's an example `abuseipdb-reporter.ini` settings config to enable API submissions to AbuseIPDB, with compact log format and JSON logging that ignores Cluster member entries where you'd inspect `DEFAULT_JSONLOG_FILE = /var/log/abuseipdb-reporter-debug-json.log` and `DEFAULT_JSONAPILOG_FILE = /var/log/abuseipdb-reporter-api-json.log` JSON logs.
Expand Down

0 comments on commit b9fae93

Please sign in to comment.