Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Commit16138fe

Browse files
committed
gis-9379 fix
1 parente078abf commit16138fe

File tree

2 files changed

+15
-8
lines changed

2 files changed

+15
-8
lines changed

‎uncoder-core/app/translator/core/parser_cti.py‎

Lines changed: 11 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -52,13 +52,20 @@ def get_iocs_from_string(
5252
include_source_ip:Optional[bool]=False,
5353
)->dict:
5454
iocs=Iocs()
55-
string=self.replace_dots_hxxp(string,ioc_parsing_rules)
5655
ifnotinclude_ioc_typesor"ip"ininclude_ioc_types:
5756
iocs.ip.extend(self._find_all_str_by_regex(string,IP_IOC_REGEXP_PATTERN))
5857
ifnotinclude_ioc_typesor"domain"ininclude_ioc_types:
59-
iocs.domain.extend(self._find_all_str_by_regex(string,DOMAIN_IOC_REGEXP_PATTERN))
58+
fordomaininself._find_all_str_by_regex(string,DOMAIN_IOC_REGEXP_PATTERN):
59+
fordomain_valindomain:
60+
ifdomain_val:
61+
iocs.domain.extend(self.replace_dots_hxxp(domain_val))
6062
ifnotinclude_ioc_typesor"url"ininclude_ioc_types:
61-
iocs.url.extend([url.rstrip(".")forurlinself._find_all_str_by_regex(string,URL_IOC_REGEXP_PATTERN)])
63+
iocs.url.extend(
64+
[
65+
self.replace_dots_hxxp(url).rstrip(".")
66+
forurlinself._find_all_str_by_regex(string,URL_IOC_REGEXP_PATTERN)
67+
]
68+
)
6269
ifnotinclude_ioc_typesor"hash"ininclude_ioc_types:
6370
ifnotinclude_hash_types:
6471
include_hash_types=list(hash_regexes.keys())
@@ -74,7 +81,7 @@ def get_iocs_from_string(
7481
raiseIocsLimitExceededException(f"IOCs count{total_count} exceeds limit{limit}.")
7582
returniocs.return_iocs(include_source_ip)
7683

77-
defreplace_dots_hxxp(self,string:str,ioc_parsing_rules:Optional[list[IocParsingRule]])->str:
84+
defreplace_dots_hxxp(self,string:str,ioc_parsing_rules:Optional[list[IocParsingRule]]=None)->str:
7885
ifioc_parsing_rulesisNoneor"replace_dots"inioc_parsing_rules:
7986
string=self._replace_dots(string)
8087
ifioc_parsing_rulesisNoneor"replace_hxxp"inioc_parsing_rules:

‎uncoder-core/app/translator/tools/const.py‎

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -6,11 +6,11 @@
66

77
IOCType=Literal["ip","domain","url","hash"]
88
HashType=Literal["md5","sha1","sha256","sha512"]
9-
IocParsingRule=Literal["replace_dots","remove_private_and_reserved_ips","replace_hxxp"]
9+
IocParsingRule=Literal["remove_private_and_reserved_ips"]
1010

1111
DefaultIOCType=list(get_args(IOCType))
1212
DefaultHashType=list(get_args(HashType))
13-
DefaultIocParsingRule=list(get_args(Literal["remove_private_and_reserved_ips"]))
13+
DefaultIocParsingRule=list(get_args(IocParsingRule))
1414

1515
HASH_MAP= {"md5":"HashMd5","sha1":"HashSha1","sha256":"HashSha256","sha512":"HashSha512"}
1616

@@ -22,10 +22,10 @@
2222
}
2323

2424
LOGSOURCE_MAP= {
25-
"hash": {"category":"process_creation"},
25+
"hash": {"category":"file_event"},
2626
"domain": {"category":"proxy"},
2727
"url": {"category":"proxy"},
28-
"ip": {"category":"proxy"},
28+
"ip": {"category":"firewall"},
2929
"emails": {"category":"mail"},
3030
"files": {"category":"file_event"},
3131
}

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp