logstash-filter-ip2proxy 1.1.0 → 2.2.1

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: d65931f469472209ce9a23de1dc4ce5556d760fb3e32f63a7bd7410a3f850184
4
- data.tar.gz: 328216e02719878362997bdee6799a651082f6712797316e739a2bea1dd5fb25
3
+ metadata.gz: bf7ae72f39b3ced4e703b07a46f8d9c83fa65b65c96d0081378303eb571517e4
4
+ data.tar.gz: 6ffc47d1d0eb2e28fb505cf81565d2ddcf35f1b57fee9f6d24cfeea2ae0621c8
5
5
  SHA512:
6
- metadata.gz: 3c9bbd7e388f1bc6aacf43056a978ee0827f74b65870e7e92a1b8e242649f39039deaaaf78c6a1122ee0ca05f4754e12e6de835c9e8af0139b0aaefd932fa7af
7
- data.tar.gz: f00bdaba4033e849556b2482d397f40fa1f5fa30f757f2fa226dad2a400ced784acc67022f1ff7726698a26d249f20275ef34c71f8cc913abf76b93337089b66
6
+ metadata.gz: fba84548436b187387ee3979cc8b4c1f01f1f25d6e315d95aae08b4c4333b801aad16c81ed793005a8835d3412276f04219ff655df21ff9734eff24a8f2a4e67
7
+ data.tar.gz: f99eeba1722200414c16f8ebcee525905f56a2be2f75e60f374e5f0a33bf826a548c53d41808c66837ae79b806e890a60d7bdce824889a13ef1e68f9f8656986
data/Gemfile CHANGED
@@ -1,11 +1,11 @@
1
- source 'https://rubygems.org'
2
-
3
- gemspec
4
-
5
- logstash_path = ENV["LOGSTASH_PATH"] || "../../logstash"
6
- use_logstash_source = ENV["LOGSTASH_SOURCE"] && ENV["LOGSTASH_SOURCE"].to_s == "1"
7
-
8
- if Dir.exist?(logstash_path) && use_logstash_source
9
- gem 'logstash-core', :path => "#{logstash_path}/logstash-core"
10
- gem 'logstash-core-plugin-api', :path => "#{logstash_path}/logstash-core-plugin-api"
11
- end
1
+ source 'https://rubygems.org'
2
+
3
+ gemspec
4
+
5
+ logstash_path = ENV["LOGSTASH_PATH"] || "../../logstash"
6
+ use_logstash_source = ENV["LOGSTASH_SOURCE"] && ENV["LOGSTASH_SOURCE"].to_s == "1"
7
+
8
+ if Dir.exist?(logstash_path) && use_logstash_source
9
+ gem 'logstash-core', :path => "#{logstash_path}/logstash-core"
10
+ gem 'logstash-core-plugin-api', :path => "#{logstash_path}/logstash-core-plugin-api"
11
+ end
data/LICENSE CHANGED
@@ -1,13 +1,13 @@
1
- Copyright (c) 2019 IP2Location.com
2
-
3
- Licensed under the Apache License, Version 2.0 (the "License");
4
- you may not use this file except in compliance with the License.
5
- You may obtain a copy of the License at
6
-
7
- http://www.apache.org/licenses/LICENSE-2.0
8
-
9
- Unless required by applicable law or agreed to in writing, software
10
- distributed under the License is distributed on an "AS IS" BASIS,
11
- WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12
- See the License for the specific language governing permissions and
1
+ Copyright (c) 2021 IP2Location.com
2
+
3
+ Licensed under the Apache License, Version 2.0 (the "License");
4
+ you may not use this file except in compliance with the License.
5
+ You may obtain a copy of the License at
6
+
7
+ http://www.apache.org/licenses/LICENSE-2.0
8
+
9
+ Unless required by applicable law or agreed to in writing, software
10
+ distributed under the License is distributed on an "AS IS" BASIS,
11
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12
+ See the License for the specific language governing permissions and
13
13
  limitations under the License.
