ip2proxy_ruby 1.0.4 → 2.0.0

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: c574300fb7ff35666bf4b8e222a75080e0cd243ed2c44877b8553328b1bc2b9f
4
- data.tar.gz: 96090be6428f5d69762a4b27610d93634e757a42592d86a6ab12c01f49b63fbe
3
+ metadata.gz: 42164edc7ec22e5c5d26f1d6bf3283dda4ab5ecb08dd1e02e4ff9971ec96319a
4
+ data.tar.gz: 28340d9b35b272b98f9d8c5a1616e4dfd1d077c57c2e2a25661f94e428631c48
5
5
  SHA512:
6
- metadata.gz: 816c038bcf7666b3bc5636b0cedb4e3f23cec2ba5e0b9eaaf2a5f80fc64114e033b4cb5c93538acab8742476168802d51cef867d3fdf96289693a02d8839ac00
7
- data.tar.gz: 0d0e6595fcb5972e90458e0bd1ba63376934061784421463354994e218701b9574afa7ffeb2a5c68ab6adfbfed74812bcc64e6cead8e590b16663ecb0586f7d5
6
+ metadata.gz: 22ee83b9ea0d240269eb1b9f77e0f9f57031ceb7a2a2e59e51d2ea684467eca3317c717df1045e69d70e4affb24d9039ff86631f6294306c2d16254593eaf20e
7
+ data.tar.gz: 4fe19be02e16b65d5852b2086c39720de28ddba5ce14a7456bd70a3551c74aaf299c5c8af5775acd02d23dd3fa41b14e112d0f5325eb0c058ebed81e158277c3
@@ -1,4 +1,4 @@
1
- Copyright (c) 2018 IP2Location ( support@ip2location.com )
1
+ Copyright (c) 2019 IP2Location ( support@ip2location.com )
2
2
 
3
3
  Permission is hereby granted, free of charge, to any person obtaining
