dap 0.1.2 → 0.1.3

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
  SHA1:
3
- metadata.gz: b119da99eec7c7e49a870110c1af855f004a38ce
4
- data.tar.gz: 556852867c42e3652559f891b9cc64655619fbbd
3
+ metadata.gz: 88bd3d23abc85411de3354902069d7bfae980809
4
+ data.tar.gz: 84459c4a10ba66f8c3b716c0f7e8f9bde1dc9c02
5
5
  SHA512:
6
- metadata.gz: e29f834d07bd0d02cb03ec4b047c47987ae585f6ebf7bfc6782c40acd30e99fbfc64b550e5497f65b50b0fc6461bd58cf581f7bcdf2c1f1cb6d5d2b8e98c3be2
7
- data.tar.gz: c846f6ebf2ec60baad6c8943ebf401ee4715e0995717d6bc897c27a2883fecb4af02951d649d20fff2154a9f1b74879726f5a3a6f74155a2cecb5b08b1c6c9ae
6
+ metadata.gz: 40c689fa8281c1dfcd2befea059657caaed9e6fcbaa42247371194d52730227145a5c7c2bc740e56a89f241d97e4d261cba40f4ecf997abbd5fb4a0903793ac6
7
+ data.tar.gz: b8a6f3f48509c4ae224a2a0750aefb0d8f4313764fe368fcc94e54604628e962535b94b93688ef8c69b5431875c57618f6f12d2780c7de95592853c10f2f7b26
@@ -139,10 +139,10 @@ class FilterDecodeHTTPReply
139
139
  lines = data.split(/\r?\n/)
140
140
  resp = lines.shift
141
141
  save = {}
142
- return save if resp !~ /^HTTP\/\d+\.\d+\s+(\d+)\s+(.*)/
142
+ return save if resp !~ /^HTTP\/\d+\.\d+\s+(\d+)(?:\s+(.*))?/
143
143
 
144
144
  save["http_code"] = $1.to_i
145
- save["http_message"] = $2.strip
145
+ save["http_message"] = ($2 ? $2.strip : '')
146
146
  save["http_raw_headers"] = {}
147
147
 
148
148
  clen = nil
@@ -91,6 +91,21 @@ class FilterRemove
91
91
  end
92
92
  end
93
93
 
94
+ class FilterMatchSelect
95
+ include Base
96
+ def process(doc)
97
+ ndoc = {}
98
+ self.opts.each_pair do |re,|
99
+ doc.each_key do |k|
100
+ if k.match(re)
101
+ ndoc[k] = doc[k]
102
+ end
103
+ end
104
+ end
105
+ (ndoc.keys.length == 0) ? [] : [ ndoc ]
106
+ end
107
+ end
108
+
94
109
  class FilterSelect
95
110
  include Base
96
111
  def process(doc)
data/lib/dap/version.rb CHANGED
@@ -1,3 +1,3 @@
1
1
  module Dap
2
- VERSION = "0.1.2"
2
+ VERSION = "0.1.3"
3
3
  end
@@ -72,6 +72,14 @@ describe Dap::Filter::FilterDecodeHTTPReply do
72
72
  end
73
73
  end
74
74
 
75
+ context 'decoding responses that are missing the "reason phrase", an RFC anomaly' do
76
+ let(:decode) { filter.decode("HTTP/1.1 301\r\nDate: Tue, 28 Mar 2017 20:46:52 GMT\r\nContent-Type: text/html\r\nContent-Length: 177\r\nConnection: close\r\nLocation: http://www.example.com/\r\n\r\nstuff") }
77
+
78
+ it 'decodes anyway' do
79
+ expect(decode['http_body']).to eq('stuff')
80
+ end
81
+ end
82
+
75
83
  end
76
84
  end
77
85
 
@@ -96,6 +96,34 @@ describe Dap::Filter::FilterMatchRemove do
96
96
  end
97
97
  end
98
98
 
99
+ describe Dap::Filter::FilterMatchSelect do
100
+ describe '.process' do
101
+
102
+ let(:filter) { described_class.new(["foo."]) }
103
+
104
+ context 'with similar keys' do
105
+ let(:process) { filter.process({"foo" => "bar", "foo.blah" => "blah", "foo.bar" => "baz"}) }
106
+ it 'selects the expected keys' do
107
+ expect(process).to eq([{"foo.blah" => "blah", "foo.bar" => "baz"}])
108
+ end
109
+ end
110
+ end
111
+ end
112
+
113
+ describe Dap::Filter::FilterSelect do
114
+ describe '.process' do
115
+
116
+ let(:filter) { described_class.new(["foo"]) }
117
+
118
+ context 'with similar keys' do
119
+ let(:process) { filter.process({"foo" => "bar", "foobar" => "blah"}) }
120
+ it 'selects the expected keys' do
121
+ expect(process).to eq([{"foo" => "bar"}])
122
+ end
123
+ end
124
+ end
125
+ end
126
+
99
127
  describe Dap::Filter::FilterTransform do
100
128
  describe '.process' do
101
129
 
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: 0.1.2
4
+ version: 0.1.3
5
5
  platform: ruby
6
6
  authors:
7
7
  - Rapid7 Research
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2017-03-28 00:00:00.000000000 Z
11
+ date: 2017-03-29 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: rspec