-
Notifications
You must be signed in to change notification settings - Fork 30
/
ServiceScanner.h
71 lines (61 loc) · 1.57 KB
/
ServiceScanner.h
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
#pragma once
#include "Stdafx.h"
#include "Service.h"
/*!
* Timeout option for the individual scans in milliseconds.
* Default value is 3000ms for most scanners.
*/
#define OPT_TIMEOUT 1
/*!
* Number of milliseconds to wait between sending packets to the same host.
* Default value is 100ms for most scanners.
*/
#define OPT_DELAY 2
/*!
* Boolean value indicating whether to wait for and grab the service banner.
* Default value is true for scanners that support it.
*/
#define OPT_BANNER 5
/*!
* Represents a port scanner.
*/
class ServiceScanner
{
public:
/*!
* Get a task which scans a service to determine its aliveness.
*
* \param service Service to scan.
*
* \return Task to scan the specified service.
*/
virtual void* GetTask(Service* service) = 0;
/*!
* Gets the currently set value for the option key.
*
* \param option Option index, see `OPT_*` macros.
* \param value Pointer to the value to set.
*
* \return true if it succeeds, false if it fails.
*/
virtual bool GetOption(int option, void* value) = 0;
/*!
* Sets a specified value for the option key.
*
* \param option Option index, see `OPT_*` macros.
* \param value Pointer to the value to set.
*
* \return true if it succeeds, false if it fails.
*/
virtual bool SetOption(int option, void* value) = 0;
/*!
* Dumps the scan results into the standard output.
*
* \param services List of services.
*/
static void DumpResults(Services* services);
/*!
* Frees up the resources allocated during the lifetime of this instance.
*/
virtual ~ServiceScanner();
};