11use crate :: config:: SYSTEM_CONFIG ;
22use crate :: database:: GOOD_LINKS ;
33use crate :: detection:: {
4- cache_safe_string, calculate_detection_hash, is_cached_safe_string, is_obfuscated_name ,
5- ENTROPY_THRESHOLD , NAME_LENGTH_THRESHOLD , SUSPICIOUS_CHAR_THRESHOLD , SUSPICIOUS_DOMAINS ,
4+ cache_safe_string, calculate_detection_hash, is_cached_safe_string,
5+ ENTROPY_THRESHOLD , NAME_LENGTH_THRESHOLD , SUSPICIOUS_DOMAINS ,
66} ;
77use crate :: errors:: ScanError ;
88use crate :: parser:: parse_class_structure;
@@ -35,7 +35,6 @@ pub struct CollapseScanner {
3535 suspicious_domains : HashSet < String > ,
3636 crypto_regex : Regex ,
3737 malicious_pattern_regex : Regex ,
38- suspicious_consecutive_chars_regex : Regex ,
3938 ignored_suspicious_keywords : HashSet < String > ,
4039 ignored_crypto_keywords : HashSet < String > ,
4140 pub options : ScannerOptions ,
@@ -105,8 +104,7 @@ impl CollapseScanner {
105104 url_regex : Regex :: new ( r#"(?i)\b((?:https?://|www\d{0,3}[.]|[a-z0-9.\-]+[.][a-z]{2,4}/)(?:[^\s()<>]+|\(([^\s()<>]+|(\([^\s()<>]+\)))*\))+(?:\(([^\s()<>]+|(\([^\s()<>]+\)))*\)|[^\s`!()\[\]{};:'".,<>?«»""'']))"# ) . unwrap ( ) ,
106105 suspicious_domains : SUSPICIOUS_DOMAINS . clone ( ) ,
107106 crypto_regex : Regex :: new ( r"(?i)\b(aes|des|rsa|md5|sha[1-9]*-?\d*|blowfish|twofish|pgp|gpg|cipher|keystore|keygenerator|secretkey|password|encrypt|decrypt|hash|salt|ivParameterSpec|SecureRandom)\b" ) . unwrap ( ) ,
108- malicious_pattern_regex : Regex :: new ( r"(?i)\b(backdoor|exploit|inject|payload|shellcode|bypass|rootkit|keylog|rat\b|trojan|malware|spyware|meterpreter|cobaltstrike|powershell|cmd\.exe|Runtime\.getRuntime\(\)\.exec|ProcessBuilder|loadLibrary|download|upload|socket\(|bind\(|connect\(|URL\(|URLConnection|Class\.forName|defineClass|getMethod|invoke|unsafe|jndi|ldap|rmi|base64|decode)\b" ) . unwrap ( ) ,
109- suspicious_consecutive_chars_regex : Regex :: new ( & format ! ( r"[^a-zA-Z0-9_$/.]{{{},}}" , SUSPICIOUS_CHAR_THRESHOLD ) ) . unwrap ( ) ,
107+ malicious_pattern_regex : Regex :: new ( r"(?i)\b(backdoor|exploit|payload|shellcode|bypass|rootkit|keylog|rat\b|trojan|malware|spyware|meterpreter|cobaltstrike|powershell|cmd\.exe|Runtime\.getRuntime\(\)\.exec|ProcessBuilder|loadLibrary|download|upload|socket\(|bind\(|connect\(|URL\(|URLConnection|Class\.forName|defineClass|getMethod|unsafe|jndi|ldap|rmi|base64|decode)\b" ) . unwrap ( ) ,
110108 ignored_suspicious_keywords,
111109 ignored_crypto_keywords,
112110 options,
@@ -787,14 +785,6 @@ impl CollapseScanner {
787785 return ;
788786 }
789787
790- if is_obfuscated_name ( name) {
791- findings. push ( (
792- FindingType :: ObfuscationChars ,
793- format ! ( "{} '{}'" , context, name) ,
794- ) ) ;
795- return ;
796- }
797-
798788 let name_char_count = name. chars ( ) . count ( ) ;
799789
800790 if name. contains ( '/' )
@@ -816,21 +806,6 @@ impl CollapseScanner {
816806 ) ) ;
817807 }
818808
819- let simple_name_to_check = get_simple_name ( name) ;
820- if self
821- . suspicious_consecutive_chars_regex
822- . is_match ( simple_name_to_check)
823- {
824- findings. push ( (
825- FindingType :: ObfuscationChars ,
826- format ! (
827- "Consecutive Symbols: {} '{}'" ,
828- context,
829- truncate_string( name, 20 )
830- ) ,
831- ) ) ;
832- }
833-
834809 let non_ascii_count = name. chars ( ) . filter ( |& c| !c. is_ascii ( ) ) . count ( ) ;
835810 if non_ascii_count > 0 {
836811 findings. push ( (
@@ -1029,9 +1004,6 @@ impl CollapseScanner {
10291004 let obfuscation_count = type_counts
10301005 . get ( & FindingType :: ObfuscationLongName )
10311006 . unwrap_or ( & 0 )
1032- + type_counts
1033- . get ( & FindingType :: ObfuscationChars )
1034- . unwrap_or ( & 0 )
10351007 + type_counts
10361008 . get ( & FindingType :: ObfuscationUnicode )
10371009 . unwrap_or ( & 0 ) ;
@@ -1155,15 +1127,6 @@ impl CollapseScanner {
11551127 }
11561128 }
11571129
1158- if let Some ( obfuscated) = by_type. get ( & FindingType :: ObfuscationChars ) {
1159- if !obfuscated. is_empty ( ) {
1160- explanations. push (
1161- "Uses obfuscated code, which may be trying to hide malicious functionality."
1162- . to_string ( ) ,
1163- ) ;
1164- }
1165- }
1166-
11671130 if let Some ( high_entropy) = by_type. get ( & FindingType :: HighEntropy ) {
11681131 if !high_entropy. is_empty ( ) && resource_info. is_some ( ) {
11691132 let ri = resource_info. unwrap ( ) ;
0 commit comments