dap 1.2.4 → 1.2.5
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/lib/dap/filter/geoip2.rb +7 -6
- data/lib/dap/version.rb +1 -1
- data/test/filters.bats +4 -0
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: e4980afacd4cce04c5936b8c973880dce051c5a7
|
4
|
+
data.tar.gz: a0519f28afc510bd44a3dd363ba99e2ef4c71b2a
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: c786cef2af1b7ac4debdecbf19c211aba042e80802ce1384fd44d482785b16b6792d9747edd4bf0bfaf362a77bd247afa48930ff7c02b81e94306bea7c6e0346
|
7
|
+
data.tar.gz: db00b788cfdfc5fb979313df8fbfd0dbade60847fabad678712539c9dd008787da48d7659b98cd8913048583de9b0829deec14d490b2cc2b1f529532067f29ba
|
data/lib/dap/filter/geoip2.rb
CHANGED
@@ -238,10 +238,11 @@ class FilterGeoIP2LegacyCompat
|
|
238
238
|
"isp.asn": "asn",
|
239
239
|
}
|
240
240
|
|
241
|
+
ret = {}
|
241
242
|
remap.each_pair do |geoip2,geoip|
|
242
243
|
geoip2_key = "#{self.base_field}.geoip2.#{geoip2}"
|
243
244
|
if doc.include?(geoip2_key)
|
244
|
-
|
245
|
+
ret["#{self.base_field}.#{geoip}"] = doc[geoip2_key]
|
245
246
|
end
|
246
247
|
end
|
247
248
|
|
@@ -256,7 +257,7 @@ class FilterGeoIP2LegacyCompat
|
|
256
257
|
if doc.include?(anon_key)
|
257
258
|
anon_value = doc[anon_key]
|
258
259
|
if anon_value == "true"
|
259
|
-
|
260
|
+
ret["#{self.base_field}.country_code"] = "A1"
|
260
261
|
end
|
261
262
|
end
|
262
263
|
|
@@ -264,7 +265,7 @@ class FilterGeoIP2LegacyCompat
|
|
264
265
|
if doc.include?(satellite_key)
|
265
266
|
satellite_value = doc[satellite_key]
|
266
267
|
if satellite_value == "true"
|
267
|
-
|
268
|
+
ret["#{self.base_field}.country_code"] = "A1"
|
268
269
|
end
|
269
270
|
end
|
270
271
|
|
@@ -273,7 +274,7 @@ class FilterGeoIP2LegacyCompat
|
|
273
274
|
if doc.include?(metro_key)
|
274
275
|
metro_value = doc[metro_key]
|
275
276
|
if !metro_value.empty? && metro_value != "0"
|
276
|
-
|
277
|
+
ret["#{self.base_field}.dma_code"] = metro_value
|
277
278
|
end
|
278
279
|
end
|
279
280
|
|
@@ -284,12 +285,12 @@ class FilterGeoIP2LegacyCompat
|
|
284
285
|
[ isp_org_key, isp_asn_org_key, asn_org_key ].each do |k|
|
285
286
|
v = doc[k]
|
286
287
|
if v && !v.empty?
|
287
|
-
|
288
|
+
ret["#{self.base_field}.org"] = v
|
288
289
|
break
|
289
290
|
end
|
290
291
|
end
|
291
292
|
|
292
|
-
[ remove_empties(
|
293
|
+
[ doc.merge(remove_empties(ret)) ]
|
293
294
|
end
|
294
295
|
end
|
295
296
|
|
data/lib/dap/version.rb
CHANGED
data/test/filters.bats
CHANGED
@@ -191,4 +191,8 @@ load ./test_common
|
|
191
191
|
assert_line --index 2 '{"line":"2a02:d9c0::","line.country_code":"TR","line.country_name":"Turkey","line.latitude":"39.05901","line.longitude":"34.91155"}'
|
192
192
|
# exists in ISP
|
193
193
|
assert_line --index 3 '{"line":"2a01:1000::","line.asn":"AS5617","line.org":"Telekomunikacja Polska S.A."}'
|
194
|
+
|
195
|
+
run bash -c "echo '{\"ip\": \"4.2.2.1\", \"something_empty\": \"\", \"some_int\": 80}' | GEOIP2_CITY_DATABASE_PATH=test/test_data/geoip2/GeoIP2-City-Test.mmdb dap json + geo_ip2_city ip + geo_ip2_legacy_compat ip + match_remove ip. + json"
|
196
|
+
assert_success
|
197
|
+
assert_output '{"ip":"4.2.2.1","something_empty":"","some_int":80}'
|
194
198
|
}
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: dap
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 1.2.
|
4
|
+
version: 1.2.5
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Rapid7 Research
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2019-05-
|
11
|
+
date: 2019-05-02 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: rspec
|