Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Test alive hosts only #456

Merged
merged 63 commits into from Mar 13, 2020
Merged

Conversation

ArnoStiefvater
Copy link
Member

@ArnoStiefvater ArnoStiefvater commented Feb 27, 2020

When the scanner preference test_alive_hosts_only is set to yes only alive hosts are tested by the scanner. This feature is still work in progress, hanging scans or unexpected behavior may occur.

Depends on:

You have to change the scanner plugin ping_host.nasl to not run a second alive detection scan. Add the following to the beginning (before or after the function definitions) of ping_host.nasl.

test_alive_hosts_only = get_preference("test_alive_hosts_only");
if(test_alive_hosts_only) {
  exit(0);
}

How fast the alive scanner sends out pings can be specified by the BURSTand BURST_TIMEOUT macros in alivedetection.h.

Instead of filtering for every host individually we filter by port.
This way we can filter for many hosts without running in memory issues
with too big filter descriptions. A new hashtable of the target hosts
is used for not including alive hosts we do not want to scan by mistake.
Add icmp ping capability. Is commented out for now because no mechanism
for multiple metods exist for now.
Use hachtables instead of gvm_hosts_t struct.
Add function for icmp pings.
Function for tcp syn which is to be used by g_hash_table_foreach().
Do not initialize main_kb every time we want to use it.
Packet sniffer can handle IPv4 and IPv6 packets now.
ICMPv6 was simplified and is working as expected now.
Simplify icmp (ipv4). Kernel builds ipv4 header for us now.
Temp addition of socket. Will be changed in the future.
Ospd puts alive_detection flag in redis. Openvas stores it in a
hashtable we can access.
On ospd side it is checked if openvas conf 'test_alive_hosts_only' is set
to 'yes'. If it is set, put the ALIVE_TEST enum in redis which is read by
openvas on startup and available via hashtable lookup by prefs_get().
Add basic arp ping functionlity.
One function for getting sockets.
Scanner structure with everything needed for scanning.
Hosts data strukture which holds the hashtables.
Only one sniffer thread instead of starting and stopping.
Clean init and free function.
Only init source addresses once and reuse them.
Improve checksum function.
Better error handling and error messages.
Use memset, memcpy etc. instead of deprecated functions.
Use different redis connection for pushing and popping.
When alive_detection crashed we wound get segfault or error.
Somehow pcpa_breakloop seems to work only if this option is set.
Timeout for how long to wait for replies after last packet was sent.
Make private functions static and add or remove __attribte__ ((unused))
where needed.
This way we can ping broadcast addresses and do not get permission denied error while pinging.
jjnicola
jjnicola previously approved these changes Mar 13, 2020
@jjnicola jjnicola merged commit c95fbb8 into greenbone:master Mar 13, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants