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

Move alive detection (Boreas) to gvm-libs #346

Merged
merged 87 commits into from
Jun 8, 2020

Conversation

ArnoStiefvater
Copy link
Member

Move alive detection module Boreas into gvm-libs.

Checklist:

ArnoStiefvater and others added 30 commits February 26, 2020 19:45
All hosts are put on queue of alive hosts even though they might actually be dead.
We do not handle SIGPIPE via signal handler.
EPIPE error is still returned. This way the program does not crash
on SIGPIPE signal.
If max_scan_hosts number of alive hosts are reached no more alive
hosts are put on the alive detection queue. Instead the finish
signal is put on the queue.

If max_alive_hosts number of alive hosts are identified no more
alive hosts are identified and the sending of new pings is stopped.

If max_scan_hosts is reached we continue scanning for alive hosts
until max_alive_hosts was reached or no more hosts to scan.
If max_scan_hosts number of alive hosts are reached no more alive
hosts are put on the alive detection queue. Instead the finish
signal is put on the queue.

If max_alive_hosts number of alive hosts are identified no more
alive hosts are identified and the sending of new pings is stopped.

If max_scan_hosts is reached we continue scanning for alive hosts
until max_alive_hosts was reached or no more hosts to scan.
At the end of the alive detection send all the dead hosts in
chunks of 1000 hosts to ospd-openvas. ospd-openvas needs this
information for calculating the progress bar in gsa.
We only use the src_mac, dst_max and sourcearpv4 variables in one function and the values always stay the same.
So we delete them from the scanner struct and make them static in the function they are used in.
Previously only dead hosts were sent to ospd-openvas for calculating the progress bar.
Now dead hosts plus the hosts which are alive but were not vuln scanned by openvas are
included in the list of dead hosts to be sent to ospd-openvas as well.
Alive hosts may not be vuln scanned if max_scan_hosts is reached.
Non blocking mode uses too much CPU. Documentation states non blocking
mode should not be used with pcap_loop().

When blocking mode is used pcap_breakloop() may not work as expected anymore.
Therefore the thread is canceled and joined afterwards.
Use conditional variable to signal the start of the sniffer thread.
We wait in a loop for new hosts. Every iteration the scan_status is
checked. If the scan was stopped we stop waiting for new hosts.
This way we won't get stuck in a waiting loop if we want to stop openvas.
We wait in a loop for new hosts. Every iteration the scan_status is
checked. If the scan was stopped we stop waiting for new hosts.
This way we won't get stuck in a waiting loop if we want to stop openvas.
Set up 2 clean-up handlers. One for putting the finish signal
(a string) on the alive detection queue and one for freeing all
used resources and closing all socket.
Also make sure that the finish signal is only put once on the
alive detection queue.
Do not use hard coded port lists anymore.
Fix typo in xml string and delete wrong debug message.
Only use ports 80, 137, 587, 3128, 8081 for alive detection.
Use global port range as fallback.
Add error type for Boreas and make minor changes to documentation.
Exit Boreas if invalid alive detection method was supplied.
Exit Boreas if initialisation of sockets was erroneous.
Only initialise sockets we need and not all types.
Remove some extensive logging.
Add tests for set_all_needed_sockets() and set_socket().
Only close sockets which where opened. Previously all possible
sockets were opened and needed to be closed. Now only the needed
sockets are opened so we only need to close those.
Add boreas_error_t for clean up error.
Only close sockets which where opened. Previously all possible
sockets were opened and needed to be closed. Now only the needed
sockets are opened so we only need to close those.
Add boreas_error_t for clean up error.
@ArnoStiefvater ArnoStiefvater changed the title Move boreas with history Move alive detection (Boreas) to gvm-libs Jun 8, 2020
@mattmundell mattmundell merged commit 79416ca into greenbone:master Jun 8, 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

5 participants