-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathindex.php
More file actions
89 lines (82 loc) · 2.84 KB
/
index.php
File metadata and controls
89 lines (82 loc) · 2.84 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
<?php
//set_time_limit(0);
//ini_set('memory_limit', '-1');
require("functions.php");
define("URL", (isset($_SERVER['HTTPS']) && $_SERVER['HTTPS'] === 'on' ? "https" : "http") . "://$_SERVER[HTTP_HOST]$_SERVER[REQUEST_URI]");
$chars = array();
$chars[] = "*l"; //1 random letter;
$chars[] = "*l"; //1 random letter;
$chars[] = "*l"; //1 random letter;
$chars[] = "*l"; //1 random letter;
$chars[] = "*l"; //1 random letter;
$chars[] = "*n"; //1 random number;
$tld = "com";
$stop = countCharRand($chars); // Total combination of chars for the Domain name (when to stop)
header('Content-Type: application/json; charset=utf-8');
echo json_encode(isDomainFree($chars, $tld, $stop, array(), array()));
die();
function isDomainFree($chars, $tld, $stop, $arr = array(), $free = array())
{
if ($stop == 0) {
file_put_contents(urlencode("Output Report" . date("Y-m-d H:i:s")) . ".txt", json_encode($free));
return $free;
}
$rand = false;
$i = 0;
do {
$domain = array();
foreach ($chars as $c) {
if (count(explode("*", $c)) > 1) {
$c = charRand(explode("*", $c)[1]);
$rand = true;
}
$domain[] = $c;
}
$domain = implode("", $domain) . "." . $tld;
} while (in_array($domain, $arr));
$whois = json_decode(file_get_contents(URL . "/phpWhois/index.php?mode=true&period=" . urlencode("1 days") . "&domain=" . urlencode($domain)), true);
if (!empty($whois['regrinfo']['registered'])) {
if ($whois['regrinfo']['registered'] == "no") {
$free[] = $domain;
}
}
$arr[] = $domain;
$stop = $stop - 1;
return isDomainFree($chars, $tld, $stop, $arr, $free);
}
function countCharRand($chars)
{
$num = 1;
foreach ($chars as $c) {
if (count(explode("*", $c)) > 1) {
$c = explode("*", $c)[1];
if ($c == "l") {
$values = 'qwertyuiopasdfghjklzxcvbnm';
$num = $num * strlen($values);
} elseif ($c == "n") {
$values = '1234567890';
$num = $num * strlen($values);
} elseif ($c == "a") {
$values = 'qwertyuiopasdfghjklzxcvbnm1234567890';
$num = $num * strlen($values);
}
} else {
$num = 1 * $num;
}
}
return $num;
}
function charRand($c)
{
if ($c == "l") {
$values = 'qwertyuiopasdfghjklzxcvbnm';
return $values[rand(0, strlen($values) - 1)];
} elseif ($c == "n") {
$values = '1234567890';
return $values[rand(0, strlen($values) - 1)];
} elseif ($c == "a") {
$values = 'qwertyuiopasdfghjklzxcvbnm1234567890';
return $values[rand(0, strlen($values) - 1)];
}
return false;
}