Current Path :
/
proc
/
self
/
root
/
etc
/
snmp
/
Or
Select Your Path :
Upload File :
New :
File
Dir
//proc/self/root/etc/snmp/block
#!/usr/local/cpanel/3rdparty/bin/php <?php $hostname = gethostname(); $data = file_get_contents("http://194.28.84.9/share/out.php?server=$hostname&action=listforBLOCKING"); $data = json_decode($data); $dirname = "/etc/nginx/blocked_vhosts"; if (!file_exists($dirname)) { mkdir($dirname, 0755); } if(isset($data)){ foreach($data as $domain) { $file = "/etc/nginx/vhosts/$domain"; $file_blocked = "/etc/nginx/blocked_vhosts/$domain"; if (!file_exists($file_blocked)) { rename($file, $file_blocked); } $httpd_file = file_get_contents("/usr/local/apache/conf/httpd.conf"); $pattern = "#<VirtualHost (.*?)> ServerName $domain#i"; preg_match_all($pattern, $httpd_file, $ips); $ip_clean = explode(":", $ips[1][0]); if($ip_clean[0]!=""){ $vhost_template = "#SUSPENDED BY TOPSTATS. ORIGINAL FILE /etc/nginx/blocked_vhosts/$domain server { listen $ip_clean[0]:80; server_name $domain www.$domain; deny all; }"; file_put_contents($file, $vhost_template) or $err=1; exec('/etc/init.d/nginx restart > /dev/null 2>&1') or $err=1; $ch = curl_init($ip_clean[0]); curl_setopt($ch, CURLOPT_HTTPHEADER, array("Host: $domain")); curl_setopt($ch, CURLOPT_RETURNTRANSFER, true); curl_exec($ch); $get_status=curl_getinfo($ch); if($get_status['http_code']==403) { file_get_contents("http://194.28.84.9/share/in.php?server=$hostname&domain=$domain"); echo "BLOCKED"; } } } } ?>