├── .clang-format ├── .codecov.yml ├── .devcontainer ├── Dockerfile ├── Makefile ├── build-cmake-project.sh ├── build-gvm-libs ├── build-openvas ├── devcontainer.json ├── github-clone.sh └── prepare-user-dirs.sh ├── .docker ├── openvas.conf ├── prod-oldstable.Dockerfile ├── prod-testing.Dockerfile ├── prod.Dockerfile └── railguards │ ├── README.md │ └── debian_stable.Dockerfile ├── .dockerignore ├── .github ├── CODEOWNERS ├── ISSUE_TEMPLATE │ ├── bug-report.md │ └── config.yml ├── PULL_REQUEST_TEMPLATE.md ├── actions │ ├── compile-aarch64 │ │ └── action.yml │ ├── compile-x86_64 │ │ └── action.yml │ └── setup-rust │ │ └── action.yml ├── check-c-formatting.sh ├── dependabot.yml ├── enhance_version.sh ├── install-openvas-dependencies.sh ├── prepare-feed.sh ├── sign-assets.sh └── workflows │ ├── README.md │ ├── auto_label.yml │ ├── build.yml │ ├── codeql.yml │ ├── control.yml │ ├── dependency-review.yml │ ├── functional.yaml │ ├── helm-release-on-tag.yml │ ├── init.yaml │ ├── linting.yml │ ├── push-container-oldstable.yml │ ├── push-container-testing.yml │ ├── push-container.yml │ ├── push-helm-chart.yml │ ├── release.yml │ ├── sbom-upload.yml │ └── tests.yml ├── .gitignore ├── .mergify.yml ├── .pontos-header-ignore ├── CHANGELOG.md ├── CMakeLists.txt ├── COPYING ├── INSTALL.md ├── README.md ├── RELICENSE ├── GFoti.md ├── NickKotsakidis.md ├── README.md ├── RuffaloLavoisier.md ├── doraeric.md ├── sepehrdaddev.md └── template │ └── template.txt ├── VERSION.in ├── changelog.toml ├── charts ├── .gitignore ├── Makefile └── openvasd │ ├── .helmignore │ ├── Chart.yaml │ ├── README.md │ ├── http-root.yaml │ ├── mtls-wo-ingress.yaml │ ├── templates │ ├── NOTES.txt │ ├── _helpers.tpl │ ├── deployment.yaml │ ├── routing.yaml │ ├── service.yaml │ ├── serviceaccount.yaml │ └── tests │ │ └── test-connection.yaml │ └── values.yaml ├── check_license_headers.bash ├── cmake └── GetGit.cmake ├── config └── redis-openvas.conf ├── doc ├── .gitignore ├── CMakeLists.txt ├── Doxyfile.in ├── Doxyfile_full.in ├── Doxyfile_xml.in ├── README.md ├── full_installation_guide.md ├── html.sh ├── images │ └── scanner_run_loop.svg ├── man.sh ├── man │ ├── openvas-nasl-lint.1 │ ├── openvas-nasl.1 │ └── openvas.8.in ├── manual │ ├── index.md │ ├── nasl │ │ ├── built-in-functions │ │ │ ├── built-in-plugins │ │ │ │ ├── index.md │ │ │ │ ├── plugin_run_find_service.md │ │ │ │ ├── plugin_run_openvas_tcp_scanner.md │ │ │ │ └── plugin_run_synscan.md │ │ │ ├── cert-functions │ │ │ │ ├── cert_close.md │ │ │ │ ├── cert_open.md │ │ │ │ ├── cert_query.md │ │ │ │ └── index.md │ │ │ ├── cryptographic │ │ │ │ ├── DES.md │ │ │ │ ├── HMAC_MD2.md │ │ │ │ ├── HMAC_MD5.md │ │ │ │ ├── HMAC_RIPEMD160.md │ │ │ │ ├── HMAC_SHA1.md │ │ │ │ ├── HMAC_SHA256.md │ │ │ │ ├── HMAC_SHA384.md │ │ │ │ ├── HMAC_SHA512.md │ │ │ │ ├── MD2.md │ │ │ │ ├── MD4.md │ │ │ │ ├── MD5.md │ │ │ │ ├── NTLMv1_HASH.md │ │ │ │ ├── NTLMv2_HASH.md │ │ │ │ ├── RIPEMD160.md │ │ │ │ ├── SHA1.md │ │ │ │ ├── SHA256.md │ │ │ │ ├── SHA512.md │ │ │ │ ├── aes128_cbc_encrypt.md │ │ │ │ ├── aes128_ccm_decrypt.md │ │ │ │ ├── aes128_ccm_decrypt_auth.md │ │ │ │ ├── aes128_ccm_encrypt.md │ │ │ │ ├── aes128_ccm_encrypt_auth.md │ │ │ │ ├── aes128_ctr_encrypt.md │ │ │ │ ├── aes128_gcm_decrypt.md │ │ │ │ ├── aes128_gcm_decrypt_auth.md │ │ │ │ ├── aes128_gcm_encrypt.md │ │ │ │ ├── aes128_gcm_encrypt_auth.md │ │ │ │ ├── aes256_cbc_encrypt.md │ │ │ │ ├── aes256_ccm_decrypt.md │ │ │ │ ├── aes256_ccm_decrypt_auth.md │ │ │ │ ├── aes256_ccm_encrypt.md │ │ │ │ ├── aes256_ccm_encrypt_auth.md │ │ │ │ ├── aes256_ctr_encrypt.md │ │ │ │ ├── aes256_gcm_decrypt.md │ │ │ │ ├── aes256_gcm_decrypt_auth.md │ │ │ │ ├── aes256_gcm_encrypt.md │ │ │ │ ├── aes256_gcm_encrypt_auth.md │ │ │ │ ├── aes_mac_cbc.md │ │ │ │ ├── aes_mac_gcm.md │ │ │ │ ├── bf_cbc_decrypt.md │ │ │ │ ├── bf_cbc_encrypt.md │ │ │ │ ├── bn_cmp.md │ │ │ │ ├── bn_random.md │ │ │ │ ├── close_stream_cipher.md │ │ │ │ ├── des_ede_cbc_encrypt.md │ │ │ │ ├── dh_compute_key.md │ │ │ │ ├── dh_generate_key.md │ │ │ │ ├── dsa_do_sign.md │ │ │ │ ├── dsa_do_verify.md │ │ │ │ ├── get_signature.md │ │ │ │ ├── get_smb2_signature.md │ │ │ │ ├── index.md │ │ │ │ ├── insert_hexzeros.md │ │ │ │ ├── key_exchange.md │ │ │ │ ├── lm_owf_gen.md │ │ │ │ ├── nt_owf_gen.md │ │ │ │ ├── ntlm2_response.md │ │ │ │ ├── ntlm_response.md │ │ │ │ ├── ntlmv2_response.md │ │ │ │ ├── ntv2_owf_gen.md │ │ │ │ ├── open_rc4_cipher.md │ │ │ │ ├── pem_to_dsa.md │ │ │ │ ├── pem_to_rsa.md │ │ │ │ ├── prf_sha256.md │ │ │ │ ├── prf_sha384.md │ │ │ │ ├── rc4_encrypt.md │ │ │ │ ├── rsa_private_decrypt.md │ │ │ │ ├── rsa_public_decrypt.md │ │ │ │ ├── rsa_public_encrypt.md │ │ │ │ ├── rsa_sign.md │ │ │ │ ├── smb3kdf.md │ │ │ │ ├── smb_cmac_aes_signature.md │ │ │ │ ├── smb_gmac_aes_signature.md │ │ │ │ └── tls1_prf.md │ │ │ ├── description-functions │ │ │ │ ├── index.md │ │ │ │ ├── script_add_preference.md │ │ │ │ ├── script_category.md │ │ │ │ ├── script_copyright.md │ │ │ │ ├── script_cve_id.md │ │ │ │ ├── script_dependencies.md │ │ │ │ ├── script_exclude_keys.md │ │ │ │ ├── script_family.md │ │ │ │ ├── script_mandatory_keys.md │ │ │ │ ├── script_name.md │ │ │ │ ├── script_oid.md │ │ │ │ ├── script_require_keys.md │ │ │ │ ├── script_require_ports.md │ │ │ │ ├── script_require_udp_ports.md │ │ │ │ ├── script_tag.md │ │ │ │ ├── script_timeout.md │ │ │ │ ├── script_version.md │ │ │ │ └── script_xref.md │ │ │ ├── glue-functions │ │ │ │ ├── get_preference.md │ │ │ │ ├── get_script_oid.md │ │ │ │ ├── index.md │ │ │ │ ├── safe_checks.md │ │ │ │ ├── script_get_preference.md │ │ │ │ ├── script_get_preference_file_content.md │ │ │ │ ├── script_get_preference_file_location.md │ │ │ │ └── vendor_version.md │ │ │ ├── host-functions │ │ │ │ ├── TARGET_IS_IPV6.md │ │ │ │ ├── add_host_name.md │ │ │ │ ├── get_host_name.md │ │ │ │ ├── get_host_name_source.md │ │ │ │ ├── get_host_names.md │ │ │ │ ├── index.md │ │ │ │ ├── ip_reverse_lookup.md │ │ │ │ ├── resolve_host_name.md │ │ │ │ ├── resolve_hostname_to_multiple_ips.md │ │ │ │ └── same_host.md │ │ │ ├── http-functions │ │ │ │ ├── cgibin.md │ │ │ │ ├── http_close_socket.md │ │ │ │ ├── http_delete.md │ │ │ │ ├── http_get.md │ │ │ │ ├── http_head.md │ │ │ │ ├── http_open_socket.md │ │ │ │ ├── http_post.md │ │ │ │ ├── http_put.md │ │ │ │ └── index.md │ │ │ ├── http2-functions │ │ │ │ ├── http2_close_handle.md │ │ │ │ ├── http2_delete.md │ │ │ │ ├── http2_get.md │ │ │ │ ├── http2_get_response_code.md │ │ │ │ ├── http2_handle.md │ │ │ │ ├── http2_head.md │ │ │ │ ├── http2_post.md │ │ │ │ ├── http2_put.md │ │ │ │ ├── http2_set_custom_header.md │ │ │ │ └── index.md │ │ │ ├── index.md │ │ │ ├── isotime-functions │ │ │ │ ├── index.md │ │ │ │ ├── isotime_add.md │ │ │ │ ├── isotime_is_valid.md │ │ │ │ ├── isotime_now.md │ │ │ │ ├── isotime_print.md │ │ │ │ └── isotime_scan.md │ │ │ ├── knowledge-base │ │ │ │ ├── get_host_kb_index.md │ │ │ │ ├── get_kb_item.md │ │ │ │ ├── get_kb_list.md │ │ │ │ ├── index.md │ │ │ │ ├── replace_kb_item.md │ │ │ │ └── set_kb_item.md │ │ │ ├── krb5 │ │ │ │ ├── krb5_error_code_to_string.md │ │ │ │ ├── krb5_find_kdc.md │ │ │ │ ├── krb5_gss_init.md │ │ │ │ ├── krb5_gss_prepare_context.md │ │ │ │ ├── krb5_gss_session_key.md │ │ │ │ ├── krb5_gss_update_context.md │ │ │ │ ├── krb5_gss_update_context_needs_more.md │ │ │ │ ├── krb5_gss_update_context_out.md │ │ │ │ ├── krb5_is_failure.md │ │ │ │ └── krb5_is_success.md │ │ │ ├── misc │ │ │ │ ├── dec2str.md │ │ │ │ ├── defined_func.md │ │ │ │ ├── dump_ctxt.md │ │ │ │ ├── exit.md │ │ │ │ ├── get_byte_order.md │ │ │ │ ├── gettimeofday.md │ │ │ │ ├── gunzip.md │ │ │ │ ├── gzip.md │ │ │ │ ├── index.md │ │ │ │ ├── isnull.md │ │ │ │ ├── keys.md │ │ │ │ ├── localtime.md │ │ │ │ ├── make_array.md │ │ │ │ ├── make_list.md │ │ │ │ ├── max_index.md │ │ │ │ ├── mktime.md │ │ │ │ ├── rand.md │ │ │ │ ├── sleep.md │ │ │ │ ├── sort.md │ │ │ │ ├── typeof.md │ │ │ │ ├── unixtime.md │ │ │ │ └── usleep.md │ │ │ ├── network-functions │ │ │ │ ├── close.md │ │ │ │ ├── end_denial.md │ │ │ │ ├── ftp_get_pasv_port.md │ │ │ │ ├── ftp_log_in.md │ │ │ │ ├── get_host_ip.md │ │ │ │ ├── get_host_open_port.md │ │ │ │ ├── get_mtu.md │ │ │ │ ├── get_port_state.md │ │ │ │ ├── get_port_transport.md │ │ │ │ ├── get_source_port.md │ │ │ │ ├── get_tcp_port_state.md │ │ │ │ ├── get_udp_port_state.md │ │ │ │ ├── index.md │ │ │ │ ├── islocalhost.md │ │ │ │ ├── islocalnet.md │ │ │ │ ├── join_multicast_group.md │ │ │ │ ├── leave_multicast_group.md │ │ │ │ ├── open_priv_sock_tcp.md │ │ │ │ ├── open_priv_sock_udp.md │ │ │ │ ├── open_sock_kdc.md │ │ │ │ ├── open_sock_tcp.md │ │ │ │ ├── open_sock_udp.md │ │ │ │ ├── recv.md │ │ │ │ ├── recv_line.md │ │ │ │ ├── scanner_add_port.md │ │ │ │ ├── scanner_get_port.md │ │ │ │ ├── send.md │ │ │ │ ├── start_denial.md │ │ │ │ ├── telnet_init.md │ │ │ │ ├── this_host.md │ │ │ │ └── this_host_name.md │ │ │ ├── raw-ip-functions │ │ │ │ ├── dump_frame.md │ │ │ │ ├── dump_icmp_packet.md │ │ │ │ ├── dump_icmp_v6_packet.md │ │ │ │ ├── dump_ip_packet.md │ │ │ │ ├── dump_ip_v6_packet.md │ │ │ │ ├── dump_ipv6_packet.md │ │ │ │ ├── dump_tcp_packet.md │ │ │ │ ├── dump_tcp_v6_packet.md │ │ │ │ ├── dump_udp_packet.md │ │ │ │ ├── dump_udp_v6_packet.md │ │ │ │ ├── forge_frame.md │ │ │ │ ├── forge_icmp_packet.md │ │ │ │ ├── forge_icmp_v6_packet.md │ │ │ │ ├── forge_igmp_packet.md │ │ │ │ ├── forge_igmp_v6_packet.md │ │ │ │ ├── forge_ip_packet.md │ │ │ │ ├── forge_ip_v6_packet.md │ │ │ │ ├── forge_ipv6_packet.md │ │ │ │ ├── forge_tcp_packet.md │ │ │ │ ├── forge_tcp_v6_packet.md │ │ │ │ ├── forge_udp_packet.md │ │ │ │ ├── forge_udp_v6_packet.md │ │ │ │ ├── get_icmp_element.md │ │ │ │ ├── get_icmp_v6_element.md │ │ │ │ ├── get_ip_element.md │ │ │ │ ├── get_ip_v6_element.md │ │ │ │ ├── get_ipv6_element.md │ │ │ │ ├── get_local_mac_address_from_ip.md │ │ │ │ ├── get_tcp_element.md │ │ │ │ ├── get_tcp_option.md │ │ │ │ ├── get_tcp_v6_element.md │ │ │ │ ├── get_tcp_v6_option.md │ │ │ │ ├── get_udp_element.md │ │ │ │ ├── get_udp_v6_element.md │ │ │ │ ├── index.md │ │ │ │ ├── insert_ip_options.md │ │ │ │ ├── insert_ip_v6_options.md │ │ │ │ ├── insert_ipv6_options.md │ │ │ │ ├── insert_tcp_options.md │ │ │ │ ├── insert_tcp_v6_options.md │ │ │ │ ├── pcap_next.md │ │ │ │ ├── send_arp_request.md │ │ │ │ ├── send_capture.md │ │ │ │ ├── send_frame.md │ │ │ │ ├── send_packet.md │ │ │ │ ├── send_v6packet.md │ │ │ │ ├── set_ip_elements.md │ │ │ │ ├── set_ip_v6_elements.md │ │ │ │ ├── set_ipv6_elements.md │ │ │ │ ├── set_tcp_elements.md │ │ │ │ ├── set_tcp_v6_elements.md │ │ │ │ ├── set_udp_elements.md │ │ │ │ ├── set_udp_v6_elements.md │ │ │ │ ├── tcp_ping.md │ │ │ │ └── tcp_v6_ping.md │ │ │ ├── regular-expressions │ │ │ │ ├── egrep.md │ │ │ │ ├── ereg.md │ │ │ │ ├── ereg_replace.md │ │ │ │ ├── eregmatch.md │ │ │ │ └── index.md │ │ │ ├── report-functions │ │ │ │ ├── error_message.md │ │ │ │ ├── index.md │ │ │ │ ├── log_message.md │ │ │ │ ├── scanner_status.md │ │ │ │ └── security_message.md │ │ │ ├── smb-functions │ │ │ │ ├── index.md │ │ │ │ ├── smb_close.md │ │ │ │ ├── smb_connect.md │ │ │ │ ├── smb_file_SDDL.md │ │ │ │ ├── smb_file_group_sid.md │ │ │ │ ├── smb_file_owner_sid.md │ │ │ │ ├── smb_file_trustee_rights.md │ │ │ │ ├── smb_versioninfo.md │ │ │ │ └── win_cmd_exec.md │ │ │ ├── snmp-functions │ │ │ │ ├── index.md │ │ │ │ ├── snmpv1_get.md │ │ │ │ ├── snmpv1_getnext.md │ │ │ │ ├── snmpv2c_get.md │ │ │ │ ├── snmpv2c_getnext.md │ │ │ │ ├── snmpv3_get.md │ │ │ │ └── snmpv3_getnext.md │ │ │ ├── ssh-functions │ │ │ │ ├── index.md │ │ │ │ ├── sftp_enabled_check.md │ │ │ │ ├── ssh_connect.md │ │ │ │ ├── ssh_disconnect.md │ │ │ │ ├── ssh_execute_netconf_subsystem.md │ │ │ │ ├── ssh_get_auth_methods.md │ │ │ │ ├── ssh_get_host_key.md │ │ │ │ ├── ssh_get_issue_banner.md │ │ │ │ ├── ssh_get_server_banner.md │ │ │ │ ├── ssh_get_sock.md │ │ │ │ ├── ssh_login_interactive.md │ │ │ │ ├── ssh_login_interactive_pass.md │ │ │ │ ├── ssh_request_exec.md │ │ │ │ ├── ssh_session_id_from_sock.md │ │ │ │ ├── ssh_set_login.md │ │ │ │ ├── ssh_shell_close.md │ │ │ │ ├── ssh_shell_open.md │ │ │ │ ├── ssh_shell_read.md │ │ │ │ ├── ssh_shell_write.md │ │ │ │ └── ssh_userauth.md │ │ │ ├── string-functions │ │ │ │ ├── chomp.md │ │ │ │ ├── crap.md │ │ │ │ ├── display.md │ │ │ │ ├── hex.md │ │ │ │ ├── hexstr.md │ │ │ │ ├── index.md │ │ │ │ ├── insstr.md │ │ │ │ ├── int.md │ │ │ │ ├── match.md │ │ │ │ ├── ord.md │ │ │ │ ├── raw_string.md │ │ │ │ ├── split.md │ │ │ │ ├── str_replace.md │ │ │ │ ├── strcat.md │ │ │ │ ├── stridx.md │ │ │ │ ├── string.md │ │ │ │ ├── strlen.md │ │ │ │ ├── strstr.md │ │ │ │ ├── substr.md │ │ │ │ ├── tolower.md │ │ │ │ └── toupper.md │ │ │ ├── tls │ │ │ │ ├── get_sock_info.md │ │ │ │ ├── index.md │ │ │ │ ├── socket_cert_verify.md │ │ │ │ ├── socket_check_ssl_safe_renegotiation.md │ │ │ │ ├── socket_get_cert.md │ │ │ │ ├── socket_get_error.md │ │ │ │ ├── socket_get_ssl_ciphersuite.md │ │ │ │ ├── socket_get_ssl_session_id.md │ │ │ │ ├── socket_get_ssl_version.md │ │ │ │ ├── socket_negotiate_ssl.md │ │ │ │ └── socket_ssl_do_handshake.md │ │ │ ├── unsafe │ │ │ │ ├── file_close.md │ │ │ │ ├── file_open.md │ │ │ │ ├── file_read.md │ │ │ │ ├── file_seek.md │ │ │ │ ├── file_stat.md │ │ │ │ ├── file_write.md │ │ │ │ ├── find_in_path.md │ │ │ │ ├── fread.md │ │ │ │ ├── fwrite.md │ │ │ │ ├── get_tmp_dir.md │ │ │ │ ├── index.md │ │ │ │ ├── pread.md │ │ │ │ └── unlink.md │ │ │ └── wmi-functions │ │ │ │ ├── index.md │ │ │ │ ├── wmi_close.md │ │ │ │ ├── wmi_connect.md │ │ │ │ ├── wmi_connect_reg.md │ │ │ │ ├── wmi_connect_rsop.md │ │ │ │ ├── wmi_query.md │ │ │ │ ├── wmi_query_rsop.md │ │ │ │ ├── wmi_reg_create_key.md │ │ │ │ ├── wmi_reg_delete_key.md │ │ │ │ ├── wmi_reg_enum_key.md │ │ │ │ ├── wmi_reg_enum_value.md │ │ │ │ ├── wmi_reg_get_bin_val.md │ │ │ │ ├── wmi_reg_get_dword_val.md │ │ │ │ ├── wmi_reg_get_ex_string_val.md │ │ │ │ ├── wmi_reg_get_mul_string_val.md │ │ │ │ ├── wmi_reg_get_qword_val.md │ │ │ │ ├── wmi_reg_get_sz.md │ │ │ │ ├── wmi_reg_set_dword_val.md │ │ │ │ ├── wmi_reg_set_ex_string_val.md │ │ │ │ ├── wmi_reg_set_qword_val.md │ │ │ │ ├── wmi_reg_set_string_val.md │ │ │ │ └── wmi_versioninfo.md │ │ ├── index.md │ │ ├── nasl-grammar │ │ │ └── index.md │ │ ├── openvas-nasl-lint.md │ │ ├── openvas-nasl.md │ │ └── predefined-constants │ │ │ └── index.md │ └── openvas │ │ ├── index.md │ │ ├── openvas.md │ │ ├── openvas_ipc_protocol.md │ │ ├── redis │ │ ├── index.md │ │ ├── redis_config.md │ │ └── redis_data_model.md │ │ └── scanner-run-loop.md ├── nasl_doc_coverage.sh ├── templates │ ├── script.js │ ├── style.css │ └── template.html └── toc.sh ├── license-details.md ├── misc ├── .gitignore ├── CMakeLists.txt ├── bpf_share.c ├── bpf_share.h ├── ftp_funcs.c ├── ftp_funcs.h ├── heartbeat.c ├── heartbeat.h ├── ipc.c ├── ipc.h ├── ipc_openvas.c ├── ipc_openvas.h ├── ipc_openvas_tests.c ├── ipc_pipe.c ├── ipc_pipe.h ├── kb_cache.c ├── kb_cache.h ├── network.c ├── network.h ├── nvt_categories.h ├── openvas-krb5.c ├── openvas-krb5.h ├── pcap.c ├── pcap_openvas.h ├── pcap_tests.c ├── plugutils.c ├── plugutils.h ├── scan_id.c ├── scan_id.h ├── scanneraux.c ├── scanneraux.h ├── strutils.c ├── strutils.h ├── support.h ├── table_driven_lsc.c ├── table_driven_lsc.h ├── table_driven_lsc_tests.c ├── user_agent.c ├── user_agent.h ├── vendorversion.c └── vendorversion.h ├── nasl ├── CMakeLists.txt ├── arc4.c ├── byteorder.h ├── capture_packet.c ├── capture_packet.h ├── charcnv.c ├── charset.h ├── exec.c ├── exec.h ├── genrand.c ├── hmacmd5.c ├── hmacmd5.h ├── iconv.c ├── iconv.h ├── lint.c ├── lint.h ├── md4.c ├── md4.h ├── md5.c ├── md5.h ├── nasl-lint.c ├── nasl.c ├── nasl.h ├── nasl_builtin_find_service.c ├── nasl_builtin_openvas_tcp_scanner.c ├── nasl_builtin_plugins.h ├── nasl_builtin_synscan.c ├── nasl_cert.c ├── nasl_cert.h ├── nasl_cmd_exec.c ├── nasl_cmd_exec.h ├── nasl_crypt_helper.c ├── nasl_crypto.c ├── nasl_crypto.h ├── nasl_crypto2.c ├── nasl_crypto2.h ├── nasl_crypto_helper.h ├── nasl_debug.c ├── nasl_debug.h ├── nasl_frame_forgery.c ├── nasl_frame_forgery.h ├── nasl_func.c ├── nasl_func.h ├── nasl_global_ctxt.h ├── nasl_grammar.y ├── nasl_host.c ├── nasl_host.h ├── nasl_http.c ├── nasl_http.h ├── nasl_http2.c ├── nasl_http2.h ├── nasl_init.c ├── nasl_init.h ├── nasl_isotime.c ├── nasl_isotime.h ├── nasl_krb5.c ├── nasl_krb5.h ├── nasl_lex_ctxt.c ├── nasl_lex_ctxt.h ├── nasl_misc_funcs.c ├── nasl_misc_funcs.h ├── nasl_packet_forgery.c ├── nasl_packet_forgery.h ├── nasl_packet_forgery_v6.c ├── nasl_packet_forgery_v6.h ├── nasl_raw.h ├── nasl_scanner_glue.c ├── nasl_scanner_glue.h ├── nasl_signature.c ├── nasl_signature.h ├── nasl_smb.c ├── nasl_smb.h ├── nasl_snmp.c ├── nasl_snmp.h ├── nasl_socket.c ├── nasl_socket.h ├── nasl_ssh.c ├── nasl_ssh.h ├── nasl_text_utils.c ├── nasl_text_utils.h ├── nasl_tree.c ├── nasl_tree.h ├── nasl_var.c ├── nasl_var.h ├── nasl_wmi.c ├── nasl_wmi.h ├── ntlmssp.c ├── ntlmssp.h ├── openvas_smb_interface.h ├── openvas_wmi_interface.h ├── proto.h ├── smb.h ├── smb_crypt.c ├── smb_crypt.h ├── smb_crypt2.c ├── smb_interface_stub.c ├── smb_signing.c ├── smb_signing.h ├── tests │ ├── Makefile │ ├── README.md │ ├── signed.nasl │ ├── signed.nasl.asc │ ├── test_blowfish.nasl │ ├── test_bn.nasl │ ├── test_crypt_data_aes.nasl │ ├── test_dh.nasl │ ├── test_dsa.nasl │ ├── test_hexstr.nasl │ ├── test_isotime.nasl │ ├── test_md.nasl │ ├── test_privkey.nasl │ ├── test_rsa.nasl │ ├── test_socket.nasl │ ├── testsuiteinit.nasl │ └── testsuitesummary.nasl ├── time.c └── wmi_interface_stub.c ├── release_tag.toml ├── rust ├── .cargo │ └── audit.toml ├── .gitignore ├── COPYING ├── Cargo.lock ├── Cargo.toml ├── Cross.toml ├── README.md ├── benches │ ├── infisto_comparison.rs │ ├── interpreter.rs │ └── nasl_syntax_parse.rs ├── crates │ ├── nasl-c-lib │ │ ├── .gitignore │ │ ├── Cargo.toml │ │ ├── README.md │ │ ├── build.rs │ │ ├── c │ │ │ └── cryptographic │ │ │ │ ├── gcrypt_error.c │ │ │ │ ├── gcrypt_error.h │ │ │ │ ├── gcrypt_mac.c │ │ │ │ └── gcrypt_mac.h │ │ ├── libgcrypt-sys │ │ │ ├── Cargo.toml │ │ │ ├── build.rs │ │ │ ├── install-gcrypt.sh │ │ │ └── src │ │ │ │ └── lib.rs │ │ ├── src │ │ │ ├── cryptographic │ │ │ │ ├── mac.rs │ │ │ │ └── mod.rs │ │ │ └── lib.rs │ │ └── tests │ │ │ ├── helper │ │ │ └── mod.rs │ │ │ └── mac.rs │ ├── nasl-function-proc-macro │ │ ├── Cargo.lock │ │ ├── Cargo.toml │ │ └── src │ │ │ ├── codegen.rs │ │ │ ├── error.rs │ │ │ ├── lib.rs │ │ │ ├── parse.rs │ │ │ ├── types.rs │ │ │ └── utils.rs │ └── smoketest │ │ ├── Cargo.toml │ │ ├── Makefile │ │ ├── README.md │ │ ├── configs │ │ └── simple_scan_ssh_only.json │ │ ├── src │ │ ├── config.rs │ │ └── lib.rs │ │ └── tests │ │ └── tests.rs ├── cross.Dockerfile ├── cross_aarch64.Dockerfile ├── data │ ├── feed │ │ ├── plugin_feed_info.inc │ │ ├── sha256sums │ │ ├── test.inc │ │ └── test.nasl │ ├── nasl_syntax │ │ ├── simple_parse.nasl │ │ └── smb_nt.inc │ ├── notus │ │ ├── README.md │ │ ├── debian_10.notus │ │ ├── debian_10_json_parse_err.notus │ │ ├── debian_10_product_parse_err.notus │ │ └── gentoo_examples.txt │ └── osp │ │ ├── response_finished.xml │ │ ├── response_queued.xml │ │ └── response_running.xml ├── doc │ ├── faq │ │ ├── progress-calculation.md │ │ └── resume-scan.md │ ├── forking.md │ ├── misc │ │ ├── builtin_coverage.nasl │ │ └── progress-calculation-details.md │ ├── openapi.yml │ ├── openvasd-osp-cmd-equivalence.md │ ├── overview.mmd │ └── reverse-sensor-openapi.yml ├── examples │ ├── .gitignore │ ├── README.md │ ├── arp_request.nasl │ ├── control.nasl │ ├── error.nasl │ ├── error_inc.inc │ ├── feed │ │ ├── nasl │ │ │ ├── 1.nasl │ │ │ ├── 2.nasl │ │ │ ├── error_message.nasl │ │ │ ├── http2_get.nasl │ │ │ ├── log_message.nasl │ │ │ ├── plugin_feed_info.inc │ │ │ ├── security_message.nasl │ │ │ ├── sha256sums │ │ │ └── sha256sums.sh │ │ └── notus │ │ │ ├── advisories │ │ │ ├── sha256sums │ │ │ ├── test.notus │ │ │ └── windows.notus │ │ │ └── products │ │ │ ├── sha256sums │ │ │ ├── test.notus │ │ │ └── windows_11_home.notus │ ├── forge_icmp_v6.nasl │ ├── forge_tcp_v6.nasl │ ├── get_kb_item.nasl │ ├── gss.nasl │ ├── http2.nasl │ ├── openvasd │ │ ├── config.example.toml │ │ ├── discovery.json │ │ ├── example-feed-scan.json │ │ ├── simple_auth_ssh_scan.json │ │ └── start-discovery.sh │ ├── packet_forgery.nasl │ ├── packet_forgery_icmp_ping.nasl │ ├── packet_forgery_igmp.nasl │ ├── packet_forgery_tcp_opts.nasl │ ├── packet_forgery_tcp_v6.nasl │ ├── packet_forgery_udp.nasl │ ├── packet_forgery_udp_v6.nasl │ ├── pem_to.nasl │ ├── scannerctl │ │ ├── scan-configs │ │ │ ├── .gitignore │ │ │ ├── README.md │ │ │ ├── adapted-full-and-fast.xml │ │ │ ├── discovery.xml │ │ │ └── openvas-default-portlist.xml │ │ └── transpile.toml │ ├── scoping.nasl │ ├── sha256sums │ ├── socket │ │ ├── ftp.nasl │ │ ├── tcp.nasl │ │ ├── tcp_priv.nasl │ │ ├── tcp_recv_line.nasl │ │ ├── udp.nasl │ │ └── udp_priv.nasl │ ├── ssh_netconf.nasl │ ├── ssh_test.nasl │ ├── tls │ │ ├── openssl.cnf │ │ ├── pki │ │ │ ├── ca_certificates.sh │ │ │ ├── client_certificates.sh │ │ │ └── server_certificates.sh │ │ └── self-signed │ │ │ ├── Makefile │ │ │ ├── client_certificates.sh │ │ │ └── server_certificates.sh │ └── wmi-exec.nasl ├── fuzz │ ├── .gitignore │ ├── Cargo.lock │ ├── Cargo.toml │ └── fuzz_targets │ │ └── fuzz_parse.rs ├── src │ ├── alive_test │ │ ├── README.md │ │ ├── alive_test.rs │ │ ├── error.rs │ │ └── mod.rs │ ├── feed │ │ ├── README.md │ │ ├── mod.rs │ │ ├── oid │ │ │ └── mod.rs │ │ ├── transpile │ │ │ ├── error.rs │ │ │ └── mod.rs │ │ ├── update │ │ │ ├── error.rs │ │ │ └── mod.rs │ │ ├── update_tests.rs │ │ └── verify │ │ │ └── mod.rs │ ├── feed_verifier │ │ ├── README.md │ │ └── main.rs │ ├── lib.rs │ ├── models │ │ ├── advisories.rs │ │ ├── credential.rs │ │ ├── host_info.rs │ │ ├── mod.rs │ │ ├── parameter.rs │ │ ├── port.rs │ │ ├── product.rs │ │ ├── resources │ │ │ ├── check.rs │ │ │ └── mod.rs │ │ ├── result.rs │ │ ├── scan.rs │ │ ├── scan_action.rs │ │ ├── scanner.rs │ │ ├── scanner_preference.rs │ │ ├── status.rs │ │ ├── target.rs │ │ └── vt.rs │ ├── nasl │ │ ├── builtin │ │ │ ├── README.md │ │ │ ├── array │ │ │ │ ├── mod.rs │ │ │ │ └── tests.rs │ │ │ ├── cert │ │ │ │ └── mod.rs │ │ │ ├── cryptographic │ │ │ │ ├── README.md │ │ │ │ ├── aes_cbc.rs │ │ │ │ ├── aes_ccm.rs │ │ │ │ ├── aes_cmac.rs │ │ │ │ ├── aes_ctr.rs │ │ │ │ ├── aes_gcm.rs │ │ │ │ ├── aes_gmac.rs │ │ │ │ ├── bf_cbc.rs │ │ │ │ ├── des.rs │ │ │ │ ├── hash.rs │ │ │ │ ├── hmac.rs │ │ │ │ ├── mod.rs │ │ │ │ ├── pem_to.rs │ │ │ │ ├── rc4.rs │ │ │ │ ├── rsa.rs │ │ │ │ └── tests │ │ │ │ │ ├── aes_cbc.rs │ │ │ │ │ ├── aes_ccm.rs │ │ │ │ │ ├── aes_cmac.rs │ │ │ │ │ ├── aes_ctr.rs │ │ │ │ │ ├── aes_gcm.rs │ │ │ │ │ ├── bf_cbc.rs │ │ │ │ │ ├── des.rs │ │ │ │ │ ├── hash.rs │ │ │ │ │ ├── helper │ │ │ │ │ └── mod.rs │ │ │ │ │ ├── hmac.rs │ │ │ │ │ ├── mod.rs │ │ │ │ │ ├── pem_to.rs │ │ │ │ │ ├── rc4.rs │ │ │ │ │ └── rsa.rs │ │ │ ├── description │ │ │ │ ├── README.md │ │ │ │ └── mod.rs │ │ │ ├── error.rs │ │ │ ├── host │ │ │ │ ├── README.md │ │ │ │ ├── mod.rs │ │ │ │ └── tests.rs │ │ │ ├── http │ │ │ │ ├── README.md │ │ │ │ ├── error.rs │ │ │ │ └── mod.rs │ │ │ ├── isotime │ │ │ │ ├── README.md │ │ │ │ ├── mod.rs │ │ │ │ └── tests.rs │ │ │ ├── knowledge_base │ │ │ │ ├── README.md │ │ │ │ ├── mod.rs │ │ │ │ └── tests.rs │ │ │ ├── misc │ │ │ │ ├── README.md │ │ │ │ ├── mod.rs │ │ │ │ └── tests.rs │ │ │ ├── mod.rs │ │ │ ├── network │ │ │ │ ├── README.md │ │ │ │ ├── mod.rs │ │ │ │ ├── network.rs │ │ │ │ ├── network_utils.rs │ │ │ │ ├── socket.rs │ │ │ │ ├── tcp.rs │ │ │ │ ├── tls.rs │ │ │ │ └── udp.rs │ │ │ ├── preferences │ │ │ │ └── mod.rs │ │ │ ├── raw_ip │ │ │ │ ├── README.md │ │ │ │ ├── frame_forgery.rs │ │ │ │ ├── mod.rs │ │ │ │ ├── packet_forgery.rs │ │ │ │ ├── raw_ip_utils.rs │ │ │ │ └── tests │ │ │ │ │ ├── frame_forgery.rs │ │ │ │ │ ├── mod.rs │ │ │ │ │ └── packet_forgery.rs │ │ │ ├── regex │ │ │ │ ├── README.md │ │ │ │ ├── mod.rs │ │ │ │ └── tests.rs │ │ │ ├── report_functions │ │ │ │ ├── mod.rs │ │ │ │ └── tests.rs │ │ │ ├── ssh │ │ │ │ ├── README.md │ │ │ │ ├── error.rs │ │ │ │ ├── libssh │ │ │ │ │ ├── channel.rs │ │ │ │ │ ├── mod.rs │ │ │ │ │ └── session.rs │ │ │ │ ├── mod.rs │ │ │ │ ├── russh │ │ │ │ │ ├── mod.rs │ │ │ │ │ └── session.rs │ │ │ │ ├── sessions.rs │ │ │ │ ├── tests │ │ │ │ │ ├── mod.rs │ │ │ │ │ └── server.rs │ │ │ │ └── utils.rs │ │ │ ├── string │ │ │ │ ├── README.md │ │ │ │ ├── mod.rs │ │ │ │ └── tests.rs │ │ │ ├── sys │ │ │ │ └── mod.rs │ │ │ └── tests.rs │ │ ├── interpreter │ │ │ ├── README.md │ │ │ ├── assign.rs │ │ │ ├── call.rs │ │ │ ├── declare.rs │ │ │ ├── error.rs │ │ │ ├── forking_interpreter.rs │ │ │ ├── include.rs │ │ │ ├── interpreter.rs │ │ │ ├── loop_extension.rs │ │ │ ├── mod.rs │ │ │ ├── operator.rs │ │ │ └── tests │ │ │ │ ├── description.rs │ │ │ │ ├── local_var.rs │ │ │ │ ├── mod.rs │ │ │ │ └── retry.rs │ │ ├── mod.rs │ │ ├── syntax │ │ │ ├── README.md │ │ │ ├── cursor.rs │ │ │ ├── error.rs │ │ │ ├── grouping_extension.rs │ │ │ ├── keyword_extension.rs │ │ │ ├── lexer.rs │ │ │ ├── loader.rs │ │ │ ├── logger.rs │ │ │ ├── mod.rs │ │ │ ├── naslvalue.rs │ │ │ ├── operation.rs │ │ │ ├── postfix_extension.rs │ │ │ ├── prefix_extension.rs │ │ │ ├── snapshots │ │ │ │ ├── statement_add.snap │ │ │ │ ├── statement_array.snap │ │ │ │ ├── statement_assign.snap │ │ │ │ ├── statement_assign_return.snap │ │ │ │ ├── statement_block.snap │ │ │ │ ├── statement_break.snap │ │ │ │ ├── statement_call.snap │ │ │ │ ├── statement_continue.snap │ │ │ │ ├── statement_declare.snap │ │ │ │ ├── statement_div.snap │ │ │ │ ├── statement_exit.snap │ │ │ │ ├── statement_for.snap │ │ │ │ ├── statement_foreach.snap │ │ │ │ ├── statement_function_declaration.snap │ │ │ │ ├── statement_if.snap │ │ │ │ ├── statement_include.snap │ │ │ │ ├── statement_modulo.snap │ │ │ │ ├── statement_mul.snap │ │ │ │ ├── statement_named_parameter.snap │ │ │ │ ├── statement_no_op.snap │ │ │ │ ├── statement_parameter.snap │ │ │ │ ├── statement_primitive.snap │ │ │ │ ├── statement_repeat.snap │ │ │ │ ├── statement_return.snap │ │ │ │ ├── statement_return_assign.snap │ │ │ │ ├── statement_sub.snap │ │ │ │ ├── statement_variable.snap │ │ │ │ └── statement_while.snap │ │ │ ├── statement.rs │ │ │ ├── tests │ │ │ │ └── missing_input_validation.rs │ │ │ ├── token.rs │ │ │ └── variable_extension.rs │ │ ├── test_utils.rs │ │ └── utils │ │ │ ├── README.md │ │ │ ├── context.rs │ │ │ ├── error.rs │ │ │ ├── executor │ │ │ ├── mod.rs │ │ │ └── nasl_function.rs │ │ │ ├── function │ │ │ ├── from_nasl_value.rs │ │ │ ├── maybe.rs │ │ │ ├── mod.rs │ │ │ ├── positionals.rs │ │ │ ├── to_nasl_result.rs │ │ │ ├── types.rs │ │ │ └── utils.rs │ │ │ ├── hosts.rs │ │ │ ├── lookup_keys.rs │ │ │ └── mod.rs │ ├── notus │ │ ├── README.md │ │ ├── error.rs │ │ ├── loader │ │ │ ├── fs.rs │ │ │ ├── hashsum.rs │ │ │ └── mod.rs │ │ ├── mod.rs │ │ ├── notus.rs │ │ ├── packages │ │ │ ├── alpm.rs │ │ │ ├── deb.rs │ │ │ ├── ebuild.rs │ │ │ ├── mod.rs │ │ │ ├── rpm.rs │ │ │ ├── slack.rs │ │ │ └── windows.rs │ │ ├── tests.rs │ │ └── vts.rs │ ├── openvas │ │ ├── README.md │ │ ├── cmd.rs │ │ ├── config.rs │ │ ├── error.rs │ │ ├── mod.rs │ │ ├── openvas.rs │ │ ├── openvas_redis.rs │ │ ├── pref_handler.rs │ │ └── result_collector.rs │ ├── openvasd │ │ ├── README.md │ │ ├── config.rs │ │ ├── controller │ │ │ ├── context.rs │ │ │ ├── entry.rs │ │ │ ├── feed.rs │ │ │ ├── mod.rs │ │ │ └── results.rs │ │ ├── crypt.rs │ │ ├── feed.rs │ │ ├── main.rs │ │ ├── notus.rs │ │ ├── request.rs │ │ ├── response.rs │ │ ├── scheduling.rs │ │ ├── storage │ │ │ ├── file.rs │ │ │ ├── inmemory.rs │ │ │ ├── mod.rs │ │ │ ├── redis.rs │ │ │ └── results.rs │ │ └── tls.rs │ ├── osp │ │ ├── README.md │ │ ├── commands.rs │ │ ├── connection.rs │ │ ├── mod.rs │ │ ├── response.rs │ │ ├── scanner.rs │ │ └── tests.rs │ ├── scanner │ │ ├── error.rs │ │ ├── mod.rs │ │ ├── preferences │ │ │ ├── mod.rs │ │ │ └── preference.rs │ │ ├── running_scan.rs │ │ ├── scan.rs │ │ ├── scan_runner.rs │ │ ├── scanner_stack.rs │ │ ├── tests.rs │ │ └── vt_runner.rs │ ├── scannerctl │ │ ├── README.md │ │ ├── alivetest │ │ │ └── mod.rs │ │ ├── error.rs │ │ ├── execute │ │ │ └── mod.rs │ │ ├── feed │ │ │ ├── mod.rs │ │ │ ├── transpile.rs │ │ │ └── update.rs │ │ ├── interpret │ │ │ └── mod.rs │ │ ├── main.rs │ │ ├── notus_update │ │ │ ├── mod.rs │ │ │ ├── scanner.rs │ │ │ └── update.rs │ │ ├── osp │ │ │ ├── mod.rs │ │ │ ├── snapshots │ │ │ │ ├── scannerctl__osp__start_scan__test__pare_credential_without_port.snap │ │ │ │ ├── scannerctl__osp__start_scan__test__parse_without_credential.snap │ │ │ │ ├── scannerctl__osp__start_scan__test__parse_xml.snap │ │ │ │ ├── scannerctl__osp__start_scan__test__parse_xml_with_empty_credentials.snap │ │ │ │ ├── scannerctl__osp__tests__print_back.snap │ │ │ │ └── scannerctl__osp__tests__print_scan_json.snap │ │ │ └── start_scan.rs │ │ ├── scan_config.rs │ │ ├── syntax │ │ │ ├── check.rs │ │ │ └── mod.rs │ │ └── utils.rs │ ├── scheduling │ │ ├── mod.rs │ │ └── wave.rs │ └── storage │ │ ├── README.md │ │ ├── error.rs │ │ ├── infisto │ │ ├── README.md │ │ ├── base.rs │ │ ├── crypto.rs │ │ ├── error.rs │ │ ├── json │ │ │ ├── README.md │ │ │ └── mod.rs │ │ ├── mod.rs │ │ └── serde.rs │ │ ├── inmemory │ │ ├── kb.rs │ │ └── mod.rs │ │ ├── items │ │ ├── kb.rs │ │ ├── mod.rs │ │ ├── notus_advisory.rs │ │ ├── nvt.rs │ │ └── result.rs │ │ ├── mod.rs │ │ ├── redis │ │ ├── README.md │ │ ├── connector.rs │ │ ├── dberror.rs │ │ └── mod.rs │ │ └── time.rs ├── tests │ ├── data │ │ ├── crash-prefix-recursion.nasl │ │ └── crash-recursion-depth.nasl │ ├── nasl_syntax_missing_input_validation.rs │ └── nasl_syntax_parsing.rs └── typos.toml ├── smoketest_lint ├── Makefile ├── README.md ├── cmd │ └── main.go ├── data │ └── undeclaredv11.nasl ├── go.mod └── test │ ├── testcase.go │ ├── testfile.go │ └── testtype.go └── src ├── CMakeLists.txt ├── attack.c ├── attack.h ├── attack_tests.c ├── debug_utils.c ├── debug_utils.h ├── hosts.c ├── hosts.h ├── main.c ├── nasl_plugins.c ├── openvas.c ├── openvas.h ├── openvas_log_conf.cmake_in ├── pluginlaunch.c ├── pluginlaunch.h ├── pluginload.c ├── pluginload.h ├── pluginscheduler.c ├── pluginscheduler.h ├── plugs_req.c ├── plugs_req.h ├── processes.c ├── processes.h ├── sighand.c ├── sighand.h ├── utils.c └── utils.h /.codecov.yml: -------------------------------------------------------------------------------- 1 | comment: off 2 | -------------------------------------------------------------------------------- /.devcontainer/build-cmake-project.sh: -------------------------------------------------------------------------------- 1 | #/bin/sh 2 | [ -d "$1" ] && WORKD_DIR="$1" || ( 3 | echo "Usage: $0 " 4 | exit 1 5 | ) 6 | cd $WORKD_DIR 7 | set -ex 8 | cmake -B build -DCMAKE_EXPORT_COMPILE_COMMANDS=ON 9 | cmake --build build --target install 10 | LDCONFIG="ldconfig" 11 | if [ "$(id -u)" -ne 0 ]; then 12 | LDCONFIG="sudo ldconfig" 13 | fi 14 | $LDCONFIG 15 | -------------------------------------------------------------------------------- /.devcontainer/build-gvm-libs: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | owner=${1:-greenbone} 3 | if [ -d "/workspaces/$owner" ]; then 4 | target_dir="/workspaces/$owner/gvm-libs" 5 | else 6 | target_dir="/workspaces/gvm-libs" 7 | fi 8 | /usr/local/bin/build-cmake-project.sh "$target_dir" -------------------------------------------------------------------------------- /.devcontainer/build-openvas: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | owner=${1:-greenbone} 3 | if [ -d "/workspaces/$owner" ]; then 4 | target_dir="/workspaces/$owner/openvas-scanner" 5 | else 6 | target_dir="/workspaces/openvas-scanner" 7 | fi 8 | 9 | /usr/local/bin/build-cmake-project.sh "$target_dir" -------------------------------------------------------------------------------- /.devcontainer/devcontainer.json: -------------------------------------------------------------------------------- 1 | { 2 | "build": { "dockerfile": "Dockerfile" }, 3 | } 4 | -------------------------------------------------------------------------------- /.docker/openvas.conf: -------------------------------------------------------------------------------- 1 | table_driven_lsc = yes 2 | mqtt_server_uri = tcp://mqtt-broker:1883 3 | -------------------------------------------------------------------------------- /.docker/railguards/README.md: -------------------------------------------------------------------------------- 1 | # Railguards 2 | 3 | As long as openvas is a distributed monolith in 4 | - greenbone/gvm-libs 5 | - greenbone/openvas-smb 6 | - greenbone/openvas-scanner 7 | 8 | we need to verify that the dependencies play nicely together on our target: 9 | 10 | - debian:stable 11 | 12 | **WARNING** The Dockerfiles within this folder are not meant to be used outside of this very specific test case. 13 | -------------------------------------------------------------------------------- /.dockerignore: -------------------------------------------------------------------------------- 1 | .vscode/ 2 | .mergify.yml 3 | build/ 4 | rust/target 5 | -------------------------------------------------------------------------------- /.github/CODEOWNERS: -------------------------------------------------------------------------------- 1 | # default reviewers 2 | * @greenbone/scanner-maintainers 3 | 4 | # devops 5 | .github/ @greenbone/scanner-maintainers 6 | .docker/ @greenbone/scanner-maintainers 7 | -------------------------------------------------------------------------------- /.github/ISSUE_TEMPLATE/config.yml: -------------------------------------------------------------------------------- 1 | blank_issues_enabled: false 2 | contact_links: 3 | - name: Greenbone Community Forum 4 | url: https://community.greenbone.net/c/gse 5 | about: Please ask and answer questions here. 6 | -------------------------------------------------------------------------------- /.github/actions/setup-rust/action.yml: -------------------------------------------------------------------------------- 1 | name: "Setup Rust Environment" 2 | description: "Install necessary dependencies and set up Rust stable" 3 | runs: 4 | using: "composite" 5 | steps: 6 | - uses: actions/cache@v4 7 | with: 8 | path: | 9 | ~/.cargo/bin/ 10 | ~/.cargo/registry/index/ 11 | ~/.cargo/registry/cache/ 12 | ~/.cargo/git/db/ 13 | rust/target/ 14 | key: ${{ runner.os }}-cargo-${{ hashFiles('rust/Cargo.lock') }} 15 | - run: sudo apt update || true 16 | shell: bash 17 | - run: sudo apt-get install -y libpcap-dev patchelf 18 | shell: bash 19 | - run: rustup update stable && rustup default stable || rustup default stable 20 | shell: bash 21 | 22 | -------------------------------------------------------------------------------- /.github/check-c-formatting.sh: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env sh 2 | 3 | sudo apt-get install -y clang-format 4 | 5 | # I wanted to get the merge base using {{ github.base_ref }}, however this is only 6 | # available for the event that opens the PR or edits it, not on pushes to the branch. 7 | # Comparing to main should be an OK alternative, since it will - at worst - do more 8 | # autoformatting than it otherwise would. 9 | 10 | [ -z "$1" ] && merge_base=main || merge_base="$1" 11 | 12 | git fetch origin $merge_base:refs/remotes/origin/$merge_base 13 | 14 | echo "$(clang-format --version)" 15 | (git diff --name-only "origin/$merge_base") | while read filename; do 16 | extension="${filename##*.}" 17 | if [ "$extension" = "c" ] || [ "$extension" = "h" ]; then 18 | clang-format -i -style=file "$filename" 19 | fi 20 | done 21 | -------------------------------------------------------------------------------- /.github/dependabot.yml: -------------------------------------------------------------------------------- 1 | version: 2 2 | updates: 3 | 4 | - package-ecosystem: "github-actions" 5 | directory: "/" 6 | schedule: 7 | interval: "weekly" 8 | groups: 9 | github-actions: 10 | patterns: 11 | - "*" 12 | -------------------------------------------------------------------------------- /.github/enhance_version.sh: -------------------------------------------------------------------------------- 1 | #!/bin/sh 2 | 3 | version="$1" 4 | type="$2" 5 | 6 | # Split version string into fields 7 | IFS='.' read -r field1 field2 field3 << EOF 8 | $version 9 | EOF 10 | 11 | # On major enhance major version, set minor and patch to 0 12 | # On minor enhance minor version, set patch to 0 13 | # On patch enhance patch version 14 | case "$type" in 15 | "major") 16 | field1=$(expr $field1 + 1) 17 | field2=0 18 | field3=0 19 | ;; 20 | "minor") 21 | field2=$(expr $field2 + 1) 22 | field3=0 23 | ;; 24 | "patch") 25 | field3=$(expr $field3 + 1) 26 | ;; 27 | *) 28 | echo "Error: Invalid update type '$type'" >&2 29 | return 1 30 | ;; 31 | esac 32 | 33 | new_version="$field1.$field2.$field3" 34 | echo "$new_version" 35 | -------------------------------------------------------------------------------- /.github/prepare-feed.sh: -------------------------------------------------------------------------------- 1 | #!/bin/sh 2 | # This script prepares the feed used for integration tests. 3 | # We don't use the download action because it is not capapble of a fork based 4 | # workflow. 5 | [ -z $FEED_DIR ] && FEED_DIR="/var/lib/openvas/plugins" 6 | DOCKER_CMD=docker 7 | FEED_IMAGE="registry.community.greenbone.net/community/vulnerability-tests" 8 | set -e 9 | printf "Copying feed $FEED_IMAGE " 10 | FEED_VERSION=$($DOCKER_CMD run --rm $FEED_IMAGE sh -c 'ls /var/lib/openvas/' | sort -r | head -n 1) 11 | printf "(version: $FEED_VERSION) to $FEED_DIR\n" 12 | # instanciate container 13 | CFP="/var/lib/openvas/$FEED_VERSION/vt-data/nasl/" 14 | CID=$($DOCKER_CMD create $FEED_IMAGE) 15 | rm -rf $FEED_DIR 16 | mkdir -p $FEED_DIR 17 | $DOCKER_CMD cp $CID:$CFP $FEED_DIR 18 | mv $FEED_DIR/nasl/* $FEED_DIR 19 | rm -r $FEED_DIR/nasl 20 | $DOCKER_CMD rm $CID 21 | -------------------------------------------------------------------------------- /.github/workflows/auto_label.yml: -------------------------------------------------------------------------------- 1 | name: Labeler 2 | 3 | on: 4 | pull_request: 5 | 6 | permissions: 7 | pull-requests: write 8 | contents: read 9 | 10 | jobs: 11 | label: 12 | runs-on: self-hosted-generic 13 | steps: 14 | - uses: greenbone/actions/pr-conventional-commit-labeler@main 15 | with: 16 | configuration-toml: release_tag.toml 17 | 18 | -------------------------------------------------------------------------------- /.github/workflows/dependency-review.yml: -------------------------------------------------------------------------------- 1 | name: 'Dependency Review' 2 | on: [pull_request] 3 | 4 | permissions: 5 | contents: read 6 | pull-requests: write 7 | 8 | jobs: 9 | dependency-review: 10 | runs-on: self-hosted-generic 11 | steps: 12 | - name: 'Dependency Review' 13 | uses: greenbone/actions/dependency-review@v3 14 | -------------------------------------------------------------------------------- /.github/workflows/push-helm-chart.yml: -------------------------------------------------------------------------------- 1 | name: "Helm Push" 2 | 3 | on: 4 | workflow_call: 5 | inputs: 6 | registry: 7 | required: true 8 | type: string 9 | secrets: 10 | user: 11 | required: true 12 | token: 13 | required: true 14 | 15 | 16 | jobs: 17 | helm: 18 | runs-on: self-hosted-generic 19 | steps: 20 | - uses: actions/checkout@v4 21 | - uses: greenbone/actions/helm-build-push@v3 22 | with: 23 | chart-name: openvasd 24 | registry: ${{ inputs.registry }} 25 | registry-subpath: helm-charts/ 26 | registry-user: ${{ secrets.user }} 27 | registry-token: ${{ secrets.token }} 28 | -------------------------------------------------------------------------------- /.github/workflows/sbom-upload.yml: -------------------------------------------------------------------------------- 1 | name: SBOM upload 2 | on: 3 | workflow_dispatch: 4 | push: 5 | branches: ["main"] 6 | jobs: 7 | SBOM-upload: 8 | runs-on: self-hosted-generic 9 | permissions: 10 | id-token: write 11 | contents: write 12 | steps: 13 | - name: 'SBOM upload' 14 | uses: greenbone/actions/sbom-upload@v3 15 | -------------------------------------------------------------------------------- /.gitignore: -------------------------------------------------------------------------------- 1 | build/ 2 | nasl/nasl_grammar.output 3 | nasl/nasl_grammar.tab.c 4 | nasl/nasl_grammar.tab.h 5 | .cache/ 6 | testsuiterun.nasl 7 | .vscode 8 | .venv/ 9 | *.bak 10 | assets/ 11 | *.rsa 12 | *.pem 13 | -------------------------------------------------------------------------------- /.pontos-header-ignore: -------------------------------------------------------------------------------- 1 | README.txt 2 | md4.* 3 | md5.* 4 | iconv.h 5 | time.c 6 | smb.h 7 | smb_signing.* 8 | smb_crypt* 9 | nasl.h 10 | nasl_var.* 11 | nasl_tree.* 12 | nasl_text_utils.* 13 | nasl_socket.h 14 | nasl_scanner_glue.* 15 | nasl_raw.h 16 | nasl_packet_forgery* 17 | nasl_misc_funcs.* 18 | nasl_lex_ctxt.* 19 | nasl_init.* 20 | nasl_http.* 21 | nasl_host.* 22 | nasl_func.* 23 | nasl_debug.* 24 | nasl_crypto* 25 | nasl_cmd_exec.* 26 | nasl_buildin_synscan.c 27 | nasl_buildin_openvas_tcp_scanner.c 28 | hmacmd5.* 29 | exec.h 30 | charset.c 31 | charcnv.c 32 | capture_packet.* 33 | byteorder.h 34 | arc4.c 35 | tests/keys/ownertrust.txt 36 | -------------------------------------------------------------------------------- /VERSION.in: -------------------------------------------------------------------------------- 1 | @CPACK_PACKAGE_VERSION@ -------------------------------------------------------------------------------- /changelog.toml: -------------------------------------------------------------------------------- 1 | commit_types = [ 2 | { message = "^add", group = "Added"}, 3 | { message = "^remove", group = "Removed"}, 4 | { message = "^change", group = "Changed"}, 5 | { message = "^fix", group = "Bug Fixes"}, 6 | ] 7 | 8 | changelog_dir = "changelog" 9 | -------------------------------------------------------------------------------- /charts/.gitignore: -------------------------------------------------------------------------------- 1 | *.rsa 2 | *.pem 3 | -------------------------------------------------------------------------------- /charts/Makefile: -------------------------------------------------------------------------------- 1 | _PHONY: install-http install-mtls uninstall log-openvasd 2 | TLS_PATH="../rust/examples/tls/self-signed" 3 | 4 | install-http: 5 | helm install --namespace openvasd --create-namespace openvasd openvasd/ --values openvasd/values.yaml --values openvasd/http-root.yaml 6 | 7 | install-mtls: 8 | helm install --namespace openvasd --create-namespace openvasd openvasd/ --values openvasd/values.yaml 9 | 10 | uninstall: 11 | helm uninstall -n openvasd openvasd 12 | 13 | log-openvasd: 14 | kubectl logs -n openvasd deployment/openvasd -c openvasd 15 | -------------------------------------------------------------------------------- /charts/openvasd/.helmignore: -------------------------------------------------------------------------------- 1 | # Patterns to ignore when building packages. 2 | # This supports shell glob matching, relative path matching, and 3 | # negation (prefixed with !). Only one pattern per line. 4 | .DS_Store 5 | # Common VCS dirs 6 | .git/ 7 | .gitignore 8 | .bzr/ 9 | .bzrignore 10 | .hg/ 11 | .hgignore 12 | .svn/ 13 | # Common backup files 14 | *.swp 15 | *.bak 16 | *.tmp 17 | *.orig 18 | *~ 19 | # Various IDEs 20 | .project 21 | .idea/ 22 | *.tmproj 23 | .vscode/ 24 | -------------------------------------------------------------------------------- /charts/openvasd/mtls-wo-ingress.yaml: -------------------------------------------------------------------------------- 1 | # this settings will startup openvasd without exposing the 443 port 2 | routing: 3 | enabled: false 4 | 5 | service: 6 | type: ClusterIP 7 | port: 443 8 | openvasd: 9 | tls: 10 | certificates: 11 | deploy_server: true 12 | deploy_client: true 13 | -------------------------------------------------------------------------------- /charts/openvasd/templates/routing.yaml: -------------------------------------------------------------------------------- 1 | {{- if .Values.routing.enabled -}} 2 | {{- $svcPort := .Values.service.port -}} 3 | apiVersion: traefik.containo.us/v1alpha1 4 | kind: IngressRouteTCP 5 | metadata: 6 | name: openvasd-route 7 | namespace: {{ .Release.Namespace }} 8 | annotations: 9 | "helm.sh/hook": post-install,post-upgrade 10 | "helm.sh/hook-delete-policy": before-hook-creation 11 | {{- if eq .Values.openvasd.tls.certificates.deploy_server true }} 12 | spec: 13 | entryPoints: 14 | - websecure 15 | routes: 16 | - match: HostSNI(`*`) 17 | services: 18 | - name: openvasd 19 | port: {{ $svcPort }} 20 | tls: 21 | passthrough: true 22 | {{ else }} 23 | spec: 24 | entryPoints: 25 | - web 26 | routes: 27 | - match: HostSNI(`*`) 28 | services: 29 | - name: openvasd 30 | port: {{ $svcPort }} 31 | {{ end }} 32 | {{- end }} 33 | -------------------------------------------------------------------------------- /charts/openvasd/templates/service.yaml: -------------------------------------------------------------------------------- 1 | apiVersion: v1 2 | kind: Service 3 | metadata: 4 | name: openvasd 5 | labels: 6 | {{- include "openvasd.labels" . | nindent 4 }} 7 | spec: 8 | type: {{ .Values.service.type }} 9 | ports: 10 | - port: {{ .Values.service.port }} 11 | {{- if eq .Values.openvasd.tls.certificates.deploy_server true }} 12 | targetPort: 443 13 | {{ else }} 14 | targetPort: 80 15 | {{ end }} 16 | protocol: TCP 17 | name: http 18 | selector: 19 | {{- include "openvasd.selectorLabels" . | nindent 4 }} 20 | -------------------------------------------------------------------------------- /charts/openvasd/templates/serviceaccount.yaml: -------------------------------------------------------------------------------- 1 | {{- if .Values.serviceAccount.create -}} 2 | apiVersion: v1 3 | kind: ServiceAccount 4 | metadata: 5 | name: {{ include "openvasd.serviceAccountName" . }} 6 | labels: 7 | {{- include "openvasd.labels" . | nindent 4 }} 8 | {{- with .Values.serviceAccount.annotations }} 9 | annotations: 10 | {{- toYaml . | nindent 4 }} 11 | {{- end }} 12 | {{- end }} 13 | -------------------------------------------------------------------------------- /charts/openvasd/templates/tests/test-connection.yaml: -------------------------------------------------------------------------------- 1 | apiVersion: v1 2 | kind: Pod 3 | metadata: 4 | name: "{{ include "openvasd.fullname" . }}-test-connection" 5 | labels: 6 | {{- include "openvasd.labels" . | nindent 4 }} 7 | annotations: 8 | "helm.sh/hook": test 9 | spec: 10 | containers: 11 | - name: wget 12 | image: busybox 13 | command: ['wget'] 14 | args: ['--header', 'x-api-key: {{ .Values.openvasd.apikey }}','{{ include "openvasd.fullname" . }}:{{ .Values.service.port }}/vts'] 15 | restartPolicy: Never 16 | -------------------------------------------------------------------------------- /doc/.gitignore: -------------------------------------------------------------------------------- 1 | html/ 2 | -------------------------------------------------------------------------------- /doc/manual/nasl/built-in-functions/built-in-plugins/index.md: -------------------------------------------------------------------------------- 1 | # Built-in plugins 2 | 3 | ## GENERAL 4 | 5 | Here you can find complex built-in functions for NASL 6 | 7 | ## TABLE OF CONTENT 8 | 9 | - **[plugin_run_find_service](plugin_run_find_service.md)** - openvas-scanner built-in find service 10 | - **[plugin_run_openvas_tcp_scanner](plugin_run_openvas_tcp_scanner.md)** - openvas-scanner built-in port scanner 11 | - **[plugin_run_synscan](plugin_run_synscan.md)** - performs a supposedly fast SYN port scan 12 | -------------------------------------------------------------------------------- /doc/manual/nasl/built-in-functions/built-in-plugins/plugin_run_openvas_tcp_scanner.md: -------------------------------------------------------------------------------- 1 | # plugin_run_openvas_tcp_scanner 2 | 3 | ## NAME 4 | 5 | **plugin_run_openvas_tcp_scanner** - openvas-scanner built-in port scanner 6 | 7 | ## SYNOPSIS 8 | 9 | *NULL* **plugin_run_openvas_tcp_scanner**(); 10 | 11 | **plugin_run_openvas_tcp_scanner** takes no arguments. 12 | -------------------------------------------------------------------------------- /doc/manual/nasl/built-in-functions/built-in-plugins/plugin_run_synscan.md: -------------------------------------------------------------------------------- 1 | # plugin_run_synscan 2 | 3 | ## NAME 4 | 5 | **plugin_run_synscan** - performs a supposedly fast SYN port scan 6 | 7 | ## SYNOPSIS 8 | 9 | *NULL* **plugin_run_synscan**(); 10 | 11 | **plugin_run_synscan** takes no arguments. 12 | -------------------------------------------------------------------------------- /doc/manual/nasl/built-in-functions/cert-functions/cert_close.md: -------------------------------------------------------------------------------- 1 | # cert_close 2 | 3 | ## NAME 4 | 5 | **cert_close** - release a certificate object 6 | 7 | ## SYNOPSIS 8 | 9 | *void* **cert_close**(0: *int*); 10 | 11 | **cert_close** takes one unnamed argument. 12 | 13 | ## DESCRIPTION 14 | 15 | This function releases a certificate object, which was created by **[cert_open(3)](cert_open.md)** before. 16 | 17 | The first unnamed argument is an *int* and contains an identifier to a cert object. This identifier is returned by **[cert_open(3)](cert_open.md)**. 18 | 19 | ## RETURN VALUE 20 | 21 | None 22 | 23 | ## ERRORS 24 | 25 | The first unnamed argument is missing 26 | 27 | The given object ID is <0 28 | 29 | The given object ID is not in use 30 | 31 | ## SEE ALSO 32 | 33 | **[cert_open(3)](cert_open.md)** 34 | -------------------------------------------------------------------------------- /doc/manual/nasl/built-in-functions/cert-functions/index.md: -------------------------------------------------------------------------------- 1 | # Cert Functions 2 | 3 | ## GENERAL 4 | 5 | Implementation of an API for X.509 certificates. 6 | 7 | ## TABLE OF CONTENT 8 | 9 | - **[cert_close](cert_close.md)** - release a certificate object 10 | - **[cert_open](cert_open.md)** - create a certificate object 11 | - **[cert_query](cert_query.md)** - query a certificate object 12 | -------------------------------------------------------------------------------- /doc/manual/nasl/built-in-functions/cryptographic/DES.md: -------------------------------------------------------------------------------- 1 | # DES 2 | 3 | ## NAME 4 | 5 | **DES** - takes a unnamed paramaeter and return DES hash. 6 | ## SYNOPSIS 7 | 8 | *str* **DES**(str); 9 | 10 | **DES** It takes one unnamed argument. 11 | 12 | ## DESCRIPTION 13 | 14 | DES is a type of hash function. 15 | 16 | 17 | ## RETURN VALUE 18 | 19 | DES hash 20 | 21 | ## ERRORS 22 | 23 | Returns NULL when given data is null or when the algorithm is not supported by the installed gcrypt library. 24 | 25 | ## EXAMPLES 26 | 27 | ```cpp 28 | hash = DES("test"); 29 | ``` 30 | -------------------------------------------------------------------------------- /doc/manual/nasl/built-in-functions/cryptographic/MD2.md: -------------------------------------------------------------------------------- 1 | # MD2 2 | 3 | ## NAME 4 | 5 | **MD2** - takes a unnamed paramaeter and return MD2 hash. 6 | ## SYNOPSIS 7 | 8 | *str* **MD2**(str); 9 | 10 | **MD2** It takes one unnamed argument. 11 | 12 | ## DESCRIPTION 13 | 14 | MD2 is a type of hash function. 15 | 16 | 17 | ## RETURN VALUE 18 | 19 | MD2 hash 20 | 21 | ## ERRORS 22 | 23 | Returns NULL when given data is null or when the algorithm is not supported by the installed gcrypt library. 24 | 25 | ## EXAMPLES 26 | 27 | ```cpp 28 | hash = MD2("test"); 29 | ``` 30 | 31 | ## SEE ALSO 32 | 33 | **[MD4(3)](MD4.md)**, 34 | **[MD5(3)](MD5.md)**, 35 | **[NTLMv1_HASH(3)](NTLMv1_HASH.md)**, 36 | **[NTLMv2_HASH(3)](NTLMv2_HASH.md)**, 37 | **[RIPEMD160(3)](RIPEMD160.md)**, 38 | **[SHA1(3)](SHA1.md)**, 39 | **[SHA256(3)](SHA256.md)**, 40 | **[SHA512(3)](SHA512.md)**, 41 | -------------------------------------------------------------------------------- /doc/manual/nasl/built-in-functions/cryptographic/MD4.md: -------------------------------------------------------------------------------- 1 | # MD4 2 | 3 | ## NAME 4 | 5 | **MD4** - takes a unnamed paramaeter and return MD4 hash. 6 | ## SYNOPSIS 7 | 8 | *str* **MD4**(str); 9 | 10 | **MD4** It takes one unnamed argument. 11 | 12 | ## DESCRIPTION 13 | 14 | MD4 is a type of hash function. 15 | 16 | 17 | ## RETURN VALUE 18 | 19 | MD4 hash 20 | 21 | ## ERRORS 22 | 23 | Returns NULL when given data is null or when the algorithm is not supported by the installed gcrypt library. 24 | 25 | ## EXAMPLES 26 | 27 | ```cpp 28 | hash = MD4("test"); 29 | ``` 30 | 31 | ## SEE ALSO 32 | 33 | **[MD2(3)](MD2.md)**, 34 | **[MD5(3)](MD5.md)**, 35 | **[NTLMv1_HASH(3)](NTLMv1_HASH.md)**, 36 | **[NTLMv2_HASH(3)](NTLMv2_HASH.md)**, 37 | **[RIPEMD160(3)](RIPEMD160.md)**, 38 | **[SHA1(3)](SHA1.md)**, 39 | **[SHA256(3)](SHA256.md)**, 40 | **[SHA512(3)](SHA512.md)**, 41 | -------------------------------------------------------------------------------- /doc/manual/nasl/built-in-functions/cryptographic/MD5.md: -------------------------------------------------------------------------------- 1 | # MD5 2 | 3 | ## NAME 4 | 5 | **MD5** - takes a unnamed paramaeter and return MD5 hash. 6 | ## SYNOPSIS 7 | 8 | *str* **MD5**(str); 9 | 10 | **MD5** It takes one unnamed argument. 11 | 12 | ## DESCRIPTION 13 | 14 | MD5 is a type of hash function. 15 | 16 | 17 | ## RETURN VALUE 18 | 19 | MD5 hash 20 | 21 | ## ERRORS 22 | 23 | Returns NULL when given data is null or when the algorithm is not supported by the installed gcrypt library. 24 | 25 | ## EXAMPLES 26 | 27 | ```cpp 28 | hash = MD5("test"); 29 | ``` 30 | 31 | ## SEE ALSO 32 | 33 | **[MD2(3)](MD2.md)**, 34 | **[MD4(3)](MD4.md)**, 35 | **[NTLMv1_HASH(3)](NTLMv1_HASH.md)**, 36 | **[NTLMv2_HASH(3)](NTLMv2_HASH.md)**, 37 | **[RIPEMD160(3)](RIPEMD160.md)**, 38 | **[SHA1(3)](SHA1.md)**, 39 | **[SHA256(3)](SHA256.md)**, 40 | **[SHA512(3)](SHA512.md)**, 41 | -------------------------------------------------------------------------------- /doc/manual/nasl/built-in-functions/cryptographic/NTLMv1_HASH.md: -------------------------------------------------------------------------------- 1 | # NTLMv1_HASH 2 | 3 | ## NAME 4 | 5 | **NTLMv1_HASH** - takes two named arguments cryptkey, pass_hash 6 | ## SYNOPSIS 7 | 8 | *str* **NTLMv1_HASH**(cryptkey: str, password: str, nt_hash: str); 9 | 10 | **NTLMv1_HASH** It takes two named arguments cryptkey, pass_hash. 11 | 12 | ## DESCRIPTION 13 | 14 | NTLMv1_HASH generates the NTLMv1_HASH based on the given arguments. 15 | 16 | 17 | ## RETURN VALUE 18 | 19 | NTLMv1_HASH 20 | 21 | ## ERRORS 22 | 23 | Returns NULL when a given parameter is null. 24 | 25 | ## SEE ALSO 26 | 27 | **[NTLMv2_HASH(3)](NTLMv2_HASH.md)**, 28 | -------------------------------------------------------------------------------- /doc/manual/nasl/built-in-functions/cryptographic/NTLMv2_HASH.md: -------------------------------------------------------------------------------- 1 | # NTLMv2_HASH 2 | 3 | ## NAME 4 | 5 | **NTLMv2_HASH** - takes two named arguments cryptkey, pass_hash 6 | ## SYNOPSIS 7 | 8 | *str* **NTLMv2_HASH**(cryptkey: str, password: str, nt_hash: str); 9 | 10 | **NTLMv2_HASH** It takes two named arguments cryptkey, pass_hash. 11 | 12 | ## DESCRIPTION 13 | 14 | NTLMv2_HASH generates the NTLMv2_HASH based on the given arguments. 15 | 16 | 17 | ## RETURN VALUE 18 | 19 | NTLMv2_HASH 20 | 21 | ## ERRORS 22 | 23 | Returns NULL when a given parameter is null. 24 | 25 | ## SEE ALSO 26 | 27 | **[NTLMv1_HASH(3)](NTLMv1_HASH.md)**, 28 | -------------------------------------------------------------------------------- /doc/manual/nasl/built-in-functions/cryptographic/SHA1.md: -------------------------------------------------------------------------------- 1 | # SHA1 2 | 3 | ## NAME 4 | 5 | **SHA1** - takes a unnamed paramaeter and return SHA1 hash 6 | 7 | ## SYNOPSIS 8 | 9 | *str* **SHA1**(str); 10 | 11 | **SHA1** It takes one unnamed argument. 12 | 13 | ## DESCRIPTION 14 | 15 | SHA1 is a type of hash function. 16 | 17 | 18 | ## RETURN VALUE 19 | 20 | SHA1 hash 21 | 22 | ## ERRORS 23 | 24 | Returns NULL when given data is null or when the algorithm is not supported by the installed gcrypt library. 25 | 26 | ## EXAMPLES 27 | 28 | ```cpp 29 | hash = SHA1("test"); 30 | ``` 31 | 32 | ## SEE ALSO 33 | 34 | **[MD2(3)](MD2.md)**, 35 | **[MD4(3)](MD4.md)**, 36 | **[MD5(3)](MD5.md)**, 37 | **[NTLMv1_HASH(3)](NTLMv1_HASH.md)**, 38 | **[NTLMv2_HASH(3)](NTLMv2_HASH.md)**, 39 | **[RIPEMD160(3)](RIPEMD160.md)**, 40 | **[SHA256(3)](SHA256.md)**, 41 | **[SHA512(3)](SHA512.md)**, 42 | -------------------------------------------------------------------------------- /doc/manual/nasl/built-in-functions/cryptographic/aes_mac_cbc.md: -------------------------------------------------------------------------------- 1 | # aes_mac_cbc 2 | 3 | ## NAME 4 | 5 | **aes_mac_cbc** - takes two named arguments key, data 6 | 7 | ## SYNOPSIS 8 | 9 | *str* **aes_mac_cbc**(key: str, data: str); 10 | 11 | **aes_mac_cbc** It takes four named arguments key, data. 12 | 13 | ## DESCRIPTION 14 | 15 | aes_mac_cbc encrypts given data with given key by using AES in CBC mode. 16 | The according aes algorithm is dependent on the key size (if the key is 128 bit than AES128 is used, 256 and 512 are supported.) 17 | 18 | 19 | ## RETURN VALUE 20 | 21 | Encrypted data 22 | 23 | ## ERRORS 24 | 25 | Returns NULL when a given parameter is null. 26 | 27 | ## SEE ALSO 28 | 29 | **[aes_mac_gcm(3)](aes_mac_gcm.md)**, 30 | -------------------------------------------------------------------------------- /doc/manual/nasl/built-in-functions/cryptographic/aes_mac_gcm.md: -------------------------------------------------------------------------------- 1 | # aes_mac_gcm 2 | 3 | ## NAME 4 | 5 | **aes_mac_gcm** - takes two named arguments key, data 6 | 7 | ## SYNOPSIS 8 | 9 | *str* **aes_mac_gcm**(key: str, data: str, iv: str); 10 | 11 | **aes_mac_gcm** It takes three named arguments key, data, iv. 12 | 13 | ## DESCRIPTION 14 | 15 | aes_mac_gcm encrypts given data with given key by using AES in GCM mode. 16 | The according aes algorithm is dependent on the key size (if the key is 128 bit than AES128 is used, 256 and 512 are supported.) 17 | 18 | 19 | ## RETURN VALUE 20 | 21 | Encrypted data 22 | 23 | ## ERRORS 24 | 25 | Returns NULL when a given parameter is null. 26 | 27 | ## SEE ALSO 28 | 29 | **[aes_mac_gcm(3)](aes_mac_gcm.md)** 30 | -------------------------------------------------------------------------------- /doc/manual/nasl/built-in-functions/cryptographic/bf_cbc_decrypt.md: -------------------------------------------------------------------------------- 1 | # bf_cbc_decrypt 2 | 3 | ## NAME 4 | 5 | **bf_cbc_decrypt** - decrypts given data with blowfish CBC mode. 6 | 7 | ## SYNOPSIS 8 | 9 | *str* **bf_cbc_decrypt**(key:str, iv: str, data: str); 10 | 11 | **bf_cbc_decrypt** decrypts given data with blowfish CBC mode. 12 | 13 | ## DESCRIPTION 14 | decrypt the given data using the blowfish algorithm in CBC mode. 15 | 16 | The key must be 16 bytes long. 17 | The iv must be at least 8 bytes long. 18 | Data must be a multiple of 8 bytes long. 19 | 20 | ## RETURN VALUE 21 | 22 | The return value is an array a with a[0] being the decrypted data and a[1] the new initialization vector to use for the next part of the data. 23 | ## ERRORS 24 | 25 | Returns NULL when a given parameter is null. 26 | 27 | ## SEE ALSO 28 | 29 | **[bf_cbc_encrypt(3)](bf_cbc_encrypt.md)**, 30 | -------------------------------------------------------------------------------- /doc/manual/nasl/built-in-functions/cryptographic/bf_cbc_encrypt.md: -------------------------------------------------------------------------------- 1 | # bf_cbc_encrypt 2 | 3 | ## NAME 4 | 5 | **bf_cbc_encrypt** - encrypts given data with blowfish CBC mode. 6 | 7 | ## SYNOPSIS 8 | 9 | *str* **bf_cbc_encrypt**(key:str, iv: str, data: str); 10 | 11 | **bf_cbc_encrypt** encrypts given data with blowfish CBC mode. 12 | 13 | ## DESCRIPTION 14 | Encrypt the given data using the blowfish algorithm in CBC mode. 15 | 16 | The key must be 16 bytes long. 17 | The iv must be at least 8 bytes long. 18 | Data must be a multiple of 8 bytes long. 19 | 20 | ## RETURN VALUE 21 | 22 | The return value is an array a with a[0] being the encrypted data and a[1] the new initialization vector to use for the next part of the data. 23 | ## ERRORS 24 | 25 | Returns NULL when a given parameter is null. 26 | 27 | ## SEE ALSO 28 | 29 | **[bf_cbc_decrypt(3)](bf_cbc_decrypt.md)**, 30 | -------------------------------------------------------------------------------- /doc/manual/nasl/built-in-functions/cryptographic/bn_cmp.md: -------------------------------------------------------------------------------- 1 | # bn_cmp 2 | 3 | ## NAME 4 | 5 | **bn_cmp** - takes two named arguments key1, key2. Returns 0 when they're equal, -1 when key1 > key2, +1 when key2 > key1 6 | 7 | ## SYNOPSIS 8 | 9 | *str* **bn_cmp**(key: str, buf: str); 10 | 11 | **bn_cmp** It takes two named arguments key1, key2. Returns 0 when they're equal, -1 when key1 > key2, +1 when key2 > key1. 12 | 13 | ## DESCRIPTION 14 | 15 | Compares key1 with key2. 16 | 17 | ## RETURN VALUE 18 | 19 | 0 when key and key2 are equal, -1 when key1 > key2 and +1 when key1 < key2. 20 | 21 | ## SEE ALSO 22 | 23 | **[bn_random(3)](bn_random.md)**, 24 | -------------------------------------------------------------------------------- /doc/manual/nasl/built-in-functions/cryptographic/bn_random.md: -------------------------------------------------------------------------------- 1 | # bn_random 2 | 3 | ## NAME 4 | 5 | **bn_random** - takes one named arguments need to returns a message passing interface with the given amount of bits. 6 | 7 | ## SYNOPSIS 8 | 9 | *str* **bn_random**(key: str, buf: str); 10 | 11 | **bn_random** It takes one named arguments need to returns a message passing interface with the given amount of bits. 12 | 13 | ## DESCRIPTION 14 | 15 | bn_random generates a MPI (message passing interface) with a given amount of bits. 16 | 17 | 18 | ## RETURN VALUE 19 | 20 | bn_random 21 | 22 | ## ERRORS 23 | 24 | Returns NULL when a given parameter is null. 25 | 26 | ## SEE ALSO 27 | 28 | **[bn_cmp(3)](bn_cmp.md)**, 29 | -------------------------------------------------------------------------------- /doc/manual/nasl/built-in-functions/cryptographic/close_stream_cipher.md: -------------------------------------------------------------------------------- 1 | # close_stream_cipher 2 | 3 | ## NAME 4 | 5 | **close_stream_cipher** - closes a stream cipher. 6 | 7 | ## SYNOPSIS 8 | 9 | *str* **close_stream_cipher**(hd: int); 10 | 11 | **close_stream_cipher** closes a stream cipher. 12 | 13 | ## DESCRIPTION 14 | Closes a stream cipher. 15 | 16 | ## RETURN VALUE 17 | 0 when the hd is closed. 18 | 19 | ## ERRORS 20 | 21 | Returns NULL when the handler given by the hd index was not found. 22 | 23 | ## SEE ALSO 24 | 25 | **[rc4_encrypt(3)](rc4_encrypt.md)**, 26 | -------------------------------------------------------------------------------- /doc/manual/nasl/built-in-functions/cryptographic/des_ede_cbc_encrypt.md: -------------------------------------------------------------------------------- 1 | # des_ede_cbc_encrypt 2 | 3 | ## NAME 4 | 5 | **des_ede_cbc_encrypt** - encrypts given data with DES EDE CBC mode. 6 | 7 | ## SYNOPSIS 8 | 9 | *str* **des_ede_cbc_encrypt**(key:str, iv: str, data: str); 10 | 11 | **des_ede_cbc_encrypt** encrypts given data with DES EDE CBC mode. 12 | 13 | ## DESCRIPTION 14 | Encrypt the given data using the DES EDE algorithm in CBC mode. 15 | 16 | ## RETURN VALUE 17 | 18 | The return value is the encrypted data. 19 | 20 | ## ERRORS 21 | 22 | Returns NULL when a given parameter is null. 23 | -------------------------------------------------------------------------------- /doc/manual/nasl/built-in-functions/cryptographic/dh_generate_key.md: -------------------------------------------------------------------------------- 1 | # dh_generate_key 2 | 3 | ## NAME 4 | 5 | **dh_generate_key** - takes three named arguments p, g and priv to generate the public key. 6 | 7 | ## SYNOPSIS 8 | 9 | *str* **dh_generate_key**(p: str, g: str, priv: str); 10 | 11 | **dh_generate_key** It takes three named arguments p, g and priv to generate the public key. 12 | 13 | ## DESCRIPTION 14 | 15 | dh_generate_key generates the public key based on p, g and the private key. 16 | 17 | 18 | ## RETURN VALUE 19 | 20 | public key 21 | ## ERRORS 22 | 23 | Returns NULL when a given parameter is null. 24 | 25 | ## SEE ALSO 26 | 27 | **[dh_compute_key(3)](dh_compute_key.md)**, 28 | -------------------------------------------------------------------------------- /doc/manual/nasl/built-in-functions/cryptographic/dsa_do_sign.md: -------------------------------------------------------------------------------- 1 | # dsa_do_sign 2 | 3 | ## NAME 4 | 5 | **dsa_do_sign** - computes DSA signature. 6 | 7 | ## SYNOPSIS 8 | 9 | *str* **dsa_do_sign**(p: str, g: str, q: str, pub: str, priv: str, data: str); 10 | 11 | **dsa_do_sign** computes DSA signature. 12 | 13 | ## DESCRIPTION 14 | 15 | Computes the DSA signature of the hash in data using the private DSA key given by p, g, q, pub and priv. 16 | 17 | 18 | ## RETURN VALUE 19 | The return value is a 40 byte string encoding the two MPIs r and s of the DSA signature. The first 20 bytes are the value of r and the last 20 bytes are the value of s. 20 | 21 | ## ERRORS 22 | 23 | Returns NULL when a given parameter is null. 24 | 25 | ## SEE ALSO 26 | 27 | **[dsa_do_verify(3)](dsa_do_verify.md)**, 28 | -------------------------------------------------------------------------------- /doc/manual/nasl/built-in-functions/cryptographic/get_signature.md: -------------------------------------------------------------------------------- 1 | # get_signature 2 | 3 | ## NAME 4 | 5 | **get_signature** - takes four named arguments key, buf, buflen, seq_number 6 | 7 | ## SYNOPSIS 8 | 9 | *str* **get_signature**(key: str, buf: str, buflen: int, seq_number: int); 10 | 11 | **get_signature** It takes four named arguments key, buf, buflen, seq_number. 12 | 13 | ## DESCRIPTION 14 | 15 | get_signature gets the ntlmssp signature based on the given arguments. 16 | 17 | 18 | ## RETURN VALUE 19 | 20 | get_signature 21 | 22 | ## ERRORS 23 | 24 | Returns NULL when a given parameter is null. 25 | 26 | ## SEE ALSO 27 | 28 | **[NTLMv1_HASH(3)](NTLMv1_HASH.md)**, 29 | **[NTLMv2_HASH(3)](NTLMv2_HASH.md)**, 30 | **[ntlm2_response(3)](ntlm2_response.md)**, 31 | **[ntlm_response(3)](ntlm_response.md)**, 32 | **[ntlmv2_response(3)](ntlmv2_response.md)**, 33 | -------------------------------------------------------------------------------- /doc/manual/nasl/built-in-functions/cryptographic/get_smb2_signature.md: -------------------------------------------------------------------------------- 1 | # get_smb2_signature 2 | 3 | ## NAME 4 | 5 | **get_smb2_signature** - takes two named arguments key, buf 6 | 7 | ## SYNOPSIS 8 | 9 | *str* **get_smb2_signature**(key: str, buf: str); 10 | 11 | **get_smb2_signature** It takes four named arguments key, buf. 12 | 13 | ## DESCRIPTION 14 | 15 | get_smb2_signature gets the smb2 signature based on the given arguments. 16 | 17 | 18 | ## RETURN VALUE 19 | 20 | get_smb2_signature 21 | 22 | ## ERRORS 23 | 24 | Returns NULL when a given parameter is null. 25 | 26 | ## SEE ALSO 27 | 28 | **[smb3kdf(3)](smb3kdf.md)**, 29 | **[smb_cmac_aes_signature(3)](smb_cmac_aes_signature.md)**, 30 | **[smb_gmac_aes_signature(3)](smb_gmac_aes_signature.md)**, 31 | -------------------------------------------------------------------------------- /doc/manual/nasl/built-in-functions/cryptographic/insert_hexzeros.md: -------------------------------------------------------------------------------- 1 | # insert_hexzeros 2 | 3 | ## NAME 4 | 5 | **insert_hexzeros** - appends a empty byte to each character in a string 6 | 7 | ## SYNOPSIS 8 | 9 | *str* **insert_hexzeros**(in: *string*); 10 | 11 | **insert_hexzeros** takes 1 named argument. 12 | 13 | ## DESCRIPTION 14 | 15 | This function takes a string and appends an empty byte to each character. Its argument is: 16 | - in: the string to modify 17 | 18 | ## RETURN VALUE 19 | 20 | The modified string. 21 | -------------------------------------------------------------------------------- /doc/manual/nasl/built-in-functions/cryptographic/lm_owf_gen.md: -------------------------------------------------------------------------------- 1 | # lm_owf_gen 2 | 3 | ## NAME 4 | 5 | **lm_owf_gen** - takes a unnamed parameter and returns LanMan one way hash. 6 | ## SYNOPSIS 7 | 8 | *str* **lm_owf_gen**(str); 9 | 10 | **lm_owf_gen** It takes one unnamed argument. 11 | 12 | ## DESCRIPTION 13 | 14 | lm_owf_gen is a type of hash function. 15 | 16 | 17 | ## RETURN VALUE 18 | 19 | lm_owf_gen hash 20 | 21 | ## ERRORS 22 | 23 | Returns NULL when given data is null or when the algorithm is not supported by the installed gcrypt library. 24 | 25 | ## EXAMPLES 26 | 27 | ```cpp 28 | hash = lm_owf_gen("test"); 29 | ``` 30 | 31 | ## SEE ALSO 32 | 33 | **[nt_owf_gen(3)](nt_owf_gen.md)**, 34 | **[ntv2_owf_gen(3)](ntv2_owf_gen.md)**, 35 | -------------------------------------------------------------------------------- /doc/manual/nasl/built-in-functions/cryptographic/nt_owf_gen.md: -------------------------------------------------------------------------------- 1 | # nt_owf_gen 2 | 3 | ## NAME 4 | 5 | **nt_owf_gen** - takes a unnamed paramaeter and returns NT one way hash. 6 | ## SYNOPSIS 7 | 8 | *str* **nt_owf_gen**(str); 9 | 10 | **nt_owf_gen** It takes one unnamed argument. 11 | 12 | ## DESCRIPTION 13 | 14 | nt_owf_gen is a type of hash function. 15 | 16 | 17 | ## RETURN VALUE 18 | 19 | nt_owf_gen hash 20 | 21 | ## ERRORS 22 | 23 | Returns NULL when given data is null or when the algorithm is not supported by the installed gcrypt library. 24 | 25 | ## EXAMPLES 26 | 27 | ```cpp 28 | hash = nt_owf_gen("test"); 29 | ``` 30 | 31 | ## SEE ALSO 32 | 33 | **[lm_owf_gen(3)](lm_owf_gen.md)**, 34 | **[ntv2_owf_gen(3)](ntv2_owf_gen.md)**, 35 | -------------------------------------------------------------------------------- /doc/manual/nasl/built-in-functions/cryptographic/ntlm2_response.md: -------------------------------------------------------------------------------- 1 | # ntlm2_response 2 | 3 | ## NAME 4 | 5 | **ntlm2_response** - takes three named arguments cryptkey, password, nt_hash 6 | ## SYNOPSIS 7 | 8 | *str* **ntlm2_response**(cryptkey: str, password: str, nt_hash: str); 9 | 10 | **ntlm2_response** It takes three named arguments cryptkey, password, nt_hash to generate ntlm2 response. 11 | 12 | The nt_hash is the `nt_owf_gen` response of the password given in password. 13 | 14 | ## DESCRIPTION 15 | 16 | ntlm2_response generates the ntlm2_response based on the given arguments. 17 | 18 | 19 | ## RETURN VALUE 20 | 21 | ntlm2_response 22 | 23 | ## ERRORS 24 | 25 | Returns NULL when a given parameter is null. 26 | 27 | ## SEE ALSO 28 | 29 | **[ntlm_response(3)](ntlm_response.md)**, 30 | **[ntlmv2_response(3)](ntlmv2_response.md)**, 31 | -------------------------------------------------------------------------------- /doc/manual/nasl/built-in-functions/cryptographic/ntv2_owf_gen.md: -------------------------------------------------------------------------------- 1 | # ntv2_owf_gen 2 | 3 | ## NAME 4 | 5 | **ntv2_owf_gen** - takes fiven named arguments owf, login, domain, length, insert_hexzeros to generate the NTLMv2 of a users's password. 6 | 7 | ## SYNOPSIS 8 | 9 | *str* **ntv2_owf_gen**(owf: str, login: str, domain: str, length int, insert_hexzeros str); 10 | 11 | **ntv2_owf_gen** It takes fiven named arguments owf, login, domain, length, insert_hexzeros to generate the NTLMv2 of a users's password. 12 | 13 | ## DESCRIPTION 14 | 15 | ntv2_owf_gen generates the ntv2_owf_gen based on the given arguments. 16 | 17 | 18 | ## RETURN VALUE 19 | 20 | ntv2_owf_gen 21 | 22 | ## ERRORS 23 | 24 | Returns NULL when a given parameter is null. 25 | 26 | ## SEE ALSO 27 | 28 | **[lm_owf_gen(3)](lm_owf_gen.md)**, 29 | **[nt_owf_gen(3)](nt_owf_gen.md)**, 30 | -------------------------------------------------------------------------------- /doc/manual/nasl/built-in-functions/cryptographic/pem_to_dsa.md: -------------------------------------------------------------------------------- 1 | # pem_to_dsa 2 | 3 | ## NAME 4 | 5 | **pem_to_dsa** - reads the private key in pem format to return the `x` parameter of the DSA key. 6 | 7 | ## SYNOPSIS 8 | 9 | *str* **pem_to_dsa**(priv: str, passphrase: str); 10 | 11 | **pem_to_dsa** reads the private key in pem format to return the `x` parameter of the DSA key. 12 | 13 | ## DESCRIPTION 14 | 15 | Reads the private key from the `priv` which contains a private DSA key in PEM format. 16 | 17 | `passphrase` is the password needed to decrypt the private key. 18 | 19 | 20 | ## RETURN VALUE 21 | 22 | Returns the parameter `x` of the DSA key as an MPI. 23 | 24 | ## ERRORS 25 | 26 | Returns NULL when a given parameter is null. 27 | 28 | ## SEE ALSO 29 | 30 | **[pem_to_rsa(3)](pem_to_rsa.md)**, 31 | -------------------------------------------------------------------------------- /doc/manual/nasl/built-in-functions/cryptographic/pem_to_rsa.md: -------------------------------------------------------------------------------- 1 | # pem_to_rsa 2 | 3 | ## NAME 4 | 5 | **pem_to_rsa** - reads the private key in pem format to return the `d` parameter of the RSA key. 6 | 7 | ## SYNOPSIS 8 | 9 | *str* **pem_to_rsa**(priv: str, passphrase: str); 10 | 11 | **pem_to_rsa** reads the private key in pem format to return the `d` parameter of the RSA key. 12 | 13 | ## DESCRIPTION 14 | 15 | Reads the private key from the `priv` which contains a private RSA key in PEM format. 16 | 17 | `passphrase` is the password needed to decrypt the private key. 18 | 19 | 20 | ## RETURN VALUE 21 | 22 | Returns the parameter ”d” of the RSA key as an MPI. 23 | 24 | ## ERRORS 25 | 26 | Returns NULL when a given parameter is null. 27 | 28 | ## SEE ALSO 29 | 30 | **[pem_to_dsa(3)](pem_to_dsa.md)**, 31 | -------------------------------------------------------------------------------- /doc/manual/nasl/built-in-functions/cryptographic/rsa_sign.md: -------------------------------------------------------------------------------- 1 | # rsa_sign 2 | 3 | ## NAME 4 | 5 | **rsa_sign** - signs data with the given private RSA key. 6 | 7 | ## SYNOPSIS 8 | 9 | *str* **rsa_sign**(data: str, priv: str, passphrase: str); 10 | 11 | **rsa_sign** signs data with the given private RSA key. 12 | 13 | ## DESCRIPTION 14 | 15 | Signs the data with the private RSA key `priv` given in PEM format. 16 | 17 | The passphrase is the password needed to decrypt the private key. 18 | 19 | 20 | ## RETURN VALUE 21 | Returns the signed data. 22 | 23 | ## ERRORS 24 | 25 | Returns NULL when a given parameter is null. 26 | 27 | ## SEE ALSO 28 | 29 | **[rsa_private_decrypt(3)](rsa_private_decrypt.md)**, 30 | **[rsa_public_decrypt(3)](rsa_public_decrypt.md)**, 31 | **[rsa_public_encrypt(3)](rsa_public_encrypt.md)**, 32 | -------------------------------------------------------------------------------- /doc/manual/nasl/built-in-functions/cryptographic/smb3kdf.md: -------------------------------------------------------------------------------- 1 | # smb3kdf 2 | 3 | ## NAME 4 | 5 | **smb3kdf** - is a key derivation function for SMB3 6 | 7 | ## SYNOPSIS 8 | 9 | *str* **smb3kdf**(key: str, label: str, ctx: str, lvalue: int); 10 | 11 | **smb3kdf** It takes six named arguments cryptkey, user, domain, ntlmv2_hash, address_list, address_list_len to generate a ntlmv2 response. 12 | 13 | The ntlmv2_hash is usually the output of `ntv2_owf_gen`. 14 | 15 | ## DESCRIPTION 16 | 17 | smb3kdf is a key derivation function for SMB3 based on SP800-108 §5.1. 18 | 19 | 20 | ## RETURN VALUE 21 | 22 | The deviated key. 23 | 24 | ## ERRORS 25 | 26 | Returns NULL when a given parameter is null. 27 | -------------------------------------------------------------------------------- /doc/manual/nasl/built-in-functions/cryptographic/smb_cmac_aes_signature.md: -------------------------------------------------------------------------------- 1 | # smb_cmac_aes_signature 2 | 3 | ## NAME 4 | 5 | **smb_cmac_aes_signature** - takes two named arguments key, buf 6 | 7 | ## SYNOPSIS 8 | 9 | *str* **smb_cmac_aes_signature**(key: str, buf: str); 10 | 11 | **smb_cmac_aes_signature** It takes four named arguments key, buf. 12 | 13 | ## DESCRIPTION 14 | 15 | smb_cmac_aes_signature gets the cmac aes signature based on the given arguments. 16 | 17 | 18 | ## RETURN VALUE 19 | 20 | smb_cmac_aes_signature 21 | 22 | ## ERRORS 23 | 24 | Returns NULL when a given parameter is null. 25 | 26 | ## SEE ALSO 27 | 28 | **[smb_gmac_aes_signature(3)](smb_gmac_aes_signature.md)**, 29 | -------------------------------------------------------------------------------- /doc/manual/nasl/built-in-functions/cryptographic/smb_gmac_aes_signature.md: -------------------------------------------------------------------------------- 1 | # smb_gmac_aes_signature 2 | 3 | ## NAME 4 | 5 | **smb_gmac_aes_signature** - takes two named arguments key, buf, iv 6 | 7 | ## SYNOPSIS 8 | 9 | *str* **smb_gmac_aes_signature**(key: str, buf: str, iv: str); 10 | 11 | **smb_gmac_aes_signature** It takes four named arguments key, buf. iv 12 | 13 | ## DESCRIPTION 14 | 15 | smb_gmac_aes_signature gets the gmac_aes signature based on the given arguments. 16 | 17 | 18 | ## RETURN VALUE 19 | 20 | smb_gmac_aes_signature 21 | 22 | ## ERRORS 23 | 24 | Returns NULL when a given parameter is null. 25 | 26 | ## SEE ALSO 27 | 28 | **[smb_cmac_aes_signature(3)](smb_cmac_aes_signature.md)**, 29 | -------------------------------------------------------------------------------- /doc/manual/nasl/built-in-functions/description-functions/script_copyright.md: -------------------------------------------------------------------------------- 1 | # script_copyright 2 | 3 | **script_copyright** - Deprecated. Kept for backward compatibility, but currently does nothing. 4 | -------------------------------------------------------------------------------- /doc/manual/nasl/built-in-functions/glue-functions/get_preference.md: -------------------------------------------------------------------------------- 1 | # get_preference 2 | 3 | ## NAME 4 | 5 | **get_preference** - get a preference 6 | 7 | ## SYNOPSIS 8 | 9 | *string* **get_preference**(0: *string*); 10 | 11 | **get_preference** takes 1 positional argument 12 | 13 | ## DESCRIPTION 14 | 15 | This function is necessary to retrieve some preferences. Its argument is: 16 | 0. name of the argument to retrieve 17 | 18 | ## RETURN VALUE 19 | 20 | Value of the preference or *NULL* on error. 21 | 22 | ## ERRORS 23 | 24 | - Preference does not exist 25 | 26 | ## EXAMPLES 27 | 28 | 1. Get the preference port_range: 29 | ```c# 30 | p = get_preference(’port_range’); # returns something like 1-65535 31 | ``` 32 | -------------------------------------------------------------------------------- /doc/manual/nasl/built-in-functions/glue-functions/get_script_oid.md: -------------------------------------------------------------------------------- 1 | # get_script_oid 2 | 3 | ## NAME 4 | 5 | **get_script_oid** - get the OID of the current script 6 | 7 | ## SYNOPSIS 8 | 9 | *string* **get_script_oid**(); 10 | 11 | **get_script_oid** takes no arguments 12 | 13 | ## DESCRIPTION 14 | 15 | THis function returns the OID of the current script. 16 | 17 | ## RETURN VALUE 18 | 19 | OID of the current script 20 | -------------------------------------------------------------------------------- /doc/manual/nasl/built-in-functions/glue-functions/index.md: -------------------------------------------------------------------------------- 1 | # Glue functions 2 | 3 | ## GENERAL 4 | 5 | This part contains functions that are dependent on openVAS. 6 | 7 | ## TABLE OF CONTENT 8 | 9 | - **[get_preference](get_preference.md)** - get a preference 10 | - **[get_script_oid](get_script_oid.md)** - get the OID of the current script 11 | - **[script_get_preference_file_content](script_get_preference_file_content.md)** - get the file contents of a plugins preference that is of type "file" 12 | - **[script_get_preference_file_location](script_get_preference_file_location.md)** - get the location of a plugin preference of type "file" 13 | - **[script_get_preference](script_get_preference.md)** - get the value of a plugin preference 14 | - **[vendor_version](vendor_version.md)** - get vendor version 15 | -------------------------------------------------------------------------------- /doc/manual/nasl/built-in-functions/glue-functions/script_get_preference.md: -------------------------------------------------------------------------------- 1 | # script_get_preference 2 | 3 | ## NAME 4 | 5 | **script_get_preference** - get the value of a plugin preference 6 | 7 | ## SYNOPSIS 8 | 9 | *string* **script_get_preference**(id: *int*, 0: *string*); 10 | 11 | **script_get_preference** takes 1 optional named argument and 1 optional positional argument. 12 | 13 | ## DESCRIPTION 14 | 15 | Get the value of a plugin preference. Its arguments are: 16 | id: the preference ID. 17 | 0. the name of the preference to get 18 | 19 | At least one argument is required to get the preference. If both are given, the ID has priority. 20 | 21 | ## RETURN VALUE 22 | 23 | The value of the preference or *NULL* on error 24 | 25 | ## ERRORS 26 | 27 | - no argument was given 28 | - the preference does not exist 29 | -------------------------------------------------------------------------------- /doc/manual/nasl/built-in-functions/glue-functions/script_get_preference_file_content.md: -------------------------------------------------------------------------------- 1 | # script_get_preference_file_content 2 | 3 | ## NAME 4 | 5 | **script_get_preference_file_content** - get the file contents of a plugins preference that is of type "file" 6 | 7 | ## SYNOPSIS 8 | 9 | *string* **script_get_preference_file_content**(0: *string*); 10 | 11 | **script_get_preference_file_content** takes up to 2 named arguments 12 | 13 | ## DESCRIPTION 14 | 15 | As files sent to the scanner (e.g. as plugin preference) are stored in a hash table with an identifier supplied by the client as the key, the contents have to be looked up. 16 | 17 | Its argument is: 18 | 0. name of the preference 19 | 20 | ## RETURN VALUE 21 | 22 | Content of the file or *NULL* on error 23 | 24 | ## ERRORS 25 | 26 | - no argument was given 27 | - the preference is not of type file 28 | -------------------------------------------------------------------------------- /doc/manual/nasl/built-in-functions/glue-functions/script_get_preference_file_location.md: -------------------------------------------------------------------------------- 1 | # script_get_preference_file_location 2 | 3 | ## NAME 4 | 5 | **script_get_preference_file_location** - get the location of a plugin preference of type "file" 6 | 7 | ## SYNOPSIS 8 | 9 | *string* **script_get_preference_file_location**(0: *string*); 10 | 11 | **script_get_preference_file_location** takes 1 positional argument. 12 | 13 | ## DESCRIPTION 14 | 15 | As files sent to the server (e.g. as plugin preference) are stored at pseudo-random locations with different names, the "real" file name has to be looked up in a hash table. 16 | 17 | Its argument is: 18 | 0. name of the preference 19 | 20 | ## RETURN VALUE 21 | 22 | Location of the preference or *NULL* on error. 23 | 24 | ## ERRORS 25 | 26 | - no argument was given 27 | - the preference is not of type file 28 | -------------------------------------------------------------------------------- /doc/manual/nasl/built-in-functions/glue-functions/vendor_version.md: -------------------------------------------------------------------------------- 1 | # vendor_version 2 | 3 | ## NAME 4 | 5 | **vendor_version** - get vendor version 6 | 7 | ## SYNOPSIS 8 | 9 | *string* **vendor_version**(); 10 | 11 | **vendor_version** takes no arguments 12 | 13 | ## DESCRIPTION 14 | 15 | This function just returns the vendor version. 16 | 17 | ## RETURN VALUE 18 | 19 | The vendor version. 20 | -------------------------------------------------------------------------------- /doc/manual/nasl/built-in-functions/host-functions/TARGET_IS_IPV6.md: -------------------------------------------------------------------------------- 1 | # TARGET_IS_IPV6 2 | 3 | ## NAME 4 | 5 | **TARGET_IS_IPV6** - check if the currently scanned target is an IPv6 address 6 | 7 | ## SYNOPSIS 8 | 9 | *bool* **TARGET_IS_IPV6**(); 10 | 11 | **TARGET_IS_IPV6** takes no arguments 12 | 13 | ## DESCRIPTION 14 | 15 | Check if the currently scanned target is an IPv6 address. 16 | 17 | ## RETURN VALUE 18 | 19 | *TRUE* if the current target is an IPv6 address, else *FALSE*. In case of an error, *NULL* is returned. 20 | 21 | 22 | ## ERROR 23 | 24 | No IP address for the current target is set. 25 | -------------------------------------------------------------------------------- /doc/manual/nasl/built-in-functions/host-functions/add_host_name.md: -------------------------------------------------------------------------------- 1 | # add_host_name 2 | 3 | ## NAME 4 | 5 | **add_host_name** - add a host name to the vhost list 6 | 7 | ## SYNOPSIS 8 | 9 | *void* **add_host_name**(hostname: *string*, source: *string*); 10 | 11 | **add_host_name** takes up to 2 named arguments 12 | 13 | ## DESCRIPTION 14 | 15 | Expands the vHosts list with the given hostname. 16 | 17 | The mandatory parameter *hostname* is of type *string*. It contains the hostname which should be added to the list of vHosts 18 | 19 | Additionally a source, how the hostname was detected can be added with the named argument *source* as a *string*. If it is not given, the value *NASL* is set as default. 20 | 21 | ## RETURN VALUE 22 | 23 | None 24 | 25 | ## ERRORS 26 | 27 | The named argument *hostname* is missing. 28 | -------------------------------------------------------------------------------- /doc/manual/nasl/built-in-functions/host-functions/get_host_name.md: -------------------------------------------------------------------------------- 1 | # get_host_name 2 | 3 | ## NAME 4 | 5 | **get_host_name** - get the currently scanned host 6 | 7 | ## SYNOPSIS 8 | 9 | *string* **get_host_name**(); 10 | 11 | **get_host_name** takes no arguments 12 | 13 | ## DESCRIPTION 14 | 15 | Get the host name of the currently scanned target. If there is no host name available, the IP of the target is returned instead. 16 | 17 | ## RETURN VALUE 18 | 19 | Return the found host name or IP as *string* 20 | -------------------------------------------------------------------------------- /doc/manual/nasl/built-in-functions/host-functions/get_host_name_source.md: -------------------------------------------------------------------------------- 1 | # get_host_name_source 2 | 3 | ## NAME 4 | 5 | **get_host_name_source** - get the hostname source 6 | 7 | ## SYNOPSIS 8 | 9 | *string* **get_host_name_source**(hostname: *string*); 10 | 11 | **get_host_name_source** takes one named argument 12 | 13 | ## DESCRIPTION 14 | 15 | This function returns the source of detection of a given hostname. 16 | 17 | The named parameter *hostname* is a *string* containing the hostname. 18 | 19 | When no hostname is given, the current scanned host is taken. 20 | 21 | If no virtual hosts are found yet this function always returns *IP-address*. 22 | 23 | ## RETURN VALUE 24 | 25 | Source of detection of a given hostname as *string* or *NULL* if hostname unknown 26 | 27 | ## SEE ALSO 28 | 29 | **[add_host_name(3)](add_host_name.md)** -------------------------------------------------------------------------------- /doc/manual/nasl/built-in-functions/host-functions/get_host_names.md: -------------------------------------------------------------------------------- 1 | # get_host_names 2 | 3 | ## NAME 4 | 5 | **get_host_names** - get a list with found hostnames 6 | 7 | ## SYNOPSIS 8 | 9 | *array* **get_host_names**(); 10 | 11 | **get_host_names** takes no arguments 12 | 13 | ## DESCRIPTION 14 | 15 | Get a list of found hostnames or a IP of the current target in case no hostnames were found yet. 16 | 17 | ## RETURN VALUE 18 | 19 | An *array* containing all found hostnames as *string*. The return type is always a NASL array. 20 | 21 | ## SEE ALSO 22 | 23 | **[add_host_name(3)](add_host_name.md)** -------------------------------------------------------------------------------- /doc/manual/nasl/built-in-functions/host-functions/index.md: -------------------------------------------------------------------------------- 1 | # HostFunctions 2 | 3 | ## GENERAL 4 | 5 | Host functions are used to get, resolve, compare and add hosts to the vhosts list 6 | 7 | ## TABLE OF CONTENT 8 | 9 | - **[add_host_name](add_host_name.md)** - add a host name to the vhost list 10 | - **[get_host_names](get_host_names.md)** - get a list with found hostnames 11 | - **[get_host_name_source](get_host_name_source.md)** - get the hostname source 12 | - **[resolve_host_name](resolve_host_name.md)** - get an IP address corresponding to the host name 13 | - **[resolve_hostname_to_multiple_ips](resolve_hostname_to_multiple_ips.md)** - resolve a hostname to all found addresses 14 | - **[same_host](same_host.md)** - compare two hosts 15 | - **[TARGET_IS_IPV6](TARGET_IS_IPV6.md)** - check if the currently scanned target is an IPv6 address 16 | -------------------------------------------------------------------------------- /doc/manual/nasl/built-in-functions/host-functions/ip_reverse_lookup.md: -------------------------------------------------------------------------------- 1 | # ip_reverse_lookup 2 | 3 | ## NAME 4 | 5 | **ip_reverse_lookup** - gets the host name of either the given IP address or the current target 6 | 7 | ## SYNOPSIS 8 | 9 | *string* **ip_reverse_lookup**( *string* ); 10 | 11 | Takes an optional *string* parameter, which is the IP address to look up. If no parameter is given, the IP address of the current target is used. 12 | 13 | ## DESCRIPTION 14 | 15 | This function uses the `gethostbyaddr` function to get the host name of the given IP address. If no IP address is given, the IP address of the current target is used. 16 | 17 | ## RETURN VALUE 18 | 19 | Return the found host name or NULL if the host name could not be retrieved. 20 | -------------------------------------------------------------------------------- /doc/manual/nasl/built-in-functions/host-functions/resolve_host_name.md: -------------------------------------------------------------------------------- 1 | # resolve_host_name 2 | 3 | ## NAME 4 | 5 | **resolve_host_name** - get an IP address corresponding to the host name 6 | 7 | ## SYNOPSIS 8 | 9 | *string* **resolve_host_name**(hostname: *string*); 10 | 11 | **resolve_host_name** takes one named argument 12 | 13 | ## DESCRIPTION 14 | 15 | Tries to resolve the IP of a given hostname as IPv6. 16 | 17 | The named parameter *hostname* is a *string* containing the hostname to resolve. 18 | 19 | ## RETURN VALUE 20 | 21 | The resolve IPv6 as *string* or *NULL*, when the hostname could not be resolved or on an error 22 | 23 | ## ERRORS 24 | 25 | The named parameter *hostname* is missing 26 | -------------------------------------------------------------------------------- /doc/manual/nasl/built-in-functions/host-functions/same_host.md: -------------------------------------------------------------------------------- 1 | # same_host 2 | 3 | ## NAME 4 | 5 | **same_host** - compare two hosts 6 | 7 | ## SYNOPSIS 8 | 9 | *bool* **same_host**(0: *string*, 1: *string*, cmp_hostname: *bool*); 10 | 11 | **same_host** takes two unnamed arguments and one named argument 12 | 13 | ## DESCRIPTION 14 | 15 | Compare if two hosts are the same. 16 | 17 | The first two unnamed arguments are *string* containing the host to compare 18 | 19 | If the named argument *cmp_hostname* is set to *TRUE*, the given hosts are resolved into their hostnames 20 | 21 | ## RETURN VALUE 22 | 23 | TRUE if both hosts are the same, else FALSE. In case of an error a *NULL* is returned instead 24 | 25 | ## ERRORS 26 | 27 | One of the two positional arguments are missing 28 | 29 | One of the hostnames is too long, max length: 255 30 | -------------------------------------------------------------------------------- /doc/manual/nasl/built-in-functions/http-functions/cgibin.md: -------------------------------------------------------------------------------- 1 | # cgibin 2 | 3 | ## NAME 4 | 5 | **cgibin** - Get the cgi-bin path elements. 6 | 7 | ## SYNOPSIS 8 | 9 | *void* **cgibin**(); 10 | 11 | **cgibin** takes no argument. 12 | 13 | ## DESCRIPTION 14 | Returns the cgi-bin path elements. In fact the NASL interpreter forks and each process gets one value. 15 | 16 | ## RETURN VALUE 17 | String containing the path. 18 | 19 | ## EXAMPLES 20 | 21 | **1** Get and display the path: 22 | ```cpp 23 | path = cgibin(); 24 | display (path); 25 | ``` 26 | 27 | ## SEE ALSO 28 | 29 | **[cgibin(3)](cgibin.md)**, **[http_delete(3)](http.md)**, **[http_get(3)](http.md)**, **[http_close_socket(3)](http.md)**, **[http_head(3)](http.md)**, **[http_open_socket(3)](http.md)**, **[http_post(3)](http.md)**, **[http_put(3)](http.md)** 30 | -------------------------------------------------------------------------------- /doc/manual/nasl/built-in-functions/index.md: -------------------------------------------------------------------------------- 1 | # Built-in Functions 2 | 3 | ## GENERAL 4 | 5 | The NASL language contains a collection of built-in functions to provide many tools to detect vulnerabilities of a network device. -------------------------------------------------------------------------------- /doc/manual/nasl/built-in-functions/isotime-functions/isotime_is_valid.md: -------------------------------------------------------------------------------- 1 | # isotime_is_valid 2 | 3 | ## NAME 4 | 5 | **isotime_is_valid** - check if a ISO time string is valid 6 | 7 | ## SYNOPSIS 8 | 9 | *bool* **isotime_is_valid**(0: *string*); 10 | 11 | **isotime_is_valid** takes 1 positional argument. 12 | 13 | ## DESCRIPTION 14 | 15 | Checks the validity for a given ISO time string. Valid strings are both the standard 15 byte string (`yyyymmddThhmmss`) and the better human readable up to 19 byte (`yyyy-mm-dd[ hh[:mm[:ss]]]`) are valid. 16 | 17 | The first unnamed argument is the *string* to be checked. 18 | 19 | ## RETURN VALUE 20 | 21 | A *bool* either TRUE or FALSE 22 | -------------------------------------------------------------------------------- /doc/manual/nasl/built-in-functions/isotime-functions/isotime_now.md: -------------------------------------------------------------------------------- 1 | # isotime_now 2 | 3 | ## NAME 4 | 5 | **isotime_now** - get the current time in the standard ISO format 6 | 7 | *string* **isotime_now**(); 8 | 9 | **isotime_now** takes no arguments 10 | 11 | ## DESCRIPTION 12 | 13 | If available get the current time in the standard ISO time format (`yyyymmddThhmmss`). 14 | 15 | ## RETURN VALUE 16 | 17 | The current ISO time as *string* or *NULL* if no time is available. 18 | -------------------------------------------------------------------------------- /doc/manual/nasl/built-in-functions/isotime-functions/isotime_print.md: -------------------------------------------------------------------------------- 1 | # isotime_print 2 | 3 | ## NAME 4 | 5 | **isotime_print** - convert ISO time string to a better readable form 6 | 7 | *string* **isotime_print**(0: *string*); 8 | 9 | **isotime_print** takes one positional argument. 10 | 11 | ## DESCRIPTION 12 | 13 | Convert a standard isotime (`yyyymmddThhmmss`) into the human readable variant (`yyyy-mm-dd hh:mm:ss`). 14 | 15 | The first unnamed argument is a *string* containing the string to convert. 16 | 17 | ## RETURN VALUE 18 | 19 | The ISO time in a human readable form as *string* or *NULL* on error. 20 | 21 | ## ERRORS 22 | 23 | First unnamed argument is either missing or in the wrong format. 24 | -------------------------------------------------------------------------------- /doc/manual/nasl/built-in-functions/isotime-functions/isotime_scan.md: -------------------------------------------------------------------------------- 1 | # isotime_scan 2 | 3 | ## NAME 4 | 5 | **isotime_scan** - convert a string into an ISO time string 6 | 7 | *string* **isotime_scan**(0: *string*); 8 | 9 | **isotime_scan** takes 1 positional argument. 10 | 11 | ## DESCRIPTION 12 | 13 | Convert a standard isotime (`yyyymmddThhmmss`) or a human readable variant (`yyyy-mm-dd[ hh[:mm[:ss]]]`) into the standard isotime (`yyyymmddThhmmss`). 14 | 15 | The first unnamed argument is a *string* containing the string to convert. 16 | 17 | ## RETURN VALUE 18 | 19 | The standard ISO time as *string* or *NULL* on error. 20 | 21 | ## ERRORS 22 | 23 | First unnamed argument is missing. 24 | 25 | Given string is too short. 26 | 27 | Unable to convert string. 28 | -------------------------------------------------------------------------------- /doc/manual/nasl/built-in-functions/knowledge-base/get_host_kb_index.md: -------------------------------------------------------------------------------- 1 | # get_host_kb_index 2 | 3 | ## NAME 4 | 5 | **get_host_kb_index** - Get the KB index of the host running the current script 6 | 7 | ## SYNOPSIS 8 | 9 | *int* **get_host_kb_index**(name: *string*, value: *any*); 10 | 11 | **get_host_kb_index** takes no arguments 12 | 13 | 14 | ## DESCRIPTION 15 | 16 | This function will return the index number of the currently used Redis Database. This index belongs to the host, which is currently scanned. 17 | 18 | 19 | ## RETURN VALUE 20 | 21 | KB index, *int* or None, when redis index cannot be determined 22 | 23 | 24 | ## SEE ALSO 25 | 26 | **[get_kb_item(3)](get_kb_item.md)**, **[get_kb_list(3)](get_kb_list.md)**, **[replace_kb_item(3)](replace_kb_item.md)**, **[set_kb_item(3)](set_kb_item.md)**, **[openvas-nasl(1)](../../openvas-nasl.md)** 27 | -------------------------------------------------------------------------------- /doc/manual/nasl/built-in-functions/knowledge-base/index.md: -------------------------------------------------------------------------------- 1 | # Knowledge-Base Functions 2 | 3 | ## GENERAL 4 | 5 | Knowledge-Base Functions are primarily used for inter-plugin communication. 6 | 7 | ## TABLE OF CONTENT 8 | 9 | - **[get_host_kb_index](get_host_kb_index.md)** - Get the KB index of the host running the current script 10 | - **[get_kb_item](get_kb_item.md)** - retrieves an entry from the KB 11 | - **[get_kb_list](get_kb_list.md)** - retrieves multiple entries from the KB 12 | - **[replace_kb_item](replace_kb_item.md)** - creates a new entry in the KB or replace the old value 13 | - **[set_kb_item](set_kb_item.md)** - creates a new entry in the KB 14 | -------------------------------------------------------------------------------- /doc/manual/nasl/built-in-functions/krb5/krb5_find_kdc.md: -------------------------------------------------------------------------------- 1 | # krb5_find_kdc 2 | 3 | ## NAME 4 | 5 | **krb5_find_kdc** - Find the KDC for a given realm 6 | 7 | ## SYNOPSIS 8 | 9 | *string* **krb5_find_kdc**(realm: *string*); 10 | 11 | **insstr** takes named argument `realm`. 12 | 13 | ## DESCRIPTION 14 | 15 | This function opens the krb5.conf file (located either by environment variable KRB5_CONFIG or /etc/ktrb5.conf) and looks for an kdc entry for the given realm. 16 | 17 | 18 | ## RETURN VALUE 19 | 20 | The found KDC or *NULL* if the KDC could not be found. 21 | 22 | ## ERRORS 23 | 24 | Returns *NULL* if the realm is not found or the krb5.conf file could not be opened. 25 | 26 | ## EXAMPLES 27 | 28 | ```c# 29 | kdc = insstr(realm: 'EXAMPLE.COM'); 30 | display(kdc); 31 | ``` 32 | 33 | 34 | -------------------------------------------------------------------------------- /doc/manual/nasl/built-in-functions/krb5/krb5_gss_init.md: -------------------------------------------------------------------------------- 1 | # krb5_gss_init 2 | 3 | ## NAME 4 | 5 | **krb5_gss_init** - initialize the krb5 GSS-API library 6 | 7 | ## SYNOPSIS 8 | 9 | *int* **krb5_gss_init**(); 10 | 11 | **krb5_gss_init** takes no arguments. 12 | 13 | ## DESCRIPTION 14 | 15 | Initializes the krb5 GSS-API library. This function can be ommited when gss_prepare_context is called. 16 | 17 | When there is an already initialized context it will be destroyed and a new one will be created. 18 | 19 | ## RETURN VALUE 20 | 21 | Returns 0 on success otherwise it is an failure. 22 | 23 | 24 | ## EXAMPLES 25 | 26 | ```c# 27 | result = krb5_gss_init(); 28 | if (krb5_is_failure(result)) { 29 | exit(42); 30 | } 31 | ``` 32 | 33 | 34 | -------------------------------------------------------------------------------- /doc/manual/nasl/built-in-functions/krb5/krb5_is_failure.md: -------------------------------------------------------------------------------- 1 | # krb5_is_failure 2 | 3 | ## NAME 4 | 5 | **krb5_is_failure** - Returns 1 if the last stored krb5 or given result code is a failure, 0 otherwise. 6 | 7 | ## SYNOPSIS 8 | 9 | *int* **krb5_is_failure**(0: *int*); 10 | 11 | **krb5_is_failure** takes an optional positional argument. 12 | 13 | ## DESCRIPTION 14 | 15 | Checks if given result code or cached result code is a failure. If no result code is given, the last cached result code is used. 16 | 17 | The cached result code reflects the error code of the last krb5 function call. 18 | 19 | 20 | ## RETURN VALUE 21 | 22 | Returns 1 if the result code is a failure, 0 otherwise. 23 | 24 | 25 | ## EXAMPLES 26 | 27 | ```c# 28 | failure = krb5_is_failure(); 29 | display(failure); 30 | ``` 31 | 32 | 33 | -------------------------------------------------------------------------------- /doc/manual/nasl/built-in-functions/krb5/krb5_is_success.md: -------------------------------------------------------------------------------- 1 | # krb5_is_success 2 | 3 | ## NAME 4 | 5 | **krb5_is_success** - Returns 1 if the last stored krb5 or given result code is a success, 0 otherwise. 6 | 7 | ## SYNOPSIS 8 | 9 | *int* **krb5_is_success**(0: *int*); 10 | 11 | **krb5_is_success** takes an optional positional argument. 12 | 13 | ## DESCRIPTION 14 | 15 | Checks if given result code or cached result code is a success. If no result code is given, the last cached result code is used. 16 | 17 | The cached result code reflects the error code of the last krb5 function call. 18 | 19 | 20 | ## RETURN VALUE 21 | 22 | Returns 1 if the result code is a success, 0 otherwise. 23 | 24 | 25 | ## EXAMPLES 26 | 27 | ```c# 28 | success = krb5_is_success(); 29 | display(success); 30 | ``` 31 | 32 | 33 | -------------------------------------------------------------------------------- /doc/manual/nasl/built-in-functions/misc/dec2str.md: -------------------------------------------------------------------------------- 1 | # dec2str 2 | 3 | ## NAME 4 | 5 | **dec2str** - converts given num as str 6 | 7 | ## SYNOPSIS 8 | 9 | *str* **dec2str**(num: int); 10 | 11 | **dec2str** takes 1 named argument. 12 | 13 | ## DESCRIPTION 14 | 15 | Converts a given number `num` to string. 16 | 17 | ## Returns 18 | 19 | A string represenation of the given number. 20 | 21 | ## EXAMPLES 22 | 23 | ```cpp 24 | display(dec2str(num: 23)); 25 | ``` 26 | -------------------------------------------------------------------------------- /doc/manual/nasl/built-in-functions/misc/defined_func.md: -------------------------------------------------------------------------------- 1 | # defined_func 2 | 3 | ## NAME 4 | 5 | **defined_func** - check if a given function is defined 6 | 7 | ## SYNOPSIS 8 | 9 | *bool* **defined_func**(0: *string*); 10 | 11 | **defined_func** takes 1 positional argument. 12 | 13 | ## DESCRIPTION 14 | 15 | Returns true when given function name is defined as a function otherwise false. 16 | 17 | ## RETURN VALUE 18 | 19 | true when the function is defined otherwise false. 20 | 21 | ## ERRORS 22 | 23 | Returns NULL when given data is null. 24 | 25 | ## EXAMPLES 26 | 27 | ```cpp 28 | if (defined_func("display")) 29 | display('defined'); 30 | ``` 31 | -------------------------------------------------------------------------------- /doc/manual/nasl/built-in-functions/misc/dump_ctxt.md: -------------------------------------------------------------------------------- 1 | # dump_ctxt 2 | 3 | ## NAME 4 | 5 | **dump_ctxt** - debug function to print the keys available within the called context 6 | 7 | ## SYNOPSIS 8 | 9 | *nil* **dump_ctxt**(); 10 | 11 | **dump_ctxt** takes no arguments. 12 | 13 | ## DESCRIPTION 14 | 15 | Is a debug function to print the keys available within the called context. It does not take any nor returns any arguments. 16 | 17 | ## EXAMPLES 18 | 19 | ```cpp 20 | dump_ctxt(); 21 | ``` 22 | -------------------------------------------------------------------------------- /doc/manual/nasl/built-in-functions/misc/exit.md: -------------------------------------------------------------------------------- 1 | # exit 2 | 3 | ## NAME 4 | 5 | **exit** - ends the script with the given result code 6 | 7 | ## SYNOPSIS 8 | 9 | *void* **exit**(0: *int*); 10 | 11 | **exit** takes one positional argument. 12 | 13 | ## DESCRIPTION 14 | 15 | exit ends the script with the given result code. 16 | 17 | ## EXAMPLES 18 | 19 | ```cpp 20 | exit(1); 21 | ``` 22 | -------------------------------------------------------------------------------- /doc/manual/nasl/built-in-functions/misc/get_byte_order.md: -------------------------------------------------------------------------------- 1 | # get_byte_order 2 | 3 | ## NAME 4 | 5 | **get_byte_order** - get byte order of host system 6 | 7 | ## SYNOPSIS 8 | 9 | *bool* **get_byte_order**(); 10 | 11 | **get_byte_order** takes no arguments 12 | 13 | ## DESCRIPTION 14 | 15 | Returns the byte order of the system. True when little-endian and false when big-endian. 16 | 17 | 18 | ## Returns 19 | 20 | 1 when little-endian 21 | 22 | 0 when bid-endian 23 | ## EXAMPLES 24 | 25 | ```cpp 26 | let le = get_byte_order(); 27 | ``` 28 | -------------------------------------------------------------------------------- /doc/manual/nasl/built-in-functions/misc/gunzip.md: -------------------------------------------------------------------------------- 1 | # gunzip 2 | 3 | ## NAME 4 | 5 | **gunzip** - decompress given data. 6 | 7 | ## SYNOPSIS 8 | 9 | *str* **gunzip**(data: str); 10 | 11 | **gunzip** takes 1 named argument. 12 | 13 | ## DESCRIPTION 14 | 15 | Decompresses given data. 16 | 17 | ## Returns 18 | 19 | Decompressed data. 20 | 21 | ## EXAMPLES 22 | 23 | ```cpp 24 | compressed = gunzip(gzip(data: "very large")); 25 | ``` 26 | -------------------------------------------------------------------------------- /doc/manual/nasl/built-in-functions/misc/gzip.md: -------------------------------------------------------------------------------- 1 | # gzip 2 | 3 | ## NAME 4 | 5 | **gzip** - compress given data with gzip 6 | 7 | ## SYNOPSIS 8 | 9 | *string* **gzip**(*string*, headformat: *string*); 10 | 11 | **gzip** takes 1 positional and 1 named argument. 12 | 13 | ## DESCRIPTION 14 | 15 | Compress given data with gzip, when headformat is set to 'gzip' it uses gzipheader. 16 | 17 | ## Returns 18 | 19 | Compressed data. 20 | 21 | ## EXAMPLES 22 | 23 | ```cpp 24 | compressed = gzip("very large", headformat: "gzip"); 25 | ``` 26 | 27 | ## SEE ALSO 28 | 29 | **[gunzip(3)](gunzip.md)**, 30 | -------------------------------------------------------------------------------- /doc/manual/nasl/built-in-functions/misc/isnull.md: -------------------------------------------------------------------------------- 1 | # isnull 2 | 3 | ## NAME 4 | 5 | **isnull** - check if a given value is NULL 6 | 7 | ## SYNOPSIS 8 | 9 | *bool* **isnull**(*any*); 10 | 11 | **isnull** takes 1 positional argument. 12 | 13 | ## DESCRIPTION 14 | Returns true when the given unnamed argument is null. 15 | 16 | Although semantically equal `isnull` behaves different than `== NULL` while 17 | ``` 18 | if (0 == NULL) 19 | display('0 == NULL'); 20 | ``` 21 | 22 | yields true and prints `0 == NULL` 23 | 24 | ``` 25 | 26 | if (isnull(0)) 27 | display('0 == NULL'); 28 | ``` 29 | 30 | yields false and does not print the message. 31 | 32 | ## RETURN VALUE 33 | 34 | Returns true when the given unnamed argument is null. 35 | 36 | ## EXAMPLES 37 | 38 | ```cpp 39 | if (!isnull(0)) 40 | display('0 != NULL'); 41 | ``` 42 | -------------------------------------------------------------------------------- /doc/manual/nasl/built-in-functions/misc/keys.md: -------------------------------------------------------------------------------- 1 | # keys 2 | 3 | ## NAME 4 | 5 | **keys** - returns an array with the keys of a dict 6 | 7 | ## SYNOPSIS 8 | 9 | *array* **keys**(*array*); 10 | 11 | **keys** takes 1 positional argument. 12 | 13 | ## DESCRIPTION 14 | 15 | Keys returns an array with the keys of a dict. 16 | 17 | ## Returns 18 | 19 | An array of used keys within a dict or NULL when the argument is not a dict/array. 20 | 21 | ## EXAMPLES 22 | 23 | ```cpp 24 | a["test"] = 2; 25 | a[1] = 3; 26 | 27 | display(keys(a)); 28 | ``` 29 | -------------------------------------------------------------------------------- /doc/manual/nasl/built-in-functions/misc/make_array.md: -------------------------------------------------------------------------------- 1 | # make_array 2 | 3 | ## NAME 4 | 5 | **make_array** - takes any even number of unnamed arguments and returns an dictionary made from them 6 | 7 | ## SYNOPSIS 8 | 9 | *dict* **make_array**(any, any, ...); 10 | 11 | **make_array** takes any even number of unnamed arguments and returns an dictionary made from them. 12 | 13 | ## DESCRIPTION 14 | 15 | Takes any even number of unnamed arguments and returns an dictionary made from them. 16 | Each uneven argument will be the key while each even argument is the value. 17 | 18 | ## RETURN VALUE 19 | 20 | Returns a dictionary made out of the arguments. 21 | 22 | ## Error 23 | 24 | Drops the last value when the arguments are not even. 25 | 26 | ## EXAMPLES 27 | 28 | ```cpp 29 | a = make_array('a', 1, 2, 3); 30 | ``` 31 | 32 | ## SEE ALSO 33 | 34 | **[make_list(3)](make_list.md)**, 35 | -------------------------------------------------------------------------------- /doc/manual/nasl/built-in-functions/misc/make_list.md: -------------------------------------------------------------------------------- 1 | # make_list 2 | 3 | ## NAME 4 | 5 | **make_list** - takes any number of unnamed arguments and returns an array made from them. 6 | 7 | ## SYNOPSIS 8 | 9 | *arr* **make_list**(any, ...); 10 | 11 | **make_list** takes any number of unnamed arguments and returns an array made from them. 12 | 13 | ## DESCRIPTION 14 | 15 | Takes any number of unnamed arguments and returns an array made from them. 16 | 17 | It can also be used to flatten arrays. 18 | 19 | ## RETURN VALUE 20 | 21 | Returns an indexed array made out of the arguments. The index starts at 0. 22 | 23 | 24 | ## EXAMPLES 25 | 26 | ```cpp 27 | arr = [0, 2, 3]; 28 | a = make_list('a', 1, arr); 29 | ``` 30 | 31 | ## SEE ALSO 32 | 33 | **[make_array(3)](make_array.md)**, 34 | -------------------------------------------------------------------------------- /doc/manual/nasl/built-in-functions/misc/max_index.md: -------------------------------------------------------------------------------- 1 | # max_index 2 | 3 | ## NAME 4 | 5 | **max_index** - returns the length of an array. 6 | 7 | ## SYNOPSIS 8 | 9 | *int* **max_index**(arr|dict); 10 | 11 | **max_index** takes an array or dict and returns it length. 12 | 13 | ## DESCRIPTION 14 | 15 | Takes any number of unnamed arguments and returns an array made from them. 16 | 17 | It can also be used to flatten arrays. 18 | 19 | ## RETURN VALUE 20 | 21 | Returns an indexed array made out of the arguments. The index starts at 0. 22 | 23 | ## Error 24 | 25 | Returns NULL when given argument is neither a dict nor an array. 26 | 27 | ## EXAMPLES 28 | 29 | ```cpp 30 | arr = [0, 2, 3]; 31 | len = max_index(arr); 32 | ``` 33 | -------------------------------------------------------------------------------- /doc/manual/nasl/built-in-functions/misc/rand.md: -------------------------------------------------------------------------------- 1 | # rand 2 | 3 | ## NAME 4 | 5 | **rand** - returns a pseudo random number. 6 | 7 | ## SYNOPSIS 8 | 9 | *int* **rand**(); 10 | 11 | **rand** returns a pseudo random number. 12 | 13 | ## DESCRIPTION 14 | 15 | Returns a pseudo random number. 16 | 17 | ## Returns 18 | 19 | A pseudo random number. 20 | 21 | ## EXAMPLES 22 | 23 | ```cpp 24 | display(rand()); 25 | ``` 26 | -------------------------------------------------------------------------------- /doc/manual/nasl/built-in-functions/misc/sleep.md: -------------------------------------------------------------------------------- 1 | # sleep 2 | 3 | ## NAME 4 | 5 | **sleep** - takes an integer and sleeps the amount of seconds 6 | 7 | ## SYNOPSIS 8 | 9 | *void* **sleep**(int); 10 | 11 | **sleep** takes an integer and sleeps the amount of seconds 12 | 13 | ## DESCRIPTION 14 | 15 | Sleeps the amount of given seconds. 16 | 17 | ## EXAMPLES 18 | 19 | ```cpp 20 | sleep(1); 21 | ``` 22 | 23 | ## SEE ALSO 24 | 25 | **[usleep(3)](usleep.md)**, 26 | -------------------------------------------------------------------------------- /doc/manual/nasl/built-in-functions/misc/typeof.md: -------------------------------------------------------------------------------- 1 | # typeof 2 | 3 | ## NAME 4 | 5 | **typeof** - returns the type of given unnamed argument. 6 | 7 | ## SYNOPSIS 8 | 9 | *str* **typeof**(any); 10 | 11 | **typeof** returns the type of given unnamed argument. 12 | 13 | ## DESCRIPTION 14 | 15 | Returns the type of the given argument. 16 | 17 | ## RETURN VALUE 18 | 19 | Return 20 | - "undef" if the argument is not initialized, 21 | - "int" if the argument is an integer, 22 | - "string" if the argument is a string, 23 | - "data" if the argument is argument is string based on `''` 24 | - "unknown" if the argument is of an unknown type 25 | 26 | ## EXAMPLES 27 | 28 | ```cpp 29 | display(typeof('a')); 30 | ``` 31 | -------------------------------------------------------------------------------- /doc/manual/nasl/built-in-functions/misc/unixtime.md: -------------------------------------------------------------------------------- 1 | # unixtime 2 | 3 | ## NAME 4 | 5 | **unixtime** - returns the unix time (number of seconds since 1970-01-01). 6 | 7 | ## SYNOPSIS 8 | 9 | *int* **unixtime**(); 10 | 11 | **unixtime** returns the unix time (number of seconds since 1970-01-01). 12 | 13 | ## DESCRIPTION 14 | 15 | Returns the seconds counted from 1st January 1970 as an integer. 16 | 17 | 18 | ## RETURN VALUE 19 | 20 | Returns the seconds counted from 1st January 1970 as an integer. 21 | 22 | 23 | ## EXAMPLES 24 | 25 | ```cpp 26 | display(unixtime()); 27 | ``` 28 | 29 | ## SEE ALSO 30 | 31 | **[gettimeofday(3)](gettimeofday.md)**, 32 | **[localtime(3)](localtime.md)**, 33 | **[mktime(3)](mktime.md)**, 34 | -------------------------------------------------------------------------------- /doc/manual/nasl/built-in-functions/misc/usleep.md: -------------------------------------------------------------------------------- 1 | # usleep 2 | 3 | ## NAME 4 | 5 | **usleep** - takes an integer and sleeps the amount of microseconds 6 | 7 | ## SYNOPSIS 8 | 9 | *void* **usleep**(int); 10 | 11 | **usleep** takes an integer and sleeps the amount of microseconds 12 | 13 | ## DESCRIPTION 14 | 15 | usleeps the amount of given microseconds. 16 | 17 | ## EXAMPLES 18 | 19 | ```cpp 20 | usleep(1); 21 | ``` 22 | 23 | ## SEE ALSO 24 | 25 | **[sleep(3)](sleep.md)**, 26 | -------------------------------------------------------------------------------- /doc/manual/nasl/built-in-functions/network-functions/close.md: -------------------------------------------------------------------------------- 1 | # close 2 | 3 | ## NAME 4 | 5 | **close** - closes the given socket. 6 | 7 | ## SYNOPSIS 8 | 9 | *void* **close**(*FD*); 10 | 11 | **close** takes single unnamed argument, the socket file descriptor to be close. 12 | 13 | ## DESCRIPTION 14 | 15 | 16 | 17 | ## RETURN VALUE 18 | 19 | Return FAKE_CELL, or Null on error 20 | 21 | ## ERRORS 22 | 23 | - Invalid socket value 24 | 25 | ## EXAMPLES 26 | 27 | **1**: Open and close a socket 28 | ```cpp 29 | soc = open_sock_tcp(port); 30 | close(soc); 31 | 32 | ``` 33 | 34 | ## SEE ALSO 35 | 36 | **[open_sock_tcp(3)](open_sock_tcp.md)** -------------------------------------------------------------------------------- /doc/manual/nasl/built-in-functions/network-functions/end_denial.md: -------------------------------------------------------------------------------- 1 | # end_denial 2 | 3 | ## NAME 4 | 5 | **end_denial** - end denial 6 | 7 | ## SYNOPSIS 8 | 9 | *bool* **end_denial**(); 10 | 11 | **end_denial** takes no arguments. 12 | 13 | ## DESCRIPTION 14 | 15 | After calling start_denial before your test, it returns TRUE if the target host is still alive and FALSE if it is dead. **[start_denial(3)](start_denial.md)** must be called before. 16 | 17 | ## RETURN VALUE 18 | 19 | Returns TRUE if the target host is still alive and FALSE if it is dead. 20 | 21 | ## SEE ALSO 22 | 23 | **[start_denial(3)](start_denial.md)** 24 | -------------------------------------------------------------------------------- /doc/manual/nasl/built-in-functions/network-functions/ftp_get_pasv_port.md: -------------------------------------------------------------------------------- 1 | # ftp_get_pasv_port 2 | 3 | ## NAME 4 | 5 | **ftp_get_pasv_port** - sends the “PASV” command on the open socket, parses the returned data and returns the chosen “passive” port 6 | 7 | ## SYNOPSIS 8 | 9 | *any* **ftp_get_pasv_port**(socket:*socket*); 10 | 11 | **ftp_get_pasv_port** It takes one named argument: socket. 12 | 13 | ## DESCRIPTION 14 | 15 | This function sends the “PASV” command on the open socket, parses the returned data and returns the chosen “passive” port. 16 | 17 | ## RETURN VALUE 18 | 19 | Return the passive port or Null 20 | -------------------------------------------------------------------------------- /doc/manual/nasl/built-in-functions/network-functions/get_host_ip.md: -------------------------------------------------------------------------------- 1 | # get_host_ip 2 | 3 | ## NAME 4 | 5 | **get_host_ip** - get the IP of the currently scanned host 6 | 7 | ## SYNOPSIS 8 | 9 | *any* **get_host_ip**(); 10 | 11 | **get_host_ip** takes no argument. 12 | 13 | ## DESCRIPTION 14 | 15 | Get the current host's ip 16 | 17 | ## RETURN VALUE 18 | 19 | Return a string containing the host ip, FAKE_CELL on failure. 20 | -------------------------------------------------------------------------------- /doc/manual/nasl/built-in-functions/network-functions/get_host_open_port.md: -------------------------------------------------------------------------------- 1 | # get_host_open_port 2 | 3 | ## NAME 4 | 5 | **get_host_open_port** - get an open TCP port on the target host 6 | 7 | ## SYNOPSIS 8 | 9 | *any* **get_host_open_port**(); 10 | 11 | **get_host_open_port** takes no arguments. 12 | 13 | ## DESCRIPTION 14 | 15 | This function is used by tests that need to speak to the TCP/IP stack but not to a specific service. 16 | Don't always return the first open port, otherwise it might get bitten by OSes doing active SYN flood countermeasures. Also, avoid returning 80 and 21 as open ports, as many transparent proxies are acting for these. 17 | 18 | ## RETURN VALUE 19 | 20 | Return a random open port from a list (if there is many open ports), the port 21 or the port 80 are the last choices. Returns 0 if there is no open port. 21 | -------------------------------------------------------------------------------- /doc/manual/nasl/built-in-functions/network-functions/get_mtu.md: -------------------------------------------------------------------------------- 1 | # get_mtu 2 | 3 | ## NAME 4 | 5 | **get_mtu** - get the maximum transition unit for the scanned host 6 | 7 | ## SYNOPSIS 8 | 9 | *int* **get_mtu**(); 10 | 11 | **get_mtu** takes no arguments 12 | 13 | ## DESCRIPTION 14 | 15 | This function gets the maximum transition unit (MTU) for the currently scanned host. 16 | 17 | ## RETURN VALUE 18 | 19 | The MTU as *int* 20 | 21 | ## ERRORS 22 | 23 | Unable to get MTU of used interface 24 | -------------------------------------------------------------------------------- /doc/manual/nasl/built-in-functions/network-functions/get_port_state.md: -------------------------------------------------------------------------------- 1 | # get_port_state 2 | 3 | ## NAME 4 | 5 | **get_port_state** - get a port state 6 | 7 | ## SYNOPSIS 8 | 9 | *any* **get_port_state**(*int*); 10 | 11 | **get_port_state** takes one single unnamed argument, the port. 12 | 13 | ## DESCRIPTION 14 | 15 | As some TCP ports may be in an unknown state because they were not scanned, the behavior of this function may be modified by the “consider unscanned ports as closed” global option. When this option is reset (the default), get_port_state will return TRUE on unknown ports; when it is set, get_port_state will return FALSE. 16 | 17 | ## RETURN VALUE 18 | 19 | Returns TRUE if it is open and FALSE otherwise. 20 | -------------------------------------------------------------------------------- /doc/manual/nasl/built-in-functions/network-functions/get_source_port.md: -------------------------------------------------------------------------------- 1 | # get_source_port 2 | 3 | ## NAME 4 | 5 | **get_source_port** - get port of a opened socket 6 | 7 | ## SYNOPSIS 8 | 9 | *int* **get_source_port**(0: *int*); 10 | 11 | **socket_get_ssl_version** takes one positional argument. 12 | 13 | ## DESCRIPTION 14 | 15 | This function gets the port information from a open socket connection. Its argument is: 16 | 0. an *int* representing the socket 17 | 18 | ## RETURN VALUE 19 | 20 | The port number of the socket connection or *NULL* on error. 21 | 22 | ## ERRORS 23 | 24 | - missing argument 25 | - invalid socket 26 | - unable to get socket information 27 | -------------------------------------------------------------------------------- /doc/manual/nasl/built-in-functions/network-functions/islocalhost.md: -------------------------------------------------------------------------------- 1 | # islocalhost 2 | 3 | ## NAME 4 | 5 | **islocalhost** - Check if the target host is the same as the attacking host 6 | 7 | ## SYNOPSIS 8 | 9 | *any* **islocalhost**(); 10 | 11 | **islocalhost** takes no arguments 12 | 13 | ## DESCRIPTION 14 | 15 | Check if the target host is the same as the attacking host 16 | This tests is performed via a packet sent to IP and checking if it is LIKELY to be routed through the kernel localhost interface. 17 | 18 | ## RETURN VALUE 19 | 20 | Return True or False. 21 | -------------------------------------------------------------------------------- /doc/manual/nasl/built-in-functions/network-functions/islocalnet.md: -------------------------------------------------------------------------------- 1 | # islocalnet 2 | 3 | ## NAME 4 | 5 | **islocalnet** - Check if the target host is on the same network as the attacking host 6 | 7 | ## SYNOPSIS 8 | 9 | *any* **islocalnet**(); 10 | 11 | **islocalnet** takes no arguments 12 | 13 | ## DESCRIPTION 14 | 15 | Check if the target host is on the same network as the attacking host 16 | 17 | ## RETURN VALUE 18 | 19 | Return True or False. 20 | -------------------------------------------------------------------------------- /doc/manual/nasl/built-in-functions/network-functions/join_multicast_group.md: -------------------------------------------------------------------------------- 1 | # join_multicast_group 2 | 3 | ## NAME 4 | 5 | **join_multicast_group** - join a multicast group. 6 | 7 | ## SYNOPSIS 8 | 9 | *any* **join_multicast_group**(*string*); 10 | 11 | **join_multicast_group** takes a single unnamed argument, an IP multicast address 12 | 13 | ## DESCRIPTION 14 | 15 | Join the multicast group given by the IP multicast address argument. If the group was already joined, the function joins increments an internal counter 16 | 17 | ## RETURN VALUE 18 | 19 | Return TRUE on success, Null on error. 20 | 21 | ## ERRORS 22 | 23 | - Invalid parameter 24 | - Missing parameter 25 | - Socket error 26 | - Set socket error 27 | -------------------------------------------------------------------------------- /doc/manual/nasl/built-in-functions/network-functions/open_sock_kdc.md: -------------------------------------------------------------------------------- 1 | # open_sock_kdc 2 | 3 | ## NAME 4 | 5 | **open_sock_kdc** - open a kdc socket 6 | 7 | ## SYNOPSIS 8 | 9 | *int* **open_sock_kdc**(); 10 | 11 | **open_sock_kdc** takes no arguments. 12 | 13 | ## DESCRIPTION 14 | 15 | This function takes no arguments, but it is mandatory that keys are set. The following keys are required: 16 | - Secret/kdc_hostname 17 | - Secret/kdc_port 18 | - Secret/kdc_use_tcp 19 | 20 | ## RETURN VALUE 21 | 22 | An *int* representing the socket or *NULL* on error. 23 | 24 | ## Error 25 | 26 | - any of the required keys is missing 27 | - unable to open socket 28 | -------------------------------------------------------------------------------- /doc/manual/nasl/built-in-functions/network-functions/open_sock_udp.md: -------------------------------------------------------------------------------- 1 | # open_sock_udp 2 | 3 | ## NAME 4 | 5 | **open_sock_udp** - opens a UDP socket to the target host. 6 | 7 | ## SYNOPSIS 8 | 9 | *any* **open_sock_udp**(*int*); 10 | 11 | **open_sock_udp** takes an unnamed integer argument (the port number) 12 | 13 | ## DESCRIPTION 14 | 15 | Open a UDP socket to the target host. 16 | 17 | ## RETURN VALUE 18 | A positive integer as a NASL socket, 0 on connection error or NULL on other errors. 19 | 20 | ## EXAMPLES 21 | 22 | **1**: Open and close a socket 23 | ```cpp 24 | soc = open_sock_udp(5060); 25 | close(soc); 26 | ``` 27 | 28 | ## SEE ALSO 29 | 30 | **[close(3)](close.md)** 31 | -------------------------------------------------------------------------------- /doc/manual/nasl/built-in-functions/network-functions/scanner_add_port.md: -------------------------------------------------------------------------------- 1 | # scanner_add_port 2 | 3 | ## NAME 4 | 5 | **scanner_add_port** - declares an open port to openvas-scanner. 6 | 7 | ## SYNOPSIS 8 | 9 | *void* **scanner_add_port**(port: *int, proto: *string*); 10 | 11 | **scanner_add_port** takes two named arguments: 12 | - port: is the port number. 13 | - proto: is "tcp" or "udp". This is optional and "tcp" is the default. 14 | 15 | ## DESCRIPTION 16 | 17 | Declares an open port to openvas-scanner. 18 | 19 | ## RETURN VALUE 20 | 21 | Return FAKE_CELL 22 | 23 | ## ERRORS 24 | 25 | - Invalid socket value 26 | -------------------------------------------------------------------------------- /doc/manual/nasl/built-in-functions/network-functions/scanner_get_port.md: -------------------------------------------------------------------------------- 1 | # scanner_get_port 2 | 3 | ## NAME 4 | 5 | **scanner_get_port** - walks through the list of open ports 6 | 7 | ## SYNOPSIS 8 | 9 | *any* **scanner_get_port**(*int*); 10 | 11 | **scanner_get_port** takes a single unnamed argument, the index. 12 | 13 | ## DESCRIPTION 14 | 15 | Walks through the list of open ports. 16 | If the plugin is a port scanner, it needs to report the list of open ports back to openvas scanner, and it also needs to know which ports are to be scanned. 17 | 18 | 19 | ## RETURN VALUE 20 | 21 | Returns a port number or 0 when the end of the list if reached. 22 | 23 | ## ERRORS 24 | 25 | Index should be 0 the first time you call i 26 | -------------------------------------------------------------------------------- /doc/manual/nasl/built-in-functions/network-functions/start_denial.md: -------------------------------------------------------------------------------- 1 | # start_denial 2 | 3 | ## NAME 4 | 5 | **start_denial** - initializes some internal data structure for end_denial 6 | 7 | ## SYNOPSIS 8 | 9 | *void* **start_denial**(); 10 | 11 | **start_denial** takes no arguments. 12 | 13 | ## DESCRIPTION 14 | 15 | Initializes some internal data structure for **[end_denial(3)](end_denial.md)**. 16 | 17 | ## RETURN VALUE 18 | 19 | None 20 | 21 | ## SEE ALSO 22 | 23 | **[end_denial(3)](end_denial.md)** -------------------------------------------------------------------------------- /doc/manual/nasl/built-in-functions/network-functions/this_host.md: -------------------------------------------------------------------------------- 1 | # this_host 2 | 3 | ## NAME 4 | 5 | **this_host** - get the IP address of the current (attacking) machine 6 | 7 | ## SYNOPSIS 8 | 9 | *any* **this_host**(); 10 | 11 | **this_host** takes no arguments 12 | 13 | ## DESCRIPTION 14 | 15 | This function gets the IP address of the current (attacking) machine. 16 | 17 | ## RETURN VALUE 18 | 19 | The IP address of the host target as string. 20 | -------------------------------------------------------------------------------- /doc/manual/nasl/built-in-functions/network-functions/this_host_name.md: -------------------------------------------------------------------------------- 1 | # this_host_name 2 | 3 | ## NAME 4 | 5 | **this_host_name** - get the host name of the current (attacking) machine 6 | 7 | ## SYNOPSIS 8 | 9 | *any* **this_host_name**(); 10 | 11 | **this_host_name** takes no arguments 12 | 13 | ## DESCRIPTION 14 | 15 | Get the host name of the current (attacking) machine. 16 | 17 | ## RETURN VALUE 18 | 19 | The host name 20 | -------------------------------------------------------------------------------- /doc/manual/nasl/built-in-functions/raw-ip-functions/dump_frame.md: -------------------------------------------------------------------------------- 1 | # dump_frame 2 | 3 | ## NAME 4 | 5 | **dump_frame** - print a datalink layer frame 6 | 7 | ## SYNOPSIS 8 | 9 | *void* **dump_frame**(frame: *string*); 10 | 11 | **dump_frame** takes one named argument 12 | 13 | ## DESCRIPTION 14 | 15 | Print a datalink layer frame in its hexadecimal representation. 16 | 17 | The named argument *frame* is a *string* representing the datalink layer frame. A frame can be created with **[forge_frame(3)](forge_frame.md)**. 18 | 19 | This function is meant to be used for debugging. 20 | 21 | ## RETURN VALUE 22 | 23 | None 24 | 25 | ## SEE ALSO 26 | 27 | **[forge_frame(3)](forge_frame.md)** -------------------------------------------------------------------------------- /doc/manual/nasl/built-in-functions/raw-ip-functions/dump_icmp_v6_packet.md: -------------------------------------------------------------------------------- 1 | # dump_icmp_v6_packet 2 | 3 | ## NAME 4 | 5 | **dump_icmp_v6_packet** - prints the ICMP part of IPv6 datagrams 6 | 7 | ## SYNOPSIS 8 | 9 | *void* **dump_icmp_v6_packet**(*data*...); 10 | 11 | **dump_icmp_v6_packet** takes any number of unnamed arguments. 12 | 13 | ## DESCRIPTION 14 | 15 | Receive a list of IPv6 datagrams and print their ICMP part in a readable format in the screen. 16 | 17 | A datagram can be created with **[forge_icmp_v6_packet(3)](forge_icmp_v6_packet.md)**. 18 | 19 | ## RETURN VALUE 20 | 21 | None 22 | 23 | ## SEE ALSO 24 | 25 | **[forge_icmp_packet(3)](forge_icmp_v6_packet.md)** 26 | -------------------------------------------------------------------------------- /doc/manual/nasl/built-in-functions/raw-ip-functions/dump_ip_v6_packet.md: -------------------------------------------------------------------------------- 1 | # dump_ip_v6_packet 2 | 3 | ## NAME 4 | 5 | **dump_ip_v6_packet** - print IPv6 header 6 | 7 | ## SYNOPSIS 8 | 9 | *NULL* **dump_ip_v6_packet**(*data*...); 10 | 11 | **dump_ip_v6_packet** takes any number of unnamed arguments. 12 | 13 | ## DESCRIPTION 14 | 15 | This function takes any number of IPv6 header and prints them in a readable format. 16 | 17 | This function is exactly the same as **[dump_ipv6_packet(3)](dump_ipv6_packet.md)** 18 | 19 | ## RETURN VALUE 20 | 21 | None 22 | 23 | ## SEE ALSO 24 | 25 | **[dump_ipv6_packet(3)](dump_ipv6_packet.md)** -------------------------------------------------------------------------------- /doc/manual/nasl/built-in-functions/raw-ip-functions/dump_ipv6_packet.md: -------------------------------------------------------------------------------- 1 | # dump_ipv6_packet 2 | 3 | ## NAME 4 | 5 | **dump_ipv6_packet** - print IPv6 header 6 | 7 | ## SYNOPSIS 8 | 9 | *NULL* **dump_ipv6_packet**(*data*...); 10 | 11 | **dump_ipv6_packet** takes any number of unnamed arguments. 12 | 13 | ## DESCRIPTION 14 | 15 | This function takes any number of IPv6 header and prints them in a readable format. 16 | 17 | This function is exactly the same as **[dump_ip_v6_packet(3)](dump_ip_v6_packet.md)** 18 | 19 | ## RETURN VALUE 20 | 21 | None 22 | 23 | ## SEE ALSO 24 | 25 | **[dump_ipv6_packet(3)](dump_ip_v6_packet.md)** -------------------------------------------------------------------------------- /doc/manual/nasl/built-in-functions/raw-ip-functions/dump_tcp_v6_packet.md: -------------------------------------------------------------------------------- 1 | # dump_tcp_v6_packet 2 | 3 | ## NAME 4 | 5 | **dump_tcp_v6_packet** - print the tcp part of IPv6 datagrams 6 | 7 | ## SYNOPSIS 8 | 9 | *NULL* **dump_tcp_v6_packet**(*data*...); 10 | 11 | **dump_tcp_v6_packet** It takes any number of unnamed arguments. 12 | 13 | ## DESCRIPTION 14 | 15 | Receive a list of IPv4 datagrams and print their TCP part in a readable format in the screen. 16 | 17 | ## RETURN VALUE 18 | 19 | None 20 | -------------------------------------------------------------------------------- /doc/manual/nasl/built-in-functions/raw-ip-functions/dump_udp_v6_packet.md: -------------------------------------------------------------------------------- 1 | # dump_udp_v6_packet 2 | 3 | ## NAME 4 | 5 | **dump_udp_v6_packet** - print the UDP part of IPv6 datagrams 6 | 7 | ## SYNOPSIS 8 | 9 | *NULL* **dump_udp_v6_packet**(*data*...); 10 | 11 | **dump_udp_v6_packet** It takes any number of unnamed arguments. 12 | 13 | ## DESCRIPTION 14 | 15 | Receive a list of IPv6 datagrams and print their UDP part in a readable format in the screen. 16 | 17 | ## RETURN VALUE 18 | 19 | None 20 | -------------------------------------------------------------------------------- /doc/manual/nasl/built-in-functions/raw-ip-functions/forge_ipv6_packet.md: -------------------------------------------------------------------------------- 1 | # forge_ipv6_packet 2 | 3 | ## NAME 4 | 5 | **forge_ipv6_packet** - Forge an IPv6 datagram inside the block of data, same as *forge_ip_v6_packet* 6 | 7 | ## SYNOPSIS 8 | 9 | *string* **forge_ipv6_packet**(data: *string*, ip6_v: *int*, ip6_tc: *int*, ip6_fl: *int*, ip6_p: *int*, ip6_hlim: *int*, ip6_src: *string*, ip6_dst: *string*); 10 | 11 | **forge_ipv6_packet** takes named arguments 12 | 13 | ## DESCRIPTION 14 | 15 | For more details see **[forge_ip_v6_packet(3)](forge_ip_v6_packet.md)**. 16 | 17 | ## SEE ALSO 18 | 19 | **[forge_ip_v6_packet(3)](forge_ip_v6_packet.md)** 20 | -------------------------------------------------------------------------------- /doc/manual/nasl/built-in-functions/raw-ip-functions/get_local_mac_address_from_ip.md: -------------------------------------------------------------------------------- 1 | # get_local_mac_address_from_ip 2 | 3 | ## NAME 4 | 5 | **get_local_mac_address_from_ip** - get the MAC address of host 6 | 7 | ## SYNOPSIS 8 | 9 | *string* **get_local_mac_address_from_ip**(0: *string*); 10 | 11 | **get_local_mac_address_from_ip** takes one unnamed argument. 12 | 13 | ## DESCRIPTION 14 | 15 | Get the MAC address of a local IP address. 16 | 17 | The first positional argument is a local IP address as *string*. 18 | 19 | ## RETURN VALUE 20 | 21 | The resolved local MAC address corresponding to the given IP or *NULL* on error. 22 | 23 | ## ERRORS 24 | 25 | - Invalid IP 26 | - Not a local IP 27 | - IP does not resolve do a MAC 28 | -------------------------------------------------------------------------------- /doc/manual/nasl/built-in-functions/raw-ip-functions/insert_ip_options.md: -------------------------------------------------------------------------------- 1 | # insert_ip_options 2 | 3 | ## NAME 4 | 5 | **insert_ip_options** - Add a option to a IP datagram 6 | 7 | ## SYNOPSIS 8 | 9 | *string* **insert_ip_options**(ip: *string*, code: *int*, length: *int*, value: *string*); 10 | 11 | **insert_ip_options** takes 4 named arguments 12 | 13 | ## DESCRIPTION 14 | 15 | Add a option to a specified IP datagram. 16 | 17 | - ip: is the IP datagram 18 | - code: is the identifier of the option to add 19 | - length: is the length of the option data 20 | - value: is the option data 21 | 22 | ## RETURN VALUE 23 | 24 | A new IP datagram with the given option set. 25 | -------------------------------------------------------------------------------- /doc/manual/nasl/built-in-functions/raw-ip-functions/insert_ip_v6_options.md: -------------------------------------------------------------------------------- 1 | # insert_ip_v6_options 2 | 3 | ## NAME 4 | 5 | **insert_ip_v6_options** - Add a option to a IPv6 datagram 6 | 7 | ## SYNOPSIS 8 | 9 | *string* **insert_ip_v6_options**(ip6: *string*, code: *int*, length: *int*, value: *string*); 10 | 11 | **insert_ip_v6_options** takes 4 named arguments 12 | 13 | ## DESCRIPTION 14 | 15 | Add a option to a specified IPv6 datagram. This function is the same as **[insert_ipv6_options(3)](insert_ipv6_options.md)**. 16 | 17 | - ip: is the IP datagram 18 | - code: is the identifier of the option to add 19 | - length: is the length of the option data 20 | - value: is the option data 21 | 22 | ## RETURN VALUE 23 | 24 | A new IPv6 datagram with the given option set. 25 | 26 | ## SEE ALSO 27 | 28 | **[insert_ipv6_options(3)](insert_ipv6_options.md)** 29 | -------------------------------------------------------------------------------- /doc/manual/nasl/built-in-functions/raw-ip-functions/insert_ipv6_options.md: -------------------------------------------------------------------------------- 1 | # insert_ipv6_options 2 | 3 | ## NAME 4 | 5 | **insert_ipv6_options** - Add a option to a IPv6 datagram 6 | 7 | ## SYNOPSIS 8 | 9 | *string* **insert_ipv6_options**(ip6: *string*, code: *int*, length: *int*, value: *string*); 10 | 11 | **insert_ipv6_options** takes 4 named arguments 12 | 13 | ## DESCRIPTION 14 | 15 | Add a option to a specified IPv6 datagram. This function is the same as **[insert_ip_v6_options(3)](insert_ip_v6_options.md)**. 16 | 17 | - ip: is the IP datagram 18 | - code: is the identifier of the option to add 19 | - length: is the length of the option data 20 | - value: is the option data 21 | 22 | ## RETURN VALUE 23 | 24 | A new IPv6 datagram with the given option set. 25 | 26 | ## SEE ALSO 27 | 28 | **[insert_ip_v6_options(3)](insert_ip_v6_options.md)** 29 | -------------------------------------------------------------------------------- /doc/manual/nasl/built-in-functions/raw-ip-functions/pcap_next.md: -------------------------------------------------------------------------------- 1 | # pcap_next 2 | 3 | ## NAME 4 | 5 | **pcap_next** - read the next packet 6 | 7 | ## SYNOPSIS 8 | 9 | *string* **pcap_next**(interface: *string*, pcap_filter: *string*, timeout: *int*); 10 | 11 | **pcap_next** takes 3 named arguments. 12 | 13 | ## DESCRIPTION 14 | 15 | This function is the same as **[send_capture(3)](send_capture.md)**. 16 | 17 | - interface: network interface name, by default NASL will try to find the best one 18 | - pcap_filter: BPF filter, by default it listens to everything 19 | - timeout: timeout in seconds, 5 by default 20 | 21 | ## RETURN VALUE 22 | 23 | Packet which was captured 24 | 25 | ## SEE ALSO 26 | 27 | **[send_capture(3)](send_capture.md)** 28 | -------------------------------------------------------------------------------- /doc/manual/nasl/built-in-functions/raw-ip-functions/send_arp_request.md: -------------------------------------------------------------------------------- 1 | # send_arp_request 2 | 3 | ## NAME 4 | 5 | **send_arp_request** - send an arp request to the scanned host 6 | 7 | ## SYNOPSIS 8 | 9 | *string* **send_arp_request**(pcap_timeout: *int*); 10 | 11 | **send_arp_request** Takes 1 named argument 12 | 13 | ## DESCRIPTION 14 | 15 | This function creates a datalink layer frame for an arp request and sends it to the currently scanned host. 16 | 17 | It takes the following argument: 18 | - pcap_timeout: time to wait for answer in seconds, 5 by default 19 | 20 | ## RETURN VALUE 21 | 22 | The answer of the arp request or *NULL* on error. 23 | 24 | ## ERRORS 25 | 26 | - Unable to send frame 27 | - No answer received 28 | -------------------------------------------------------------------------------- /doc/manual/nasl/built-in-functions/raw-ip-functions/send_capture.md: -------------------------------------------------------------------------------- 1 | # send_capture 2 | 3 | ## NAME 4 | 5 | **send_capture** - read the next packet 6 | 7 | ## SYNOPSIS 8 | 9 | *string* **send_capture**(interface: *string*, pcap_filter: *string*, timeout: *int*); 10 | 11 | **send_capture** takes 3 named arguments. 12 | 13 | ## DESCRIPTION 14 | 15 | This function is the same as **[pcap_next(3)](pcap_next.md)**. 16 | 17 | - interface: network interface name, by default NASL will try to find the best one 18 | - pcap_filter: BPF filter, by default it listens to everything 19 | - timeout: timeout in seconds, 5 by default 20 | 21 | ## RETURN VALUE 22 | 23 | Packet which was captured 24 | 25 | ## SEE ALSO 26 | 27 | **[pcap_next(3)](pcap_next.md)** 28 | -------------------------------------------------------------------------------- /doc/manual/nasl/built-in-functions/raw-ip-functions/send_frame.md: -------------------------------------------------------------------------------- 1 | # send_frame 2 | 3 | ## NAME 4 | 5 | **send_frame** - send a frame to th scanned host 6 | 7 | ## SYNOPSIS 8 | 9 | *string* **send_frame**(frame: *string*, pcap_active: *bool*, pcap_filter: *string*, pcap_timeout: *int*); 10 | 11 | **send_frame** takes 4 named arguments. 12 | 13 | ## DESCRIPTION 14 | 15 | Send a frame to the currently scanned host with the option to listen to the answer. 16 | 17 | The arguments are: 18 | - frame: the frame to send, created with **[forge_frame(3)](forge_frame.md)** 19 | - pcap_active: option to capture the answer, default is TRUE 20 | - pcap_filter: filter for the answer 21 | - pcap_timeout: time to wait for the answer in seconds, default 5 22 | 23 | ## RETURN VALUE 24 | 25 | The answer of the send frame 26 | 27 | ## SEE ALSO 28 | 29 | **[forge_frame(3)](forge_frame.md)** 30 | -------------------------------------------------------------------------------- /doc/manual/nasl/built-in-functions/raw-ip-functions/tcp_ping.md: -------------------------------------------------------------------------------- 1 | # tcp_ping 2 | 3 | ## NAME 4 | 5 | **tcp_ping** - Launches a TCP ping against the target host 6 | 7 | ## SYNOPSIS 8 | 9 | *bool* **tcp_ping**(port: *int*); 10 | 11 | **tcp_ping** takes 1 named argument. 12 | 13 | ## DESCRIPTION 14 | 15 | This function tries to open a TCP connection and sees if anything comes back (SYN/ACK or RST). 16 | 17 | Its argument is: 18 | - port: port for the ping 19 | 20 | ## RETURN VALUE 21 | 22 | TRUE on success, FALSE on failure 23 | -------------------------------------------------------------------------------- /doc/manual/nasl/built-in-functions/raw-ip-functions/tcp_v6_ping.md: -------------------------------------------------------------------------------- 1 | # tcp_v6_ping 2 | 3 | ## NAME 4 | 5 | **tcp_v6_ping** - Launches a TCP ping against the target host 6 | 7 | ## SYNOPSIS 8 | 9 | *bool* **tcp_v6_ping**(port: *int*); 10 | 11 | **tcp_v6_ping** takes 1 named argument. 12 | 13 | ## DESCRIPTION 14 | 15 | This function tries to open a TCP connection and sees if anything comes back (SYN/ACK or RST). 16 | 17 | Its argument is: 18 | - port: port for the ping 19 | 20 | ## RETURN VALUE 21 | 22 | TRUE on success, FALSE on failure 23 | -------------------------------------------------------------------------------- /doc/manual/nasl/built-in-functions/report-functions/index.md: -------------------------------------------------------------------------------- 1 | # Report Functions 2 | 3 | ## GENERAL 4 | 5 | Those functions are used for reporting (send data back to daemon). 6 | 7 | ## TABLE OF CONTENT 8 | 9 | - **[error_message](error_message.md)** - Reports an error information. 10 | - **[log_message](log_message.md)** - Reports a miscellaneous information. 11 | - **[scanner_status](scanner_status.md)** - this function currently does nothing, kept for backwards compatibility 12 | - **[security_message](security_message.md)** - Reports a severe flaw. 13 | -------------------------------------------------------------------------------- /doc/manual/nasl/built-in-functions/report-functions/scanner_status.md: -------------------------------------------------------------------------------- 1 | # scanner_status 2 | 3 | ## NAME 4 | 5 | **scanner_status** - this function currently does nothing, kept for backwards compatibility 6 | -------------------------------------------------------------------------------- /doc/manual/nasl/built-in-functions/smb-functions/smb_close.md: -------------------------------------------------------------------------------- 1 | # smb_close 2 | 3 | ## NAME 4 | 5 | **smb_close** - close SMB service handle 6 | 7 | ## SYNOPSIS 8 | 9 | *bool* **smb_close**(smb_handle: *int*); 10 | 11 | **smb_close** takes 1 named argument. 12 | 13 | ## DESCRIPTION 14 | 15 | Closes an opened SMB service handle. A service handle can be opened with **[smb_connect(3)](smb_connect.md)**. 16 | 17 | The named argument *smb_handle* is an *int* representing a connection to a SMB service. This connection can be opened with the **[smb_connect(3)](smb_connect.md)** functions. 18 | 19 | ## RETURN VALUE 20 | 21 | *TRUE* on success, *FALSE* on failure. 22 | 23 | ## ERRORS 24 | 25 | The named argument *smb_handle* is either missing or invalid. 26 | 27 | ## SEE ALSO 28 | 29 | **[smb_connect(3)](smb_connect.md)** 30 | -------------------------------------------------------------------------------- /doc/manual/nasl/built-in-functions/ssh-functions/ssh_disconnect.md: -------------------------------------------------------------------------------- 1 | # ssh_disconnect 2 | 3 | ## NAME 4 | 5 | **ssh_disconnect** - disconnect an open SSH connection 6 | 7 | ## SYNOPSIS 8 | 9 | *void* **ssh_disconnect**(0: *int*); 10 | 11 | **ssh_disconnect** takes one positional argument 12 | 13 | ## DESCRIPTION 14 | 15 | This function takes the SSH session ID returned by **[ssh_connect(3)](ssh_connect.md)** and closes it. Passing 0 as session ID is explicitly allowed and does nothing. If there are any open channels, they are closed as well and their IDs will be marked as invalid. 16 | 17 | The first unnamed parameter is the session ID as an *int*. 18 | 19 | ## RETURN 20 | 21 | Nothing 22 | 23 | ## SEE ALSO 24 | 25 | **[ssh_connect(3)](ssh_connect.md)** -------------------------------------------------------------------------------- /doc/manual/nasl/built-in-functions/ssh-functions/ssh_get_auth_methods.md: -------------------------------------------------------------------------------- 1 | # ssh_get_auth_methods 2 | 3 | ## NAME 4 | 5 | **ssh_get_auth_methods** - get list of supported authentication schemes 6 | 7 | ## SYNOPSIS 8 | 9 | *int* **ssh_get_auth_methods**(0: *int*); 10 | 11 | **ssg_get_auth_methods** takes one positional argument 12 | 13 | ## DESCRIPTION 14 | 15 | The first positional argument contains the SSH session ID as *int* returned by **[ssh_connect(3)](ssh_connect.md)**. 16 | 17 | ## RETURN VALUE 18 | 19 | A comma separated list with enabled authentication methods or *NULL*. 20 | The *NULL* value can have different reasons: 21 | - The session ID is invalid 22 | - No SSH user is set 23 | - No authentication methods are enabled 24 | 25 | ## ERROR 26 | 27 | Invalid session ID 28 | 29 | Bad SSH session ID 30 | 31 | ## SEE ALSO 32 | 33 | **[ssh_connect(3)](ssh_connect.md)** -------------------------------------------------------------------------------- /doc/manual/nasl/built-in-functions/ssh-functions/ssh_get_host_key.md: -------------------------------------------------------------------------------- 1 | # ssh_get_host_key 2 | 3 | ## NAME 4 | 5 | **ssh_get_host_key** - get the host key 6 | 7 | ## SYNOPSIS 8 | 9 | *string* **ssh_get_host_key**(0: *int*); 10 | 11 | **ssh_get_host_key** takes 1 positional argument 12 | 13 | ## DESCRIPTION 14 | 15 | Get the MD5 host key. 16 | 17 | The first positional argument contains the SSH session ID as *int* returned by **[ssh_connect(3)](ssh_connect.md)**. 18 | 19 | ## RETURN VALUE 20 | 21 | MD5 host key as *string* or *NULL* on invalid SSH session ID 22 | 23 | ## SEE ALSO 24 | 25 | **[ssh_connect(3)](ssh_connect.md)** -------------------------------------------------------------------------------- /doc/manual/nasl/built-in-functions/ssh-functions/ssh_get_issue_banner.md: -------------------------------------------------------------------------------- 1 | # ssh_get_issue_banner 2 | 3 | ## NAME 4 | 5 | **ssh_get_issue_banner** - get the issue banner 6 | 7 | ## SYNOPSIS 8 | 9 | *string* **ssh_get_issue_banner**(0: *int*); 10 | 11 | **ssh_get_issue_banner** takes 1 positional argument. 12 | 13 | ## DESCRIPTION 14 | 15 | The issue banner is normally displayed before a SSH authentication. 16 | 17 | The first positional argument contains the SSH session ID as *int* returned by **[ssh_connect(3)](ssh_connect.md)**. 18 | 19 | ## RETURN VALUE 20 | 21 | The SSH issue banner as *string* or *NULL* on an invalid SSH session ID. 22 | 23 | ## SEE ALSO 24 | 25 | **[ssh_connect(3)](ssh_connect.md)**, **[ssh_server_banner(3)](ssh_get_server_banner.md)** -------------------------------------------------------------------------------- /doc/manual/nasl/built-in-functions/ssh-functions/ssh_get_server_banner.md: -------------------------------------------------------------------------------- 1 | # ssh_get_server_banner 2 | 3 | ## NAME 4 | 5 | **ssh_get_server_banner** - get the server banner 6 | 7 | ## SYNOPSIS 8 | 9 | *string* **ssh_get_server_banner**(0: *int*); 10 | 11 | **ssh_get_server_banner** takes one positional argument 12 | 13 | ## DESCRIPTION 14 | 15 | This is usually the first data sent by the SSH server. 16 | 17 | The first positional argument contains the SSH session ID as *int* returned by **[ssh_connect(3)](ssh_connect.md)**. 18 | 19 | ## RETURN VALUE 20 | 21 | The SSH server banner as *string* or *NULL* on an invalid SSH session ID. 22 | 23 | ## SEE ALSO 24 | 25 | **[ssh_connect(3)](ssh_connect.md)**, **[ssh_get_issue_banner(3)](ssh_get_issue_banner.md)** -------------------------------------------------------------------------------- /doc/manual/nasl/built-in-functions/ssh-functions/ssh_get_sock.md: -------------------------------------------------------------------------------- 1 | # ssh_get_sock 2 | 3 | ## NAME 4 | 5 | **ssh_get_sock** - get the corresponding socket to a SSH session ID 6 | 7 | ## SYNOPSIS 8 | 9 | *int* **ssh_get_sock**(0: *int*); 10 | 11 | **ssh_get_sock** takes one positional argument. 12 | 13 | ## DESCRIPTION 14 | 15 | The socket is either a native file descriptor or a NASL connection socket, if a open socket was passed to ssh_connect. The NASL network code handles both of them. 16 | 17 | The first positional argument contains the SSH session ID as *int* returned by **[ssh_connect(3)](ssh_connect.md)**. 18 | 19 | ## RETURN VALUE 20 | 21 | An *int* representing the socket or or *NULL* on an invalid SSH session ID. 22 | 23 | ## SEE ALSO 24 | 25 | **[ssh_connect(3)](ssh_connect.md)** -------------------------------------------------------------------------------- /doc/manual/nasl/built-in-functions/ssh-functions/ssh_session_id_from_sock.md: -------------------------------------------------------------------------------- 1 | # ssh_session_id_from_sock 2 | 3 | ## NAME 4 | 5 | **ssh_session_id_from_sock** - get the SSH session ID from a socket 6 | 7 | ## SYNOPSIS 8 | 9 | *int* **ssh_session_id_from_sock**(0: *int*); 10 | 11 | **ssh_session_id_from_sock** takes one positional argument. 12 | 13 | ## DESCRIPTION 14 | 15 | Given a socket, return the corresponding SSH session ID. 16 | 17 | The first positional argument is a NASL socket value. 18 | 19 | ## RETURN VALUE 20 | 21 | An *int* corresponding to an active SSH session ID or 0 if no session ID is known for the given socket. 22 | 23 | ## SEE ALSO 24 | 25 | **[ssh_connect(3)](ssh_connect.md)** -------------------------------------------------------------------------------- /doc/manual/nasl/built-in-functions/ssh-functions/ssh_shell_close.md: -------------------------------------------------------------------------------- 1 | # ssh_shell_close 2 | 3 | ## NAME 4 | 5 | **ssh_shell_close** - close an SSH shell 6 | 7 | ## SYNOPSIS 8 | 9 | *NULL* **ssh_shell_close**(0: *int*); 10 | 11 | **ssh_shell_close** takes 1 positional argument 12 | 13 | ## DESCRIPTION 14 | 15 | This function closes an opened SSH shell. 16 | 17 | The first positional argument contains the SSH session ID as *int* returned by **[ssh_connect(3)](ssh_connect.md)**. 18 | 19 | The shell has to be opened with **[ssh_shell_open(3)](ssh_shell_open.md)** for the SSH session before. 20 | 21 | ## RETURN VALUE 22 | 23 | *NULL* 24 | 25 | ## SEE ALSO 26 | 27 | *[ssh_connect(3)](ssh_connect.md)**, **[ssh_shell_open(3)](ssh_shell_open.md)** -------------------------------------------------------------------------------- /doc/manual/nasl/built-in-functions/string-functions/chomp.md: -------------------------------------------------------------------------------- 1 | # chomp 2 | 3 | ## NAME 4 | 5 | **chomp** - removes trailing whitespaces from a string 6 | 7 | ## SYNOPSIS 8 | 9 | *string* **chomp**(0: *string*); 10 | 11 | **chomp** takes one positional argument 12 | 13 | ## DESCRIPTION 14 | 15 | Remove all whitespace character at the end of a string. Whitespace characters are space, vertical or horizontal tabulation, 16 | carriage return and line feed. 17 | 18 | The first unnamed argument is of type *string* and contains the string to chomp. 19 | 20 | ## RETURN VALUE 21 | 22 | The chomped string. 23 | -------------------------------------------------------------------------------- /doc/manual/nasl/built-in-functions/string-functions/display.md: -------------------------------------------------------------------------------- 1 | # display 2 | 3 | ## NAME 4 | 5 | **display** - display any number of NASL values 6 | 7 | ## SYNOPSIS 8 | 9 | *int* **display**(*any*...); 10 | 11 | **display** takes any number of arguments. 12 | 13 | ## DESCRIPTION 14 | 15 | This function displays any number of NASL values. Internally it calls **[string(3)](string.md)** to concatenate them. 16 | 17 | ## RETURN VALUE 18 | 19 | Size of the displayed string. 20 | -------------------------------------------------------------------------------- /doc/manual/nasl/built-in-functions/string-functions/hexstr.md: -------------------------------------------------------------------------------- 1 | # hexstr 2 | 3 | ## NAME 4 | 5 | **hexstr** - converts a string into a hexadecimal representation 6 | 7 | ## SYNOPSIS 8 | 9 | *string* **hexstr**(0: *string*); 10 | 11 | **hexstr** takes 1 positional argument. 12 | 13 | ## DESCRIPTION 14 | 15 | This function converts each character of a string into its hexadecimal ASCII representation. The hexadecimals are written without any notation and space in between. 16 | 17 | The first positional argument is the *string* to convert. 18 | 19 | ## RETURN VALUE 20 | 21 | Hexadecimal representation of a given string as *string* or *NULL* on error. 22 | 23 | ## ERRORS 24 | 25 | The first positional argument is missing. 26 | 27 | ## EXAMPLES 28 | 29 | Conversion of a string: 30 | ```c# 31 | a = hexstr('a!\n'); 32 | 33 | display(a); 34 | # Displays 61210a 35 | ``` -------------------------------------------------------------------------------- /doc/manual/nasl/built-in-functions/string-functions/int.md: -------------------------------------------------------------------------------- 1 | # int 2 | 3 | ## NAME 4 | 5 | **int** - converts a given argument into an integer 6 | 7 | ## SYNOPSIS 8 | 9 | *int* **int**(0: *any*); 10 | 11 | **int** takes 1 positional argument. 12 | 13 | ## DESCRIPTION 14 | 15 | This function tries to convert any given parameter into an integer. If the conversion is not possible or no argument was given, a 0 is returned instead. If a string contains any non-numerical characters, it only converts, if the string starts with a numerical character and end at the first appearance of any non-numerical character. The TRUE value converts to 1, FALSE to 0. An array will always convert to 0. 16 | 17 | The first positional argument is the value to convert to an *int*. It can be of any type. 18 | 19 | ## RETURN VALUE 20 | 21 | The given value as *int* or 0 if conversion is not possible. 22 | -------------------------------------------------------------------------------- /doc/manual/nasl/built-in-functions/string-functions/ord.md: -------------------------------------------------------------------------------- 1 | # ord 2 | 3 | ## NAME 4 | 5 | **ord** - get the ASCII code of the first character of a given string 6 | 7 | ## SYNOPSIS 8 | 9 | *int* **ord**(0: *string*); 10 | 11 | **ord** takes one unnamed argument. 12 | 13 | ## DESCRIPTION 14 | 15 | This function transforms the first character of a given string into its decimal ASCII representation. 16 | 17 | The first positional argument is a *string*. 18 | 19 | ## RETURN VALUE 20 | 21 | A decimal ASCII representation as *int* or *NULL* on error. 22 | 23 | ## ERRORS 24 | 25 | The first positional argument is *NULL* or missing. 26 | -------------------------------------------------------------------------------- /doc/manual/nasl/built-in-functions/string-functions/strlen.md: -------------------------------------------------------------------------------- 1 | # strlen 2 | 3 | ## NAME 4 | 5 | **strlen** - get the length of a string 6 | 7 | ## SYNOPSIS 8 | 9 | *int* **strlen**(0: *string*); 10 | 11 | **strlen** takes one positional argument 12 | 13 | ## DESCRIPTION 14 | 15 | This function calculates the length of a given string and returns it. 16 | 17 | The first positional argument is the *string* to get the length of. 18 | 19 | If any other type than string is given, the result is undefined. 20 | 21 | ## RETURN VALUE 22 | 23 | The length of the given string as *int*. 24 | -------------------------------------------------------------------------------- /doc/manual/nasl/built-in-functions/string-functions/tolower.md: -------------------------------------------------------------------------------- 1 | # tolower 2 | 3 | ## NAME 4 | 5 | **tolower** - converts a string to lower case 6 | 7 | ## SYNOPSIS 8 | 9 | *string* **tolower**(0: *string); 10 | 11 | **tolower** takes one positional argument. 12 | 13 | ## DESCRIPTION 14 | 15 | This function converts any string to lower case. 16 | 17 | The first positional argument is the *string* to convert. 18 | 19 | ## RETURN VALUE 20 | 21 | The to lower case converted *string*. 22 | -------------------------------------------------------------------------------- /doc/manual/nasl/built-in-functions/string-functions/toupper.md: -------------------------------------------------------------------------------- 1 | # toupper 2 | 3 | ## NAME 4 | 5 | **toupper** - converts a string to upper case 6 | 7 | ## SYNOPSIS 8 | 9 | *string* **toupper**(0: *string); 10 | 11 | **toupper** takes one positional argument. 12 | 13 | ## DESCRIPTION 14 | 15 | This function converts any string to upper case. 16 | 17 | The first positional argument is the *string* to convert. 18 | 19 | ## RETURN VALUE 20 | 21 | The to upper case converted *string*. 22 | -------------------------------------------------------------------------------- /doc/manual/nasl/built-in-functions/tls/socket_check_ssl_safe_renegotiation.md: -------------------------------------------------------------------------------- 1 | # socket_check_ssl_safe_renegotiation 2 | 3 | ## NAME 4 | 5 | **socket_check_ssl_safe_renegotiation** - check if secure renegotiation is supported in the server side 6 | 7 | ## SYNOPSIS 8 | 9 | *int* **socket_check_ssl_safe_renegotiation**(socket: *int*); 10 | 11 | **socket_check_ssl_safe_renegotiation** takes 1 named argument. 12 | 13 | ## DESCRIPTION 14 | 15 | The first positional argument contains the SSH session ID as *int* returned by **[ssh_connect(3)](ssh_connect.md)**. 16 | 17 | ## RETURN VALUE 18 | 19 | 0 on success, <0 or *NULL* on failure. 20 | 21 | ## SEE ALSO 22 | 23 | **[ssh_connect(3)](ssh_connect.md)** 24 | -------------------------------------------------------------------------------- /doc/manual/nasl/built-in-functions/tls/socket_ssl_do_handshake.md: -------------------------------------------------------------------------------- 1 | # socket_ssl_do_handshake 2 | 3 | ## NAME 4 | 5 | **socket_ssl_do_handshake** - do a re-handshake of the TLS/SSL protocol 6 | 7 | ## SYNOPSIS 8 | 9 | *int* **socket_ssl_do_handshake**(socket: *int*); 10 | 11 | **socket_ssl_do_handshake** takes 1 named argument. 12 | 13 | ## DESCRIPTION 14 | 15 | The first positional argument contains the SSH session ID as *int* returned by **[ssh_connect(3)](ssh_connect.md)**. 16 | 17 | ## RETURN VALUE 18 | 19 | 1 on success, 0 on NASL error or <0 on handshake error. 20 | 21 | ## SEE ALSO 22 | 23 | **[ssh_connect(3)](ssh_connect.md)** 24 | -------------------------------------------------------------------------------- /doc/manual/nasl/built-in-functions/unsafe/file_close.md: -------------------------------------------------------------------------------- 1 | # file_close 2 | 3 | ## NAME 4 | 5 | **file_close** - close a file descriptor 6 | 7 | ## SYNOPSIS 8 | 9 | *Optional(int)* **file_close**(0: *int*); 10 | 11 | **file_close** takes one unnamed argument. 12 | 13 | ## DESCRIPTION 14 | 15 | This function is used to close an opened file descriptor. 16 | 17 | The first positional argument contains the file descriptor as an *int* returned by **[file_open(3)](file_open.md)**. 18 | 19 | ## RETURN VALUE 20 | 21 | Either 0 on success or *NULL* on failure 22 | 23 | ## ERRORS 24 | 25 | first positional argument is either missing or negative 26 | 27 | closing the file descriptor failed 28 | 29 | ## SEE ALSO 30 | 31 | **[file_open(3)](file_open.md)** 32 | -------------------------------------------------------------------------------- /doc/manual/nasl/built-in-functions/unsafe/file_seek.md: -------------------------------------------------------------------------------- 1 | # file_seek 2 | 3 | ## Name 4 | 5 | **file_seek** - set offset for file operations 6 | 7 | ## SYNOPSIS 8 | 9 | *int* **file_seek**(fp: *int*, offset: *int*); 10 | 11 | **file_seek** takes 2 named arguments 12 | 13 | ## DESCRIPTION 14 | 15 | This function takes a file descriptor and applies an offset for operations on the file. 16 | 17 | *fp* is an *int* parameter. It is the file descriptor for the file to read from. It is returned by **[file_open(3)](file_open.md)**. 18 | 19 | *offset* is an *int* parameter. It determines the offset 20 | 21 | ## RETURN VALUE 22 | 23 | 0 on success, NULL on error 24 | 25 | ## ERRORS 26 | 27 | *fd* parameter is missing or negative 28 | 29 | unable to apply the offset, see **lseek(2)** for more information 30 | 31 | ## SEE ALSO 32 | 33 | **[file_open(3)](file_open.md)** 34 | -------------------------------------------------------------------------------- /doc/manual/nasl/built-in-functions/unsafe/file_stat.md: -------------------------------------------------------------------------------- 1 | # file_stat 2 | 3 | ## NAME 4 | 5 | **file_stat** - get size of a file 6 | 7 | ## SYNOPSIS 8 | 9 | *int* **file_stat**(0: *string*); 10 | 11 | **file_stat** takes one positional argument 12 | 13 | ## DESCRIPTION 14 | 15 | This function is used to get the size of a file. 16 | 17 | The first unnamed argument is the path to the file as *string* 18 | 19 | ## RETURN VALUE 20 | 21 | The size of the file as *int* or *NULL* on failure 22 | 23 | ## ERRORS 24 | 25 | first positional argument is missing 26 | 27 | ## NOTES 28 | 29 | Currently it is not possible to get the cause of the failure 30 | 31 | ## SEE ALSO 32 | 33 | **[file_open(3)](file_open.md)** 34 | -------------------------------------------------------------------------------- /doc/manual/nasl/built-in-functions/unsafe/fread.md: -------------------------------------------------------------------------------- 1 | # fread 2 | 3 | ## NAME 4 | 5 | **fread** - read a whole file on the openvas-scanner host 6 | 7 | ## SYNOPSIS 8 | 9 | *string* **fread**(0: *string*); 10 | 11 | **fread** takes 1 unnamed argument 12 | 13 | ## DESCRIPTION 14 | 15 | This function is used to read a whole file in one go on the openvas-scanner host. It is not necessary to open/close a file descriptor. 16 | 17 | The first positional argument is of type *string* and is the path to the file. 18 | 19 | ## RETURN VALUE 20 | 21 | content of file as *string* 22 | 23 | ## ERRORS 24 | 25 | first positional argument is missing 26 | 27 | unable to read file, see *G_FILE_ERROR* for more information 28 | 29 | ## SEE ALSO 30 | 31 | **[fwrite(3)](fwrite.md)** -------------------------------------------------------------------------------- /doc/manual/nasl/built-in-functions/unsafe/unlink.md: -------------------------------------------------------------------------------- 1 | # unlink 2 | 3 | ## NAME 4 | 5 | **unlink** - removes a file on the openvas scanner host 6 | 7 | ## SYNOPSIS 8 | 9 | *NULL* **unlink**(0: *string); 10 | 11 | **unlink** takes 1 positional argument 12 | 13 | ## DESCRIPTION 14 | 15 | This function removes a file on the openvas-scanner host and does not return any value 16 | 17 | ## RETURN VALUE 18 | 19 | *NULL* 20 | 21 | ## ERRORS 22 | 23 | first positional argument is missing 24 | 25 | unable to remove file, see **unlink(2)** for more information 26 | 27 | ## EXAMPLES 28 | 29 | TODO! -------------------------------------------------------------------------------- /doc/manual/nasl/built-in-functions/wmi-functions/wmi_close.md: -------------------------------------------------------------------------------- 1 | # wmi_close 2 | 3 | ## NAME 4 | 5 | **wmi_close** - closes an opened WMI handle 6 | 7 | ## SYNOPSIS 8 | 9 | *bool* **wmi_close**(wmi_handle: *int*); 10 | 11 | **wmi_close** takes one named argument 12 | 13 | ## DESCRIPTION 14 | 15 | This function closes a before opened WMI handle. A WMI handle can be opened with **[wmi_connect(3)](wmi_connect.md)**. 16 | 17 | The named *wmi_handle* argument is a *int* containing a representation of a WMI handle. 18 | 19 | ## RETURN VALUE 20 | 21 | *TRUE* on success, *NULL* on failure or error. 22 | 23 | ## ERRORS 24 | 25 | The named argument *wmi_handle* is missing or 0. 26 | 27 | ## SEE ALSO 28 | 29 | **[wmi_connect(3)](wmi_connect.md)** 30 | -------------------------------------------------------------------------------- /doc/manual/nasl/built-in-functions/wmi-functions/wmi_reg_create_key.md: -------------------------------------------------------------------------------- 1 | # wmi_reg_create_key 2 | 3 | ## NAME 4 | 5 | **wmi_reg_create_key** - create registry key 6 | 7 | ## SYNOPSIS 8 | 9 | *bool* **wmi_reg_create_key**(wmi_handle: *int*, key: *string*); 10 | 11 | **wmi_reg_create_key** takes two named arguments. 12 | 13 | ## DESCRIPTION 14 | 15 | This functions creates a new key in the registry. 16 | 17 | The named argument *wmi_handle* is an *int* representing a connection to a WMI server. This connection can be opened with on of the **[wmi_connect(3)](wmi_connect.md)** functions. 18 | 19 | The named argument *key* is a *string* containing the new key to create. 20 | 21 | ## RETURN VALUE 22 | 23 | *TRUE* on success, *FALSE* on failure 24 | 25 | ## SEE ALSO 26 | 27 | **[wmi_connect(3)](wmi_connect.md)** 28 | -------------------------------------------------------------------------------- /doc/manual/nasl/built-in-functions/wmi-functions/wmi_reg_delete_key.md: -------------------------------------------------------------------------------- 1 | # wmi_reg_delete_key 2 | 3 | ## NAME 4 | 5 | **wmi_reg_delete_key** - delete a key in the registry 6 | 7 | ## SYNOPSIS 8 | 9 | *bool* **wmi_reg_delete_key**(wmi_handle: *int*, key: *string*); 10 | 11 | **wmi_reg_delete_key** takes 2 named arguments. 12 | 13 | ## DESCRIPTION 14 | 15 | This function deletes a key in the registry. 16 | 17 | The named argument *wmi_handle* is an *int* representing a connection to a WMI server. This connection can be opened with on of the **[wmi_connect(3)](wmi_connect.md)** functions. 18 | 19 | The named argument *key* is a *string* containing the key to delete. 20 | 21 | ## RETURN VALUE 22 | 23 | *TRUE* und success, *FALSE* on failure. 24 | 25 | ## SEE ALSO 26 | 27 | **[wmi_connect(3)](wmi_connect.md)** 28 | -------------------------------------------------------------------------------- /doc/manual/nasl/index.md: -------------------------------------------------------------------------------- 1 | # NASL - NASL Attack Scripting Language 2 | 3 | ## GENERAL 4 | 5 | The NASL Attack Scripting Language (NASL) is a language which is part of the OpenVAS Project and interpreted by the NASL interpreter. It is a simple language with focus on detecting vulnerabilities on network devices. Therefore it provides many built-in functions to attack hosts to discover vulnerabilities. A NASL script can be either run directly with the NASL interpreter [openvas-nasl](openvas-nasl.md) or within a scan with [openvas](../openvas/openvas.md). 6 | -------------------------------------------------------------------------------- /doc/manual/openvas/index.md: -------------------------------------------------------------------------------- 1 | # OpenVAS Scanner 2 | 3 | ## Overview 4 | 5 | The OpenVAS Scanner is a scanner engine, which allows the user to scan networks. 6 | -------------------------------------------------------------------------------- /doc/manual/openvas/redis/index.md: -------------------------------------------------------------------------------- 1 | # Redis 2 | 3 | ## GENERAL 4 | 5 | **Redis** is a in-memory data base with a simple key-value data structure. It belongs to the family of NoSQL databases and therefore is not relational. It is not suitable for complex data structures, but benefits from its speed. 6 | 7 | ## USAGE IN OPENVAS 8 | 9 | The main use of Redis in OpenVAS is the communication. It is used to set information in order for OpenVAS to start a scan. This information are e.g. the host to scan, credentials for further access and configurations for the scanner. Additionally it is used for the scan internally to send information between forked processes, as each running NASL script is a forked process. The last usage is the reporting of information, errors and results. 10 | 11 | ## SEE ALSO 12 | 13 | **redis-cli(1)** 14 | -------------------------------------------------------------------------------- /doc/manual/openvas/scanner-run-loop.md: -------------------------------------------------------------------------------- 1 | # OpenVAS scanner run-loop 2 | 3 | [Click to open scanner-run-loop](../../images/scanner_run_loop.svg) -------------------------------------------------------------------------------- /doc/templates/script.js: -------------------------------------------------------------------------------- 1 | /* SPDX-FileCopyrightText: 2023 Greenbone AG 2 | * 3 | * SPDX-License-Identifier: GPL-2.0-or-later 4 | */ 5 | 6 | $(function () { 7 | var title = document.title.split(" - ")[1]; 8 | 9 | var xpath = "//a[text()='" + title + "']"; 10 | var matchingElement = document.evaluate(xpath, document, null, XPathResult.FIRST_ORDERED_NODE_TYPE, null).singleNodeValue; 11 | 12 | matchingElement.classList.add("selected"); 13 | 14 | var navigator = document.getElementById("navigator"); 15 | for (var element = matchingElement.parentElement; element != navigator; element = element.parentElement) { 16 | 17 | if (element.nodeName == "UL") { 18 | element.classList.add("active"); 19 | } 20 | } 21 | }); 22 | -------------------------------------------------------------------------------- /doc/templates/template.html: -------------------------------------------------------------------------------- 1 | 2 | 7 | 8 | 9 | 10 | 11 | OpenVAS User Manual - %TITLE% 12 | 13 | 14 | 15 | 16 | 17 | 18 | 21 |
22 |
23 | %CONTENT% 24 |
25 |
26 | 27 | 28 | -------------------------------------------------------------------------------- /misc/.gitignore: -------------------------------------------------------------------------------- 1 | a.out 2 | test.sh 3 | krb5.conf 4 | -------------------------------------------------------------------------------- /misc/bpf_share.h: -------------------------------------------------------------------------------- 1 | /* SPDX-FileCopyrightText: 2023 Greenbone AG 2 | * SPDX-FileCopyrightText: 1998-2007 Tenable Network Security, Inc. 3 | * 4 | * SPDX-License-Identifier: GPL-2.0-or-later 5 | */ 6 | 7 | /** 8 | * @file bpf_share.h 9 | * @brief Header file for module bpf_share. 10 | */ 11 | 12 | #ifndef MISC_BPF_SHARE_H 13 | #define MISC_BPF_SHARE_H 14 | 15 | #include 16 | 17 | int 18 | bpf_open_live (char *, char *); 19 | 20 | u_char * 21 | bpf_next (int, int *); 22 | 23 | u_char * 24 | bpf_next_tv (int, int *, struct timeval *); 25 | 26 | void 27 | bpf_close (int); 28 | 29 | int 30 | bpf_datalink (int); 31 | 32 | #endif 33 | -------------------------------------------------------------------------------- /misc/ftp_funcs.h: -------------------------------------------------------------------------------- 1 | /* SPDX-FileCopyrightText: 2023 Greenbone AG 2 | * SPDX-FileCopyrightText: 1998 Renaud Deraison 3 | * 4 | * SPDX-License-Identifier: GPL-2.0-or-later 5 | */ 6 | 7 | /** 8 | * @file ftp_funcs.h 9 | * @brief Header file for module ftp_funcs. 10 | */ 11 | 12 | #ifndef MISC_FTP_FUNCS_H 13 | #define MISC_FTP_FUNCS_H 14 | 15 | #include 16 | #include 17 | #include 18 | #ifdef __FreeBSD__ 19 | #include 20 | #endif 21 | 22 | int 23 | ftp_log_in (int, char *, char *); 24 | 25 | int 26 | ftp_get_pasv_address (int, struct sockaddr_in *); 27 | 28 | #endif 29 | -------------------------------------------------------------------------------- /misc/heartbeat.h: -------------------------------------------------------------------------------- 1 | /* SPDX-FileCopyrightText: 2023 Greenbone AG 2 | * 3 | * SPDX-License-Identifier: GPL-2.0-or-later 4 | */ 5 | 6 | /** 7 | * @file heartbeat.h 8 | * @brief heartbeat.c headerfile. 9 | */ 10 | 11 | #ifndef OPENVAS_HEARTBEAT_H 12 | #define OPENVAS_HEARTBEAT_H 13 | 14 | #include "../misc/scanneraux.h" 15 | 16 | int 17 | check_host_still_alive (kb_t, const char *); 18 | #endif 19 | -------------------------------------------------------------------------------- /misc/ipc_pipe.h: -------------------------------------------------------------------------------- 1 | /* SPDX-FileCopyrightText: 2023 Greenbone AG 2 | * 3 | * SPDX-License-Identifier: GPL-2.0-or-later 4 | */ 5 | 6 | #ifndef MISC_IPC_PIPE_H 7 | #define MISC_IPC_PIPE_H 8 | 9 | struct ipc_pipe_context 10 | { 11 | int fd[2]; 12 | }; 13 | 14 | int 15 | ipc_pipe_send (struct ipc_pipe_context *context, const char *msg, int len); 16 | 17 | char * 18 | ipc_pipe_retrieve (struct ipc_pipe_context *context); 19 | 20 | int 21 | ipc_pipe_destroy (struct ipc_pipe_context *context); 22 | 23 | int 24 | ipc_pipe_close (struct ipc_pipe_context *context); 25 | 26 | struct ipc_pipe_context * 27 | ipc_init_pipe (void); 28 | 29 | #endif 30 | -------------------------------------------------------------------------------- /misc/kb_cache.h: -------------------------------------------------------------------------------- 1 | /* SPDX-FileCopyrightText: 2023 Greenbone AG 2 | * SPDX-FileCopyrightText: 1998-2007 Tenable Network Security, Inc. 3 | * 4 | * SPDX-License-Identifier: GPL-2.0-or-later 5 | */ 6 | 7 | /** 8 | * @file kb_cache.h 9 | * @brief Header file to cache main_kb. 10 | */ 11 | 12 | #ifndef MISC_KB_CACHE_H 13 | #define MISC_KB_CACHE_H 14 | #include 15 | 16 | void set_main_kb (kb_t); 17 | kb_t 18 | get_main_kb (void); 19 | 20 | #endif 21 | -------------------------------------------------------------------------------- /misc/scan_id.c: -------------------------------------------------------------------------------- 1 | /* SPDX-FileCopyrightText: 2023 Greenbone AG 2 | * 3 | * SPDX-License-Identifier: GPL-2.0-or-later 4 | */ 5 | 6 | #include "scan_id.h" 7 | 8 | #include 9 | 10 | const char *scan_id = NULL; 11 | 12 | int 13 | set_scan_id (const char *new_scan_id) 14 | { 15 | if (scan_id != NULL) 16 | return -1; 17 | scan_id = new_scan_id; 18 | return 0; 19 | } 20 | 21 | const char * 22 | get_scan_id () 23 | { 24 | return scan_id; 25 | } 26 | -------------------------------------------------------------------------------- /misc/scan_id.h: -------------------------------------------------------------------------------- 1 | /* SPDX-FileCopyrightText: 2023 Greenbone AG 2 | * 3 | * SPDX-License-Identifier: GPL-2.0-or-later 4 | */ 5 | 6 | #ifndef MISC_SCANID_H 7 | #define MISC_SCANID_H 8 | 9 | int 10 | set_scan_id (const char *); 11 | 12 | const char * 13 | get_scan_id (void); 14 | #endif 15 | -------------------------------------------------------------------------------- /misc/scanneraux.c: -------------------------------------------------------------------------------- 1 | /* SPDX-FileCopyrightText: 2023 Greenbone AG 2 | * 3 | * SPDX-License-Identifier: GPL-2.0-or-later 4 | */ 5 | 6 | /** 7 | * @file scanneraux.c 8 | * @brief Auxiliary functions and structures for scanner. 9 | */ 10 | 11 | #include "scanneraux.h" 12 | 13 | void 14 | destroy_scan_globals (struct scan_globals *globals) 15 | { 16 | if (globals == NULL) 17 | return; 18 | 19 | g_free (globals->scan_id); 20 | 21 | if (globals->files_translation) 22 | g_hash_table_destroy (globals->files_translation); 23 | 24 | if (globals->files_size_translation) 25 | g_hash_table_destroy (globals->files_size_translation); 26 | 27 | g_free (globals); 28 | globals = NULL; 29 | } 30 | -------------------------------------------------------------------------------- /misc/strutils.h: -------------------------------------------------------------------------------- 1 | /* SPDX-FileCopyrightText: 2023 Greenbone AG 2 | * 3 | * SPDX-License-Identifier: GPL-2.0-or-later 4 | */ 5 | 6 | #ifndef MISC_STRUTILS_H 7 | #define MISC_STRUTILS_H 8 | 9 | #include 10 | 11 | int 12 | str_match (const gchar *, const gchar *, int); 13 | 14 | #endif 15 | -------------------------------------------------------------------------------- /misc/table_driven_lsc.h: -------------------------------------------------------------------------------- 1 | /* SPDX-FileCopyrightText: 2023 Greenbone AG 2 | * 3 | * SPDX-License-Identifier: GPL-2.0-or-later 4 | */ 5 | 6 | /** 7 | * @file table_drive_lsc.h 8 | * @brief Header file for module table_driven_lsc. 9 | */ 10 | 11 | #ifndef MISC_TABLE_DRIVEN_LSC_H 12 | #define MISC_TABLE_DRIVEN_LSC_H 13 | 14 | #include 15 | #include // for kb_t 16 | 17 | void 18 | set_lsc_flag (void); 19 | 20 | int 21 | lsc_has_run (void); 22 | 23 | int 24 | run_table_driven_lsc (const char *, const char *, const char *, const char *, 25 | const char *); 26 | 27 | #endif // MISC_TABLE_DRIVEN_LSC_H 28 | -------------------------------------------------------------------------------- /misc/user_agent.h: -------------------------------------------------------------------------------- 1 | /* SPDX-FileCopyrightText: 2023 Greenbone AG 2 | * 3 | * SPDX-License-Identifier: GPL-2.0-or-later 4 | */ 5 | 6 | /** 7 | * @file user_agent.h 8 | * @brief Header file: user agent functions prototypes. 9 | */ 10 | 11 | #ifndef MISC_USERAGENT_H 12 | #define MISC_USERAGENT_H 13 | 14 | #include "ipc.h" 15 | 16 | #include 17 | 18 | int 19 | user_agent_get (struct ipc_context *, char **); 20 | 21 | gchar * 22 | user_agent_set (const gchar *); 23 | 24 | #endif /* not MISC_USERAGENT_H */ 25 | -------------------------------------------------------------------------------- /misc/vendorversion.c: -------------------------------------------------------------------------------- 1 | /* SPDX-FileCopyrightText: 2023 Greenbone AG 2 | * 3 | * SPDX-License-Identifier: GPL-2.0-or-later 4 | */ 5 | 6 | /** 7 | * @file vendorversion.c 8 | * @brief Functions to set and get the vendor version. 9 | */ 10 | 11 | #include "vendorversion.h" 12 | 13 | #include 14 | 15 | /** 16 | * @brief Vendor version, or NULL. 17 | */ 18 | gchar *vendor_version = NULL; 19 | 20 | /** 21 | * @brief Set vendor version 22 | * 23 | * @param[in] version Vendor version. 24 | */ 25 | void 26 | vendor_version_set (const gchar *version) 27 | { 28 | g_free (vendor_version); 29 | vendor_version = g_strdup (version); 30 | } 31 | 32 | /** 33 | * @brief Get vendor version. 34 | * 35 | * @return Set vendor version or empty string. 36 | */ 37 | const gchar * 38 | vendor_version_get () 39 | { 40 | return vendor_version ? vendor_version : ""; 41 | } 42 | -------------------------------------------------------------------------------- /misc/vendorversion.h: -------------------------------------------------------------------------------- 1 | /* SPDX-FileCopyrightText: 2023 Greenbone AG 2 | * 3 | * SPDX-License-Identifier: GPL-2.0-or-later 4 | */ 5 | 6 | /** 7 | * @file vendorversion.h 8 | * @brief Header file: vendor version functions prototypes. 9 | */ 10 | 11 | #ifndef MISC_VENDORVERSION_H 12 | #define MISC_VENDORVERSION_H 13 | 14 | #include 15 | 16 | const gchar * 17 | vendor_version_get (void); 18 | 19 | void 20 | vendor_version_set (const gchar *); 21 | 22 | #endif /* not MISC_VENDORVERSION_H */ 23 | -------------------------------------------------------------------------------- /nasl/capture_packet.h: -------------------------------------------------------------------------------- 1 | /* SPDX-FileCopyrightText: 2023 Greenbone AG 2 | * SPDX-FileCopyrightText: 2002-2003 Michel Arboi 3 | * SPDX-FileCopyrightText: 2002-2003 Renaud Deraison 4 | * 5 | * SPDX-License-Identifier: GPL-2.0-only 6 | */ 7 | 8 | #ifndef NASL_CAPTURE_PACKET_H 9 | #define NASL_CAPTURE_PACKET_H 10 | 11 | #include 12 | #include 13 | 14 | int 15 | init_capture_device (struct in_addr, struct in_addr, char *); 16 | 17 | struct ip * 18 | capture_next_packet (int, int, int *); 19 | 20 | char * 21 | capture_next_frame (int, int, int *, int); 22 | 23 | int 24 | init_v6_capture_device (struct in6_addr, struct in6_addr, char *); 25 | 26 | struct ip6_hdr * 27 | capture_next_v6_packet (int, int, int *); 28 | 29 | #endif 30 | -------------------------------------------------------------------------------- /nasl/exec.h: -------------------------------------------------------------------------------- 1 | /* SPDX-FileCopyrightText: 2023 Greenbone AG 2 | * SPDX-FileCopyrightText: 2002-2003 Michel Arboi 3 | * SPDX-FileCopyrightText: 2002-2003 Renaud Deraison 4 | * 5 | * SPDX-License-Identifier: GPL-2.0-only 6 | */ 7 | 8 | #ifndef NASL_EXEC_H 9 | #define NASL_EXEC_H 10 | 11 | #include "nasl_lex_ctxt.h" 12 | 13 | tree_cell * 14 | nasl_exec (lex_ctxt *, tree_cell *); 15 | 16 | long int 17 | cell_cmp (lex_ctxt *, tree_cell *, tree_cell *); 18 | 19 | tree_cell * 20 | cell2atom (lex_ctxt *, tree_cell *); 21 | 22 | #endif 23 | -------------------------------------------------------------------------------- /nasl/lint.h: -------------------------------------------------------------------------------- 1 | /* SPDX-FileCopyrightText: 2023 Greenbone AG 2 | * SPDX-FileCopyrightText: 2006 Software in the Public Interest, Inc. 3 | * SPDX-FileCopyrightText: 1998-2006 Tenable Network Security, Inc. 4 | * 5 | * SPDX-License-Identifier: GPL-2.0-only 6 | */ 7 | 8 | #ifndef NASL_LINT_H 9 | #define NASL_LINT_H 10 | 11 | #include "nasl_lex_ctxt.h" 12 | 13 | enum nasl_lint_feature_flags 14 | { 15 | NLFF_NONE = 0, 16 | NLFF_STRICT_INCLUDES = 1 17 | }; 18 | 19 | void 20 | nasl_lint_feature_flags (int flags); 21 | 22 | tree_cell * 23 | nasl_lint (lex_ctxt *lexic, tree_cell *st); 24 | 25 | #endif 26 | -------------------------------------------------------------------------------- /nasl/md4.h: -------------------------------------------------------------------------------- 1 | /* SPDX-FileCopyrightText: 2023 Greenbone AG 2 | * SPDX-FileCopyrightText: 1997-1998 Andrew Tridgell 3 | * 4 | * SPDX-License-Identifier: GPL-2.0-or-later 5 | */ 6 | 7 | /** 8 | * @file md4.h 9 | * @brief Unix SMB/CIFS implementation. 10 | * 11 | * A implementation of MD4 designed for use in the SMB authentication protocol 12 | */ 13 | #ifndef NASL_MD4_H 14 | #define NASL_MD4_H 15 | 16 | void 17 | mdfour_ntlmssp (unsigned char *out, const unsigned char *in, int n); 18 | 19 | #endif -------------------------------------------------------------------------------- /nasl/nasl_builtin_plugins.h: -------------------------------------------------------------------------------- 1 | /* SPDX-FileCopyrightText: 2023 Greenbone AG 2 | * 3 | * SPDX-License-Identifier: GPL-2.0-or-later 4 | */ 5 | 6 | /** 7 | * @file nasl_builtin_plugins.h 8 | * @brief Header file for built-in plugins. 9 | */ 10 | 11 | #ifndef NASL_NASL_BUILTIN_PLUGINS_H 12 | #define NASL_NASL_BUILTIN_PLUGINS_H 13 | #include "nasl_lex_ctxt.h" 14 | #include "nasl_tree.h" 15 | tree_cell * 16 | plugin_run_find_service (lex_ctxt *); 17 | 18 | tree_cell * 19 | plugin_run_openvas_tcp_scanner (lex_ctxt *); 20 | 21 | tree_cell * 22 | plugin_run_synscan (lex_ctxt *); 23 | 24 | #endif /* not NASL_NASL_BUILTIN_PLUGINS_H */ 25 | -------------------------------------------------------------------------------- /nasl/nasl_cert.h: -------------------------------------------------------------------------------- 1 | /* SPDX-FileCopyrightText: 2023 Greenbone AG 2 | * 3 | * SPDX-License-Identifier: GPL-2.0-or-later 4 | */ 5 | 6 | /** 7 | * @file nasl_cert.h 8 | * @brief Protos and data structures for CERT functions used by NASL scripts 9 | * 10 | * This file contains the protos for \ref nasl_cert.c 11 | */ 12 | 13 | #ifndef NASL_NASL_CERT_H 14 | #define NASL_NASL_CERT_H 15 | 16 | #include "nasl_lex_ctxt.h" 17 | 18 | tree_cell * 19 | nasl_cert_open (lex_ctxt *lexic); 20 | 21 | tree_cell * 22 | nasl_cert_close (lex_ctxt *lexic); 23 | 24 | tree_cell * 25 | nasl_cert_query (lex_ctxt *lexic); 26 | 27 | #endif /*NASL_NASL_CERT_H*/ 28 | -------------------------------------------------------------------------------- /nasl/nasl_frame_forgery.h: -------------------------------------------------------------------------------- 1 | /* SPDX-FileCopyrightText: 2023 Greenbone AG 2 | * 3 | * SPDX-License-Identifier: GPL-2.0-or-later 4 | */ 5 | 6 | /** 7 | * @file nasl_frame_forgery.h 8 | * @brief Header file for module nasl_frame_forgery. 9 | */ 10 | 11 | #ifndef NASL_NASL_FRAME_FORGERY_H 12 | #define NASL_NASL_FRAME_FORGERY_H 13 | 14 | #include "nasl_lex_ctxt.h" 15 | 16 | tree_cell * 17 | nasl_send_arp_request (lex_ctxt *); 18 | 19 | tree_cell * 20 | nasl_get_local_mac_address_from_ip (lex_ctxt *); 21 | 22 | tree_cell * 23 | nasl_forge_frame (lex_ctxt *); 24 | 25 | tree_cell * 26 | nasl_send_frame (lex_ctxt *); 27 | 28 | tree_cell * 29 | nasl_dump_frame (lex_ctxt *); 30 | 31 | #endif // NASL_NASL_FRAME_FORGERY_H 32 | -------------------------------------------------------------------------------- /nasl/nasl_func.h: -------------------------------------------------------------------------------- 1 | /* SPDX-FileCopyrightText: 2023 Greenbone AG 2 | * SPDX-FileCopyrightText: 2002-2003 Michel Arboi 3 | * SPDX-FileCopyrightText: 2002-2003 Renaud Deraison 4 | * 5 | * SPDX-License-Identifier: GPL-2.0-only 6 | */ 7 | 8 | #ifndef NASL_NASL_FUNC_H 9 | #define NASL_NASL_FUNC_H 10 | 11 | /** 12 | * Type for a built-in nasl function. 13 | */ 14 | typedef struct st_nasl_func 15 | { 16 | char *func_name; 17 | void *block; /* Can be pointer to a C function! */ 18 | } nasl_func; 19 | 20 | nasl_func * 21 | func_is_internal (const char *); 22 | 23 | void 24 | free_func (nasl_func *); 25 | 26 | #endif 27 | -------------------------------------------------------------------------------- /nasl/nasl_init.h: -------------------------------------------------------------------------------- 1 | /* SPDX-FileCopyrightText: 2023 Greenbone AG 2 | * SPDX-FileCopyrightText: 2002-2003 Michel Arboi 3 | * SPDX-FileCopyrightText: 2002-2003 Renaud Deraison 4 | * 5 | * SPDX-License-Identifier: GPL-2.0-only 6 | */ 7 | 8 | #ifndef NASL_NASL_INIT_H 9 | #define NASL_NASL_INIT_H 10 | #include "nasl_lex_ctxt.h" 11 | 12 | #include 13 | 14 | void 15 | init_nasl_library (lex_ctxt *); 16 | 17 | void 18 | add_nasl_library (GSList **); 19 | 20 | #endif 21 | -------------------------------------------------------------------------------- /nasl/nasl_isotime.h: -------------------------------------------------------------------------------- 1 | /* SPDX-FileCopyrightText: 2023 Greenbone AG 2 | * 3 | * SPDX-License-Identifier: GPL-2.0-or-later 4 | */ 5 | 6 | /** 7 | * @file nasl_isotime.h 8 | * @brief Protos and data structures for ISOTIME functions used by NASL scripts 9 | * 10 | * This file contains the protos for \ref nasl_isotime.c 11 | */ 12 | 13 | #ifndef NASL_NASL_ISOTIME_H 14 | #define NASL_NASL_ISOTIME_H 15 | 16 | #include "nasl_lex_ctxt.h" 17 | 18 | tree_cell * 19 | nasl_isotime_now (lex_ctxt *lexic); 20 | 21 | tree_cell * 22 | nasl_isotime_is_valid (lex_ctxt *lexic); 23 | 24 | tree_cell * 25 | nasl_isotime_scan (lex_ctxt *lexic); 26 | 27 | tree_cell * 28 | nasl_isotime_print (lex_ctxt *lexic); 29 | 30 | tree_cell * 31 | nasl_isotime_add (lex_ctxt *lexic); 32 | 33 | #endif /*NASL_NASL_ISOTIME_H*/ 34 | -------------------------------------------------------------------------------- /nasl/nasl_signature.h: -------------------------------------------------------------------------------- 1 | /* SPDX-FileCopyrightText: 2023 Greenbone AG 2 | * 3 | * SPDX-License-Identifier: GPL-2.0-or-later 4 | */ 5 | 6 | #ifndef NASL_NASL_SIGNATURE_H 7 | #define NASL_NASL_SIGNATURE_H 8 | 9 | #include 10 | 11 | int 12 | nasl_verify_signature (const char *, const char *, size_t); 13 | 14 | #endif 15 | -------------------------------------------------------------------------------- /nasl/nasl_snmp.h: -------------------------------------------------------------------------------- 1 | /* SPDX-FileCopyrightText: 2023 Greenbone AG 2 | * 3 | * SPDX-License-Identifier: GPL-2.0-or-later 4 | */ 5 | 6 | /** 7 | * @file nasl_snmp.h 8 | * @brief Headers of an API for SNMP used by NASL scripts. 9 | */ 10 | #ifndef NASL_NASL_SNMP_H 11 | #define NASL_NASL_SNMP_H 12 | 13 | #include "nasl_lex_ctxt.h" 14 | #include "nasl_tree.h" 15 | tree_cell * 16 | nasl_snmpv1_get (lex_ctxt *); 17 | 18 | tree_cell * 19 | nasl_snmpv1_getnext (lex_ctxt *); 20 | 21 | tree_cell * 22 | nasl_snmpv2c_get (lex_ctxt *); 23 | 24 | tree_cell * 25 | nasl_snmpv2c_getnext (lex_ctxt *); 26 | 27 | tree_cell * 28 | nasl_snmpv3_get (lex_ctxt *); 29 | 30 | tree_cell * 31 | nasl_snmpv3_getnext (lex_ctxt *); 32 | 33 | #endif 34 | -------------------------------------------------------------------------------- /nasl/tests/signed.nasl.asc: -------------------------------------------------------------------------------- 1 | -----BEGIN PGP SIGNATURE----- 2 | Version: GnuPG v1.4.10 (GNU/Linux) 3 | 4 | iEYEABECAAYFAlAtLXIACgkQ90OJv9I6KBj9YwCfazhJ6nBYaiNRutdfpUml2olt 5 | gsMAoJdygJS1Bl5qWsiOrUB8UWiuY1G6 6 | =+lDC 7 | -----END PGP SIGNATURE----- 8 | -------------------------------------------------------------------------------- /nasl/tests/testsuiteinit.nasl: -------------------------------------------------------------------------------- 1 | # SPDX-FileCopyrightText: 2023 Greenbone AG 2 | # Some text descriptions might be excerpted from (a) referenced 3 | # source(s), and are Copyright (C) by the respective right holder(s). 4 | # 5 | # SPDX-License-Identifier: GPL-2.0-or-later 6 | 7 | # OpenVAS Testsuite for the NASL interpreter 8 | # Description: Testsuite support functions 9 | 10 | # initializes the test suite and provides some helper functions 11 | 12 | global_var num_successful, num_failed; 13 | 14 | num_successful = 0; 15 | num_failed = 0; 16 | 17 | function testcase_start(name) 18 | { 19 | name = _FCT_ANON_ARGS[0]; 20 | display(name, " "); 21 | } 22 | 23 | function testcase_ok() 24 | { 25 | display("OK\n"); 26 | num_successful += 1; 27 | } 28 | 29 | function testcase_failed() 30 | { 31 | display("FAILED\n"); 32 | num_failed += 1; 33 | } 34 | -------------------------------------------------------------------------------- /nasl/tests/testsuitesummary.nasl: -------------------------------------------------------------------------------- 1 | # SPDX-FileCopyrightText: 2023 Greenbone AG 2 | # Some text descriptions might be excerpted from (a) referenced 3 | # source(s), and are Copyright (C) by the respective right holder(s). 4 | # 5 | # SPDX-License-Identifier: GPL-2.0-or-later 6 | 7 | # OpenVAS Testsuite for the NASL interpreter 8 | # Description: prints the test summary 9 | 10 | function testsuite_summary() 11 | { 12 | display("----------\n"); 13 | display(num_successful + num_failed, " tests, ", num_failed, " failed\n"); 14 | 15 | if (num_failed > 0) 16 | exit(1); 17 | } 18 | 19 | testsuite_summary(); 20 | -------------------------------------------------------------------------------- /release_tag.toml: -------------------------------------------------------------------------------- 1 | # disables labeling when this label is on a PR 2 | disable_on = "no_release" 3 | 4 | # The priority is used when only_highest_priority is set to true 5 | labels = [ 6 | { name = "patch_release", priority = 1 }, 7 | { name = "minor_release", priority = 2 }, 8 | { name = "major_release", priority = 3 }, 9 | ] 10 | 11 | # group within groups must be defined in `changelog.toml` 12 | # label within groups must be defined in `labels` 13 | groups = [ 14 | { group = "Added", label = "minor_release" }, 15 | { group = "Changed", label = "major_release" }, 16 | { group = "Removed", label = "major_release" }, 17 | { group = "Bug Fixes", label = "patch_release" }, 18 | ] 19 | 20 | # when set to false all unique labels will be set 21 | # otherwise only one label with the highest priority 22 | # will be set 23 | only_highest_priority = true 24 | 25 | -------------------------------------------------------------------------------- /rust/.cargo/audit.toml: -------------------------------------------------------------------------------- 1 | [advisories] 2 | # RUSTSEC-2023-0071 side channel attack; currently not fixable 3 | ignore = ["RUSTSEC-2023-0071"] 4 | -------------------------------------------------------------------------------- /rust/.gitignore: -------------------------------------------------------------------------------- 1 | target/ 2 | libsrc/ 3 | *.rsa 4 | *.cert 5 | -------------------------------------------------------------------------------- /rust/Cross.toml: -------------------------------------------------------------------------------- 1 | [build.env] 2 | passthrough = ["IN_CROSS=1", "CLEAN=1"] 3 | [target.aarch64-unknown-linux-gnu] 4 | dockerfile = "cross_aarch64.Dockerfile" 5 | [target.x86_64-unknown-linux-gnu] 6 | dockerfile = "cross.Dockerfile" 7 | -------------------------------------------------------------------------------- /rust/crates/nasl-c-lib/.gitignore: -------------------------------------------------------------------------------- 1 | tmp/ 2 | include/ 3 | bin/ 4 | share/ 5 | lib/ 6 | -------------------------------------------------------------------------------- /rust/crates/nasl-c-lib/Cargo.toml: -------------------------------------------------------------------------------- 1 | [package] 2 | name = "nasl-c-lib" 3 | version = "0.1.0" 4 | edition = "2024" 5 | 6 | # See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html 7 | [dependencies] 8 | libgcrypt-sys = { path = "libgcrypt-sys" } 9 | 10 | [build-dependencies] 11 | cc = "1.0" 12 | -------------------------------------------------------------------------------- /rust/crates/nasl-c-lib/c/cryptographic/gcrypt_error.c: -------------------------------------------------------------------------------- 1 | /* SPDX-FileCopyrightText: 2023 Greenbone AG 2 | * 3 | * SPDX-License-Identifier: GPL-2.0-or-later WITH x11vnc-openssl-exception 4 | */ 5 | 6 | #include "gcrypt_error.h" 7 | 8 | #include 9 | 10 | const char * 11 | gcrypt_strerror (gcry_error_t err) 12 | { 13 | return gcry_strerror (err); 14 | } 15 | -------------------------------------------------------------------------------- /rust/crates/nasl-c-lib/c/cryptographic/gcrypt_error.h: -------------------------------------------------------------------------------- 1 | /* SPDX-FileCopyrightText: 2023 Greenbone AG 2 | * 3 | * SPDX-License-Identifier: GPL-2.0-or-later WITH x11vnc-openssl-exception 4 | */ 5 | 6 | #ifndef NASL_GCRYPT_ERROR_H 7 | #define NASL_GCRYPT_ERROR_H 8 | 9 | #include 10 | 11 | const char * 12 | gcrypt_strerror (gcry_error_t err); 13 | 14 | #endif 15 | -------------------------------------------------------------------------------- /rust/crates/nasl-c-lib/libgcrypt-sys/Cargo.toml: -------------------------------------------------------------------------------- 1 | [package] 2 | name = "libgcrypt-sys" 3 | version = "0.1.0" 4 | edition = "2024" 5 | links = "gcrypt" 6 | -------------------------------------------------------------------------------- /rust/crates/nasl-c-lib/libgcrypt-sys/src/lib.rs: -------------------------------------------------------------------------------- 1 | // SPDX-FileCopyrightText: 2024 Greenbone AG 2 | // 3 | // SPDX-License-Identifier: GPL-2.0-or-later WITH x11vnc-openssl-exception 4 | -------------------------------------------------------------------------------- /rust/crates/nasl-c-lib/src/cryptographic/mod.rs: -------------------------------------------------------------------------------- 1 | // SPDX-FileCopyrightText: 2024 Greenbone AG 2 | // 3 | // SPDX-License-Identifier: GPL-2.0-or-later WITH x11vnc-openssl-exception 4 | 5 | use std::ffi::CStr; 6 | 7 | pub mod mac; 8 | 9 | unsafe extern "C" { 10 | pub fn gcrypt_strerror(err: ::std::os::raw::c_int) -> *const ::std::os::raw::c_char; 11 | } 12 | 13 | fn gcrypt_get_error_string(error: i32) -> &'static str { 14 | let char_ptr = unsafe { gcrypt_strerror(error) }; 15 | let c_str = unsafe { CStr::from_ptr(char_ptr) }; 16 | c_str.to_str().unwrap_or("Invalid UTF8") 17 | } 18 | -------------------------------------------------------------------------------- /rust/crates/nasl-c-lib/src/lib.rs: -------------------------------------------------------------------------------- 1 | // SPDX-FileCopyrightText: 2024 Greenbone AG 2 | // 3 | // SPDX-License-Identifier: GPL-2.0-or-later WITH x11vnc-openssl-exception 4 | 5 | pub mod cryptographic; 6 | -------------------------------------------------------------------------------- /rust/crates/nasl-c-lib/tests/helper/mod.rs: -------------------------------------------------------------------------------- 1 | // SPDX-FileCopyrightText: 2024 Greenbone AG 2 | // 3 | // SPDX-License-Identifier: GPL-2.0-or-later WITH x11vnc-openssl-exception 4 | 5 | use std::num::ParseIntError; 6 | 7 | /// Decodes given string as hex and returns the result as a byte array 8 | pub(crate) fn decode_hex(s: &str) -> Result, ParseIntError> { 9 | (0..s.len()) 10 | .step_by(2) 11 | .map(|i| u8::from_str_radix(&s[i..i + 2], 16)) 12 | .collect() 13 | } 14 | -------------------------------------------------------------------------------- /rust/crates/nasl-c-lib/tests/mac.rs: -------------------------------------------------------------------------------- 1 | // SPDX-FileCopyrightText: 2023 Greenbone AG 2 | // 3 | // SPDX-License-Identifier: GPL-2.0-or-later WITH x11vnc-openssl-exception 4 | 5 | mod helper; 6 | #[cfg(test)] 7 | mod tests { 8 | use nasl_c_lib::cryptographic::mac::aes_gmac; 9 | 10 | use crate::helper::decode_hex; 11 | 12 | #[test] 13 | fn aes_mac_gcm() { 14 | let key = decode_hex("7fddb57453c241d03efbed3ac44e371c").unwrap(); 15 | let data = decode_hex("d5de42b461646c255c87bd2962d3b9a2").unwrap(); 16 | let iv = decode_hex("ee283a3fc75575e33efd48").unwrap(); 17 | 18 | let result = aes_gmac(data.as_slice(), key.as_slice(), iv.as_slice()); 19 | 20 | assert!(result.is_ok()); 21 | } 22 | } 23 | -------------------------------------------------------------------------------- /rust/crates/nasl-function-proc-macro/Cargo.toml: -------------------------------------------------------------------------------- 1 | [package] 2 | name = "nasl-function-proc-macro" 3 | version = "0.1.0" 4 | edition = "2024" 5 | 6 | [dependencies] 7 | syn = { version = "2.0", features = ["full", "extra-traits"] } 8 | quote = "1.0" 9 | proc-macro2 = "1.0.86" 10 | 11 | [lib] 12 | proc-macro = true -------------------------------------------------------------------------------- /rust/crates/smoketest/Cargo.toml: -------------------------------------------------------------------------------- 1 | [package] 2 | name = "smoketest" 3 | version = "0.1.0" 4 | edition = "2024" 5 | 6 | # See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html 7 | 8 | [dependencies] 9 | clap = { version = "4.4.0", features = ["derive"] } 10 | reqwest = { version = "0.11.20", features = ["rustls-tls", "blocking", "json"], default-features=false } 11 | tokio = { workspace = true } 12 | tracing = "0.1.37" 13 | tracing-subscriber = { version = "0.3.17", features = ["env-filter"] } 14 | serde = {version = "1", features = ["derive"], optional = true} 15 | serde_json = "1" 16 | scannerlib = { path = "../.." } 17 | 18 | [features] 19 | default = ["serde_support"] 20 | serde_support = ["serde"] 21 | smoketest = [] 22 | 23 | [dev-dependencies] 24 | serde_json = "1" 25 | -------------------------------------------------------------------------------- /rust/crates/smoketest/configs/simple_scan_ssh_only.json: -------------------------------------------------------------------------------- 1 | {"target": {"hosts": [""], 2 | "ports": [ 3 | { 4 | "protocol": "tcp", 5 | "range": [ 6 | { 7 | "start": 22, 8 | "end": 22 9 | } 10 | ] 11 | } 12 | ], 13 | "credentials": [ 14 | { 15 | "service": "ssh", 16 | "port": 22, 17 | "up": { 18 | "username": "", 19 | "password": "" 20 | } 21 | } 22 | ] 23 | }, 24 | "vts": [ 25 | { 26 | "oid": "1.3.6.1.4.1.25623.1.0.90022" 27 | } 28 | ] 29 | } 30 | -------------------------------------------------------------------------------- /rust/data/feed/plugin_feed_info.inc: -------------------------------------------------------------------------------- 1 | # SPDX-FileCopyrightText: 2023 Greenbone AG 2 | # Some text descriptions might be excerpted from (a) referenced 3 | # source(s), and are Copyright (C) by the respective right holder(s). 4 | # 5 | # SPDX-License-Identifier: GPL-2.0-or-later WITH x11vnc-openssl-exception 6 | 7 | PLUGIN_SET = "202302011009"; 8 | PLUGIN_FEED = "Ziggi Di Mik Mik"; 9 | FEED_VENDOR = "Greenbone AG"; 10 | FEED_HOME = "https://www.greenbone.net/en/feed-comparison/"; 11 | FEED_NAME = "ZiggiDiMikMik"; 12 | -------------------------------------------------------------------------------- /rust/data/feed/sha256sums: -------------------------------------------------------------------------------- 1 | 5250af0ebd8bd431b2e32d6b8075c1f803108d3fb7ccf3d43c7d442c3db74770 plugin_feed_info.inc 2 | 2a23d0316941cfc0f3295f0d4b1e62dc6bdcbbe68baa279729ec34420fb0619f test.inc 3 | d9414deb6d3f9c9f07b09cb9496ff2b6a2ae1c7f805b4a7edd31faefd9a7c8a8 test.nasl 4 | -------------------------------------------------------------------------------- /rust/data/feed/test.inc: -------------------------------------------------------------------------------- 1 | # SPDX-FileCopyrightText: 2023 Greenbone AG 2 | # Some text descriptions might be excerpted from (a) referenced 3 | # source(s), and are Copyright (C) by the respective right holder(s). 4 | # 5 | # SPDX-License-Identifier: GPL-2.0-or-later WITH x11vnc-openssl-exception 6 | -------------------------------------------------------------------------------- /rust/data/feed/test.nasl: -------------------------------------------------------------------------------- 1 | # SPDX-FileCopyrightText: 2023 Greenbone AG 2 | # Some text descriptions might be excerpted from (a) referenced 3 | # source(s), and are Copyright (C) by the respective right holder(s). 4 | # 5 | # SPDX-License-Identifier: GPL-2.0-or-later WITH x11vnc-openssl-exception 6 | 7 | if (description) { 8 | script_oid("1"); 9 | exit(0); 10 | } 11 | include("test.inc"); 12 | exit(1); 13 | -------------------------------------------------------------------------------- /rust/data/notus/README.md: -------------------------------------------------------------------------------- 1 | # Data Directory 2 | 3 | This directory primarily contains data, that is necessary to write unit and integration tests. -------------------------------------------------------------------------------- /rust/data/osp/response_queued.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | -------------------------------------------------------------------------------- /rust/examples/.gitignore: -------------------------------------------------------------------------------- 1 | test.sh 2 | -------------------------------------------------------------------------------- /rust/examples/README.md: -------------------------------------------------------------------------------- 1 | This contains a rudimentary feed for testing purposes. 2 | 3 | This is not a real feed. 4 | -------------------------------------------------------------------------------- /rust/examples/arp_request.nasl: -------------------------------------------------------------------------------- 1 | # SPDX-FileCopyrightText: 2023 Greenbone AG 2 | # Some text descriptions might be excerpted from (a) referenced 3 | # source(s), and are Copyright (C) by the respective right holder(s). 4 | # 5 | # SPDX-License-Identifier: GPL-2.0-or-later WITH x11vnc-openssl-exception 6 | 7 | if(description) { 8 | script_oid("1.2.3"); 9 | exit(0); 10 | } 11 | 12 | display(send_arp_request(pcap_timeout: 2)); 13 | -------------------------------------------------------------------------------- /rust/examples/error.nasl: -------------------------------------------------------------------------------- 1 | # SPDX-FileCopyrightText: 2023 Greenbone AG 2 | # Some text descriptions might be excerpted from (a) referenced 3 | # source(s), and are Copyright (C) by the respective right holder(s). 4 | # 5 | # SPDX-License-Identifier: GPL-2.0-or-later WITH x11vnc-openssl-exception 6 | 7 | # when started with 8 | # scannerctl execute -p examples/ examples/error.nasl 9 | # it fails on include otherwise on display(a) 10 | 11 | include("error_inc.inc"); 12 | display(a) 13 | -------------------------------------------------------------------------------- /rust/examples/error_inc.inc: -------------------------------------------------------------------------------- 1 | # SPDX-FileCopyrightText: 2023 Greenbone AG 2 | # Some text descriptions might be excerpted from (a) referenced 3 | # source(s), and are Copyright (C) by the respective right holder(s). 4 | # 5 | # SPDX-License-Identifier: GPL-2.0-or-later WITH x11vnc-openssl-exception 6 | 7 | a = 1 8 | -------------------------------------------------------------------------------- /rust/examples/feed/nasl/plugin_feed_info.inc: -------------------------------------------------------------------------------- 1 | PLUGIN_SET = "0.0.1"; 2 | PLUGIN_FEED = "testus apparatus"; 3 | FEED_VENDOR = "Greenbone AG"; 4 | FEED_HOME = "https://www.greenbone.net"; 5 | FEED_NAME = "testus"; 6 | -------------------------------------------------------------------------------- /rust/examples/feed/nasl/sha256sums: -------------------------------------------------------------------------------- 1 | 85e4c46356ab18d34de67efd6c3b778d61e2de858d334ce17cc3ca8d0ee62c69 ./error_message.nasl 2 | 97669d7129c6a92197bfd414c610feb89eeaa0be7fe1b3d7b2c25fa49b16fa8c ./2.nasl 3 | 8f349ff124775d38be5242c97caa8a8568e66de4a334599a549e1f0f444fc8ee ./1.nasl 4 | 2cd9f921dd86b4170f4499e0e7d2aae393b7a014976a72dc81d28b4fa7e1dd5f ./http2_get.nasl 5 | 4837adf4f6ff07b1378ca6deb3d468621242e89d2349a21c0744b294c35af4cf ./security_message.nasl 6 | 85902178e00a8a25b4559936504685ed41a2815c7f16e23f8926b515711d8239 ./log_message.nasl 7 | 2e21d3f6973e02e74ebc10dcc4ca77e7fbe414d6a8b985b2e0cda0111199a6aa ./plugin_feed_info.inc 8 | -------------------------------------------------------------------------------- /rust/examples/feed/nasl/sha256sums.sh: -------------------------------------------------------------------------------- 1 | # This script creates a sha256sums over the nasl and inc files within this dir. 2 | #!/bin/sh 3 | PWD=$(pwd) 4 | set -e 5 | find . -type f -regex ".*\.\(nasl\|inc\)\$" -exec sha256sum {} \; | tee sha256sums 6 | -------------------------------------------------------------------------------- /rust/examples/feed/notus/advisories/sha256sums: -------------------------------------------------------------------------------- 1 | a6192b32e0dfdbb1177ade8df8b22bc3a9db49149a8187361f63ec5b1c2cddad windows.notus 2 | 297dbd12caf0894c01b43c536f13d2a06dcf814526014b9314308d070ac2e27a test.notus 3 | -------------------------------------------------------------------------------- /rust/examples/feed/notus/products/sha256sums: -------------------------------------------------------------------------------- 1 | 6830ce4bba090b122442e4277e25b1ecccb495ba1e347e363b282200434ac0df windows_11_home.notus 2 | 21574bf1ba1ff429fd7f40fa4d028bc60ed292a98b3d848a7af05d664fad3410 test.notus 3 | -------------------------------------------------------------------------------- /rust/examples/feed/notus/products/test.notus: -------------------------------------------------------------------------------- 1 | { 2 | "version": "1.2", 3 | "spdx-license-identifier": "GPL-2.0-only", 4 | "copyright": "Copyright (C) 2008-2024 Greenbone AG", 5 | "package_type": "deb", 6 | "product_name": "Test", 7 | "advisories": [ 8 | { 9 | "oid": "1.3.6.1.4.1.25623.1.1.1.2.2024.3731", 10 | "fixed_packages": [ 11 | { 12 | "name": "man-db", 13 | "full_version": "2.8.5-2+deb10u1", 14 | "specifier": ">=" 15 | } 16 | ] 17 | } 18 | ] 19 | } 20 | -------------------------------------------------------------------------------- /rust/examples/get_kb_item.nasl: -------------------------------------------------------------------------------- 1 | # SPDX-FileCopyrightText: 2025 Greenbone AG 2 | # 3 | # SPDX-License-Identifier: GPL-2.0-or-later WITH x11vnc-openssl-exception 4 | 5 | set_kb_item(name: "test", value: 1); 6 | set_kb_item(name: "test", value: 2); 7 | set_kb_item(name: "test", value: 3); 8 | set_kb_item(name: "test", value: 4); 9 | set_kb_item(name: "test", value: 5); 10 | display(get_kb_item("test")); 11 | -------------------------------------------------------------------------------- /rust/examples/http2.nasl: -------------------------------------------------------------------------------- 1 | # SPDX-FileCopyrightText: 2023 Greenbone AG 2 | # 3 | # SPDX-License-Identifier: GPL-2.0-or-later WITH x11vnc-openssl-exception 4 | 5 | display("Starting..."); 6 | h = http2_handle(); 7 | display(h); 8 | 9 | i = http2_set_custom_header(handle: h, header_item: "X-API-KEY: changeme"); 10 | i = http2_set_custom_header(handle: h, header_item: "content-type: application/json"); 11 | 12 | # valid for openvasd 13 | r = http2_get(handle:h, port:3000, item:"/health/ready", schema:"https"); 14 | display("response: ", r); 15 | 16 | rc = http2_get_response_code(handle:h); 17 | 18 | display("return code: ", rc); 19 | 20 | http2_close_handle(h); 21 | -------------------------------------------------------------------------------- /rust/examples/packet_forgery_igmp.nasl: -------------------------------------------------------------------------------- 1 | # SPDX-FileCopyrightText: 2023 Greenbone AG 2 | # 3 | # SPDX-License-Identifier: GPL-2.0-or-later WITH x11vnc-openssl-exception 4 | 5 | ip_packet = forge_ip_packet(ip_v : 4, 6 | ip_hl : 5, 7 | ip_tos : 0, 8 | ip_len : 20, 9 | ip_id : 1234, 10 | ip_p : 0x02, #IPPROTO_IGMP 11 | ip_ttl : 255, 12 | ip_off : 0, 13 | ip_src : 192.168.0.1, 14 | ip_dst : 192.168.0.10); 15 | 16 | igmp = forge_igmp_packet(ip: ip_packet, 17 | type: 0x11, 18 | code: 10, 19 | group: 224.0.0.1, 20 | ); 21 | 22 | display(igmp); 23 | send_packet(igmp); 24 | -------------------------------------------------------------------------------- /rust/examples/scannerctl/scan-configs/.gitignore: -------------------------------------------------------------------------------- 1 | *.json 2 | -------------------------------------------------------------------------------- /rust/examples/scoping.nasl: -------------------------------------------------------------------------------- 1 | # SPDX-FileCopyrightText: 2023 Greenbone AG 2 | # Some text descriptions might be excerpted from (a) referenced 3 | # source(s), and are Copyright (C) by the respective right holder(s). 4 | # 5 | # SPDX-License-Identifier: GPL-2.0-or-later WITH x11vnc-openssl-exception 6 | 7 | a = 1; 8 | if (a) { 9 | local_var a; 10 | a = 23; 11 | display(a); 12 | } 13 | display(a); 14 | -------------------------------------------------------------------------------- /rust/examples/sha256sums: -------------------------------------------------------------------------------- 1 | e9f95e180f84a9c0de971fe475e0a2a9f80443ed703f1aa9481f16a86329c478 control.nasl 2 | ea9a91ae76ca9c1ab5e4f95d3cd5b9b64b87bc629699a1abcca80bb58cb14df9 hello.nasl 3 | -------------------------------------------------------------------------------- /rust/examples/socket/ftp.nasl: -------------------------------------------------------------------------------- 1 | # SPDX-FileCopyrightText: 2024 Greenbone AG 2 | # 3 | # SPDX-License-Identifier: GPL-2.0-or-later WITH x11vnc-openssl-exception 4 | 5 | display("Start"); 6 | display("is function open_sock_tcp defined: ", defined_func("open_sock_tcp")); 7 | sock = open_sock_tcp(21, transport: 1); 8 | display("was socket created: ", !isnull(sock)); 9 | display("fd: ", sock); 10 | display("is function ftp_log_in defined: ", defined_func("ftp_log_in")); 11 | # Login data for ftp://ftp.dlptest.com/ provided by https://dlptest.com/ftp-test/ 12 | user = "dlpuser"; 13 | pass = "rNrKYTX9g7z3RgJRmxWuGHbeu"; 14 | display("login succeeded: ", ftp_log_in(user: user, pass: pass, socket: sock)); 15 | port = ftp_get_pasv_port(socket: sock); 16 | display("pasv port: ", port); 17 | close(sock); 18 | display("end"); 19 | -------------------------------------------------------------------------------- /rust/examples/socket/tcp.nasl: -------------------------------------------------------------------------------- 1 | # SPDX-FileCopyrightText: 2024 Greenbone AG 2 | # 3 | # SPDX-License-Identifier: GPL-2.0-or-later WITH x11vnc-openssl-exception 4 | 5 | display("Start"); 6 | display("is function defined: ", defined_func("open_sock_tcp")); 7 | sock = open_sock_tcp(34254, transport: 1); 8 | display("was socket created: ", !isnull(sock)); 9 | display("fd: ", sock); 10 | ret = send(socket: sock, data: 'foobar'); 11 | display("num bytes sent: ", ret); 12 | rec = recv(socket: sock, length: 10, min: 3); 13 | display("received: ", rec); 14 | port = get_source_port(sock); 15 | display("source port: ", port); 16 | close(sock); 17 | display("end"); 18 | -------------------------------------------------------------------------------- /rust/examples/socket/tcp_priv.nasl: -------------------------------------------------------------------------------- 1 | # SPDX-FileCopyrightText: 2024 Greenbone AG 2 | # 3 | # SPDX-License-Identifier: GPL-2.0-or-later WITH x11vnc-openssl-exception 4 | 5 | display("Start"); 6 | display("is function defined: ", defined_func("open_priv_sock_tcp")); 7 | sock = open_priv_sock_tcp(dport: 34254); 8 | display("was socket created: ", !isnull(sock)); 9 | display("fd: ", sock); 10 | ret = send(socket: sock, data: 'foobar'); 11 | display("num bytes sent: ", ret); 12 | rec = recv(socket: sock, length: 10, min: 3); 13 | display("received: ", rec); 14 | port = get_source_port(sock); 15 | display("source port: ", port); 16 | close(sock); 17 | display("end"); 18 | -------------------------------------------------------------------------------- /rust/examples/socket/tcp_recv_line.nasl: -------------------------------------------------------------------------------- 1 | # SPDX-FileCopyrightText: 2024 Greenbone AG 2 | # 3 | # SPDX-License-Identifier: GPL-2.0-or-later WITH x11vnc-openssl-exception 4 | 5 | display("Start"); 6 | display("is function defined: ", defined_func("open_sock_udp")); 7 | sock = open_sock_tcp(34254, transport: 1); 8 | if (isnull(sock)) { 9 | display("Failed to open socket"); 10 | exit(0); 11 | } 12 | display("fd: ", sock); 13 | ret = send(socket: sock, data: '123'); 14 | if (ret < 0) { 15 | display("Failed to send data"); 16 | exit(0); 17 | } 18 | display("num bytes sent: ", ret); 19 | rec = recv_line(socket: sock, length: 10, timeout: 1); 20 | display("line1: ", rec); 21 | rec = recv_line(socket: sock, length: 10, timeout: 1); 22 | display("line2: ", rec); 23 | rec = recv_line(socket: sock, length: 10, timeout: 1); 24 | display("line3: ", rec); 25 | display("end"); 26 | -------------------------------------------------------------------------------- /rust/examples/socket/udp.nasl: -------------------------------------------------------------------------------- 1 | # SPDX-FileCopyrightText: 2024 Greenbone AG 2 | # 3 | # SPDX-License-Identifier: GPL-2.0-or-later WITH x11vnc-openssl-exception 4 | 5 | display("Start"); 6 | display("is function defined: ", defined_func("open_sock_udp")); 7 | sock = open_sock_udp(34254); 8 | display("was socket created: ", !isnull(sock)); 9 | display("fd: ", sock); 10 | ret = send(socket: sock, data: '123'); 11 | display("num bytes sent: ", ret); 12 | rec = recv(socket: sock, length: 10); 13 | display(rec); 14 | close(sock); 15 | display("end"); 16 | -------------------------------------------------------------------------------- /rust/examples/socket/udp_priv.nasl: -------------------------------------------------------------------------------- 1 | # SPDX-FileCopyrightText: 2024 Greenbone AG 2 | # 3 | # SPDX-License-Identifier: GPL-2.0-or-later WITH x11vnc-openssl-exception 4 | 5 | display("Start"); 6 | display("is function defined: ", defined_func("open_priv_sock_udp")); 7 | sock = open_priv_sock_udp(dport: 34254); 8 | display("was socket created: ", !isnull(sock)); 9 | display("fd: ", sock); 10 | ret = send(socket: sock, data: '123'); 11 | display("num bytes sent: ", ret); 12 | rec = recv(socket: sock, length: 10); 13 | display(rec); 14 | close(sock); 15 | display("end"); 16 | -------------------------------------------------------------------------------- /rust/examples/wmi-exec.nasl: -------------------------------------------------------------------------------- 1 | # SPDX-FileCopyrightText: 2025 Greenbone AG 2 | # 3 | # SPDX-License-Identifier: GPL-2.0-or-later WITH x11vnc-openssl-exception 4 | 5 | login = string( get_kb_item( "KRB5/login_filled/0" ) ); 6 | password = string( get_kb_item( "KRB5/password_filled/0" ) ); 7 | realm = string( get_kb_item( "KRB5/realm_filled/0" ) ); 8 | kdc = string( get_kb_item( "KRB5/kdc_filled/0" ) ); 9 | host = ip_reverse_lookup(); 10 | cmd = 'powershell -Command "& {Get-Process}"'; 11 | 12 | result = win_cmd_exec(cmd:cmd, password:password, username:login, realm: realm, kdc: kdc, host:host); 13 | display(result); 14 | -------------------------------------------------------------------------------- /rust/fuzz/.gitignore: -------------------------------------------------------------------------------- 1 | target 2 | corpus 3 | artifacts 4 | coverage 5 | -------------------------------------------------------------------------------- /rust/fuzz/Cargo.toml: -------------------------------------------------------------------------------- 1 | [package] 2 | name = "nasl-syntax-fuzz" 3 | version = "0.0.0" 4 | publish = false 5 | edition = "2024" 6 | 7 | [package.metadata] 8 | cargo-fuzz = true 9 | 10 | [dependencies] 11 | libfuzzer-sys = "0.4" 12 | 13 | [dependencies.nasl-syntax] 14 | path = ".." 15 | 16 | # Prevent this from interfering with workspaces 17 | [workspace] 18 | members = ["."] 19 | 20 | [profile.release] 21 | debug = 1 22 | 23 | [[bin]] 24 | name = "fuzz_parse" 25 | path = "fuzz_targets/fuzz_parse.rs" 26 | test = false 27 | doc = false 28 | -------------------------------------------------------------------------------- /rust/fuzz/fuzz_targets/fuzz_parse.rs: -------------------------------------------------------------------------------- 1 | #![no_main] 2 | 3 | use libfuzzer_sys::fuzz_target; 4 | 5 | fuzz_target!(|data: &[u8]| { 6 | if let Ok(s) = std::str::from_utf8(data) { 7 | let _stmt = scannerlib::nasl::syntax::parse(&s).collect::>>(); 8 | } 9 | }); 10 | -------------------------------------------------------------------------------- /rust/src/alive_test/README.md: -------------------------------------------------------------------------------- 1 | # Alive Test 2 | 3 | This is the rust library implementation of Boreas from https://github.com/greenbone/gvm-libs/ and https://github.com/greenbone/boreas/ 4 | 5 | Alive Test is a library to scan for alive hosts as well as a command line tool integrated in scannerctl, which replaces the former Boreas library and command line tool written in C. 6 | 7 | It supports IPv4 and IPv6 address ranges and allows to exclude certain addresses from a range. The alive ping tests support ICMP, TCP-ACK, TCP-SYN and ARP and any combination. For TCP ping an individual port list can be applied. 8 | -------------------------------------------------------------------------------- /rust/src/alive_test/mod.rs: -------------------------------------------------------------------------------- 1 | // SPDX-FileCopyrightText: 2024 Greenbone AG 2 | // 3 | // SPDX-License-Identifier: GPL-2.0-or-later WITH x11vnc-openssl-exception 4 | 5 | #![doc = include_str!("README.md")] 6 | 7 | #[cfg(feature = "nasl-builtin-raw-ip")] 8 | #[allow(clippy::module_inception)] 9 | mod alive_test; 10 | mod error; 11 | 12 | #[cfg(feature = "nasl-builtin-raw-ip")] 13 | pub use alive_test::Scanner; 14 | pub use error::Error as AliveTestError; 15 | -------------------------------------------------------------------------------- /rust/src/feed/mod.rs: -------------------------------------------------------------------------------- 1 | // SPDX-FileCopyrightText: 2023 Greenbone AG 2 | // 3 | // SPDX-License-Identifier: GPL-2.0-or-later WITH x11vnc-openssl-exception 4 | 5 | #![doc = include_str!("README.md")] 6 | mod oid; 7 | mod transpile; 8 | mod update; 9 | mod verify; 10 | 11 | #[cfg(test)] 12 | mod update_tests; 13 | 14 | pub use oid::Oid; 15 | pub use update::Error as UpdateError; 16 | pub use update::ErrorKind as UpdateErrorKind; 17 | pub use update::Update; 18 | pub use update::feed_version as version; 19 | pub use verify::Error as VerifyError; 20 | pub use verify::FakeVerifier; 21 | pub use verify::FileNameLoader; 22 | pub use verify::HashSumNameLoader; 23 | pub use verify::Hasher; 24 | pub use verify::NaslFileFinder; 25 | pub use verify::SignatureChecker; 26 | pub use verify::check_signature; 27 | 28 | pub use transpile::FeedReplacer; 29 | pub use transpile::ReplaceCommand; 30 | -------------------------------------------------------------------------------- /rust/src/feed_verifier/README.md: -------------------------------------------------------------------------------- 1 | # feed-verifier 2 | 3 | Is a specialized cli program to verify if 4 | 5 | ``` 6 | openvas -u 7 | ``` 8 | 9 | and 10 | 11 | ``` 12 | scannerctl feed update 13 | ``` 14 | 15 | do have the same output within redis. 16 | 17 | This is required to verify if the rust based scannerctl is downwards compatible to ospd-openvas. 18 | -------------------------------------------------------------------------------- /rust/src/lib.rs: -------------------------------------------------------------------------------- 1 | // SPDX-FileCopyrightText: 2025 Greenbone AG 2 | // 3 | // SPDX-License-Identifier: GPL-2.0-or-later WITH x11vnc-openssl-exception 4 | 5 | // We allow this fow now, since it would require lots of changes 6 | // but should eventually solve this. 7 | #![allow(clippy::result_large_err)] 8 | #![allow(clippy::large_enum_variant)] 9 | 10 | #[cfg(feature = "nasl-builtin-raw-ip")] 11 | pub mod alive_test; 12 | pub mod feed; 13 | pub mod models; 14 | pub mod nasl; 15 | pub mod notus; 16 | pub mod openvas; 17 | pub mod osp; 18 | pub mod scanner; 19 | pub mod scheduling; 20 | pub mod storage; 21 | -------------------------------------------------------------------------------- /rust/src/models/parameter.rs: -------------------------------------------------------------------------------- 1 | // SPDX-FileCopyrightText: 2023 Greenbone AG 2 | // 3 | // SPDX-License-Identifier: GPL-2.0-or-later WITH x11vnc-openssl-exception 4 | 5 | use std::fmt::Display; 6 | 7 | #[derive(Debug, Clone, PartialEq, Eq, Hash, PartialOrd, Ord)] 8 | #[cfg_attr( 9 | feature = "serde_support", 10 | derive(serde::Serialize, serde::Deserialize) 11 | )] 12 | /// Represents a parameter for a VTS configuration. 13 | pub struct Parameter { 14 | /// The ID of the parameter. 15 | pub id: u16, 16 | /// The value of the parameter. 17 | pub value: String, 18 | } 19 | 20 | impl Display for Parameter { 21 | fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result { 22 | write!(f, "{}: {}", self.id, self.value) 23 | } 24 | } 25 | -------------------------------------------------------------------------------- /rust/src/nasl/builtin/cryptographic/tests/aes_cmac.rs: -------------------------------------------------------------------------------- 1 | // SPDX-FileCopyrightText: 2023 Greenbone AG 2 | // 3 | // SPDX-License-Identifier: GPL-2.0-or-later WITH x11vnc-openssl-exception 4 | 5 | use super::helper::decode_hex; 6 | use crate::nasl::test_prelude::*; 7 | 8 | #[test] 9 | fn aes_mac_cbc() { 10 | let mut t = TestBuilder::default(); 11 | t.run(r#"key = hexstr_to_data("e3ceb929b52a6eec02b99b13bf30721b");"#); 12 | t.run(r#"data = hexstr_to_data("d2e8a3e86ae0b9edc7cc3116d929a16f13ee3643");"#); 13 | t.ok( 14 | r#"crypt = aes_mac_cbc(key: key, data: data);"#, 15 | decode_hex("10f3d29e89e4039b85e16438b2b2a470").unwrap(), 16 | ); 17 | } 18 | -------------------------------------------------------------------------------- /rust/src/nasl/builtin/cryptographic/tests/des.rs: -------------------------------------------------------------------------------- 1 | // SPDX-FileCopyrightText: 2024 Greenbone AG 2 | // 3 | // SPDX-License-Identifier: GPL-2.0-or-later 4 | 5 | use super::helper::decode_hex; 6 | use crate::nasl::test_prelude::*; 7 | 8 | #[test] 9 | fn des_encrypt() { 10 | let mut t = TestBuilder::default(); 11 | t.run(r#"key = hexstr_to_data("0101010101010101");"#); 12 | t.run(r#"data = hexstr_to_data("95f8a5e5dd31d900");"#); 13 | t.ok(r#"DES(data,key);"#, decode_hex("8000000000000000").unwrap()); 14 | } 15 | -------------------------------------------------------------------------------- /rust/src/nasl/builtin/cryptographic/tests/helper/mod.rs: -------------------------------------------------------------------------------- 1 | // SPDX-FileCopyrightText: 2024 Greenbone AG 2 | // 3 | // SPDX-License-Identifier: GPL-2.0-or-later WITH x11vnc-openssl-exception 4 | 5 | use std::num::ParseIntError; 6 | 7 | pub fn decode_hex(s: &str) -> Result, ParseIntError> { 8 | (0..s.len()) 9 | .step_by(2) 10 | .map(|i| u8::from_str_radix(&s[i..i + 2], 16)) 11 | .collect() 12 | } 13 | -------------------------------------------------------------------------------- /rust/src/nasl/builtin/cryptographic/tests/mod.rs: -------------------------------------------------------------------------------- 1 | // SPDX-FileCopyrightText: 2025 Greenbone AG 2 | // 3 | // SPDX-License-Identifier: GPL-2.0-or-later WITH x11vnc-openssl-exception 4 | 5 | mod aes_cbc; 6 | mod aes_ccm; 7 | mod aes_cmac; 8 | mod aes_ctr; 9 | mod aes_gcm; 10 | mod bf_cbc; 11 | mod des; 12 | mod hash; 13 | mod helper; 14 | mod hmac; 15 | mod pem_to; 16 | mod rc4; 17 | mod rsa; 18 | -------------------------------------------------------------------------------- /rust/src/nasl/builtin/description/README.md: -------------------------------------------------------------------------------- 1 | # Extends nasl-function that don't have network or file capabilities 2 | 3 | It is part of the std which is proven in the tests. 4 | 5 | To use this module you have to initiate `Description` and look for the function: 6 | 7 | ```rust 8 | let functions = nasl_builtin_utils::NaslfunctionRegisterBuilder::new() 9 | .push_register(nasl_builtin_description::Description) 10 | .build(); 11 | ``` 12 | 13 | ## Implements 14 | 15 | - script_timeout 16 | - script_category 17 | - script_name 18 | - script_version 19 | - script_copyright 20 | - script_family 21 | - script_oid 22 | - script_dependencies 23 | - script_exclude_keys 24 | - script_mandatory_keys 25 | - script_require_ports 26 | - script_require_udp_ports 27 | - script_require_keys 28 | - script_cve_id 29 | - script_tag 30 | - script_xref 31 | - script_add_preference 32 | -------------------------------------------------------------------------------- /rust/src/nasl/builtin/host/README.md: -------------------------------------------------------------------------------- 1 | ## Implements 2 | 3 | - TARGET_IS_IPV6 4 | - add_host_name 5 | - get_host_name 6 | - get_host_name_source 7 | - get_host_names 8 | - resolve_host_name 9 | - resolve_hostname_to_multiple_ips 10 | - same_host 11 | -------------------------------------------------------------------------------- /rust/src/nasl/builtin/host/tests.rs: -------------------------------------------------------------------------------- 1 | // SPDX-FileCopyrightText: 2023 Greenbone AG 2 | // 3 | // SPDX-License-Identifier: GPL-2.0-or-later WITH x11vnc-openssl-exception 4 | 5 | use crate::{check_code_result_matches, nasl::prelude::*}; 6 | 7 | #[test] 8 | fn get_host_name() { 9 | check_code_result_matches!("get_host_name();", NaslValue::String(_)); 10 | check_code_result_matches!("get_host_names();", NaslValue::Array(_)); 11 | } 12 | -------------------------------------------------------------------------------- /rust/src/nasl/builtin/http/README.md: -------------------------------------------------------------------------------- 1 | ## Implements 2 | 3 | ## Missing 4 | -------------------------------------------------------------------------------- /rust/src/nasl/builtin/http/error.rs: -------------------------------------------------------------------------------- 1 | // SPDX-FileCopyrightText: 2025 Greenbone AG 2 | // 3 | // SPDX-License-Identifier: GPL-2.0-or-later WITH x11vnc-openssl-exception 4 | 5 | use std::io; 6 | 7 | use thiserror::Error; 8 | 9 | #[derive(Debug, Error)] 10 | pub enum HttpError { 11 | #[error("IO error during HTTP: {0}")] 12 | IO(io::ErrorKind), 13 | #[error("HTTP error: {0}")] 14 | H2(String), 15 | #[error("Handle ID {0} not found.")] 16 | HandleIdNotFound(i32), 17 | } 18 | 19 | impl From for HttpError { 20 | fn from(value: io::Error) -> Self { 21 | Self::IO(value.kind()) 22 | } 23 | } 24 | 25 | impl From for HttpError { 26 | fn from(value: h2::Error) -> Self { 27 | Self::H2(format!("{}", value)) 28 | } 29 | } 30 | -------------------------------------------------------------------------------- /rust/src/nasl/builtin/isotime/README.md: -------------------------------------------------------------------------------- 1 | ## Implements 2 | 3 | - isotime_add 4 | - isotime_is_valid 5 | - isotime_now 6 | - isotime_print 7 | - isotime_scan 8 | -------------------------------------------------------------------------------- /rust/src/nasl/builtin/knowledge_base/README.md: -------------------------------------------------------------------------------- 1 | ## Implements 2 | 3 | - set_kb_item 4 | - get_kp_item 5 | - get_kb_list 6 | - replace_kb_item 7 | 8 | ## Missing 9 | - get_host_kb_index: Do not apply. Redis specific and currently not used in any script 10 | -------------------------------------------------------------------------------- /rust/src/nasl/builtin/misc/README.md: -------------------------------------------------------------------------------- 1 | ## Implements 2 | 3 | - rand 4 | - get_byte_order 5 | - dec2str 6 | - typeof 7 | - isnull 8 | - unixtime 9 | - localtime 10 | - mktime 11 | - usleep 12 | - sleep 13 | - gzip 14 | - gunzip 15 | - defined_func 16 | - gettimeofday 17 | - dump_ctxt 18 | -------------------------------------------------------------------------------- /rust/src/nasl/builtin/network/README.md: -------------------------------------------------------------------------------- 1 | ## Implements 2 | - open_sock_kdc 3 | - open_sock_tcp 4 | - open_priv_sock_tcp 5 | - open_sock_udp 6 | - open_priv_sock_udp 7 | - close 8 | - send 9 | - recv 10 | - this_host_name 11 | - get_mtu 12 | - this_host 13 | - islocalhost 14 | - islocalnet 15 | - get_host_ip 16 | - scanner_add_port 17 | - recv_line 18 | - get_source_port 19 | - ftp_log_in 20 | - ftp_get_pasv_port 21 | - get_port_transport 22 | - get_host_open_port 23 | 24 | ## Missing 25 | 26 | - get_port_state 27 | - get_tcp_port_state 28 | - get_udp_port_state 29 | - join_multicast_group 30 | - leave_multicast_group 31 | - scanner_get_port 32 | - start_denial 33 | - end_denial 34 | - telnet_init 35 | -------------------------------------------------------------------------------- /rust/src/nasl/builtin/raw_ip/tests/mod.rs: -------------------------------------------------------------------------------- 1 | // SPDX-FileCopyrightText: 2025 Greenbone AG 2 | // 3 | // SPDX-License-Identifier: GPL-2.0-or-later WITH x11vnc-openssl-exception 4 | 5 | mod frame_forgery; 6 | mod packet_forgery; 7 | -------------------------------------------------------------------------------- /rust/src/nasl/builtin/regex/README.md: -------------------------------------------------------------------------------- 1 | ## Implements 2 | - ereg 3 | - ereg_replace 4 | - egrep 5 | - eregmatch 6 | 7 | -------------------------------------------------------------------------------- /rust/src/nasl/builtin/ssh/README.md: -------------------------------------------------------------------------------- 1 | ## Implements 2 | - ssh_connect 3 | - ssh_disconnect 4 | - ssh_session_id_from_sock 5 | - ssh_get_sock 6 | - ssh_set_login 7 | - ssh_userauth 8 | - ssh_request_exec 9 | - ssh_shell_open 10 | - ssh_shell_read 11 | - ssh_shell_write 12 | - ssh_shell_close 13 | - ssh_login_interactive 14 | - ssh_login_interactive_pass 15 | ## Missing 16 | - sftp_enabled_check 17 | - ssh_get_auth_methods 18 | - ssh_get_host_key 19 | - ssh_get_issue_banner 20 | - ssh_get_server_banner 21 | -------------------------------------------------------------------------------- /rust/src/nasl/builtin/string/README.md: -------------------------------------------------------------------------------- 1 | ## Implements 2 | - chomp 3 | - crap 4 | - display 5 | - hexstr 6 | - hexstr_to_data 7 | - raw_string 8 | - stridx 9 | - string 10 | - strlen 11 | - substr 12 | - tolower 13 | - toupper 14 | 15 | 16 | ## Missing 17 | - hex 18 | - insstr 19 | - int 20 | - match 21 | - ord 22 | - split 23 | - str_replace 24 | - strcat 25 | - strstr 26 | -------------------------------------------------------------------------------- /rust/src/nasl/interpreter/mod.rs: -------------------------------------------------------------------------------- 1 | mod error; 2 | 3 | mod assign; 4 | mod call; 5 | mod declare; 6 | mod forking_interpreter; 7 | mod include; 8 | #[allow(clippy::module_inception)] 9 | mod interpreter; 10 | mod loop_extension; 11 | mod operator; 12 | 13 | pub use error::{FunctionCallError, InterpretError, InterpretErrorKind}; 14 | pub use forking_interpreter::ForkingInterpreter; 15 | pub use interpreter::Interpreter; 16 | 17 | #[cfg(test)] 18 | mod tests; 19 | -------------------------------------------------------------------------------- /rust/src/nasl/interpreter/tests/mod.rs: -------------------------------------------------------------------------------- 1 | // SPDX-FileCopyrightText: 2025 Greenbone AG 2 | // 3 | // SPDX-License-Identifier: GPL-2.0-or-later WITH x11vnc-openssl-exception 4 | 5 | mod description; 6 | mod local_var; 7 | mod retry; 8 | -------------------------------------------------------------------------------- /rust/src/nasl/syntax/README.md: -------------------------------------------------------------------------------- 1 | # nasl-syntax 2 | 3 | `nasl-syntax` is a library to provide structured representation of NASL code. 4 | 5 | It will return an Iterator with either a [statement](./statement.rs) for further execution or an [error](./error.rs) if the given code was incorrect. 6 | 7 | Each statement is self contained and it is expected to be executed iteratively and therefore there is no visitor implementation. 8 | 9 | 10 | ## Usage 11 | 12 | ```rust 13 | use scannerlib::nasl::syntax::{Statement, SyntaxError}; 14 | let statements = 15 | scannerlib::nasl::syntax::parse("a = 23;b = 1;") 16 | .collect::>>(); 17 | ``` 18 | 19 | ## Build 20 | 21 | Run `cargo test` to test and `cargo build --release` to build it. 22 | -------------------------------------------------------------------------------- /rust/src/nasl/syntax/snapshots/statement_add.snap: -------------------------------------------------------------------------------- 1 | --- 2 | source: src/nasl/syntax/statement.rs 3 | expression: stmt 4 | snapshot_kind: text 5 | --- 6 | a + 1 7 | -------------------------------------------------------------------------------- /rust/src/nasl/syntax/snapshots/statement_array.snap: -------------------------------------------------------------------------------- 1 | --- 2 | source: src/nasl/syntax/statement.rs 3 | expression: stmt 4 | snapshot_kind: text 5 | --- 6 | a[1] 7 | -------------------------------------------------------------------------------- /rust/src/nasl/syntax/snapshots/statement_assign.snap: -------------------------------------------------------------------------------- 1 | --- 2 | source: src/nasl/syntax/statement.rs 3 | expression: stmt 4 | snapshot_kind: text 5 | --- 6 | a = 1 7 | -------------------------------------------------------------------------------- /rust/src/nasl/syntax/snapshots/statement_assign_return.snap: -------------------------------------------------------------------------------- 1 | --- 2 | source: src/nasl/syntax/statement.rs 3 | expression: stmt 4 | snapshot_kind: text 5 | --- 6 | --a 7 | -------------------------------------------------------------------------------- /rust/src/nasl/syntax/snapshots/statement_block.snap: -------------------------------------------------------------------------------- 1 | --- 2 | source: src/nasl/syntax/statement.rs 3 | expression: stmt 4 | snapshot_kind: text 5 | --- 6 | { ... } 7 | -------------------------------------------------------------------------------- /rust/src/nasl/syntax/snapshots/statement_break.snap: -------------------------------------------------------------------------------- 1 | --- 2 | source: src/nasl/syntax/statement.rs 3 | expression: stmt 4 | snapshot_kind: text 5 | --- 6 | break 7 | -------------------------------------------------------------------------------- /rust/src/nasl/syntax/snapshots/statement_call.snap: -------------------------------------------------------------------------------- 1 | --- 2 | source: src/nasl/syntax/statement.rs 3 | expression: stmt 4 | snapshot_kind: text 5 | --- 6 | a(); 7 | -------------------------------------------------------------------------------- /rust/src/nasl/syntax/snapshots/statement_continue.snap: -------------------------------------------------------------------------------- 1 | --- 2 | source: src/nasl/syntax/statement.rs 3 | expression: stmt 4 | snapshot_kind: text 5 | --- 6 | continue 7 | -------------------------------------------------------------------------------- /rust/src/nasl/syntax/snapshots/statement_declare.snap: -------------------------------------------------------------------------------- 1 | --- 2 | source: src/nasl/syntax/statement.rs 3 | expression: stmt 4 | snapshot_kind: text 5 | --- 6 | local_var a 7 | -------------------------------------------------------------------------------- /rust/src/nasl/syntax/snapshots/statement_div.snap: -------------------------------------------------------------------------------- 1 | --- 2 | source: src/nasl/syntax/statement.rs 3 | expression: stmt 4 | snapshot_kind: text 5 | --- 6 | a / 1 7 | -------------------------------------------------------------------------------- /rust/src/nasl/syntax/snapshots/statement_exit.snap: -------------------------------------------------------------------------------- 1 | --- 2 | source: src/nasl/syntax/statement.rs 3 | expression: stmt 4 | snapshot_kind: text 5 | --- 6 | exit(0); 7 | -------------------------------------------------------------------------------- /rust/src/nasl/syntax/snapshots/statement_for.snap: -------------------------------------------------------------------------------- 1 | --- 2 | source: src/nasl/syntax/statement.rs 3 | expression: stmt 4 | snapshot_kind: text 5 | --- 6 | for (i = 0; i < 10; i++) { a } 7 | -------------------------------------------------------------------------------- /rust/src/nasl/syntax/snapshots/statement_foreach.snap: -------------------------------------------------------------------------------- 1 | --- 2 | source: src/nasl/syntax/statement.rs 3 | expression: stmt 4 | snapshot_kind: text 5 | --- 6 | foreach a(b) {c} 7 | -------------------------------------------------------------------------------- /rust/src/nasl/syntax/snapshots/statement_function_declaration.snap: -------------------------------------------------------------------------------- 1 | --- 2 | source: src/nasl/syntax/statement.rs 3 | expression: stmt 4 | snapshot_kind: text 5 | --- 6 | function a((b)) { ... } 7 | -------------------------------------------------------------------------------- /rust/src/nasl/syntax/snapshots/statement_if.snap: -------------------------------------------------------------------------------- 1 | --- 2 | source: src/nasl/syntax/statement.rs 3 | expression: stmt 4 | snapshot_kind: text 5 | --- 6 | if (a) b else c 7 | -------------------------------------------------------------------------------- /rust/src/nasl/syntax/snapshots/statement_include.snap: -------------------------------------------------------------------------------- 1 | --- 2 | source: src/nasl/syntax/statement.rs 3 | expression: stmt 4 | snapshot_kind: text 5 | --- 6 | include("test.inc"); 7 | -------------------------------------------------------------------------------- /rust/src/nasl/syntax/snapshots/statement_modulo.snap: -------------------------------------------------------------------------------- 1 | --- 2 | source: src/nasl/syntax/statement.rs 3 | expression: stmt 4 | snapshot_kind: text 5 | --- 6 | a % 1 7 | -------------------------------------------------------------------------------- /rust/src/nasl/syntax/snapshots/statement_mul.snap: -------------------------------------------------------------------------------- 1 | --- 2 | source: src/nasl/syntax/statement.rs 3 | expression: stmt 4 | snapshot_kind: text 5 | --- 6 | a * 1 7 | -------------------------------------------------------------------------------- /rust/src/nasl/syntax/snapshots/statement_named_parameter.snap: -------------------------------------------------------------------------------- 1 | --- 2 | source: src/nasl/syntax/statement.rs 3 | expression: stmt 4 | snapshot_kind: text 5 | --- 6 | a: b 7 | -------------------------------------------------------------------------------- /rust/src/nasl/syntax/snapshots/statement_no_op.snap: -------------------------------------------------------------------------------- 1 | --- 2 | source: src/nasl/syntax/statement.rs 3 | expression: stmt 4 | snapshot_kind: text 5 | --- 6 | NoOp 7 | -------------------------------------------------------------------------------- /rust/src/nasl/syntax/snapshots/statement_parameter.snap: -------------------------------------------------------------------------------- 1 | --- 2 | source: src/nasl/syntax/statement.rs 3 | expression: stmt 4 | snapshot_kind: text 5 | --- 6 | (a, b) 7 | -------------------------------------------------------------------------------- /rust/src/nasl/syntax/snapshots/statement_primitive.snap: -------------------------------------------------------------------------------- 1 | --- 2 | source: src/nasl/syntax/statement.rs 3 | expression: stmt 4 | snapshot_kind: text 5 | --- 6 | 1 7 | -------------------------------------------------------------------------------- /rust/src/nasl/syntax/snapshots/statement_repeat.snap: -------------------------------------------------------------------------------- 1 | --- 2 | source: src/nasl/syntax/statement.rs 3 | expression: stmt 4 | snapshot_kind: text 5 | --- 6 | repeat a until b 7 | -------------------------------------------------------------------------------- /rust/src/nasl/syntax/snapshots/statement_return.snap: -------------------------------------------------------------------------------- 1 | --- 2 | source: src/nasl/syntax/statement.rs 3 | expression: stmt 4 | snapshot_kind: text 5 | --- 6 | return 0; 7 | -------------------------------------------------------------------------------- /rust/src/nasl/syntax/snapshots/statement_return_assign.snap: -------------------------------------------------------------------------------- 1 | --- 2 | source: src/nasl/syntax/statement.rs 3 | expression: stmt 4 | snapshot_kind: text 5 | --- 6 | a++ 7 | -------------------------------------------------------------------------------- /rust/src/nasl/syntax/snapshots/statement_sub.snap: -------------------------------------------------------------------------------- 1 | --- 2 | source: src/nasl/syntax/statement.rs 3 | expression: stmt 4 | snapshot_kind: text 5 | --- 6 | a - 1 7 | -------------------------------------------------------------------------------- /rust/src/nasl/syntax/snapshots/statement_variable.snap: -------------------------------------------------------------------------------- 1 | --- 2 | source: src/nasl/syntax/statement.rs 3 | expression: stmt 4 | snapshot_kind: text 5 | --- 6 | a 7 | -------------------------------------------------------------------------------- /rust/src/nasl/syntax/snapshots/statement_while.snap: -------------------------------------------------------------------------------- 1 | --- 2 | source: src/nasl/syntax/statement.rs 3 | expression: stmt 4 | snapshot_kind: text 5 | --- 6 | while (a) {b} 7 | -------------------------------------------------------------------------------- /rust/src/nasl/utils/function/mod.rs: -------------------------------------------------------------------------------- 1 | // SPDX-FileCopyrightText: 2025 Greenbone AG 2 | // 3 | // SPDX-License-Identifier: GPL-2.0-or-later WITH x11vnc-openssl-exception 4 | 5 | //! This module provides machinery to handle typical usecases 6 | //! while parsing the input arguments to NASL functions. 7 | 8 | mod from_nasl_value; 9 | mod maybe; 10 | mod positionals; 11 | mod to_nasl_result; 12 | mod types; 13 | pub mod utils; 14 | 15 | pub use from_nasl_value::FromNaslValue; 16 | pub use maybe::Maybe; 17 | pub use positionals::CheckedPositionals; 18 | pub use positionals::Positionals; 19 | pub use to_nasl_result::ToNaslResult; 20 | pub use types::Seconds; 21 | pub use types::StringOrData; 22 | pub use types::bytes_to_str; 23 | -------------------------------------------------------------------------------- /rust/src/notus/mod.rs: -------------------------------------------------------------------------------- 1 | // SPDX-FileCopyrightText: 2023 Greenbone AG 2 | // 3 | // SPDX-License-Identifier: GPL-2.0-or-later WITH x11vnc-openssl-exception 4 | 5 | #![doc = include_str!("README.md")] 6 | 7 | mod loader; 8 | mod packages; 9 | 10 | mod error; 11 | #[allow(clippy::module_inception)] 12 | mod notus; 13 | mod vts; 14 | 15 | #[cfg(test)] 16 | mod tests; 17 | 18 | pub use error::Error as NotusError; 19 | pub use loader::AdvisoryLoader; 20 | pub use loader::fs::FSProductLoader; 21 | pub use loader::hashsum::HashsumAdvisoryLoader; 22 | pub use loader::hashsum::HashsumProductLoader; 23 | pub use notus::Notus; 24 | -------------------------------------------------------------------------------- /rust/src/openvas/README.md: -------------------------------------------------------------------------------- 1 | # OpenVAS Control 2 | 3 | Is a module for controlling scan instances using OpenVAS. It works similar to 4 | [ospd-openvas](https://github.com/greenbone/ospd-openvas), as it prepares the 5 | scan and invokes a OpenVAS instance to run the scan 6 | -------------------------------------------------------------------------------- /rust/src/openvas/error.rs: -------------------------------------------------------------------------------- 1 | // SPDX-FileCopyrightText: 2024 Greenbone AG 2 | // 3 | // SPDX-License-Identifier: GPL-2.0-or-later WITH x11vnc-openssl-exception 4 | 5 | use std::io; 6 | 7 | use thiserror::Error; 8 | 9 | #[derive(Debug, Error)] 10 | pub enum OpenvasError { 11 | #[error("A scan with ID {0} already exists.")] 12 | DuplicateScanID(String), 13 | #[error("Unable to launch openvas executable.")] 14 | MissingExec, 15 | #[error("A scan with ID {0} not found.")] 16 | ScanNotFound(String), 17 | #[error("Unable to run command: {0}")] 18 | CmdError(io::Error), 19 | #[error("Maximum number of queued scan reached.")] 20 | MaxQueuedScans, 21 | #[error("Unable to run openvas.")] 22 | UnableToRunExec, 23 | } 24 | -------------------------------------------------------------------------------- /rust/src/openvas/mod.rs: -------------------------------------------------------------------------------- 1 | // SPDX-FileCopyrightText: 2024 Greenbone AG 2 | // 3 | // SPDX-License-Identifier: GPL-2.0-or-later WITH x11vnc-openssl-exception 4 | 5 | pub mod cmd; 6 | mod config; 7 | mod error; 8 | #[allow(clippy::module_inception)] 9 | mod openvas; 10 | mod openvas_redis; 11 | mod pref_handler; 12 | mod result_collector; 13 | 14 | pub use openvas::Scanner; 15 | -------------------------------------------------------------------------------- /rust/src/osp/mod.rs: -------------------------------------------------------------------------------- 1 | // SPDX-FileCopyrightText: 2023 Greenbone AG 2 | // 3 | // SPDX-License-Identifier: GPL-2.0-or-later WITH x11vnc-openssl-exception 4 | 5 | #![doc = include_str!("README.md")] 6 | mod commands; 7 | mod connection; 8 | mod response; 9 | mod scanner; 10 | 11 | #[cfg(test)] 12 | mod tests; 13 | 14 | pub use response::Response as OspResponse; 15 | pub use response::ResultType as OspResultType; 16 | pub use response::Scan as OspScan; 17 | pub use response::ScanResult as OspScanResult; 18 | pub use response::ScanStatus as OspScanStatus; 19 | pub use response::StringF32; 20 | pub use scanner::Scanner; 21 | -------------------------------------------------------------------------------- /rust/src/scanner/preferences/mod.rs: -------------------------------------------------------------------------------- 1 | // SPDX-FileCopyrightText: 2025 Greenbone AG 2 | // 3 | // SPDX-License-Identifier: GPL-2.0-or-later WITH x11vnc-openssl-exception 4 | 5 | pub mod preference; 6 | -------------------------------------------------------------------------------- /rust/src/scannerctl/notus_update/mod.rs: -------------------------------------------------------------------------------- 1 | // SPDX-FileCopyrightText: 2023 Greenbone AG 2 | // 3 | // SPDX-License-Identifier: GPL-2.0-or-later WITH x11vnc-openssl-exception 4 | pub mod scanner; 5 | pub mod update; 6 | -------------------------------------------------------------------------------- /rust/src/scannerctl/syntax/mod.rs: -------------------------------------------------------------------------------- 1 | // SPDX-FileCopyrightText: 2024 Greenbone AG 2 | // 3 | // SPDX-License-Identifier: GPL-2.0-or-later WITH x11vnc-openssl-exception 4 | 5 | use std::path::PathBuf; 6 | 7 | use crate::CliError; 8 | 9 | pub mod check; 10 | 11 | #[derive(clap::Parser)] 12 | pub struct SyntaxArgs { 13 | /// The directory of the NASL files for which to check the syntax. 14 | path: PathBuf, 15 | } 16 | 17 | pub async fn run(args: SyntaxArgs, verbose: bool, quiet: bool) -> Result<(), CliError> { 18 | check::run(&args.path, verbose, !quiet) 19 | } 20 | -------------------------------------------------------------------------------- /rust/src/scannerctl/utils.rs: -------------------------------------------------------------------------------- 1 | use std::str::FromStr; 2 | 3 | #[derive(Clone)] 4 | pub enum ArgOrStdin { 5 | Stdin, 6 | Arg(T), 7 | } 8 | 9 | impl FromStr for ArgOrStdin 10 | where 11 | T: FromStr, 12 | ::Err: std::error::Error + Send + Sync + 'static, 13 | { 14 | type Err = ::Err; 15 | 16 | fn from_str(s: &str) -> Result { 17 | if s == "-" { 18 | Ok(Self::Stdin) 19 | } else { 20 | Ok(Self::Arg(T::from_str(s)?)) 21 | } 22 | } 23 | } 24 | -------------------------------------------------------------------------------- /rust/src/storage/README.md: -------------------------------------------------------------------------------- 1 | # storage 2 | 3 | ``` 4 | 5 | ``` 6 | 7 | 8 | Is a specialized library to handle data from the nasl-interpreter to the storage / distribution implementation. 9 | 10 | To be able to introduce new distribution implementations the `Dispatcher` must be implement. 11 | 12 | The reason that it uses field descriptions rather than structs are two fold: 13 | 1. it allows the usage of streaming distribution 14 | 2. it makes it easier to store information immediately on execution 15 | 16 | Since we sometimes have the requirement to just store when all information is available the `on_exit` must be called when the interpreter finishes. 17 | 18 | A simplified example on how to write a storage implementation can be found in `InMemoryStorage` 19 | 20 | ## Build 21 | 22 | Run `cargo test` to test and `cargo build --release` to build it. 23 | -------------------------------------------------------------------------------- /rust/src/storage/infisto/mod.rs: -------------------------------------------------------------------------------- 1 | // SPDX-FileCopyrightText: 2024 Greenbone AG 2 | // 3 | // SPDX-License-Identifier: GPL-2.0-or-later WITH x11vnc-openssl-exception 4 | 5 | #![doc = include_str!("README.md")] 6 | 7 | mod base; 8 | mod crypto; 9 | mod error; 10 | pub mod json; 11 | mod serde; 12 | 13 | pub use base::{ 14 | CachedIndexFileStorer, IndexedByteStorage, IndexedByteStorageIterator, IndexedFileStorer, Range, 15 | }; 16 | pub use crypto::{ChaCha20IndexFileStorer, Key}; 17 | pub use error::Error; 18 | pub use error::IoErrorKind; 19 | pub use serde::Serialization; 20 | -------------------------------------------------------------------------------- /rust/src/storage/items/mod.rs: -------------------------------------------------------------------------------- 1 | // SPDX-FileCopyrightText: 2023 Greenbone AG 2 | // 3 | // SPDX-License-Identifier: GPL-2.0-or-later WITH x11vnc-openssl-exception 4 | 5 | pub mod kb; 6 | pub mod notus_advisory; 7 | pub mod nvt; 8 | pub mod result; 9 | -------------------------------------------------------------------------------- /rust/src/storage/items/notus_advisory.rs: -------------------------------------------------------------------------------- 1 | // SPDX-FileCopyrightText: 2023 Greenbone AG 2 | // 3 | // SPDX-License-Identifier: GPL-2.0-or-later WITH x11vnc-openssl-exception 4 | 5 | use crate::models; 6 | 7 | pub type NotusAdvisory = models::VulnerabilityData; 8 | 9 | #[derive(Clone)] 10 | pub struct NotusCache; 11 | -------------------------------------------------------------------------------- /rust/src/storage/items/result.rs: -------------------------------------------------------------------------------- 1 | // SPDX-FileCopyrightText: 2025 Greenbone AG 2 | // 3 | // SPDX-License-Identifier: GPL-2.0-or-later WITH x11vnc-openssl-exception 4 | 5 | use crate::{models, storage::ScanID}; 6 | 7 | pub type ResultItem = models::Result; 8 | 9 | pub type ResultContextKeySingle = (ScanID, usize); 10 | 11 | pub type ResultContextKeyAll = ScanID; 12 | -------------------------------------------------------------------------------- /rust/src/storage/redis/README.md: -------------------------------------------------------------------------------- 1 | # redis-storage 2 | 3 | Is the redis implementation for [storage](../../storage/). 4 | 5 | It is written in a downwards compatible way so that `ospd-openvas` is capable of reading and writing the data. 6 | -------------------------------------------------------------------------------- /rust/tests/data/crash-prefix-recursion.nasl: -------------------------------------------------------------------------------- 1 | # SPDX-FileCopyrightText: 2025 Greenbone AG 2 | # 3 | # SPDX-License-Identifier: GPL-2.0-or-later WITH x11vnc-openssl-exception 4 | 5 | [3 [-p0[[S[[[[[[[[z4[[a[[[[,[[[[[[[[[[[z4[[a[[[,[[[[[[[[[[[[[[[[s[[[[[[[[[[[[[[[[[a[[[[,[[[[[[[[[[[[[[[[[[s[[[[[[[[[[[[[[[[[[[,[[[[[[[[[[[[[[[[a[[[[,[[[[[[[[[[[[[[[[[[s[[[[[[[[[[[[[[[[[[[,[[[[[[[[[[[[[[[[[[[[[[s[[[[[[[[[[[[[[[,[[[[[[[[[[[[[[s[[[[[[[[[[[[[[[[[a[[[[,[[[[[[[[[Q[[[[[[[[[[[[[[[a[[[[,[[[[[[[[[[[[[[[[[[s[[[[[[[[[[[[[[[,[[[[[[[[[[[[[[s[[[[[[[[[[[[[[[[[a[[[[,[[[[[[[[s[[[[[[[[[[[[[[[[[a[[[[,[[[[[[[[[[[[[[[[[[s[[[[[[[[[[[[[[[,[[[[[[[[[[[[[[s[[[[[[[[[[[[[[[[[a[[[[,[[[[[[[[[Q[[[[[[[[[[[[[[[[[[[%[[[[[[[[[[ -------------------------------------------------------------------------------- /rust/tests/data/crash-recursion-depth.nasl: -------------------------------------------------------------------------------- 1 | # SPDX-FileCopyrightText: 2025 Greenbone AG 2 | # 3 | # SPDX-License-Identifier: GPL-2.0-or-later WITH x11vnc-openssl-exception 4 | 5 | i~f&((((((((((((((((((((((((((((((((+(((((((((((re(((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((~f&((((((((((((((((((((((((((((((((+(((((((((((re(((((((((((((((((((((((((((((((((((((((((((((((((((((~f&((((((((((((((((((((((((((((((((+(((((((((((re((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((~f&((((((((((((((((((((((((((((((((+(((((((((((re(((((((((((,i -------------------------------------------------------------------------------- /rust/typos.toml: -------------------------------------------------------------------------------- 1 | [default.extend-identifiers] 2 | OpenVAS = "OpenVAS" 3 | des_ede_cbc_encrypt = "des_ede_cbc_encrypt" 4 | typ = "typ" 5 | 6 | [default.extend-words] 7 | hd = "hd" 8 | guid = "guid" 9 | GOST = "GOST" 10 | fpr = "fpr" 11 | nversion = "nversion" 12 | 13 | [files] 14 | extend-exclude = [ 15 | "data/osp/response_*.xml", 16 | "crates/smoketest/configs/client_sample.cert", 17 | "*.notus", 18 | "examples/pem_to.nasl", 19 | "src/nasl/builtin/cryptographic/tests/pem_to.rs", 20 | ] 21 | -------------------------------------------------------------------------------- /smoketest_lint/Makefile: -------------------------------------------------------------------------------- 1 | # SPDX-FileCopyrightText: 2023 Greenbone AG 2 | # 3 | # SPDX-License-Identifier: GPL-2.0-or-later 4 | 5 | .PHONY: build run clean all 6 | 7 | build: 8 | go build -o run cmd/main.go 9 | 10 | run: build 11 | ./run 12 | 13 | clean: 14 | rm run 15 | 16 | all: build run clean 17 | 18 | -------------------------------------------------------------------------------- /smoketest_lint/README.md: -------------------------------------------------------------------------------- 1 | # smoke-test linter 2 | 3 | Contains a bunch of predefined nasl finds which are used by a go program to test the expected functionality of openvas-nasl-lint. 4 | 5 | To build and run the tests a Makefile is provided: 6 | - make build - builds the file `run` in the root directory 7 | - make run - runs the program `run` builded with `make build` 8 | - make clean - removes the builded program `run` 9 | - make all - automatically builds, runs and cleans 10 | 11 | To verify in your local environment you need to have `go` installed: 12 | 13 | ``` 14 | make all 15 | ``` 16 | 17 | The current version supports two arguments: 18 | - openvasDir - Location of the openvas-nasl-lint executable, has to be absolute or relative to test files directory. If `openvas-nasl-lint` is located within `$PATH` It can be left empty 19 | - testFiles - Folder containing the nasl test files. -------------------------------------------------------------------------------- /smoketest_lint/go.mod: -------------------------------------------------------------------------------- 1 | module github.com/greenbone/openvas-scanner/smoketest_lint 2 | 3 | go 1.16 4 | -------------------------------------------------------------------------------- /smoketest_lint/test/testcase.go: -------------------------------------------------------------------------------- 1 | // SPDX-FileCopyrightText: 2023 Greenbone AG 2 | // 3 | // SPDX-License-Identifier: GPL-2.0-or-later 4 | 5 | package test 6 | 7 | import "fmt" 8 | 9 | type testCase struct { 10 | msg string 11 | line int 12 | tested bool 13 | } 14 | 15 | type testError struct { 16 | line int 17 | expected string 18 | occurred string 19 | } 20 | 21 | func (t testError) Error() string { 22 | return fmt.Sprintf("line %d:\nexpected: %s\noccurred: %s", t.line, t.expected, t.occurred) 23 | } 24 | 25 | func (t1 *testCase) test(t2 *testCase) error { 26 | if t1.line != t2.line { 27 | return nil 28 | } 29 | t1.tested = true 30 | t2.tested = true 31 | if t1.msg != t2.msg { 32 | return testError{ 33 | t1.line, 34 | t1.msg, 35 | t2.msg, 36 | } 37 | } 38 | return nil 39 | } 40 | -------------------------------------------------------------------------------- /smoketest_lint/test/testtype.go: -------------------------------------------------------------------------------- 1 | // SPDX-FileCopyrightText: 2023 Greenbone AG 2 | // 3 | // SPDX-License-Identifier: GPL-2.0-or-later 4 | 5 | package test 6 | 7 | import ( 8 | "fmt" 9 | "regexp" 10 | ) 11 | 12 | type parse func(string) string 13 | 14 | func undeclared(line string) string { 15 | match := regexp.MustCompile(`^#!undeclared:(.*)$`).FindAllStringSubmatch(line, -1) 16 | 17 | if len(match) != 1 { 18 | return "" 19 | } 20 | if len(match[0]) != 2 { 21 | return "" 22 | } 23 | 24 | return fmt.Sprintf("The variable %s was not declared", match[0][1]) 25 | } 26 | 27 | var testCaseTypes []parse 28 | 29 | func init() { 30 | testCaseTypes = make([]parse, 0) 31 | testCaseTypes = append(testCaseTypes, undeclared) 32 | } 33 | -------------------------------------------------------------------------------- /src/attack.h: -------------------------------------------------------------------------------- 1 | /* SPDX-FileCopyrightText: 2023 Greenbone AG 2 | * SPDX-FileCopyrightText: 2006 Software in the Public Interest, Inc. 3 | * SPDX-FileCopyrightText: 1998-2006 Tenable Network Security, Inc. 4 | * 5 | * SPDX-License-Identifier: GPL-2.0-only 6 | */ 7 | 8 | /** 9 | * @file attack.h 10 | * @brief attack.c header. 11 | */ 12 | 13 | #ifndef OPENVAS_ATTACK_H 14 | #define OPENVAS_ATTACK_H 15 | 16 | #include "../misc/scanneraux.h" 17 | 18 | #include 19 | 20 | int 21 | attack_network (struct scan_globals *); 22 | 23 | #endif 24 | -------------------------------------------------------------------------------- /src/debug_utils.h: -------------------------------------------------------------------------------- 1 | /* SPDX-FileCopyrightText: 2023 Greenbone AG 2 | * 3 | * SPDX-License-Identifier: GPL-2.0-or-later 4 | */ 5 | 6 | /** 7 | * @file debug_utils.h 8 | * @brief debug_utils.c headerfile. 9 | */ 10 | 11 | #ifndef OPENVAS_DEBUG_UTILS_H 12 | #define OPENVAS_DEBUG_UTILS_H 13 | 14 | #include /* for gvm_sentry_init */ 15 | 16 | int 17 | init_sentry (void); 18 | 19 | #endif 20 | -------------------------------------------------------------------------------- /src/hosts.h: -------------------------------------------------------------------------------- 1 | /* SPDX-FileCopyrightText: 2023 Greenbone AG 2 | * SPDX-FileCopyrightText: 2006 Software in the Public Interest, Inc. 3 | * SPDX-FileCopyrightText: 1998-2006 Tenable Network Security, Inc. 4 | * 5 | * SPDX-License-Identifier: GPL-2.0-only 6 | */ 7 | 8 | /** 9 | * @file hosts.h 10 | * @brief hosts.c header. 11 | */ 12 | 13 | #ifndef OPENVAS_HOSTS_H 14 | #define OPENVAS_HOSTS_H 15 | 16 | #include "../misc/scanneraux.h" 17 | 18 | #include /* for gvm_host_t */ 19 | 20 | int 21 | hosts_init (int); 22 | 23 | int 24 | hosts_new (char *, kb_t, kb_t); 25 | 26 | int 27 | hosts_set_pid (char *, pid_t); 28 | 29 | int 30 | hosts_read (void); 31 | 32 | void 33 | hosts_stop_all (void); 34 | 35 | void 36 | host_set_time (kb_t, char *, char *); 37 | 38 | int 39 | host_is_currently_scanned (gvm_host_t *); 40 | 41 | #endif 42 | -------------------------------------------------------------------------------- /src/main.c: -------------------------------------------------------------------------------- 1 | /* SPDX-FileCopyrightText: 2023 Greenbone AG 2 | * 3 | * SPDX-License-Identifier: GPL-2.0-or-later 4 | */ 5 | 6 | /** 7 | * @file main.c 8 | * @brief Main function of openvas. 9 | * 10 | * This file separates out the "main" function of openvas. 11 | */ 12 | 13 | #include "openvas.h" 14 | 15 | /** 16 | * @brief Main function. 17 | * 18 | * @param[in] argc The number of arguments in argv. 19 | * @param[in] argv The list of arguments to the program. 20 | * 21 | * @return EXIT_SUCCESS on success, EXIT_FAILURE on failure. 22 | */ 23 | int 24 | main (int argc, char **argv, char *env[]) 25 | { 26 | return openvas (argc, argv, env); 27 | } 28 | -------------------------------------------------------------------------------- /src/openvas.h: -------------------------------------------------------------------------------- 1 | /* SPDX-FileCopyrightText: 2023 Greenbone AG 2 | * 3 | * SPDX-License-Identifier: GPL-2.0-or-later 4 | */ 5 | 6 | /* 7 | * @file openvas.h 8 | * @brief Headers for OpenVAS entry point. 9 | */ 10 | 11 | #ifndef OPENVAS_H 12 | #define OPENVAS_H 13 | 14 | int 15 | openvas (int, char **, char **); 16 | 17 | #endif /* not OPENVAS_H */ 18 | -------------------------------------------------------------------------------- /src/plugs_req.h: -------------------------------------------------------------------------------- 1 | /* SPDX-FileCopyrightText: 2023 Greenbone AG 2 | * SPDX-FileCopyrightText: 2006 Software in the Public Interest, Inc. 3 | * SPDX-FileCopyrightText: 1998-2006 Tenable Network Security, Inc. 4 | * 5 | * SPDX-License-Identifier: GPL-2.0-only 6 | */ 7 | 8 | /** 9 | * @file plugs_req.h 10 | * @brief plugs_req.c header. 11 | */ 12 | 13 | #ifndef OPENVAS_PLUGS_REQ_H 14 | #define OPENVAS_PLUGS_REQ_H 15 | 16 | #include /* for struct kb_item */ 17 | 18 | char * 19 | requirements_plugin (kb_t, nvti_t *); 20 | 21 | int 22 | mandatory_requirements_met (kb_t, nvti_t *); 23 | 24 | #endif 25 | -------------------------------------------------------------------------------- /src/sighand.h: -------------------------------------------------------------------------------- 1 | /* SPDX-FileCopyrightText: 2023 Greenbone AG 2 | * SPDX-FileCopyrightText: 2006 Software in the Public Interest, Inc. 3 | * SPDX-FileCopyrightText: 1998-2006 Tenable Network Security, Inc. 4 | * 5 | * SPDX-License-Identifier: GPL-2.0-only 6 | */ 7 | 8 | /** 9 | * @file sighand.h 10 | * @brief headerfile for sighand.c. 11 | */ 12 | 13 | #ifndef OPENVAS_SIGHAND_H 14 | #define OPENVAS_SIGHAND_H 15 | 16 | void (*openvas_signal (int signum, void (*handler) (int))) (int); 17 | void 18 | 19 | sighand_chld (int sig); 20 | 21 | void 22 | sighand_segv (int sig); 23 | 24 | void 25 | let_em_die (int pid); 26 | void 27 | make_em_die (int sig); 28 | #endif 29 | --------------------------------------------------------------------------------