-
Notifications
You must be signed in to change notification settings - Fork 80
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
mattmundell
merged 87 commits into
greenbone:master
from
ArnoStiefvater:move-boreas-with-history
Jun 8, 2020
Merged
Move alive detection (Boreas) to gvm-libs #346
mattmundell
merged 87 commits into
greenbone:master
from
ArnoStiefvater:move-boreas-with-history
Jun 8, 2020
Conversation
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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.
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.
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.
This socket is later to be used for getting the source addr for a given destination addr.
mattmundell
approved these changes
Jun 8, 2020
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Move alive detection module Boreas into
gvm-libs
.Checklist: