forked from omergulen/keygen
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathglobal.php
212 lines (175 loc) · 4.7 KB
/
global.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
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
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
<?php
function make($name)
{
global $generators;
if (!isset($generators[$name])) {
return;
}
return $generators[$name]['function']();
}
function random($length = 9, $add_dashes = false, $available_sets = 'luds', $special_chars = '!@#$%&*?')
{
$sets = [];
if (strpos($available_sets, 'l') !== false) {
$sets[] = 'abcdefghjkmnpqrstuvwxyz';
}
if (strpos($available_sets, 'u') !== false) {
$sets[] = 'ABCDEFGHJKMNPQRSTUVWXYZ';
}
if (strpos($available_sets, 'd') !== false) {
$sets[] = '23456789';
}
if (strpos($available_sets, 's') !== false) {
$sets[] = $special_chars;
}
$all = '';
$password = '';
foreach ($sets as $set) {
$password .= $set[array_rand(str_split($set))];
$all .= $set;
}
$all = str_split($all);
for ($i = 0; $i < $length - count($sets); $i++) {
$password .= $all[array_rand($all)];
}
$password = str_shuffle($password);
if (!$add_dashes) {
return $password;
}
$dash_len = floor(sqrt($length));
$dash_str = '';
while (strlen($password) > $dash_len) {
$dash_str .= substr($password, 0, $dash_len).'-';
$password = substr($password, $dash_len);
}
$dash_str .= $password;
return $dash_str;
}
function generateRandomWPAKey($bits)
{
$in_bits = ['160', '504'];
if (in_array($bits, $in_bits)) {
$buytes = $bits / 8;
$WPAKey = 'NipPBM4AQkqCI5ThDOxJ6GocFKzjsd9SLbWXfR8Z1ywV72t3UmvEa0HeugnrlY';
$key = substr(str_shuffle($WPAKey), 0, $buytes);
return $key;
}
}
function generateRandomWEPKey($bits)
{
$in_bits = ['64', '128', '152', '256'];
if (in_array($bits, $in_bits)) {
$buytes = $bits / 8;
$WEPKey = 'APWNZFpn8VYU5aOiMj9mvkH37hXd4T0btIgzf6JGeRBDCQ2rEs1lSwyKuoqLcx';
return substr(str_shuffle($WEPKey), 0, $buytes);
}
}
function generateRandomSHAKey($bits)
{
$random_pass = random(15);
if ($bits == 512) {
return hash('sha512', $random_pass);
} elseif ($bits == 256) {
return hash('sha256', $random_pass);
} elseif ($bits == 128) {
return hash('md5', $random_pass);
}
}
$generators = [
'password' => [
'name' => 'Decent Password',
'function' => function () {
return random(10, false, 'lud');
},
],
'strongpassword' => [
'name' => 'Strong Password',
'function' => function () {
return random(15);
},
],
'verystrongpassword' => [
'name' => 'Very Strong Password',
'function' => function () {
return random(30);
},
],
'codeigniter' => [
'name' => 'CodeIgniter Encryption Key',
'function' => function () {
return random(32);
},
],
'laravel' => [
'name' => 'Laravel Encryption Key',
'function' => function () {
return random(32, false, 'lud');
},
],
'wordpress' => [
'name' => 'Wordpress Key',
'function' => function () {
return random(64, false, 'luds', '$!#%&/()=*@-_.:,; <>');
},
],
'wpa160' => [
'name' => 'WPA 160-bit Key',
'function' => function () {
return generateRandomWPAKey(160);
},
],
'wpa504' => [
'name' => 'WPA 504-bit Key',
'function' => function () {
return generateRandomWPAKey(504);
},
],
'wep64' => [
'name' => 'WEP 64-bit Key',
'function' => function () {
return generateRandomWEPKey(64);
},
],
'wep128' => [
'name' => 'WEP 128-bit Key',
'function' => function () {
return generateRandomWEPKey(128);
},
],
'wep152' => [
'name' => 'WEP 152-bit Key',
'function' => function () {
return generateRandomWEPKey(152);
},
],
'wep256' => [
'name' => 'WEP 256-bit Key',
'function' => function () {
return generateRandomWEPKey(256);
},
],
'crc32' => [
'name' => 'CRC32 Key',
'function' => function () {
return crc32(random(15));
},
],
'sha512' => [
'name' => 'SHA 512-bit Key',
'function' => function () {
return generateRandomSHAKey(512);
},
],
'sha256' => [
'name' => 'SHA 256-bit Key',
'function' => function () {
return generateRandomSHAKey(256);
},
],
'sha128' => [
'name' => 'SHA 128-bit Key',
'function' => function () {
return generateRandomSHAKey(128);
},
],
];