### Start Base HTTP Setup Source: https://github.com/greenbone/openvas-scanner/blob/main/compose/README.md Use this command to start the OpenVAS Scanner with the base HTTP service definition. This is the minimal configuration for running the scanner. ```bash podman-compose -f base.yaml up ``` -------------------------------- ### Start Setup with TLS Source: https://github.com/greenbone/openvas-scanner/blob/main/compose/README.md This command starts the OpenVAS Scanner with TLS enabled by including the `tls.yaml` file. Ensure you have generated the necessary certificates. ```bash podman-compose -f base.yaml -f tls.yaml up ``` -------------------------------- ### Start Setup with mTLS Source: https://github.com/greenbone/openvas-scanner/blob/main/compose/README.md This command starts the OpenVAS Scanner with mutual TLS (mTLS) enabled by including the `mtls.yaml` file. Client requests will require authentication using client certificates and keys. ```bash podman-compose -f base.yaml -f mtls.yaml up ``` -------------------------------- ### Example Scan Workflow using Makefile Source: https://github.com/greenbone/openvas-scanner/blob/main/compose/tests/README.md Demonstrates a typical sequence of commands to create, start, check status, retrieve results, and remove a scan named 'victim-full-and-fast'. ```bash make create-victim-full-and-fast make start-victim-full-and-fast make status-victim-full-and-fast make results-victim-full-and-fast make rm-victim-full-and-fast ``` -------------------------------- ### API Key Authentication Example Source: https://github.com/greenbone/openvas-scanner/blob/main/rust/src/openvasd/README.md This example demonstrates how to make a GET request to the /scans endpoint using an API Key for authentication. The API Key must be included in the 'X-API-KEY' header. ```bash curl --insecure --request GET https://localhost:3000/scans -H "X-API-KEY: mtls_is_preferred" ``` -------------------------------- ### Install openvas-smb Source: https://github.com/greenbone/openvas-scanner/blob/main/doc/full_installation_guide.md Installs the compiled openvas-smb module to the specified installation directory and then copies it to the root filesystem. ```shell mkdir -p $INSTALL_DIR/openvas-smb make DESTDIR=$INSTALL_DIR/openvas-smb install sudo cp -rv $INSTALL_DIR/openvas-smb/* / ``` -------------------------------- ### SNMPv3 Get and GetNext Iteration Example Source: https://github.com/greenbone/openvas-scanner/blob/main/doc/manual/nasl/built-in-functions/snmp-functions/snmpv1_getnext.md Illustrates fetching an SNMPv3 device entry and iterating through the next 6 entries using snmpv3_get and snmpv3_getnext. This example includes authentication parameters like username, passwords, and protocols for secure SNMPv3 communication. ```c++ oid = '.1.3.6.1.2.1.1.1.0'; port = 161; user = "user"; pass = "password"; passph = "password"; display("\n\n\n"); display("version 3\n"); ret = snmpv3_get(port:port, protocol:"udp", username:user, oid:oid, authpass:pass, authproto:"sha1", privpass:passph, privproto:"aes"); display (ret, "\n"); display("getnext WITH oid (optinal)"); ret = snmpv3_getnext(port:port, protocol:"udp", username:user, oid:oid, authpass:pass, authproto:"sha1", privpass:passph, privproto:"aes"); display (ret, "\n"); display("getnext WITHOUT oid (which is optional. Using the last one from the last call)"); for (i = 0; i< 5; i++) { ret = snmpv3_getnext(port:port, protocol:"udp", username:user, authpass:pass, authproto:"sha1", privpass:passph, privproto:"aes"); display (ret); } ``` -------------------------------- ### Start and Enable Systemd Services Source: https://github.com/greenbone/openvas-scanner/blob/main/doc/full_installation_guide.md Enables the services to start on boot and then starts them immediately. ```shell sudo systemctl enable ospd-openvas.service sudo systemctl start ospd-openvas.service sudo systemctl enable notus-scanner.service sudo systemctl start notus-scanner.service sudo systemctl enable openvasd.service sudo systemctl start openvasd.service ``` -------------------------------- ### Install gvm-libs Source: https://github.com/greenbone/openvas-scanner/blob/main/doc/full_installation_guide.md Installs the compiled gvm-libs component to the specified installation directory and then copies it to the root filesystem. ```shell mkdir -p $INSTALL_DIR/gvm-libs make DESTDIR=$INSTALL_DIR/gvm-libs install sudo cp -rv $INSTALL_DIR/gvm-libs/* / ``` -------------------------------- ### Install openvas-scanner Source: https://github.com/greenbone/openvas-scanner/blob/main/doc/full_installation_guide.md Installs the compiled openvas-scanner component to the specified installation directory and then copies it to the root filesystem. ```shell mkdir -p $INSTALL_DIR/openvas-scanner make DESTDIR=$INSTALL_DIR/openvas-scanner install sudo cp -rv $INSTALL_DIR/openvas-scanner/* / ``` -------------------------------- ### Start Mosquitto Broker and Configure OpenVAS Source: https://github.com/greenbone/openvas-scanner/blob/main/doc/full_installation_guide.md Starts the Mosquitto broker, enables it to start on boot, and configures the OpenVAS scanner to use the broker. ```shell sudo systemctl start mosquitto.service sudo systemctl enable mosquitto.service echo -e "mqtt_server_uri = localhost:1883\ntable_driven_lsc = yes" | sudo tee -a /etc/openvas/openvas.conf ``` -------------------------------- ### SNMPv1 Get and GetNext Example Source: https://github.com/greenbone/openvas-scanner/blob/main/doc/manual/nasl/built-in-functions/snmp-functions/snmpv2c_getnext.md Demonstrates how to retrieve an SNMPv1 network device's information using snmpv1_get and then iterate through the next 5 entries using snmpv1_getnext. The OID is required for the initial 'get' call, and subsequent 'getnext' calls can omit it. ```c++ oid = '.1.3.6.1.2.1.1.1.0'; protocol = 'udp'; port = 161; community = 'public'; display("version 1"); ret = snmpv1_get( port:port, oid:oid, protocol:protocol, community:community ); display (ret); display("\n\n\n\ngetnext version 1 "); for (i = 0; i < 5; i++) { ret = snmpv1_getnext( port:port, protocol:protocol, community:community ); display (ret); } ``` -------------------------------- ### SNMPv3 Get and GetNext Example Source: https://github.com/greenbone/openvas-scanner/blob/main/doc/manual/nasl/built-in-functions/snmp-functions/snmpv2c_getnext.md Illustrates retrieving SNMPv3 device information using snmpv3_get and then iterating through the next 6 entries with snmpv3_getnext. This example shows calls with and without an OID for 'getnext', demonstrating its optional nature after the initial call. ```c++ oid = '.1.3.6.1.2.1.1.1.0'; port = 161; user = "user"; pass = "password"; passph = "password"; display("\n\n\n"); display("version 3\n"); ret = snmpv3_get(port:port, protocol:"udp", username:user, oid:oid, authpass:pass, authproto:"sha1", privpass:passph, privproto:"aes"); display (ret, "\n"); display("getnext WITH oid (optional)"); ret = snmpv3_getnext(port:port, protocol:"udp", username:user, oid:oid, authpass:pass, authproto:"sha1", privpass:passph, privproto:"aes"); display (ret, "\n"); display("getnext WITHOUT oid (which is optional. Using the last one from the last call)"); for (i = 0; i< 5; i++) { ret = snmpv3_getnext(port:port, protocol:"udp", username:user, authpass:pass, authproto:"sha1", privpass:passph, privproto:"aes"); display (ret); } ``` -------------------------------- ### Start and Enable Redis Service for OpenVAS Source: https://github.com/greenbone/openvas-scanner/blob/main/doc/full_installation_guide.md Starts the Redis server with the OpenVAS configuration and enables it to start on system boot. ```shell sudo systemctl start redis-server@openvas.service sudo systemctl enable redis-server@openvas.service ``` -------------------------------- ### Install Man Pages Source: https://github.com/greenbone/openvas-scanner/blob/main/nasl/CMakeLists.txt Installs the man pages for 'openvas-nasl' and 'openvas-nasl-lint'. ```cmake install (FILES ${CMAKE_SOURCE_DIR}/doc/man/openvas-nasl.1 DESTINATION ${DATADIR}/man/man1 ) install (FILES ${CMAKE_SOURCE_DIR}/doc/man/openvas-nasl-lint.1 DESTINATION ${DATADIR}/man/man1 ) ``` -------------------------------- ### Install OpenVAS Configuration File Source: https://github.com/greenbone/openvas-scanner/blob/main/src/CMakeLists.txt Installs the 'openvas_log.conf' configuration file from the build directory to the OPENVAS_SYSCONF_DIR. ```cmake install (FILES ${CMAKE_BINARY_DIR}/src/openvas_log.conf DESTINATION ${OPENVAS_SYSCONF_DIR}) ``` -------------------------------- ### Install greenbone-feed-sync Source: https://github.com/greenbone/openvas-scanner/blob/main/doc/full_installation_guide.md Installs the greenbone-feed-sync tool system-wide using pip. ```shell mkdir -p $INSTALL_DIR/greenbone-feed-sync python3 -m pip install --root=$INSTALL_DIR/greenbone-feed-sync --no-warn-script-location greenbone-feed-sync sudo cp -rv $INSTALL_DIR/greenbone-feed-sync/* / ``` -------------------------------- ### Install openvas-smb Dependencies Source: https://github.com/greenbone/openvas-scanner/blob/main/doc/full_installation_guide.md Installs the necessary development packages for building the openvas-smb module. ```shell sudo apt install -y \ gcc-mingw-w64 \ libgnutls28-dev \ libglib2.0-dev \ libpopt-dev \ libunistring-dev \ heimdal-dev \ perl-base ``` -------------------------------- ### SNMPv2c Get and GetNext Example Source: https://github.com/greenbone/openvas-scanner/blob/main/doc/manual/nasl/built-in-functions/snmp-functions/snmpv2c_getnext.md Shows how to fetch SNMPv2c device information with snmpv2c_get and then iterate through the next 5 entries using snmpv2c_getnext. The OID is necessary for the first call, but subsequent 'getnext' calls will use the internally stored OID. ```c++ oid = '.1.3.6.1.2.1.1.1.0'; protocol = 'udp'; port = 161; community = 'public'; display("version 2c"); ret = snmpv2c_get( port:port, oid:oid, protocol:protocol, community:community ); display (ret, "\n"); display("getnext version 2c . No OID (optional), because it was already stored during the last call with an oid\n"); for (i = 0; i < 5; i++) { ret = snmpv2c_getnext( port:port, protocol:protocol, community:community ); display (ret); } ``` -------------------------------- ### Install Project Targets Source: https://github.com/greenbone/openvas-scanner/blob/main/misc/CMakeLists.txt Installs runtime, library, and archive files for the openvas_misc_shared target. Also installs directories for logs, data, and configuration. ```cmake install (TARGETS openvas_misc_shared RUNTIME DESTINATION ${BINDIR} LIBRARY DESTINATION ${LIBDIR} ARCHIVE DESTINATION ${LIBDIR}) ``` ```cmake install (DIRECTORY DESTINATION ${GVM_LOG_DIR}) ``` ```cmake install (DIRECTORY DESTINATION ${OPENVAS_DATA_DIR}) ``` ```cmake install (DIRECTORY DESTINATION ${OPENVAS_SYSCONF_DIR}) ``` ```cmake install (DIRECTORY DESTINATION ${OPENVAS_SYSCONF_DIR}/gnupg DIRECTORY_PERMISSIONS OWNER_EXECUTE OWNER_READ OWNER_WRITE) ``` ```cmake install (DIRECTORY DESTINATION ${OPENVAS_STATE_DIR}/gnupg DIRECTORY_PERMISSIONS OWNER_EXECUTE OWNER_READ OWNER_WRITE) ``` -------------------------------- ### Install notus-scanner Source: https://github.com/greenbone/openvas-scanner/blob/main/doc/full_installation_guide.md Installs notus-scanner using pip after cloning the source code. ```shell cd $SOURCE_DIR/notus-scanner mkdir -p $INSTALL_DIR/notus-scanner python3 -m pip install --root=$INSTALL_DIR/notus-scanner --no-warn-script-location . sudo cp -rv $INSTALL_DIR/notus-scanner/* / ``` -------------------------------- ### Install Targets Source: https://github.com/greenbone/openvas-scanner/blob/main/nasl/CMakeLists.txt Installs the built shared library and executables to their respective runtime and library directories. ```cmake install (TARGETS openvas_nasl_shared openvas-nasl openvas-nasl-lint RUNTIME DESTINATION ${BINDIR} LIBRARY DESTINATION ${LIBDIR} ARCHIVE DESTINATION ${LIBDIR}) ``` -------------------------------- ### Install ospd-openvas Source: https://github.com/greenbone/openvas-scanner/blob/main/doc/full_installation_guide.md Installs ospd-openvas using pip after cloning the source code. ```shell cd $SOURCE_DIR/ospd-openvas mkdir -p $INSTALL_DIR/ospd-openvas python3 -m pip install --root=$INSTALL_DIR/ospd-openvas --no-warn-script-location . sudo cp -rv $INSTALL_DIR/ospd-openvas/* / ``` -------------------------------- ### Install OpenVAS Man Page Source: https://github.com/greenbone/openvas-scanner/blob/main/src/CMakeLists.txt Installs the 'openvas.8' man page from the build directory to the DATADIR/man/man8. ```cmake install (FILES ${CMAKE_BINARY_DIR}/doc/man/openvas.8 DESTINATION ${DATADIR}/man/man8 ) ``` -------------------------------- ### Create Install Directory Source: https://github.com/greenbone/openvas-scanner/blob/main/doc/full_installation_guide.md Sets the INSTALL_DIR environment variable and creates a temporary directory for installation before moving artifacts to their final destination. ```shell export INSTALL_DIR=$HOME/install mkdir -p $INSTALL_DIR ``` -------------------------------- ### Install openvas-scanner Dependencies Source: https://github.com/greenbone/openvas-scanner/blob/main/doc/full_installation_guide.md Installs the core dependencies required for building the openvas-scanner component. ```shell sudo apt install -y \ bison \ libglib2.0-dev \ libgnutls28-dev \ libgcrypt20-dev \ libpcap-dev \ libgpgme-dev \ libksba-dev \ rsync \ nmap \ libjson-glib-dev \ libcurl4-gnutls-dev \ libbsd-dev ``` -------------------------------- ### Install greenbone-feed-sync Dependencies Source: https://github.com/greenbone/openvas-scanner/blob/main/doc/full_installation_guide.md Installs necessary Python packages for greenbone-feed-sync using apt. ```shell sudo apt install -y \ python3 \ python3-pip ``` -------------------------------- ### Install ospd-openvas Dependencies Source: https://github.com/greenbone/openvas-scanner/blob/main/doc/full_installation_guide.md Installs necessary Python packages for ospd-openvas using apt. ```shell sudo apt install -y \ python3 \ python3-pip \ python3-setuptools \ python3-packaging \ python3-wrapt \ python3-cffi \ python3-psutil \ python3-lxml \ python3-defusedxml \ python3-paramiko \ python3-redis \ python3-gnupg \ python3-paho-mqtt \ python3-poetry ``` -------------------------------- ### Install Redis Server Source: https://github.com/greenbone/openvas-scanner/blob/main/doc/full_installation_guide.md Installs the Redis server package required for storing VT information and scan results. ```shell sudo apt install -y redis-server ``` -------------------------------- ### Create and Start an OpenVAS Scan Source: https://github.com/greenbone/openvas-scanner/blob/main/rust/doc/resume-scan.md These shell commands demonstrate how to create a new scan using a JSON configuration file, start the scan, and then retrieve its status. ```sh curl -k --cert $CERT --key $KEY "https://localhost/scans" -d @scan.json ``` ```sh curl -k --cert $CERT --key $KEY "https://localhost/scans/$ID" -d "{ \"action\": \"start\"}" ``` ```sh curl -k --cert $CERT --key $KEY "https://localhost/scans/$ID" ``` -------------------------------- ### Build and Install scannerctl Source: https://github.com/greenbone/openvas-scanner/blob/main/rust/src/scannerctl/README.md Instructions for building and installing the scannerctl CLI tool using Cargo. Includes a check for necessary shared libraries. ```bash cargo install --path . ``` ```text > readelf -d ./scannerctl-x86_64-unknown-linux-gnu | grep NEEDED 0x0000000000000001 (NEEDED) Shared library: [libz.so.1] 0x0000000000000001 (NEEDED) Shared library: [libpcap.so.0.8] 0x0000000000000001 (NEEDED) Shared library: [libgcc_s.so.1] 0x0000000000000001 (NEEDED) Shared library: [libm.so.6] 0x0000000000000001 (NEEDED) Shared library: [libc.so.6] 0x0000000000000001 (NEEDED) Shared library: [ld-linux-x86-64.so.2] ``` -------------------------------- ### Install Rust Toolchain Source: https://github.com/greenbone/openvas-scanner/blob/main/doc/full_installation_guide.md Installs the Rust programming language toolchain, which is required for building openvasd. ```shell curl --proto '=https' --tlsv1.2 -sSf https://sh.rustup.rs | sh source "$HOME/.cargo/env" ``` -------------------------------- ### Feed Update Example Source: https://github.com/greenbone/openvas-scanner/blob/main/rust/src/scannerctl/README.md Example of updating the feed, including Notus advisories and performing a signature check. Ensure GPGHOME is set correctly. ```bash GPGHOME=/path/to/.gnupg scannerctl feed update --notus-path --signature-check ``` -------------------------------- ### Install OpenVAS Executable Source: https://github.com/greenbone/openvas-scanner/blob/main/src/CMakeLists.txt Installs the 'openvas' executable to the SBINDIR, setting specific file permissions for owner, group, and world. ```cmake install (TARGETS openvas RUNTIME DESTINATION ${SBINDIR} PERMISSIONS OWNER_EXECUTE OWNER_READ OWNER_WRITE GROUP_READ GROUP_EXECUTE WORLD_READ WORLD_EXECUTE) ``` -------------------------------- ### Install Mosquitto MQTT Broker Source: https://github.com/greenbone/openvas-scanner/blob/main/doc/full_installation_guide.md Installs the Mosquitto MQTT broker, which is used for communication between scanner components. ```shell sudo apt install -y mosquitto ``` -------------------------------- ### Install OpenVAS Helm Chart Source: https://github.com/greenbone/openvas-scanner/blob/main/charts/openvasd/README.md Installs the openvasd Helm chart from a local path, allowing for custom value overrides. ```bash helm install openvasd ./openvasd/ -f openvasd/values.yaml --namespace openvasd --create-namespace openvasd ``` ```bash helm install --namespace openvasd --create-namespace openvasd openvasd/ --values openvasd/values.yaml --values openvasd/http-root.yaml ``` -------------------------------- ### Start a Scan using Makefile Source: https://github.com/greenbone/openvas-scanner/blob/main/compose/tests/README.md Starts a previously created scan. The scan name should correspond to a defined JSON file. ```bash make start- ``` -------------------------------- ### Container Image Scanner Configuration Example Source: https://github.com/greenbone/openvas-scanner/blob/main/rust/doc/container-image-scanner-configuration.md This TOML snippet shows a complete example of the container image scanner configuration section. ```toml [container_image_scanner.image] extract_to = "/var/lib/openvasd/cis" scanning_retries = 5 max_scanning = 10 batch_size = 2 retry_timeout = "1s" ``` -------------------------------- ### Install OpenVAS Build Source: https://github.com/greenbone/openvas-scanner/blob/main/INSTALL.md Installs the compiled OpenVAS scanner to the specified or default location. This command may require root privileges. ```bash make install ``` -------------------------------- ### Connect to WMI and Query Information Source: https://github.com/greenbone/openvas-scanner/blob/main/doc/manual/nasl/built-in-functions/wmi-functions/wmi_connect_rsop.md This example demonstrates how to connect to a WMI service using provided credentials and options, query system information, and then close the WMI connection. It retrieves username and password from KB items, constructs the username with domain if available, and sets the 'sign' option for the WMI connection. Access success is then logged to KB items. ```c# usrname = get_kb_item( "SMB/login" ); passwd = get_kb_item( "SMB/password" ); if(!usrname || !passwd) exit( 0 ); domain = get_kb_item( "SMB/domain" ); if( domain ) usrname = domain + '\\' + usrname; opts = "[sign]"; handle = wmi_connect(username:usrname, password:passwd, options:opts); if( ! handle ) exit( 0 ); a = wmi_query( wmi_handle:handle, query:"select * from Win32_ComputerSystem"); display (a); wmi_close( wmi_handle:handle ); set_kb_item( name:"WMI/access_successful", value:TRUE ); set_kb_item( name:"SMB_or_WMI/access_successful", value:TRUE ); ``` -------------------------------- ### Get Performance Data with OSP Source: https://github.com/greenbone/openvas-scanner/blob/main/rust/doc/openvasd-osp-cmd-equivalence.md Use the `` OSP command with `start`, `end`, and `title` parameters to retrieve performance data, such as CPU usage. ```xml ``` -------------------------------- ### Create a KB List Source: https://github.com/greenbone/openvas-scanner/blob/main/doc/manual/nasl/built-in-functions/knowledge-base/set_kb_item.md Demonstrates how to create a list in the KB by calling set_kb_item multiple times with the same name but different values. This allows storing multiple related pieces of information under a single key. ```nasl set_kb_item(name: "hosts", value: "foo"); set_kb_item(name: "hosts", value: "bar"); ``` -------------------------------- ### Get SSL Cipher Suite from TCP Socket Source: https://github.com/greenbone/openvas-scanner/blob/main/doc/manual/nasl/built-in-functions/tls/socket_get_ssl_ciphersuite.md This example demonstrates how to open a TCP socket and then retrieve its SSL/TLS cipher suite using socket_get_ssl_ciphersuite. It includes basic error handling for socket opening. ```nasl port = 22; soc = open_sock_tcp( port ); if ( !soc ) exit(1); ciphersuite = socket_get_ssl_ciphersuite( socket:soc ); ``` -------------------------------- ### Fetch Scan Results with Scanner API Source: https://github.com/greenbone/openvas-scanner/blob/main/rust/doc/openvasd-osp-cmd-equivalence.md The Scanner API uses a GET request to `/scans/{scan_id}/results` to fetch scan results. A `range` query parameter can be used to specify the start and end of the results to retrieve. ```cmd Method: GET Endpoint: /scans/{scan_id}/results?range=0-9 Parameter scan_id: is de Scan ID. Optional Query: ?range=start-end, where end is optional as well. ``` -------------------------------- ### Build HTML Manual Source: https://github.com/greenbone/openvas-scanner/blob/main/INSTALL.md Generates the manual for OpenVAS in HTML format. This command is executed from the build directory. ```bash make manual ``` -------------------------------- ### Create and Navigate to Build Directory Source: https://github.com/greenbone/openvas-scanner/blob/main/INSTALL.md Creates a new directory named 'build' and changes the current directory to it. This is a standard practice for out-of-source builds. ```bash mkdir build cd build ``` -------------------------------- ### Install openvasd and scannerctl Source: https://github.com/greenbone/openvas-scanner/blob/main/doc/full_installation_guide.md Copies the compiled openvasd binary and the scannerctl utility to the system's bin directory. ```shell sudo cp -rv $BUILD_DIR/openvasd/release/openvasd $INSTALL_PREFIX/bin/ sudo cp -rv $BUILD_DIR/openvasd/release/scannerctl $INSTALL_PREFIX/bin/ ``` -------------------------------- ### Insert String with Start and End Index Source: https://github.com/greenbone/openvas-scanner/blob/main/doc/manual/nasl/built-in-functions/string-functions/insstr.md Use this to replace a specific slice of a string. The replacement starts at the given start index and ends at the given end index. ```csharp a = insstr('aaaa', 'b', 2, 2); display(a); # Displays aaba ``` -------------------------------- ### Format and Display HTTP POST Request Source: https://github.com/greenbone/openvas-scanner/blob/main/doc/manual/nasl/built-in-functions/http-functions/http_post.md This example demonstrates how to use http_post to create a POST request with specified data and then display the resulting formatted request string. Ensure the port and URL are correctly set for your target server. ```cpp data = "some data"; req = http_post(port: 80, item: "http://localhost/index.html", data: data); display (req); ``` -------------------------------- ### Write Data to a File using file_write Source: https://github.com/greenbone/openvas-scanner/blob/main/doc/manual/nasl/built-in-functions/unsafe/file_write.md This example demonstrates opening a file in write mode, writing data to it using file_write, and then closing the file descriptor. Ensure the file is opened before attempting to write. ```nasl fd = file_open(name: "foo/bar.txt", mode: "w"); file_write(fp: fd, data: "put some useful text in here"); file_close(fd); ``` -------------------------------- ### Start Scan with Scanner API Source: https://github.com/greenbone/openvas-scanner/blob/main/rust/doc/openvasd-osp-cmd-equivalence.md Second step to start a scan using the Scanner API. This POST request to the /scans/{scan_id} endpoint starts a previously created scan task. ```cmd Method: POST Endpoint: /scans/{scan_id} Parameter scan_id: : is de Scan ID ``` ```json {"action": "start"} ``` -------------------------------- ### Format and Display HTTP Request using http_get Source: https://github.com/greenbone/openvas-scanner/blob/main/doc/manual/nasl/built-in-functions/http-functions/http_get.md This example demonstrates how to use http_get to format an HTTP request for a given URL and port, and then display the resulting request string. The 'data' argument is not used. ```cpp url = "http://localhost/"; file = url + "index.html"; req = http_get(port: 80, item: file); display (req); ``` -------------------------------- ### Retrieve GSSAPI Session Key Source: https://github.com/greenbone/openvas-scanner/blob/main/doc/manual/nasl/built-in-functions/krb5/krb5_gss_session_key.md This example demonstrates how to prepare a GSSAPI context, update it, and then retrieve the session key using krb5_gss_session_key. It checks for failures at each step and exits if the context preparation or update fails, or if more context updates are needed. ```nasl login = string( get_kb_item( "KRB5/login_filled/0" ) ); password = string( get_kb_item( "KRB5/password_filled/0" ) ); realm = string( get_kb_item( "KRB5/realm_filled/0" ) ); kdc = string( get_kb_item( "KRB5/kdc_filled/0" ) ); host = ip_reverse_lookup(); # must be a domain name. result = krb5_gss_prepare_context(realm: realm, kdc: kdc, host: host, service: 'cifs', user: login, password: passwod); if (krb5_is_failure(result)) { exit(42); } if (krb5_is_failure(krb5_gss_update_context())) { exit(42); } if (krb5_update_context_needs_more()) { session_key = krb5_gss_session_key(); } ``` -------------------------------- ### Install notus-scanner Dependencies Source: https://github.com/greenbone/openvas-scanner/blob/main/doc/full_installation_guide.md Installs necessary Python packages for notus-scanner using apt. ```shell sudo apt install -y \ python3 \ python3-pip \ python3-setuptools \ python3-paho-mqtt \ python3-psutil \ python3-gnupg ``` -------------------------------- ### Build and Run Smoke Tests with Makefile Source: https://github.com/greenbone/openvas-scanner/blob/main/smoketest_lint/README.md Use this command to build, run, and clean the smoke tests. Ensure Go is installed locally. ```makefile make all ``` -------------------------------- ### Install Optional gvm-libs Dependencies Source: https://github.com/greenbone/openvas-scanner/blob/main/doc/full_installation_guide.md Installs optional development libraries that can enhance gvm-libs functionality. ```shell sudo apt install -y \ libldap2-dev \ libradcli-dev ``` -------------------------------- ### Create and Retrieve KB Item Source: https://github.com/greenbone/openvas-scanner/blob/main/doc/manual/nasl/built-in-functions/knowledge-base/get_kb_item.md Demonstrates how to set a KB item and then retrieve its value using get_kb_item. The retrieved value is then displayed. ```nasl set_kb_item(name: "foo", value: "bar"); display(get_kb_item("foo")); # should print bar ``` -------------------------------- ### Install Systemd Service Files Source: https://github.com/greenbone/openvas-scanner/blob/main/doc/full_installation_guide.md Copies the generated systemd service files to the systemd system directory. ```shell sudo cp -v $BUILD_DIR/ospd-openvas.service /etc/systemd/system/ sudo cp -v $BUILD_DIR/notus-scanner.service /etc/systemd/system/ sudo cp -v $BUILD_DIR/openvasd.service /etc/systemd/system/ ``` -------------------------------- ### Example: Split string discarding separator Source: https://github.com/greenbone/openvas-scanner/blob/main/doc/manual/nasl/built-in-functions/string-functions/split.md This example demonstrates splitting a string and discarding the separator. ```APIDOC ## Example: Split string discarding separator ### Description Splits the string "aabaabaa" using "b" as a separator and discards the separator. ### Code ```c# a = split("aabaabaa", sep: "b", keep: FALSE); display(a); ``` ### Output ``` [ 0: 'aa', 1: 'aa', 2: 'aa' ] ``` ``` -------------------------------- ### Example: Split string with keeping separator Source: https://github.com/greenbone/openvas-scanner/blob/main/doc/manual/nasl/built-in-functions/string-functions/split.md This example demonstrates splitting a string and keeping the separator. ```APIDOC ## Example: Split string with keeping separator ### Description Splits the string "aabaabaa" using "b" as a separator and keeps the separator. ### Code ```c# a = split("aabaabaa", sep: "b"); display(a); ``` ### Output ``` [ 0: 'aab', 1: 'aab', 2: 'aa' ] ``` ``` -------------------------------- ### krb5_gss_init Source: https://github.com/greenbone/openvas-scanner/blob/main/doc/manual/nasl/built-in-functions/krb5/index.md Initialize the krb5 GSS-API library. ```APIDOC ## krb5_gss_init ### Description Initializes the Kerberos Generic Security Services Application Program Interface (GSS-API) library. ### Returns * (int) - 0 on success, a negative value on failure. ``` -------------------------------- ### Build Full Developer Documentation Source: https://github.com/greenbone/openvas-scanner/blob/main/INSTALL.md Generates more comprehensive, developer-oriented documentation for OpenVAS using Doxygen. This command is executed from the build directory. ```bash make doxygen-full ``` -------------------------------- ### Example Usage of forge_tcp_packet Source: https://github.com/greenbone/openvas-scanner/blob/main/doc/manual/nasl/built-in-functions/raw-ip-functions/forge_tcp_packet.md An example demonstrating how to use forge_tcp_packet to create a TCP packet and then dump it. ```APIDOC ## Example **1** Dump the forged tcp packet: ```cpp ip_packet = forge_ip_packet(ip_v : 4, ip_hl : 5, ip_tos : 0, ip_len : 20, ip_id : 0xFEAF, ip_p : IPPROTO_TCP, ip_ttl : 255, ip_off : 0, ip_src : 192.168.0.1, ip_dst : 192.168.0.12); tcp_packet = forge_tcp_packet(ip: ip_packet, th_sport: 5080, th_dport: 80, th_seq: 1000, th_ack: 0, th_x2: 0, th_off: 5, th_flags: TH_SYN, th_win: 0, th_sum: 0, th_urp: 0); dump_tcp_packet (ip_packet); ``` ``` -------------------------------- ### Build XML Documentation Source: https://github.com/greenbone/openvas-scanner/blob/main/INSTALL.md Generates the documentation for OpenVAS in XML format using Doxygen. This command is executed from the build directory. ```bash make doxygen-xml ``` -------------------------------- ### Install Optional openvas-scanner Dependencies Source: https://github.com/greenbone/openvas-scanner/blob/main/doc/full_installation_guide.md Installs optional dependencies for openvas-scanner, such as Python modules for enhanced functionality. ```shell sudo apt install -y \ python3-impacket \ libsnmp-dev ``` -------------------------------- ### Performing an HTTP2 POST Request Source: https://github.com/greenbone/openvas-scanner/blob/main/doc/manual/nasl/built-in-functions/http2-functions/http2_post.md This example demonstrates how to create an HTTP2 handle, perform a POST request using http2_post with 'http' schema, and then display the response and return code. Ensure the handle is created before making the request. ```cpp h = http2_handle(); display(h); r = http2_post(handle:h, port:3000, item:"/scan", schema:"http", data:"bad scan config format"); display("response: ", r); rc = http2_get_response_code(handle:h); display("return code: ", rc); ```