當前位置: 首頁>>代碼示例>>PHP>>正文


PHP wfUtils::potentialBinaryStringToHTML方法代碼示例

本文整理匯總了PHP中wfUtils::potentialBinaryStringToHTML方法的典型用法代碼示例。如果您正苦於以下問題:PHP wfUtils::potentialBinaryStringToHTML方法的具體用法?PHP wfUtils::potentialBinaryStringToHTML怎麽用?PHP wfUtils::potentialBinaryStringToHTML使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在wfUtils的用法示例。


在下文中一共展示了wfUtils::potentialBinaryStringToHTML方法的2個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的PHP代碼示例。

示例1: scan


//.........這裏部分代碼省略.........
                         $extraMsg = ' This file was detected because you have enabled HIGH SENSITIVITY scanning. This option is more aggressive than the usual scans, and may cause false positives.';
                     }
                 }
                 $treatAsBinary = $isPHP || $isHTML || wfConfig::get('scansEnabled_scanImages');
                 if ($treatAsBinary && strpos($data, '$allowed' . 'Sites') !== false && strpos($data, "define ('VER" . "SION', '1.") !== false && strpos($data, "TimThum" . "b script created by") !== false) {
                     if (!$this->isSafeFile($this->path . $file)) {
                         $this->addResult(array('type' => 'file', 'severity' => 1, 'ignoreP' => $this->path . $file, 'ignoreC' => $fileSum, 'shortMsg' => "File is an old version of TimThumb which is vulnerable.", 'longMsg' => "This file appears to be an old version of the TimThumb script which makes your system vulnerable to attackers. Please upgrade the theme or plugin that uses this or remove it." . $extraMsg, 'data' => array_merge(array('file' => $file), $dataForFile)));
                         break;
                     }
                 } else {
                     if (strpos($file, 'lib/wordfenceScanner.php') === false) {
                         $regexMatched = false;
                         foreach ($this->patterns['rules'] as $rule) {
                             $type = isset($rule[4]) && !empty($rule[4]) ? $rule[4] : 'server';
                             $logOnly = isset($rule[5]) && !empty($rule[5]) ? $rule[5] : false;
                             if ($type == 'server' && !$treatAsBinary) {
                                 continue;
                             } else {
                                 if (($type == 'both' || $type == 'browser') && $fileExt == 'js') {
                                     $extraMsg = '';
                                 } else {
                                     if (($type == 'both' || $type == 'browser') && !$treatAsBinary) {
                                         continue;
                                     }
                                 }
                             }
                             if (preg_match('/(' . $rule[2] . ')/i', $data, $matches, PREG_OFFSET_CAPTURE)) {
                                 if (!$this->isSafeFile($this->path . $file)) {
                                     $matchString = $matches[1][0];
                                     $matchOffset = $matches[1][1];
                                     $beforeString = substr($data, max(0, $matchOffset - 100), $matchOffset - max(0, $matchOffset - 100));
                                     $afterString = substr($data, $matchOffset + strlen($matchString), 100);
                                     if (!$logOnly) {
                                         $this->addResult(array('type' => 'file', 'severity' => 1, 'ignoreP' => $this->path . $file, 'ignoreC' => $fileSum, 'shortMsg' => "File appears to be malicious: " . esc_html($file), 'longMsg' => "This file appears to be installed by a hacker to perform malicious activity. If you know about this file you can choose to ignore it to exclude it from future scans. The text we found in this file that matches a known malicious file is: <strong style=\"color: #F00;\">\"" . wfUtils::potentialBinaryStringToHTML(strlen($matchString) > 200 ? substr($matchString, 0, 200) . '...' : $matchString) . "\"</strong>. The infection type is: <strong>" . esc_html($rule[3]) . '</strong>.' . $extraMsg, 'data' => array_merge(array('file' => $file), $dataForFile)));
                                     }
                                     $regexMatched = true;
                                     $this->scanEngine->recordMetric('malwareSignature', $rule[0], array('file' => $file, 'match' => $matchString, 'before' => $beforeString, 'after' => $afterString), false);
                                     break;
                                 }
                             }
                         }
                         if ($regexMatched) {
                             break;
                         }
                     }
                 }
                 if ($treatAsBinary && wfConfig::get('scansEnabled_highSense')) {
                     $badStringFound = false;
                     if (strpos($data, $this->patterns['badstrings'][0]) !== false) {
                         for ($i = 1; $i < sizeof($this->patterns['badstrings']); $i++) {
                             if (strpos($data, $this->patterns['badstrings'][$i]) !== false) {
                                 $badStringFound = $this->patterns['badstrings'][$i];
                                 break;
                             }
                         }
                     }
                     if ($badStringFound) {
                         if (!$this->isSafeFile($this->path . $file)) {
                             $this->addResult(array('type' => 'file', 'severity' => 1, 'ignoreP' => $this->path . $file, 'ignoreC' => $fileSum, 'shortMsg' => "This file may contain malicious executable code: " . esc_html($this->path . $file), 'longMsg' => "This file is a PHP executable file and contains the word 'eval' (without quotes) and the word '" . esc_html($badStringFound) . "' (without quotes). The eval() function along with an encoding function like the one mentioned are commonly used by hackers to hide their code. If you know about this file you can choose to ignore it to exclude it from future scans. This file was detected because you have enabled HIGH SENSITIVITY scanning. This option is more aggressive than the usual scans, and may cause false positives.", 'data' => array_merge(array('file' => $file), $dataForFile)));
                             break;
                         }
                     }
                 }
                 if (!$dontScanForURLs) {
                     $this->urlHoover->hoover($file, $data);
                 }
開發者ID:Jerram-Marketing,項目名稱:Gummer-Co,代碼行數:67,代碼來源:wordfenceScanner.php

示例2:

        echo $bg_colors[$stripe];
        ?>
" align="left" valign="baseline"><?php 
        echo $this->attackTime($attack_row->attackLogTime);
        ?>
</td>
							<td style="font-size: 100%; vertical-align: baseline; font-weight: normal; text-align: left; border-collapse: collapse; margin: 0; padding: 6px 4px; border: 1px solid #cccccc;<?php 
        echo $bg_colors[$stripe];
        ?>
" align="left" valign="baseline">
								<div style="font-weight: bold; font-size: 12px;"><?php 
        echo $this->displayIP($attack_row->IP);
        ?>
</div> 
								<pre class="display-file" style="font-size: 12px; vertical-align: baseline; width: 420px; margin: 0; padding: 0; border: 0; white-space: normal;"><?php 
        echo wfUtils::potentialBinaryStringToHTML($attack_row->longDescription, true);
        ?>
</pre>
							</td>
						</tr>
					<?php 
    }
    ?>
					<?php 
} else {
    ?>
						<tr>
							<td colspan="2">
								No blocked attacks yet.
							</td>
						</tr>
開發者ID:Jerram-Marketing,項目名稱:Gummer-Co,代碼行數:31,代碼來源:activity-report-email-inline.php


注:本文中的wfUtils::potentialBinaryStringToHTML方法示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。