what you don't know can hurt you
Home Files News &[SERVICES_TAB]About Contact Add New

NiX API Script

NiX API Script
Posted Dec 20, 2011
Site nixapi.com

NiX API is a powerful anti-proxy, anti-fraud, and IP reputation lookup API. It uses the NiX database at cli.nixapi.com to determine IP country/region/city, data center details, satellite provider details, open proxy details, and Tor network association.

tags | tool, scanner
systems | unix
SHA-256 | 474102596a87d21818c553be365a5aee27299455bc52719a27f2ca79bcfa0979

NiX API Script

Change Mirror Download
#!/usr/local/bin/php

<?php

/*---------------------------------------------------------------------
/ Copyright (c) 2011 - NiX - http://nixapi.com/ - All Rights Reserved /
---------------------------------------------------------------------*/

/*

* Permission is hereby granted, without written agreement and without
* license or royalty fees, to use, copy, modify, and distribute this
* software and to distribute modified versions of this software for any
* purpose, provided that the above copyright notice and the following
* two paragraphs appear in all copies of this software.
*
* In no event shall NiX LLC or the NiX Development Group be liable
* to any party for direct, indirect, special, incidental, or consequential
* damages arising out of the use of this software and its documentation,
* even if NiX LLC and the NiX Development Group have been advised of
* the possibility of such damage.
*
* NiX LLC and the NiX Development Group specifically disclaim any
* warranties, including, but not limited to, the implied warranties of
* merchantability and fitness for a particular purpose. The software
* provided hereunder is on an "as is" basis, and NiX LLC and the
* NiX Development Group have no obligation to provide maintenance,
* support, updates, enhancements, or modifications.

*/

/*---------------------------------------------------------------------
/ INSTALLATION & USAGE /
---------------------------------------------------------------------*/

/*

1) cp nixapi /usr/local/sbin/
2) chmod 755 /usr/local/sbin/nixapi

Usage: nixapi 127.0.0.1

*/

error_reporting(E_ALL ^ E_NOTICE);

$ipaddr = trim($argv[1]);

if ($argc < 2 || !ip($ipaddr)) { die ("[-] Please enter a valid IPv4 address.\n"); }

$hostname = gethostbyaddr($ipaddr);

/*
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
*/

$api_proxy = "";

// Proxy type: HTTP or SOCKS4 or SOCKS5

$api_proxytype = "";

if ($response = nix_api()) {

$country = str_between($response, "<country>", "</country>");
$abbr = str_between($response, "<abbr>", "</abbr>");
$region = str_between($response, "<region>", "</region>");
$city = str_between($response, "<city>", "</city>");

$open_proxy = str_between($response, "<opd>", "</opd>");
$tor = str_between($response, "<tor>", "</tor>");
$data_center = str_between($response, "<dc>", "</dc>");
$satellite_provider = str_between($response, "<sp>", "</sp>");

$api_codes = str_between($response, "<codes>", "</codes>");

$tor_nodes = str_between($response, "<tornodes>", "</tornodes>");
$active_proxies = str_between($response, "<activeproxies>", "</activeproxies>");
$total_proxies = str_between($response, "<totalproxies>", "</totalproxies>");
$hosting_providers = str_between($response, "<hostingproviders>", "</hostingproviders>");
$hosting_subnets = str_between($response, "<hostingsubnets>", "</hostingsubnets>");
$satellite_providers = str_between($response, "<satelliteproviders>", "</satelliteproviders>");
$satellite_subnets = str_between($response, "<satellitesubnets>", "</satellitesubnets>");

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;
}
}

?>
Login or Register to add favorites

File Archive:

April 2024

  • Su
  • Mo
  • Tu
  • We
  • Th
  • Fr
  • Sa
  • 1
    Apr 1st
    10 Files
  • 2
    Apr 2nd
    26 Files
  • 3
    Apr 3rd
    40 Files
  • 4
    Apr 4th
    6 Files
  • 5
    Apr 5th
    26 Files
  • 6
    Apr 6th
    0 Files
  • 7
    Apr 7th
    0 Files
  • 8
    Apr 8th
    22 Files
  • 9
    Apr 9th
    14 Files
  • 10
    Apr 10th
    10 Files
  • 11
    Apr 11th
    13 Files
  • 12
    Apr 12th
    14 Files
  • 13
    Apr 13th
    0 Files
  • 14
    Apr 14th
    0 Files
  • 15
    Apr 15th
    30 Files
  • 16
    Apr 16th
    10 Files
  • 17
    Apr 17th
    22 Files
  • 18
    Apr 18th
    45 Files
  • 19
    Apr 19th
    8 Files
  • 20
    Apr 20th
    0 Files
  • 21
    Apr 21st
    0 Files
  • 22
    Apr 22nd
    11 Files
  • 23
    Apr 23rd
    68 Files
  • 24
    Apr 24th
    23 Files
  • 25
    Apr 25th
    0 Files
  • 26
    Apr 26th
    0 Files
  • 27
    Apr 27th
    0 Files
  • 28
    Apr 28th
    0 Files
  • 29
    Apr 29th
    0 Files
  • 30
    Apr 30th
    0 Files

Top Authors In Last 30 Days

File Tags

Systems

packet storm

© 2022 Packet Storm. All rights reserved.

Services
Security Services
Hosting By
Rokasec
close