-
Notifications
You must be signed in to change notification settings - Fork 2
/
ntvpref.hpp
129 lines (124 loc) · 3.89 KB
/
ntvpref.hpp
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
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
#pragma once
#include "engine/value.hpp"
class NVTPref {
protected:
Interpreter::Value mPref;
public:
explicit NVTPref(Interpreter::Value pref) : mPref(pref) {
if (!mPref.IsMap()) {
throw Interpreter::RuntimeException("invalid config value");
}
}
unsigned int number_of_concurrent_tasks() {
auto iter = mPref._map().find("number_of_concurrent_tasks");
if (iter != mPref._map().end()) {
return (unsigned int)iter->second.ToInteger();
}
return 30;
}
unsigned int port_scan_send_packet_rate() {
auto iter = mPref._map().find("port_scan_send_packet_rate");
if (iter != mPref._map().end()) {
return (unsigned int)iter->second.ToInteger();
}
return 1000;
}
unsigned int script_default_timeout_second() {
auto iter = mPref._map().find("script_default_timeout_second");
if (iter != mPref._map().end()) {
return (unsigned int)iter->second.ToInteger();
}
return 120;
}
unsigned int service_detection_thread_count() {
auto iter = mPref._map().find("service_detection_thread_count");
if (iter != mPref._map().end()) {
return (unsigned int)iter->second.ToInteger();
}
return 6;
}
std::string default_network_interface() {
auto iter = mPref._map().find("default_network_interface");
if (iter != mPref._map().end()) {
return iter->second.ToString();
}
return "";
}
int log_level() {
auto iter = mPref._map().find("log_level");
if (iter != mPref._map().end()) {
return (int)iter->second.ToInteger();
}
return 2;
}
int log_engine_warning() {
auto iter = mPref._map().find("log_engine_warning");
if (iter != mPref._map().end()) {
return (int)iter->second.ToInteger();
}
return true;
}
int tcp_connect_timeout_second() {
auto iter = mPref._map().find("tcp_connect_timeout_second");
if (iter != mPref._map().end()) {
return (int)iter->second.ToInteger();
}
return 5;
}
int trace_object_storage() {
auto iter = mPref._map().find("trace_object_storage");
if (iter != mPref._map().end()) {
return (int)iter->second.ToInteger();
}
return false;
}
int tcp_read_write_timeout_second() {
auto iter = mPref._map().find("tcp_read_write_timeout_second");
if (iter != mPref._map().end()) {
return (int)iter->second.ToInteger();
}
return 5;
}
std::string script_package() {
auto iter = mPref._map().find("script_package");
if (iter != mPref._map().end()) {
return iter->second.ToString();
}
return "";
}
std::string script_folder() {
auto iter = mPref._map().find("script_folder");
if (iter != mPref._map().end()) {
return iter->second.ToString();
}
return "";
}
std::string app_data_folder() {
auto iter = mPref._map().find("app_data_folder");
if (iter != mPref._map().end()) {
return iter->second.ToString();
}
return "";
}
std::string builtin_script_path() {
auto iter = mPref._map().find("builtin_script_path");
if (iter != mPref._map().end()) {
return iter->second.ToString();
}
return "";
}
int enable_code_cache() {
auto iter = mPref._map().find("enable_code_cache");
if (iter != mPref._map().end()) {
return (int)iter->second.ToInteger();
}
return 1;
}
std::string result_output_format() {
auto iter = mPref._map().find("result_output_format");
if (iter != mPref._map().end()) {
return iter->second.ToString();
}
return "text";
}
};