Skip to content

Commit 062a88c

Browse files
Add: Add initial WAS wrapper client library.
1 parent 076f287 commit 062a88c

7 files changed

Lines changed: 640 additions & 2 deletions

File tree

.github/workflows/ci-c.yml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -17,15 +17,15 @@ jobs:
1717
- name: Check Source Format
1818
id: check
1919
run: |
20-
clang-format -i -style=file {agent_controller,base,boreas,gmp,http,http_scanner,openvasd,osp,security_intelligence,util}/*.{c,h}
20+
clang-format -i -style=file {agent_controller,base,boreas,gmp,http,http_scanner,openvasd,osp,security_intelligence,web_application_scanner,util}/*.{c,h}
2121
git diff --exit-code
2222
- name: Report Diff
2323
if: ${{ failure() && steps.check.outcome == 'failure' }}
2424
run: |
2525
echo "## Clang Format Check" >> $GITHUB_STEP_SUMMARY
2626
echo "Found formatting issues in the source code. Please run clang-format to fix them." >> $GITHUB_STEP_SUMMARY
2727
echo '```sh' >> $GITHUB_STEP_SUMMARY
28-
echo 'clang-format -i -style=file {agent_controller,base,boreas,gmp,http,http_scanner,openvasd,osp,security_intelligence,util}/*.{c,h}' >> $GITHUB_STEP_SUMMARY
28+
echo 'clang-format -i -style=file {agent_controller,base,boreas,gmp,http,http_scanner,openvasd,osp,security_intelligence,web_application_scanner,util}/*.{c,h}' >> $GITHUB_STEP_SUMMARY
2929
echo '```' >> $GITHUB_STEP_SUMMARY
3030
echo "## Clang Format Diff" >> $GITHUB_STEP_SUMMARY
3131
echo '```diff' >> $GITHUB_STEP_SUMMARY

CMakeLists.txt

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -26,6 +26,11 @@ option(ENABLE_OPENVASD "Build openvasd library" ON)
2626
option(ENABLE_AGENTS "Build agent controller library" ON)
2727
option(ENABLE_CREDENTIAL_STORES "Build credential store library" ON)
2828
option(ENABLE_SECURITY_INTELLIGENCE "Build security intelligence library" ON)
29+
option(
30+
ENABLE_WEB_APPLICATION_SCANNER
31+
"Build web application scanner library"
32+
ON
33+
)
2934

3035
if(NOT BUILD_STATIC)
3136
set(BUILD_SHARED ON)
@@ -277,6 +282,10 @@ if(BUILD_TESTS AND NOT SKIP_SRC)
277282
list(APPEND TESTS security-intelligence-test)
278283
endif(ENABLE_SECURITY_INTELLIGENCE)
279284

285+
if(ENABLE_WEB_APPLICATION_SCANNER)
286+
list(APPEND TESTS web-application-scanner-test)
287+
endif(ENABLE_WEB_APPLICATION_SCANNER)
288+
280289
add_custom_target(tests DEPENDS ${TESTS})
281290

282291
# Code coverage
@@ -327,13 +336,15 @@ if(NOT SKIP_SRC)
327336
OR ENABLE_AGENTS
328337
OR ENABLE_CREDENTIAL_STORES
329338
OR ENABLE_SECURITY_INTELLIGENCE
339+
OR ENABLE_WEB_APPLICATION_SCANNER
330340
)
331341
add_subdirectory(http)
332342
endif(
333343
ENABLE_OPENVASD
334344
OR ENABLE_AGENTS
335345
OR ENABLE_CREDENTIAL_STORES
336346
OR ENABLE_SECURITY_INTELLIGENCE
347+
OR ENABLE_WEB_APPLICATION_SCANNER
337348
)
338349

339350
if(ENABLE_OPENVASD)
@@ -346,6 +357,13 @@ if(NOT SKIP_SRC)
346357
add_subdirectory(agent_controller)
347358
endif(ENABLE_AGENTS)
348359

360+
if(ENABLE_WEB_APPLICATION_SCANNER)
361+
if(NOT ENABLE_OPENVASD)
362+
add_subdirectory(http_scanner)
363+
endif(NOT ENABLE_OPENVASD)
364+
add_subdirectory(web_application_scanner)
365+
endif(ENABLE_WEB_APPLICATION_SCANNER)
366+
349367
if(ENABLE_CREDENTIAL_STORES)
350368
add_subdirectory(cyberark)
351369
endif(ENABLE_CREDENTIAL_STORES)
Lines changed: 116 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,116 @@
1+
# SPDX-FileCopyrightText: 2026 Greenbone AG
2+
#
3+
# SPDX-License-Identifier: GPL-2.0-or-later
4+
5+
## Library
6+
7+
include(FindPkgConfig)
8+
9+
if(NOT PKG_CONFIG_FOUND)
10+
message(FATAL_ERROR "pkg-config executable not found. Aborting.")
11+
endif(NOT PKG_CONFIG_FOUND)
12+
13+
## Dependency checks
14+
15+
pkg_check_modules(GLIB REQUIRED glib-2.0>=2.42)
16+
pkg_check_modules(CJSON REQUIRED libcjson>=1.7.14)
17+
18+
include_directories(${GLIB_INCLUDE_DIRS})
19+
20+
set(FILES web_application_scanner.c)
21+
set(HEADERS web_application_scanner.h)
22+
23+
if(BUILD_STATIC)
24+
add_library(gvm_web_application_scanner_static STATIC ${FILES})
25+
set_target_properties(
26+
gvm_web_application_scanner_static
27+
PROPERTIES OUTPUT_NAME "gvm_web_application_scanner"
28+
)
29+
set_target_properties(
30+
gvm_web_application_scanner_static
31+
PROPERTIES CLEAN_DIRECT_OUTPUT 1
32+
)
33+
set_target_properties(
34+
gvm_web_application_scanner_static
35+
PROPERTIES PUBLIC_HEADER "${HEADERS}"
36+
)
37+
endif(BUILD_STATIC)
38+
39+
if(BUILD_SHARED)
40+
add_library(gvm_web_application_scanner_shared SHARED ${FILES})
41+
set_target_properties(
42+
gvm_web_application_scanner_shared
43+
PROPERTIES OUTPUT_NAME "gvm_web_application_scanner"
44+
)
45+
set_target_properties(
46+
gvm_web_application_scanner_shared
47+
PROPERTIES CLEAN_DIRECT_OUTPUT 1
48+
)
49+
set_target_properties(
50+
gvm_web_application_scanner_shared
51+
PROPERTIES SOVERSION "${PROJECT_VERSION_MAJOR}"
52+
)
53+
set_target_properties(
54+
gvm_web_application_scanner_shared
55+
PROPERTIES VERSION "${CPACK_PACKAGE_VERSION}"
56+
)
57+
set_target_properties(
58+
gvm_web_application_scanner_shared
59+
PROPERTIES PUBLIC_HEADER "${HEADERS}"
60+
)
61+
62+
target_link_libraries(
63+
gvm_web_application_scanner_shared
64+
LINK_PRIVATE
65+
gvm_util_shared
66+
${GLIB_LDFLAGS}
67+
${CJSON_LDFLAGS}
68+
${LINKER_HARDENING_FLAGS}
69+
)
70+
endif(BUILD_SHARED)
71+
72+
## Tests
73+
74+
if(BUILD_TESTS)
75+
add_unit_test(
76+
web-application-scanner-test
77+
web_application_scanner_tests.c
78+
gvm_base_shared
79+
gvm_util_shared
80+
${GLIB_LDFLAGS}
81+
${CJSON_LDFLAGS}
82+
${LINKER_HARDENING_FLAGS}
83+
)
84+
endif(BUILD_TESTS)
85+
86+
## Install
87+
configure_file(
88+
libgvm_web_application_scanner.pc.in
89+
${CMAKE_BINARY_DIR}/libgvm_web_application_scanner.pc
90+
@ONLY
91+
)
92+
93+
install(
94+
FILES ${CMAKE_BINARY_DIR}/libgvm_web_application_scanner.pc
95+
DESTINATION ${LIBDIR}/pkgconfig
96+
)
97+
98+
if(BUILD_STATIC)
99+
install(
100+
TARGETS gvm_web_application_scanner_static
101+
RUNTIME DESTINATION ${BINDIR}
102+
ARCHIVE DESTINATION ${LIBDIR}
103+
PUBLIC_HEADER DESTINATION "${INCLUDEDIR}/gvm/web_application_scanner"
104+
)
105+
endif(BUILD_STATIC)
106+
if(BUILD_SHARED)
107+
install(
108+
TARGETS gvm_web_application_scanner_shared
109+
RUNTIME DESTINATION ${BINDIR}
110+
LIBRARY DESTINATION ${LIBDIR}
111+
ARCHIVE DESTINATION ${LIBDIR}
112+
PUBLIC_HEADER DESTINATION "${INCLUDEDIR}/gvm/web_application_scanner"
113+
)
114+
endif(BUILD_SHARED)
115+
116+
## End
Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
prefix=@CMAKE_INSTALL_PREFIX@
2+
exec_prefix=@EXEC_PREFIX@
3+
libdir=@LIBDIR@
4+
includedir=@INCLUDEDIR@
5+
6+
Name: gvmlibs-web_application_scanner
7+
Description: Greenbone Vulnerability Management Library web_application_scanner
8+
Version: @LIBGVMCONFIG_VERSION@
9+
Requires.private: glib-2.0 >= 2.42.0
10+
Cflags: -I${includedir} -I${includedir}/gvm
11+
Libs: -L${libdir} -lgvm_web_application_scanner

0 commit comments

Comments
 (0)