what you don't know can hurt you

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:

May 2022

  • Su
  • Mo
  • Tu
  • We
  • Th
  • Fr
  • Sa
  • 1
    May 1st
    0 Files
  • 2
    May 2nd
    15 Files
  • 3
    May 3rd
    19 Files
  • 4
    May 4th
    24 Files
  • 5
    May 5th
    15 Files
  • 6
    May 6th
    14 Files
  • 7
    May 7th
    0 Files
  • 8
    May 8th
    0 Files
  • 9
    May 9th
    13 Files
  • 10
    May 10th
    7 Files
  • 11
    May 11th
    99 Files
  • 12
    May 12th
    45 Files
  • 13
    May 13th
    7 Files
  • 14
    May 14th
    0 Files
  • 15
    May 15th
    0 Files
  • 16
    May 16th
    16 Files
  • 17
    May 17th
    26 Files
  • 18
    May 18th
    0 Files
  • 19
    May 19th
    0 Files
  • 20
    May 20th
    0 Files
  • 21
    May 21st
    0 Files
  • 22
    May 22nd
    0 Files
  • 23
    May 23rd
    0 Files
  • 24
    May 24th
    0 Files
  • 25
    May 25th
    0 Files
  • 26
    May 26th
    0 Files
  • 27
    May 27th
    0 Files
  • 28
    May 28th
    0 Files
  • 29
    May 29th
    0 Files
  • 30
    May 30th
    0 Files
  • 31
    May 31st
    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