ip2proxy_ruby 3.3.1 → 3.5.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/LICENSE.txt +1 -1
- data/README.md +5 -2
- data/example.rb +46 -44
- data/ip2proxy_ruby.gemspec +4 -3
- data/lib/ip2proxy_ruby/i2p_database_config.rb +13 -12
- data/lib/ip2proxy_ruby.rb +545 -526
- 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 +6 -8
- 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: 4fcaf2e6a17ab015cd891c8f518ad2fe7494faf1c0392fd53d4f65b91afc0a7c
|
|
4
|
+
data.tar.gz: 2db5fece7ac66539061f5755d91f7a71593fc5fc07aa4028e3e0e924fa946804
|
|
5
5
|
SHA512:
|
|
6
|
-
metadata.gz:
|
|
7
|
-
data.tar.gz:
|
|
6
|
+
metadata.gz: e5eb42c6941106364964185194e927068f762463a7c6e9ab360fc941886b1755bf58c9e2074c0e296769da45e713677e02093d39cba1072bbf64621d02c0abed
|
|
7
|
+
data.tar.gz: 8d4824e9317981ad0049906c3c3d001e04f0ff810ed26a7270829a2ce73056c2838ada560eb6c9c69c969e5cd61027998577bb1588f5daf1719a71570e6bda67
|
data/LICENSE.txt
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
Copyright (c) 2016 -
|
|
1
|
+
Copyright (c) 2016 - 2026 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
|
@@ -5,7 +5,7 @@
|
|
|
5
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
6
|
|
|
7
7
|
For more details, please visit:
|
|
8
|
-
[https://www.ip2location.com/ip2proxy/
|
|
8
|
+
[https://www.ip2location.com/documentation/ip2proxy-libraries/ruby](https://www.ip2location.com/documentation/ip2proxy-libraries/ruby)
|
|
9
9
|
|
|
10
10
|
# Developer Documentation
|
|
11
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)
|
|
@@ -24,6 +24,7 @@ To learn more about installation, usage, and code examples, please visit the dev
|
|
|
24
24
|
|RES|Residential Proxies [PX10+]|
|
|
25
25
|
|CPN|Consumer Privacy Networks. [PX11+]|
|
|
26
26
|
|EPN|Enterprise Private Networks. [PX11+]|
|
|
27
|
+
|AIC|AI Crawler. [PX12]|
|
|
27
28
|
|
|
28
29
|
### Usage Type
|
|
29
30
|
|
|
@@ -41,14 +42,16 @@ To learn more about installation, usage, and code examples, please visit the dev
|
|
|
41
42
|
|DCH|Data Center/Web Hosting/Transit|
|
|
42
43
|
|SES|Search Engine Spider|
|
|
43
44
|
|RSV|Reserved|
|
|
45
|
+
|AIC|AI Crawler|
|
|
44
46
|
|
|
45
47
|
### Threat Type
|
|
46
48
|
|
|
47
49
|
|Threat Type|Description|
|
|
48
50
|
|---|---|
|
|
49
|
-
|SPAM|
|
|
51
|
+
|SPAM|Email and forum spammers|
|
|
50
52
|
|SCANNER|Security Scanner or Attack|
|
|
51
53
|
|BOTNET|Spyware or Malware|
|
|
54
|
+
|BOGON|Unassigned or illegitimate IP addresses announced via BGP|
|
|
52
55
|
|
|
53
56
|
# Dependencies
|
|
54
57
|
|
data/example.rb
CHANGED
|
@@ -1,45 +1,47 @@
|
|
|
1
|
-
require 'ip2proxy_ruby'
|
|
2
|
-
|
|
3
|
-
# open IP2Proxy BIN database for proxy lookup
|
|
4
|
-
i2p = Ip2proxy.new.open("./data/
|
|
5
|
-
|
|
6
|
-
# get versioning information
|
|
7
|
-
print 'Module Version: ' + i2p.get_module_version + "\n"
|
|
8
|
-
print 'Package Version: ' + i2p.get_package_version + "\n"
|
|
9
|
-
print 'Database Version: ' + i2p.get_database_version + "\n"
|
|
10
|
-
|
|
11
|
-
# individual proxy data check
|
|
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"
|
|
24
|
-
print 'Threat: ' + i2p.get_threat('1.2.3.4') + "\n"
|
|
25
|
-
print 'Provider: ' + i2p.get_provider('1.2.3.4') + "\n"
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
print 'Proxy
|
|
31
|
-
print '
|
|
32
|
-
print 'Country
|
|
33
|
-
print '
|
|
34
|
-
print '
|
|
35
|
-
print '
|
|
36
|
-
print '
|
|
37
|
-
print '
|
|
38
|
-
print '
|
|
39
|
-
print '
|
|
40
|
-
print '
|
|
41
|
-
print '
|
|
42
|
-
print '
|
|
43
|
-
|
|
44
|
-
|
|
1
|
+
require 'ip2proxy_ruby'
|
|
2
|
+
|
|
3
|
+
# open IP2Proxy BIN database for proxy lookup
|
|
4
|
+
i2p = Ip2proxy.new.open("./data/PX12.SAMPLE.BIN")
|
|
5
|
+
|
|
6
|
+
# get versioning information
|
|
7
|
+
print 'Module Version: ' + i2p.get_module_version + "\n"
|
|
8
|
+
print 'Package Version: ' + i2p.get_package_version + "\n"
|
|
9
|
+
print 'Database Version: ' + i2p.get_database_version + "\n"
|
|
10
|
+
|
|
11
|
+
# individual proxy data check
|
|
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"
|
|
24
|
+
print 'Threat: ' + i2p.get_threat('1.2.3.4') + "\n"
|
|
25
|
+
print 'Provider: ' + i2p.get_provider('1.2.3.4') + "\n"
|
|
26
|
+
print 'Fraud Score: ' + i2p.get_fraud_score('1.2.3.4') + "\n"
|
|
27
|
+
|
|
28
|
+
# single function to get all proxy data returned in array
|
|
29
|
+
record = i2p.get_all('1.2.3.4')
|
|
30
|
+
print 'is Proxy: ' + record['is_proxy'].to_s + "\n"
|
|
31
|
+
print 'Proxy Type: ' + record['proxy_type'] + "\n"
|
|
32
|
+
print 'Country Code: ' + record['country_short'] + "\n"
|
|
33
|
+
print 'Country Name: ' + record['country_long'] + "\n"
|
|
34
|
+
print 'Region Name: ' + record['region'] + "\n"
|
|
35
|
+
print 'City Name: ' + record['city'] + "\n"
|
|
36
|
+
print 'ISP: ' + record['isp'] + "\n"
|
|
37
|
+
print 'Domain: ' + record['domain'] + "\n"
|
|
38
|
+
print 'Usage Type: ' + record['usagetype'] + "\n"
|
|
39
|
+
print 'ASN: ' + record['asn'] + "\n"
|
|
40
|
+
print 'AS: ' + record['as'] + "\n"
|
|
41
|
+
print 'Last Seen: ' + record['last_seen'] + "\n"
|
|
42
|
+
print 'Threat: ' + record['threat'] + "\n"
|
|
43
|
+
print 'Provider: ' + record['provider'] + "\n"
|
|
44
|
+
print 'Fraud Score: ' + record['fraud_score'] + "\n"
|
|
45
|
+
|
|
46
|
+
# close IP2Proxy BIN database
|
|
45
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.5.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
|
}
|
|
@@ -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)
|