Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 3 additions & 0 deletions eml_parser/eml_parser.py
Original file line number Diff line number Diff line change
Expand Up @@ -451,6 +451,7 @@ def parse_email(self) -> dict:
list_observed_urls_noscheme: typing.List[str] = []
list_observed_email: typing.Counter[str] = Counter()
list_observed_dom: typing.Counter[str] = Counter()
list_observed_rdom: typing.Counter[str] = Counter()
list_observed_ip: typing.Counter[str] = Counter()

# If we start directly a findall on 500K+ body we got time and memory issues...
Expand All @@ -473,6 +474,7 @@ def parse_email(self) -> dict:
valid_domain = self.get_valid_domain_or_ip(match.lower())
if valid_domain:
list_observed_dom[match.lower()] = 1
list_observed_rdom[self._psl.privatesuffix(match.lower())] = 1

for ip_regex in (eml_parser.regexes.ipv4_regex, eml_parser.regexes.ipv6_regex):
for match in ip_regex.findall(body_slice):
Expand All @@ -495,6 +497,7 @@ def parse_email(self) -> dict:

if list_observed_dom:
bodie['domain'] = list(list_observed_dom)
bodie['domain_registered'] = list(list_observed_rdom)

if list_observed_ip:
bodie['ip'] = list(list_observed_ip)
Expand Down