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
Show file tree
Hide file tree
Changes from 62 commits
Commits
Show all changes
63 commits
Select commit Hold shift + click to select a range
72026e7
initial commit
ArnoStiefvater Nov 14, 2019
0eaea0a
filter by port
ArnoStiefvater Feb 3, 2020
0c22b11
make functions static
ArnoStiefvater Feb 3, 2020
6eb7872
add barebones icmp
ArnoStiefvater Feb 3, 2020
36e25eb
use hashtables and add icmp function
ArnoStiefvater Feb 4, 2020
9f41168
move tcp syn in a GHFunc
ArnoStiefvater Feb 4, 2020
3eb2dbd
delete function which got replaced
ArnoStiefvater Feb 4, 2020
c439975
use thread instead of fork
ArnoStiefvater Feb 4, 2020
d9b6abc
clang-format
ArnoStiefvater Feb 4, 2020
fe1d17b
use only one kb_t
ArnoStiefvater Feb 4, 2020
a260438
add ipv6 version functions
ArnoStiefvater Feb 6, 2020
1782ebd
add ipv6 tcp syn ping
ArnoStiefvater Feb 6, 2020
c0619b3
add ipv6 for got_packet() and get icmpv6 in working state
ArnoStiefvater Feb 11, 2020
fc85911
add simpler version of ICMP
ArnoStiefvater Feb 11, 2020
ed6f624
add socket for tcpv6
ArnoStiefvater Feb 11, 2020
d1899a5
delete old icmp function
ArnoStiefvater Feb 11, 2020
35e8ba7
make names consisten
ArnoStiefvater Feb 11, 2020
19f916e
close sockets
ArnoStiefvater Feb 11, 2020
abc9815
delete unused struct and change function locations
ArnoStiefvater Feb 11, 2020
a1b8af2
add mechanism for alive detection method selection
ArnoStiefvater Feb 11, 2020
bfe2efc
add openvas conf setting for activation of test_alive_hosts_only func…
ArnoStiefvater Feb 11, 2020
4439df3
immprove handling of icmp pings
ArnoStiefvater Feb 11, 2020
70754c0
streamline tcp_ping and add tcp_ack ping
ArnoStiefvater Feb 12, 2020
36c7ed5
add explicit struct for icmp_ping sockets
ArnoStiefvater Feb 12, 2020
a4acdc1
get alive_test method from ospd
ArnoStiefvater Feb 12, 2020
4af3795
add arp ping
ArnoStiefvater Feb 12, 2020
cc10f6b
make sniffer thread aware of arp reply
ArnoStiefvater Feb 12, 2020
547d533
add arp via icmpv6
ArnoStiefvater Feb 12, 2020
2b983c6
refactor 1
ArnoStiefvater Feb 13, 2020
659b03e
refactor 2
ArnoStiefvater Feb 13, 2020
b053658
disable promiscuous mode for pcap
ArnoStiefvater Feb 13, 2020
c388adc
add packet buffer timeout
ArnoStiefvater Feb 13, 2020
993d109
free scanner addresses
ArnoStiefvater Feb 13, 2020
60518e0
improve timeout for get_host_from_queue
ArnoStiefvater Feb 13, 2020
7f1289e
add rate limiting
ArnoStiefvater Feb 13, 2020
216b923
set interface for icmp pings manually
ArnoStiefvater Feb 13, 2020
8a5bd46
clean up output
ArnoStiefvater Feb 13, 2020
c66e932
delete unused functions
ArnoStiefvater Feb 13, 2020
06c0352
simplify error message
ArnoStiefvater Feb 19, 2020
9186f59
streamline get_host_from_queue()
ArnoStiefvater Feb 19, 2020
b2c5898
improve open_live()
ArnoStiefvater Feb 19, 2020
109332c
improve error handling of got_packet()
ArnoStiefvater Feb 19, 2020
557d01b
improve log messages in sniffer_thread()
ArnoStiefvater Feb 19, 2020
ca55596
improve code quality
ArnoStiefvater Feb 19, 2020
aa8c860
improve error handling
ArnoStiefvater Feb 19, 2020
b2f3bff
add alive_test combinations
ArnoStiefvater Feb 20, 2020
6af2f68
pthread does not set errno
ArnoStiefvater Feb 20, 2020
3adb75c
pthread does not return errno
ArnoStiefvater Feb 20, 2020
84bfbbc
seperate pushing und popping from alive_detection queue
ArnoStiefvater Feb 20, 2020
b4c6279
add different error return values for easy debugging
ArnoStiefvater Feb 20, 2020
29b7768
set non-blocking mode on
ArnoStiefvater Feb 20, 2020
1483026
add wait_for_replies_timeout
ArnoStiefvater Feb 20, 2020
51f45cb
make functions static
ArnoStiefvater Feb 20, 2020
f13682b
access alive_detection_tid via functions
ArnoStiefvater Feb 20, 2020
65d7d57
add documentation
ArnoStiefvater Feb 26, 2020
d9f2587
delete timeout from header
ArnoStiefvater Feb 26, 2020
4d4b9df
use function to access alive_detection_tid
ArnoStiefvater Feb 26, 2020
f3adbed
use find_package and CMAKE_THREAD_LIBS_INIT instead of -lpthread
ArnoStiefvater Feb 26, 2020
9158658
set SO_BROADCAST socket option
ArnoStiefvater Feb 26, 2020
d010642
rename file
ArnoStiefvater Feb 26, 2020
cec5692
add changelog entry
ArnoStiefvater Feb 26, 2020
1e48f0b
Merge branch 'master' into test-alive-hosts-only
jjnicola Mar 13, 2020
cabb3b0
Fix linker for test
jjnicola Mar 13, 2020
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@ The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/).
- Use __func__ instead of __FUNCTION__ [#419](https://github.com/greenbone/openvas/pull/419)
- Use pcap_findalldevs() instead of deprecated function pcap_lookupdev() [#422](https://github.com/greenbone/openvas/pull/422) [#430](https://github.com/greenbone/openvas/pull/430)
- Add port-range option for openvas-nasl [#431](https://github.com/greenbone/openvas/pull/431)
- Add test_alive_hosts_only feature. [#456](https://github.com/greenbone/openvas/pull/456)
- Don't reload the plugins when start a new scan. [#458](https://github.com/greenbone/openvas/pull/458)

### Fixed
Expand Down
38 changes: 31 additions & 7 deletions src/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -58,7 +58,33 @@ else (NOT GCRYPT)
string(REPLACE "-I" "" GCRYPT_INCLUDE_DIRS "${GCRYPT_CFLAGS}")
endif (NOT GCRYPT)

add_executable (openvas attack.c hosts.c
message (STATUS "Looking for pcap...")
find_library (PCAP pcap)
message (STATUS "Looking for pcap... ${PCAP}")
if (NOT PCAP)
message (SEND_ERROR "The pcap library is required.")
endif (NOT PCAP)

message (STATUS "Looking for pcap-config...")
find_program (PCAP_CONFIG pcap-config)

if (PCAP_CONFIG)
message (STATUS "Looking for pcap-config... ${PCAP_CONFIG}")
execute_process (COMMAND pcap-config --libs
OUTPUT_VARIABLE PCAP_LDFLAGS
OUTPUT_STRIP_TRAILING_WHITESPACE)
execute_process (COMMAND pcap-config --cflags
OUTPUT_VARIABLE PCAP_CFLAGS
OUTPUT_STRIP_TRAILING_WHITESPACE)
else (PCAP_CONFIG)
message (STATUS "pcap-config not found, using defaults...")
set (PCAP_LDFLAGS "-L/usr/lib -lpcap")
set (PCAP_CFLAGS "-I/usr/include")
endif (PCAP_CONFIG)

find_package (Threads)

add_executable (openvas alivedetection.c attack.c hosts.c
main.c nasl_plugins.c openvas.c
pluginlaunch.c pluginload.c
pluginscheduler.c plugs_req.c
Expand Down Expand Up @@ -140,20 +166,18 @@ if (CMAKE_SYSTEM_NAME MATCHES "FreeBSD")
set (EXECINFO_LDFLAGS "execinfo")
endif (CMAKE_SYSTEM_NAME MATCHES "FreeBSD")


target_link_libraries (openvas openvas_nasl_shared ${LIBOPENVAS_NASL_LDFLAGS}
${LIBOPENVAS_MISC_LDFLAGS}
${LIBGVM_BASE_LDFLAGS}
${GLIB_LDFLAGS} ${GCRYPT_LDFLAGS}
${EXECINFO_LDFLAGS}
${LINKER_HARDENING_FLAGS})
${EXECINFO_LDFLAGS} ${PCAP_LDFLAGS}
${LINKER_HARDENING_FLAGS} ${CMAKE_THREAD_LIBS_INIT})

## Tests

add_executable (attack-test
EXCLUDE_FROM_ALL
attack_tests.c

alivedetection.c attack_tests.c
hosts.c nasl_plugins.c openvas.c
pluginlaunch.c pluginload.c
pluginscheduler.c plugs_req.c
Expand Down Expand Up @@ -185,7 +209,7 @@ add_dependencies (check cppcheck)

## Tag files

set (C_FILES "attack.c" "hosts.c"
set (C_FILES "alivedetection.c" "attack.c" "hosts.c"
"nasl_plugins.c" "openvas.c"
"pluginlaunch.c" "pluginload.c"
"pluginscheduler.c" "plugs_req.c"
Expand Down
Loading