Gateway Script


SUBMITTED BY: Guest

DATE: June 16, 2014, 1:17 p.m.

FORMAT: PHP

SIZE: 7.4 kB

HITS: 1390

  1. <?PHP
  2. // Coinurl Gateway v1.1
  3. // Author: Ptv2
  4. // Website: http://www.pak-soft.org/vb/
  5. // Function getBrowser() from http://php.net/manual/en/function.get-browser.php#101125
  6. error_reporting(0);
  7. session_start();
  8. // Settings
  9. $URLs_file = "urls.dat"; // A file which contains urls
  10. $log_enabled = true; // Enable/disable log - Boolean true or false.
  11. $log_file = "status.log"; // $log_enabled must be "true" for this to take effect
  12. $isCloudFlare = false; // If your host/server is protected by CloudFLare set this to true. Boolean true/false only.
  13. // Do not change anything staring from here. Those are functions and pre-set internal variables
  14. function getCoinUrl($url)
  15. {
  16. $uuid = "5165fa0fa1bb6049715674";
  17. $url = rawurlencode($url);
  18. $result = file_get_contents("https://coinurl.com/api.php?uuid={$uuid}&url={$url}");
  19. if($result == 'error')
  20. return false;
  21. else
  22. return $result;
  23. }
  24. $RDR = false;
  25. $proxy = "Not detected";
  26. if (!file_exists($URLs_file))
  27. file_put_contents($URLs_file, getCoinUrl("http://www.elite7hackers.us")."\n".getCoinUrl("http://leak.sx")."\n".getCoinUrl("https://www.google.com"));
  28. $URLs = file($URLs_file);
  29. function getBrowser()
  30. {
  31. $u_agent = $_SERVER['HTTP_USER_AGENT'];
  32. $bname = 'Unknown';
  33. $platform = 'Unknown';
  34. $version = "";
  35. //First get the platform?
  36. if (preg_match('/linux/i', $u_agent)) {
  37. $platform = 'linux';
  38. } elseif (preg_match('/macintosh|mac os x/i', $u_agent)) {
  39. $platform = 'mac';
  40. } elseif (preg_match('/windows|win32/i', $u_agent)) {
  41. $platform = 'windows';
  42. }
  43. // Next get the name of the useragent yes seperately and for good reason
  44. if (preg_match('/MSIE/i', $u_agent) && !preg_match('/Opera/i', $u_agent)) {
  45. $bname = 'Internet Explorer';
  46. $ub = "MSIE";
  47. } elseif (preg_match('/Firefox/i', $u_agent)) {
  48. $bname = 'Mozilla Firefox';
  49. $ub = "Firefox";
  50. } elseif (preg_match('/Chrome/i', $u_agent)) {
  51. $bname = 'Google Chrome';
  52. $ub = "Chrome";
  53. } elseif (preg_match('/Safari/i', $u_agent)) {
  54. $bname = 'Apple Safari';
  55. $ub = "Safari";
  56. } elseif (preg_match('/Opera/i', $u_agent)) {
  57. $bname = 'Opera';
  58. $ub = "Opera";
  59. } elseif (preg_match('/Netscape/i', $u_agent)) {
  60. $bname = 'Netscape';
  61. $ub = "Netscape";
  62. }
  63. // finally get the correct version number
  64. $known = array(
  65. 'Version',
  66. $ub,
  67. 'other'
  68. );
  69. $pattern = '#(?<browser>' . join('|', $known) . ')[/ ]+(?<version>[0-9.|a-zA-Z.]*)#';
  70. if (!preg_match_all($pattern, $u_agent, $matches)) {
  71. // we have no matching number just continue
  72. }
  73. // see how many we have
  74. $i = count($matches['browser']);
  75. if ($i != 1) {
  76. //we will have two since we are not using 'other' argument yet
  77. //see if version is before or after the name
  78. if (strripos($u_agent, "Version") < strripos($u_agent, $ub)) {
  79. $version = $matches['version'][0];
  80. } else {
  81. $version = $matches['version'][1];
  82. }
  83. } else {
  84. $version = $matches['version'][0];
  85. }
  86. // check if we have a number
  87. if ($version == null || $version == "") {
  88. $version = "?";
  89. }
  90. return array(
  91. 'userAgent' => $u_agent,
  92. 'name' => $bname,
  93. 'version' => $version,
  94. 'platform' => $platform,
  95. 'pattern' => $pattern
  96. );
  97. }
  98. $UA = getBrowser();
  99. $CF = "";
  100. if (!$isCloudFlare) {
  101. $IP = @$_SERVER['REMOTE_ADDR'];
  102. } else {
  103. $IP = @$_SERVER["HTTP_CF_CONNECTING_IP"] or $IP = @$_SERVER['REMOTE_ADDR'];
  104. $CF = "-> Cloudflare possible";
  105. }
  106. if ($_SERVER['HTTP_X_FORWARDED_FOR'] || $_SERVER['HTTP_X_FORWARDED'] || $_SERVER['HTTP_FORWARDED_FOR'] || $_SERVER['HTTP_VIA'] || in_array($_SERVER['REMOTE_PORT'], array(
  107. 8080,
  108. 80,
  109. 6588,
  110. 8000,
  111. 9000,
  112. 9090,
  113. 3128,
  114. 553,
  115. 554
  116. )) || @fsockopen($IP, 80, $errno, $errstr, 1)) {
  117. $proxy = "detected";
  118. }
  119. $ref = @$_SERVER['HTTP_REFERER'] or $ref = "Unknown";
  120. $vID = sha1(session_id() . $IP . $UA['name'] . $UA['version'] . $UA['platform'] . $proxy); // Unique visistor ID
  121. $visit_data = "Visistor $vID from IP $IP -> Browser: $UA[name] $UA[version] | OS: $UA[platform] | Proxy: $proxy $CF\n";
  122. class xzlog
  123. {
  124. public $file = "log_file.log";
  125. public $swch = false;
  126. public function file($file)
  127. {
  128. $this->file = $file;
  129. }
  130. public function status($eod)
  131. {
  132. $this->swch = $eod;
  133. }
  134. public function write($data = "This is log comment")
  135. {
  136. if ($this->swch) {
  137. $log_data = date("[d/M/Y H:i:s]") . " $data";
  138. if (file_put_contents($this->file, $log_data, FILE_APPEND)) {
  139. return true;
  140. }
  141. }
  142. return false;
  143. }
  144. }
  145. $log = new xzlog;
  146. $log->file($log_file);
  147. $log->status($log_enabled);
  148. $log->write($visit_data);
  149. $log->write("Visistor referred by $ref\n");
  150. if (isset($_GET['id'])) {
  151. $ID = preg_replace('/\D/', '', $_GET['id']);
  152. $log->write('$_GET[\'id\'] parameter detected -> ' . $ID . "\n");
  153. if (array_key_exists($ID, $URLs)) {
  154. $URL = trim(preg_replace('/\s+/', ' ', $URLs[$ID]));
  155. $log->write('$_GET[\'id\'] parameter -> ' . $ID . " has found in database -> $URL\n");
  156. $RDR = true;
  157. }
  158. } else {
  159. $URL_count = count($URLs) - 1;
  160. $ID = mt_rand(0, $URL_count);
  161. $URL = trim(preg_replace('/\s+/', ' ', $URLs[$ID]));
  162. $log->write("ID selected by random -> $ID -> $URL\n");
  163. $RDR = true;
  164. }
  165. if ($RDR) {
  166. $log->write("Visistor $vID redirected to it's location.\n" . str_repeat("_", 148) . "\n");
  167. header("location: $URL");
  168. // Just in case if browser ignore redirect header
  169. $eHTML = "<html>\n<head>\n<meta http-equiv=\"refresh\" content=\"0; url=$url\">\n</head>\n<body>\n<h1><a href='$URL'>CLICK HERE</a></h1>\n</body>\n</html>";
  170. die($eHTML);
  171. } else {
  172. $log->write('$_GET[\'id\'] parameter -> ' . $ID . " has not found in database\n" . str_repeat("_", 148) . "\n");
  173. echo "<html>\n<head><title>ID Not found</title></head><body>\nThe URL ID you have selected is not available in database.<br/>\n";
  174. echo "Check one of the exist URLs:<br/>\n";
  175. foreach ($URLs as $key => $URL) {
  176. echo "<strong>$key -></strong> <a href='?id=$key'>$URL</a><br/>\n";
  177. }
  178. echo "</body>\n</html>";
  179. exit;
  180. }
  181. ?>

comments powered by Disqus