Skip to content

Commit 81f7eaa

Browse files
committed
Improved capture of IOCs
1 parent 299e1f3 commit 81f7eaa

File tree

2 files changed

+30
-24
lines changed

2 files changed

+30
-24
lines changed

email/1.3.0/src/app.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -126,7 +126,7 @@ def send_email_smtp(self, smtp_host, recipient, subject, body, smtp_port, attach
126126
if len(username) == 0:
127127
return {
128128
"success": False,
129-
"reason": "No username provided (sender). Please provide a username."
129+
"reason": "No username provided (sender). Please provide a username. Required since January 2025."
130130
}
131131

132132
msg["To"] = recipient

shuffle-tools/1.2.0/src/app.py

Lines changed: 29 additions & 23 deletions
Original file line numberDiff line numberDiff line change
@@ -2613,9 +2613,10 @@ def cleanup_ioc_data(self, input_data):
26132613
input_data = input_data.replace("}", "")
26142614
input_data = input_data.replace("\"", "")
26152615
input_data = input_data.replace("'", "")
2616-
input_data = input_data.replace(" ", "")
2617-
input_data = input_data.replace("\t", "")
2618-
input_data = input_data.replace("\n", "")
2616+
2617+
input_data = input_data.replace("\t", " ")
2618+
input_data = input_data.replace(" ", " ")
2619+
input_data = input_data.replace("\n\n", "\n")
26192620

26202621
# Remove html tags
26212622
input_data = re.sub(r'<[^>]*>', '', input_data)
@@ -2661,9 +2662,11 @@ def parse_ioc(self, input_string, input_type="all"):
26612662
# input_string = input_string[:max_size]
26622663

26632664
self.logger.info("[DEBUG] Parsing data of length %d with types %s. Max size: %d" % (len(input_string), ioc_types, max_size))
2665+
self.logger.info(f"STRING: {input_string}")
26642666

2665-
iocs = find_iocs(str(input_string), included_ioc_types=ioc_types)
2666-
self.logger.info("[DEBUG] Found %d iocs" % len(iocs))
2667+
#iocs = find_iocs(str(input_string), included_ioc_types=ioc_types)
2668+
iocs = find_iocs(str(input_string))
2669+
self.logger.info("[DEBUG] Found %d ioc types" % len(iocs))
26672670

26682671
newarray = []
26692672
for key, value in iocs.items():
@@ -2672,24 +2675,27 @@ def parse_ioc(self, input_string, input_type="all"):
26722675
print("Invalid key: %s" % key)
26732676
continue
26742677

2675-
if len(value) > 0:
2676-
for item in value:
2677-
# If in here: attack techniques. Shouldn't be 3 levels so no
2678-
# recursion necessary
2679-
if isinstance(value, dict):
2680-
for subkey, subvalue in value.items():
2681-
if len(subvalue) > 0:
2682-
for subitem in subvalue:
2683-
data = {
2684-
"data": subitem,
2685-
"data_type": "%s_%s" % (key[:-1], subkey),
2686-
}
2687-
if data not in newarray:
2688-
newarray.append(data)
2689-
else:
2690-
data = {"data": item, "data_type": key[:-1]}
2691-
if data not in newarray:
2692-
newarray.append(data)
2678+
print(key, value)
2679+
if len(value) == 0:
2680+
continue
2681+
2682+
for item in value:
2683+
# If in here: attack techniques. Shouldn't be 3 levels so no
2684+
# recursion necessary
2685+
if isinstance(value, dict):
2686+
for subkey, subvalue in value.items():
2687+
if len(subvalue) > 0:
2688+
for subitem in subvalue:
2689+
data = {
2690+
"data": subitem,
2691+
"data_type": "%s_%s" % (key[:-1], subkey),
2692+
}
2693+
if data not in newarray:
2694+
newarray.append(data)
2695+
else:
2696+
data = {"data": item, "data_type": key[:-1]}
2697+
if data not in newarray:
2698+
newarray.append(data)
26932699

26942700
# Reformatting IP
26952701
for item in newarray:

0 commit comments

Comments
 (0)