Skip to content

Commit

Permalink
Bugfix
Browse files Browse the repository at this point in the history
  • Loading branch information
fedelemantuano committed Jul 26, 2018
1 parent 6db421e commit d9b0a0d
Show file tree
Hide file tree
Showing 2 changed files with 19 additions and 6 deletions.
2 changes: 1 addition & 1 deletion requirements_optional.txt
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
elasticsearch>=6.0.0, <7
redis>=2.10.5, <3
shodan
tika-app
tika-app>=1.4.0
virustotal-api
23 changes: 18 additions & 5 deletions src/modules/attachments/post_processing.py
Original file line number Diff line number Diff line change
Expand Up @@ -84,13 +84,20 @@ def tika(conf, attachments):

if conf["enabled"]:
from tikapp import TikaApp
tika = TikaApp(file_jar=conf["path_jar"],
memory_allocation=conf["memory_allocation"])

tika = TikaApp(
file_jar=conf["path_jar"],
memory_allocation=conf["memory_allocation"])

wtlist = conf.get("whitelist_content_types", [])
if not wtlist:
log.warning(
"Apache Tika analysis setted, without whitelist content types")
return

for a in attachments:
if not a.get("is_filtered", False):
if a["Content-Type"] in \
conf.get("whitelist_content_types", []):
if a["Content-Type"] in wtlist:
payload = a["payload"]

if a["content_transfer_encoding"] != "base64":
Expand Down Expand Up @@ -132,7 +139,13 @@ def virustotal(conf, attachments):
from .utils import reformat_virustotal

vt = VirusTotalPublicApi(conf["api_key"])
wtlist = conf["whitelist_content_types"]
wtlist = conf.get("whitelist_content_types", [])

# I don't have content types to analyze
if not wtlist:
log.warning(
"Virustotal analysis setted, without whitelist content types")
return

for a in attachments:
if not a.get("is_filtered", False) and a["Content-Type"] in wtlist:
Expand Down

0 comments on commit d9b0a0d

Please sign in to comment.