Formatting changes
This commit is contained in:
parent
53620b6a0a
commit
2095a1c3d6
@ -12,12 +12,12 @@ import time
|
|||||||
from multiprocessing import Process
|
from multiprocessing import Process
|
||||||
|
|
||||||
"""
|
"""
|
||||||
This file is parsing the watchers present
|
This file is parsing the watchers present
|
||||||
in the configuration file. This in order to get
|
in the configuration file. This in order to get
|
||||||
automatically new iocs / elements from remote
|
automatically new iocs / elements from remote
|
||||||
sources without user interaction.
|
sources without user interaction.
|
||||||
|
|
||||||
As of today the default export JSON format from
|
As of today the default export JSON format from
|
||||||
the backend and unauthenticated HTTP requests
|
the backend and unauthenticated HTTP requests
|
||||||
are accepted. The code is little awkward, it'll
|
are accepted. The code is little awkward, it'll
|
||||||
be better in a next version ;)
|
be better in a next version ;)
|
||||||
@ -45,10 +45,8 @@ def watch_iocs():
|
|||||||
res = requests.get(w["url"], verify=False)
|
res = requests.get(w["url"], verify=False)
|
||||||
if res.status_code == 200:
|
if res.status_code == 200:
|
||||||
content = json.loads(res.content)
|
content = json.loads(res.content)
|
||||||
iocs_list = content["iocs"] if "iocs" in content else [
|
iocs_list = content["iocs"] if "iocs" in content else []
|
||||||
]
|
to_delete = content["to_delete"] if "to_delete" in content else []
|
||||||
to_delete = content["to_delete"] if "to_delete" in content else [
|
|
||||||
]
|
|
||||||
else:
|
else:
|
||||||
w["status"] = False
|
w["status"] = False
|
||||||
except:
|
except:
|
||||||
@ -78,8 +76,8 @@ def watch_iocs():
|
|||||||
|
|
||||||
def watch_whitelists():
|
def watch_whitelists():
|
||||||
"""
|
"""
|
||||||
Retrieve whitelist elements from the remote URLs
|
Retrieve whitelist elements from the remote URLs
|
||||||
defined in config/watchers. For each (new ?) element,
|
defined in config/watchers. For each (new ?) element,
|
||||||
add it to the DB.
|
add it to the DB.
|
||||||
"""
|
"""
|
||||||
|
|
||||||
@ -95,10 +93,8 @@ def watch_whitelists():
|
|||||||
res = requests.get(w["url"], verify=False)
|
res = requests.get(w["url"], verify=False)
|
||||||
if res.status_code == 200:
|
if res.status_code == 200:
|
||||||
content = json.loads(res.content)
|
content = json.loads(res.content)
|
||||||
elements = content["elements"] if "elements" in content else [
|
elements = content["elements"] if "elements" in content else []
|
||||||
]
|
to_delete = content["to_delete"] if "to_delete" in content else []
|
||||||
to_delete = content["to_delete"] if "to_delete" in content else [
|
|
||||||
]
|
|
||||||
else:
|
else:
|
||||||
w["status"] = False
|
w["status"] = False
|
||||||
except:
|
except:
|
||||||
|
Loading…
Reference in New Issue
Block a user