-
Notifications
You must be signed in to change notification settings - Fork 0
/
CheckStatus.php
116 lines (109 loc) · 2.52 KB
/
CheckStatus.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
<?php
use JonnyW\PhantomJs\Client;
class CheckStatus
{
public static function search() {
//Copy and Paste IP range with line break (note: this IP range belongs to FaceBook)
$str = "31.13.24.0/21
31.13.64.0/19
31.13.64.0/24
31.13.69.0/24
31.13.70.0/24
31.13.71.0/24
31.13.72.0/24
31.13.73.0/24
31.13.75.0/24
31.13.76.0/24
31.13.77.0/24
31.13.78.0/24
31.13.79.0/24
31.13.80.0/24
66.220.144.0/20
66.220.144.0/21
66.220.149.11/16
66.220.152.0/21
66.220.158.11/16
66.220.159.0/24
69.63.176.0/21
69.63.176.0/24
69.63.184.0/21
69.171.224.0/19
69.171.224.0/20
69.171.224.37/16
69.171.229.11/16
69.171.239.0/24
69.171.240.0/20
69.171.242.11/16
69.171.255.0/24
74.119.76.0/22
173.252.64.0/19
173.252.70.0/24
173.252.96.0/19
204.15.20.0/22
69.63.176.0/20
173.252.64.0/18
103.4.96.0/22
31.13.64.0/18
31.13.65.0/24
31.13.67.0/24
31.13.68.0/24
31.13.74.0/24
31.13.96.0/19
31.13.66.0/24
69.63.178.0/24
31.13.82.0/24
31.13.83.0/24
31.13.84.0/24
31.13.85.0/24
31.13.87.0/24
31.13.88.0/24
31.13.89.0/24
31.13.90.0/24
31.13.91.0/24
31.13.92.0/24
31.13.93.0/24
31.13.94.0/24
31.13.95.0/24
69.171.253.0/24
69.63.186.0/24
69.63.176.0/20
45.64.40.0/22
129.134.0.0/16
157.240.0.0/16
179.60.192.0/22
185.60.216.0/22";
//Create array from IP addresses
$ip = explode("\n", $str);
$fun = function($n)
{
return explode("/", $n)[0];
};
$ip = array_map($fun, $ip);
//Create every possible IP address
$fun2 = function ($n) {
$ary = array();
$ip = explode(".",$n);
for ($x = 11; $x <= 255; $x++) {
$ary[] = $ip[0].".".$ip[1].".".$ip[2].".".$x;
}
return $ary;
};
$ip = array_map($fun2, $ip);
$ip = array_reduce($ip, 'array_merge', array());
foreach ($ip as $i){
$state = self::test("http://".$i."/");
echo $i . "--------" . $state . "\n";
}
}
// Using PhantomJS validate every IP
public static function test($url) {
$client = Client::getInstance();
$client->getEngine()->setPath( base_path() . '\bin\phantomjs.exe');
$request = $client->getMessageFactory()->createRequest($url, 'GET');
$response = $client->getMessageFactory()->createResponse();
// Send the request
$client->send($request, $response);
// Get status code
return $response->getStatus();
}
}