OpenVAS Scanner 21.4.1
Macros | Functions | Variables
nasl_builtin_find_service.c File Reference
#include "../misc/network.h"
#include "../misc/plugutils.h"
#include "nasl_lex_ctxt.h"
#include <ctype.h>
#include <errno.h>
#include <glib.h>
#include <gvm/util/nvticache.h>
#include <regex.h>
#include <signal.h>
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <sys/time.h>
#include <sys/types.h>
#include <sys/wait.h>
#include <unistd.h>

Macros

#define SMART_TCP_RW
 
#define CERT_FILE   "SSL certificate : "
 
#define KEY_FILE   "SSL private key : "
 
#define PEM_PASS   "PEM password : "
 
#define CA_FILE   "CA file : "
 
#define CNX_TIMEOUT_PREF   "Network connection timeout : "
 
#define RW_TIMEOUT_PREF   "Network read/write timeout : "
 
#define WRAP_TIMEOUT_PREF   "Wrapped service read timeout : "
 
#define TEST_SSL_PREF   "Test SSL based services"
 
#define NUM_CHILDREN   "Number of connections done in parallel : "
 
#define G_LOG_DOMAIN   "lib nasl"
 GLib logging domain. More...
 
#define MAX_SHIFT   (3 * 365 * 86400)
 
#define DIFF_1970_1900   2208988800U
 
#define ABS(x)   (((x) < 0) ? -(x) : (x))
 
#define DIFFTV1000(t1, t2)    ((t1.tv_sec - t2.tv_sec) * 1000 + (t1.tv_usec - t2.tv_usec) / 1000)
 
#define TESTSTRING   "OpenVAS Wrap Test"
 
#define MAX_SONS   128
 

Functions

static void register_service (struct script_infos *desc, int port, const char *proto)
 
static int regex_match (char *string, char *pattern)
 Compares string with the regular expression. Null characters in buffer are replaced by 'x'. More...
 
static void mark_chargen_server (struct script_infos *desc, int port)
 
void mark_echo_server (struct script_infos *desc, int port)
 
void mark_ncacn_http_server (struct script_infos *desc, int port, char *buffer)
 
void mark_vnc_server (struct script_infos *desc, int port, char *buffer)
 
void mark_nntp_server (struct script_infos *desc, int port, char *buffer, int trp)
 
void mark_swat_server (struct script_infos *desc, int port)
 
void mark_vqserver (struct script_infos *desc, int port)
 
void mark_mldonkey (struct script_infos *desc, int port)
 
void mark_http_server (struct script_infos *desc, int port, unsigned char *buffer, int trp)
 
void mark_locked_adsubtract_server (struct script_infos *desc, int port, unsigned char *buffer, int trp)
 
static void mark_gopher_server (struct script_infos *desc, int port)
 
void mark_rmserver (struct script_infos *desc, int port, char *buffer, int trp)
 
void mark_smtp_server (struct script_infos *desc, int port, char *buffer, int trp)
 
void mark_snpp_server (struct script_infos *desc, int port, char *buffer, int trp)
 
void mark_ftp_server (struct script_infos *desc, int port, char *buffer, int trp)
 
void mark_ssh_server (struct script_infos *desc, int port, char *buffer)
 
void mark_http_proxy (struct script_infos *desc, int port, int trp)
 
void mark_pop_server (struct script_infos *desc, int port, char *buffer)
 
void mark_imap_server (struct script_infos *desc, int port, char *buffer, int trp)
 
void mark_auth_server (struct script_infos *desc, int port)
 
void mark_postgresql (struct script_infos *desc, int port)
 
void mark_sphinxql (struct script_infos *desc, int port)
 
void mark_mysql (struct script_infos *desc, int port)
 
void mark_cvspserver (struct script_infos *desc, int port)
 
void mark_cvsupserver (struct script_infos *desc, int port)
 
void mark_cvslockserver (struct script_infos *desc, int port)
 
void mark_rsync (struct script_infos *desc, int port)
 
void mark_wild_shell (struct script_infos *desc, int port)
 
