dap 0.0.1

Sign up to get free protection for your applications and to get access to all the features.
Files changed (54) hide show
  1. data/.gitignore +6 -0
  2. data/.rspec +2 -0
  3. data/Gemfile +15 -0
  4. data/Gemfile.lock +55 -0
  5. data/LICENSE +20 -0
  6. data/README.md +15 -0
  7. data/bin/dap +137 -0
  8. data/dap.gemspec +42 -0
  9. data/data/.gitkeep +0 -0
  10. data/lib/dap.rb +101 -0
  11. data/lib/dap/filter.rb +8 -0
  12. data/lib/dap/filter/base.rb +37 -0
  13. data/lib/dap/filter/geoip.rb +72 -0
  14. data/lib/dap/filter/http.rb +173 -0
  15. data/lib/dap/filter/names.rb +151 -0
  16. data/lib/dap/filter/openssl.rb +53 -0
  17. data/lib/dap/filter/recog.rb +23 -0
  18. data/lib/dap/filter/simple.rb +340 -0
  19. data/lib/dap/filter/udp.rb +401 -0
  20. data/lib/dap/input.rb +74 -0
  21. data/lib/dap/input/csv.rb +60 -0
  22. data/lib/dap/input/warc.rb +81 -0
  23. data/lib/dap/output.rb +117 -0
  24. data/lib/dap/proto/addp.rb +0 -0
  25. data/lib/dap/proto/dtls.rb +21 -0
  26. data/lib/dap/proto/ipmi.rb +94 -0
  27. data/lib/dap/proto/natpmp.rb +19 -0
  28. data/lib/dap/proto/wdbrpc.rb +58 -0
  29. data/lib/dap/utils/oui.rb +16586 -0
  30. data/lib/dap/version.rb +3 -0
  31. data/samples/http_get_reply.ic12.bz2 +0 -0
  32. data/samples/http_get_reply.ic12.sh +1 -0
  33. data/samples/http_get_reply_iframes.json.bz2 +0 -0
  34. data/samples/http_get_reply_iframes.json.sh +1 -0
  35. data/samples/http_get_reply_links.json.sh +1 -0
  36. data/samples/iawide.warc.bz2 +0 -0
  37. data/samples/iawide_warc.sh +1 -0
  38. data/samples/ipmi_chan_auth_replies.crd.bz2 +0 -0
  39. data/samples/ipmi_chan_auth_replies.sh +1 -0
  40. data/samples/ssl_certs.bz2 +0 -0
  41. data/samples/ssl_certs_geo.sh +1 -0
  42. data/samples/ssl_certs_names.sh +1 -0
  43. data/samples/ssl_certs_names_expanded.sh +1 -0
  44. data/samples/ssl_certs_org.sh +1 -0
  45. data/samples/udp-netbios.csv.bz2 +0 -0
  46. data/samples/udp-netbios.sh +1 -0
  47. data/spec/dap/proto/ipmi_spec.rb +19 -0
  48. data/tools/geo-ip-summary.rb +149 -0
  49. data/tools/ipmi-vulns.rb +27 -0
  50. data/tools/json-summarize.rb +81 -0
  51. data/tools/netbios-counts.rb +271 -0
  52. data/tools/upnp-vulns.rb +35 -0
  53. data/tools/value-counts-to-md-table.rb +23 -0
  54. metadata +264 -0
