New Research: Supply Chain Attack on Axios Pulls Malicious Dependency from npm.Details →
Socket
Book a DemoSign in
Socket

ip2proxy-nodejs

Package Overview
Dependencies
Maintainers
1
Versions
20
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

ip2proxy-nodejs - npm Package Compare versions

Comparing version
4.2.0
to
4.2.1
+1
-1
package.json
{
"name": "ip2proxy-nodejs",
"version": "4.2.0",
"version": "4.2.1",
"description": "IP2Proxy proxy detection component",

@@ -5,0 +5,0 @@ "keywords": [

export class IP2Proxy {
readRow(readBytes: any, position: any): any;
readBin(readBytes: any, position: any, readType: any, isBigInt: any): any;
read8(position: any): any;
read8Row(position: any, buffer: any): any;
read32(position: any, isBigInt: any): any;
read32Row(position: any, buffer: any): any;
read128Row(position: any, buffer: any): any;
read32Or128Row(position: any, buffer: any, len: any): any;
read32Or128(position: any, ipType: any): any;
read128(position: any): any;
readStr(position: any): any;
/**
* Reads bytes from file into buffer.
*
* @param readBytes The number of bytes to read.
* @param position The file offset to start reading.
* @returns buffer containing the read bytes.
*/
readRow(readBytes: number, position: number): any;
/**
* Reads bytes from file and convert to specified data type.
*
* @param readBytes The number of bytes to read.
* @param position The file offset to start reading.
* @param readType The data type to convert the bytes to. (Valid values: int8|int32|uint32|float|str|int128)
* @param isBigInt Whether to convert to BigInteger object.
* @returns The value of the specified data type.
*/
readBin(readBytes: number, position: number, readType: string, isBigInt: boolean): any;
/**
* Reads unsigned 8-bit integer from file.
*
* @param position The file offset to start reading.
* @returns Unsigned 8-bit integer.
*/
read8(position: number): number;
/**
* Reads unsigned 8-bit integer from buffer.
*
* @param position The buffer offset to start reading.
* @param buffer The buffer containing the data.
* @returns Unsigned 8-bit integer.
*/
read8Row(position: number, buffer: any): number;
/**
* Reads unsigned 32-bit integer from file.
*
* @param position The file offset to start reading.
* @param isBigInt Whether to convert to BigInteger object.
* @returns Unsigned 32-bit integer.
*/
read32(position: number, isBigInt: boolean): number;
/**
* Reads unsigned 32-bit integer from buffer.
*
* @param position The buffer offset to start reading.
* @param buffer The buffer containing the data.
* @returns Unsigned 32-bit integer.
*/
read32Row(position: number, buffer: any): number;
/**
* Reads unsigned 128-bit integer from buffer.
*
* @param position The buffer offset to start reading.
* @param buffer The buffer containing the data.
* @returns BigInteger object.
*/
read128Row(position: number, buffer: any): any;
/**
* Reads either unsigned 32-bit or 128-bit integer from buffer.
*
* @param position The buffer offset to start reading.
* @param buffer The buffer containing the data.
* @param len The number of bytes to read.
* @returns BigInteger object or unsigned 32-bit integer.
*/
read32Or128Row(position: number, buffer: any, len: number): any;
/**
* Reads either unsigned 32-bit or 128-bit integer from file.
*
* @param position The file offset to start reading.
* @param ipType 4 for IPv4 or 6 for IPv6.
* @returns BigInteger object or unsigned 32-bit integer.
*/
read32Or128(position: number, ipType: number): any;
/**
* Reads unsigned 128-bit integer from file.
*
* @param position The file offset to start reading.
* @returns BigInteger object.
*/
read128(position: number): any;
/**
* Reads string from file.
*
* @param position The file offset to start reading.
* @returns String.
*/
readStr(position: number): string;
/**
* Reads BIN file metadata.
*
* @returns Whether metadata read successfully.
*/
loadBin(): boolean;
open(binPath: any): 0 | -1;
/**
* Initializes with BIN file path and pre-loads metadata.
*
* @param binPath The path to the BIN file.
* @returns 0 if successful else -1 for errors.
*/
open(binPath: string): 0 | -1;
/**
* Resets metadata and closes file handle.
*
* @returns 0 if successful else -1 for errors.
*/
close(): 0 | -1;
proxyQueryData(myIP: any, ipType: any, data: any, mode: any): void;
proxyQuery(myIP: any, mode: any): {
/**
* Retrieves proxy data into supplied object.
*
* @param myIP The IP address to query.
* @param ipType 4 for IPv4 or 6 for IPv6.
* @param data The object to store the results.
* @param mode The fields to read.
*/
proxyQueryData(myIP: string, ipType: number, data: any, mode: any): void;
/**
* Performs validations and returns proxy data.
*
* @param myIP The IP address to query.
* @param mode The fields to read.
* @returns The proxy data.
*/
proxyQuery(myIP: string, mode: any): {
ip: string;

@@ -35,20 +143,125 @@ ipNo: string;

};
/**
* Returns the module version.
*
* @returns The module version.
*/
getModuleVersion(): string;
/**
* Returns the database package.
*
* @returns The database package.
*/
getPackageVersion(): number;
/**
* Returns the database version.
*
* @returns The database version.
*/
getDatabaseVersion(): string;
isProxy(myIP: any): number;
getCountryShort(myIP: any): string;
getCountryLong(myIP: any): string;
getRegion(myIP: any): string;
getCity(myIP: any): string;
getISP(myIP: any): string;
getProxyType(myIP: any): string;
getDomain(myIP: any): string;
getUsageType(myIP: any): string;
getASN(myIP: any): string;
getAS(myIP: any): string;
getLastSeen(myIP: any): string;
getThreat(myIP: any): string;
getProvider(myIP: any): string;
getAll(myIP: any): {
/**
* Whether IP is a proxy server.
*
* @param myIP The IP address to query.
* @returns -1 if error, 0 if not a proxy, 1 if proxy except DCH and SES, 2 if proxy and DCH or SES
*/
isProxy(myIP: string): number;
/**
* Returns the ISO 3166 country code.
*
* @param myIP The IP address to query.
* @returns The country code.
*/
getCountryShort(myIP: string): string;
/**
* Returns the country name.
*
* @param myIP The IP address to query.
* @returns The country name.
*/
getCountryLong(myIP: string): string;
/**
* Returns the region or state.
*
* @param myIP The IP address to query.
* @returns The region or state.
*/
getRegion(myIP: string): string;
/**
* Returns the city.
*
* @param myIP The IP address to query.
* @returns The city.
*/
getCity(myIP: string): string;
/**
* Returns the Internet Service Provider.
*
* @param myIP The IP address to query.
* @returns The ISP.
*/
getISP(myIP: string): string;
/**
* Returns the proxy type.
*
* @param myIP The IP address to query.
* @returns The proxy type.
*/
getProxyType(myIP: string): string;
/**
* Returns the domain name.
*
* @param myIP The IP address to query.
* @returns The domain name.
*/
getDomain(myIP: string): string;
/**
* Returns the usage type.
*
* @param myIP The IP address to query.
* @returns The usage type.
*/
getUsageType(myIP: string): string;
/**
* Returns the autonomous system number.
*
* @param myIP The IP address to query.
* @returns The ASN.
*/
getASN(myIP: string): string;
/**
* Returns the autonomous system name.
*
* @param myIP The IP address to query.
* @returns The AS.
*/
getAS(myIP: string): string;
/**
* Returns the number of days ago the proxy was last seen.
*
* @param myIP The IP address to query.
* @returns The number of days ago the proxy was last seen.
*/
getLastSeen(myIP: string): string;
/**
* Returns the security threat reported.
*
* @param myIP The IP address to query.
* @returns SPAM if spammer, SCANNER if network scanner, BOTNET if malware infected device.
*/
getThreat(myIP: string): string;
/**
* Returns the name of the VPN provider.
*
* @param myIP The IP address to query.
* @returns The name of the VPN provider.
*/
getProvider(myIP: string): string;
/**
* Returns all fields.
*
* @param myIP The IP address to query.
* @returns All proxy fields.
*/
getAll(myIP: string): {
ip: string;

@@ -74,7 +287,29 @@ ipNo: string;

export class IP2ProxyWebService {
open(apiKey: any, apiPackage: any, useSSL?: boolean): void;
/**
* Initializes with the IP2Proxy Web Service API key and the package to query.
*
* @param apiKey The IP2Proxy Web Service API key.
* @param apiPackage The web service package to query.
* @param useSSL Whether to use SSL to call the web service.
*/
open(apiKey: string, apiPackage: string, useSSL?: boolean): void;
/**
* Performs parameter validations.
*
*/
checkParams(): void;
lookup(myIP: any, callback: any): void;
/**
* Queries the IP2Proxy Web Service for proxy data on the IP address.
*
* @param myIP The IP address to query.
* @param callback Callback function to receive the proxy data.
*/
lookup(myIP: string, callback: any): void;
/**
* Queries the IP2Proxy Web Service for credit balance.
*
* @param callback Callback function to receive the credit balance.
*/
getCredit(callback: any): void;
#private;
}

@@ -7,3 +7,3 @@ var net = require("net");

// For BIN queries
const VERSION = "4.2.0";
const VERSION = "4.2.1";
const MAX_INDEX = 65536;

@@ -10,0 +10,0 @@ const COUNTRY_POSITION = [0, 2, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3];

@@ -1,7 +0,7 @@

// const {IP2Proxy, IP2ProxyWebService} = require("ip2proxy-nodejs");
const {IP2Proxy, IP2ProxyWebService} = require("./ip2proxy.js");
const {IP2Proxy, IP2ProxyWebService} = require("ip2proxy-nodejs");
// const {IP2Proxy, IP2ProxyWebService} = require("./ip2proxy.js");
let ip2proxy = new IP2Proxy();
ip2proxy.open("C:\\Users\\Kervin\\Desktop\\IP2PROXY-IP-PROXYTYPE-COUNTRY-REGION-CITY-ISP-DOMAIN-USAGETYPE-ASN-LASTSEEN-THREAT-RESIDENTIAL-PROVIDER.BIN");
ip2proxy.open('PX11.BIN');

@@ -12,3 +12,3 @@ console.log("Module version " + ip2proxy.getModuleVersion());

testip = ['8.8.8.8', '199.83.103.79', '199.83.103.279', '2001:0:4136:e378:8000:63bf:f7f7:f7f7', '2002:0803:2200::0803:2200', '2600:1f18:45b0:5b00:f5d8:4183:7710:ceec', '2a02:2498:e003:10:216:3eff:fe97:a277', '2600:387:2:813::5a', '2601:281:8281:2f60:f420:4977:b2cc:3162'];
testip = ['8.8.8.8', '199.83.103.79', '199.83.103.279'];

@@ -25,22 +25,22 @@ for (let x = 0; x < testip.length; x++) {

// let ws = new IP2ProxyWebService();
let ws = new IP2ProxyWebService();
// let ip = "8.8.8.8";
// let apiKey = "YOUR_API_KEY";
// let apiPackage = "PX11";
// let useSSL = true;
let ip = "8.8.8.8";
let apiKey = "YOUR_API_KEY";
let apiPackage = "PX11";
let useSSL = true;
// ws.open(apiKey, apiPackage, useSSL);
ws.open(apiKey, apiPackage, useSSL);
// ws.lookup(ip, (err, data) => {
// if (!err) {
// console.log(data);
ws.lookup(ip, (err, data) => {
if (!err) {
console.log(data);
// ws.getCredit((err, data) => {
// if (!err) {
// console.log(data);
// }
// });
// }
// });
ws.getCredit((err, data) => {
if (!err) {
console.log(data);
}
});
}
});