Skip to content

Commit 41fb0c4

Browse files
committed
Add credential to host object
1 parent 111d744 commit 41fb0c4

2 files changed

Lines changed: 111 additions & 118 deletions

File tree

rust/api/v2/components/examples/scans.yml

Lines changed: 74 additions & 59 deletions
Original file line numberDiff line numberDiff line change
@@ -6,9 +6,14 @@ scan_simple:
66
{
77
"target":
88
{
9-
"hosts": [ "127.0.0.1" ],
10-
"ports": [ { "range": [ { "start": 22 } ] } ],
11-
"credentials": [ { "service": "ssh", "port": 22, "up": { "username": "user", "password": "pass" } } ]
9+
"hosts":
10+
[
11+
{
12+
"ip": "127.0.0.1",
13+
"credential": { "service": "ssh", "port": 22, "up": { "username": "user", "password": "pass" } }
14+
}
15+
],
16+
"ports": [ { "range": [ { "start": 22 } ] } ]
1217
},
1318
"vts": [ { "oid": "1.3.6.1.4.1.25623.1.0.50282" } ]
1419
}
@@ -23,13 +28,39 @@ scan_full_req:
2328
{
2429
"hosts":
2530
[
26-
"127.0.0.1",
27-
"192.168.0.1-15",
28-
"10.0.5.0/24",
29-
"::1",
30-
"2001:db8:0000:0000:0000:0000:0000:0001-00ff",
31-
"2002::1234:abcd:ffff:c0a8:101/64",
32-
"examplehost"
31+
{
32+
"ip": "127.0.0.1",
33+
"credential":
34+
{
35+
"service": "ssh",
36+
"port": 22,
37+
"usk": { "username": "user", "password": "pw", "private": "ssh-key..." }
38+
}
39+
},
40+
{
41+
"ip": "192.168.0.1-15",
42+
"credential": { "service": "smb", "up": { "username": "user", "password": "pw" } }
43+
},
44+
{
45+
"ip": "10.0.5.0/24",
46+
"credential":
47+
{
48+
"service": "snmp",
49+
"snmp":
50+
{
51+
"username": "user",
52+
"password": "pw",
53+
"community": "my_community",
54+
"auth_algorithm": "md5",
55+
"privacy_password": "priv_pw",
56+
"privacy_algorithm": "aes"
57+
}
58+
}
59+
},
60+
{ "ip": "::1" },
61+
{ "ip": "2001:db8:0000:0000:0000:0000:0000:0001-00ff" },
62+
{ "ip": "2002::1234:abcd:ffff:c0a8:101/64" },
63+
{ "ip": "examplehost" }
3364
],
3465
"excluded_hosts": [ "192.168.0.14" ],
3566
"ports":
@@ -38,27 +69,6 @@ scan_full_req:
3869
{ "protocol": "tcp", "range": [ { "start": 24, "end": 30 } ] },
3970
{ "range": [ { "start": 100, "end": 1000 } ] }
4071
],
41-
"credentials":
42-
[
43-
{
44-
"service": "ssh",
45-
"port": 22,
46-
"usk": { "username": "user", "password": "pw", "private": "ssh-key..." }
47-
},
48-
{ "service": "smb", "up": { "username": "user", "password": "pw" } },
49-
{
50-
"service": "snmp",
51-
"snmp":
52-
{
53-
"username": "user",
54-
"password": "pw",
55-
"community": "my_community",
56-
"auth_algorithm": "md5",
57-
"privacy_password": "priv_pw",
58-
"privacy_algorithm": "aes"
59-
}
60-
}
61-
],
6272
"alive_test_ports":
6373
[
6474
{ "protocol": "tcp", "range": [ { "start": 1, "end": 100 } ] },
@@ -125,13 +135,39 @@ scan_full_resp:
125135
{
126136
"hosts":
127137
[
128-
"127.0.0.1",
129-
"192.168.0.1-15",
130-
"10.0.5.0/24",
131-
"::1",
132-
"2001:db8:0000:0000:0000:0000:0000:0001-00ff",
133-
"2002::1234:abcd:ffff:c0a8:101/64",
134-
"examplehost"
138+
{
139+
"ip": "127.0.0.1",
140+
"credential":
141+
{
142+
"service": "ssh",
143+
"port": 22,
144+
"usk": { "username": "user", "password": "pw", "private": "ssh-key..." }
145+
}
146+
},
147+
{
148+
"ip": "192.168.0.1-15",
149+
"credential": { "service": "smb", "up": { "username": "user", "password": "pw" } }
150+
},
151+
{
152+
"ip": "10.0.5.0/24",
153+
"credential":
154+
{
155+
"service": "snmp",
156+
"snmp":
157+
{
158+
"username": "user",
159+
"password": "pw",
160+
"community": "my_community",
161+
"auth_algorithm": "md5",
162+
"privacy_password": "priv_pw",
163+
"privacy_algorithm": "aes"
164+
}
165+
}
166+
},
167+
{ "ip": "::1" },
168+
{ "ip": "2001:db8:0000:0000:0000:0000:0000:0001-00ff" },
169+
{ "ip": "2002::1234:abcd:ffff:c0a8:101/64" },
170+
{ "ip": "examplehost" }
135171
],
136172
"excluded_hosts": [ "192.168.0.14" ],
137173
"ports":
@@ -140,27 +176,6 @@ scan_full_resp:
140176
{ "protocol": "tcp", "range": [ { "start": 24, "end": 30 } ] },
141177
{ "range": [ { "start": 100, "end": 1000 } ] }
142178
],
143-
"credentials":
144-
[
145-
{
146-
"service": "ssh",
147-
"port": 22,
148-
"usk": { "username": "user", "password": "pw", "private": "ssh-key..." }
149-
},
150-
{ "service": "smb", "up": { "username": "user", "password": "pw" } },
151-
{
152-
"service": "snmp",
153-
"snmp":
154-
{
155-
"username": "user",
156-
"password": "pw",
157-
"community": "my_community",
158-
"auth_algorithm": "md5",
159-
"privacy_password": "priv_pw",
160-
"privacy_algorithm": "aes"
161-
}
162-
}
163-
],
164179
"alive_test_ports":
165180
[
166181
{ "protocol": "tcp", "range": [ { "start": 1, "end": 100 } ] },

rust/api/v2/components/schemas/target.yml

Lines changed: 37 additions & 59 deletions
Original file line numberDiff line numberDiff line change
@@ -4,69 +4,27 @@ Target:
44
type: "object"
55
properties:
66
hosts:
7-
description: "A list of hosts."
7+
description: "A list of hosts and corresponding credentials."
88
type: "array"
99
items:
10-
description: "Contains either an IPv4, IPv6, IPv4 range, IPv6 range, IPv4 CIDR, IPv6 CIDR or
11-
hostname.
12-
13-
Examples:
14-
15-
IPv4: 192.168.178.42
16-
17-
IPv6: 2001:0db8:85a3:0000:0000:8a2e:1370:7334
18-
19-
IPv4 range: 192.167.178.1-93 or 192.167.178.1-192.167.178.93
20-
21-
IPv6 range:
22-
2001:0db8:85a3:0000:0000:8a2e:1370:7334-2001:0db8:85a3:0000:0000:8a2e:1370:7339
23-
24-
IPv4 CIDR: 192.168.178.0/24
25-
26-
IPv6 CIDR: 2001:0db8:85a3::/64
27-
28-
Hostname: localhost"
29-
type: "string"
10+
type: "object"
11+
properties:
12+
ip:
13+
$ref: "#/IP"
14+
credential:
15+
$ref: "#/Credential"
16+
required:
17+
- ip
3018
excluded_hosts:
3119
description: "A list of excluded hosts."
3220
type: "array"
3321
items:
34-
description: "Contains either an IPv4, IPv6, IPv4 range, IPv6 range, IPv4 CIDR, IPv6 CIDR or
35-
hostname.
36-
37-
Examples:
38-
39-
IPv4: 192.168.178.42
40-
41-
IPv6: 2001:0db8:85a3:0000:0000:8a2e:1370:7334
42-
43-
IPv4 range: 192.167.178.1-93 or 192.167.178.1-192.167.178.93
44-
45-
IPv6 range:
46-
2001:0db8:85a3:0000:0000:8a2e:1370:7334-2001:0db8:85a3:0000:0000:8a2e:1370:7339
47-
48-
IPv4 CIDR: 192.168.178.0/24
49-
50-
IPv6 CIDR: 2001:0db8:85a3::/64
51-
52-
Hostname: localhost"
53-
type: "string"
22+
$ref: "#/IP"
5423
ports:
5524
description: "A list of ports."
5625
type: "array"
5726
items:
5827
$ref: "#/PortRange"
59-
credentials:
60-
description: "A list of credentials used for further access to a target system."
61-
type: "array"
62-
items:
63-
$ref: "#/Credential"
64-
multiple_credentials:
65-
description: "If true, multiple credentials per host are allowed. WARNING: this can massively slow
66-
down the scan for many credentials and hosts, as each authentication attempt takes some
67-
time. If false, only one credential per host is allowed and a error is thrown otherwise. The
68-
default is false."
69-
type: "boolean"
7028
alive_test_ports:
7129
description: "Dedicated port list for alive detection. Used for TCP-SYN and TCP-ACK ping when Boreas
7230
is enabled."
@@ -86,6 +44,12 @@ Target:
8644
reverse_lookup_only:
8745
description: "Only scan IP addresses that can be resolved into a DNS name."
8846
type: "boolean"
47+
multiple_credentials:
48+
description: "If true, multiple credentials per host are allowed. WARNING: this can massively slow
49+
down the scan for many credentials and hosts, as each authentication attempt takes some
50+
time. If false, only one credential per host is allowed and a error is thrown otherwise. The
51+
default is false."
52+
type: "boolean"
8953
required:
9054
- hosts
9155
- ports
@@ -125,17 +89,31 @@ PortRange:
12589
required:
12690
- range
12791

92+
IP:
93+
description: "Contains either an IPv4, IPv6, IPv4 range, IPv6 range, IPv4 CIDR, IPv6 CIDR or
94+
hostname.
95+
96+
Examples:
97+
98+
IPv4: 192.168.178.42
99+
100+
IPv6: 2001:0db8:85a3:0000:0000:8a2e:1370:7334
101+
102+
IPv4 range: 192.167.178.1-93 or 192.167.178.1-192.167.178.93
103+
104+
IPv6 range: 2001:0db8:85a3:0000:0000:8a2e:1370:7334-2001:0db8:85a3:0000:0000:8a2e:1370:7339
105+
106+
IPv4 CIDR: 192.168.178.0/24
107+
108+
IPv6 CIDR: 2001:0db8:85a3::/64
109+
110+
Hostname: localhost"
111+
type: "string"
112+
128113
Credential:
129114
description: "Data for authentication for a target system."
130115
type: "object"
131116
properties:
132-
hosts:
133-
description: "A list of hosts for which the credential is valid. The format is the same as for the
134-
hosts in the target. This field is optional, if not set the credential is the default
135-
credential for all hosts of the target."
136-
type: "array"
137-
items:
138-
type: "string"
139117
service:
140118
description: "The service used for authentication."
141119
type: "string"

0 commit comments

Comments
 (0)