Advertisement
scriptz-team

[PHP] NiXAPi

May 29th, 2012
133
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 5.71 KB | None | 0 0
  1. <?php
  2. /*
  3. _____ _____ _ _____ _____ _____ _____ _____ _____
  4. ___| | __ |_| _ |_ _|___ ___|_ _| __| _ | |
  5. |_ -| --| -| | __| | | |- _|___| | | | __| | | | |
  6. |___|_____|__|__|_|__| |_| |___| |_| |_____|__|__|_|_|_|
  7. |s C R i P T z - T E A M . i N F O|
  8.  
  9. NiXAPi
  10.  
  11. USAGE:
  12. index.php?ip=196.43.78.225
  13. */
  14. error_reporting(0);
  15.  
  16. $ipaddr = trim($_GET["ip"]);
  17.  
  18. $hostname = gethostbyaddr($ipaddr);
  19.  
  20. /*
  21. Leave variables below empty if you are not using a proxy to query the API. Paste the proxy in proxy format 127.0.0.1:1234
  22. */
  23.  
  24. $api_proxy = "";
  25.  
  26. //Proxy type: HTTP or SOCKS4 or SOCKS5
  27.  
  28. $api_proxytype = "";
  29.  
  30. if ($response = nix_api()) {
  31. $country = str_between($response, "<country>", "</country>");
  32. $abbr = str_between($response, "<abbr>", "</abbr>");
  33. $region = str_between($response, "<region>", "</region>");
  34. $city = str_between($response, "<city>", "</city>");
  35.  
  36. $open_proxy = str_between($response, "<opd>", "</opd>");
  37. $tor = str_between($response, "<tor>", "</tor>");
  38. $data_center = str_between($response, "<dc>", "</dc>");
  39. $satellite_provider = str_between($response, "<sp>", "</sp>");
  40.  
  41. $api_codes = str_between($response, "<codes>", "</codes>");
  42.  
  43. $tor_nodes = str_between($response, "<tornodes>", "</tornodes>");
  44. $active_proxies = str_between($response, "<activeproxies>", "</activeproxies>");
  45. $total_proxies = str_between($response, "<totalproxies>", "</totalproxies>");
  46. $hosting_providers = str_between($response, "<hostingproviders>", "</hostingproviders>");
  47. $hosting_subnets = str_between($response, "<hostingsubnets>", "</hostingsubnets>");
  48. $satellite_providers = str_between($response, "<satelliteproviders>", "</satelliteproviders>");
  49. $satellite_subnets = str_between($response, "<satellitesubnets>", "</satellitesubnets>");
  50.  
  51. echo "<pre>
  52. _____ _ __ __ _____ _____ _
  53. | | |_| | | | _ | _ |_|
  54. | | | | |- -| | | __| |
  55. |_|___|_|__|__| |__|__|__| |_|
  56. |s C R i P T z - T E A M . iNFO|</pre>";
  57. echo nl2br("
  58. CURRENTLY KEEPS RECORDS OF:
  59.  
  60. [+] $hosting_providers hosting provider IP's in $hosting_subnets subnets.
  61. [+] $satellite_providers satellite provider IP's in $satellite_subnets subnets.
  62. [+] $total_proxies open proxies in the past two week period where $active_proxies proxies
  63. worked in the past 12 hours.
  64. [+] $tor_nodes Tor nodes
  65.  
  66. IPv4: $ipaddr
  67. Hostname: $hostname
  68. Country long: $country
  69. Country abbr.: $abbr
  70. Region: $region
  71. City: $city
  72. Data center: $data_center
  73. Satellite provider: $satellite_provider
  74. Open proxy database: $open_proxy
  75. Tor network: $tor
  76. ");
  77.  
  78. } else {
  79. die("[-] An error has occurred. Please try again.\n");
  80. }
  81.  
  82. /*---------------------------------------------------------------------
  83. / DO NOT EDIT ANYTHING BELOW OR THE QUERY WILL FAIL /
  84. ---------------------------------------------------------------------*/
  85.  
  86. function str_between($string, $start, $end)
  87. {
  88. $string = " " . $string;
  89. $ini = strpos($string, $start);
  90.  
  91. if ($ini == 0) {
  92. return "";
  93. }
  94.  
  95. $ini += strlen($start);
  96. $len = strpos($string, $end, $ini) - $ini;
  97. return substr($string, $ini, $len);
  98. }
  99.  
  100. function nix_api()
  101. {
  102. global $ipaddr, $api_proxy, $api_proxytype;
  103. $proxy_regex = '(\d{1,3}\.\d{1,3}\.\d{1,3}\.\d{1,3}\:\d{1,5})';
  104.  
  105. if (!function_exists('curl_init')) {
  106. die("[-] Error: Curl is not enabled.\n");
  107. }
  108.  
  109. // Load-balanced API server-pool
  110.  
  111. $nixapi = "http://cli.nixapi.com/";
  112.  
  113. $options = array(
  114. CURLOPT_RETURNTRANSFER => true,
  115. CURLOPT_HEADER => 1,
  116. CURLOPT_FOLLOWLOCATION => false,
  117. CURLOPT_ENCODING => "",
  118. CURLOPT_USERAGENT => "NiX API CLI",
  119. CURLOPT_AUTOREFERER => true,
  120. CURLOPT_CONNECTTIMEOUT => 4,
  121. CURLOPT_TIMEOUT => 60,
  122. CURLOPT_MAXREDIRS => 1,
  123. CURLOPT_SSL_VERIFYHOST => 0,
  124. CURLOPT_SSL_VERIFYPEER => false,
  125. CURL_HTTP_VERSION_1_1 => true,
  126. CURLOPT_VERBOSE => 0,
  127. CURLOPT_POSTFIELDS => "ipaddr=$ipaddr"
  128. );
  129.  
  130. $ch = curl_init($nixapi);
  131. curl_setopt_array($ch, $options);
  132.  
  133. if (!empty($proxy)) {
  134. switch ($proxytype) {
  135.  
  136. case "HTTP":
  137. curl_setopt($ch, CURLOPT_PROXYTYPE, CURLPROXY_HTTP);
  138. break;
  139. case "SOCKS4":
  140. curl_setopt($ch, CURLOPT_PROXYTYPE, CURLPROXY_SOCKS4);
  141. break;
  142. case "SOCKS5":
  143. curl_setopt($ch, CURLOPT_PROXYTYPE, CURLPROXY_SOCKS5);
  144. break;
  145. default:
  146. die("[-] Error: Invalid proxy type.\n");
  147. }
  148.  
  149. if (preg_match("$proxy_regex", $proxy)) {
  150. curl_setopt($ch, CURLOPT_PROXY, $proxy);
  151. } else {
  152. die("[-] Error: Invalid proxy.\n");
  153. }
  154. }
  155.  
  156. // Query NiX API
  157.  
  158. $response = curl_exec($ch);
  159. $errno = curl_errno($ch);
  160. $errmsg = curl_error($ch);
  161. $info = curl_getinfo($ch);
  162.  
  163. curl_close($ch);
  164.  
  165. if ($errno == "0" && $info['http_code'] == "200") {
  166. return $response;
  167. } else {
  168. return false;
  169. }
  170. }
  171.  
  172. function ip($ip = '')
  173. {
  174. if (preg_match("/^(\d{1,3})\.(\d{1,3})\.(\d{1,3})\.(\d{1,3})$/", $ip)) {
  175. $parts = explode(".", $ip);
  176.  
  177. foreach ($parts as $ip_parts) {
  178. if (intval($ip_parts) > 255 || intval($ip_parts) < 0) {
  179. return false;
  180. }
  181. }
  182.  
  183. return true;
  184. } else {
  185. return false;
  186. }
  187. }
  188. ?>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement