recog-intrigue 2.3.7
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +7 -0
- data/.github/ISSUE_TEMPLATE/bug_report.md +37 -0
- data/.github/ISSUE_TEMPLATE/feature_request.md +17 -0
- data/.github/ISSUE_TEMPLATE/fingerprint_request.md +27 -0
- data/.github/PULL_REQUEST_TEMPLATE +24 -0
- data/.gitignore +14 -0
- data/.rbenv-gemset +1 -0
- data/.rspec +3 -0
- data/.ruby-gemset +1 -0
- data/.ruby-version +1 -0
- data/.travis.yml +25 -0
- data/.yardopts +1 -0
- data/CONTRIBUTING.md +171 -0
- data/COPYING +23 -0
- data/Gemfile +10 -0
- data/LICENSE +7 -0
- data/README.md +85 -0
- data/Rakefile +22 -0
- data/bin/recog_export +81 -0
- data/bin/recog_match +55 -0
- data/bin/recog_standardize +118 -0
- data/bin/recog_verify +64 -0
- data/cpe-remap.yaml +134 -0
- data/features/data/failing_banners_fingerprints.xml +20 -0
- data/features/data/matching_banners_fingerprints.xml +23 -0
- data/features/data/multiple_banners_fingerprints.xml +32 -0
- data/features/data/no_tests.xml +3 -0
- data/features/data/sample_banner.txt +2 -0
- data/features/data/successful_tests.xml +18 -0
- data/features/data/tests_with_failures.xml +20 -0
- data/features/data/tests_with_warnings.xml +17 -0
- data/features/match.feature +36 -0
- data/features/support/aruba.rb +3 -0
- data/features/support/env.rb +6 -0
- data/features/verify.feature +48 -0
- data/identifiers/README.md +47 -0
- data/identifiers/os_architecture.txt +20 -0
- data/identifiers/os_device.txt +52 -0
- data/identifiers/os_family.txt +160 -0
- data/identifiers/os_product.txt +199 -0
- data/identifiers/service_family.txt +185 -0
- data/identifiers/service_product.txt +255 -0
- data/identifiers/software_class.txt +26 -0
- data/identifiers/software_family.txt +91 -0
- data/identifiers/software_product.txt +333 -0
- data/identifiers/vendor.txt +405 -0
- data/lib/recog.rb +4 -0
- data/lib/recog/db.rb +78 -0
- data/lib/recog/db_manager.rb +31 -0
- data/lib/recog/fingerprint.rb +280 -0
- data/lib/recog/fingerprint/regexp_factory.rb +56 -0
- data/lib/recog/fingerprint/test.rb +18 -0
- data/lib/recog/formatter.rb +51 -0
- data/lib/recog/match_reporter.rb +77 -0
- data/lib/recog/matcher.rb +94 -0
- data/lib/recog/matcher_factory.rb +14 -0
- data/lib/recog/nizer.rb +347 -0
- data/lib/recog/verifier.rb +39 -0
- data/lib/recog/verifier_factory.rb +13 -0
- data/lib/recog/verify_reporter.rb +86 -0
- data/lib/recog/version.rb +3 -0
- data/misc/convert_mysql_err +61 -0
- data/misc/order.xsl +17 -0
- data/recog-intrigue.gemspec +45 -0
- data/requirements.txt +2 -0
- data/spec/data/best_os_match_1.yml +17 -0
- data/spec/data/best_os_match_2.yml +17 -0
- data/spec/data/best_service_match_1.yml +17 -0
- data/spec/data/smb_native_os.txt +25 -0
- data/spec/data/test_fingerprints.xml +36 -0
- data/spec/data/verification_fingerprints.xml +86 -0
- data/spec/data/whitespaced_fingerprint.xml +5 -0
- data/spec/lib/fingerprint_self_test_spec.rb +174 -0
- data/spec/lib/recog/db_spec.rb +98 -0
- data/spec/lib/recog/fingerprint/regexp_factory_spec.rb +73 -0
- data/spec/lib/recog/fingerprint_spec.rb +112 -0
- data/spec/lib/recog/formatter_spec.rb +69 -0
- data/spec/lib/recog/match_reporter_spec.rb +91 -0
- data/spec/lib/recog/nizer_spec.rb +330 -0
- data/spec/lib/recog/verify_reporter_spec.rb +113 -0
- data/spec/spec_helper.rb +82 -0
- data/update_cpes.py +186 -0
- data/xml/apache_modules.xml +1911 -0
- data/xml/apache_os.xml +273 -0
- data/xml/architecture.xml +36 -0
- data/xml/dns_versionbind.xml +761 -0
- data/xml/fingerprints.xsd +128 -0
- data/xml/ftp_banners.xml +1553 -0
- data/xml/h323_callresp.xml +603 -0
- data/xml/hp_pjl_id.xml +358 -0
- data/xml/html_title.xml +1630 -0
- data/xml/http_cookies.xml +411 -0
- data/xml/http_servers.xml +3195 -0
- data/xml/http_wwwauth.xml +595 -0
- data/xml/imap_banners.xml +245 -0
- data/xml/ldap_searchresult.xml +711 -0
- data/xml/mdns_device-info_txt.xml +1796 -0
- data/xml/mdns_workstation_txt.xml +15 -0
- data/xml/mysql_banners.xml +1649 -0
- data/xml/mysql_error.xml +871 -0
- data/xml/nntp_banners.xml +82 -0
- data/xml/ntp_banners.xml +1223 -0
- data/xml/operating_system.xml +629 -0
- data/xml/pop_banners.xml +499 -0
- data/xml/rsh_resp.xml +76 -0
- data/xml/rtsp_servers.xml +76 -0
- data/xml/sip_banners.xml +359 -0
- data/xml/sip_user_agents.xml +221 -0
- data/xml/smb_native_lm.xml +62 -0
- data/xml/smb_native_os.xml +662 -0
- data/xml/smtp_banners.xml +1690 -0
- data/xml/smtp_debug.xml +39 -0
- data/xml/smtp_ehlo.xml +49 -0
- data/xml/smtp_expn.xml +82 -0
- data/xml/smtp_help.xml +157 -0
- data/xml/smtp_mailfrom.xml +20 -0
- data/xml/smtp_noop.xml +44 -0
- data/xml/smtp_quit.xml +29 -0
- data/xml/smtp_rcptto.xml +25 -0
- data/xml/smtp_rset.xml +26 -0
- data/xml/smtp_turn.xml +26 -0
- data/xml/smtp_vrfy.xml +89 -0
- data/xml/snmp_sysdescr.xml +6507 -0
- data/xml/snmp_sysobjid.xml +430 -0
- data/xml/ssh_banners.xml +1968 -0
- data/xml/telnet_banners.xml +1595 -0
- data/xml/x11_banners.xml +232 -0
- data/xml/x509_issuers.xml +134 -0
- data/xml/x509_subjects.xml +1268 -0
- metadata +304 -0
|
@@ -0,0 +1,405 @@
|
|
|
1
|
+
2Wire
|
|
2
|
+
3Com
|
|
3
|
+
4D
|
|
4
|
+
ACC
|
|
5
|
+
ACME Laboratories
|
|
6
|
+
Acorn
|
|
7
|
+
Actiontec
|
|
8
|
+
ActiveState
|
|
9
|
+
Adaptec
|
|
10
|
+
ADC
|
|
11
|
+
Adobe
|
|
12
|
+
Adtran
|
|
13
|
+
AIM
|
|
14
|
+
Aironet
|
|
15
|
+
Alcatel
|
|
16
|
+
Allegro Software
|
|
17
|
+
Allied Telesyn
|
|
18
|
+
Alpha Micro
|
|
19
|
+
Alpine
|
|
20
|
+
Alteon
|
|
21
|
+
Alt-N
|
|
22
|
+
Amazon
|
|
23
|
+
AMD
|
|
24
|
+
Amiga
|
|
25
|
+
AnalogX
|
|
26
|
+
Apache
|
|
27
|
+
APC
|
|
28
|
+
Apollo
|
|
29
|
+
Apple
|
|
30
|
+
Aprelium Technologies
|
|
31
|
+
Arescom
|
|
32
|
+
ArGoSoft
|
|
33
|
+
Arlan
|
|
34
|
+
ARM
|
|
35
|
+
ARRIS
|
|
36
|
+
Artifex Software Inc.
|
|
37
|
+
Asante
|
|
38
|
+
Ascend
|
|
39
|
+
Ascom
|
|
40
|
+
Asianux
|
|
41
|
+
Atari
|
|
42
|
+
ATG
|
|
43
|
+
AtheOS
|
|
44
|
+
Atrium Software
|
|
45
|
+
Attachmate
|
|
46
|
+
Auspex
|
|
47
|
+
Avaya
|
|
48
|
+
Avocent
|
|
49
|
+
Axent
|
|
50
|
+
Axis
|
|
51
|
+
Bay Networks
|
|
52
|
+
Be
|
|
53
|
+
BEA
|
|
54
|
+
Bell Labs
|
|
55
|
+
Bintec
|
|
56
|
+
Bitvise
|
|
57
|
+
Blue Coat
|
|
58
|
+
Borderware
|
|
59
|
+
Brix Networks
|
|
60
|
+
Brocade
|
|
61
|
+
Brother
|
|
62
|
+
BSDi
|
|
63
|
+
BT
|
|
64
|
+
Buffalo
|
|
65
|
+
Business Objects
|
|
66
|
+
Cabletron
|
|
67
|
+
Cacheflow
|
|
68
|
+
Canon
|
|
69
|
+
Canonical
|
|
70
|
+
Cantillion
|
|
71
|
+
Capellix
|
|
72
|
+
Castelle
|
|
73
|
+
CastleNet
|
|
74
|
+
Caucho
|
|
75
|
+
Cayman
|
|
76
|
+
CentOS
|
|
77
|
+
Chase
|
|
78
|
+
Check Point
|
|
79
|
+
CherryPy
|
|
80
|
+
Cisco
|
|
81
|
+
Citrix
|
|
82
|
+
Clearswift
|
|
83
|
+
CNET
|
|
84
|
+
CNT
|
|
85
|
+
Cobalt
|
|
86
|
+
Commodore
|
|
87
|
+
Compaq
|
|
88
|
+
Compatible Systems
|
|
89
|
+
Computer Associates
|
|
90
|
+
Computone
|
|
91
|
+
Conectiva
|
|
92
|
+
Conexant
|
|
93
|
+
Convex
|
|
94
|
+
Copper Mountain
|
|
95
|
+
Corega
|
|
96
|
+
Cray
|
|
97
|
+
Critical Path
|
|
98
|
+
CSM
|
|
99
|
+
CyberArk
|
|
100
|
+
CyberGuard
|
|
101
|
+
Cyclades
|
|
102
|
+
Data General
|
|
103
|
+
Datamax
|
|
104
|
+
DataVoice
|
|
105
|
+
Debian
|
|
106
|
+
DEC
|
|
107
|
+
Dell
|
|
108
|
+
Digital Link
|
|
109
|
+
Digital Networks
|
|
110
|
+
DigiTel
|
|
111
|
+
D-Link
|
|
112
|
+
Docker Inc.
|
|
113
|
+
DrayTek
|
|
114
|
+
EasyTel
|
|
115
|
+
Eaton
|
|
116
|
+
Edimax
|
|
117
|
+
Eicon
|
|
118
|
+
Ektron
|
|
119
|
+
ELSA
|
|
120
|
+
Embedthis
|
|
121
|
+
EMC
|
|
122
|
+
EMWAC
|
|
123
|
+
Enterasys
|
|
124
|
+
Epson
|
|
125
|
+
EqualLogic
|
|
126
|
+
Ericsson
|
|
127
|
+
Eudora
|
|
128
|
+
EUSSO
|
|
129
|
+
Exabyte
|
|
130
|
+
exim
|
|
131
|
+
ExtendNet
|
|
132
|
+
Extreme Networks
|
|
133
|
+
F5
|
|
134
|
+
FastComm
|
|
135
|
+
FatWire
|
|
136
|
+
FiberLine
|
|
137
|
+
Floosietek
|
|
138
|
+
FlowPoint
|
|
139
|
+
Fore
|
|
140
|
+
FortiNet
|
|
141
|
+
Foundry
|
|
142
|
+
Foxit Software Inc.
|
|
143
|
+
FreeBSD
|
|
144
|
+
FreeScale
|
|
145
|
+
FreeSCO
|
|
146
|
+
Fujitsu Siemens
|
|
147
|
+
GalactiComm
|
|
148
|
+
Gandalf
|
|
149
|
+
Gauntlet
|
|
150
|
+
Genius
|
|
151
|
+
Gentoo
|
|
152
|
+
Gigamon
|
|
153
|
+
Global Technology Associates
|
|
154
|
+
GlobalScape
|
|
155
|
+
GNet
|
|
156
|
+
GNU
|
|
157
|
+
Google
|
|
158
|
+
Gordano
|
|
159
|
+
Hawking
|
|
160
|
+
Hitachi
|
|
161
|
+
Hospira
|
|
162
|
+
HP
|
|
163
|
+
Huawei
|
|
164
|
+
Hydra
|
|
165
|
+
IBM
|
|
166
|
+
Imagistics
|
|
167
|
+
Innovaphone
|
|
168
|
+
Intel
|
|
169
|
+
Intergraph
|
|
170
|
+
IPCop
|
|
171
|
+
Ipswitch
|
|
172
|
+
Isolation
|
|
173
|
+
IXIA
|
|
174
|
+
Juniper
|
|
175
|
+
KA9Q
|
|
176
|
+
Kaspersky Lab
|
|
177
|
+
Kentrox
|
|
178
|
+
Kerio
|
|
179
|
+
Konica
|
|
180
|
+
Kronos
|
|
181
|
+
Kyocera
|
|
182
|
+
Labtam
|
|
183
|
+
LANCOM Systems
|
|
184
|
+
Lantronix
|
|
185
|
+
Leunig
|
|
186
|
+
Lexmark
|
|
187
|
+
LG Goldstream
|
|
188
|
+
Linksys
|
|
189
|
+
Linux
|
|
190
|
+
Linux Foundation
|
|
191
|
+
Livingston
|
|
192
|
+
LogMeIn
|
|
193
|
+
Lotus
|
|
194
|
+
Lucent
|
|
195
|
+
LWIP
|
|
196
|
+
Lyris
|
|
197
|
+
Macromedia
|
|
198
|
+
Madge
|
|
199
|
+
Magna
|
|
200
|
+
Mail-Max
|
|
201
|
+
Mandrake
|
|
202
|
+
Mandriva
|
|
203
|
+
Maxim IC
|
|
204
|
+
McAfee
|
|
205
|
+
Megabit
|
|
206
|
+
Merak
|
|
207
|
+
Meridian
|
|
208
|
+
MetaInfo
|
|
209
|
+
Microbase
|
|
210
|
+
Microplex
|
|
211
|
+
Microsoft
|
|
212
|
+
MikroTik
|
|
213
|
+
Minix
|
|
214
|
+
Minolta
|
|
215
|
+
Mirapoint
|
|
216
|
+
Mocana
|
|
217
|
+
Moodle
|
|
218
|
+
Mort Bay
|
|
219
|
+
Motorola
|
|
220
|
+
Mozilla
|
|
221
|
+
MRV Communications
|
|
222
|
+
MultiTech
|
|
223
|
+
MySQL
|
|
224
|
+
NAT
|
|
225
|
+
NCD
|
|
226
|
+
NcFTP Software
|
|
227
|
+
NCR
|
|
228
|
+
NEC
|
|
229
|
+
Neoware
|
|
230
|
+
NetApp
|
|
231
|
+
NetBSD
|
|
232
|
+
Netgear
|
|
233
|
+
NetJet
|
|
234
|
+
NetMatrix
|
|
235
|
+
Netopia
|
|
236
|
+
Netscape
|
|
237
|
+
NetScreen
|
|
238
|
+
NetSilicon
|
|
239
|
+
Network Systems
|
|
240
|
+
Nexland
|
|
241
|
+
NeXT
|
|
242
|
+
Nokia
|
|
243
|
+
Nortel
|
|
244
|
+
Norton
|
|
245
|
+
Novell
|
|
246
|
+
NSG
|
|
247
|
+
NTT
|
|
248
|
+
Oce
|
|
249
|
+
Okidata
|
|
250
|
+
Omron
|
|
251
|
+
OpenBSD
|
|
252
|
+
OpenJDK
|
|
253
|
+
OpenSUSE
|
|
254
|
+
Opera Software
|
|
255
|
+
Oracle
|
|
256
|
+
Overland
|
|
257
|
+
Oversee
|
|
258
|
+
ownCloud
|
|
259
|
+
Packet Engines
|
|
260
|
+
Packeteer
|
|
261
|
+
Palm
|
|
262
|
+
Palo Alto Networks
|
|
263
|
+
Panasonic
|
|
264
|
+
Paul Smith Computer Services
|
|
265
|
+
Philips
|
|
266
|
+
PHP
|
|
267
|
+
phpMyAdmin
|
|
268
|
+
Pigtail
|
|
269
|
+
Piriform
|
|
270
|
+
Pitney Bowes
|
|
271
|
+
Plain Black
|
|
272
|
+
Planet
|
|
273
|
+
PLD
|
|
274
|
+
Polycom
|
|
275
|
+
Postgres
|
|
276
|
+
PowerWare
|
|
277
|
+
Pragma Systems
|
|
278
|
+
PreEmptive Solutions
|
|
279
|
+
Process Software
|
|
280
|
+
Proteon
|
|
281
|
+
Proxim
|
|
282
|
+
qmail
|
|
283
|
+
QMS
|
|
284
|
+
QNX
|
|
285
|
+
Qualcomm
|
|
286
|
+
Quanterra
|
|
287
|
+
Quantum
|
|
288
|
+
Racal
|
|
289
|
+
Radionics
|
|
290
|
+
Rapid7
|
|
291
|
+
Raptor
|
|
292
|
+
Rarlab
|
|
293
|
+
RCA
|
|
294
|
+
RealMedia
|
|
295
|
+
Red Hat
|
|
296
|
+
Redback
|
|
297
|
+
Rhino Software
|
|
298
|
+
Ricoh
|
|
299
|
+
Ringdale
|
|
300
|
+
Riverbed Technology
|
|
301
|
+
Riverstone Networks
|
|
302
|
+
RoadLanner
|
|
303
|
+
Rockliffe
|
|
304
|
+
Rockwell
|
|
305
|
+
Roxen
|
|
306
|
+
rPath
|
|
307
|
+
SafeNet
|
|
308
|
+
SAP
|
|
309
|
+
SAR
|
|
310
|
+
Savin
|
|
311
|
+
SBLIM
|
|
312
|
+
Schneider Electric
|
|
313
|
+
SCO
|
|
314
|
+
Seattle Labs
|
|
315
|
+
Secure Computing
|
|
316
|
+
Sega
|
|
317
|
+
Sendmail
|
|
318
|
+
Sequent
|
|
319
|
+
SGI
|
|
320
|
+
Sharp
|
|
321
|
+
Shiva
|
|
322
|
+
Siebel
|
|
323
|
+
Siemens
|
|
324
|
+
Simon Tatham
|
|
325
|
+
Slackware
|
|
326
|
+
SMC
|
|
327
|
+
SmoothWall
|
|
328
|
+
SonicWALL
|
|
329
|
+
SonoSite
|
|
330
|
+
Sony
|
|
331
|
+
Sophos
|
|
332
|
+
Source Technologies
|
|
333
|
+
Sourcefire
|
|
334
|
+
SpeedStream
|
|
335
|
+
Sphera
|
|
336
|
+
SSH Communications Security
|
|
337
|
+
StackTools
|
|
338
|
+
Standard Networks
|
|
339
|
+
StartCom
|
|
340
|
+
Stratus
|
|
341
|
+
Sun
|
|
342
|
+
SUSE
|
|
343
|
+
Sybase
|
|
344
|
+
Symantec
|
|
345
|
+
Symbol
|
|
346
|
+
SysTech
|
|
347
|
+
Tahoe
|
|
348
|
+
Tally
|
|
349
|
+
Tandberg
|
|
350
|
+
Tandem
|
|
351
|
+
Tasman Networks
|
|
352
|
+
Tekelec
|
|
353
|
+
Tektonix
|
|
354
|
+
Telebit
|
|
355
|
+
Telindus
|
|
356
|
+
Telocity
|
|
357
|
+
Teltrend
|
|
358
|
+
Thomson
|
|
359
|
+
TIS
|
|
360
|
+
TOR
|
|
361
|
+
Toshiba
|
|
362
|
+
Trancell
|
|
363
|
+
Trend Micro
|
|
364
|
+
Truetime
|
|
365
|
+
Trustix
|
|
366
|
+
Turbolinux
|
|
367
|
+
Turtle Beach
|
|
368
|
+
Twisted Matrix Labs
|
|
369
|
+
TYPO3
|
|
370
|
+
Ubuntu
|
|
371
|
+
Unica
|
|
372
|
+
UnitedLinux
|
|
373
|
+
US Robotics
|
|
374
|
+
VanDyke Software
|
|
375
|
+
Vanguard
|
|
376
|
+
VersaNet
|
|
377
|
+
VideoLAN
|
|
378
|
+
Vignette
|
|
379
|
+
Vine
|
|
380
|
+
Vircom
|
|
381
|
+
Virtual Access
|
|
382
|
+
VMware
|
|
383
|
+
WatchGuard
|
|
384
|
+
Webmin
|
|
385
|
+
WebTrends
|
|
386
|
+
White Box
|
|
387
|
+
Wind River
|
|
388
|
+
Wireshark
|
|
389
|
+
Wordpress
|
|
390
|
+
WTI
|
|
391
|
+
XCD
|
|
392
|
+
Xerox
|
|
393
|
+
Xitami
|
|
394
|
+
XMach
|
|
395
|
+
XnSoft
|
|
396
|
+
Xylan
|
|
397
|
+
Xylogics
|
|
398
|
+
Xyplex
|
|
399
|
+
Yahoo
|
|
400
|
+
Yamaha
|
|
401
|
+
Zero One
|
|
402
|
+
ZMailer
|
|
403
|
+
Zoom
|
|
404
|
+
ZoomAir
|
|
405
|
+
Zyxel
|
data/lib/recog.rb
ADDED
data/lib/recog/db.rb
ADDED
|
@@ -0,0 +1,78 @@
|
|
|
1
|
+
module Recog
|
|
2
|
+
|
|
3
|
+
# A collection of {Fingerprint fingerprints} for matching against a particular
|
|
4
|
+
# kind of fingerprintable data, e.g. an HTTP `Server` header
|
|
5
|
+
class DB
|
|
6
|
+
require 'nokogiri'
|
|
7
|
+
require_relative 'fingerprint'
|
|
8
|
+
|
|
9
|
+
# @return [String]
|
|
10
|
+
attr_reader :path
|
|
11
|
+
|
|
12
|
+
# @return [Array<Fingerprint>] {Fingerprint} objects that can be matched
|
|
13
|
+
# against strings that make sense for the {#match_key}
|
|
14
|
+
attr_reader :fingerprints
|
|
15
|
+
|
|
16
|
+
# @return [String] Taken from the `fingerprints/matches` attribute, or
|
|
17
|
+
# defaults to the basename of {#path} without the `.xml` extension.
|
|
18
|
+
attr_reader :match_key
|
|
19
|
+
|
|
20
|
+
# @return [String] Taken from the `fingerprints/protocol` attribute, or
|
|
21
|
+
# defaults to an empty string
|
|
22
|
+
attr_reader :protocol
|
|
23
|
+
|
|
24
|
+
# @return [String] Taken from the `fingerprints/database_type` attribute
|
|
25
|
+
# defaults to an empty string
|
|
26
|
+
attr_reader :database_type
|
|
27
|
+
|
|
28
|
+
# @return [Float] Taken from the `fingerprints/preference` attribute,
|
|
29
|
+
# defaults to 0.10. Used when ordering databases, highest numbers
|
|
30
|
+
# are given priority and are processed first.
|
|
31
|
+
attr_reader :preference
|
|
32
|
+
|
|
33
|
+
# Default Fingerprint database preference when it isn't specified in file
|
|
34
|
+
# Do not use a value below 0.10 so as to allow users to specify lower
|
|
35
|
+
# values in their own custom XML that will always run last.
|
|
36
|
+
DEFAULT_FP_PREFERENCE = 0.10
|
|
37
|
+
|
|
38
|
+
# @param path [String]
|
|
39
|
+
def initialize(filename)
|
|
40
|
+
@match_key = nil
|
|
41
|
+
@protocol = ''
|
|
42
|
+
@database_type = ''
|
|
43
|
+
@preference = DEFAULT_FP_PREFERENCE.to_f
|
|
44
|
+
@path = "#{File.dirname(__FILE__)}/../../xml/#{filename}"
|
|
45
|
+
@fingerprints = []
|
|
46
|
+
|
|
47
|
+
parse_fingerprints
|
|
48
|
+
end
|
|
49
|
+
|
|
50
|
+
# @return [void]
|
|
51
|
+
def parse_fingerprints
|
|
52
|
+
xml = nil
|
|
53
|
+
|
|
54
|
+
File.open(self.path, 'rb') do |fd|
|
|
55
|
+
xml = Nokogiri::XML(fd.read(fd.stat.size))
|
|
56
|
+
end
|
|
57
|
+
|
|
58
|
+
raise "#{self.path} is invalid XML: #{xml.errors.join(',')}" unless xml.errors.empty?
|
|
59
|
+
|
|
60
|
+
xml.xpath('/fingerprints').each do |fbase|
|
|
61
|
+
|
|
62
|
+
@match_key = fbase['matches'].to_s if fbase['matches']
|
|
63
|
+
@protocol = fbase['protocol'].to_s if fbase['protocol']
|
|
64
|
+
@database_type = fbase['database_type'].to_s if fbase['database_type']
|
|
65
|
+
@preference = fbase['preference'].to_f if fbase['preference']
|
|
66
|
+
|
|
67
|
+
end
|
|
68
|
+
|
|
69
|
+
@match_key = File.basename(self.path).sub(/\.xml$/, '') unless @match_key
|
|
70
|
+
|
|
71
|
+
xml.xpath('/fingerprints/fingerprint').each do |fprint|
|
|
72
|
+
@fingerprints << Fingerprint.new(fprint, @match_key, @protocol)
|
|
73
|
+
end
|
|
74
|
+
|
|
75
|
+
xml = nil
|
|
76
|
+
end
|
|
77
|
+
end
|
|
78
|
+
end
|