Skip to content

Commit

Permalink
Merge pull request #456 from ArnoStiefvater/test-alive-hosts-only
Browse files Browse the repository at this point in the history
Test alive hosts only
  • Loading branch information
jjnicola committed Mar 13, 2020
2 parents 33771fa + cabb3b0 commit c95fbb8
Show file tree
Hide file tree
Showing 5 changed files with 1,682 additions and 14 deletions.
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
42 changes: 33 additions & 9 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 All @@ -168,8 +192,8 @@ target_link_libraries (attack-test openvas_nasl_shared cgreen
${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}
-Wl,--wrap=redis_push_str)

add_custom_target (tests
Expand All @@ -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

0 comments on commit c95fbb8

Please sign in to comment.