-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathdeveloper_manual.txt
332 lines (242 loc) · 8.32 KB
/
developer_manual.txt
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
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
Help on module auto-openvas:
NAME
auto-openvas - AutoVAS primary logic
FUNCTIONS
clean_up()
remove machines with last successfull test older than threshold days
days_diff(date1: datetime.datetime, date2: datetime.datetime = None) -> int
return days between 2 dates
get_args() -> argparse.Namespace
argparser
import_target_file(path: str) -> None
import single job file
import_target_folder(path: str) -> None
crawl import folder and load jobs
import_targets(path: str) -> None
call method for file or folder
load_config() -> dict
get config + add app path
load_previous_data() -> None
restore previously saved data (ip, mac and time stamps)
mk_machine(json_data: dict, source: str) -> None
create new machine object
now() -> datetime.datetime
openvas_analysis() -> None
handle gathering from openvas
openvas_populate() -> None
create missing openvas targets/tasks
openvas_run_task() -> None
try to start OV task until success, ordered by last_report
print_console() -> None
print stats to console
registered(ip: str, keep: bool = None) -> bool
create machine object and return True if doesn't exist yet
save_results() -> None
prepare and export gathered information
scan_net(subnet: str) -> None
crawl net and add found IPs
sleep(...)
sleep(seconds)
Delay execution for a given number of seconds. The argument may be
a floating point number for subsecond precision.
task_running(ip: str) -> bool
confirm that task is running
tasks_running() -> int
count running tasks
test_order(sort_key: str) -> Iterator[Tuple[str, str]]
return list (ip, sort_key) ordered by sort_key value
DATA
Iterator = typing.Iterator
Tuple = typing.Tuple
FILE
.../autoopenvas/auto-openvas.py
##### Help on module JSONfile:
NAME
JSONfile - general module for handling json files, dicts and lists
CLASSES
builtins.object
JSONfile
class JSONfile(builtins.object)
| JSONfile(filename: str) -> None
|
| convert JSON-formatted files to dict or list of dicts and back
| usage:
|
| myfile = JSONfile('filename')
|
| content = myfile.load([[list_sort_key='a'], reverse=True])
| if not myfile.error: print("yay")
|
| myfile.save(content[[, list_sort_key='a'], reverse=True])
| if not myfile.error: print("yay")
|
| Methods defined here:
|
| __init__(self, filename: str) -> None
| set filename and defaults
|
| read(self, **kwargs) -> Union[list, dict, NoneType]
| load file content as dict or list of dicts (optionally sorted)
| kwargs:
| list_sort_key: str [default: None]
| reverse: bool [default: False]
|
| write(self, data: Union[list, dict], **kwargs) -> bool
| save dict or list of dicts to json file (optionally sorted)
| data:
| data: dict or list of dicts
| kwargs:
| list_sort_key: str [default: None]
| reverse: bool [default: False]
|
| ----------------------------------------------------------------------
| Data descriptors defined here:
|
| __dict__
| dictionary for instance variables (if defined)
|
| __weakref__
| list of weak references to the object (if defined)
DATA
Union = typing.Union
FILE
/home/tobias/develop/autoopenvas/modules/JSONfile.py
##### Help on module Machine:
NAME
Machine - class Machine
CLASSES
builtins.object
Machine
class Machine(builtins.object)
| Machine(ip: str) -> None
|
| machine container
|
| Methods defined here:
|
| __init__(self, ip: str) -> None
| Initialize self. See help(type(self)) for accurate signature.
|
| mac_update(self, mac: str) -> bool
| verify mac matches
|
| ----------------------------------------------------------------------
| Data descriptors defined here:
|
| __dict__
| dictionary for instance variables (if defined)
|
| __weakref__
| list of weak references to the object (if defined)
DATA
default_stamp = datetime.datetime(1970, 1, 1, 0, 0)
FILE
/home/tobias/develop/autoopenvas/modules/Machine.py
##### Help on module OpenVAS:
NAME
OpenVAS - class OpenVAS
CLASSES
builtins.object
OpenVAS
class OpenVAS(builtins.object)
| OpenVAS(login: str, passwd: str, ip: str, omp_port: str, web_port: str) -> None
|
| parse and control openvas by omp
|
| Methods defined here:
|
| __init__(self, login: str, passwd: str, ip: str, omp_port: str, web_port: str) -> None
| Initialize self. See help(type(self)) for accurate signature.
|
| mk_target(self, ip: str, mac: str, ports: str, comment: str = '') -> Union[str, NoneType]
| create target
|
| mk_task(self, ip: str, mac: str, target_id: str, scan_config: str, comment: str = '') -> Union[str, NoneType]
| create task
|
| reports(self) -> Iterator[Union[str, datetime.datetime]]
| extract ip, reportID and time stamp from openvas report
|
| results(self) -> Iterator[str]
| extract ip, severety
|
| rm(self, what: str, what_id: str) -> bool
| delete given task or target from OpenVAS
|
| run_task(self, task: str) -> Union[str, NoneType]
| telling omp to start a task
|
| targets(self) -> Iterator[str]
| extract ip, target-IDs
|
| tasks(self) -> Iterator[str]
| extract ip, mac, task-IDs
|
| ----------------------------------------------------------------------
| Data descriptors defined here:
|
| __dict__
| dictionary for instance variables (if defined)
|
| __weakref__
| list of weak references to the object (if defined)
FUNCTIONS
get_quote(s: str) -> str
get substring between (first) quotes
is_ok(raw_data: str) -> bool
check status code of omp command
rm_tags(s: str) -> str
return string with all XML tags (<TAG>) removed
sleep(...)
sleep(seconds)
Delay execution for a given number of seconds. The argument may be
a floating point number for subsecond precision.
DATA
Iterator = typing.Iterator
Union = typing.Union
FILE
/home/tobias/develop/autoopenvas/modules/OpenVAS.py
##### Help on module exe:
NAME
exe - general module for subprocessing
FUNCTIONS
exe(command: Union[list, str], **kwargs) -> Tuple[Union[str, bool], Union[str, Exception]]
execute external process, returns (stdout: str|false, stderr: str)
kwargs:
timeout: default = 300sec
label: log-label
DATA
PIPE = -1
STDOUT = -2
Tuple = typing.Tuple
Union = typing.Union
FILE
/home/tobias/develop/autoopenvas/modules/exe.py
##### Help on module nettools:
NAME
nettools - network functions
FUNCTIONS
crawl_net(subnet: str = None) -> Iterator[str]
scan given subnet for IPs and MACs using nmap
get_mac(ip: str) -> Union[str, NoneType]
get current mac address from ip using arping
DATA
Iterator = typing.Iterator
Union = typing.Union
ip_pattern = r'(\d{1,3}\.\d{1,3}\.\d{1,3}\.\d{1,3})'
mac_pattern = '([0-9A-F]{2}:[0-9A-F]{2}:[0-9A-F]{2}:[0-9A-F]{2}:[0-9A-...
FILE
/home/tobias/develop/autoopenvas/modules/nettools.py
##### problem in modules/syslog.py - ImportError: cannot import name 'syslog' from 'syslog' (modules/syslog.py)
##### Help on module vcheck:
NAME
vcheck - general version check module
FUNCTIONS
vcheck(recent_version_url: str) -> Union[str, bool, NoneType]
compare given remote and local VERSION file
return False if failed, None if no newer version found
or recent version
DATA
Union = typing.Union
FILE
/home/tobias/develop/autoopenvas/modules/vcheck.py