ip2proxy_ruby 3.3.0 → 3.4.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +4 -4
- data/Gemfile +1 -1
- data/LICENSE.txt +20 -20
- data/README.md +64 -98
- data/example.rb +4 -9
- data/ip2proxy_ruby.gemspec +7 -6
- data/lib/ip2proxy_ruby/i2p_database_config.rb +13 -12
- data/lib/ip2proxy_ruby.rb +20 -1
- data/rb/data/PX12.SAMPLE.BIN +0 -0
- data/spec/assets/PX12.SAMPLE.BIN +0 -0
- data/spec/ip2proxy_ruby_database_spec.rb +44 -38
- metadata +10 -12
- data/rb/data/PX11.SAMPLE.BIN +0 -0
- data/spec/assets/PX11.SAMPLE.BIN +0 -0
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: e344a1f199333b229ab18e7a461caa60ab70d6a287e44915b27007be9f854970
|
4
|
+
data.tar.gz: efdd3f09798abc2bd99a7d3a391c607e9436b71ff151c48c4836d7cbe6a7940d
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: dd25f8039cd727ddfb7ea5827fd90e115e89eb240cd15d7cdf33b222d3bb0c059c26d07bbd742a54f9001edde838394eda229ce7b62004fbf8c29dea661c9deb
|
7
|
+
data.tar.gz: 7fb434d314ecdfda0762400463e372b216086e41c0139ed7ad5014452434580ecf5819e66bb0f0db854c9c2bb5a99828acd1e640f2010cac3496f57a26776452
|
data/Gemfile
CHANGED
data/LICENSE.txt
CHANGED
@@ -1,20 +1,20 @@
|
|
1
|
-
Copyright (c)
|
2
|
-
|
3
|
-
Permission is hereby granted, free of charge, to any person obtaining
|
4
|
-
a copy of this software and associated documentation files (the
|
5
|
-
"Software"), to deal in the Software without restriction, including
|
6
|
-
without limitation the rights to use, copy, modify, merge, publish,
|
7
|
-
distribute, sublicense, and/or sell copies of the Software, and to
|
8
|
-
permit persons to whom the Software is furnished to do so, subject to
|
9
|
-
the following conditions:
|
10
|
-
|
11
|
-
The above copyright notice and this permission notice shall be
|
12
|
-
included in all copies or substantial portions of the Software.
|
13
|
-
|
14
|
-
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
|
15
|
-
EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
|
16
|
-
MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
|
17
|
-
NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
|
18
|
-
LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
|
19
|
-
OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
|
20
|
-
WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
1
|
+
Copyright (c) 2016 - 2025 IP2Location ( support@ip2location.com )
|
2
|
+
|
3
|
+
Permission is hereby granted, free of charge, to any person obtaining
|
4
|
+
a copy of this software and associated documentation files (the
|
5
|
+
"Software"), to deal in the Software without restriction, including
|
6
|
+
without limitation the rights to use, copy, modify, merge, publish,
|
7
|
+
distribute, sublicense, and/or sell copies of the Software, and to
|
8
|
+
permit persons to whom the Software is furnished to do so, subject to
|
9
|
+
the following conditions:
|
10
|
+
|
11
|
+
The above copyright notice and this permission notice shall be
|
12
|
+
included in all copies or substantial portions of the Software.
|
13
|
+
|
14
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
|
15
|
+
EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
|
16
|
+
MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
|
17
|
+
NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
|
18
|
+
LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
|
19
|
+
OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
|
20
|
+
WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
data/README.md
CHANGED
@@ -1,98 +1,64 @@
|
|
1
|
-
[](https://rubygems.org/gems/ip2proxy_ruby)
|
2
|
-
[](https://rubygems.org/gems/ip2proxy_ruby)
|
3
|
-
|
4
|
-
# IP2Proxy Ruby Library
|
5
|
-
This module allows user to reverse search of IP address to detect VPN servers, open proxies, web proxies, Tor exit nodes, search engine robots, data center ranges
|
6
|
-
|
7
|
-
For more details, please visit:
|
8
|
-
[https://www.ip2location.com/ip2proxy/developers/ruby](https://www.ip2location.com/ip2proxy/developers/ruby)
|
9
|
-
|
10
|
-
#
|
11
|
-
|
12
|
-
|
13
|
-
|
14
|
-
|
15
|
-
|
16
|
-
|
17
|
-
|
18
|
-
|
|
19
|
-
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
28
|
-
|
29
|
-
|
30
|
-
|
|
31
|
-
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
41
|
-
|
42
|
-
|
43
|
-
|
44
|
-
|
45
|
-
|
46
|
-
|
47
|
-
|
|
48
|
-
|
49
|
-
|
50
|
-
|
51
|
-
|
52
|
-
|
53
|
-
|
54
|
-
|
55
|
-
|
56
|
-
|
57
|
-
|
58
|
-
|
59
|
-
|
60
|
-
|
61
|
-
|
62
|
-
|
63
|
-
|
64
|
-
|
65
|
-
|---|---|
|
66
|
-
|COM|Commercial|
|
67
|
-
|ORG|Organization|
|
68
|
-
|GOV|Government|
|
69
|
-
|MIL|Military|
|
70
|
-
|EDU|University/College/School|
|
71
|
-
|LIB|Library|
|
72
|
-
|CDN|Content Delivery Network|
|
73
|
-
|ISP|Fixed Line ISP|
|
74
|
-
|MOB|Mobile ISP|
|
75
|
-
|DCH|Data Center/Web Hosting/Transit|
|
76
|
-
|SES|Search Engine Spider|
|
77
|
-
|RSV|Reserved|
|
78
|
-
|
79
|
-
### Threat Type
|
80
|
-
|
81
|
-
|Threat Type|Description|
|
82
|
-
|---|---|
|
83
|
-
|SPAM|Spammer|
|
84
|
-
|SCANNER|Security Scanner or Attack|
|
85
|
-
|BOTNET|Spyware or Malware|
|
86
|
-
|
87
|
-
# Dependencies
|
88
|
-
|
89
|
-
This library requires IP2Proxy BIN data file to function. You may download the BIN data file at
|
90
|
-
* IP2Proxy LITE BIN Data (Free): https://lite.ip2location.com
|
91
|
-
* IP2Proxy Commercial BIN Data (Comprehensive): https://www.ip2location.com/proxy-database
|
92
|
-
|
93
|
-
You can also sign up for [IP2Proxy Web Service](https://www.ip2location.com/web-service/ip2proxy) to lookup by IP2Proxy API.
|
94
|
-
|
95
|
-
# Support
|
96
|
-
|
97
|
-
Email: support@ip2location.com
|
98
|
-
URL: [https://www.ip2location.com](https://www.ip2location.com)
|
1
|
+
[](https://rubygems.org/gems/ip2proxy_ruby)
|
2
|
+
[](https://rubygems.org/gems/ip2proxy_ruby)
|
3
|
+
|
4
|
+
# IP2Proxy Ruby Library
|
5
|
+
This module allows user to reverse search of IP address to detect VPN servers, open proxies, web proxies, Tor exit nodes, search engine robots, data center ranges, residential proxies, consumer privacy networks, and enterprise private networks using IP2Proxy BIN database. Other information available includes proxy type, country, state, city, ISP, domain name, usage type, AS number, AS name, threats, last seen date and provider names. It lookup the proxy IP address from **IP2Proxy BIN Data** file or web service.
|
6
|
+
|
7
|
+
For more details, please visit:
|
8
|
+
[https://www.ip2location.com/ip2proxy/developers/ruby](https://www.ip2location.com/ip2proxy/developers/ruby)
|
9
|
+
|
10
|
+
# Developer Documentation
|
11
|
+
To learn more about installation, usage, and code examples, please visit the developer documentation at [https://ip2proxy-ruby.readthedocs.io/en/latest/index.html.](https://ip2proxy-ruby.readthedocs.io/en/latest/index.html)
|
12
|
+
|
13
|
+
|
14
|
+
### Proxy Type
|
15
|
+
|
16
|
+
|Proxy Type|Description|
|
17
|
+
|---|---|
|
18
|
+
|VPN|Anonymizing VPN services|
|
19
|
+
|TOR|Tor Exit Nodes|
|
20
|
+
|PUB|Public Proxies|
|
21
|
+
|WEB|Web Proxies|
|
22
|
+
|DCH|Hosting Providers/Data Center|
|
23
|
+
|SES|Search Engine Robots|
|
24
|
+
|RES|Residential Proxies [PX10+]|
|
25
|
+
|CPN|Consumer Privacy Networks. [PX11+]|
|
26
|
+
|EPN|Enterprise Private Networks. [PX11+]|
|
27
|
+
|
28
|
+
### Usage Type
|
29
|
+
|
30
|
+
|Usage Type|Description|
|
31
|
+
|---|---|
|
32
|
+
|COM|Commercial|
|
33
|
+
|ORG|Organization|
|
34
|
+
|GOV|Government|
|
35
|
+
|MIL|Military|
|
36
|
+
|EDU|University/College/School|
|
37
|
+
|LIB|Library|
|
38
|
+
|CDN|Content Delivery Network|
|
39
|
+
|ISP|Fixed Line ISP|
|
40
|
+
|MOB|Mobile ISP|
|
41
|
+
|DCH|Data Center/Web Hosting/Transit|
|
42
|
+
|SES|Search Engine Spider|
|
43
|
+
|RSV|Reserved|
|
44
|
+
|
45
|
+
### Threat Type
|
46
|
+
|
47
|
+
|Threat Type|Description|
|
48
|
+
|---|---|
|
49
|
+
|SPAM|Spammer|
|
50
|
+
|SCANNER|Security Scanner or Attack|
|
51
|
+
|BOTNET|Spyware or Malware|
|
52
|
+
|
53
|
+
# Dependencies
|
54
|
+
|
55
|
+
This library requires IP2Proxy BIN data file to function. You may download the BIN data file at
|
56
|
+
* IP2Proxy LITE BIN Data (Free): https://lite.ip2location.com
|
57
|
+
* IP2Proxy Commercial BIN Data (Comprehensive): https://www.ip2location.com/proxy-database
|
58
|
+
|
59
|
+
You can also sign up for [IP2Proxy Web Service](https://www.ip2location.com/web-service/ip2proxy) to lookup by IP2Proxy API.
|
60
|
+
|
61
|
+
# Support
|
62
|
+
|
63
|
+
Email: support@ip2location.com
|
64
|
+
URL: [https://www.ip2location.com](https://www.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/
|
4
|
+
i2p = Ip2proxy.new.open("./data/PX12.SAMPLE.BIN")
|
5
5
|
|
6
6
|
# get versioning information
|
7
7
|
print 'Module Version: ' + i2p.get_module_version + "\n"
|
@@ -23,6 +23,7 @@ print 'AS: ' + i2p.get_as('1.2.3.4') + "\n"
|
|
23
23
|
print 'Last Seen: ' + i2p.get_last_seen('1.2.3.4') + "\n"
|
24
24
|
print 'Threat: ' + i2p.get_threat('1.2.3.4') + "\n"
|
25
25
|
print 'Provider: ' + i2p.get_provider('1.2.3.4') + "\n"
|
26
|
+
print 'Fraud Score: ' + i2p.get_fraud_score('1.2.3.4') + "\n"
|
26
27
|
|
27
28
|
# single function to get all proxy data returned in array
|
28
29
|
record = i2p.get_all('1.2.3.4')
|
@@ -40,13 +41,7 @@ print 'AS: ' + record['as'] + "\n"
|
|
40
41
|
print 'Last Seen: ' + record['last_seen'] + "\n"
|
41
42
|
print 'Threat: ' + record['threat'] + "\n"
|
42
43
|
print 'Provider: ' + record['provider'] + "\n"
|
44
|
+
print 'Fraud Score: ' + record['fraud_score'] + "\n"
|
43
45
|
|
44
46
|
# close IP2Proxy BIN database
|
45
|
-
i2p.close()
|
46
|
-
|
47
|
-
# Web Service
|
48
|
-
ws = Ip2proxyWebService.new('demo', 'PX11', true)
|
49
|
-
record = ws.lookup('1.2.3.4')
|
50
|
-
print record
|
51
|
-
print "\n"
|
52
|
-
print ws.get_credit()
|
47
|
+
i2p.close()
|
data/ip2proxy_ruby.gemspec
CHANGED
@@ -2,7 +2,7 @@
|
|
2
2
|
|
3
3
|
Gem::Specification.new do |s|
|
4
4
|
s.name = "ip2proxy_ruby"
|
5
|
-
s.version = "3.
|
5
|
+
s.version = "3.4.0"
|
6
6
|
s.authors = ["ip2location"]
|
7
7
|
s.email = ["support@ip2location.com"]
|
8
8
|
|
@@ -31,15 +31,16 @@ Gem::Specification.new do |s|
|
|
31
31
|
"lib/ip2proxy_ruby/i2p_string_data.rb",
|
32
32
|
"lib/ip2proxy_ruby/ip2proxy_config.rb",
|
33
33
|
"lib/ip2proxy_ruby/ip2proxy_record.rb",
|
34
|
-
"spec/assets/
|
34
|
+
"spec/assets/PX12.SAMPLE.BIN",
|
35
35
|
"spec/ip2proxy_ruby_database_spec.rb",
|
36
36
|
"spec/spec_helper.rb",
|
37
|
-
"rb/data/
|
37
|
+
"rb/data/PX12.SAMPLE.BIN"
|
38
38
|
]
|
39
39
|
|
40
40
|
if s.respond_to?(:metadata=)
|
41
41
|
s.metadata = {
|
42
42
|
"bug_tracker_uri" => "https://github.com/ip2location/ip2proxy-ruby/issues",
|
43
|
+
"documentation_uri" => "https://www.rubydoc.info/gems/ip2proxy_ruby",
|
43
44
|
"homepage_uri" => "https://www.ip2location.com",
|
44
45
|
"source_code_uri" => "https://github.com/ip2location/ip2proxy-ruby",
|
45
46
|
}
|
@@ -49,18 +50,18 @@ Gem::Specification.new do |s|
|
|
49
50
|
s.specification_version = 4
|
50
51
|
|
51
52
|
if Gem::Version.new(Gem::VERSION) >= Gem::Version.new('1.2.0') then
|
52
|
-
s.add_runtime_dependency(%q<bindata>, ["
|
53
|
+
s.add_runtime_dependency(%q<bindata>, ["~> 2.4.15"])
|
53
54
|
s.add_development_dependency(%q<rspec>, ["~> 2.8.0"])
|
54
55
|
s.add_development_dependency(%q<rdoc>, [">= 6.3.1"])
|
55
56
|
s.add_development_dependency(%q<bundler>, [">= 1.2.0"])
|
56
57
|
else
|
57
|
-
s.add_dependency(%q<bindata>, ["
|
58
|
+
s.add_dependency(%q<bindata>, ["~> 2.4.15"])
|
58
59
|
s.add_dependency(%q<rspec>, ["~> 2.8.0"])
|
59
60
|
s.add_dependency(%q<rdoc>, [">= 6.3.1"])
|
60
61
|
s.add_dependency(%q<bundler>, [">= 1.2.0"])
|
61
62
|
end
|
62
63
|
else
|
63
|
-
s.add_dependency(%q<bindata>, ["
|
64
|
+
s.add_dependency(%q<bindata>, ["~> 2.4.15"])
|
64
65
|
s.add_dependency(%q<rspec>, ["~> 2.8.0"])
|
65
66
|
s.add_dependency(%q<rdoc>, [">= 6.3.1"])
|
66
67
|
s.add_dependency(%q<bundler>, [">= 1.2.0"])
|
@@ -1,17 +1,18 @@
|
|
1
1
|
class I2pDbConfig
|
2
2
|
COLUMNS = {
|
3
|
-
:COUNTRY => [0, 2, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3],
|
4
|
-
:REGION => [0, 0, 0, 4, 4, 4, 4, 4, 4, 4, 4, 4],
|
5
|
-
:CITY => [0, 0, 0, 5, 5, 5, 5, 5, 5, 5, 5, 5],
|
6
|
-
:ISP => [0, 0, 0, 0, 6, 6, 6, 6, 6, 6, 6, 6],
|
7
|
-
:PROXYTYPE => [0, 0, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2],
|
8
|
-
:DOMAIN => [0, 0, 0, 0, 0, 7, 7, 7, 7, 7, 7, 7],
|
9
|
-
:USAGETYPE => [0, 0, 0, 0, 0, 0, 8, 8, 8, 8, 8, 8],
|
10
|
-
:ASN => [0, 0, 0, 0, 0, 0, 0, 9, 9, 9, 9, 9],
|
11
|
-
:AS => [0, 0, 0, 0, 0, 0, 0, 10, 10, 10, 10, 10],
|
12
|
-
:LASTSEEN => [0, 0, 0, 0, 0, 0, 0, 0, 11, 11, 11, 11],
|
13
|
-
:THREAT => [0, 0, 0, 0, 0, 0, 0, 0, 0, 12, 12, 12],
|
14
|
-
:PROVIDER => [0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 13]
|
3
|
+
:COUNTRY => [0, 2, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3],
|
4
|
+
:REGION => [0, 0, 0, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4],
|
5
|
+
:CITY => [0, 0, 0, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5],
|
6
|
+
:ISP => [0, 0, 0, 0, 6, 6, 6, 6, 6, 6, 6, 6, 6],
|
7
|
+
:PROXYTYPE => [0, 0, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2],
|
8
|
+
:DOMAIN => [0, 0, 0, 0, 0, 7, 7, 7, 7, 7, 7, 7, 7],
|
9
|
+
:USAGETYPE => [0, 0, 0, 0, 0, 0, 8, 8, 8, 8, 8, 8, 8],
|
10
|
+
:ASN => [0, 0, 0, 0, 0, 0, 0, 9, 9, 9, 9, 9, 9],
|
11
|
+
:AS => [0, 0, 0, 0, 0, 0, 0, 10, 10, 10, 10, 10, 10],
|
12
|
+
:LASTSEEN => [0, 0, 0, 0, 0, 0, 0, 0, 11, 11, 11, 11, 11],
|
13
|
+
:THREAT => [0, 0, 0, 0, 0, 0, 0, 0, 0, 12, 12, 12, 12],
|
14
|
+
:PROVIDER => [0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 13, 13],
|
15
|
+
:FRAUD_SCORE => [0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 14]
|
15
16
|
}
|
16
17
|
|
17
18
|
def self.setup_database(db_index)
|
data/lib/ip2proxy_ruby.rb
CHANGED
@@ -11,7 +11,7 @@ require_relative 'ip2proxy_ruby/ip2proxy_record'
|
|
11
11
|
class Ip2proxy
|
12
12
|
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, :last_err_msg
|
13
13
|
|
14
|
-
VERSION = '3.
|
14
|
+
VERSION = '3.4.0'
|
15
15
|
FIELD_NOT_SUPPORTED = 'NOT SUPPORTED'
|
16
16
|
INVALID_IP_ADDRESS = 'INVALID IP ADDRESS'
|
17
17
|
INVALID_BIN_DATABASE = 'Incorrect IP2Proxy BIN file format. Please make sure that you are using the latest IP2Proxy BIN file.'
|
@@ -322,6 +322,21 @@ class Ip2proxy
|
|
322
322
|
return provider
|
323
323
|
end
|
324
324
|
|
325
|
+
def get_fraud_score(ip)
|
326
|
+
valid = !(IPAddr.new(ip) rescue nil).nil?
|
327
|
+
if valid
|
328
|
+
rec = get_record(ip)
|
329
|
+
if !(rec.nil?)
|
330
|
+
fraud_score = (defined?(rec.fraud_score) && rec.fraud_score != '') ? rec.fraud_score : FIELD_NOT_SUPPORTED
|
331
|
+
else
|
332
|
+
fraud_score = INVALID_IP_ADDRESS
|
333
|
+
end
|
334
|
+
else
|
335
|
+
fraud_score = INVALID_IP_ADDRESS
|
336
|
+
end
|
337
|
+
return fraud_score
|
338
|
+
end
|
339
|
+
|
325
340
|
def get_all(ip)
|
326
341
|
valid = !(IPAddr.new(ip) rescue nil).nil?
|
327
342
|
if valid
|
@@ -340,6 +355,7 @@ class Ip2proxy
|
|
340
355
|
last_seen = (defined?(rec.lastseen) && rec.lastseen != '') ? rec.lastseen : FIELD_NOT_SUPPORTED
|
341
356
|
threat = (defined?(rec.threat) && rec.threat != '') ? rec.threat : FIELD_NOT_SUPPORTED
|
342
357
|
provider = (defined?(rec.provider) && rec.provider != '') ? rec.provider : FIELD_NOT_SUPPORTED
|
358
|
+
fraud_score = (defined?(rec.fraud_score) && rec.fraud_score != '') ? rec.fraud_score : FIELD_NOT_SUPPORTED
|
343
359
|
if self.db_index == 1
|
344
360
|
isproxy = (rec.country_short == '-') ? 0 : 1
|
345
361
|
else
|
@@ -359,6 +375,7 @@ class Ip2proxy
|
|
359
375
|
last_seen = INVALID_IP_ADDRESS
|
360
376
|
threat = INVALID_IP_ADDRESS
|
361
377
|
provider = INVALID_IP_ADDRESS
|
378
|
+
fraud_score = INVALID_IP_ADDRESS
|
362
379
|
isproxy = -1
|
363
380
|
end
|
364
381
|
else
|
@@ -375,6 +392,7 @@ class Ip2proxy
|
|
375
392
|
last_seen = INVALID_IP_ADDRESS
|
376
393
|
threat = INVALID_IP_ADDRESS
|
377
394
|
provider = INVALID_IP_ADDRESS
|
395
|
+
fraud_score = INVALID_IP_ADDRESS
|
378
396
|
isproxy = -1
|
379
397
|
end
|
380
398
|
results = {}
|
@@ -392,6 +410,7 @@ class Ip2proxy
|
|
392
410
|
results['last_seen'] = last_seen
|
393
411
|
results['threat'] = threat
|
394
412
|
results['provider'] = provider
|
413
|
+
results['fraud_score'] = fraud_score
|
395
414
|
return results
|
396
415
|
end
|
397
416
|
|
Binary file
|
Binary file
|
@@ -2,122 +2,128 @@ require File.expand_path(File.dirname(__FILE__) + '/spec_helper')
|
|
2
2
|
|
3
3
|
describe "Ip2proxy" do
|
4
4
|
it "work correctly with invalid ip" do
|
5
|
-
i2p = Ip2proxy.new.open(File.dirname(__FILE__) + "/assets/
|
5
|
+
i2p = Ip2proxy.new.open(File.dirname(__FILE__) + "/assets/PX12.SAMPLE.BIN")
|
6
6
|
record = i2p.get_all('1.0.0.x')
|
7
7
|
expect(record['country_short']).to eq 'INVALID IP ADDRESS'
|
8
8
|
end
|
9
9
|
|
10
10
|
it "work correctly with get_all ipv4" do
|
11
|
-
i2p = Ip2proxy.new.open(File.dirname(__FILE__) + "/assets/
|
11
|
+
i2p = Ip2proxy.new.open(File.dirname(__FILE__) + "/assets/PX12.SAMPLE.BIN")
|
12
12
|
record = i2p.get_all('1.0.0.8')
|
13
|
-
expect(record['country_short']).to eq '
|
13
|
+
expect(record['country_short']).to eq '-'
|
14
14
|
end
|
15
15
|
|
16
16
|
it "work correctly with get_country_short" do
|
17
|
-
i2p = Ip2proxy.new.open(File.dirname(__FILE__) + "/assets/
|
17
|
+
i2p = Ip2proxy.new.open(File.dirname(__FILE__) + "/assets/PX12.SAMPLE.BIN")
|
18
18
|
record = i2p.get_country_short('1.0.0.8')
|
19
|
-
expect(record).to eq '
|
19
|
+
expect(record).to eq '-'
|
20
20
|
end
|
21
21
|
|
22
22
|
it "work correctly with get_country_long" do
|
23
|
-
i2p = Ip2proxy.new.open(File.dirname(__FILE__) + "/assets/
|
23
|
+
i2p = Ip2proxy.new.open(File.dirname(__FILE__) + "/assets/PX12.SAMPLE.BIN")
|
24
24
|
record = i2p.get_country_long('1.0.0.8')
|
25
|
-
expect(record).to eq '
|
25
|
+
expect(record).to eq '-'
|
26
26
|
end
|
27
27
|
|
28
28
|
it "work correctly with get_region" do
|
29
|
-
i2p = Ip2proxy.new.open(File.dirname(__FILE__) + "/assets/
|
29
|
+
i2p = Ip2proxy.new.open(File.dirname(__FILE__) + "/assets/PX12.SAMPLE.BIN")
|
30
30
|
record = i2p.get_region('1.0.0.8')
|
31
|
-
expect(record).to eq '
|
31
|
+
expect(record).to eq '-'
|
32
32
|
end
|
33
33
|
|
34
34
|
it "work correctly with get_city" do
|
35
|
-
i2p = Ip2proxy.new.open(File.dirname(__FILE__) + "/assets/
|
35
|
+
i2p = Ip2proxy.new.open(File.dirname(__FILE__) + "/assets/PX12.SAMPLE.BIN")
|
36
36
|
record = i2p.get_city('1.0.0.8')
|
37
|
-
expect(record).to eq '
|
37
|
+
expect(record).to eq '-'
|
38
38
|
end
|
39
39
|
|
40
40
|
it "work correctly with get_isp" do
|
41
|
-
i2p = Ip2proxy.new.open(File.dirname(__FILE__) + "/assets/
|
41
|
+
i2p = Ip2proxy.new.open(File.dirname(__FILE__) + "/assets/PX12.SAMPLE.BIN")
|
42
42
|
record = i2p.get_isp('1.0.0.8')
|
43
|
-
expect(record).to eq '
|
43
|
+
expect(record).to eq '-'
|
44
44
|
end
|
45
45
|
|
46
46
|
it "work correctly with get_domain" do
|
47
|
-
i2p = Ip2proxy.new.open(File.dirname(__FILE__) + "/assets/
|
47
|
+
i2p = Ip2proxy.new.open(File.dirname(__FILE__) + "/assets/PX12.SAMPLE.BIN")
|
48
48
|
record = i2p.get_domain('1.0.0.8')
|
49
|
-
expect(record).to eq '
|
49
|
+
expect(record).to eq '-'
|
50
50
|
end
|
51
51
|
|
52
52
|
it "work correctly with get_usagetype" do
|
53
|
-
i2p = Ip2proxy.new.open(File.dirname(__FILE__) + "/assets/
|
53
|
+
i2p = Ip2proxy.new.open(File.dirname(__FILE__) + "/assets/PX12.SAMPLE.BIN")
|
54
54
|
record = i2p.get_usagetype('1.0.0.8')
|
55
|
-
expect(record).to eq '
|
55
|
+
expect(record).to eq '-'
|
56
56
|
end
|
57
57
|
|
58
58
|
it "work correctly with get_asn" do
|
59
|
-
i2p = Ip2proxy.new.open(File.dirname(__FILE__) + "/assets/
|
59
|
+
i2p = Ip2proxy.new.open(File.dirname(__FILE__) + "/assets/PX12.SAMPLE.BIN")
|
60
60
|
record = i2p.get_asn('1.0.0.8')
|
61
|
-
expect(record).to eq '
|
61
|
+
expect(record).to eq '-'
|
62
62
|
end
|
63
63
|
|
64
64
|
it "work correctly with get_as" do
|
65
|
-
i2p = Ip2proxy.new.open(File.dirname(__FILE__) + "/assets/
|
65
|
+
i2p = Ip2proxy.new.open(File.dirname(__FILE__) + "/assets/PX12.SAMPLE.BIN")
|
66
66
|
record = i2p.get_as('1.0.0.8')
|
67
|
-
expect(record).to eq '
|
67
|
+
expect(record).to eq '-'
|
68
68
|
end
|
69
69
|
|
70
70
|
it "work correctly with get_last_seen" do
|
71
|
-
i2p = Ip2proxy.new.open(File.dirname(__FILE__) + "/assets/
|
71
|
+
i2p = Ip2proxy.new.open(File.dirname(__FILE__) + "/assets/PX12.SAMPLE.BIN")
|
72
72
|
record = i2p.get_last_seen('1.0.0.8')
|
73
|
-
expect(record).to eq '
|
73
|
+
expect(record).to eq '-'
|
74
74
|
end
|
75
75
|
|
76
76
|
it "work correctly with get_threat" do
|
77
|
-
i2p = Ip2proxy.new.open(File.dirname(__FILE__) + "/assets/
|
77
|
+
i2p = Ip2proxy.new.open(File.dirname(__FILE__) + "/assets/PX12.SAMPLE.BIN")
|
78
78
|
record = i2p.get_threat('1.0.0.8')
|
79
79
|
expect(record).to eq '-'
|
80
80
|
end
|
81
81
|
|
82
82
|
it "work correctly with is_proxy" do
|
83
|
-
i2p = Ip2proxy.new.open(File.dirname(__FILE__) + "/assets/
|
83
|
+
i2p = Ip2proxy.new.open(File.dirname(__FILE__) + "/assets/PX12.SAMPLE.BIN")
|
84
84
|
record = i2p.is_proxy('1.0.0.8')
|
85
|
-
expect(record).to eq
|
85
|
+
expect(record).to eq 0
|
86
86
|
end
|
87
87
|
|
88
88
|
it "work correctly with get_proxytype" do
|
89
|
-
i2p = Ip2proxy.new.open(File.dirname(__FILE__) + "/assets/
|
89
|
+
i2p = Ip2proxy.new.open(File.dirname(__FILE__) + "/assets/PX12.SAMPLE.BIN")
|
90
90
|
record = i2p.get_proxytype('1.0.0.8')
|
91
|
-
expect(record).to eq '
|
91
|
+
expect(record).to eq '-'
|
92
92
|
end
|
93
93
|
|
94
94
|
it "work correctly with get_provider" do
|
95
|
-
i2p = Ip2proxy.new.open(File.dirname(__FILE__) + "/assets/
|
95
|
+
i2p = Ip2proxy.new.open(File.dirname(__FILE__) + "/assets/PX12.SAMPLE.BIN")
|
96
96
|
record = i2p.get_provider('1.0.0.8')
|
97
|
-
expect(record).to eq '
|
97
|
+
expect(record).to eq '-'
|
98
|
+
end
|
99
|
+
|
100
|
+
it "work correctly with get_fraud_score" do
|
101
|
+
i2p = Ip2proxy.new.open(File.dirname(__FILE__) + "/assets/PX12.SAMPLE.BIN")
|
102
|
+
record = i2p.get_fraud_score('1.0.0.8')
|
103
|
+
expect(record).to eq '0'
|
98
104
|
end
|
99
105
|
|
100
106
|
it "work correctly with get_all ipv6" do
|
101
|
-
i2p = Ip2proxy.new.open(File.dirname(__FILE__) + "/assets/
|
107
|
+
i2p = Ip2proxy.new.open(File.dirname(__FILE__) + "/assets/PX12.SAMPLE.BIN")
|
102
108
|
record = i2p.get_all('2c0f:ffa0::4')
|
103
|
-
expect(record['country_short']).to eq '
|
109
|
+
expect(record['country_short']).to eq '-'
|
104
110
|
end
|
105
111
|
|
106
112
|
it "work correctly with get_module_version" do
|
107
|
-
i2p = Ip2proxy.new.open(File.dirname(__FILE__) + "/assets/
|
113
|
+
i2p = Ip2proxy.new.open(File.dirname(__FILE__) + "/assets/PX12.SAMPLE.BIN")
|
108
114
|
record = i2p.get_module_version()
|
109
|
-
expect(record).to eq '3.
|
115
|
+
expect(record).to eq '3.4.0'
|
110
116
|
end
|
111
117
|
|
112
118
|
it "work correctly with get_package_version" do
|
113
|
-
i2p = Ip2proxy.new.open(File.dirname(__FILE__) + "/assets/
|
119
|
+
i2p = Ip2proxy.new.open(File.dirname(__FILE__) + "/assets/PX12.SAMPLE.BIN")
|
114
120
|
record = i2p.get_package_version()
|
115
|
-
expect(record).to eq '
|
121
|
+
expect(record).to eq '12'
|
116
122
|
end
|
117
123
|
|
118
124
|
it "work correctly with get_database_version" do
|
119
|
-
i2p = Ip2proxy.new.open(File.dirname(__FILE__) + "/assets/
|
125
|
+
i2p = Ip2proxy.new.open(File.dirname(__FILE__) + "/assets/PX12.SAMPLE.BIN")
|
120
126
|
record = i2p.get_database_version()
|
121
|
-
expect(record).to eq '
|
127
|
+
expect(record).to eq '2025.2.5'
|
122
128
|
end
|
123
129
|
end
|
metadata
CHANGED
@@ -1,29 +1,28 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: ip2proxy_ruby
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 3.
|
4
|
+
version: 3.4.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- ip2location
|
8
|
-
autorequire:
|
9
8
|
bindir: bin
|
10
9
|
cert_chain: []
|
11
|
-
date:
|
10
|
+
date: 2025-02-20 00:00:00.000000000 Z
|
12
11
|
dependencies:
|
13
12
|
- !ruby/object:Gem::Dependency
|
14
13
|
name: bindata
|
15
14
|
requirement: !ruby/object:Gem::Requirement
|
16
15
|
requirements:
|
17
|
-
- - "
|
16
|
+
- - "~>"
|
18
17
|
- !ruby/object:Gem::Version
|
19
|
-
version:
|
18
|
+
version: 2.4.15
|
20
19
|
type: :runtime
|
21
20
|
prerelease: false
|
22
21
|
version_requirements: !ruby/object:Gem::Requirement
|
23
22
|
requirements:
|
24
|
-
- - "
|
23
|
+
- - "~>"
|
25
24
|
- !ruby/object:Gem::Version
|
26
|
-
version:
|
25
|
+
version: 2.4.15
|
27
26
|
- !ruby/object:Gem::Dependency
|
28
27
|
name: rspec
|
29
28
|
requirement: !ruby/object:Gem::Requirement
|
@@ -93,8 +92,8 @@ files:
|
|
93
92
|
- lib/ip2proxy_ruby/i2p_string_data.rb
|
94
93
|
- lib/ip2proxy_ruby/ip2proxy_config.rb
|
95
94
|
- lib/ip2proxy_ruby/ip2proxy_record.rb
|
96
|
-
- rb/data/
|
97
|
-
- spec/assets/
|
95
|
+
- rb/data/PX12.SAMPLE.BIN
|
96
|
+
- spec/assets/PX12.SAMPLE.BIN
|
98
97
|
- spec/ip2proxy_ruby_database_spec.rb
|
99
98
|
- spec/spec_helper.rb
|
100
99
|
homepage: https://github.com/ip2location/ip2proxy-ruby
|
@@ -102,9 +101,9 @@ licenses:
|
|
102
101
|
- MIT
|
103
102
|
metadata:
|
104
103
|
bug_tracker_uri: https://github.com/ip2location/ip2proxy-ruby/issues
|
104
|
+
documentation_uri: https://www.rubydoc.info/gems/ip2proxy_ruby
|
105
105
|
homepage_uri: https://www.ip2location.com
|
106
106
|
source_code_uri: https://github.com/ip2location/ip2proxy-ruby
|
107
|
-
post_install_message:
|
108
107
|
rdoc_options: []
|
109
108
|
require_paths:
|
110
109
|
- lib
|
@@ -119,8 +118,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
119
118
|
- !ruby/object:Gem::Version
|
120
119
|
version: '0'
|
121
120
|
requirements: []
|
122
|
-
rubygems_version: 3.
|
123
|
-
signing_key:
|
121
|
+
rubygems_version: 3.6.4
|
124
122
|
specification_version: 4
|
125
123
|
summary: IP2Proxy Ruby library
|
126
124
|
test_files: []
|
data/rb/data/PX11.SAMPLE.BIN
DELETED
Binary file
|
data/spec/assets/PX11.SAMPLE.BIN
DELETED
Binary file
|