Skip to content

Commit

Permalink
work in progress for mandiant threat intel integration, cisagov#358
Browse files Browse the repository at this point in the history
  • Loading branch information
mmguero committed Nov 8, 2024
1 parent 231ad13 commit 13bf9a7
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 10 deletions.
12 changes: 4 additions & 8 deletions logstash/pipelines/zeek/1029_zeek_intel.conf
Original file line number Diff line number Diff line change
Expand Up @@ -40,16 +40,12 @@ filter {
code => "event.set('[zeek_cols]', @zeek_intel_field_names.zip(event.get('[message]')).to_h)"
}
}
mutate { id => "mutate_split_zeek_intel_commas"
split => { "[zeek_cols][sources]" => ","
"[zeek_cols][matched]" => "," } }
}

# For some reason, even in JSON, I have cif_tags strings like:
# Network activity,osint:source-type=\"block-or-filter-list\"
# so whatever reason it's not already an array. Split it here.
mutate { id => "mutate_split_zeek_intel_cif_tags"
split => { "[zeek_cols][cif_tags]" => "," } }
mutate { id => "mutate_split_zeek_intel_commas"
split => { "[zeek_cols][sources]" => ","
"[zeek_cols][matched]" => ","
"[zeek_cols][cif_tags]" => "," } }

}

Expand Down
10 changes: 8 additions & 2 deletions shared/bin/zeek_threat_feed_utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -232,7 +232,13 @@ def map_mandiant_indicator_to_zeek(
zeekItem[ZEEK_INTEL_CIF_LASTSEEN] = str(mktime(indicator.last_seen.timetuple()))
if hasattr(indicator, 'sources'):
zeekItem[ZEEK_INTEL_META_SOURCE] = ','.join(
list({entry['source_name'] for entry in indicator.sources if 'source_name' in entry})
list(
{
entry['source_name'].replace(',', '\\x2c')
for entry in indicator.sources
if 'source_name' in entry
}
)
)
if categories := list(
{
Expand All @@ -249,7 +255,7 @@ def map_mandiant_indicator_to_zeek(
tags.extend(trueMispAttrs)

if tags:
zeekItem[ZEEK_INTEL_CIF_TAGS] = ','.join(tags)
zeekItem[ZEEK_INTEL_CIF_TAGS] = ','.join([x.replace(',', '\\x2c') for x in tags])

# The MD5Indicator class can actually have multiple types of hashes,
# and we want to create a zeek intel item for each. I'm accessing
Expand Down

0 comments on commit 13bf9a7

Please sign in to comment.