-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathpmaFile.php
executable file
·82 lines (71 loc) · 2.5 KB
/
pmaFile.php
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
#!/usr/bin/php -q
<?php
//pmaFile
//Copyright (C) 2004 Devin Egan
//
//This program is free software; you can redistribute it and/or
//modify it under the terms of the GNU General Public License
//as published by the Free Software Foundation; either version 2
//of the License, or (at your option) any later version.
//
//This program is distributed in the hope that it will be useful,
//but WITHOUT ANY WARRANTY; without even the implied warranty of
//MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
//GNU General Public License for more details.
//
//You should have received a copy of the GNU General Public License
//along with this program; if not, write to the Free Software
//Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
//Include the PMA Config
include_once("includes/config.inc.php");
//Include Functions
include_once("includes/functions.inc.php");
//Display Baner
printf("phpMyAudit %s\n\n", $version);
//Check for proper usage
if(!isset($argv[1])){
printf("Usage: %s filename\n", $argv[0]);
exit;
}
$intCount = 0;
$intFound = 0;
$intFastCant = 0;
$decPercentage = 0;
//Open the File for reading and processing
$file = fopen($argv[1], "r");
time_start();
while(!feof($file)){
$line = fgets($file, 80);
$line = str_replace("\n","",$line);
$arrFile = explode(":", $line);
if($arrFile[0] && $arrFile[1]){
$intCount += 1;
$sqlTest = "SELECT entry FROM dictionary WHERE hash='$arrFile[1]' OR old_hash='$arrFile[1]'";
$resTest = mysqli_query($link, $sqlTest);
$numTest = mysqli_num_rows($resTest);
if($numTest){
while($arrTest = mysqli_fetch_array($resTest, MYSQLI_ASSOC)){
printf("%s: %s - $arrTest[entry] (found)\n", $arrFile[0], $arrFile[1]);
$intFound += 1;
if(strlen($arrTest["entry"]) > 8){
$intFastCant += 1;
}
}
} else {
printf("%s: %s - NOT FOUND\n", $arrFile[0], $arrFile[1]);
}
}
}
time_stop();
fclose($file);
$decPercentage = ($intFound/$intCount) * 100;
if($intFastCant && $intFound){
$decCantPercentage = ($intFastCant/$intFound) * 100;
} else {
$decCantPercentage = 0;
}
$decTime = time_result();
printf("\nTotal: %s\nFound: %s\nTime: %01.6f seconds\n%02.2f%% of the passwords were found.\n%02.2f%% of the found passwords would be difficult to brute force.\n",$intCount, $intFound, $decTime, $decPercentage, $decCantPercentage);
//Close the MySQL database
mysqli_close($link);
?>