4
4
  a copy of this software and associated documentation files (the
data/README.md CHANGED
@@ -3,7 +3,9 @@
3
3
 
4
4
  # IP2Proxy Ruby Library
5
5
 
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
7
9
 
8
10
  * Free IP2Proxy BIN Data: https://lite.ip2location.com
9
11
  * Commercial IP2Proxy BIN Data: https://www.ip2location.com/proxy-database
@@ -23,7 +25,7 @@ Below are the methods supported in this module.
23
25
  |get_package_version|Get the package version (1 to 4 for PX1 to PX4 respectively).|
24
26
  |get_module_version|Get the module version.|
25
27
  |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>|
27
29
  |get_all|Return the proxy information in array.|
28
30
  |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|
29
31
  |get_country_short|Return the ISO3166-1 country code (2-digits) of the proxy.|
@@ -31,6 +33,11 @@ Below are the methods supported in this module.
31
33
  |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|
32
34
  |get_city|Return the city name of the proxy.|
33
35
  |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.|
34
41
 
35
42
  ## Usage
36
43
 
@@ -38,7 +45,7 @@ Below are the methods supported in this module.
38
45
  require 'ip2proxy_ruby'
39
46
 
40
47
  # 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")
42
49
 
43
50
  # get versioning information
44
51
  print 'Module Version: ' + i2p.get_module_version + "\n"
@@ -46,16 +53,21 @@ print 'Package Version: ' + i2p.get_package_version + "\n"
46
53
  print 'Database Version: ' + i2p.get_database_version + "\n"
47
54
 
48
55
  # 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"
56
68
 
57
69
  # 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')
59
71
  print 'is Proxy: ' + record['is_proxy'].to_s + "\n"
60
72
  print 'Proxy Type: ' + record['proxy_type'] + "\n"
61
73
  print 'Country Code: ' + record['country_short'] + "\n"
@@ -63,11 +75,44 @@ print 'Country Name: ' + record['country_long'] + "\n"
63
75
  print 'Region Name: ' + record['region'] + "\n"
64
76
  print 'City Name: ' + record['city'] + "\n"
65
77
  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"
66
83
 
67
84
  # close IP2Proxy BIN database
68
85
  i2p.close()
69
86
  ```
70
87
 
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
+
71
116
  ## Support
72
117
 
73
118
  Email: support@ip2location.com
data/example.rb CHANGED
@@ -1,7 +1,7 @@
1
1
  require 'ip2proxy_ruby'
2
2
 
3
3
  # 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")
5
5
 
6
6
  # get versioning information
7
7
  print 'Module Version: ' + i2p.get_module_version + "\n"
@@ -9,16 +9,21 @@ print 'Package Version: ' + i2p.get_package_version + "\n"
9
9
  print 'Database Version: ' + i2p.get_database_version + "\n"
10
10
 
11
11
  # 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"
19
24
 
20
25
  # 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')
22
27
  print 'is Proxy: ' + record['is_proxy'].to_s + "\n"
23
28
  print 'Proxy Type: ' + record['proxy_type'] + "\n"
24
29
  print 'Country Code: ' + record['country_short'] + "\n"
@@ -26,6 +31,11 @@ print 'Country Name: ' + record['country_long'] + "\n"
26
31
  print 'Region Name: ' + record['region'] + "\n"
27
32
  print 'City Name: ' + record['city'] + "\n"
28
33
  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"
29
39
 
30
40
  # close IP2Proxy BIN database
31
41
  i2p.close()
@@ -2,12 +2,12 @@
2
2
 
3
3
  Gem::Specification.new do |s|
4
4
  s.name = "ip2proxy_ruby"
5
- s.version = "1.0.4"
5
+ s.version = "2.0.0"
6
6
  s.authors = ["ip2location"]
7
7
  s.email = ["support@ip2location.com"]
8
8
 
9
9
  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."
11
11
  s.homepage = "https://github.com/ip2location/ip2proxy-ruby"
12
12
  s.licenses = ["MIT"]
13
13
  s.require_paths = ["lib"]
@@ -8,11 +8,11 @@ require_relative 'ip2proxy_ruby/ip2proxy_record'
8
8
 
9
9
  class Ip2proxy
10
10
  attr_accessor :record_class4, :record_class6, :v4, :file, :db_index, :count, :base_addr, :ipno, :record, :database, :columns, :ip_version, :ipv4databasecount, :ipv4databaseaddr, :ipv4indexbaseaddr, :ipv6databasecount, :ipv6databaseaddr, :ipv6indexbaseaddr, :databaseyear, :databasemonth, :databaseday
11
-
12
- VERSION = '1.0.4'
11
+
12
+ VERSION = '2.0.0'
13
13
  FIELD_NOT_SUPPORTED = 'NOT SUPPORTED'
14
14
  INVALID_IP_ADDRESS = 'INVALID IP ADDRESS'
15
-
15
+
16
16
  def open(url)
17
17
  self.file = File.open(File.expand_path url, 'rb')
18
18
  i2p = Ip2proxyConfig.read(file)
@@ -32,33 +32,33 @@ class Ip2proxy
32
32
  self.record_class6 = (Ip2ProxyRecord.init database, 6)
33
33
  self
34
34
  end
35
-
35
+
36
36
  def close()
37
37
  self.file.close
38
38
  end
39
-
39
+
40
40
  def get_module_version()
41
41
  return VERSION
42
42
  end
43
-
43
+
44
44
  def get_package_version()
45
45
  return (self.db_index).to_s
46
46
  end
47
-
47
+
48
48
  def get_database_version()
49
49
  return (self.databaseyear).to_s + "." + (self.databasemonth).to_s + "." + (self.databaseday).to_s
50
50
  end
51
-
51
+
52
52
  def get_record(ip)
53
53
  ipno = IPAddr.new(ip, Socket::AF_UNSPEC)
54
54
  self.ip_version = ipno.ipv4? ? 4 : 6
55
55
  self.v4 = ipno.ipv4?
56
56
  self.count = ipno.ipv4? ? self.ipv4databasecount + 0 : self.ipv6databasecount + 0
57
57
  self.base_addr = (ipno.ipv4? ? self.ipv4databaseaddr - 1 : self.ipv6databaseaddr - 1)
58
-
58
+
59
59
  ipnum = ipno.to_i + 0
60
60
  col_length = columns * 4
61
-
61
+
62
62
  if ipv4indexbaseaddr > 0 || ipv6indexbaseaddr > 0
63
63
  indexpos = 0
64
64
  case ip_version
@@ -76,7 +76,7 @@ class Ip2proxy
76
76
  return self.record = bsearch(0, self.count, ipnum, self.base_addr, col_length)
77
77
  end
78
78
  end
79
-
79
+
80
80
  def get_country_short(ip)
81
81
  valid = !(IPAddr.new(ip) rescue nil).nil?
82
82
  if valid
@@ -91,7 +91,7 @@ class Ip2proxy
91
91
  end
92
92
  return country_short
93
93
  end
94
-
94
+
95
95
  def get_country_long(ip)
96
96
  valid = !(IPAddr.new(ip) rescue nil).nil?
97
97
  if valid
@@ -106,7 +106,7 @@ class Ip2proxy
106
106
  end
107
107
  return country_long
108
108
  end
109
-
109
+
110
110
  def get_region(ip)
111
111
  valid = !(IPAddr.new(ip) rescue nil).nil?
112
112
  if valid
@@ -121,7 +121,7 @@ class Ip2proxy
121
121
  end
122
122
  return region
123
123
  end
124
-
124
+
125
125
  def get_city(ip)
126
126
  valid = !(IPAddr.new(ip) rescue nil).nil?
127
127
  if valid
@@ -136,7 +136,7 @@ class Ip2proxy
136
136
  end
137
137
  return city
138
138
  end
139
-
139
+
140
140
  def get_isp(ip)
141
141
  valid = !(IPAddr.new(ip) rescue nil).nil?
142
142
  if valid
@@ -151,7 +151,7 @@ class Ip2proxy
151
151
  end
152
152
  return isp
153
153
  end
154
-
154
+
155
155
  def get_proxytype(ip)
156
156
  valid = !(IPAddr.new(ip) rescue nil).nil?
157
157
  if valid
@@ -166,7 +166,82 @@ class Ip2proxy
166
166
  end
167
167
  return proxytype
168
168
  end
169
-
169
+
170
+ def get_domain(ip)
171
+ valid = !(IPAddr.new(ip) rescue nil).nil?
172
+ if valid
173
+ rec = get_record(ip)
174
+ if !(rec.nil?)
175
+ domain = (defined?(rec.domain) && rec.domain != '') ? rec.domain : FIELD_NOT_SUPPORTED
176
+ else
177
+ domain = INVALID_IP_ADDRESS
178
+ end
179
+ else
180
+ domain = INVALID_IP_ADDRESS
181
+ end
182
+ return domain
183
+ end
184
+
185
+ def get_usagetype(ip)
186
+ valid = !(IPAddr.new(ip) rescue nil).nil?
187
+ if valid
188
+ rec = get_record(ip)
189
+ if !(rec.nil?)
190
+ usagetype = (defined?(rec.usagetype) && rec.usagetype != '') ? rec.usagetype : FIELD_NOT_SUPPORTED
191
+ else
192
+ usagetype = INVALID_IP_ADDRESS
193
+ end
194
+ else
195
+ usagetype = INVALID_IP_ADDRESS
196
+ end
197
+ return usagetype
198
+ end
199
+
200
+ def get_asn(ip)
201
+ valid = !(IPAddr.new(ip) rescue nil).nil?
202
+ if valid
203
+ rec = get_record(ip)
204
+ if !(rec.nil?)
205
+ asn = (defined?(rec.asn) && rec.asn != '') ? rec.asn : FIELD_NOT_SUPPORTED
206
+ else
207
+ asn = INVALID_IP_ADDRESS
208
+ end
209
+ else
210
+ asn = INVALID_IP_ADDRESS
211
+ end
212
+ return asn
213
+ end
214
+
215
+ def get_as(ip)
216
+ valid = !(IPAddr.new(ip) rescue nil).nil?
217
+ if valid
218
+ rec = get_record(ip)
219
+ if !(rec.nil?)
220
+ as = (defined?(rec.as) && rec.as != '') ? rec.as : FIELD_NOT_SUPPORTED
221
+ else
222
+ as = INVALID_IP_ADDRESS
223
+ end
224
+ else
225
+ as = INVALID_IP_ADDRESS
226
+ end
227
+ return as
228
+ end
229
+
230
+ def get_last_seen(ip)
231
+ valid = !(IPAddr.new(ip) rescue nil).nil?
232
+ if valid
233
+ rec = get_record(ip)
234
+ if !(rec.nil?)
235
+ last_seen = (defined?(rec.lastseen) && rec.lastseen != '') ? rec.lastseen : FIELD_NOT_SUPPORTED
236
+ else
237
+ last_seen = INVALID_IP_ADDRESS
238
+ end
239
+ else
240
+ last_seen = INVALID_IP_ADDRESS
241
+ end
242
+ return last_seen
243
+ end
244
+
170
245
  def is_proxy(ip)
171
246
  valid = !(IPAddr.new(ip) rescue nil).nil?
172
247
  if valid
@@ -175,7 +250,7 @@ class Ip2proxy
175
250
  if self.db_index == 1
176
251
  isproxy = (rec.country_short == '-') ? 0 : 1
177
252
  else
178
- isproxy = (rec.proxytype == '-') ? 0 : (rec.proxytype == 'DCH') ? 2 : 1
253
+ isproxy = (rec.proxytype == '-') ? 0 : (rec.proxytype == 'DCH' || rec.proxytype == 'SES') ? 2 : 1
179
254
  end
180
255
  else
181
256
  isproxy = -1
@@ -185,7 +260,7 @@ class Ip2proxy
185
260
  end
186
261
  return isproxy
187
262
  end
188
-
263
+
189
264
  def get_all(ip)
190
265
  valid = !(IPAddr.new(ip) rescue nil).nil?
191
266
  if valid
@@ -197,11 +272,16 @@ class Ip2proxy
197
272
  city = (defined?(rec.city) && rec.city != '') ? rec.city : FIELD_NOT_SUPPORTED
198
273
  isp = (defined?(rec.isp) && rec.isp != '') ? rec.isp : FIELD_NOT_SUPPORTED
199
274
  proxytype = (defined?(rec.proxytype) && rec.proxytype != '') ? rec.proxytype : FIELD_NOT_SUPPORTED
200
-
275
+ domain = (defined?(rec.domain) && rec.domain != '') ? rec.domain : FIELD_NOT_SUPPORTED
276
+ usagetype = (defined?(rec.usagetype) && rec.usagetype != '') ? rec.usagetype : FIELD_NOT_SUPPORTED
277
+ asn = (defined?(rec.asn) && rec.asn != '') ? rec.asn : FIELD_NOT_SUPPORTED
278
+ as = (defined?(rec.as) && rec.as != '') ? rec.as : FIELD_NOT_SUPPORTED
279
+ last_seen = (defined?(rec.lastseen) && rec.lastseen != '') ? rec.lastseen : FIELD_NOT_SUPPORTED
280
+
201
281
  if self.db_index == 1
202
282
  isproxy = (rec.country_short == '-') ? 0 : 1
203
283
  else
204
- isproxy = (rec.proxytype == '-') ? 0 : (rec.proxytype == 'DCH') ? 2 : 1
284
+ isproxy = (rec.proxytype == '-') ? 0 : (rec.proxytype == 'DCH' || rec.proxytype == 'SES') ? 2 : 1
205
285
  end
206
286
  else
207
287
  country_short = INVALID_IP_ADDRESS
@@ -210,6 +290,11 @@ class Ip2proxy
210
290
  city = INVALID_IP_ADDRESS
211
291
  isp = INVALID_IP_ADDRESS
212
292
  proxytype = INVALID_IP_ADDRESS
293
+ domain = INVALID_IP_ADDRESS
294
+ usagetype = INVALID_IP_ADDRESS
295
+ asn = INVALID_IP_ADDRESS
296
+ as = INVALID_IP_ADDRESS
297
+ last_seen = INVALID_IP_ADDRESS
213
298
  isproxy = -1
214
299
  end
215
300
  else
@@ -219,9 +304,14 @@ class Ip2proxy
219
304
  city = INVALID_IP_ADDRESS
220
305
  isp = INVALID_IP_ADDRESS
221
306
  proxytype = INVALID_IP_ADDRESS
307
+ domain = INVALID_IP_ADDRESS
308
+ usagetype = INVALID_IP_ADDRESS
309
+ asn = INVALID_IP_ADDRESS
310
+ as = INVALID_IP_ADDRESS
311
+ last_seen = INVALID_IP_ADDRESS
222
312
  isproxy = -1
223
313
  end
224
-
314
+
225
315
  results = {}
226
316
  results['is_proxy'] = isproxy
227
317
  results['proxy_type'] = proxytype
@@ -230,10 +320,15 @@ class Ip2proxy
230
320
  results['region'] = region
231
321
  results['city'] = city
232
322
  results['isp'] = isp
323
+ results['domain'] = domain
324
+ results['usagetype'] = usagetype
325
+ results['asn'] = asn
326
+ results['as'] = as
327
+ results['last_seen'] = last_seen
233
328
 
234
329
  return results
235
330
  end
236
-
331
+
237
332
  def bsearch(low, high, ipnum, base_addr, col_length)
238
333
  while low <= high do
239
334
  mid = (low + high) >> 1
@@ -255,7 +350,7 @@ class Ip2proxy
255
350
  end
256
351
  end
257
352
  end
258
-
353
+
259
354
  def get_from_to(mid, base_addr, col_length)
260
355
  from_base = ( base_addr + mid * (col_length + (v4 ? 0 : 12)))
261
356
  file.seek(from_base)
@@ -264,17 +359,17 @@ class Ip2proxy
264
359
  ip_to = v4 ? file.read(4).unpack('V').first : readipv6(file)
265
360
  [ip_from, ip_to]
266
361
  end
267
-
362
+
268
363
  def read32(indexp)
269
364
  file.seek(indexp - 1)
270
365
  return file.read(4).unpack('V').first
271
366
  end
272
-
367
+
273
368
  def readipv6(filer)
274
369
  parts = filer.read(16).unpack('V*')
275
370
  return parts[0] + parts[1] * 4294967296 + parts[2] * 4294967296**2 + parts[3] * 4294967296**3
276
371
  end
277
-
372
+
278
373
  private :get_record, :bsearch, :get_from_to, :read32, :readipv6
279
-
374
+
280
375
  end
@@ -1,10 +1,15 @@
1
1
  class I2pDbConfig
2
2
  COLUMNS = {
3
- :COUNTRY => [0, 2, 3, 3, 3],
4
- :REGION => [0, 0, 0, 4, 4],
5
- :CITY => [0, 0, 0, 5, 5],
6
- :ISP => [0, 0, 0, 0, 6],
7
- :PROXYTYPE => [0, 0, 2, 2, 2]
3
+ :COUNTRY => [0, 2, 3, 3, 3, 3, 3, 3, 3],
4
+ :REGION => [0, 0, 0, 4, 4, 4, 4, 4, 4],
5
+ :CITY => [0, 0, 0, 5, 5, 5, 5, 5, 5],
6
+ :ISP => [0, 0, 0, 0, 6, 6, 6, 6, 6],
7
+ :PROXYTYPE => [0, 0, 2, 2, 2, 2, 2, 2, 2],
8
+ :DOMAIN => [0, 0, 0, 0, 0, 7, 7, 7, 7],
9
+ :USAGETYPE => [0, 0, 0, 0, 0, 0, 8, 8, 8],
10
+ :ASN => [0, 0, 0, 0, 0, 0, 0, 9, 9],
11
+ :AS => [0, 0, 0, 0, 0, 0, 0, 10, 10],
12
+ :LASTSEEN => [0, 0, 0, 0, 0, 0, 0, 0, 11]
8
13
  }
9
14
 
10
15
  def self.setup_database(db_index)
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: ip2proxy_ruby
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.0.4
4
+ version: 2.0.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - ip2location
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2019-01-10 00:00:00.000000000 Z
11
+ date: 2019-05-13 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: bindata
@@ -94,8 +94,10 @@ dependencies:
94
94
  - - ">="
95
95
  - !ruby/object:Gem::Version
96
96
  version: '0'
97
- description: The official IP2Proxy Ruby library to detect anonymous proxy, VPN and
98
- Tor exit nodes.
97
+ description: The official IP2Proxy Ruby library to detect VPN servers, open proxies,
98
+ web proxies, Tor exit nodes, search engine robots and data center ranges using IP2Proxy
99
+ BIN database. Other information available includes proxy type, country, state, city,
100
+ ISP, domain name, usage type, AS number, AS name and last seen date.
99
101
  email:
100
102
  - support@ip2location.com
101
103
  executables: []
@@ -145,7 +147,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
145
147
  version: '0'
146
148
  requirements: []
147
149
  rubyforge_project:
148
- rubygems_version: 2.7.7
150
+ rubygems_version: 2.7.6.2
149
151
  signing_key:
150
152
  specification_version: 4
151
153
  summary: IP2Proxy Ruby library