Skip to content

Commit

Permalink
Fixed email to have more exception handling
Browse files Browse the repository at this point in the history
  • Loading branch information
frikky committed Jan 31, 2025
1 parent bb6fd14 commit baaf301
Show file tree
Hide file tree
Showing 3 changed files with 11 additions and 3 deletions.
2 changes: 1 addition & 1 deletion email/1.3.0/requirements.txt
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
requests==2.25.1
requests==2.32.3
glom==20.11.0
jsonpickle==2.0.0

Expand Down
7 changes: 6 additions & 1 deletion email/1.3.0/src/app.py
Original file line number Diff line number Diff line change
Expand Up @@ -164,11 +164,16 @@ def send_email_smtp(self, smtp_host, recipient, subject, body, smtp_port, attach
"success": False,
"reason": f"Failed to send mail: {e}"
}
except Exception as e:
return {
"success": False,
"reason": f"Failed to send mail (2): {e}"
}

self.logger.info("Successfully sent email with subject %s to %s" % (subject, recipient))
return {
"success": True,
"reason": "Email sent to %s, %s!" %(recipient,cc_emails) if cc_emails else "Email sent to %s!" % recipient,
"reason": "Email sent to %s, %s!" % (recipient, cc_emails) if cc_emails else "Email sent to %s!" % recipient,
"attachments": attachment_count
}

Expand Down
5 changes: 4 additions & 1 deletion shuffle-tools/1.2.0/src/app.py
Original file line number Diff line number Diff line change
Expand Up @@ -2624,7 +2624,7 @@ def cleanup_ioc_data(self, input_data):


def parse_ioc(self, input_string, input_type="all"):
ioc_types = ["domains", "urls", "email_addresses", "ipv4s", "ipv4_cidrs", "md5s", "sha256s", "sha1s", "cves"]
ioc_types = ["domains", "urls", "email_addresses", "ipv4s", "ipv6s", "ipv4_cidrs", "md5s", "sha256s", "sha1s", "cves"]
#ioc_types = ["ipv4s"]

try:
Expand Down Expand Up @@ -2652,6 +2652,8 @@ def parse_ioc(self, input_string, input_type="all"):
new_input_types.append(item)

ioc_types = new_input_types
if len(ioc_types) == 0:
input_type = "all"

# Not used for anything after cleanup fixes
max_size = 7500000
Expand All @@ -2667,6 +2669,7 @@ def parse_ioc(self, input_string, input_type="all"):
for key, value in iocs.items():
if input_type != "all":
if key not in input_type:
print("Invalid key: %s" % key)
continue

if len(value) > 0:
Expand Down

0 comments on commit baaf301

Please sign in to comment.