Skip to content

Commit 3eae866

Browse files
committed
Add: handle large ipv6 networks
With this patch, the host discovery for large ipv6 networks is introduced together with a new alive test method (int 32). Instead of creating a host list from an IPv6 network address and mask (e.g. 5858::0/64), which would take years to scan and it woudl consume all the RAM, it just call a new function in gvm-libs to perform an ICMPv6 to a multicast IPv6 address (ff02::1). Later, the found host are set as target and they will be handle as before. To avoid a double alive test, they are just considered alive. For now, it only supports only one IPv6 network address. This means it can not be combined with other networks or unicast addresses. Also, it is required that the local network has ICMPv6 enabled, otherwise the discovery won't work.
1 parent b9f3f57 commit 3eae866

File tree

1 file changed

+21
-1
lines changed

1 file changed

+21
-1
lines changed

src/attack.c

Lines changed: 21 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -40,6 +40,7 @@
4040
#include <gvm/base/prefs.h> /* for prefs_get() */
4141
#include <gvm/boreas/alivedetection.h> /* for start_alive_detection() */
4242
#include <gvm/boreas/boreas_io.h> /* for get_host_from_queue() */
43+
#include <gvm/boreas/cli.h> /* for ipv6 host discovery */
4344
#include <gvm/util/mqtt.h>
4445
#include <gvm/util/nvticache.h> /* for nvticache_t */
4546
#include <pthread.h>
@@ -1197,7 +1198,26 @@ attack_network (struct scan_globals *globals)
11971198
return error;
11981199
}
11991200
/* Init and check Target List */
1200-
hostlist = prefs_get ("TARGET");
1201+
#ifdef FEATURE_HOST_DISCOVERY_IPV6
1202+
alive_test_t alive_test;
1203+
const char *target_aux = prefs_get ("TARGET");
1204+
char *host_found = "";
1205+
1206+
get_alive_test_methods (&alive_test);
1207+
if (alive_test == 32)
1208+
{
1209+
int print_results = 0;
1210+
run_cli_for_ipv6_network (target_aux, &host_found, print_results);
1211+
hostlist = host_found;
1212+
// Consider alive the found hosts, to avoid double check later
1213+
prefs_set("ALIVE_TEST", "8");
1214+
}
1215+
else
1216+
#endif /* FEATURE_HOST_DISCOVERY_IPV6 */
1217+
{
1218+
hostlist = prefs_get ("TARGET");
1219+
}
1220+
12011221
if (hostlist == NULL)
12021222
{
12031223
error = -1;

0 commit comments

Comments
 (0)