recog 1.0.16 → 1.0.17
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/.travis.yml +6 -4
- data/CONTRIBUTING.md +10 -10
- data/Gemfile +1 -0
- data/README.md +11 -7
- data/Rakefile +2 -2
- data/features/support/env.rb +1 -0
- data/lib/recog/fingerprint/regexp_factory.rb +16 -1
- data/lib/recog/version.rb +1 -1
- data/spec/lib/fingerprint_self_test_spec.rb +1 -1
- data/spec/lib/recog/fingerprint/regexp_factory.rb +8 -3
- data/xml/http_cookies.xml +38 -1
- data/xml/http_servers.xml +13 -0
- data/xml/http_wwwauth.xml +91 -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: ba7d8b2d9765280fc41fea934102dbff6bff69b6
|
4
|
+
data.tar.gz: d86c1221b484f17a0d826de292648b6bf5737381
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 56446fa6f827bdcf28976878dc4697333da0eb48be67884c875a8b848b6e0d44e429e675becb3a2e9556338bf9ab9af674d38dea77603f8f399a1be05adb4446
|
7
|
+
data.tar.gz: 7c1e4e4751dfbf8b8082aa9928340be690f98f3cdbf1141bd5570c3a35b57a2142dc64b604a35726f9443e520c4d53e27080fa4b07891c52d7cac59aa80356b7
|
data/.travis.yml
CHANGED
@@ -4,7 +4,9 @@ rvm:
|
|
4
4
|
- 2.1.5
|
5
5
|
- 1.9.3
|
6
6
|
- jruby
|
7
|
-
|
8
|
-
|
9
|
-
|
10
|
-
|
7
|
+
before_install:
|
8
|
+
- "echo 'gem: --no-ri --no-rdoc' > ~/.gemrc"
|
9
|
+
- rake --version
|
10
|
+
before_script:
|
11
|
+
- bundle exec rake --version
|
12
|
+
script: bundle exec rake tests
|
data/CONTRIBUTING.md
CHANGED
@@ -100,23 +100,23 @@ In short:
|
|
100
100
|
|
101
101
|
```
|
102
102
|
git checkout -b upstream-master --track upstream/master
|
103
|
-
git merge -S --no-ff --edit landing-PR
|
103
|
+
git merge -S --no-ff --edit landing-PR # merge the PR into upstream-master
|
104
|
+
# re-test if/as necessary
|
104
105
|
git push upstream upstream-master:master --dry-run # confirm you are pushing what you expect
|
105
|
-
git push upstream upstream-master:master
|
106
|
+
git push upstream upstream-master:master # push upstream-master to upstream:master
|
106
107
|
```
|
108
|
+
6. If applicable, release a new version (see next section)
|
107
109
|
|
108
110
|
## Releasing New Versions
|
109
111
|
|
110
|
-
When Recog's critical parts are modified, for example its fingerprints or
|
111
|
-
underlying supporting code, a new version should eventually be released. These
|
112
|
-
new releases can then be optionally included in projects such as Metasploit or
|
113
|
-
products such as Rapid7's in a controlled manner.
|
112
|
+
When Recog's critical parts are modified, for example its fingerprints or underlying supporting code, a new version _must_ eventually be released. These new releases can then be optionally included in projects such as Metasploit or products such as Rapid7's Nexpose in a controlled manner. Releases for non-functional updates such as updates to documentation are not necessary.
|
114
113
|
|
115
|
-
|
116
|
-
the Gem and the Github release, described below. Eventually this process may
|
117
|
-
change.
|
114
|
+
When a new version of Recog is released, you _must_ do so in two different places:
|
118
115
|
|
119
|
-
|
116
|
+
* Gem -- for systems that use Gemspec or similar tools to control what version of Recog to include
|
117
|
+
* Github -- for systems that use Git tags to control what version of Recog to include
|
118
|
+
|
119
|
+
### Gem Release
|
120
120
|
|
121
121
|
1. Get an account on [Rubygems](https://rubygems.org)
|
122
122
|
2. Contact one of the Recog project contributors (listed [here under OWNERS](https://rubygems.org/gems/recog) and have them add you to the Recog gem. They'll need to run:
|
data/Gemfile
CHANGED
data/README.md
CHANGED
@@ -30,7 +30,7 @@ A fingerprint file consists of an XML document like the following:
|
|
30
30
|
04:
|
31
31
|
05: <fingerprint pattern="^RomSShell_([\d\.]+)$">
|
32
32
|
06: <description>Allegro RomSShell SSH</description>
|
33
|
-
07: <example>RomSShell_4.62</example>
|
33
|
+
07: <example service.version="4.62">RomSShell_4.62</example>
|
34
34
|
08: <param pos="0" name="service.vendor" value="Allegro"/>
|
35
35
|
09: <param pos="0" name="service.product" value="RomSShell"/>
|
36
36
|
10: <param pos="1" name="service.version"/>
|
@@ -38,17 +38,21 @@ A fingerprint file consists of an XML document like the following:
|
|
38
38
|
12:
|
39
39
|
13: </fingerprints>
|
40
40
|
|
41
|
-
The first line should always consist of the XML version declaration. The first element should always be a
|
41
|
+
The first line should always consist of the XML version declaration. The first element should always be a `fingerpints` block with a `matches` attribute indicating what data this fingerprint file is supposed to match. The `matches` attribute is normally in the form of `protocol.field`.
|
42
42
|
|
43
|
-
Inside of the
|
43
|
+
Inside of the `fingerprints` element there should be one or more `fingerprint` elements. Every `fingerprint` must contain a `pattern` attribute, which contains the regular expression to be used to match against the data. An optional `flags` attribute can be specified to control how the regular expression is to be interpreted. See [the Recog documentation for `FLAG_MAP`](http://www.rubydoc.info/gems/recog/Recog/Fingerprint/RegexpFactory#FLAG_MAP-constant) for more information.
|
44
44
|
|
45
|
-
Inside of the fingerprint, a
|
45
|
+
Inside of the fingerprint, a `description` element should contain a human-readable string describing this fingerprint.
|
46
46
|
|
47
|
-
|
47
|
+
At least one `example` element should be present, however multiple `example` elements are preferred. These elements are used as part of the test coverage present in rspec which validates that the provided data matches the specified regular expression. Additionally, if the fingerprint is using the `param` elements to extract field values from the data (described next), you can add these expected extractions as attributes for the `example` elements. In the example above, this:
|
48
48
|
|
49
|
-
|
49
|
+
07: <example service.version="4.62">RomSShell_4.62</example>
|
50
50
|
|
51
|
-
|
51
|
+
tests that `RomSShell_4.62` matches the provided regular expression and that the value of `service.version` is 4.62.
|
52
|
+
|
53
|
+
The `param` elements contain a `pos` attribute, which indicates what capture field from the `pattern` should be extracted, or `0` for a static string. The `name` attribute is the key that will be reported in the case of a successful match and the `value` will either be a static string for `pos` values of `0` or missing and taken from the captured field.
|
54
|
+
|
55
|
+
Once a fingerprint has been added, the `example` entries can be tested by executing `bin/recog_verify` against the fingerprint file:
|
52
56
|
|
53
57
|
$ bin/recog_verify xml/ssh_banners.xml
|
54
58
|
|
data/Rakefile
CHANGED
data/features/support/env.rb
CHANGED
@@ -9,11 +9,22 @@ module Recog
|
|
9
9
|
#
|
10
10
|
module RegexpFactory
|
11
11
|
|
12
|
-
#
|
12
|
+
# Currently, only options relating to case insensitivity and
|
13
|
+
# multiline/newline are supported. Because Recog's data is used by tools
|
14
|
+
# written in different languages like Ruby and Java, we currently support
|
15
|
+
# specifying them in a variety of ways. This map controls how they can
|
16
|
+
# be specified.
|
17
|
+
#
|
18
|
+
# TODO: consider supporting only a simpler variant and require that tools
|
19
|
+
# that use Recog data translate accordingly
|
13
20
|
FLAG_MAP = {
|
21
|
+
# multiline variations
|
14
22
|
'REG_DOT_NEWLINE' => Regexp::MULTILINE,
|
15
23
|
'REG_LINE_ANY_CRLF' => Regexp::MULTILINE,
|
24
|
+
'MULTILINE' => Regexp::MULTILINE,
|
25
|
+
# case variations
|
16
26
|
'REG_ICASE' => Regexp::IGNORECASE,
|
27
|
+
'IGNORECASE' => Regexp::IGNORECASE
|
17
28
|
}
|
18
29
|
|
19
30
|
# @return [Regexp]
|
@@ -29,6 +40,10 @@ module Recog
|
|
29
40
|
# @param flags [Array<String>]
|
30
41
|
# @return [Fixnum] Flags for creating a regular expression object
|
31
42
|
def self.build_options(flags)
|
43
|
+
unsupported_flags = flags.select { |flag| !FLAG_MAP.key?(flag) }
|
44
|
+
unless unsupported_flags.empty?
|
45
|
+
fail "Unsupported regular expression flags found: #{unsupported_flags.join(',')}. Must be one of: #{FLAG_MAP.keys.join(',')}"
|
46
|
+
end
|
32
47
|
flags.reduce(Regexp::NOENCODING) do |sum, flag|
|
33
48
|
sum |= (FLAG_MAP[flag] || 0)
|
34
49
|
end
|
data/lib/recog/version.rb
CHANGED
@@ -30,7 +30,7 @@ describe Recog::DB do
|
|
30
30
|
|
31
31
|
it 'uses capturing regular expressions properly' do
|
32
32
|
# the list of index-based captures that the fingerprint is expecting
|
33
|
-
expected_capture_positions = fp.params.values.map(&:first).map(&:to_i).select { |
|
33
|
+
expected_capture_positions = fp.params.values.map(&:first).map(&:to_i).select { |position| position > 0 }
|
34
34
|
if fp.params.empty? && expected_capture_positions.size > 0
|
35
35
|
fail "Non-asserting fingerprint with regex #{fp.regex} captures #{expected_capture_positions.size} time(s); 0 are needed"
|
36
36
|
else
|
@@ -6,8 +6,8 @@ describe Recog::Fingerprint::RegexpFactory do
|
|
6
6
|
describe 'FLAG_MAP' do
|
7
7
|
subject { described_class::FLAG_MAP }
|
8
8
|
|
9
|
-
it "should have
|
10
|
-
expect(subject.size).to be
|
9
|
+
it "should have the right number of flags" do
|
10
|
+
expect(subject.size).to be 5
|
11
11
|
end
|
12
12
|
end
|
13
13
|
|
@@ -56,6 +56,11 @@ describe Recog::Fingerprint::RegexpFactory do
|
|
56
56
|
end
|
57
57
|
end
|
58
58
|
|
59
|
+
context 'with invalid flags' do
|
60
|
+
let(:flags) { %w(SYN ACK FIN) } # oh, wrong flags!
|
61
|
+
specify 'raises and lists supported/unsupported flags' do
|
62
|
+
expect { subject }.to raise_error(/SYN,ACK,FIN. Must be one of: .+/)
|
63
|
+
end
|
64
|
+
end
|
59
65
|
end
|
60
66
|
end
|
61
|
-
|
data/xml/http_cookies.xml
CHANGED
@@ -375,5 +375,42 @@ servers.
|
|
375
375
|
<param pos="0" name="service.vendor" value="Oracle"/>
|
376
376
|
<param pos="0" name="service.family" value="OracleAS"/>
|
377
377
|
<param pos="0" name="service.product" value="OracleAS Portal"/>
|
378
|
-
|
378
|
+
</fingerprint>
|
379
|
+
|
380
|
+
<fingerprint pattern="^Compaq-HMMD=[^;]+;.*$">
|
381
|
+
<description>HP System Management Homepage (SMH)</description>
|
382
|
+
<example>Compaq-HMMD=0001-c01fffff-487a-394a-aab0-ffffffffffff-ffffffffffffffff; path=/</example>
|
383
|
+
<example>Compaq-HMMD=0001-c01fffff-487a-394a-aab0-ffffffffffff-ffffffffffffffff; path=/; Secure</example>
|
384
|
+
<param pos="0" name="service.vendor" value="HP"/>
|
385
|
+
<param pos="0" name="service.family" value="SMH"/>
|
386
|
+
<param pos="0" name="service.product" value="SMH"/>
|
387
|
+
</fingerprint>
|
388
|
+
|
389
|
+
<!--
|
390
|
+
Ignore various cookies that are very generic cookies for session IDs
|
391
|
+
that are not necessarily indicative of any particular
|
392
|
+
product/device/etc. If a future fingerprint comes along that utilizes
|
393
|
+
a similar cookie name, you must ensure that it is located prior to
|
394
|
+
these and this is enforced by rspec.
|
395
|
+
-->
|
396
|
+
|
397
|
+
<fingerprint pattern="^JSESSIONID(?:\.[^=]+)?=[^;]+;.*$" flags="REG_ICASE">
|
398
|
+
<description>Ignore simple JSESSIONID and related cookies</description>
|
399
|
+
<example>JSESSIONID=6ooov35i4l3n36qtaf8csvg0;Path=/</example>
|
400
|
+
<example>jsessionid=6nkp66iogcdc92720%2Dc6e4%2D4989%2Db7b2%2D5021624cfdff;Path=/;secure</example>
|
401
|
+
<example>JSESSIONID.c00a9623=v216643eijh19p9duve5srgf;Path=/;HttpOnly</example>
|
402
|
+
</fingerprint>
|
403
|
+
|
404
|
+
<fingerprint pattern="^_?SESSION_?ID\s*=\s*[^;]+;.*$" flags="REG_ICASE">
|
405
|
+
<description>Ignore simple SESSIONID and related cookies</description>
|
406
|
+
<example>sessionId=7dba3249cfcd4b59854055311099a294; path=/;</example>
|
407
|
+
<example>_session_id=7fe933db0fea13e9c872103ba2d142db; path=/; HttpOnly</example>
|
408
|
+
<example>sessionId =0VrS6Ro6uC5QPXKgNdqGvyUgUFtUOVwv6OWAEWcWQ3jLRtAk2TVAgAApN9yTWVz;postId=; path=/;</example>
|
409
|
+
<example>_session_id=18b3e173aa11db0533fd01752e81f583; path=/; HttpOnly</example>
|
410
|
+
</fingerprint>
|
411
|
+
|
412
|
+
<fingerprint pattern="^sid=[^;]+;.*$" flags="REG_ICASE">
|
413
|
+
<description>Ignore simple SID and related cookies</description>
|
414
|
+
<example>sid=sfd10bf73-654458f687aa3c68b3874915f651e0ca;path=/;"</example>
|
415
|
+
</fingerprint>
|
379
416
|
</fingerprints>
|
data/xml/http_servers.xml
CHANGED
@@ -1876,6 +1876,19 @@
|
|
1876
1876
|
<param pos="1" name="service.version"/>
|
1877
1877
|
</fingerprint>
|
1878
1878
|
|
1879
|
+
<fingerprint pattern="^eHTTP[/ ]v?(\d+\.\d+)" flags="REG_ICASE">
|
1880
|
+
<example service.version="1.1">EHTTP/1.1</example>
|
1881
|
+
<example service.version="2.0">eHTTP v2.0</example>
|
1882
|
+
<description>HTTP Server present on seemingly only HP ProCurve network devices</description>
|
1883
|
+
<param pos="0" name="service.vendor" value="HP"/>
|
1884
|
+
<param pos="0" name="service.product" value="HTTP"/>
|
1885
|
+
<param pos="0" name="service.family" value="ProCurve"/>
|
1886
|
+
<param pos="1" name="service.version"/>
|
1887
|
+
<param pos="0" name="os.vendor" value="HP"/>
|
1888
|
+
<param pos="0" name="os.family" value="ProCurve"/>
|
1889
|
+
<param pos="0" name="os.certainty" value="0.75"/>
|
1890
|
+
</fingerprint>
|
1891
|
+
|
1879
1892
|
<fingerprint pattern = "^com.hp.openview.Coda (\d\.\d.\d)$">
|
1880
1893
|
<description>HP Openview Coda</description>
|
1881
1894
|
<example>com.hp.openview.Coda 0.0.1</example>
|
data/xml/http_wwwauth.xml
CHANGED
@@ -302,8 +302,99 @@
|
|
302
302
|
<param pos="0" name="os.vendor" value="TP-LINK"/>
|
303
303
|
<param pos="0" name="os.device" value="WAP"/>
|
304
304
|
<param pos="1" name="os.product"/>
|
305
|
+
</fingerprint>
|
306
|
+
|
307
|
+
<fingerprint pattern="^(?:Basic|Digest) .*realm="Broadcom Management Service".*$" flags="REG_ICASE">
|
308
|
+
<description>Supposedly part of Broadcom Advanced Control Suite 3 (BACS3) or something similar</description>
|
309
|
+
<example>Digest qop="auth", realm="Broadcom Management Service", nonce="AAAAAAAAAAAAAP//DwHpMwYy1zc=", algorithm="MD5"</example>
|
310
|
+
<param pos="0" name="service.vendor" value="Broadcom"/>
|
311
|
+
<param pos="0" name="service.product" value="Management Service"/>
|
312
|
+
</fingerprint>
|
313
|
+
|
314
|
+
<fingerprint pattern="^(?:Basic|Digest) .*realm="SWAT".*$">
|
315
|
+
<description>Samba Web Administration Tool (SWAT)</description>
|
316
|
+
<example>Basic realm="SWAT"</example>
|
317
|
+
<param pos="0" name="service.vendor" value="Samba"/>
|
318
|
+
<param pos="0" name="service.family" value="Samba"/>
|
319
|
+
<param pos="0" name="service.product" value="SWAT"/>
|
320
|
+
</fingerprint>
|
321
|
+
|
322
|
+
<fingerprint pattern="^.*(?:Basic|Digest) realm="SPIP Configuration".*$">
|
323
|
+
<description>SPIP publishing system (www.spip.net)</description>
|
324
|
+
<example>Basic realm="SPIP Configuration", Digest realm="SPIP Configuration", nonce="116761147", algorithm="MD5"</example>
|
325
|
+
<param pos="0" name="service.vendor" value="SPIP"/>
|
326
|
+
<param pos="0" name="service.product" value="SPIP"/>
|
327
|
+
</fingerprint>
|
328
|
+
|
329
|
+
<fingerprint pattern="^.*(?:Basic|Digest) .*realm="HP ISEE @ ([^"]+)".*$">
|
330
|
+
<description>HP Instant Support Enterprise Edition with a hostname</description>
|
331
|
+
<example host.name="blah">Basic realm="HP ISEE @ blah"</example>
|
332
|
+
<param pos="0" name="service.vendor" value="HP"/>
|
333
|
+
<param pos="0" name="service.product" value="ISEE"/>
|
334
|
+
<param pos="1" name="host.name"/>
|
335
|
+
</fingerprint>
|
336
|
+
|
337
|
+
<fingerprint pattern="^.*(?:Basic|Digest) .*realm="BIG-IP".*$">
|
338
|
+
<description>Generic F5 Big-IP</description>
|
339
|
+
<example>Basic realm="BIG-IP"</example>
|
340
|
+
<param pos="0" name="os.vendor" value="F5"/>
|
341
|
+
<param pos="0" name="os.product" value="BIG-IP"/>
|
342
|
+
</fingerprint>
|
343
|
+
|
344
|
+
<!-- HP ProCurve -->
|
345
|
+
|
346
|
+
<fingerprint pattern="^(?:Basic|Digest) realm="(?:HP|ProCurve) (J[3]\d{3}A)"$" flags="REG_ICASE">
|
347
|
+
<description>HP ProCurve Hubs</description>
|
348
|
+
<example os.product="J3295A">Basic realm="HP J3295A"</example>
|
349
|
+
<param pos="0" name="os.vendor" value="HP"/>
|
350
|
+
<param pos="0" name="os.family" value="ProCurve"/>
|
351
|
+
<param pos="0" name="os.device" value="Hub"/>
|
352
|
+
<param pos="1" name="os.product"/>
|
353
|
+
</fingerprint>
|
354
|
+
|
355
|
+
<fingerprint pattern="^(?:Basic|Digest) realm="(?:HP|ProCurve) (J[489]\d{3}A)"$" flags="REG_ICASE">
|
356
|
+
<description>HP ProCurve Switches</description>
|
357
|
+
<example os.product="J4110A">Basic realm="HP J4110A"</example>
|
358
|
+
<example os.product="J8164A">Basic realm="ProCurve J8164A"</example>
|
359
|
+
<example os.product="J8165A">Basic realm="HP J8165A"</example>
|
360
|
+
<example os.product="J9021A">Basic realm="HP J9021A"</example>
|
361
|
+
<param pos="0" name="os.vendor" value="HP"/>
|
362
|
+
<param pos="0" name="os.family" value="ProCurve"/>
|
363
|
+
<param pos="0" name="os.device" value="Switch"/>
|
364
|
+
<param pos="1" name="os.product"/>
|
305
365
|
</fingerprint>
|
306
366
|
|
367
|
+
<!-- a variety of headers we currently just ignore -->
|
368
|
+
|
369
|
+
<fingerprint pattern="^NTLM$" flags="REG_ICASE">
|
370
|
+
<example>NTLM</example>
|
371
|
+
<example>Ntlm</example>
|
372
|
+
<description>Ignore NTLM-only</description>
|
373
|
+
</fingerprint>
|
374
|
+
|
375
|
+
<fingerprint pattern="^Negotiate$">
|
376
|
+
<description>Ignore Negotiate-only</description>
|
377
|
+
<example>Negotiate</example>
|
378
|
+
</fingerprint>
|
379
|
+
|
380
|
+
<fingerprint pattern="^(?:Basic|Digest) .*realm="null"">
|
381
|
+
<description>Ignore null</description>
|
382
|
+
<example>Basic realm="null"</example>
|
383
|
+
</fingerprint>
|
384
|
+
|
385
|
+
<fingerprint pattern="^(?:Basic|Digest) .*realm="(?:(?:25[0-5]|2[0-4][0-9]|[01]?[0-9][0-9]?)\.){3}(?:25[0-5]|2[0-4][0-9]|[01]?[0-9][0-9]?)".*$">
|
386
|
+
<description>Ignore realms with an IPv4 address</description>
|
387
|
+
<example>Basic realm="192.168.0.1"</example>
|
388
|
+
<example>Digest qop="auth", realm="172.16.0.1", nonce="AAAAAAAAAAAAAP//DwHpM0IvM78=", algorithm="MD5"</example>
|
389
|
+
</fingerprint>
|
390
|
+
|
391
|
+
<fingerprint pattern="^(?:Basic|Digest) .*realm="config".*$">
|
392
|
+
<description>Ignore generic 'config' realms</description>
|
393
|
+
<example>Digest realm="config", nonce="1155041914", algorithm="MD5", qop="auth"</example>
|
394
|
+
</fingerprint>
|
395
|
+
|
396
|
+
|
397
|
+
|
307
398
|
<!--
|
308
399
|
Temporarily disable this version-less fingerprint because it overrode the
|
309
400
|
one in http_servers.xml (see NEX-1255).
|
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.
|
4
|
+
version: 1.0.17
|
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-02-
|
11
|
+
date: 2015-02-19 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: rspec
|