void mark_telnet_server (struct script_infos *desc, int port, int trp)
 
void mark_gnome14_server (struct script_infos *desc, int port, int trp)
 
void mark_eggdrop_server (struct script_infos *desc, int port, int trp)
 
void mark_netbus_server (struct script_infos *desc, int port)
 
void mark_linuxconf (struct script_infos *desc, int port, unsigned char *buffer)
 
static void mark_finger_server (struct script_infos *desc, int port, int trp)
 
static void mark_vtun_server (struct script_infos *desc, int port, unsigned char *banner, int trp)
 
static void mark_uucp_server (struct script_infos *desc, int port, unsigned char *banner, int trp)
 
static void mark_lpd_server (struct script_infos *desc, int port, int trp)
 
static void mark_lyskom_server (struct script_infos *desc, int port, int trp)
 
static void mark_ph_server (struct script_infos *desc, int port, int trp)
 
static void mark_time_server (struct script_infos *desc, int port, int trp)
 
static void mark_ens_server (struct script_infos *desc, int port, int trp)
 
static void mark_citrix_server (struct script_infos *desc, int port, int trp)
 
static void mark_giop_server (struct script_infos *desc, int port, int trp)
 
static void mark_exchg_routing_server (struct script_infos *desc, int port, char *buffer, int trp)
 
static void mark_tcpmux_server (struct script_infos *desc, int port, int trp)
 
static void mark_BitTorrent_server (struct script_infos *desc, int port, int trp)
 
static void mark_smux_server (struct script_infos *desc, int port, int trp)
 
static void mark_LISa_server (struct script_infos *desc, int port, int trp)
 
static void mark_msdtc_server (struct script_infos *desc, int port)
 
static void mark_pop3pw_server (struct script_infos *desc, int port, char *buffer, int trp)
 
static void mark_whois_plus2_server (struct script_infos *desc, int port, char *buffer, int trp)
 
static void mark_mon_server (struct script_infos *desc, int port, char *buffer, int trp)
 
static void mark_fw1 (struct script_infos *desc, int port, char *buffer, int trp)
 
static void mark_psybnc (struct script_infos *desc, int port, char *buffer, int trp)
 
static void mark_shoutcast_server (struct script_infos *desc, int port, char *buffer, int trp)
 
static void mark_adsgone (struct script_infos *desc, int port, char *buffer, int trp)
 
static void mark_acap_server (struct script_infos *desc, int port, char *buffer, int trp)
 
static void mark_nagiosd_server (struct script_infos *desc, int port, int trp)
 
static void mark_teamspeak2_server (struct script_infos *desc, int port, int trp)
 
static void mark_websm_server (struct script_infos *desc, int port, int trp)
 
static void mark_ofa_express_server (struct script_infos *desc, int port, int trp)
 
static void mark_smppd_server (struct script_infos *desc, int port, int trp)
 
static void mark_upsmon_server (struct script_infos *desc, int port, int trp)
 
static void mark_sub7_server (struct script_infos *desc, int port, int trp)
 
static void mark_spamd_server (struct script_infos *desc, int port, int trp)
 
static void mark_quicktime_streaming_server (struct script_infos *desc, int port, int trp)
 
static void mark_dameware_server (struct script_infos *desc, int port, int trp)
 
static void mark_stonegate_auth_server (struct script_infos *desc, int port, int trp)
 
void mark_listserv_server (struct script_infos *desc, int port, int trp)
 
void mark_fssniffer (struct script_infos *desc, int port, int trp)
 
void mark_remote_nc_server (struct script_infos *desc, int port, int trp)
 
static void mark_wrapped_svc (struct script_infos *desc, int port, int delta)
 
static const char * port_to_name (int port)
 
static void mark_unknown_svc (struct script_infos *desc, int port, const unsigned char *banner, int trp)
 
static void mark_gnuserv (struct script_infos *desc, int port)
 
static void mark_iss_realsecure (struct script_infos *desc, int port)
 
static void mark_vmware_auth (struct script_infos *desc, int port, char *buffer, int trp)
 