data/README.md CHANGED
@@ -1,77 +1,79 @@
1
- # IP2Proxy Filter Plugin
2
- This is IP2Proxy filter plugin for Logstash that enables Logstash's users 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. The library took the proxy IP address from **IP2Proxy BIN Data** file.
3
-
4
- For the methods to use IP2Proxy filter plugin with Elastic Stack (Elasticsearch, Filebeat, Logstash, and Kibana), please take a look on this [tutorial](https://blog.ip2location.com/knowledge-base/how-to-use-ip2proxy-filter-plugin-with-elastic-stack).
5
-
6
-
7
- ## Dependencies (IP2PROXY BIN DATA FILE)
8
- This plugin requires IP2Proxy BIN data file to function. You may download the BIN data file at
9
- * IP2Proxy LITE BIN Data (Free): https://lite.ip2location.com
10
- * IP2Proxy Commercial BIN Data (Commercial): https://www.ip2location.com
11
-
12
-
13
- ## Installation
14
- Install this plugin by the following code:
15
- ```
16
- bin/logstash-plugin install logstash-filter-ip2proxy
17
- ```
18
-
19
-
20
- ## Config File Example
21
- ```
22
- input {
23
- beats {
24
- port => "5043"
25
- }
26
- }
27
-
28
- filter {
29
- grok {
30
- match => { "message" => "%{COMBINEDAPACHELOG}"}
31
- }
32
- ip2proxy {
33
- source => "clientip"
34
- }
35
- }
36
-
37
- output {
38
- elasticsearch {
39
- hosts => [ "localhost:9200" ]
40
- }
41
- }
42
- ```
43
-
44
-
45
- ## IP2Proxy Filter Configuration
46
- |Setting|Input type|Required|
47
- |---|---|---|
48
- |source|string|Yes|
49
- |database|a valid filesystem path|No|
50
-
51
- * **source** field is a required setting that containing the IP address or hostname to get the ip information.
52
- * **database** field is an optional setting that containing the path to the IP2Proxy BIN database file.
53
-
54
-
55
- ## Sample Output
56
- |Field|Description|
57
- |---|---|
58
- |ip2proxy.as|the autonomous system (AS) name of proxy's IP address or domain name|
59
- |ip2proxy.asn|the autonomous system number (ASN) of proxy's IP address or domain name|
60
- |ip2proxy.city|the city name of the proxy|
61
- |ip2proxy.country_long|the ISO3166-1 country name of the proxy|
62
- |ip2proxy.country_short|the ISO3166-1 country code (two-characters) of the proxy|
63
- |ip2proxy.domain|the domain name of proxy's IP address or domain name|
64
- |ip2proxy.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>|
65
- |ip2proxy.isp|the ISP name of the proxy|
66
- |ip2proxy.last_seen|the last seen days ago value of proxy's IP address or domain name|
67
- |ip2proxy.proxy_type|the proxy type. Please visit <a href="https://www.ip2location.com/database/px8-ip-proxytype-country-region-city-isp-domain-usagetype-asn-lastseen" target="_blank">IP2Location</a> for the list of proxy types supported|
68
- |ip2proxy.region|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|
69
- |ip2proxy.usage_type|the usage type classification of the proxy. Please visit <a href="https://www.ip2location.com/database/px8-ip-proxytype-country-region-city-isp-domain-usagetype-asn-lastseen" target="_blank">IP2Location</a> for the list of usage types supported|
70
-
71
- ![Example of data](https://www.ip2location.com/assets/img/logstash-filter-ip2proxy-screenshot.png)
72
-
73
-
74
- ## Support
75
- Email: support@ip2location.com
76
-
77
- URL: [https://www.ip2location.com](https://www.ip2location.com)
1
+ # IP2Proxy Filter Plugin
2
+ This is IP2Proxy filter plugin for Logstash that enables Logstash's users to reverse search of IP address to detect VPN servers, open proxies, web proxies, Tor exit nodes, search engine robots, data center ranges and residential proxies 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. The library took the proxy IP address from **IP2Proxy BIN Data** file.
3
+
4
+ For the methods to use IP2Proxy filter plugin with Elastic Stack (Elasticsearch, Filebeat, Logstash, and Kibana), please take a look on this [tutorial](https://blog.ip2location.com/knowledge-base/how-to-use-ip2proxy-filter-plugin-with-elastic-stack).
5
+
6
+
7
+ ## Dependencies (IP2PROXY BIN DATA FILE)
8
+ This plugin requires IP2Proxy BIN data file to function. You may download the BIN data file at
9
+ * IP2Proxy LITE BIN Data (Free): https://lite.ip2location.com
10
+ * IP2Proxy Commercial BIN Data (Commercial): https://www.ip2location.com
11
+
12
+
13
+ ## Installation
14
+ Install this plugin by the following code:
15
+ ```
16
+ bin/logstash-plugin install logstash-filter-ip2proxy
17
+ ```
18
+
19
+
20
+ ## Config File Example
21
+ ```
22
+ input {
23
+ beats {
24
+ port => "5043"
25
+ }
26
+ }
27
+
28
+ filter {
29
+ grok {
30
+ match => { "message" => "%{COMBINEDAPACHELOG}"}
31
+ }
32
+ ip2proxy {
33
+ source => "clientip"
34
+ }
35
+ }
36
+
37
+ output {
38
+ elasticsearch {
39
+ hosts => [ "localhost:9200" ]
40
+ }
41
+ }
42
+ ```
43
+
44
+
45
+ ## IP2Proxy Filter Configuration
46
+ |Setting|Input type|Required|
47
+ |---|---|---|
48
+ |source|string|Yes|
49
+ |database|a valid filesystem path|No|
50
+ |use_cache|boolean|No|
51
+
52
+ * **source** field is a required setting that containing the IP address or hostname to get the ip information.
53
+ * **database** field is an optional setting that containing the path to the IP2Proxy BIN database file.
54
+ * **use_cache** field is an optional setting that used to allow user to enable the use of cache. Default value is true.
55
+
56
+
57
+ ## Sample Output
58
+ |Field|Description|
59
+ |---|---|
60
+ |ip2proxy.as|the autonomous system (AS) name of proxy's IP address or domain name|
61
+ |ip2proxy.asn|the autonomous system number (ASN) of proxy's IP address or domain name|
62
+ |ip2proxy.city|the city name of the proxy|
63
+ |ip2proxy.country_long|the ISO3166-1 country name of the proxy|
64
+ |ip2proxy.country_short|the ISO3166-1 country code (two-characters) of the proxy|
65
+ |ip2proxy.domain|the domain name of proxy's IP address or domain name|
66
+ |ip2proxy.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>|
67
+ |ip2proxy.isp|the ISP name of the proxy|
68
+ |ip2proxy.last_seen|the last seen days ago value of proxy's IP address or domain name|
69
+ |ip2proxy.provider|the VPN service provider name if available|
70
+ |ip2proxy.proxy_type|the proxy type. Please visit <a href="https://www.ip2location.com/database/px11-ip-proxytype-country-region-city-isp-domain-usagetype-asn-lastseen-threat-residential-provider" target="_blank">IP2Location</a> for the list of proxy types supported|
71
+ |ip2proxy.region|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|
72
+ |ip2proxy.thread|the threat type of the proxy|
73
+ |ip2proxy.usage_type|the usage type classification of the proxy. Please visit <a href="https://www.ip2location.com/database/px11-ip-proxytype-country-region-city-isp-domain-usagetype-asn-lastseen-threat-residential-provider" target="_blank">IP2Location</a> for the list of usage types supported|
74
+
75
+
76
+ ## Support
77
+ Email: support@ip2location.com
78
+
79
+ URL: [https://www.ip2location.com](https://www.ip2location.com)
@@ -1,50 +1,165 @@
1
- # encoding: utf-8
2
- require "logstash/filters/base"
3
- require "logstash/namespace"
4
-
5
- require "logstash-filter-ip2proxy_jars"
6
-
7
- class LogStash::Filters::IP2Proxy < LogStash::Filters::Base
8
- config_name "ip2proxy"
9
-
10
- # The path to the IP2Proxy.BIN database file which Logstash should use.
11
- # If not specified, this will default to the IP2PROXY-LITE-PX4.BIN database that embedded in the plugin.
12
- config :database, :validate => :path
13
-
14
- # The field containing the IP address.
15
- # If this field is an array, only the first value will be used.
16
- config :source, :validate => :string, :required => true
17
-
18
- # The field used to define iplocation as target.
19
- config :target, :validate => :string, :default => 'ip2proxy'
20
-
21
- public
22
- def register
23
- if @database.nil?
24
- @database = ::Dir.glob(::File.join(::File.expand_path("../../../vendor/", ::File.dirname(__FILE__)),"IP2PROXY-LITE-PX8.BIN")).first
25
-
26
- if @database.nil? || !File.exists?(@database)
27
- raise "You must specify 'database => ...' in your ip2proxy filter (I looked for '#{@database}')"
28
- end
29
- end
30
-
31
- @logger.info("Using ip2proxy database", :path => @database)
32
-
33
- @ip2proxyfilter = org.logstash.filters.IP2ProxyFilter.new(@source, @target, @database)
34
- end
35
-
36
- public
37
- def filter(event)
38
- return unless filter?(event)
39
- if @ip2proxyfilter.handleEvent(event)
40
- filter_matched(event)
41
- else
42
- tag_iplookup_unsuccessful(event)
43
- end
44
- end
45
-
46
- def tag_iplookup_unsuccessful(event)
47
- @logger.debug? && @logger.debug("IP #{event.get(@source)} was not found in the database", :event => event)
48
- end
49
-
50
- end # class LogStash::Filters::IP2Proxy
1
+ # encoding: utf-8
2
+ require "logstash/filters/base"
3
+ require "logstash/namespace"
4
+
5
+ require "logstash-filter-ip2proxy_jars"
6
+
7
+ class LogStash::Filters::IP2Proxy < LogStash::Filters::Base
8
+ config_name "ip2proxy"
9
+
10
+ # The path to the IP2Proxy.BIN database file which Logstash should use.
11
+ # If not specified, this will default to the IP2PROXY-LITE-PX4.BIN database that embedded in the plugin.
12
+ config :database, :validate => :path
13
+
14
+ # The field containing the IP address.
15
+ # If this field is an array, only the first value will be used.
16
+ config :source, :validate => :string, :required => true
17
+
18
+ # The field used to define iplocation as target.
19
+ config :target, :validate => :string, :default => 'ip2proxy'
20
+
21
+ # The field used to allow user to enable the use of cache.
22
+ config :use_cache, :validate => :boolean, :default => true
23
+
24
+ # The field used to define the size of the cache. It is not required and the default value is 10 000
25
+ config :cache_size, :validate => :number, :required => false, :default => 10_000
26
+
27
+ public
28
+ def register
29
+ if @database.nil?
30
+ @database = ::Dir.glob(::File.join(::File.expand_path("../../../vendor/", ::File.dirname(__FILE__)),"IP2PROXY-LITE-PX1.BIN")).first
31
+
32
+ if @database.nil? || !File.exists?(@database)
33
+ raise "You must specify 'database => ...' in your ip2proxy filter (I looked for '#{@database}')"
34
+ end
35
+ end
36
+
37
+ @logger.info("Using ip2proxy database", :path => @database)
38
+
39
+ @ip2proxyfilter = org.logstash.filters.IP2ProxyFilter.new(@source, @target, @database)
40
+ end
41
+
42
+ public
43
+ def filter(event)
44
+ ip = event.get(@source)
45
+
46
+ return unless filter?(event)
47
+ if @use_cache
48
+ if value = Cache.find(event, ip, @ip2proxyfilter, @cache_size).get('ip2proxy')
49
+ event.set('ip2proxy', value)
50
+ filter_matched(event)
51
+ else
52
+ tag_iplookup_unsuccessful(event)
53
+ end
54
+ else
55
+ if @ip2proxyfilter.handleEvent(event)
56
+ filter_matched(event)
57
+ else
58
+ tag_iplookup_unsuccessful(event)
59
+ end
60
+ end
61
+ end
62
+
63
+ def tag_iplookup_unsuccessful(event)
64
+ @logger.debug? && @logger.debug("IP #{event.get(@source)} was not found in the database", :event => event)
65
+ end
66
+
67
+ end # class LogStash::Filters::IP2Proxy
68
+
69
+ class OrderedHash
70
+ ONE = 1
71
+
72
+ attr_reader :times_queried # ip -> times queried
73
+ attr_reader :hash
74
+
75
+ def initialize
76
+ @times_queried = Hash.new(0) # ip -> times queried
77
+ @hash = {} # number of hits -> array of ips
78
+ end
79
+
80
+ def add(key)
81
+ hash[ONE] ||= []
82
+ hash[ONE] << key
83
+ times_queried[key] = ONE
84
+ end
85
+
86
+ def reorder(key)
87
+ number_of_queries = times_queried[key]
88
+
89
+ hash[number_of_queries].delete(key)
90
+ hash.delete(number_of_queries) if hash[number_of_queries].empty?
91
+
92
+ hash[number_of_queries + 1] ||= []
93
+ hash[number_of_queries + 1] << key
94
+ end
95
+
96
+ def increment(key)
97
+ add(key) unless times_queried.has_key?(key)
98
+ reorder(key)
99
+ times_queried[key] += 1
100
+ end
101
+
102
+ def delete_least_used
103
+ first_pile_with_something.shift.tap { |key| times_queried.delete(key) }
104
+ end
105
+
106
+ def first_pile_with_something
107
+ hash[hash.keys.min]
108
+ end
109
+ end
110
+
111
+ class Cache
112
+ ONE_DAY_IN_SECONDS = 86_400
113
+
114
+ @cache = {} # ip -> event
115
+ @timestamps = {} # ip -> time of caching
116
+ @times_queried = OrderedHash.new # ip -> times queried
117
+ @mutex = Mutex.new
118
+
119
+ class << self
120
+ attr_reader :cache
121
+ attr_reader :timestamps
122
+ attr_reader :times_queried
123
+
124
+ def find(event, ip, filter, cache_size)
125
+ synchronize do
126
+ if cache.has_key?(ip)
127
+ refresh_event(event, ip, filter) if too_old?(ip)
128
+ else
129
+ if cache_full?(cache_size)
130
+ make_room
131
+ end
132
+ cache_event(event, ip, filter)
133
+ end
134
+ times_queried.increment(ip)
135
+ cache[ip]
136
+ end
137
+ end
138
+
139
+ def too_old?(ip)
140
+ timestamps[ip] < Time.now - ONE_DAY_IN_SECONDS
141
+ end
142
+
143
+ def make_room
144
+ key = times_queried.delete_least_used
145
+ cache.delete(key)
146
+ timestamps.delete(key)
147
+ end
148
+
149
+ def cache_full?(cache_size)
150
+ cache.size >= cache_size
151
+ end
152
+
153
+ def cache_event(event, ip, filter)
154
+ filter.handleEvent(event)
155
+ cache[ip] = event
156
+ timestamps[ip] = Time.now
157
+ end
158
+
159
+ def synchronize(&block)
160
+ @mutex.synchronize(&block)
161
+ end
162
+
163
+ alias_method :refresh_event, :cache_event
164
+ end
165
+ end
@@ -1,3 +1,3 @@
1
- require 'jar_dependencies'
2
- require_jar('com.ip2proxy.ip2proxy', 'ip2proxy', '2.0.0')
3
- require_jar('org.logstash.filters', 'logstash-filter-ip2proxy', '1.1.0')
1
+ require 'jar_dependencies'
2
+ require_jar('com.ip2proxy.ip2proxy', 'ip2proxy', '3.1.0')
3
+ require_jar('org.logstash.filters', 'logstash-filter-ip2proxy', '2.2.1')
@@ -1,25 +1,25 @@
1
- Gem::Specification.new do |s|
2
-
3
- s.name = 'logstash-filter-ip2proxy'
4
- s.version = '1.1.0'
5
- s.licenses = ['Apache License (2.0)']
6
- s.summary = "Logstash filter IP2Proxy"
7
- s.description = "IP2Proxy filter plugin for Logstash enables Logstash's users 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."
8
- s.authors = ["IP2Location"]
9
- s.email = 'support@ip2location.com'
10
- s.homepage = "https://www.ip2location.com"
11
- s.require_paths = ["lib", "vendor/jar-dependencies"]
12
-
13
- # Files
14
- s.files = Dir["lib/**/*",'spec/**/*',"vendor/**/*","vendor/jar-dependencies/**/*.jar","*.gemspec","*.md","Gemfile","LICENSE"]
15
-
16
- # Tests
17
- s.test_files = s.files.grep(%r{^(test|spec|features)/})
18
-
19
- # Special flag to let us know this is actually a logstash plugin
20
- s.metadata = { "logstash_plugin" => "true", "logstash_group" => "filter" }
21
-
22
- # Gem dependencies
23
- s.add_runtime_dependency "logstash-core-plugin-api", "~> 2.0"
24
- s.add_development_dependency "logstash-devutils"
25
- end
1
+ Gem::Specification.new do |s|
2
+
3
+ s.name = 'logstash-filter-ip2proxy'
4
+ s.version = '2.2.1'
5
+ s.licenses = ['Apache-2.0']
6
+ s.summary = "Logstash filter IP2Proxy"
7
+ s.description = "IP2Proxy filter plugin for Logstash enables Logstash's users to reverse search of IP address to detect VPN servers, open proxies, web proxies, Tor exit nodes, search engine robots, data center ranges and residential proxies using IP2Proxy BIN database."
8
+ s.authors = ["IP2Location"]
9
+ s.email = 'support@ip2location.com'
10
+ s.homepage = "https://www.ip2location.com"
11
+ s.require_paths = ["lib", "vendor/jar-dependencies"]
12
+
13
+ # Files
14
+ s.files = Dir["lib/**/*",'spec/**/*',"vendor/**/*","vendor/jar-dependencies/**/*.jar","*.gemspec","*.md","Gemfile","LICENSE"]
15
+
16
+ # Tests
17
+ s.test_files = s.files.grep(%r{^(test|spec|features)/})
18
+
19
+ # Special flag to let us know this is actually a logstash plugin
20
+ s.metadata = { "logstash_plugin" => "true", "logstash_group" => "filter" }
21
+
22
+ # Gem dependencies
23
+ s.add_runtime_dependency "logstash-core-plugin-api", "~> 2.0"
24
+ s.add_development_dependency "logstash-devutils"
25
+ end
@@ -1,27 +1,27 @@
1
- # encoding: utf-8
2
- require_relative '../spec_helper'
3
- require "logstash/filters/ip2proxy"
4
-
5
- IP2PROXYDB = ::Dir.glob(::File.expand_path("../../vendor/", ::File.dirname(__FILE__))+"/IP2PROXY-LITE-PX8.BIN").first
6
-
7
- describe LogStash::Filters::IP2Proxy do
8
-
9
- describe "normal test" do
10
- config <<-CONFIG
11
- filter {
12
- ip2proxy {
13
- source => "ip"
14
- #database => "#{IP2PROXYDB}"
15
- }
16
- }
17
- CONFIG
18
-
19
- sample("ip" => "8.8.8.8") do
20
- expect(subject.get("ip2proxy")).not_to be_empty
21
- expect(subject.get("ip2proxy")["country_short"]).to eq("US")
22
- end
23
- end
24
-
25
- end
26
-
1
+ # encoding: utf-8
2
+ require_relative '../spec_helper'
3
+ require "logstash/filters/ip2proxy"
4
+
5
+ IP2PROXYDB = ::Dir.glob(::File.expand_path("../../vendor/", ::File.dirname(__FILE__))+"/IP2PROXY-LITE-PX1.BIN").first
6
+
7
+ describe LogStash::Filters::IP2Proxy do
8
+
9
+ describe "normal test" do
10
+ config <<-CONFIG
11
+ filter {
12
+ ip2proxy {
13
+ source => "ip"
14
+ #database => "#{IP2PROXYDB}"
15
+ }
16
+ }
17
+ CONFIG
18
+
19
+ sample("ip" => "8.8.8.8") do
20
+ expect(subject.get("ip2proxy")).not_to be_empty
21
+ expect(subject.get("ip2proxy")["country_short"]).to eq("US")
22
+ end
23
+ end
24
+
25
+ end
26
+
27
27
  end
data/spec/spec_helper.rb CHANGED
@@ -1,2 +1,2 @@
1
- # encoding: utf-8
2
- require "logstash/devutils/rspec/spec_helper"
1
+ # encoding: utf-8
2
+ require "logstash/devutils/rspec/spec_helper"
@@ -0,0 +1,3 @@
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:852f55814fb14e8de5b47d416b95f1ce58757256484fda7d2d4462900db4229a
3
+ size 229021771
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: logstash-filter-ip2proxy
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.1.0
4
+ version: 2.2.1
5
5
  platform: ruby
6
6
  authors:
7
7
  - IP2Location
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2019-06-04 00:00:00.000000000 Z
11
+ date: 2021-09-17 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: logstash-core-plugin-api
@@ -40,7 +40,8 @@ dependencies:
40
40
  version: '0'
41
41
  description: IP2Proxy filter plugin for Logstash enables Logstash's users to reverse
42
42
  search of IP address to detect VPN servers, open proxies, web proxies, Tor exit
43
- nodes, search engine robots and data center ranges using IP2Proxy BIN database.
43
+ nodes, search engine robots, data center ranges and residential proxies using IP2Proxy
44
+ BIN database.
44
45
  email: support@ip2location.com
45
46
  executables: []
46
47
  extensions: []
@@ -54,12 +55,12 @@ files:
54
55
  - logstash-filter-ip2proxy.gemspec
55
56
  - spec/filters/ip2proxy_spec.rb
56
57
  - spec/spec_helper.rb
57
- - vendor/IP2PROXY-LITE-PX8.BIN
58
- - vendor/jar-dependencies/com/ip2proxy/ip2proxy/ip2proxy/2.0.0/ip2proxy-2.0.0.jar
59
- - vendor/jar-dependencies/org/logstash/filters/logstash-filter-ip2proxy/1.1.0/logstash-filter-ip2proxy-1.1.0.jar
58
+ - vendor/IP2PROXY-LITE-PX1.BIN
59
+ - vendor/jar-dependencies/com/ip2proxy/ip2proxy/ip2proxy/3.1.0/ip2proxy-3.1.0.jar
60
+ - vendor/jar-dependencies/org/logstash/filters/logstash-filter-ip2proxy/2.2.1/logstash-filter-ip2proxy-2.2.1.jar
60
61
  homepage: https://www.ip2location.com
61
62
  licenses:
62
- - Apache License (2.0)
63
+ - Apache-2.0
63
64
  metadata:
64
65
  logstash_plugin: 'true'
65
66
  logstash_group: filter
Binary file