recog 1.0.8 → 1.0.9

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: 25ed93ab984d93aa284e7a17dfe96cd4395913e5
4
- data.tar.gz: 7f5caf500b3646ac3f180c5cc55c72cab6b5aa26
3
+ metadata.gz: a661719e8af83d9afd786f25510ec87d01c96fd9
4
+ data.tar.gz: b70ff39d8f3daa85bc150ee9f16320b4367bf14b
5
5
  SHA512:
6
- metadata.gz: 00951a92a9893f2d58f0bc0dd9566ff45a5c58f5b9a024f31bb80e707073bec5f2709ca973f87259e30834834b0f6feb53cd06a3d3f85450b65529df3baf44bf
7
- data.tar.gz: cc48bdd99a6d8c263ae93ca2552ea34e3725d7f07c04aad2c64f8d74c47b602448dbeb625132d64e464d295b98a4913b03632a461db0de5515cda11b6f739f15
6
+ metadata.gz: a9b2be07b4ed3ed0f589421e3fc6292b892eb930ee37f7f5d5f2cf86fbed0077ce863a9d08717155f9464e2242bbe1885e4db4f0d4a8d2b635224e08c94eb576
7
+ data.tar.gz: 170977c3716f1a3d4e4f90c5b08d484e762cbc281fdef8d0a66d01f76506b927d34fb3cc3617e88de92e9cf966563107c5f632671c4e1197e3634ee289c07c08
@@ -128,7 +128,7 @@ class Fingerprint
128
128
  # @return [String] Contents of the source XML's `description` tag
129
129
  def parse_description(xml)
130
130
  element = xml.xpath('description')
131
- element.empty? ? '' : element.first.content.gsub(/[\r\n]+/, ' ').gsub(/\s{3,}/, ' ').strip
131
+ element.empty? ? '' : element.first.content.to_s.gsub(/\s+/, ' ').strip
132
132
  end
133
133
 
134
134
  # @param xml [Nokogiri::XML::Element]
data/lib/recog/version.rb CHANGED
@@ -1,3 +1,3 @@
1
1
  module Recog
2
- VERSION = '1.0.8'
2
+ VERSION = '1.0.9'
3
3
  end
@@ -0,0 +1,5 @@
1
+ <fingerprint pattern=".*this doesn't matter.*">
2
+ <description> I love
3
+ whitespace!
4
+ </description>
5
+ </fingerprint>
@@ -1,5 +1,17 @@
1
+ require 'nokogiri'
1
2
  require 'recog/fingerprint'
2
3
 
3
4
  describe Recog::Fingerprint do
5
+ let(:xml) do
6
+ path = File.expand_path(File.join('spec', 'data', 'whitespaced_fingerprint.xml'))
7
+ doc = Nokogiri::XML(IO.read(path))
8
+ doc.xpath("//fingerprint").first
9
+ end
10
+ subject { Recog::Fingerprint.new(xml) }
4
11
 
12
+ describe "#name" do
13
+ it "properly squashes whitespace" do
14
+ expect(subject.name).to eq('I love whitespace!')
15
+ end
16
+ end
5
17
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: recog
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.0.8
4
+ version: 1.0.9
5
5
  platform: ruby
6
6
  authors:
7
7
  - Rapid7 Research
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2015-01-08 00:00:00.000000000 Z
11
+ date: 2015-01-16 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: rspec
@@ -164,6 +164,7 @@ files:
164
164
  - spec/data/best_service_match_1.yml
165
165
  - spec/data/smb_native_os.txt
166
166
  - spec/data/test_fingerprints.xml
167
+ - spec/data/whitespaced_fingerprint.xml
167
168
  - spec/lib/fingerprint_self_test_spec.rb
168
169
  - spec/lib/recog/db_spec.rb
169
170
  - spec/lib/recog/fingerprint/regexp_factory.rb