dap 1.2.5 → 1.2.9
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +5 -5
- data/.gitignore +13 -0
- data/Dockerfile +1 -0
- data/Dockerfile.testing +4 -2
- data/Gemfile +4 -4
- data/Gemfile.lock +73 -34
- data/README.md +5 -4
- data/Rakefile +1 -1
- data/lib/dap/filter/geoip2.rb +14 -5
- data/lib/dap/filter/http.rb +1 -1
- data/lib/dap/version.rb +1 -1
- data/spec/dap/filter/http_filter_spec.rb +65 -0
- data/test/filters.bats +13 -1
- metadata +6 -7
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
|
-
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
2
|
+
SHA256:
|
3
|
+
metadata.gz: 269ac8cdd229ae3024579e464a7328e0c03fd63475db4ea00f27062881b7a584
|
4
|
+
data.tar.gz: bb7eccc16da408a3612e425063391f04598fa9f2a2588d1e5bc76044d82ab966
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 03df4ab5d19b8c9658fd00d74973d28fec5e7fafcdaa8c0b5f6b4f88eddd07d439918f133990a099b86b92ec2a7ccb6ee14e1167663b9583e90da493b71e73dc
|
7
|
+
data.tar.gz: ef55c2efa82bfafa533085895aed89a4dd0aeb059b6bc1fd9a054329d7f06873c130c46234bbb8d174df89add716dbb863e830717085a4119cbfff0c8a9c1187
|
data/.gitignore
CHANGED
@@ -4,3 +4,16 @@
|
|
4
4
|
|
5
5
|
# Ignore geoip data file
|
6
6
|
data/geoip.dat
|
7
|
+
data/GeoLite2-ASN.mmdb
|
8
|
+
data/GeoLite2-City.mmdb
|
9
|
+
data/GeoLite2-Country.mmdb
|
10
|
+
|
11
|
+
/pkg/
|
12
|
+
|
13
|
+
## Environment normalization:
|
14
|
+
/.bundle/
|
15
|
+
/vendor/bundle
|
16
|
+
/lib/bundler/man/
|
17
|
+
|
18
|
+
# Misc
|
19
|
+
**/.DS_Store
|
data/Dockerfile
CHANGED
data/Dockerfile.testing
CHANGED
@@ -1,6 +1,8 @@
|
|
1
|
-
FROM ubuntu:
|
1
|
+
FROM ubuntu:20.04
|
2
2
|
|
3
3
|
ENV TEST_DIR /opt/bats_testing
|
4
|
+
|
5
|
+
ENV DEBIAN_FRONTEND=noninteractive
|
4
6
|
RUN apt-get update
|
5
7
|
RUN apt-get install -y build-essential ca-certificates curl git jq libffi-dev libgeoip-dev libxml2-dev wget zlib1g-dev
|
6
8
|
|
@@ -12,7 +14,7 @@ RUN /bin/bash -l -c "rvm requirements"
|
|
12
14
|
RUN /bin/bash -l -c "rvm install 2.4.5"
|
13
15
|
RUN /bin/bash -l -c "rvm use 2.4.5 && gem update --system && gem install bundler"
|
14
16
|
ADD Gemfile* $TEST_DIR/
|
15
|
-
RUN /bin/bash -l -c "cd $TEST_DIR && rvm use 2.4.5 && bundle install"
|
17
|
+
RUN /bin/bash -l -c "cd $TEST_DIR && rvm use 2.4.5 && bundle update --bundler && bundle install"
|
16
18
|
|
17
19
|
# install maxmind legacy data
|
18
20
|
RUN mkdir /var/lib/geoip
|
data/Gemfile
CHANGED
@@ -6,10 +6,10 @@ gem 'net-dns'
|
|
6
6
|
gem 'bit-struct'
|
7
7
|
gem 'geoip-c'
|
8
8
|
gem 'maxmind-db', '~> 1.0.0'
|
9
|
-
gem 'recog', '>=2.3.
|
9
|
+
gem 'recog', '>=2.3.21'
|
10
10
|
|
11
11
|
group :test do
|
12
|
-
gem 'rspec', '~> 3.
|
13
|
-
gem 'cucumber', '~>
|
14
|
-
gem 'aruba', '~> 0.6.
|
12
|
+
gem 'rspec', '~> 3.9.0'
|
13
|
+
gem 'cucumber', '~> 4.0.0'
|
14
|
+
gem 'aruba', '~> 0.6.2'
|
15
15
|
end
|
data/Gemfile.lock
CHANGED
@@ -1,63 +1,102 @@
|
|
1
1
|
GEM
|
2
2
|
remote: https://rubygems.org/
|
3
3
|
specs:
|
4
|
+
activesupport (5.2.4.4)
|
5
|
+
concurrent-ruby (~> 1.0, >= 1.0.2)
|
6
|
+
i18n (>= 0.7, < 2)
|
7
|
+
minitest (~> 5.1)
|
8
|
+
tzinfo (~> 1.1)
|
4
9
|
aruba (0.6.2)
|
5
10
|
childprocess (>= 0.3.6)
|
6
11
|
cucumber (>= 1.1.1)
|
7
12
|
rspec-expectations (>= 2.7.0)
|
8
|
-
bit-struct (0.16
|
9
|
-
builder (3.2.
|
10
|
-
childprocess (0.
|
11
|
-
|
12
|
-
cucumber (
|
13
|
-
builder (>= 2.
|
14
|
-
|
15
|
-
|
16
|
-
|
17
|
-
|
18
|
-
|
19
|
-
|
13
|
+
bit-struct (0.16)
|
14
|
+
builder (3.2.4)
|
15
|
+
childprocess (4.0.0)
|
16
|
+
concurrent-ruby (1.1.7)
|
17
|
+
cucumber (4.0.1)
|
18
|
+
builder (~> 3.2, >= 3.2.3)
|
19
|
+
cucumber-core (~> 7.0, >= 7.0.0)
|
20
|
+
cucumber-cucumber-expressions (~> 10.1, >= 10.1.0)
|
21
|
+
cucumber-gherkin (~> 13.0, >= 13.0.0)
|
22
|
+
cucumber-html-formatter (~> 6.0, >= 6.0.1)
|
23
|
+
cucumber-messages (~> 12.1, >= 12.1.1)
|
24
|
+
cucumber-wire (~> 3.0, >= 3.0.0)
|
25
|
+
diff-lcs (~> 1.3, >= 1.3, < 1.4)
|
26
|
+
multi_test (~> 0.1, >= 0.1.2)
|
27
|
+
sys-uname (~> 1.0, >= 1.0.2)
|
28
|
+
cucumber-core (7.0.0)
|
29
|
+
cucumber-gherkin (~> 13.0, >= 13.0.0)
|
30
|
+
cucumber-messages (~> 12.1, >= 12.1.1)
|
31
|
+
cucumber-tag-expressions (~> 2.0, >= 2.0.4)
|
32
|
+
cucumber-cucumber-expressions (10.3.0)
|
33
|
+
cucumber-gherkin (13.0.0)
|
34
|
+
cucumber-messages (~> 12.0, >= 12.0.0)
|
35
|
+
cucumber-html-formatter (6.0.3)
|
36
|
+
cucumber-messages (~> 12.1, >= 12.1.1)
|
37
|
+
cucumber-messages (12.4.0)
|
38
|
+
protobuf-cucumber (~> 3.10, >= 3.10.8)
|
39
|
+
cucumber-tag-expressions (2.0.4)
|
40
|
+
cucumber-wire (3.0.0)
|
41
|
+
cucumber-core (~> 7.0, >= 7.0.0)
|
42
|
+
cucumber-cucumber-expressions (~> 10.1, >= 10.1.0)
|
43
|
+
cucumber-messages (~> 12.1, >= 12.1.1)
|
44
|
+
diff-lcs (1.3)
|
45
|
+
ffi (1.13.1)
|
20
46
|
geoip-c (0.9.1)
|
21
|
-
gherkin (2.12.2)
|
22
|
-
multi_json (~> 1.3)
|
23
47
|
htmlentities (4.3.4)
|
48
|
+
i18n (1.8.5)
|
49
|
+
concurrent-ruby (~> 1.0)
|
24
50
|
maxmind-db (1.0.0)
|
51
|
+
middleware (0.1.0)
|
25
52
|
mini_portile2 (2.4.0)
|
26
|
-
|
53
|
+
minitest (5.14.2)
|
27
54
|
multi_test (0.1.2)
|
28
55
|
net-dns (0.9.0)
|
29
|
-
nokogiri (1.10.
|
56
|
+
nokogiri (1.10.10)
|
30
57
|
mini_portile2 (~> 2.4.0)
|
31
|
-
oj (3.
|
32
|
-
|
58
|
+
oj (3.10.6)
|
59
|
+
protobuf-cucumber (3.10.8)
|
60
|
+
activesupport (>= 3.2)
|
61
|
+
middleware
|
62
|
+
thor
|
63
|
+
thread_safe
|
64
|
+
recog (2.3.21)
|
33
65
|
nokogiri
|
34
|
-
rspec (3.
|
35
|
-
rspec-core (~> 3.
|
36
|
-
rspec-expectations (~> 3.
|
37
|
-
rspec-mocks (~> 3.
|
38
|
-
rspec-core (3.
|
39
|
-
rspec-support (~> 3.
|
40
|
-
rspec-expectations (3.
|
66
|
+
rspec (3.9.0)
|
67
|
+
rspec-core (~> 3.9.0)
|
68
|
+
rspec-expectations (~> 3.9.0)
|
69
|
+
rspec-mocks (~> 3.9.0)
|
70
|
+
rspec-core (3.9.2)
|
71
|
+
rspec-support (~> 3.9.3)
|
72
|
+
rspec-expectations (3.9.3)
|
41
73
|
diff-lcs (>= 1.2.0, < 2.0)
|
42
|
-
rspec-support (~> 3.
|
43
|
-
rspec-mocks (3.1
|
44
|
-
|
45
|
-
|
74
|
+
rspec-support (~> 3.9.0)
|
75
|
+
rspec-mocks (3.9.1)
|
76
|
+
diff-lcs (>= 1.2.0, < 2.0)
|
77
|
+
rspec-support (~> 3.9.0)
|
78
|
+
rspec-support (3.9.4)
|
79
|
+
sys-uname (1.2.1)
|
80
|
+
ffi (>= 1.0.0)
|
81
|
+
thor (1.0.1)
|
82
|
+
thread_safe (0.3.6)
|
83
|
+
tzinfo (1.2.7)
|
84
|
+
thread_safe (~> 0.1)
|
46
85
|
|
47
86
|
PLATFORMS
|
48
87
|
ruby
|
49
88
|
|
50
89
|
DEPENDENCIES
|
51
|
-
aruba (~> 0.6.
|
90
|
+
aruba (~> 0.6.2)
|
52
91
|
bit-struct
|
53
|
-
cucumber (~>
|
92
|
+
cucumber (~> 4.0.0)
|
54
93
|
geoip-c
|
55
94
|
htmlentities
|
56
95
|
maxmind-db (~> 1.0.0)
|
57
96
|
net-dns
|
58
97
|
oj
|
59
|
-
recog (>= 2.3.
|
60
|
-
rspec (~> 3.
|
98
|
+
recog (>= 2.3.21)
|
99
|
+
rspec (~> 3.9.0)
|
61
100
|
|
62
101
|
BUNDLED WITH
|
63
|
-
|
102
|
+
1.17.3
|
data/README.md
CHANGED
@@ -9,8 +9,6 @@ DAP reads data using an input plugin, transforms it through a series of filters,
|
|
9
9
|
|
10
10
|
DAP was written to process terabyte-sized public scan datasets, such as those provided by https://scans.io/. Although DAP isn't particularly fast, it can be used across multiple cores (and machines) by splitting the input source and wrapping the execution with GNU Parallel.
|
11
11
|
|
12
|
-
|
13
|
-
|
14
12
|
## Installation
|
15
13
|
|
16
14
|
### Prerequisites
|
@@ -61,7 +59,10 @@ gem install dap
|
|
61
59
|
### OS X
|
62
60
|
|
63
61
|
```bash
|
62
|
+
# Install the GeoIP C library required by DAP
|
64
63
|
brew update
|
64
|
+
brew install geoip
|
65
|
+
|
65
66
|
gem install dap
|
66
67
|
```
|
67
68
|
|
@@ -69,7 +70,7 @@ gem install dap
|
|
69
70
|
|
70
71
|
In its simplest form, DAP takes input, applies zero or more filters which modify the input, and then outputs the result. The input, filters and output are separated by plus signs (`+`). As seen from `dap -h`:
|
71
72
|
|
72
|
-
```
|
73
|
+
```shell
|
73
74
|
Usage: dap [input] + [filter] + [output]
|
74
75
|
--inputs
|
75
76
|
--outputs
|
@@ -80,7 +81,7 @@ To see which input/output formats are supported and what filters are available,
|
|
80
81
|
|
81
82
|
This example reads as input a single IP address from `STDIN` in line form, applies geo-ip transformations as a filter on that line, and then returns the output as JSON:
|
82
83
|
|
83
|
-
```
|
84
|
+
```shell
|
84
85
|
$ echo 8.8.8.8 | bin/dap + lines + geo_ip2_city line + json | jq .
|
85
86
|
{
|
86
87
|
"line": "8.8.8.8",
|
data/Rakefile
CHANGED
data/lib/dap/filter/geoip2.rb
CHANGED
@@ -33,6 +33,13 @@ module GeoIP2Library
|
|
33
33
|
nil
|
34
34
|
end
|
35
35
|
|
36
|
+
def get_maxmind_data(db, ip)
|
37
|
+
begin
|
38
|
+
db.get(ip)
|
39
|
+
rescue IPAddr::InvalidAddressError
|
40
|
+
end
|
41
|
+
end
|
42
|
+
|
36
43
|
def remove_empties(hash)
|
37
44
|
hash.each_pair do |k,v|
|
38
45
|
if v.empty?
|
@@ -78,8 +85,10 @@ class FilterGeoIP2City
|
|
78
85
|
unless @@geo_city
|
79
86
|
raise "No MaxMind GeoIP2::City data found"
|
80
87
|
end
|
81
|
-
|
88
|
+
|
82
89
|
ret = defaults
|
90
|
+
geo_hash = get_maxmind_data(@@geo_city, ip)
|
91
|
+
return unless geo_hash
|
83
92
|
|
84
93
|
if geo_hash.include?("subdivisions")
|
85
94
|
# handle countries that are divided into various subdivisions. generally 1, sometimes 2
|
@@ -143,9 +152,9 @@ class FilterGeoIP2Asn
|
|
143
152
|
unless @@geo_asn
|
144
153
|
raise "No MaxMind GeoIP2::ASN data found"
|
145
154
|
end
|
146
|
-
geo_hash = @@geo_asn.get(ip)
|
147
|
-
return unless geo_hash
|
148
155
|
|
156
|
+
geo_hash = get_maxmind_data(@@geo_asn, ip)
|
157
|
+
return unless geo_hash
|
149
158
|
ret = {}
|
150
159
|
|
151
160
|
if geo_hash.include?("autonomous_system_number")
|
@@ -174,9 +183,9 @@ class FilterGeoIP2Isp
|
|
174
183
|
unless @@geo_isp
|
175
184
|
raise "No MaxMind GeoIP2::ISP data found"
|
176
185
|
end
|
177
|
-
geo_hash = @@geo_isp.get(ip)
|
178
|
-
return unless geo_hash
|
179
186
|
|
187
|
+
geo_hash = get_maxmind_data(@@geo_isp, ip)
|
188
|
+
return unless geo_hash
|
180
189
|
ret = {}
|
181
190
|
|
182
191
|
if geo_hash.include?("autonomous_system_number")
|
data/lib/dap/filter/http.rb
CHANGED
data/lib/dap/version.rb
CHANGED
@@ -151,5 +151,70 @@ describe Dap::Filter::FilterHTMLLinks do
|
|
151
151
|
expect(processed.map { |p| p['link'] }).to eq(%w(a b))
|
152
152
|
end
|
153
153
|
end
|
154
|
+
|
155
|
+
context 'repeated less than symbol' do
|
156
|
+
body =
|
157
|
+
'<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<'\
|
158
|
+
'<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<'\
|
159
|
+
'<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<'\
|
160
|
+
'<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<'\
|
161
|
+
'<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<'\
|
162
|
+
'<a href="a"/>'\
|
163
|
+
'<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<'\
|
164
|
+
'<<<<<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|
215
|
+
it 'extracted the correct links' do
|
216
|
+
expect(processed.map { |p| p['link'] }).to eq(%w(a b))
|
217
|
+
end
|
218
|
+
end
|
154
219
|
end
|
155
220
|
end
|
data/test/filters.bats
CHANGED
@@ -160,6 +160,11 @@ load ./test_common
|
|
160
160
|
run bash -c "echo 2a02:d9c0:: | GEOIP2_CITY_DATABASE_PATH=test/test_data/geoip2/GeoIP2-City-Test.mmdb $DAP_EXECUTABLE lines + geo_ip2_city line + json | jq -Sc -r ."
|
161
161
|
assert_success
|
162
162
|
assert_output '{"line":"2a02:d9c0::","line.geoip2.city.city.geoname_id":"0","line.geoip2.city.continent.code":"AS","line.geoip2.city.continent.geoname_id":"6255147","line.geoip2.city.continent.name":"Asia","line.geoip2.city.country.geoname_id":"298795","line.geoip2.city.country.is_in_european_union":"false","line.geoip2.city.country.iso_code":"TR","line.geoip2.city.country.name":"Turkey","line.geoip2.city.location.accuracy_radius":"100","line.geoip2.city.location.latitude":"39.05901","line.geoip2.city.location.longitude":"34.91155","line.geoip2.city.location.metro_code":"0","line.geoip2.city.location.time_zone":"Europe/Istanbul","line.geoip2.city.registered_country.geoname_id":"298795","line.geoip2.city.registered_country.is_in_european_union":"false","line.geoip2.city.registered_country.iso_code":"TR","line.geoip2.city.registered_country.name":"Turkey","line.geoip2.city.represented_country.geoname_id":"0","line.geoip2.city.represented_country.is_in_european_union":"false","line.geoip2.city.traits.is_anonymous_proxy":"false","line.geoip2.city.traits.is_satellite_provider":"false"}'
|
163
|
+
|
164
|
+
# test invalid IP
|
165
|
+
run bash -c "echo test | GEOIP2_CITY_DATABASE_PATH=test/test_data/geoip2/GeoIP2-City-Test.mmdb $DAP_EXECUTABLE lines + geo_ip2_city line + json | jq -Sc -r ."
|
166
|
+
assert_success
|
167
|
+
assert_output '{"line":"test"}'
|
163
168
|
}
|
164
169
|
|
165
170
|
@test "geo_ip2_asn" {
|
@@ -171,13 +176,20 @@ load ./test_common
|
|
171
176
|
run bash -c "echo 2600:7000:: | GEOIP2_ASN_DATABASE_PATH=test/test_data/geoip2/GeoLite2-ASN-Test.mmdb $DAP_EXECUTABLE lines + geo_ip2_asn line + json | jq -Sc -r ."
|
172
177
|
assert_success
|
173
178
|
assert_output '{"line":"2600:7000::","line.geoip2.asn.asn":"AS6939","line.geoip2.asn.asn_org":"Hurricane Electric, Inc."}'
|
179
|
+
|
180
|
+
# test invalid IP
|
181
|
+
run bash -c "echo test | GEOIP2_ASN_DATABASE_PATH=test/test_data/geoip2/GeoLite2-ASN-Test.mmdb $DAP_EXECUTABLE lines + geo_ip2_asn line + json | jq -Sc -r ."
|
182
|
+
assert_success
|
183
|
+
assert_output '{"line":"test"}'
|
174
184
|
}
|
175
185
|
|
176
186
|
@test "geo_ip2_isp" {
|
177
|
-
run bash -c "echo -e '12.81.92.0\n2600:7000
|
187
|
+
run bash -c "echo -e '12.81.92.0\n2600:7000::\ntest' | GEOIP2_ISP_DATABASE_PATH=test/test_data/geoip2/GeoIP2-ISP-Test.mmdb $DAP_EXECUTABLE lines + geo_ip2_isp line + json | jq -Sc -r ."
|
178
188
|
assert_line --index 0 '{"line":"12.81.92.0","line.geoip2.isp.asn":"AS7018","line.geoip2.isp.isp":"AT&T Services","line.geoip2.isp.org":"AT&T Services"}'
|
179
189
|
# test IPv6
|
180
190
|
assert_line --index 1 '{"line":"2600:7000::","line.geoip2.isp.asn":"AS6939","line.geoip2.isp.asn_org":"Hurricane Electric, Inc."}'
|
191
|
+
# test invalid IP
|
192
|
+
assert_line --index 2 '{"line":"test"}'
|
181
193
|
}
|
182
194
|
|
183
195
|
@test "geo_ip2_legacy_compat" {
|
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.9
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Rapid7 Research
|
8
|
-
autorequire:
|
8
|
+
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date:
|
11
|
+
date: 2021-08-04 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: rspec
|
@@ -267,7 +267,7 @@ files:
|
|
267
267
|
homepage: https://www.github.com/rapid7/dap
|
268
268
|
licenses: []
|
269
269
|
metadata: {}
|
270
|
-
post_install_message:
|
270
|
+
post_install_message:
|
271
271
|
rdoc_options: []
|
272
272
|
require_paths:
|
273
273
|
- lib
|
@@ -282,9 +282,8 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
282
282
|
- !ruby/object:Gem::Version
|
283
283
|
version: '0'
|
284
284
|
requirements: []
|
285
|
-
|
286
|
-
|
287
|
-
signing_key:
|
285
|
+
rubygems_version: 3.0.6
|
286
|
+
signing_key:
|
288
287
|
specification_version: 4
|
289
288
|
summary: 'DAP: The Data Analysis Pipeline'
|
290
289
|
test_files:
|