PluginProbe ʕ •ᴥ•ʔ
Wordfence Security – Firewall, Malware Scan, and Login Security / 1.4.2
Wordfence Security – Firewall, Malware Scan, and Login Security v1.4.2
8.2.2 8.2.1 8.2.0 3.7.1 3.7.2 3.8.1 3.8.2 3.8.3 3.8.4 3.8.5 3.8.6 3.8.7 3.8.8 3.8.9 3.9.1 4.0.1 4.0.2 4.0.3 5.0.1 5.0.2 5.0.3 5.0.4 5.0.5 5.0.6 5.0.7 5.0.8 5.0.9 5.1.1 5.1.2 5.1.4 5.1.5 5.1.6 5.1.7 5.1.8 5.1.9 5.2.1 5.2.2 5.2.3 5.2.4 5.2.5 5.2.6 5.2.7 5.2.8 5.2.9 5.3.1 5.3.10 5.3.11 5.3.12 5.3.2 5.3.3 5.3.4 5.3.5 5.3.6 5.3.7 5.3.8 5.3.9 6.0.1 6.0.10 6.0.11 6.0.12 6.0.14 6.0.15 6.0.16 6.0.17 6.0.18 6.0.19 6.0.2 6.0.20 6.0.21 6.0.22 6.0.23 6.0.24 6.0.25 6.0.3 6.0.4 6.0.5 6.0.6 6.0.7 6.0.8 6.0.9 6.1.1 6.1.10 6.1.11 6.1.12 6.1.14 6.1.15 6.1.16 6.1.17 6.1.2 6.1.3 6.1.4 6.1.5 6.1.6 6.1.7 6.1.8 6.1.9 6.2.0 6.2.1 6.2.10 6.2.2 6.2.3 6.2.4 6.2.5 6.2.6 6.2.7 6.2.8 6.2.9 6.3.0 6.3.1 6.3.10 6.3.11 6.3.12 6.3.14 6.3.15 6.3.16 6.3.17 6.3.18 6.3.19 6.3.2 6.3.20 6.3.21 6.3.22 6.3.3 6.3.4 6.3.5 6.3.6 6.3.7 6.3.8 6.3.9 7.0.1 7.0.2 7.0.3 7.0.4 7.0.5 7.1.0 7.1.1 7.1.10 7.1.11 7.1.12 7.1.14 7.1.15 7.1.16 7.1.17 7.1.18 7.1.19 7.1.2 7.1.20 7.1.3 7.1.4 7.1.5 7.1.6 7.1.7 7.1.8 7.1.9 7.10.0 7.10.1 7.10.2 7.10.3 7.10.4 7.10.5 7.10.6 7.10.7 7.11.0 7.11.1 7.11.2 7.11.3 7.11.4 7.11.5 7.11.6 7.11.7 7.2.1 7.2.2 7.2.3 7.2.4 7.2.5 7.3.1 7.3.2 7.3.3 7.3.4 7.3.5 7.3.6 7.4.0 7.4.1 7.4.10 7.4.11 7.4.12 7.4.14 7.4.2 7.4.3 trunk 7.4.4 1.1 7.4.5 1.2 7.4.6 1.3 7.4.7 1.3.1 7.4.8 1.3.2 7.4.9 1.3.3 7.5.0 1.4.2 7.5.1 1.4.3 7.5.10 1.4.4 7.5.11 1.4.5 7.5.2 1.4.6 7.5.3 1.4.7 7.5.4 1.4.8 7.5.5 1.5.1 7.5.6 1.5.2 7.5.7 1.5.3 7.5.8 1.5.4 7.5.9 1.5.5 7.6.0 1.5.6 7.6.1 2.0.1 7.6.2 2.0.2 7.7.0 2.0.3 7.7.1 2.0.5 7.8.0 2.0.6 7.8.1 2.0.7 7.8.2 2.1.0 7.9.0 2.1.1 7.9.1 2.1.2 7.9.2 2.1.3 7.9.3 2.1.4 8.0.0 2.1.5 8.0.1 3.0.2 8.0.2 3.0.3 8.0.3 3.0.4 8.0.4 3.0.5 8.0.5 3.0.6 8.1.0 3.0.7 8.1.1 3.0.8 8.1.2 3.0.9 8.1.3 3.1.0 8.1.4 3.1.1 v1.4.1 3.1.2 3.1.4 3.1.6 3.2.1 3.2.3 3.2.4 3.2.5 3.2.6 3.2.7 3.3.2 3.3.3 3.3.4 3.3.5 3.3.6 3.3.7 3.4.1 3.4.4 3.4.5 3.5.1 3.5.2 3.6.1 3.6.3 3.6.4 3.6.5 3.6.6 3.6.7 3.6.8 3.6.9
wordfence / lib / wordfenceHash.php
wordfence / lib Last commit date
Diff 14 years ago geshi 14 years ago .htaccess 14 years ago Diff.php 14 years ago IPTraf.php 14 years ago diffResult.php 14 years ago dropAll.php 14 years ago email_genericAlert.php 14 years ago email_newIssues.php 14 years ago geshi.php 14 years ago menu_activity.php 14 years ago menu_blockedIPs.php 14 years ago menu_config.php 14 years ago menu_options.php 14 years ago menu_scan.php 14 years ago sysinfo.php 14 years ago wf503.php 14 years ago wfAPI.php 14 years ago wfAction.php 14 years ago wfBrowscap.php 14 years ago wfBrowscapCache.php 14 years ago wfConfig.php 14 years ago wfCrawl.php 14 years ago wfDB.php 14 years ago wfDict.php 14 years ago wfIssues.php 14 years ago wfLockedOut.php 14 years ago wfLog.php 14 years ago wfModTracker.php 14 years ago wfRate.php 14 years ago wfScanEngine.php 14 years ago wfSchema.php 14 years ago wfUtils.php 14 years ago wfViewResult.php 14 years ago wordfenceClass.php 14 years ago wordfenceConstants.php 14 years ago wordfenceHash.php 14 years ago wordfenceScanner.php 14 years ago wordfenceURLHoover.php 14 years ago
wordfenceHash.php
111 lines
1 <?php
2 require_once('wordfenceClass.php');
3 class wordfenceHash {
4 private $whitespace = array("\n","\r","\t"," ");
5 public $totalData = 0; //To do a sanity check, don't use 'du' because it gets sparse files wrong and reports blocks used on disk. Use : find . -type f -ls | awk '{total += $7} END {print total}'
6 public $totalFiles = 0;
7 public $totalDirs = 0;
8 public $linesOfPHP = 0;
9 public $linesOfJCH = 0; //lines of HTML, CSS and javascript
10 public $striplen = 0;
11 private $hashes = array();
12 public function __construct($striplen){
13 $this->striplen = $striplen;
14 }
15 public function hashPaths($path, $only = array()){ //base path and 'only' is a list of files and dirs in the bast that are the only ones that should be processed. Everything else in base is ignored. If only is empty then everything is processed.
16 if($path[strlen($path) - 1] != '/'){
17 $path .= '/';
18 }
19 $files = scandir($path);
20 foreach($files as $file){
21 if(sizeof($only) > 0 && (! in_array($file, $only))){
22 continue;
23 }
24 $file = $path . $file;
25 wordfence::status(2, 'info', "Hashing item in base dir: $file");
26 $this->_dirHash($file);
27 }
28 return $this->hashes;
29 }
30 private function _dirHash($path){
31 if(substr($path, -3, 3) == '/..' || substr($path, -2, 2) == '/.'){
32 return;
33 }
34 if(is_dir($path)){
35 $this->totalDirs++;
36 if($path[strlen($path) - 1] != '/'){
37 $path .= '/';
38 }
39 $cont = scandir($path);
40 for($i = 0; $i < sizeof($cont); $i++){
41 if($cont[$i] == '.' || $cont[$i] == '..'){ continue; }
42 $file = $path . $cont[$i];
43 if(is_file($file)){
44 $this->processFile($file);
45 } else if(is_dir($file)) {
46 $this->_dirHash($file);
47 }
48 }
49 } else {
50 if(is_file($path)){
51 $this->processFile($path);
52 }
53 }
54 }
55 private function processFile($file){
56 $wfHash = $this->wfHash($file, true);
57 if($wfHash){
58 wordfence::status(2, 'info', "Examined file: $file");
59 $this->hashes[substr($file, $this->striplen)] = $wfHash;
60 //Now that we know we can open the file, lets update stats
61 if(preg_match('/\.(?:js|html|htm|css)$/i', $file)){
62 $this->linesOfJCH += sizeof(file($file));
63 } else if(preg_match('/\.php$/i', $file)){
64 $this->linesOfPHP += sizeof(file($file));
65 }
66 $this->totalFiles++;
67 $this->totalData += filesize($file);
68 } else {
69 wordfence::status(2, 'error', "Could not gen hash for file: $file");
70 }
71 }
72 public function wfHash($file, $binary = true){
73 $md5 = @md5_file($file, $binary);
74 if(! $md5){ return false; }
75 //$sha = @hash_file('sha256', $file, $binary);
76 //if(! $sha){ return false; }
77 $fp = @fopen($file, "rb");
78 if(! $fp){
79 return false;
80 }
81 $ctx = hash_init('sha256');
82 while (!feof($fp)) {
83 hash_update($ctx, str_replace($this->whitespace,"",fread($fp, 65536)));
84 }
85 $shac = hash_final($ctx, $binary);
86 //Taking out $sha for now because we don't use it on the scanning server side
87 return array($md5, '', $shac, filesize($file) );
88 }
89 public static function bin2hex($hashes){
90 function wf_func1($elem){
91 return array(
92 bin2hex($elem[0]),
93 bin2hex($elem[1]),
94 bin2hex($elem[2])
95 );
96 }
97 return array_map('wf_func1', $hashes);
98 }
99 public static function hex2bin($hashes){
100 function wf_func2($elem){
101 return array(
102 pack('H*', $elem[0]),
103 pack('H*', $elem[1]),
104 pack('H*', $elem[2])
105 );
106 }
107 return array_map('wf_func2', $hashes);
108 }
109 }
110 ?>
111