static void mark_interscan_viruswall (struct script_infos *desc, int port, char *buffer, int trp)
 
static void mark_ppp_daemon (struct script_infos *desc, int port, int trp)
 
static void mark_zebra_server (struct script_infos *desc, int port, char *buffer, int trp)
 
static void mark_ircxpro_admin_server (struct script_infos *desc, int port, int trp)
 
static void mark_gnocatan_server (struct script_infos *desc, int port, int trp)
 
static void mark_pbmaster_server (struct script_infos *desc, int port, char *buffer, int trp)
 
static void mark_dictd_server (struct script_infos *desc, int port, char *buffer, int trp)
 
static void mark_pnsclient (struct script_infos *desc, int port, int trp)
 
static void mark_veritas_backup (struct script_infos *desc, int port, int trp)
 
static void mark_pblocald_server (struct script_infos *desc, int port, char *buffer, int trp)
 
static void mark_jabber_server (struct script_infos *desc, int port, int trp)
 
static void mark_avotus_mm_server (struct script_infos *desc, int port, char *buffer, int trp)
 
static void mark_socks_proxy (struct script_infos *desc, int port, int ver)
 
static void mark_direct_connect_hub (struct script_infos *desc, int port, int trp)
 
static void mark_mongodb (struct script_infos *desc, int port)
 
static int may_be_time (time_t *rtime)
 
static int plugin_do_run (struct script_infos *desc, GSList *h, int test_ssl)
 
static void sigterm (int s)
 
static void sigchld (int s)
 
tree_cellplugin_run_find_service (lex_ctxt *lexic)
 

Variables

const char * oid
 
static pid_t sons [MAX_SONS]
 

Macro Definition Documentation

◆ ABS

#define ABS (   x)    (((x) < 0) ? -(x) : (x))

◆ CA_FILE

#define CA_FILE   "CA file : "

◆ CERT_FILE

#define CERT_FILE   "SSL certificate : "

◆ CNX_TIMEOUT_PREF

#define CNX_TIMEOUT_PREF   "Network connection timeout : "

◆ DIFF_1970_1900

#define DIFF_1970_1900   2208988800U

◆ DIFFTV1000

#define DIFFTV1000 (   t1,
  t2 
)     ((t1.tv_sec - t2.tv_sec) * 1000 + (t1.tv_usec - t2.tv_usec) / 1000)

◆ G_LOG_DOMAIN

#define G_LOG_DOMAIN   "lib nasl"

GLib logging domain.

◆ KEY_FILE

#define KEY_FILE   "SSL private key : "

◆ MAX_SHIFT

#define MAX_SHIFT   (3 * 365 * 86400)

◆ MAX_SONS

#define MAX_SONS   128

◆ NUM_CHILDREN

#define NUM_CHILDREN   "Number of connections done in parallel : "

◆ PEM_PASS

#define PEM_PASS   "PEM password : "

◆ RW_TIMEOUT_PREF

#define RW_TIMEOUT_PREF   "Network read/write timeout : "

◆ SMART_TCP_RW

#define SMART_TCP_RW

◆ TEST_SSL_PREF

#define TEST_SSL_PREF   "Test SSL based services"

◆ TESTSTRING

#define TESTSTRING   "OpenVAS Wrap Test"

◆ WRAP_TIMEOUT_PREF

#define WRAP_TIMEOUT_PREF   "Wrapped service read timeout : "

Function Documentation

◆ mark_acap_server()

static void mark_acap_server ( struct script_infos desc,
int  port,
char *  buffer,
int  trp 
)
static

◆ mark_adsgone()

static void mark_adsgone ( struct script_infos desc,
int  port,
char *  buffer,
int  trp 
)
static

◆ mark_auth_server()

void mark_auth_server ( struct script_infos desc,
int  port 
)

◆ mark_avotus_mm_server()

static void mark_avotus_mm_server ( struct script_infos desc,
int  port,
char *  buffer,
int  trp 
)
static

◆ mark_BitTorrent_server()

static void mark_BitTorrent_server ( struct script_infos desc,
int  port,
int  trp 
)
static

