-
Notifications
You must be signed in to change notification settings - Fork 26
Expand file tree
/
Copy pathServiceRegexMatcher.h
More file actions
78 lines (63 loc) · 1.28 KB
/
ServiceRegexMatcher.h
File metadata and controls
78 lines (63 loc) · 1.28 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
#pragma once
#include "Stdafx.h"
#include "BannerProcessor.h"
#include <regex>
#include <string>
/*!
* Represents a service identifier entry.
*/
struct ServiceRegex
{
/*!
* Regular expression to match against service banner.
*/
std::regex regex;
/*!
* CPE name of the matched service.
*/
std::string cpe;
/*!
* Vendor of the matched service.
*/
std::string vendor;
/*!
* Product name of the matched service.
*/
std::string product;
/*!
* Version number of the matched service.
*/
std::string version;
};
/*!
* Implements a bulk regular expression matcher against service banners.
*/
class ServiceRegexMatcher : public BannerProcessor
{
public:
/*!
* Processes the banner of a service.
*
* \param service Scanned service.
*/
void Scan(Service* service) override;
/*!
* Gets the regular expressions.
*
* \return List of regular expressions.
*/
static std::vector<struct ServiceRegex*> GetRegexes();
/*!
* Frees up the resources allocated during the lifetime of this instance.
*/
~ServiceRegexMatcher() override;
private:
/*!
* List of regular expressions with their associated product info.
*/
static std::vector<struct ServiceRegex*> regexes;
/*!
* Loads the regex database from external file.
*/
static void loadRegexes();
};