Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Migrate enrich.py to modular system #117

Merged
merged 53 commits into from
Apr 8, 2021
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
53 commits
Select commit Hold shift + click to select a range
4cc2d35
Added CS Beacon enrich module
fastlorenzo Nov 17, 2020
8310441
Added enrich greynoise module
fastlorenzo Nov 17, 2020
61c3832
Deleted old reference to greynoise
fastlorenzo Nov 17, 2020
78c0815
Fixed installer for dev (cert)
fastlorenzo Nov 17, 2020
f52e218
Added option to disable enrich modules in config
fastlorenzo Nov 17, 2020
96b2ff2
Added interval options for modules
fastlorenzo Nov 17, 2020
e275109
Added check if alarm fails
fastlorenzo Nov 19, 2020
27bc8e3
Added enrich_tor module
fastlorenzo Nov 19, 2020
e4a1b6d
Removed abuse.ch ssl and botnet lists (to be created in new alarms la…
fastlorenzo Nov 20, 2020
d969ffc
added iplist in ES + small fixes
fastlorenzo Nov 21, 2020
4ed43fe
small fix
fastlorenzo Nov 21, 2020
4c1a9c8
Added iplist config
fastlorenzo Mar 8, 2021
2ecfe65
Updated helper script
fastlorenzo Mar 8, 2021
c9e27b3
Added missing templates
fastlorenzo Mar 8, 2021
e41400a
Cleaned code
fastlorenzo Mar 8, 2021
2030561
Fetch LOGLEVEL from config.json for alarms.py
Mar 9, 2021
51768e0
Added blueteam IP list
fastlorenzo Mar 23, 2021
a31c5d6
Minor updates to alarms
Jan 20, 2021
7f053a8
removed logs + fixed line endings
fastlorenzo Mar 30, 2021
a3ab7c7
Added CS Beacon enrich module
fastlorenzo Nov 17, 2020
5e5d6c3
Added enrich greynoise module
fastlorenzo Nov 17, 2020
444196c
Deleted old reference to greynoise
fastlorenzo Nov 17, 2020
5fa8b8a
Fixed installer for dev (cert)
fastlorenzo Nov 17, 2020
034386f
Added option to disable enrich modules in config
fastlorenzo Nov 17, 2020
88c2962
Added interval options for modules
fastlorenzo Nov 17, 2020
9fd59d9
Added check if alarm fails
fastlorenzo Nov 19, 2020
49a3cbc
Added enrich_tor module
fastlorenzo Nov 19, 2020
8797a0e
Removed abuse.ch ssl and botnet lists (to be created in new alarms la…
fastlorenzo Nov 20, 2020
a844d16
added iplist in ES + small fixes
fastlorenzo Nov 21, 2020
c87ccf1
small fix
fastlorenzo Nov 21, 2020
14a3694
Added iplist config
fastlorenzo Mar 8, 2021
35bf3d4
Updated helper script
fastlorenzo Mar 8, 2021
b454847
Added missing templates
fastlorenzo Mar 8, 2021
5ffacf6
Cleaned code
fastlorenzo Mar 8, 2021
b557b67
Fetch LOGLEVEL from config.json for alarms.py
Mar 9, 2021
0d07a47
Added blueteam IP list
fastlorenzo Mar 23, 2021
355c049
Minor updates to alarms
Jan 20, 2021
e82f525
removed logs + fixed line endings
fastlorenzo Mar 30, 2021
d37ab39
Updated enrichment and alarm scripts
fastlorenzo Mar 31, 2021
bde4020
fixed merge
fastlorenzo Mar 31, 2021
d66d937
Cleaned python scripts
fastlorenzo Mar 31, 2021
06ac482
Split the alarm file into different functions to reduce complexity
fastlorenzo Mar 31, 2021
fad5a01
fixed iplist pattern + sample data ingestor
fastlorenzo Mar 31, 2021
e4183f9
renamed alarm script to daemon + minor py fixes
fastlorenzo Mar 31, 2021
939a65c
fixed lint
fastlorenzo Mar 31, 2021
14a0997
renamed iplist
fastlorenzo Mar 31, 2021
e008078
Added RedELK internal health dashboard (IP Lists + modules run results)
fastlorenzo Mar 31, 2021
9468df1
Merge remote-tracking branch 'upstream/master' into enrich-modules
fastlorenzo Mar 31, 2021
3c7b0fa
Added screenshots
fastlorenzo Mar 31, 2021
c272ca2
Updated to latest version of RedELK Kibana app
fastlorenzo Apr 1, 2021
666530d
Fixed typo
fastlorenzo Apr 1, 2021
c46f4e1
Fix in case iplist file does not exists
fastlorenzo Apr 2, 2021
57d9964
Fixed notifications
fastlorenzo Apr 2, 2021
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -101,7 +101,7 @@ echo "" >> $LOGFILE

echo "[*] Installing Elasticsearch index templates" | tee -a $LOGFILE
upcheck_elasticsearch
for i in implantsdb rtops redirtraffic; do $CURL -X POST "https://redelk-elasticsearch:9200/_template/$i" -H "Content-Type: application/json" -d @./root/redelkinstalldata/templates/redelk_elasticsearch_template_$i.json; done >> $LOGFILE 2>&1
for i in implantsdb rtops redirtraffic redelk email bluecheck credentials; do $CURL -X POST "https://redelk-elasticsearch:9200/_template/$i" -H "Content-Type: application/json" -d @./root/redelkinstalldata/templates/redelk_elasticsearch_template_$i.json; done >> $LOGFILE 2>&1
ERROR=$?
if [ $ERROR -ne 0 ]; then
echo "[X] Could not install Elasticsearch index templates (Error Code: $ERROR)."
Expand Down
101 changes: 0 additions & 101 deletions elkserver/docker/redelk-base/redelkinstalldata/scripts/alarm.py

This file was deleted.

This file was deleted.

89 changes: 67 additions & 22 deletions elkserver/docker/redelk-base/redelkinstalldata/scripts/config.py
Original file line number Diff line number Diff line change
@@ -1,27 +1,37 @@
import json
import logging

with open('/etc/redelk/config.json') as json_data:
d = json.load(json_data)

#### General
Verbosity = 0 #Verbosity
if "Verbosity" in d: Verbosity = int(d['Verbosity'])
# -- General
Verbosity = 0 # Verbosity
if "Verbosity" in d:
Verbosity = int(d['Verbosity'])

DEBUG = 0 #Debug 1 or 0
if "DEBUG" in d: DEBUG = int(d['DEBUG'])

interval = 3600 #interval for rechecking IOC's (in seconds)
if "interval" in d: interval = int(d['interval'])
# -- logging
# CRITICAL, 50
# ERROR, 40
# WARNING, 30
# INFO, 20
# DEBUG, 10
# NOTSET, 0

#### HybridAnalysisAPIKEY
HybridAnalysisAPIKEY = ""
if "HybridAnalysisAPIKEY" in d: HybridAnalysisAPIKEY = d['HybridAnalysisAPIKEY']
DEBUG = 0 # Debug 1 or 0
if "DEBUG" in d:
DEBUG = int(d['DEBUG'])

#### directory for cache files (including shelves)
tempDir="/tmp"
if "tempDir" in d: tempDir = d['tempDir']
LOGLEVEL = logging.INFO
if "LOGLEVEL" in d:
LOGLEVEL = int(d['LOGLEVEL'])

#### Notifications
# -- directory for cache files (including shelves)
tempDir = "/tmp"
if "tempDir" in d:
tempDir = d['tempDir']

# -- Notifications
notifications = {
'email': {
'enabled': False,
Expand All @@ -47,27 +57,62 @@
for n in d['notifications']:
notifications[n] = d['notifications'][n]

#### Alarms
# -- Alarms
alarms = {
'alarm_filehash': {
'enabled': False,
'vt_api_key': '', # Virustotal API
'ibm_basic_auth': '', # IBM X-Force API (can be retreived from a sample call on their swagger test site)
'ha_api_key': '' # Hybrid Analysis API
'interval': 300,
'vt_api_key': '', # Virustotal API
'ibm_basic_auth': '', # IBM X-Force API (can be retreived from a sample call on their swagger test site)
'ha_api_key': '' # Hybrid Analysis API
},
'alarm_httptraffic': {
'enabled': False
'enabled': False,
'interval': 310,
'notify_interval': 86400 # Only notify on the same IP hit every 24h by default
},
'alarm_useragent': {
'enabled': False
'enabled': False,
'interval': 320
},
'alarm_dummy': {
'enabled': False
'enabled': False,
'interval': 300
}
}
if 'alarms' in d:
for a in d['alarms']:
alarms[a] = d['alarms'][a]

# -- Enrichments modules
enrich = {
'enrich_csbeacon': {
'enabled': True,
'interval': 300
},
'enrich_greynoise': {
'enabled': True,
'interval': 310,
'cache': 86400
},
'enrich_tor': {
'enabled': True,
'interval': 320,
'cache': 3600
},
'enrich_iplists': {
'enabled': True,
'interval': 330
},
'enrich_synciplists': {
'enabled': True,
'interval': 360
}
}
if 'enrich' in d:
for e in d['enrich']:
enrich[e] = d['enrich'][e]

es_connection = ['http://localhost:9200']
if 'es_connection' in d: es_connection = d['es_connection']
if 'es_connection' in d:
es_connection = d['es_connection']
Loading