◆ mark_chargen_server()

static void mark_chargen_server ( struct script_infos desc,
int  port 
)
static

◆ mark_citrix_server()

static void mark_citrix_server ( struct script_infos desc,
int  port,
int  trp 
)
static

◆ mark_cvslockserver()

void mark_cvslockserver ( struct script_infos desc,
int  port 
)

◆ mark_cvspserver()

void mark_cvspserver ( struct script_infos desc,
int  port 
)

◆ mark_cvsupserver()

void mark_cvsupserver ( struct script_infos desc,
int  port 
)

◆ mark_dameware_server()

static void mark_dameware_server ( struct script_infos desc,
int  port,
int  trp 
)
static

◆ mark_dictd_server()

static void mark_dictd_server ( struct script_infos desc,
int  port,
char *  buffer,
int  trp 
)
static

◆ mark_direct_connect_hub()

static void mark_direct_connect_hub ( struct script_infos desc,
int  port,
int  trp 
)
static

◆ mark_echo_server()

void mark_echo_server ( struct script_infos desc,
int  port 
)

◆ mark_eggdrop_server()

void mark_eggdrop_server ( struct script_infos desc,
int  port,
int  trp 
)

◆ mark_ens_server()

static void mark_ens_server ( struct script_infos desc,
int  port,
int  trp 
)
static

◆ mark_exchg_routing_server()

static void mark_exchg_routing_server ( struct script_infos desc,
int  port,
char *  buffer,
int  trp 
)
static

◆ mark_finger_server()

static void mark_finger_server ( struct script_infos desc,
int  port,
int  trp 
)
static

◆ mark_fssniffer()

void mark_fssniffer ( struct script_infos desc,
int  port,
int  trp 
)

◆ mark_ftp_server()

void mark_ftp_server ( struct script_infos desc,
int  port,
char *  buffer,
int  trp 
)

◆ mark_fw1()

static void mark_fw1 ( struct script_infos desc,
int  port,
char *  buffer,
int  trp 
)
static

◆ mark_giop_server()

static void mark_giop_server ( struct script_infos desc,
int  port,
int  trp 
)
static

◆ mark_gnocatan_server()

static void mark_gnocatan_server ( struct script_infos desc,
int  port,
int  trp 
)
static

◆ mark_gnome14_server()

void mark_gnome14_server ( struct script_infos desc,
int  port,
int  trp 
)

◆ mark_gnuserv()

static void mark_gnuserv ( struct script_infos desc,
int  port 
)
static

◆ mark_gopher_server()

static void mark_gopher_server ( struct script_infos desc,
int  port 
)
static

◆ mark_http_proxy()

void mark_http_proxy ( struct script_infos desc,
int  port,
int  trp 
)

◆ mark_http_server()

void mark_http_server ( struct script_infos desc,
int  port,
unsigned char *  buffer,
int  trp 
)

◆ mark_imap_server()

void mark_imap_server ( struct script_infos desc,
int  port,
char *  buffer,
int  trp 
)

◆ mark_interscan_viruswall()

static void mark_interscan_viruswall ( struct script_infos desc,
int  port,
char *  buffer,
int  trp 
)
static

◆ mark_ircxpro_admin_server()

static void mark_ircxpro_admin_server ( struct script_infos desc,
int  port,
int  trp 
)
static

◆ mark_iss_realsecure()

static void mark_iss_realsecure ( struct script_infos desc,
int  port 
)
static

◆ mark_jabber_server()

static void mark_jabber_server ( struct script_infos desc,
int  port,
int  trp 
)
static

◆ mark_linuxconf()

void mark_linuxconf ( struct script_infos desc,
int  port,
unsigned char *  buffer 
)

◆ mark_LISa_server()

static void mark_LISa_server ( struct script_infos desc,
int  port,
int  trp 
)
static

◆ mark_listserv_server()

void mark_listserv_server ( struct script_infos desc,
int  port,
int  trp 
)

◆ mark_locked_adsubtract_server()

