PluginProbe
Defender Security – Malware Scanner, Login Security & Firewall / 6.3.0
Defender Security – Malware Scanner, Login Security & Firewall v6.3.0
6.3.0 6.2.3 6.2.4 6.2.0 6.2.1 6.2.2 6.1.0 5.3.1 5.4.0 5.4.1 5.5.0 5.5.1 5.6.0 5.6.1 5.6.2 5.7.0 5.7.1 5.7.2 5.8.0 5.8.1 5.9.0 6.0.0 6.0.1 3.0.1 3.1.0 All 141 releases
← All changes | src/behavior/scan/class-malware-quick-scan.php +15 -13 5.7.0 → 6.3.0 View file →
@@ -79,9 +79,9 @@
79 79 'text' => $text,
80 80 'offset' => $offset,
81 81 );
82 82 }
83 - if ( empty( $local_issues['catches'] ) ) {
83 + if ( array() === $local_issues['catches'] ) {
84 84 continue;
85 85 }
86 86
87 87 if ( $this->condition_valid( $local_issues['catches'], $rule ) ) {
@@ -105,21 +105,23 @@
105 105 private function condition_valid( $found, $rule ): bool {
106 106 $condition = explode( 'and', $rule['condition'] );
107 107 $count = 0;
108 108 foreach ( $condition as $item ) {
109 - $patterns = array(
110 - 'x_of_them' => '/([a-z0-9]+)\s*of\s*(.*)/',
111 - 'id_at_pos' => '/(\$[a-zA-Z0-9]+)\s*at\s*(\d+)/',
112 - );
113 - foreach ( $patterns as $func => $pattern ) {
114 - if ( preg_match( $pattern, $item, $match ) ) {
115 - ++$count;
116 - $ret = $this->$func( $found, $match, $rule );
117 - if ( false === $ret ) {
118 - return false;
119 - }
109 + if ( preg_match( '/([a-z0-9]+)\s*of\s*(.*)/', $item, $match ) ) {
110 + ++$count;
111 + $ret = $this->x_of_them( $found, $match, $rule );
112 + if ( false === $ret ) {
113 + return false;
120 114 }
121 115 }
116 +
117 + if ( preg_match( '/(\$[a-zA-Z0-9]+)\s*at\s*(\d+)/', $item, $match ) ) {
118 + ++$count;
119 + $ret = $this->id_at_pos( $found, $match, $rule );
120 + if ( false === $ret ) {
121 + return false;
122 + }
123 + }
122 124 }
123 125 if ( 0 === $count ) {
124 126 $this->log( $rule['identifier'], Malware_Scan::MALWARE_LOG );
125 127 $this->log( $found, Malware_Scan::MALWARE_LOG );
@@ -169,9 +171,9 @@
169 171 private function id_at_pos( $found, $check_info, $rule ): bool {
170 172 // Get the text to check.
171 173 foreach ( $found as $item ) {
172 174 if ( $item['id'] === $check_info[1] ) {
173 - return strpos( $this->content, $item['text'] ) === $check_info[2];
175 + return strpos( $this->content, $item['text'] ) === (int) $check_info[2];
174 176 }
175 177 }
176 178
177 179 return false;