Skip to content

Commit 08d3796

Browse files
committed
Support IP2Proxy PX5 to PX8
1 parent 1ae4bea commit 08d3796

File tree

6 files changed

+211
-56
lines changed

6 files changed

+211
-56
lines changed

LICENSE.txt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
Copyright (c) 2018 IP2Location ( [email protected] )
1+
Copyright (c) 2019 IP2Location ( [email protected] )
22

33
Permission is hereby granted, free of charge, to any person obtaining
44
a copy of this software and associated documentation files (the

README.md

Lines changed: 56 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,9 @@
33

44
# IP2Proxy Ruby Library
55

6-
This module allows user to query an IP address if it was being used as open proxy, web proxy, VPN anonymizer and TOR exits. It lookup the proxy IP address from **IP2Proxy BIN Data** file. This data file can be downloaded at
6+
This module allows user to reverse search of IP address to detect VPN servers, open proxies, web proxies, Tor exit nodes, search engine robots and data center ranges using IP2Proxy BIN database. Other information available includes proxy type, country, state, city, ISP, domain name, usage type, AS number, AS name and last seen date.
7+
8+
It lookup the proxy IP address from **IP2Proxy BIN Data** file. This data file can be downloaded at
79

810
* Free IP2Proxy BIN Data: https://lite.ip2location.com
911
* Commercial IP2Proxy BIN Data: https://www.ip2location.com/proxy-database
@@ -23,51 +25,94 @@ Below are the methods supported in this module.
2325
|get_package_version|Get the package version (1 to 4 for PX1 to PX4 respectively).|
2426
|get_module_version|Get the module version.|
2527
|get_database_version|Get the database version.|
26-
|is_proxy|Check whether if an IP address was a proxy. Returned value:<ul><li>-1 : errors</li><li>0 : not a proxy</li><li>1 : a proxy</li><li>2 : a data center IP address</li></ul>|
28+
|is_proxy|Check whether if an IP address was a proxy. Please see [Proxy Type](#proxy-type) for details. Returned value:<ul><li>-1 : errors</li><li>0 : not a proxy</li><li>1 : a proxy</li><li>2 : a data center IP address</li></ul>|
2729
|get_all|Return the proxy information in array.|
2830
|get_proxytype|Return the proxy type. Please visit <a href="https://www.ip2location.com/databases/px4-ip-proxytype-country-region-city-isp" target="_blank">IP2Location</a> for the list of proxy types supported|
2931
|get_country_short|Return the ISO3166-1 country code (2-digits) of the proxy.|
3032
|get_country_long|Return the ISO3166-1 country name of the proxy.|
3133
|get_region|Return the ISO3166-2 region name of the proxy. Please visit <a href="https://www.ip2location.com/free/iso3166-2" target="_blank">ISO3166-2 Subdivision Code</a> for the information of ISO3166-2 supported|
3234
|get_city|Return the city name of the proxy.|
3335
|get_isp|Return the ISP name of the proxy.|
36+
|get_domain|Return the domain name of proxy's IP address or domain name.|
37+
|get_usagetype|Return the ISP's usage type of proxy's IP address or domain name. Please see [Usage Type](#usage-type) for details.|
38+
|get_asn|Return the autonomous system number (ASN) of proxy's IP address or domain name.|
39+
|get_as|Return the autonomous system (AS) name of proxy's IP address or domain name.|
40+
|get_last_seen|Return the last seen days ago value of proxy's IP address or domain name.|
3441

3542
## Usage
3643

3744
```
3845
require 'ip2proxy_ruby'
3946
4047
# open IP2Proxy BIN database for proxy lookup
41-
i2p = Ip2proxy.new.open("./data/IP2PROXY-IP-PROXYTYPE-COUNTRY-REGION-CITY-ISP.SAMPLE.BIN")
48+
i2p = Ip2proxy.new.open("./data/IP2PROXY-IP-PROXYTYPE-COUNTRY-REGION-CITY-ISP-DOMAIN-USAGETYPE-ASN-LASTSEEN.BIN")
4249
4350
# get versioning information
4451
print 'Module Version: ' + i2p.get_module_version + "\n"
4552
print 'Package Version: ' + i2p.get_package_version + "\n"
4653
print 'Database Version: ' + i2p.get_database_version + "\n"
4754
4855
# individual proxy data check
49-
print 'Is Proxy: ' + i2p.is_proxy('4.0.0.47').to_s + "\n"
50-
print 'Proxy Type: ' + i2p.get_proxytype('4.0.0.47') + "\n"
51-
print 'Country Code: ' + i2p.get_country_short('4.0.0.47') + "\n"
52-
print 'Country Name: ' + i2p.get_country_long('4.0.0.47') + "\n"
53-
print 'Region Name: ' + i2p.get_region('4.0.0.47') + "\n"
54-
print 'City Name: ' + i2p.get_city('4.0.0.47') + "\n"
55-
print 'ISP: ' + i2p.get_isp('4.0.0.47') + "\n"
56+
print 'Is Proxy: ' + i2p.is_proxy('1.2.3.4').to_s + "\n"
57+
print 'Proxy Type: ' + i2p.get_proxytype('1.2.3.4') + "\n"
58+
print 'Country Code: ' + i2p.get_country_short('1.2.3.4') + "\n"
59+
print 'Country Name: ' + i2p.get_country_long('1.2.3.4') + "\n"
60+
print 'Region Name: ' + i2p.get_region('1.2.3.4') + "\n"
61+
print 'City Name: ' + i2p.get_city('1.2.3.4') + "\n"
62+
print 'ISP: ' + i2p.get_isp('1.2.3.4') + "\n"
63+
print 'Domain: ' + i2p.get_domain('1.2.3.4') + "\n"
64+
print 'Usage Type: ' + i2p.get_usagetype('1.2.3.4') + "\n"
65+
print 'ASN: ' + i2p.get_asn('1.2.3.4') + "\n"
66+
print 'AS: ' + i2p.get_as('1.2.3.4') + "\n"
67+
print 'Last Seen: ' + i2p.get_last_seen('1.2.3.4') + "\n"
5668
5769
# single function to get all proxy data returned in array
58-
record = i2p.get_all('4.0.0.47')
70+
record = i2p.get_all('1.2.3.4')
5971
print 'is Proxy: ' + record['is_proxy'].to_s + "\n"
6072
print 'Proxy Type: ' + record['proxy_type'] + "\n"
6173
print 'Country Code: ' + record['country_short'] + "\n"
6274
print 'Country Name: ' + record['country_long'] + "\n"
6375
print 'Region Name: ' + record['region'] + "\n"
6476
print 'City Name: ' + record['city'] + "\n"
6577
print 'ISP: ' + record['isp'] + "\n"
78+
print 'Domain: ' + record['domain'] + "\n"
79+
print 'Usage Type: ' + record['usagetype'] + "\n"
80+
print 'ASN: ' + record['asn'] + "\n"
81+
print 'AS: ' + record['as'] + "\n"
82+
print 'Last Seen: ' + record['last_seen'] + "\n"
6683
6784
# close IP2Proxy BIN database
6885
i2p.close()
6986
```
7087

88+
### Proxy Type
89+
90+
|Proxy Type|Description|
91+
|---|---|
92+
|VPN|Anonymizing VPN services.|
93+
|TOR|Tor Exit Nodes.|
94+
|PUB|Public Proxies.|
95+
|WEB|Web Proxies.|
96+
|DCH|Hosting Providers/Data Center.|
97+
|SES|Search Engine Robots.
98+
99+
### Usage Type
100+
101+
|Usage Type|Description|
102+
|---|---|
103+
|COM|Commercial|
104+
|ORG|Organization|
105+
|GOV|Government|
106+
|MIL|Military|
107+
|EDU|University/College/School|
108+
|LIB|Library|
109+
|CDN|Content Delivery Network|
110+
|ISP|Fixed Line ISP|
111+
|MOB|Mobile ISP|
112+
|DCH|Data Center/Web Hosting/Transit|
113+
|SES|Search Engine Spider|
114+
|RSV|Reserved|
115+
71116
## Support
72117

73118

example.rb

Lines changed: 19 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -1,31 +1,41 @@
11
require 'ip2proxy_ruby'
22

33
# open IP2Proxy BIN database for proxy lookup
4-
i2p = Ip2proxy.new.open("./data/IP2PROXY-IP-PROXYTYPE-COUNTRY-REGION-CITY-ISP.SAMPLE.BIN")
4+
i2p = Ip2proxy.new.open("./data/IP2PROXY-IP-PROXYTYPE-COUNTRY-REGION-CITY-ISP-DOMAIN-USAGETYPE-ASN-LASTSEEN.BIN")
55

66
# get versioning information
77
print 'Module Version: ' + i2p.get_module_version + "\n"
88
print 'Package Version: ' + i2p.get_package_version + "\n"
99
print 'Database Version: ' + i2p.get_database_version + "\n"
1010

1111
# individual proxy data check
12-
print 'Is Proxy: ' + i2p.is_proxy('4.0.0.47').to_s + "\n"
13-
print 'Proxy Type: ' + i2p.get_proxytype('4.0.0.47') + "\n"
14-
print 'Country Code: ' + i2p.get_country_short('4.0.0.47') + "\n"
15-
print 'Country Name: ' + i2p.get_country_long('4.0.0.47') + "\n"
16-
print 'Region Name: ' + i2p.get_region('4.0.0.47') + "\n"
17-
print 'City Name: ' + i2p.get_city('4.0.0.47') + "\n"
18-
print 'ISP: ' + i2p.get_isp('4.0.0.47') + "\n"
12+
print 'Is Proxy: ' + i2p.is_proxy('1.2.3.4').to_s + "\n"
13+
print 'Proxy Type: ' + i2p.get_proxytype('1.2.3.4') + "\n"
14+
print 'Country Code: ' + i2p.get_country_short('1.2.3.4') + "\n"
15+
print 'Country Name: ' + i2p.get_country_long('1.2.3.4') + "\n"
16+
print 'Region Name: ' + i2p.get_region('1.2.3.4') + "\n"
17+
print 'City Name: ' + i2p.get_city('1.2.3.4') + "\n"
18+
print 'ISP: ' + i2p.get_isp('1.2.3.4') + "\n"
19+
print 'Domain: ' + i2p.get_domain('1.2.3.4') + "\n"
20+
print 'Usage Type: ' + i2p.get_usagetype('1.2.3.4') + "\n"
21+
print 'ASN: ' + i2p.get_asn('1.2.3.4') + "\n"
22+
print 'AS: ' + i2p.get_as('1.2.3.4') + "\n"
23+
print 'Last Seen: ' + i2p.get_last_seen('1.2.3.4') + "\n"
1924

2025
# single function to get all proxy data returned in array
21-
record = i2p.get_all('4.0.0.47')
26+
record = i2p.get_all('1.2.3.4')
2227
print 'is Proxy: ' + record['is_proxy'].to_s + "\n"
2328
print 'Proxy Type: ' + record['proxy_type'] + "\n"
2429
print 'Country Code: ' + record['country_short'] + "\n"
2530
print 'Country Name: ' + record['country_long'] + "\n"
2631
print 'Region Name: ' + record['region'] + "\n"
2732
print 'City Name: ' + record['city'] + "\n"
2833
print 'ISP: ' + record['isp'] + "\n"
34+
print 'Domain: ' + record['domain'] + "\n"
35+
print 'Usage Type: ' + record['usagetype'] + "\n"
36+
print 'ASN: ' + record['asn'] + "\n"
37+
print 'AS: ' + record['as'] + "\n"
38+
print 'Last Seen: ' + record['last_seen'] + "\n"
2939

3040
# close IP2Proxy BIN database
3141
i2p.close()

ip2proxy_ruby.gemspec

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,12 +2,12 @@
22

33
Gem::Specification.new do |s|
44
s.name = "ip2proxy_ruby"
5-
s.version = "1.0.4"
5+
s.version = "2.0.0"
66
s.authors = ["ip2location"]
77
s.email = ["[email protected]"]
88

99
s.summary = "IP2Proxy Ruby library"
10-
s.description = "The official IP2Proxy Ruby library to detect anonymous proxy, VPN and Tor exit nodes."
10+
s.description = "The official IP2Proxy Ruby library to detect VPN servers, open proxies, web proxies, Tor exit nodes, search engine robots and data center ranges using IP2Proxy BIN database. Other information available includes proxy type, country, state, city, ISP, domain name, usage type, AS number, AS name and last seen date."
1111
s.homepage = "https://github.com/ip2location/ip2proxy-ruby"
1212
s.licenses = ["MIT"]
1313
s.require_paths = ["lib"]

0 commit comments

Comments
 (0)