void mark_locked_adsubtract_server ( struct script_infos desc,
int  port,
unsigned char *  buffer,
int  trp 
)

◆ mark_lpd_server()

static void mark_lpd_server ( struct script_infos desc,
int  port,
int  trp 
)
static

◆ mark_lyskom_server()

static void mark_lyskom_server ( struct script_infos desc,
int  port,
int  trp 
)
static

◆ mark_mldonkey()

void mark_mldonkey ( struct script_infos desc,
int  port 
)

◆ mark_mon_server()

static void mark_mon_server ( struct script_infos desc,
int  port,
char *  buffer,
int  trp 
)
static

◆ mark_mongodb()

static void mark_mongodb ( struct script_infos desc,
int  port 
)
static

◆ mark_msdtc_server()

static void mark_msdtc_server ( struct script_infos desc,
int  port 
)
static

◆ mark_mysql()

void mark_mysql ( struct script_infos desc,
int  port 
)

◆ mark_nagiosd_server()

static void mark_nagiosd_server ( struct script_infos desc,
int  port,
int  trp 
)
static

◆ mark_ncacn_http_server()

void mark_ncacn_http_server ( struct script_infos desc,
int  port,
char *  buffer 
)

◆ mark_netbus_server()

void mark_netbus_server ( struct script_infos desc,
int  port 
)

◆ mark_nntp_server()

void mark_nntp_server ( struct script_infos desc,
int  port,
char *  buffer,
int  trp 
)

◆ mark_ofa_express_server()

static void mark_ofa_express_server ( struct script_infos desc,
int  port,
int  trp 
)
static

◆ mark_pblocald_server()

static void mark_pblocald_server ( struct script_infos desc,
int  port,
char *  buffer,
int  trp 
)
static

◆ mark_pbmaster_server()

static void mark_pbmaster_server ( struct script_infos desc,
int  port,
char *  buffer,
int  trp 
)
static

◆ mark_ph_server()

static void mark_ph_server ( struct script_infos desc,
int  port,
int  trp 
)
static

◆ mark_pnsclient()

static void mark_pnsclient ( struct script_infos desc,
int  port,
int  trp 
)
static

◆ mark_pop3pw_server()

static void mark_pop3pw_server ( struct script_infos desc,
int  port,
char *  buffer,
int  trp 
)
static

◆ mark_pop_server()

void mark_pop_server ( struct script_infos desc,
int  port,
char *  buffer 
)

◆ mark_postgresql()

void mark_postgresql ( struct script_infos desc,
int  port 
)

◆ mark_ppp_daemon()

static void mark_ppp_daemon ( struct script_infos desc,
int  port,
int  trp 
)
static

◆ mark_psybnc()

static void mark_psybnc ( struct script_infos desc,
int  port,
char *  buffer,
int  trp 
)
static

◆ mark_quicktime_streaming_server()

static void mark_quicktime_streaming_server ( struct script_infos desc,
int  port,
int  trp 
)
static

◆ mark_remote_nc_server()

void mark_remote_nc_server ( struct script_infos desc,
int  port,
int  trp 
)

◆ mark_rmserver()

void mark_rmserver ( struct script_infos desc,
int  port,
char *  buffer,
int  trp 
)

◆ mark_rsync()

void mark_rsync ( struct script_infos desc,
int  port 
)

◆ mark_shoutcast_server()

static void mark_shoutcast_server ( struct script_infos desc,
int  port,
char *  buffer,
int  trp 
)
static

◆ mark_smppd_server()

static void mark_smppd_server ( struct script_infos desc,
int  port,
int  trp 
)
static

◆ mark_smtp_server()

void mark_smtp_server ( struct script_infos desc,
int  port,
char *  buffer,
int  trp 
)

◆ mark_smux_server()

static void mark_smux_server ( struct script_infos desc,
int  port,
int  trp 
)
static

◆ mark_snpp_server()

void mark_snpp_server ( struct script_infos desc,
int  port,
char *  buffer,
int  trp 
)

◆ mark_socks_proxy()

static void mark_socks_proxy ( struct script_infos desc,
int  port,
int  ver 
)
static

