#!/usr/local/bin/php
", "");
$abbr = str_between($response, "", "");
$region = str_between($response, "", "");
$city = str_between($response, "", "");
$open_proxy = str_between($response, "", "");
$tor = str_between($response, "", "");
$data_center = str_between($response, "", "");
$satellite_provider = str_between($response, "", "");
$api_codes = str_between($response, "", "");
$tor_nodes = str_between($response, "", "");
$active_proxies = str_between($response, "", "");
$total_proxies = str_between($response, "", "");
$hosting_providers = str_between($response, "", "");
$hosting_subnets = str_between($response, "", "");
$satellite_providers = str_between($response, "", "");
$satellite_subnets = str_between($response, "", "");
echo "
|N|/-------------------------------------------------------------------------------------\|A|
|i| NiX API CLI - (c) http://nixapi.com/ |P|
|X|\-------------------------------------------------------------------------------------/|I|
CURRENTLY KEEPS RECORDS OF:
[+] $hosting_providers hosting provider IP's in $hosting_subnets subnets.
[+] $satellite_providers satellite provider IP's in $satellite_subnets subnets.
[+] $total_proxies open proxies in the past two week period where $active_proxies proxies
worked in the past 12 hours.
[+] $tor_nodes Tor nodes
IPv4: $ipaddr Hostname: $hostname
Country long: $country Country abbr.: $abbr Region: $region City: $city
Data center: $data_center
Satellite provider: $satellite_provider
Open proxy database: $open_proxy
Tor network: $tor
API codes: $api_codes - More information: http://nixapi.com/documentation
Open Proxy Scan is disabled in CLI mode. Use http://nixapi.com/ip-reputation-lookup
IP Reputation Lookup is disabled in CLI mode. Use http://nixapi.com/ip-reputation-lookup
";
} else {
die("[-] An error has occurred. Please try again.\n");
}
/*---------------------------------------------------------------------
/ DO NOT EDIT ANYTHING BELOW OR THE QUERY WILL FAIL /
---------------------------------------------------------------------*/
function str_between($string, $start, $end) {
$string = " ".$string;
$ini = strpos($string, $start);
if ($ini == 0) {
return "";
}
$ini += strlen($start);
$len = strpos($string, $end, $ini) - $ini;
return substr($string, $ini, $len);
}
function nix_api () {
global $ipaddr,$api_proxy,$api_proxytype;
$proxy_regex = '(\d{1,3}\.\d{1,3}\.\d{1,3}\.\d{1,3}\:\d{1,5})';
if (!function_exists('curl_init')) {
die("[-] Error: Curl is not enabled.\n");
}
// Load-balanced API server-pool
$nixapi = "http://cli.nixapi.com/";
$options = array(
CURLOPT_RETURNTRANSFER => true,
CURLOPT_HEADER => 1,
CURLOPT_FOLLOWLOCATION => false,
CURLOPT_ENCODING => "",
CURLOPT_USERAGENT => "NiX API CLI",
CURLOPT_AUTOREFERER => true,
CURLOPT_CONNECTTIMEOUT => 4,
CURLOPT_TIMEOUT => 60,
CURLOPT_MAXREDIRS => 1,
CURLOPT_SSL_VERIFYHOST => 0,
CURLOPT_SSL_VERIFYPEER => false,
CURL_HTTP_VERSION_1_1 => true,
CURLOPT_VERBOSE => 0,
CURLOPT_POSTFIELDS => "ipaddr=$ipaddr"
);
$ch = curl_init($nixapi);
curl_setopt_array($ch,$options);
if (!empty($proxy)) {
switch ($proxytype) {
case "HTTP": curl_setopt($ch, CURLOPT_PROXYTYPE, CURLPROXY_HTTP); break;
case "SOCKS4": curl_setopt($ch, CURLOPT_PROXYTYPE, CURLPROXY_SOCKS4); break;
case "SOCKS5": curl_setopt($ch, CURLOPT_PROXYTYPE, CURLPROXY_SOCKS5); break;
default: die("[-] Error: Invalid proxy type.\n");
}
if (preg_match("$proxy_regex", $proxy)) {
curl_setopt($ch, CURLOPT_PROXY, $proxy);
} else {
die("[-] Error: Invalid proxy.\n");
}
}
// Query NiX API
$response = curl_exec($ch);
$errno = curl_errno($ch);
$errmsg = curl_error($ch) ;
$info = curl_getinfo($ch);
curl_close($ch);
if ($errno == "0" && $info['http_code'] == "200") {
return $response;
} else {
return false;
}
}
function ip($ip = '') {
if (preg_match("/^(\d{1,3})\.(\d{1,3})\.(\d{1,3})\.(\d{1,3})$/", $ip)) {
$parts = explode(".", $ip);
foreach ($parts as $ip_parts) {
if (intval($ip_parts) > 255 || intval($ip_parts) < 0) {
return false;
}
}
return true;
} else {
return false;
}
}
?>