-
Notifications
You must be signed in to change notification settings - Fork 22
Expand file tree
/
Copy pathresources.py
More file actions
102 lines (79 loc) · 3.17 KB
/
resources.py
File metadata and controls
102 lines (79 loc) · 3.17 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
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
from simple_rest_client.resource import Resource
class LoginResource(Resource):
actions = {
"auth": {"method": "POST", "url": "login"},
"whoami": {"method": "GET", "url": "v3/whoami"},
"get_token": {"method": "GET", "url": "v3/token"},
"validate": {"method": "GET", "url": "v3/preferences"},
"second_factor": {"method": "POST", "url": "confirmation"},
}
class ConfigResource(Resource):
actions = {
"config": {"method": "GET", "url": "config"},
}
class WorkspaceResource(Resource):
actions = {
"list": {"method": "GET", "url": "v3/ws"},
"get": {"method": "GET", "url": "v3/ws/{}"},
"filter": {"method": "GET", "url": "v3/ws/filter"},
"create": {"method": "POST", "url": "v3/ws"},
"delete": {"method": "DELETE", "url": "v3/ws/{}"},
"activities": {"method": "GET", "url": "v3/ws/{}/activities"},
"update": {"method": "PATCH", "url": "v3/ws/{}"},
}
class BulkCreateResource(Resource):
actions = {"create": {"method": "POST", "url": "v3/ws/{}/bulk_create"}}
class HostResource(Resource):
actions = {
"list": {
"method": "GET",
"url": "v3/ws/{}/hosts?page=1&page_size=100000",
}, # workaround for api bug
"get": {"method": "GET", "url": "v3/ws/{}/hosts/{}"},
"create": {"method": "POST", "url": "v3/ws/{}/hosts"},
"update": {"method": "PATCH", "url": "v3/ws/{}/hosts/{}"},
"delete": {"method": "DELETE", "url": "v3/ws/{}/hosts/{}"},
"get_services": {
"method": "GET",
"url": "v3/ws/{}/hosts/{}/services",
},
"get_vulns": {"method": "GET", "url": "v3/ws/{}/vulns"},
}
class ServiceResource(Resource):
actions = {
"list": {"method": "GET", "url": "v3/ws/{}/services"},
"get": {"method": "GET", "url": "v3/ws/{}/services/{}"},
}
class VulnResource(Resource):
actions = {
"get": {"method": "GET", "url": "v3/ws/{}/vulns/{}"},
"create": {"method": "POST", "url": "v3/vulnerability_template"},
"patch": {"method": "PATCH", "url": "v3/ws/{}/vulns/{}"},
"list": {"method": "GET", "url": "v3/ws/{}/vulns"},
"filter": {"method": "GET", "url": "v3/ws/{}/vulns/filter"},
"delete": {"method": "DELETE", "url": "v3/ws/{}/vulns/{}"},
}
class VulnEvidenceResource(Resource):
actions = {
"create": {"method": "POST", "url": "v3/ws/{}/vulns/{}/attachment"},
}
class CredentialResource(Resource):
actions = {
"list": {"method": "GET", "url": "v3/ws/{}/credential"},
}
class AgentResource(Resource):
actions = {
"list": {"method": "GET", "url": "v3/agents"},
"get": {"method": "GET", "url": "v3/agents/{}"},
"run": {"method": "POST", "url": "v3/agents/{}/run"},
}
class ExecutiveReportResource(Resource):
actions = {
"list_templates": {
"method": "GET",
"url": "v3/reports/listTemplates",
},
"generate": {"method": "POST", "url": "v3/reports"},
"status": {"method": "GET", "url": "v3/reports/{}"},
"download": {"method": "GET", "url": "v3/reports/{}/download"},
}