◆ mark_spamd_server()

static void mark_spamd_server ( struct script_infos desc,
int  port,
int  trp 
)
static

◆ mark_sphinxql()

void mark_sphinxql ( struct script_infos desc,
int  port 
)

◆ mark_ssh_server()

void mark_ssh_server ( struct script_infos desc,
int  port,
char *  buffer 
)

◆ mark_stonegate_auth_server()

static void mark_stonegate_auth_server ( struct script_infos desc,
int  port,
int  trp 
)
static

◆ mark_sub7_server()

static void mark_sub7_server ( struct script_infos desc,
int  port,
int  trp 
)
static

◆ mark_swat_server()

void mark_swat_server ( struct script_infos desc,
int  port 
)

◆ mark_tcpmux_server()

static void mark_tcpmux_server ( struct script_infos desc,
int  port,
int  trp 
)
static

◆ mark_teamspeak2_server()

static void mark_teamspeak2_server ( struct script_infos desc,
int  port,
int  trp 
)
static

◆ mark_telnet_server()

void mark_telnet_server ( struct script_infos desc,
int  port,
int  trp 
)

◆ mark_time_server()

static void mark_time_server ( struct script_infos desc,
int  port,
int  trp 
)
static

◆ mark_unknown_svc()

static void mark_unknown_svc ( struct script_infos desc,
int  port,
const unsigned char *  banner,
int  trp 
)
static

◆ mark_upsmon_server()

static void mark_upsmon_server ( struct script_infos desc,
int  port,
int  trp 
)
static

◆ mark_uucp_server()

static void mark_uucp_server ( struct script_infos desc,
int  port,
unsigned char *  banner,
int  trp 
)
static

◆ mark_veritas_backup()

static void mark_veritas_backup ( struct script_infos desc,
int  port,
int  trp 
)
static

◆ mark_vmware_auth()

static void mark_vmware_auth ( struct script_infos desc,
int  port,
char *  buffer,
int  trp 
)
static

◆ mark_vnc_server()

void mark_vnc_server ( struct script_infos desc,
int  port,
char *  buffer 
)

◆ mark_vqserver()

void mark_vqserver ( struct script_infos desc,
int  port 
)

◆ mark_vtun_server()

static void mark_vtun_server ( struct script_infos desc,
int  port,
unsigned char *  banner,
int  trp 
)
static

◆ mark_websm_server()

static void mark_websm_server ( struct script_infos desc,
int  port,
int  trp 
)
static

◆ mark_whois_plus2_server()

static void mark_whois_plus2_server ( struct script_infos desc,
int  port,
char *  buffer,
int  trp 
)
static

◆ mark_wild_shell()

void mark_wild_shell ( struct script_infos desc,
int  port 
)

◆ mark_wrapped_svc()

static void mark_wrapped_svc ( struct script_infos desc,
int  port,
int  delta 
)
static

◆ mark_zebra_server()

static void mark_zebra_server ( struct script_infos desc,
int  port,
char *  buffer,
int  trp 
)
static

◆ may_be_time()

static int may_be_time ( time_t *  rtime)
static

◆ plugin_do_run()

static int plugin_do_run ( struct script_infos desc,
GSList *  h,
int  test_ssl 
)
static

◆ plugin_run_find_service()

tree_cell * plugin_run_find_service ( lex_ctxt lexic)

◆ port_to_name()

static const char * port_to_name ( int  port)
static

◆ regex_match()

static int regex_match ( char *  string,
char *  pattern 
)
static

Compares string with the regular expression. Null characters in buffer are replaced by 'x'.

Parameters
[in]stringString to compare
[in]patternregular expression
Returns
1 if match, 0 if not match.

◆ register_service()

static void register_service ( struct script_infos desc,
int  port,
const char *  proto 
)
static

◆ sigchld()

static void sigchld ( int  s)
static

◆ sigterm()

static void sigterm ( int  s)
static

Variable Documentation

◆ oid

const char* oid

◆ sons

pid_t sons[MAX_SONS]
static