@@ -0,0 +1,35 @@
1
+ require 'oj'
2
+
3
+
4
+ # Searches contains each of the services, within each service it contains
5
+ # a hash key that will be compared against each of the items in the
6
+ # regex hash, and if a hit is returned the value from the regex is inserted
7
+ # into the hash with the output_key as the key.
8
+ #
9
+ SEARCHES = {
10
+ :upnp => {
11
+ :hash_key => 'data.upnp_server',
12
+ :output_key => 'vulnerability',
13
+ :regex => {
14
+ /MiniUPnPd\/1\.0([\.\,\-\~\s]|$)/mi => 'CVE-2013-0229',
15
+ /MiniUPnPd\/1\.[0-3]([\.\,\-\~\s]|$)/mi => 'CVE-2013-0230',
16
+ /Intel SDK for UPnP devices.*|Portable SDK for UPnP devices(\/?\s*$|\/1\.([0-5]\..*|8\.0.*|(6\.[0-9]|6\.1[0-7])([\.\,\-\~\s]|$)))/mi => 'CVE-2012-5958 , CVE-2012-5959'
17
+ }
18
+ }
19
+ }
20
+
21
+ def search(hash, service)
22
+ SEARCHES[service][:regex].each do | regex, value |
23
+ if regex =~ hash[SEARCHES[service][:hash_key]].force_encoding('BINARY')
24
+ # Handle cases that could be multiple hits, not for upnp but could be others.
25
+ hash[SEARCHES[service][:output_key]] = ( hash[SEARCHES[service][:output_key]] ? hash[SEARCHES[service][:output_key]] + ',' + value : value )
26
+ end
27
+ end if hash[SEARCHES[service][:hash_key]]
28
+ hash
29
+ end
30
+
31
+ while line=gets
32
+ #line.encode!('UTF-8', invalid: :replace, undef: :replace, replace: '')
33
+ #line.force_encoding('BINARY')
34
+ puts Oj.dump( search( Oj.load(line.strip), :upnp ))
35
+ end
@@ -0,0 +1,23 @@
1
+ #!/usr/bin/env ruby
2
+ info = {}
3
+ $stdin.each_line do |line|
4
+ line = line.unpack("C*").pack("C*").strip
5
+ info[line] ||= 0
6
+ info[line] +=1
7
+ end
8
+
9
+
10
+ puts "
11
+
12
+ #### Top Values
13
+ | Count | Value |
14
+ |:------------- | ------------- |"
15
+
16
+ max = 100
17
+ cnt = 0
18
+ info.keys.sort {|a,b| info[b] <=> info[a] }.each do |k|
19
+ puts "| #{info[k]} | #{k} |"
20
+ cnt +=1
21
+ break if cnt > max
22
+ end
23
+ puts ""
metadata ADDED
@@ -0,0 +1,264 @@
1
+ --- !ruby/object:Gem::Specification
2
+ name: dap
3
+ version: !ruby/object:Gem::Version
4
+ version: 0.0.1
5
+ prerelease:
6
+ platform: ruby
7
+ authors:
8
+ - Rapid7 Research
9
+ autorequire:
10
+ bindir: bin
11
+ cert_chain: []
12
+ date: 2014-06-17 00:00:00.000000000 Z
13
+ dependencies:
14
+ - !ruby/object:Gem::Dependency
15
+ name: rspec
16
+ requirement: !ruby/object:Gem::Requirement
17
+ none: false
18
+ requirements:
19
+ - - ! '>='
20
+ - !ruby/object:Gem::Version
21
+ version: '0'
22
+ type: :development
23
+ prerelease: false
24
+ version_requirements: !ruby/object:Gem::Requirement
25
+ none: false
26
+ requirements:
27
+ - - ! '>='
28
+ - !ruby/object:Gem::Version
29
+ version: '0'
30
+ - !ruby/object:Gem::Dependency
31
+ name: cucumber
32
+ requirement: !ruby/object:Gem::Requirement
33
+ none: false
34
+ requirements:
35
+ - - ! '>='
36
+ - !ruby/object:Gem::Version
37
+ version: '0'
38
+ type: :development
39
+ prerelease: false
40
+ version_requirements: !ruby/object:Gem::Requirement
41
+ none: false
42
+ requirements:
43
+ - - ! '>='
44
+ - !ruby/object:Gem::Version
45
+ version: '0'
46
+ - !ruby/object:Gem::Dependency
47
+ name: aruba
48
+ requirement: !ruby/object:Gem::Requirement
49
+ none: false
50
+ requirements:
51
+ - - ! '>='
52
+ - !ruby/object:Gem::Version
53
+ version: '0'
54
+ type: :development
55
+ prerelease: false
56
+ version_requirements: !ruby/object:Gem::Requirement
57
+ none: false
58
+ requirements:
59
+ - - ! '>='
60
+ - !ruby/object:Gem::Version
61
+ version: '0'
62
+ - !ruby/object:Gem::Dependency
63
+ name: nokogiri
64
+ requirement: !ruby/object:Gem::Requirement
65
+ none: false
66
+ requirements:
67
+ - - ! '>='
68
+ - !ruby/object:Gem::Version
69
+ version: '0'
70
+ type: :runtime
71
+ prerelease: false
72
+ version_requirements: !ruby/object:Gem::Requirement
73
+ none: false
74
+ requirements:
75
+ - - ! '>='
76
+ - !ruby/object:Gem::Version
77
+ version: '0'
78
+ - !ruby/object:Gem::Dependency
79
+ name: oj
80
+ requirement: !ruby/object:Gem::Requirement
81
+ none: false
82
+ requirements:
83
+ - - ! '>='
84
+ - !ruby/object:Gem::Version
85
+ version: '0'
86
+ type: :runtime
87
+ prerelease: false
88
+ version_requirements: !ruby/object:Gem::Requirement
89
+ none: false
90
+ requirements:
91
+ - - ! '>='
92
+ - !ruby/object:Gem::Version
93
+ version: '0'
94
+ - !ruby/object:Gem::Dependency
95
+ name: htmlentities
96
+ requirement: !ruby/object:Gem::Requirement
97
+ none: false
98
+ requirements:
99
+ - - ! '>='
100
+ - !ruby/object:Gem::Version
101
+ version: '0'
102
+ type: :runtime
103
+ prerelease: false
104
+ version_requirements: !ruby/object:Gem::Requirement
105
+ none: false
106
+ requirements:
107
+ - - ! '>='
108
+ - !ruby/object:Gem::Version
109
+ version: '0'
110
+ - !ruby/object:Gem::Dependency
111
+ name: net-dns
112
+ requirement: !ruby/object:Gem::Requirement
113
+ none: false
114
+ requirements:
115
+ - - ! '>='
116
+ - !ruby/object:Gem::Version
117
+ version: '0'
118
+ type: :runtime
119
+ prerelease: false
120
+ version_requirements: !ruby/object:Gem::Requirement
121
+ none: false
122
+ requirements:
123
+ - - ! '>='
124
+ - !ruby/object:Gem::Version
125
+ version: '0'
126
+ - !ruby/object:Gem::Dependency
127
+ name: bit-struct
128
+ requirement: !ruby/object:Gem::Requirement
129
+ none: false
130
+ requirements:
131
+ - - ! '>='
132
+ - !ruby/object:Gem::Version
133
+ version: '0'
134
+ type: :runtime
135
+ prerelease: false
136
+ version_requirements: !ruby/object:Gem::Requirement
137
+ none: false
138
+ requirements:
139
+ - - ! '>='
140
+ - !ruby/object:Gem::Version
141
+ version: '0'
142
+ - !ruby/object:Gem::Dependency
143
+ name: geoip-c
144
+ requirement: !ruby/object:Gem::Requirement
145
+ none: false
146
+ requirements:
147
+ - - ! '>='
148
+ - !ruby/object:Gem::Version
149
+ version: '0'
150
+ type: :runtime
151
+ prerelease: false
152
+ version_requirements: !ruby/object:Gem::Requirement
153
+ none: false
154
+ requirements:
155
+ - - ! '>='
156
+ - !ruby/object:Gem::Version
157
+ version: '0'
158
+ - !ruby/object:Gem::Dependency
159
+ name: recog
160
+ requirement: !ruby/object:Gem::Requirement
161
+ none: false
162
+ requirements:
163
+ - - ! '>='
164
+ - !ruby/object:Gem::Version
165
+ version: '0'
166
+ type: :runtime
167
+ prerelease: false
168
+ version_requirements: !ruby/object:Gem::Requirement
169
+ none: false
170
+ requirements:
171
+ - - ! '>='
172
+ - !ruby/object:Gem::Version
173
+ version: '0'
174
+ description: ! 'DAP reads data using an input plugin, transforms it through a series
175
+ of filters, and prints it out again using an output plugin. Every record is treated
176
+ as a document (aka: hash/dict) and filters are used to reduce, expand, and transform
177
+ these documents as they pass through. Think of DAP as a mashup between sed, awk,
178
+ grep, csvtool, and jq, with map/reduce capabilities.'
179
+ email:
180
+ - research@rapid7.com
181
+ executables:
182
+ - dap
183
+ extensions: []
184
+ extra_rdoc_files: []
185
+ files:
186
+ - .gitignore
187
+ - .rspec
188
+ - Gemfile
189
+ - Gemfile.lock
190
+ - LICENSE
191
+ - README.md
192
+ - bin/dap
193
+ - dap.gemspec
194
+ - data/.gitkeep
195
+ - lib/dap.rb
196
+ - lib/dap/filter.rb
197
+ - lib/dap/filter/base.rb
198
+ - lib/dap/filter/geoip.rb
199
+ - lib/dap/filter/http.rb
200
+ - lib/dap/filter/names.rb
201
+ - lib/dap/filter/openssl.rb
202
+ - lib/dap/filter/recog.rb
203
+ - lib/dap/filter/simple.rb
204
+ - lib/dap/filter/udp.rb
205
+ - lib/dap/input.rb
206
+ - lib/dap/input/csv.rb
207
+ - lib/dap/input/warc.rb
208
+ - lib/dap/output.rb
209
+ - lib/dap/proto/addp.rb
210
+ - lib/dap/proto/dtls.rb
211
+ - lib/dap/proto/ipmi.rb
212
+ - lib/dap/proto/natpmp.rb
213
+ - lib/dap/proto/wdbrpc.rb
214
+ - lib/dap/utils/oui.rb
215
+ - lib/dap/version.rb
216
+ - samples/http_get_reply.ic12.bz2
217
+ - samples/http_get_reply.ic12.sh
218
+ - samples/http_get_reply_iframes.json.bz2
219
+ - samples/http_get_reply_iframes.json.sh
220
+ - samples/http_get_reply_links.json.sh
221
+ - samples/iawide.warc.bz2
222
+ - samples/iawide_warc.sh
223
+ - samples/ipmi_chan_auth_replies.crd.bz2
224
+ - samples/ipmi_chan_auth_replies.sh
225
+ - samples/ssl_certs.bz2
226
+ - samples/ssl_certs_geo.sh
227
+ - samples/ssl_certs_names.sh
228
+ - samples/ssl_certs_names_expanded.sh
229
+ - samples/ssl_certs_org.sh
230
+ - samples/udp-netbios.csv.bz2
231
+ - samples/udp-netbios.sh
232
+ - spec/dap/proto/ipmi_spec.rb
233
+ - tools/geo-ip-summary.rb
234
+ - tools/ipmi-vulns.rb
235
+ - tools/json-summarize.rb
236
+ - tools/netbios-counts.rb
237
+ - tools/upnp-vulns.rb
238
+ - tools/value-counts-to-md-table.rb
239
+ homepage: https://www.github.com/rapid7/dap
240
+ licenses: []
241
+ post_install_message:
242
+ rdoc_options: []
243
+ require_paths:
244
+ - lib
245
+ required_ruby_version: !ruby/object:Gem::Requirement
246
+ none: false
247
+ requirements:
248
+ - - ! '>='
249
+ - !ruby/object:Gem::Version
250
+ version: '0'
251
+ required_rubygems_version: !ruby/object:Gem::Requirement
252
+ none: false
253
+ requirements:
254
+ - - ! '>='
255
+ - !ruby/object:Gem::Version
256
+ version: '0'
257
+ requirements: []
258
+ rubyforge_project:
259
+ rubygems_version: 1.8.23
260
+ signing_key:
261
+ specification_version: 3
262
+ summary: ! 'DAP: The Data Analysis Pipeline'
263
+ test_files: []
264
+ has_rdoc: