OpenVAS Scanner
7.0.1~git
|
Header file for module plugutils. More...
Go to the source code of this file.
Macros | |
#define | ARG_STRING 1 |
#define | ARG_INT 2 |
#define | post_alarm_tcp post_alarm |
#define | post_error_tcp post_error |
#define | post_log_tcp post_log |
Functions | |
void | scanner_add_port (struct script_infos *, int, char *) |
void | plug_set_dep (struct script_infos *, const char *) |
void | plug_set_ssl_cert (struct script_infos *, char *) |
void | plug_set_ssl_key (struct script_infos *, char *) |
void | plug_set_ssl_pem_password (struct script_infos *, char *) |
void | plug_set_ssl_CA_file (struct script_infos *, char *) |
const char * | plug_current_vhost (void) |
char * | plug_get_host_fqdn (struct script_infos *) |
int | plug_add_host_fqdn (struct script_infos *, const char *, const char *) |
GSList * | plug_get_host_fqdn_list (struct script_infos *) |
char * | plug_get_host_source (struct script_infos *, const char *) |
unsigned int | plug_get_host_open_port (struct script_infos *desc) |
void | plug_set_port_transport (struct script_infos *, int, int) |
int | plug_get_port_transport (struct script_infos *, int) |
struct script_infos * | plug_create_from_nvti_and_prefs (const nvti_t *) |
void | proto_post_alarm (const char *, struct script_infos *, int, const char *, const char *) |
void | post_alarm (const char *, struct script_infos *, int, const char *) |
void | post_alarm_udp (struct script_infos *, int, const char *) |
void | proto_post_error (const char *, struct script_infos *, int, const char *, const char *) |
void | post_error (const char *, struct script_infos *, int, const char *) |
void | proto_post_log (const char *, struct script_infos *, int, const char *, const char *) |
Post a log message. More... | |
void | post_log (const char *, struct script_infos *, int, const char *) |
Post a log message about a tcp port. More... | |
int | host_get_port_state (struct script_infos *, int) |
int | host_get_port_state_udp (struct script_infos *, int) |
void | plug_set_key (struct script_infos *, char *, int, const void *) |
void | plug_set_key_len (struct script_infos *, char *, int, const void *, size_t) |
void | plug_replace_key (struct script_infos *, char *, int, void *) |
void | plug_replace_key_len (struct script_infos *, char *, int, void *, size_t) |
kb_t | plug_get_kb (struct script_infos *) |
void * | plug_get_key (struct script_infos *, char *, int *, size_t *, int) |
Get values from a kb under the given key name. More... | |
struct in6_addr * | plug_get_host_ip (struct script_infos *) |
char * | plug_get_host_ip_str (struct script_infos *) |
char * | get_plugin_preference (const char *, const char *, int) |
Get the a plugins preference. More... | |
const char * | get_plugin_preference_fname (struct script_infos *, const char *) |
Get the file name of a plugins preference that is of type "file". More... | |
char * | get_plugin_preference_file_content (struct script_infos *, const char *) |
Get the file contents of a plugins preference that is of type "file". More... | |
long | get_plugin_preference_file_size (struct script_infos *, const char *) |
Get the file size of a plugins preference that is of type "file". More... | |
Header file for module plugutils.
Definition in file plugutils.h.
#define ARG_INT 2 |
Definition at line 34 of file plugutils.h.
#define ARG_STRING 1 |
Definition at line 33 of file plugutils.h.
#define post_alarm_tcp post_alarm |
Definition at line 99 of file plugutils.h.
#define post_error_tcp post_error |
Definition at line 107 of file plugutils.h.
#define post_log_tcp post_log |
Definition at line 115 of file plugutils.h.
char* get_plugin_preference | ( | const char * | oid, |
const char * | name, | ||
int | pref_id | ||
) |
Get the a plugins preference.
Search in the preferences set by the client. If it is not present, search in redis cache for the default.
[in] | oid | Script OID to get the preference from |
[in] | name | Name of the preference to get |
[in] | pref_id | Id of the preferences to get |
Definition at line 408 of file plugutils.c.
References name, oid, and prefix().
Referenced by _http_req(), add_scantype_arguments(), add_timing_arguments(), build_cmd_line(), nmap_create(), plugin_do_run(), plugin_run_find_service(), script_get_preference(), script_get_preference_file_content(), and script_get_preference_file_location().
char* get_plugin_preference_file_content | ( | struct script_infos * | desc, |
const char * | identifier | ||
) |
Get the file contents of a plugins preference that is of type "file".
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 here.
identifier | Identifier that was supplied by the client when the file was uploaded. |
identifier
, NULL if not found or setup broken. Definition at line 541 of file plugutils.c.
References scan_globals::files_translation, and script_infos::globals.
Referenced by get_plugin_preference_fname(), and script_get_preference_file_content().
long get_plugin_preference_file_size | ( | struct script_infos * | desc, |
const char * | identifier | ||
) |
Get the file size of a plugins preference that is of type "file".
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 size of the file is stored in a separate hash table with the same identifier as key, which can be looked up here.
identifier | Identifier that was supplied by the client when the file was uploaded. |
identifier
, -1 if not found or setup broken. Definition at line 572 of file plugutils.c.
References scan_globals::files_size_translation, and script_infos::globals.
Referenced by get_plugin_preference_fname(), and script_get_preference_file_content().
const char* get_plugin_preference_fname | ( | struct script_infos * | desc, |
const char * | filename | ||
) |
Get the file name of a plugins preference that is of type "file".
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 hashtable.
filename
, NULL if not found or setup broken. Definition at line 486 of file plugutils.c.
References get_plugin_preference_file_content(), and get_plugin_preference_file_size().
Referenced by nmap_create(), plugin_run_find_service(), and script_get_preference_file_location().
int host_get_port_state | ( | struct script_infos * | , |
int | |||
) |
Definition at line 154 of file plugutils.c.
References host_get_port_state_proto().
Referenced by get_port_state(), and open_sock_tcp().
int host_get_port_state_udp | ( | struct script_infos * | , |
int | |||
) |
Definition at line 160 of file plugutils.c.
References host_get_port_state_proto().
Referenced by get_udp_port_state().
int plug_add_host_fqdn | ( | struct script_infos * | , |
const char * | , | ||
const char * | |||
) |
Definition at line 166 of file plugutils.c.
References hostname, and script_infos::vhosts.
Referenced by add_hostname().
struct script_infos* plug_create_from_nvti_and_prefs | ( | const nvti_t * | ) |
const char* plug_current_vhost | ( | void | ) |
Definition at line 57 of file plugutils.c.
References current_vhost.
Referenced by open_sock_tcp().
char* plug_get_host_fqdn | ( | struct script_infos * | ) |
Definition at line 211 of file plugutils.c.
References current_vhost, script_infos::ip, script_infos::key, pid, plug_fork_child(), and script_infos::vhosts.
Referenced by _http_req(), get_hostname(), open_stream_connection_ext(), plug_get_host_source(), plugin_do_run(), and socket_negotiate_ssl().
GSList* plug_get_host_fqdn_list | ( | struct script_infos * | ) |
Definition at line 239 of file plugutils.c.
References script_infos::ip, and script_infos::vhosts.
Referenced by get_hostnames().
struct in6_addr* plug_get_host_ip | ( | struct script_infos * | ) |
Definition at line 285 of file plugutils.c.
References script_infos::ip.
Referenced by forge_ip_packet(), forge_ipv6_packet(), get_host_ip(), nasl_islocalhost(), nasl_islocalnet(), nasl_open_privileged_socket(), nasl_open_sock_udp(), nasl_pcap_next(), nasl_send_capture(), nasl_send_packet(), nasl_send_v6packet(), nasl_smb_connect(), nasl_ssh_connect(), nasl_target_is_ipv6(), nasl_tcp_ping(), nasl_tcp_v6_ping(), nasl_this_host(), nasl_win_cmd_exec(), nasl_wmi_connect(), nasl_wmi_connect_reg(), nasl_wmi_connect_rsop(), open_sock_option(), plug_get_host_ip_str(), plugin_run_synscan(), and proto_post_wrapped().
char* plug_get_host_ip_str | ( | struct script_infos * | ) |
Definition at line 291 of file plugutils.c.
References plug_get_host_ip().
Referenced by open_sock_tcp().
unsigned int plug_get_host_open_port | ( | struct script_infos * | desc | ) |
Don't always return the first open port, otherwise we 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...
Definition at line 817 of file plugutils.c.
References MAX_CANDIDATES, and plug_get_kb().
Referenced by get_host_open_port(), nasl_start_denial(), nasl_tcp_ping(), and nasl_tcp_v6_ping().
char* plug_get_host_source | ( | struct script_infos * | , |
const char * | |||
) |
Definition at line 257 of file plugutils.c.
References current_vhost, hostname, plug_get_host_fqdn(), and script_infos::vhosts.
Referenced by get_hostname_source().
kb_t plug_get_kb | ( | struct script_infos * | ) |
Definition at line 658 of file plugutils.c.
References script_infos::key.
Referenced by _http_req(), exec_nasl_script(), get_kb_list(), get_script_args(), get_script_list(), nasl_ssh_set_login(), nasl_ssh_userauth(), open_sock_tcp(), open_stream_connection_ext(), plug_get_host_open_port(), plug_get_port_transport(), plug_replace_key_len(), plug_set_key_len(), plugin_run_find_service(), proto_post_wrapped(), and socket_negotiate_ssl().
void* plug_get_key | ( | struct script_infos * | args, |
char * | name, | ||
int * | type, | ||
size_t * | len, | ||
int | single | ||
) |
Get values from a kb under the given key name.
[in] | args | The script infos where to get the kb from. |
[in] | name | Key name to search in the kb. |
[in/out] | type If 1 is given, the answer is forced to be KB_TYPE_INT type. Otherwise it returns the fetched type. | |
[in] | len | Desired string length to be returned. |
[in] | single | In case of a list, fetch only the last element |
Definition at line 730 of file plugutils.c.
References script_infos::key, name, pid, plug_fork_child(), plug_get_key_sigchld(), and sig_chld().
Referenced by banner_grab(), get_kb_item(), get_ssh_port(), nasl_open_sock_kdc(), and plugin_do_run().
int plug_get_port_transport | ( | struct script_infos * | , |
int | |||
) |
Definition at line 885 of file plugutils.c.
References OPENVAS_ENCAPS_IP, and plug_get_kb().
Referenced by get_port_transport(), and open_stream_auto_encaps_ext().
void plug_replace_key | ( | struct script_infos * | , |
char * | , | ||
int | , | ||
void * | |||
) |
Definition at line 646 of file plugutils.c.
References name, and plug_replace_key_len().
Referenced by mark_acap_server(), mark_adsgone(), mark_exchg_routing_server(), mark_ftp_server(), mark_fw1(), mark_http_server(), mark_imap_server(), mark_linuxconf(), mark_locked_adsubtract_server(), mark_mon_server(), mark_ncacn_http_server(), mark_nntp_server(), mark_pop3pw_server(), mark_pop_server(), mark_psybnc(), mark_rmserver(), mark_shoutcast_server(), mark_smtp_server(), mark_snpp_server(), mark_unknown_svc(), mark_uucp_server(), mark_vnc_server(), mark_vtun_server(), mark_whois_plus2_server(), mark_zebra_server(), plugin_do_run(), register_service(), and replace_kb_item().
void plug_replace_key_len | ( | struct script_infos * | , |
char * | , | ||
int | , | ||
void * | , | ||
size_t | |||
) |
Definition at line 623 of file plugutils.c.
References ARG_INT, ARG_STRING, global_nasl_debug, name, and plug_get_kb().
Referenced by plug_replace_key(), and replace_kb_item().
void plug_set_dep | ( | struct script_infos * | , |
const char * | |||
) |
Definition at line 65 of file plugutils.c.
References script_infos::nvti.
Referenced by script_dependencies().
void plug_set_key | ( | struct script_infos * | , |
char * | , | ||
int | , | ||
const void * | |||
) |
Definition at line 616 of file plugutils.c.
References name, and plug_set_key_len().
Referenced by banner_grab(), host_add_port_proto(), mark_unknown_svc(), mark_wrapped_svc(), plug_set_port_transport(), plug_set_ssl_item(), plugin_do_run(), plugin_run_openvas_tcp_scanner(), plugin_run_synscan(), register_service(), save_detected_os(), save_host_state(), save_hostscripts(), save_ipidseq_details(), save_open_ports(), save_portscripts(), save_tcpseq_details(), save_traceroute_details(), scan(), set_kb_item(), and simple_register_host_detail().
void plug_set_key_len | ( | struct script_infos * | , |
char * | , | ||
int | , | ||
const void * | , | ||
size_t | |||
) |
Definition at line 594 of file plugutils.c.
References ARG_INT, ARG_STRING, global_nasl_debug, name, and plug_get_kb().
Referenced by plug_set_key(), and set_kb_item().
void plug_set_port_transport | ( | struct script_infos * | args, |
int | port, | ||
int | tr | ||
) |
Definition at line 872 of file plugutils.c.
References ARG_INT, and plug_set_key().
Referenced by open_stream_auto_encaps_ext(), and plugin_do_run().
void plug_set_ssl_CA_file | ( | struct script_infos * | args, |
char * | key | ||
) |
Definition at line 931 of file plugutils.c.
References plug_set_ssl_item().
Referenced by plugin_run_find_service().
void plug_set_ssl_cert | ( | struct script_infos * | , |
char * | |||
) |
Definition at line 909 of file plugutils.c.
References plug_set_ssl_item().
Referenced by plugin_run_find_service().
void plug_set_ssl_key | ( | struct script_infos * | , |
char * | |||
) |
Definition at line 915 of file plugutils.c.
References plug_set_ssl_item().
Referenced by plugin_run_find_service().
void plug_set_ssl_pem_password | ( | struct script_infos * | , |
char * | |||
) |
Definition at line 921 of file plugutils.c.
References plug_set_ssl_item().
Referenced by plugin_run_find_service().
void post_alarm | ( | const char * | , |
struct script_infos * | , | ||
int | , | ||
const char * | |||
) |
Definition at line 355 of file plugutils.c.
References oid, and proto_post_alarm().
Referenced by mark_fssniffer(), mark_netbus_server(), mark_sub7_server(), mark_wild_shell(), and security_message().
void post_alarm_udp | ( | struct script_infos * | , |
int | , | ||
const char * | |||
) |
void post_error | ( | const char * | , |
struct script_infos * | , | ||
int | , | ||
const char * | |||
) |
Definition at line 389 of file plugutils.c.
References oid, and proto_post_error().
Referenced by error_message().
void post_log | ( | const char * | , |
struct script_infos * | , | ||
int | , | ||
const char * | |||
) |
Post a log message about a tcp port.
Definition at line 375 of file plugutils.c.
References oid, and proto_post_log().
Referenced by log_message(), mark_acap_server(), mark_adsgone(), mark_auth_server(), mark_avotus_mm_server(), mark_BitTorrent_server(), mark_chargen_server(), mark_citrix_server(), mark_cvslockserver(), mark_cvspserver(), mark_cvsupserver(), mark_dameware_server(), mark_dictd_server(), mark_direct_connect_hub(), mark_echo_server(), mark_eggdrop_server(), mark_ens_server(), mark_exchg_routing_server(), mark_finger_server(), mark_ftp_server(), mark_fw1(), mark_giop_server(), mark_gnocatan_server(), mark_gnome14_server(), mark_gnuserv(), mark_gopher_server(), mark_http_proxy(), mark_http_server(), mark_imap_server(), mark_interscan_viruswall(), mark_ircxpro_admin_server(), mark_iss_realsecure(), mark_jabber_server(), mark_linuxconf(), mark_LISa_server(), mark_listserv_server(), mark_locked_adsubtract_server(), mark_lpd_server(), mark_lyskom_server(), mark_mldonkey(), mark_mon_server(), mark_msdtc_server(), mark_mysql(), mark_nagiosd_server(), mark_nntp_server(), mark_ofa_express_server(), mark_pblocald_server(), mark_pbmaster_server(), mark_ph_server(), mark_pnsclient(), mark_pop3pw_server(), mark_pop_server(), mark_postgresql(), mark_ppp_daemon(), mark_psybnc(), mark_quicktime_streaming_server(), mark_remote_nc_server(), mark_rmserver(), mark_rsync(), mark_shoutcast_server(), mark_smppd_server(), mark_smtp_server(), mark_smux_server(), mark_snpp_server(), mark_socks_proxy(), mark_spamd_server(), mark_sphinxql(), mark_ssh_server(), mark_stonegate_auth_server(), mark_tcpmux_server(), mark_teamspeak2_server(), mark_telnet_server(), mark_time_server(), mark_unknown_svc(), mark_upsmon_server(), mark_uucp_server(), mark_veritas_backup(), mark_vmware_auth(), mark_vtun_server(), mark_websm_server(), mark_whois_plus2_server(), mark_wrapped_svc(), mark_zebra_server(), and plugin_do_run().
void proto_post_alarm | ( | const char * | , |
struct script_infos * | , | ||
int | , | ||
const char * | , | ||
const char * | |||
) |
Definition at line 348 of file plugutils.c.
References oid, and proto_post_wrapped().
Referenced by post_alarm(), and security_message().
void proto_post_error | ( | const char * | , |
struct script_infos * | , | ||
int | , | ||
const char * | , | ||
const char * | |||
) |
Definition at line 382 of file plugutils.c.
References oid, and proto_post_wrapped().
Referenced by error_message(), and post_error().
void proto_post_log | ( | const char * | , |
struct script_infos * | , | ||
int | , | ||
const char * | , | ||
const char * | |||
) |
Post a log message.
Definition at line 365 of file plugutils.c.
References oid, and proto_post_wrapped().
Referenced by log_message(), and post_log().
void scanner_add_port | ( | struct script_infos * | , |
int | , | ||
char * | |||
) |
Definition at line 652 of file plugutils.c.
References host_add_port_proto().
Referenced by banner_grab(), nasl_scanner_add_port(), sendpacket(), and v6_sendpacket().