OpenVAS Scanner  7.0.1~git
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>
Include dependency graph for nasl_builtin_find_service.c:

Go to the source code of this file.

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 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 : "

Definition at line 43 of file nasl_builtin_find_service.c.

◆ CERT_FILE

#define CERT_FILE   "SSL certificate : "

Definition at line 40 of file nasl_builtin_find_service.c.

◆ CNX_TIMEOUT_PREF

#define CNX_TIMEOUT_PREF   "Network connection timeout : "

Definition at line 44 of file nasl_builtin_find_service.c.

◆ DIFF_1970_1900

#define DIFF_1970_1900   2208988800U

Definition at line 1464 of file nasl_builtin_find_service.c.

◆ 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.

Definition at line 55 of file nasl_builtin_find_service.c.

◆ KEY_FILE

#define KEY_FILE   "SSL private key : "

Definition at line 41 of file nasl_builtin_find_service.c.

◆ MAX_SHIFT

#define MAX_SHIFT   (3 * 365 * 86400)

Definition at line 1463 of file nasl_builtin_find_service.c.

◆ MAX_SONS

#define MAX_SONS   128

Definition at line 2342 of file nasl_builtin_find_service.c.

◆ NUM_CHILDREN

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

Definition at line 49 of file nasl_builtin_find_service.c.

◆ PEM_PASS

#define PEM_PASS   "PEM password : "

Definition at line 42 of file nasl_builtin_find_service.c.

◆ RW_TIMEOUT_PREF

#define RW_TIMEOUT_PREF   "Network read/write timeout : "

Definition at line 45 of file nasl_builtin_find_service.c.

◆ SMART_TCP_RW

#define SMART_TCP_RW

Definition at line 20 of file nasl_builtin_find_service.c.

◆ TEST_SSL_PREF

#define TEST_SSL_PREF   "Test SSL based services"

Definition at line 47 of file nasl_builtin_find_service.c.

◆ TESTSTRING

#define TESTSTRING   "OpenVAS Wrap Test"

◆ WRAP_TIMEOUT_PREF

#define WRAP_TIMEOUT_PREF   "Wrapped service read timeout : "

Definition at line 46 of file nasl_builtin_find_service.c.

Function Documentation

◆ mark_acap_server()

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

Definition at line 890 of file nasl_builtin_find_service.c.

891 {
892  char ban[255];
893  register_service (desc, port, "acap");
894  snprintf (ban, sizeof (ban), "acap/banner/%d", port);
895  plug_replace_key (desc, ban, ARG_STRING, buffer);
896  {
897  snprintf (ban, sizeof (ban), "An ACAP server is running on this port%s",
898  get_encaps_through (trp));
899  post_log (oid, desc, port, ban);
900  }
901 }

References ARG_STRING, get_encaps_through(), oid, plug_replace_key(), post_log(), and register_service().

Referenced by plugin_do_run().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ mark_adsgone()

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

Definition at line 859 of file nasl_builtin_find_service.c.

860 {
861  char ban[255];
862  register_service (desc, port, "adsgone");
863  plug_replace_key (desc, ban, ARG_STRING, buffer);
864  snprintf (
865  ban, sizeof (ban),
866  "An AdsGone (a popup banner blocking server) is running on this port%s",
867  get_encaps_through (trp));
868  post_log (oid, desc, port, ban);
869 }

References ARG_STRING, get_encaps_through(), oid, plug_replace_key(), post_log(), and register_service().

Referenced by plugin_do_run().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ mark_auth_server()

void mark_auth_server ( struct script_infos desc,
int  port 
)

Definition at line 381 of file nasl_builtin_find_service.c.

382 {
383  register_service (desc, port, "auth");
384  post_log (oid, desc, port, "An identd server is running on this port");
385 }

References oid, post_log(), and register_service().

Referenced by plugin_do_run().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ mark_avotus_mm_server()

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

Definition at line 1417 of file nasl_builtin_find_service.c.

1419 {
1420  char ban[512];
1421 
1422  register_service (desc, port, "avotus_mm");
1423 
1424  snprintf (ban, sizeof (ban),
1425  "An avotus 'mm' server is running on this port%s:\n%s",
1426  get_encaps_through (trp), buffer);
1427  post_log (oid, desc, port, ban);
1428 }

References get_encaps_through(), oid, post_log(), and register_service().

Referenced by plugin_do_run().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ mark_BitTorrent_server()

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

Definition at line 686 of file nasl_builtin_find_service.c.

687 {
688  char msg[255];
689 
690  register_service (desc, port, "BitTorrent");
691  snprintf (msg, sizeof (msg),
692  "A BitTorrent server seems to be running on this port%s",
693  get_encaps_through (trp));
694  post_log (oid, desc, port, msg);
695 }

References get_encaps_through(), oid, post_log(), and register_service().

Referenced by plugin_do_run().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ mark_chargen_server()

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

Definition at line 109 of file nasl_builtin_find_service.c.

110 {
111  register_service (desc, port, "chargen");
112  post_log (oid, desc, port, "Chargen is running on this port");
113 }

References oid, post_log(), and register_service().

Referenced by plugin_do_run().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ mark_citrix_server()

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

Definition at line 632 of file nasl_builtin_find_service.c.

633 {
634  char tmp[255];
635 
636  register_service (desc, port, "citrix");
637  snprintf (tmp, sizeof (tmp),
638  "a Citrix server seems to be running on this port%s",
639  get_encaps_through (trp));
640  post_log (oid, desc, port, tmp);
641 }

References get_encaps_through(), oid, post_log(), and register_service().

Referenced by plugin_do_run().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ mark_cvslockserver()

void mark_cvslockserver ( struct script_infos desc,
int  port 
)

Definition at line 432 of file nasl_builtin_find_service.c.

433 {
434  register_service (desc, port, "cvslockserver");
435  /* if (port != 2401) */
436  post_log (oid, desc, port, "A CVSLock server server is running on this port");
437 }

References oid, post_log(), and register_service().

Referenced by plugin_do_run().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ mark_cvspserver()

void mark_cvspserver ( struct script_infos desc,
int  port 
)

Definition at line 417 of file nasl_builtin_find_service.c.

418 {
419  register_service (desc, port, "cvspserver");
420  /* if (port != 2401) */
421  post_log (oid, desc, port, "A CVS pserver server is running on this port");
422 }

References oid, post_log(), and register_service().

Referenced by plugin_do_run().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ mark_cvsupserver()

void mark_cvsupserver ( struct script_infos desc,
int  port 
)

Definition at line 425 of file nasl_builtin_find_service.c.

426 {
427  register_service (desc, port, "cvsup");
428  post_log (oid, desc, port, "A CVSup server is running on this port");
429 }

References oid, post_log(), and register_service().

Referenced by plugin_do_run().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ mark_dameware_server()

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

Definition at line 1068 of file nasl_builtin_find_service.c.

1069 {
1070  char ban[255];
1071  register_service (desc, port, "dameware");
1072  snprintf (ban, sizeof (ban), "a dameware server is running on this port%s",
1073  get_encaps_through (trp));
1074  post_log (oid, desc, port, ban);
1075 }

References get_encaps_through(), oid, post_log(), and register_service().

Referenced by plugin_do_run().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ mark_dictd_server()

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

Definition at line 1354 of file nasl_builtin_find_service.c.

1355 {
1356  char ban[512];
1357 
1358  register_service (desc, port, "dicts");
1359 
1360  snprintf (ban, sizeof (ban), "A dictd server is running on this port%s:\n%s",
1361  get_encaps_through (trp), buffer);
1362  post_log (oid, desc, port, ban);
1363 }

References get_encaps_through(), oid, post_log(), and register_service().

Referenced by plugin_do_run().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ mark_direct_connect_hub()

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

Definition at line 1443 of file nasl_builtin_find_service.c.

1444 {
1445  char str[256];
1446 
1447  register_service (desc, port, "DirectConnectHub");
1448  snprintf (str, sizeof (str), "A Direct Connect Hub is running on this port%s",
1449  get_encaps_through (trp));
1450  post_log (oid, desc, port, str);
1451 }

References get_encaps_through(), oid, post_log(), and register_service().

Referenced by plugin_do_run().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ mark_echo_server()

void mark_echo_server ( struct script_infos desc,
int  port 
)

Definition at line 116 of file nasl_builtin_find_service.c.

117 {
118  register_service (desc, port, "echo");
119  post_log (oid, desc, port, "An echo server is running on this port");
120 }

References oid, post_log(), and register_service().

Referenced by plugin_do_run().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ mark_eggdrop_server()

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

Definition at line 483 of file nasl_builtin_find_service.c.

484 {
485  char ban[255];
486  register_service (desc, port, "eggdrop");
487  {
488  snprintf (
489  ban, sizeof (ban),
490  "An eggdrop IRC bot seems to be running a control server on this port%s",
491  get_encaps_through (trp));
492  post_log (oid, desc, port, ban);
493  }
494 }

References get_encaps_through(), oid, post_log(), and register_service().

Referenced by plugin_do_run().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ mark_ens_server()

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

Definition at line 619 of file nasl_builtin_find_service.c.

620 {
621  char tmp[255];
622  register_service (desc, port, "iPlanetENS");
623 
624  snprintf (tmp, sizeof (tmp),
625  "An iPlanet ENS (Event Notification Server) seems to be running on "
626  "this port%s",
627  get_encaps_through (trp));
628  post_log (oid, desc, port, tmp);
629 }

References get_encaps_through(), oid, post_log(), and register_service().

Referenced by plugin_do_run().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ mark_exchg_routing_server()

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

Definition at line 657 of file nasl_builtin_find_service.c.

659 {
660  char ban[255];
661 
662  register_service (desc, port, "exchg-routing");
663  snprintf (ban, sizeof (ban), "exchg-routing/banner/%d", port);
664  plug_replace_key (desc, ban, ARG_STRING, buffer);
665  {
666  snprintf (ban, sizeof (ban),
667  "A Microsoft Exchange routing server is running on this port%s",
668  get_encaps_through (trp));
669  post_log (oid, desc, port, ban);
670  }
671 }

References ARG_STRING, get_encaps_through(), oid, plug_replace_key(), post_log(), and register_service().

Referenced by plugin_do_run().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ mark_finger_server()

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

Definition at line 514 of file nasl_builtin_find_service.c.

515 {
516  char tmp[256];
517 
518  register_service (desc, port, "finger");
519 
520  snprintf (tmp, sizeof (tmp),
521  "A finger server seems to be running on this port%s",
522  get_encaps_through (trp));
523  post_log (oid, desc, port, tmp);
524 }

References get_encaps_through(), oid, post_log(), and register_service().

Referenced by plugin_do_run().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ mark_fssniffer()

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

Definition at line 1102 of file nasl_builtin_find_service.c.

1103 {
1104  char ban[255];
1105  register_service (desc, port, "FsSniffer");
1106  {
1107  snprintf (ban, sizeof (ban),
1108  "A FsSniffer backdoor seems to be running on this port%s",
1109  get_encaps_through (trp));
1110  post_alarm (oid, desc, port, ban);
1111  }
1112 }

References get_encaps_through(), oid, post_alarm(), and register_service().

Referenced by plugin_do_run().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ mark_ftp_server()

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

Definition at line 275 of file nasl_builtin_find_service.c.

276 {
277  register_service (desc, port, "ftp");
278 
279  if (buffer != NULL)
280  {
281  char ban[255];
282 
283  snprintf (ban, sizeof (ban), "ftp/banner/%d", port);
284  plug_replace_key (desc, ban, ARG_STRING, buffer);
285  }
286  if (buffer != NULL)
287  {
288  char *report = g_malloc0 (255 + strlen (buffer));
289  char *t = strchr (buffer, '\n');
290  if (t != NULL)
291  t[0] = '\0';
292  snprintf (report, 255 + strlen (buffer),
293  "An FTP server is running on this port%s.\n\
294 Here is its banner : \n%s",
295  get_encaps_through (trp), buffer);
296  post_log (oid, desc, port, report);
297  g_free (report);
298  }
299  else
300  {
301  char report[255];
302  snprintf (report, sizeof (report),
303  "An FTP server is running on this port%s.",
304  get_encaps_through (trp));
305  post_log (oid, desc, port, report);
306  }
307 }

References ARG_STRING, get_encaps_through(), oid, plug_replace_key(), post_log(), and register_service().

Referenced by plugin_do_run().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ mark_fw1()

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

Definition at line 800 of file nasl_builtin_find_service.c.

801 {
802  char ban[255];
803  register_service (desc, port, "cpfw1");
804  plug_replace_key (desc, ban, ARG_STRING, buffer);
805  snprintf (ban, sizeof (ban),
806  "A CheckPoint FW1 SecureRemote or FW1 FWModule server is running "
807  "on this port%s",
808  get_encaps_through (trp));
809  post_log (oid, desc, port, ban);
810 }

References ARG_STRING, get_encaps_through(), oid, plug_replace_key(), post_log(), and register_service().

Referenced by plugin_do_run().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ mark_giop_server()

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

Definition at line 644 of file nasl_builtin_find_service.c.

645 {
646  char tmp[255];
647 
648  register_service (desc, port, "giop");
649  snprintf (tmp, sizeof (tmp),
650  "A GIOP-enabled service is running on this port%s",
651  get_encaps_through (trp));
652 
653  post_log (oid, desc, port, tmp);
654 }

References get_encaps_through(), oid, post_log(), and register_service().

Referenced by plugin_do_run().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ mark_gnocatan_server()

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

Definition at line 1325 of file nasl_builtin_find_service.c.

1326 {
1327  char ban[512];
1328 
1329  register_service (desc, port, "gnocatan");
1330 
1331  snprintf (ban, sizeof (ban),
1332  "A gnocatan game server is running on this port%s",
1333  get_encaps_through (trp));
1334  post_log (oid, desc, port, ban);
1335 }

References get_encaps_through(), oid, post_log(), and register_service().

Referenced by plugin_do_run().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ mark_gnome14_server()

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

Definition at line 470 of file nasl_builtin_find_service.c.

471 {
472  char ban[255];
473  register_service (desc, port, "gnome14");
474  {
475  snprintf (ban, sizeof (ban),
476  "A Gnome 1.4 server seems to be running on this port%s",
477  get_encaps_through (trp));
478  post_log (oid, desc, port, ban);
479  }
480 }

References get_encaps_through(), oid, post_log(), and register_service().

Referenced by plugin_do_run().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ mark_gnuserv()

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

Definition at line 1245 of file nasl_builtin_find_service.c.

1246 {
1247  register_service (desc, port, "gnuserv");
1248  post_log (oid, desc, port, "gnuserv is running on this port");
1249 }

References oid, post_log(), and register_service().

Referenced by plugin_do_run().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ mark_gopher_server()

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

Definition at line 210 of file nasl_builtin_find_service.c.

211 {
212  register_service (desc, port, "gopher");
213  post_log (oid, desc, port, "A gopher server is running on this port");
214 }

References oid, post_log(), and register_service().

Referenced by plugin_do_run().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ mark_http_proxy()

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

Definition at line 320 of file nasl_builtin_find_service.c.

321 {
322  char ban[512];
323  /* the banner is in www/banner/port */
324  register_service (desc, port, "http_proxy");
325  snprintf (ban, sizeof (ban), "An HTTP proxy is running on this port%s",
326  get_encaps_through (trp));
327  post_log (oid, desc, port, ban);
328 }

References get_encaps_through(), oid, post_log(), and register_service().

Referenced by plugin_do_run().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ mark_http_server()

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

Definition at line 183 of file nasl_builtin_find_service.c.

185 {
186  char ban[512];
187  register_service (desc, port, "www");
188  snprintf (ban, sizeof (ban), "www/banner/%d", port);
189  plug_replace_key (desc, ban, ARG_STRING, buffer);
190  snprintf (ban, sizeof (ban), "A web server is running on this port%s",
191  get_encaps_through (trp));
192  post_log (oid, desc, port, ban);
193 }

References ARG_STRING, get_encaps_through(), oid, plug_replace_key(), post_log(), and register_service().

Referenced by plugin_do_run().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ mark_imap_server()

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

Definition at line 367 of file nasl_builtin_find_service.c.

368 {
369  char ban[512];
370  register_service (desc, port, "imap");
371  snprintf (ban, sizeof (ban), "imap/banner/%d", port);
372  plug_replace_key (desc, ban, ARG_STRING, buffer);
373  {
374  snprintf (ban, sizeof (ban), "An IMAP server is running on this port%s",
375  get_encaps_through (trp));
376  post_log (oid, desc, port, ban);
377  }
378 }

References ARG_STRING, get_encaps_through(), oid, plug_replace_key(), post_log(), and register_service().

Referenced by plugin_do_run().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ mark_interscan_viruswall()

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

Definition at line 1272 of file nasl_builtin_find_service.c.

1274 {
1275  char ban[512];
1276 
1277  register_service (desc, port, "interscan_viruswall");
1278 
1279  snprintf (ban, sizeof (ban),
1280  "An interscan viruswall is running on this port%s:\n%s",
1281  get_encaps_through (trp), buffer);
1282  post_log (oid, desc, port, ban);
1283 }

References get_encaps_through(), oid, post_log(), and register_service().

Referenced by plugin_do_run().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ mark_ircxpro_admin_server()

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

Definition at line 1312 of file nasl_builtin_find_service.c.

1313 {
1314  char ban[512];
1315 
1316  register_service (desc, port, "ircxpro_admin");
1317 
1318  snprintf (ban, sizeof (ban),
1319  "An IRCXPro administrative server is running on this port%s",
1320  get_encaps_through (trp));
1321  post_log (oid, desc, port, ban);
1322 }

References get_encaps_through(), oid, post_log(), and register_service().

Referenced by plugin_do_run().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ mark_iss_realsecure()

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

Definition at line 1252 of file nasl_builtin_find_service.c.

1253 {
1254  register_service (desc, port, "issrealsecure");
1255  post_log (oid, desc, port, "ISS RealSecure is running on this port");
1256 }

References oid, post_log(), and register_service().

Referenced by plugin_do_run().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ mark_jabber_server()

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

Definition at line 1406 of file nasl_builtin_find_service.c.

1407 {
1408  char ban[255];
1409  register_service (desc, port, "jabber");
1410  snprintf (ban, sizeof (ban),
1411  "jabber daemon seems to be running on this port%s",
1412  get_encaps_through (trp));
1413  post_log (oid, desc, port, ban);
1414 }

References get_encaps_through(), oid, post_log(), and register_service().

Referenced by plugin_do_run().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ mark_linuxconf()

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

Definition at line 504 of file nasl_builtin_find_service.c.

505 {
506  char ban[512];
507  register_service (desc, port, "linuxconf");
508  snprintf (ban, sizeof (ban), "linuxconf/banner/%d", port);
509  plug_replace_key (desc, ban, ARG_STRING, buffer);
510  post_log (oid, desc, port, "Linuxconf is running on this port");
511 }

References ARG_STRING, oid, plug_replace_key(), post_log(), and register_service().

Referenced by plugin_do_run().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ mark_LISa_server()

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

Definition at line 715 of file nasl_builtin_find_service.c.

716 {
717  char tmp[255];
718 
719  register_service (desc, port, "LISa");
720  snprintf (tmp, sizeof (tmp), "A LISa daemon is running on this port%s",
721  get_encaps_through (trp));
722 
723  post_log (oid, desc, port, tmp);
724 }

References get_encaps_through(), oid, post_log(), and register_service().

Referenced by plugin_do_run().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ mark_listserv_server()

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

Definition at line 1089 of file nasl_builtin_find_service.c.

1090 {
1091  char ban[255];
1092  register_service (desc, port, "listserv");
1093  {
1094  snprintf (ban, sizeof (ban),
1095  "A LISTSERV daemon seems to be running on this port%s",
1096  get_encaps_through (trp));
1097  post_log (oid, desc, port, ban);
1098  }
1099 }

References get_encaps_through(), oid, post_log(), and register_service().

Referenced by plugin_do_run().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ mark_locked_adsubtract_server()

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

Definition at line 196 of file nasl_builtin_find_service.c.

198 {
199  char ban[512];
200  register_service (desc, port, "AdSubtract");
201  snprintf (ban, sizeof (ban), "AdSubtract/banner/%d", port);
202  plug_replace_key (desc, ban, ARG_STRING, buffer);
203  snprintf (ban, sizeof (ban),
204  "A (locked) AdSubtract server is running on this port%s",
205  get_encaps_through (trp));
206  post_log (oid, desc, port, ban);
207 }

References ARG_STRING, get_encaps_through(), oid, plug_replace_key(), post_log(), and register_service().

Referenced by plugin_do_run().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ mark_lpd_server()

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

Definition at line 570 of file nasl_builtin_find_service.c.

571 {
572  char tmp[255];
573 
574  register_service (desc, port, "lpd");
575  snprintf (tmp, sizeof (tmp),
576  "A LPD server seems to be running on this port%s",
577  get_encaps_through (trp));
578  post_log (oid, desc, port, tmp);
579 }

References get_encaps_through(), oid, post_log(), and register_service().

Referenced by plugin_do_run().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ mark_lyskom_server()

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

Definition at line 583 of file nasl_builtin_find_service.c.

584 {
585  char tmp[255];
586 
587  register_service (desc, port, "lyskom");
588  snprintf (tmp, sizeof (tmp),
589  "A LysKOM server seems to be running on this port%s",
590  get_encaps_through (trp));
591  post_log (oid, desc, port, tmp);
592 }

References get_encaps_through(), oid, post_log(), and register_service().

Referenced by plugin_do_run().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ mark_mldonkey()

void mark_mldonkey ( struct script_infos desc,
int  port 
)

Definition at line 174 of file nasl_builtin_find_service.c.

175 {
176  char ban[512];
177  register_service (desc, port, "mldonkey");
178  snprintf (ban, sizeof (ban), "A mldonkey server is running on this port");
179  post_log (oid, desc, port, ban);
180 }

References oid, post_log(), and register_service().

Referenced by plugin_do_run().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ mark_mon_server()

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

Definition at line 788 of file nasl_builtin_find_service.c.

789 {
790  char ban[255];
791  register_service (desc, port, "mon");
792  snprintf (ban, sizeof (ban), "mon/banner/%d", port);
793  plug_replace_key (desc, ban, ARG_STRING, buffer);
794  snprintf (ban, sizeof (ban), "A mon server is running on this port%s",
795  get_encaps_through (trp));
796  post_log (oid, desc, port, ban);
797 }

References ARG_STRING, get_encaps_through(), oid, plug_replace_key(), post_log(), and register_service().

Referenced by plugin_do_run().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ mark_msdtc_server()

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

Definition at line 733 of file nasl_builtin_find_service.c.

734 {
735  register_service (desc, port, "msdtc");
736  post_log (oid, desc, port, "A MSDTC server is running on this port");
737 }

References oid, post_log(), and register_service().

Referenced by plugin_do_run().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ mark_mysql()

void mark_mysql ( struct script_infos desc,
int  port 
)

Definition at line 409 of file nasl_builtin_find_service.c.

410 {
411  register_service (desc, port, "mysql");
412  /* if (port != 3306) */
413  post_log (oid, desc, port, "A MySQL server is running on this port");
414 }

References oid, post_log(), and register_service().

Referenced by plugin_do_run().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ mark_nagiosd_server()

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

Definition at line 918 of file nasl_builtin_find_service.c.

919 {
920  char ban[255];
921  register_service (desc, port, "nagiosd");
922  snprintf (ban, sizeof (ban), "A nagiosd server is running on this port%s",
923  get_encaps_through (trp));
924  post_log (oid, desc, port, ban);
925 }

References get_encaps_through(), oid, post_log(), and register_service().

Referenced by plugin_do_run().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ mark_ncacn_http_server()

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

Definition at line 123 of file nasl_builtin_find_service.c.

124 {
125  char ban[256];
126  if (port == 593)
127  {
128  register_service (desc, port, "http-rpc-epmap");
129  snprintf (ban, sizeof (ban), "http-rpc-epmap/banner/%d", port);
130  plug_replace_key (desc, ban, ARG_STRING, buffer);
131  }
132  else
133  {
134  register_service (desc, port, "ncacn_http");
135  snprintf (ban, sizeof (ban), "ncacn_http/banner/%d", port);
136  plug_replace_key (desc, ban, ARG_STRING, buffer);
137  }
138 }

References ARG_STRING, plug_replace_key(), and register_service().

Referenced by plugin_do_run().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ mark_netbus_server()

void mark_netbus_server ( struct script_infos desc,
int  port 
)

Definition at line 497 of file nasl_builtin_find_service.c.

498 {
499  register_service (desc, port, "netbus");
500  post_alarm (oid, desc, port, "NetBus is running on this port");
501 }

References oid, post_alarm(), and register_service().

Referenced by plugin_do_run().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ mark_nntp_server()

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

Definition at line 150 of file nasl_builtin_find_service.c.

151 {
152  char ban[512];
153  register_service (desc, port, "nntp");
154  snprintf (ban, sizeof (ban), "nntp/banner/%d", port);
155  plug_replace_key (desc, ban, ARG_STRING, buffer);
156  snprintf (ban, sizeof (ban), "An NNTP server is running on this port%s",
157  get_encaps_through (trp));
158  post_log (oid, desc, port, ban);
159 }

References ARG_STRING, get_encaps_through(), oid, plug_replace_key(), post_log(), and register_service().

Referenced by plugin_do_run().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ mark_ofa_express_server()

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

Definition at line 973 of file nasl_builtin_find_service.c.

974 {
975  char ban[255];
976  register_service (desc, port, "ofa_express");
977  snprintf (ban, sizeof (ban),
978  "An OFA/Express server is running on this port%s",
979  get_encaps_through (trp));
980  post_log (oid, desc, port, ban);
981 }

References get_encaps_through(), oid, post_log(), and register_service().

Referenced by plugin_do_run().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ mark_pblocald_server()

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

Definition at line 1392 of file nasl_builtin_find_service.c.

1394 {
1395  char ban[512];
1396 
1397  register_service (desc, port, "power-broker-master");
1398 
1399  snprintf (ban, sizeof (ban),
1400  "A PowerBroker locald server is running on this port%s:\n%s",
1401  get_encaps_through (trp), buffer);
1402  post_log (oid, desc, port, ban);
1403 }

References get_encaps_through(), oid, post_log(), and register_service().

Referenced by plugin_do_run().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ mark_pbmaster_server()

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

Definition at line 1339 of file nasl_builtin_find_service.c.

1341 {
1342  char ban[512];
1343 
1344  register_service (desc, port, "power-broker-master");
1345 
1346  snprintf (ban, sizeof (ban),
1347  "A PowerBroker master server is running on this port%s:\n%s",
1348  get_encaps_through (trp), buffer);
1349  post_log (oid, desc, port, ban);
1350 }

References get_encaps_through(), oid, post_log(), and register_service().

Referenced by plugin_do_run().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ mark_ph_server()

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

Definition at line 596 of file nasl_builtin_find_service.c.

597 {
598  char tmp[255];
599 
600  register_service (desc, port, "ph");
601  snprintf (tmp, sizeof (tmp), "A PH server seems to be running on this port%s",
602  get_encaps_through (trp));
603  post_log (oid, desc, port, tmp);
604 }

References get_encaps_through(), oid, post_log(), and register_service().

Referenced by plugin_do_run().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ mark_pnsclient()

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

Definition at line 1367 of file nasl_builtin_find_service.c.

1368 {
1369  char ban[512];
1370 
1371  register_service (desc, port, "pNSClient");
1372 
1373  snprintf (ban, sizeof (ban),
1374  "A Netsaint plugin (pNSClient.exe) is running on this port%s",
1375  get_encaps_through (trp));
1376  post_log (oid, desc, port, ban);
1377 }

References get_encaps_through(), oid, post_log(), and register_service().

Referenced by plugin_do_run().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ mark_pop3pw_server()

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

Definition at line 740 of file nasl_builtin_find_service.c.

741 {
742  char ban[512];
743  register_service (desc, port, "pop3pw");
744  snprintf (ban, sizeof (ban), "pop3pw/banner/%d", port);
745  plug_replace_key (desc, ban, ARG_STRING, buffer);
746  snprintf (ban, sizeof (ban), "A pop3pw server is running on this port%s",
747  get_encaps_through (trp));
748  post_log (oid, desc, port, ban);
749 }

References ARG_STRING, get_encaps_through(), oid, plug_replace_key(), post_log(), and register_service().

Referenced by plugin_do_run().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ mark_pop_server()

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

Definition at line 331 of file nasl_builtin_find_service.c.

332 {
333  char *c = strchr (buffer, '\n');
334  char ban[512];
335  char *buffer2;
336  unsigned int i;
337 
338  if (c)
339  c[0] = 0;
340  buffer2 = g_strdup (buffer);
341  for (i = 0; i < strlen (buffer2); i++)
342  buffer2[i] = tolower (buffer2[i]);
343  if (!strcmp (buffer2, "+ok"))
344  {
345  register_service (desc, port, "pop1");
346  snprintf (ban, sizeof (ban), "pop1/banner/%d", port);
347  plug_replace_key (desc, ban, ARG_STRING, buffer);
348  }
349  else if (strstr (buffer2, "pop2"))
350  {
351  register_service (desc, port, "pop2");
352  snprintf (ban, sizeof (ban), "pop2/banner/%d", port);
353  plug_replace_key (desc, ban, ARG_STRING, buffer);
354  post_log (oid, desc, port, "a pop2 server is running on this port");
355  }
356  else
357  {
358  register_service (desc, port, "pop3");
359  snprintf (ban, sizeof (ban), "pop3/banner/%d", port);
360  plug_replace_key (desc, ban, ARG_STRING, buffer);
361  post_log (oid, desc, port, "A pop3 server is running on this port");
362  }
363  g_free (buffer2);
364 }

References ARG_STRING, oid, plug_replace_key(), post_log(), and register_service().

Referenced by plugin_do_run().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ mark_postgresql()

void mark_postgresql ( struct script_infos desc,
int  port 
)

Definition at line 392 of file nasl_builtin_find_service.c.

393 {
394  register_service (desc, port, "postgresql");
395  /* if (port != 5432) */
396  post_log (oid, desc, port, "A PostgreSQL server is running on this port");
397 }

References oid, post_log(), and register_service().

Referenced by plugin_do_run().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ mark_ppp_daemon()

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

Definition at line 1286 of file nasl_builtin_find_service.c.

1287 {
1288  char ban[512];
1289 
1290  register_service (desc, port, "pppd");
1291 
1292  snprintf (ban, sizeof (ban), "A PPP daemon is running on this port%s",
1293  get_encaps_through (trp));
1294  post_log (oid, desc, port, ban);
1295 }

References get_encaps_through(), oid, post_log(), and register_service().

Referenced by plugin_do_run().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ mark_psybnc()

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

Definition at line 823 of file nasl_builtin_find_service.c.

824 {
825  char ban[255];
826  register_service (desc, port, "psybnc");
827  plug_replace_key (desc, ban, ARG_STRING, buffer);
828  snprintf (ban, sizeof (ban), "A PsyBNC IRC proxy is running on this port%s",
829  get_encaps_through (trp));
830  post_log (oid, desc, port, ban);
831 }

References ARG_STRING, get_encaps_through(), oid, plug_replace_key(), post_log(), and register_service().

Referenced by plugin_do_run().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ mark_quicktime_streaming_server()

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

Definition at line 1056 of file nasl_builtin_find_service.c.

1057 {
1058  char ban[255];
1059  register_service (desc, port, "quicktime-streaming-server");
1060  snprintf (ban, sizeof (ban),
1061  "a quicktime streaming server is running on this port%s",
1062  get_encaps_through (trp));
1063  post_log (oid, desc, port, ban);
1064 }

References get_encaps_through(), oid, post_log(), and register_service().

Referenced by plugin_do_run().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ mark_remote_nc_server()

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

Definition at line 1115 of file nasl_builtin_find_service.c.

1116 {
1117  char ban[255];
1118  register_service (desc, port, "RemoteNC");
1119  {
1120  snprintf (ban, sizeof (ban),
1121  "A RemoteNC backdoor seems to be running on this port%s",
1122  get_encaps_through (trp));
1123  post_log (oid, desc, port, ban);
1124  }
1125 }

References get_encaps_through(), oid, post_log(), and register_service().

Referenced by plugin_do_run().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ mark_rmserver()

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

Definition at line 217 of file nasl_builtin_find_service.c.

218 {
219  char ban[512];
220  register_service (desc, port, "realserver");
221  snprintf (ban, sizeof (ban), "realserver/banner/%d", port);
222  plug_replace_key (desc, ban, ARG_STRING, buffer);
223 
224  snprintf (ban, sizeof (ban), "A RealMedia server is running on this port%s",
225  get_encaps_through (trp));
226  post_log (oid, desc, port, ban);
227 }

References ARG_STRING, get_encaps_through(), oid, plug_replace_key(), post_log(), and register_service().

Referenced by plugin_do_run().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ mark_rsync()

void mark_rsync ( struct script_infos desc,
int  port 
)

Definition at line 440 of file nasl_builtin_find_service.c.

441 {
442  register_service (desc, port, "rsync");
443  post_log (oid, desc, port, "A rsync server is running on this port");
444 }

References oid, post_log(), and register_service().

Referenced by plugin_do_run().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ mark_shoutcast_server()

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

Definition at line 841 of file nasl_builtin_find_service.c.

843 {
844  char ban[255];
845  register_service (desc, port, "shoutcast");
846  plug_replace_key (desc, ban, ARG_STRING, buffer);
847  snprintf (ban, sizeof (ban), "A shoutcast server is running on this port%s",
848  get_encaps_through (trp));
849  post_log (oid, desc, port, ban);
850 }

References ARG_STRING, get_encaps_through(), oid, plug_replace_key(), post_log(), and register_service().

Referenced by plugin_do_run().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ mark_smppd_server()

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

Definition at line 990 of file nasl_builtin_find_service.c.

991 {
992  char ban[255];
993  register_service (desc, port, "smppd");
994  snprintf (ban, sizeof (ban),
995  "A SuSE Meta pppd server is running on this port%s",
996  get_encaps_through (trp));
997  post_log (oid, desc, port, ban);
998 }

References get_encaps_through(), oid, post_log(), and register_service().

Referenced by plugin_do_run().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ mark_smtp_server()

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

Definition at line 230 of file nasl_builtin_find_service.c.

231 {
232  char ban[512];
233  register_service (desc, port, "smtp");
234  snprintf (ban, sizeof (ban), "smtp/banner/%d", port);
235  plug_replace_key (desc, ban, ARG_STRING, buffer);
236 
237  if (strstr (buffer, " postfix"))
238  plug_replace_key (desc, "smtp/postfix", ARG_INT, (void *) 1);
239 
240  {
241  char *report = g_malloc0 (255 + strlen (buffer));
242  char *t = strchr (buffer, '\n');
243  if (t)
244  t[0] = 0;
245  snprintf (report, 255 + strlen (buffer),
246  "An SMTP server is running on this port%s\n\
247 Here is its banner : \n%s",
248  get_encaps_through (trp), buffer);
249  post_log (oid, desc, port, report);
250  g_free (report);
251  }
252 }

References ARG_INT, ARG_STRING, get_encaps_through(), oid, plug_replace_key(), post_log(), and register_service().

Referenced by plugin_do_run().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ mark_smux_server()

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

Definition at line 698 of file nasl_builtin_find_service.c.

699 {
700  char msg[255];
701 
702  register_service (desc, port, "smux");
703  snprintf (msg, sizeof (msg),
704  "A SNMP Multiplexer (smux) seems to be running on this port%s",
705  get_encaps_through (trp));
706  post_log (oid, desc, port, msg);
707 }

References get_encaps_through(), oid, post_log(), and register_service().

Referenced by plugin_do_run().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ mark_snpp_server()

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

Definition at line 255 of file nasl_builtin_find_service.c.

256 {
257  char ban[512], *report, *t;
258  register_service (desc, port, "snpp");
259  snprintf (ban, sizeof (ban), "snpp/banner/%d", port);
260  plug_replace_key (desc, ban, ARG_STRING, buffer);
261 
262  report = g_malloc0 (255 + strlen (buffer));
263  t = strchr (buffer, '\n');
264  if (t != NULL)
265  *t = '\0';
266  snprintf (report, 255 + strlen (buffer),
267  "An SNPP server is running on this port%s\n\
268 Here is its banner : \n%s",
269  get_encaps_through (trp), buffer);
270  post_log (oid, desc, port, report);
271  g_free (report);
272 }

References ARG_STRING, get_encaps_through(), oid, plug_replace_key(), post_log(), and register_service().

Referenced by plugin_do_run().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ mark_socks_proxy()

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

Definition at line 1431 of file nasl_builtin_find_service.c.

1432 {
1433  char str[256];
1434 
1435  snprintf (str, sizeof (str), "socks%d", ver);
1436  register_service (desc, port, str);
1437  snprintf (str, sizeof (str), "A SOCKS%d proxy is running on this port. ",
1438  ver);
1439  post_log (oid, desc, port, str);
1440 }

References oid, post_log(), and register_service().

Referenced by plugin_do_run().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ mark_spamd_server()

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

Definition at line 1044 of file nasl_builtin_find_service.c.

1045 {
1046  char ban[255];
1047  register_service (desc, port, "spamd");
1048  snprintf (ban, sizeof (ban),
1049  "a spamd server (part of spamassassin) is running on this port%s",
1050  get_encaps_through (trp));
1051  post_log (oid, desc, port, ban);
1052 }

References get_encaps_through(), oid, post_log(), and register_service().

Referenced by plugin_do_run().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ mark_sphinxql()

void mark_sphinxql ( struct script_infos desc,
int  port 
)

Definition at line 400 of file nasl_builtin_find_service.c.

401 {
402  register_service (desc, port, "sphinxql");
403  post_log (oid, desc, port,
404  "A Sphinx search server (MySQL listener)"
405  "seems to be running on this port");
406 }

References oid, post_log(), and register_service().

Referenced by plugin_do_run().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ mark_ssh_server()

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

Definition at line 310 of file nasl_builtin_find_service.c.

311 {
312  register_service (desc, port, "ssh");
313  while ((buffer[strlen (buffer) - 1] == '\n')
314  || (buffer[strlen (buffer) - 1] == '\r'))
315  buffer[strlen (buffer) - 1] = '\0';
316  post_log (oid, desc, port, "An ssh server is running on this port");
317 }

References oid, post_log(), and register_service().

Referenced by plugin_do_run().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ mark_stonegate_auth_server()

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

Definition at line 1078 of file nasl_builtin_find_service.c.

1079 {
1080  char ban[255];
1081  register_service (desc, port, "SG_ClientAuth");
1082  snprintf (ban, sizeof (ban),
1083  "a StoneGate authentication server is running on this port%s",
1084  get_encaps_through (trp));
1085  post_log (oid, desc, port, ban);
1086 }

References get_encaps_through(), oid, post_log(), and register_service().

Referenced by plugin_do_run().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ mark_sub7_server()

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

Definition at line 1027 of file nasl_builtin_find_service.c.

1028 {
1029  char ban[255];
1030  register_service (desc, port, "sub7");
1031  snprintf (ban, sizeof (ban), "The Sub7 trojan is running on this port%s",
1032  get_encaps_through (trp));
1033  post_alarm (oid, desc, port, ban);
1034 }

References get_encaps_through(), oid, post_alarm(), and register_service().

Referenced by plugin_do_run().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ mark_swat_server()

void mark_swat_server ( struct script_infos desc,
int  port 
)

Definition at line 162 of file nasl_builtin_find_service.c.

163 {
164  register_service (desc, port, "swat");
165 }

References register_service().

Referenced by plugin_do_run().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ mark_tcpmux_server()

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

Definition at line 674 of file nasl_builtin_find_service.c.

675 {
676  char msg[255];
677 
678  register_service (desc, port, "tcpmux");
679  snprintf (msg, sizeof (msg),
680  "A tcpmux server seems to be running on this port%s",
681  get_encaps_through (trp));
682  post_log (oid, desc, port, msg);
683 }

References get_encaps_through(), oid, post_log(), and register_service().

Referenced by plugin_do_run().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ mark_teamspeak2_server()

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

Definition at line 935 of file nasl_builtin_find_service.c.

936 {
937  char ban[255];
938  register_service (desc, port, "teamspeak2");
939  snprintf (ban, sizeof (ban), "A teamspeak2 server is running on this port%s",
940  get_encaps_through (trp));
941  post_log (oid, desc, port, ban);
942 }

References get_encaps_through(), oid, post_log(), and register_service().

Referenced by plugin_do_run().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ mark_telnet_server()

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

Definition at line 457 of file nasl_builtin_find_service.c.

458 {
459  char ban[255];
460  register_service (desc, port, "telnet");
461  {
462  snprintf (ban, sizeof (ban),
463  "A telnet server seems to be running on this port%s",
464  get_encaps_through (trp));
465  post_log (oid, desc, port, ban);
466  }
467 }

References get_encaps_through(), oid, post_log(), and register_service().

Referenced by plugin_do_run().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ mark_time_server()

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

Definition at line 607 of file nasl_builtin_find_service.c.

608 {
609  char tmp[256];
610 
611  register_service (desc, port, "time");
612  snprintf (tmp, sizeof (tmp),
613  "A time server seems to be running on this port%s",
614  get_encaps_through (trp));
615  post_log (oid, desc, port, tmp);
616 }

References get_encaps_through(), oid, post_log(), and register_service().

Referenced by plugin_do_run().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ mark_unknown_svc()

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

Definition at line 1221 of file nasl_builtin_find_service.c.

1223 {
1224  char tmp[1600], *norm = NULL;
1225 
1226  /* Do NOT use plug_replace_key! */
1227  plug_set_key (desc, "Services/unknown", ARG_INT, GSIZE_TO_POINTER (port));
1228  snprintf (tmp, sizeof (tmp), "unknown/banner/%d", port);
1229  plug_replace_key (desc, tmp, ARG_STRING, (char *) banner);
1230 
1231  norm = (char *) port_to_name (port);
1232  *tmp = '\0';
1233  if (norm != NULL)
1234  {
1235  snprintf (tmp, sizeof (tmp),
1236  "An unknown service is running on this port%s.\n"
1237  "It is usually reserved for %s",
1238  get_encaps_through (trp), norm);
1239  }
1240  if (*tmp != '\0')
1241  post_log (oid, desc, port, tmp);
1242 }

References ARG_INT, ARG_STRING, get_encaps_through(), oid, plug_replace_key(), plug_set_key(), port_to_name(), and post_log().

Referenced by plugin_do_run().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ mark_upsmon_server()

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

Definition at line 1008 of file nasl_builtin_find_service.c.

1009 {
1010  char ban[255];
1011  register_service (desc, port, "upsmon");
1012  snprintf (ban, sizeof (ban),
1013  "An upsd/upsmon server is running on this port%s",
1014  get_encaps_through (trp));
1015  post_log (oid, desc, port, ban);
1016 }

References get_encaps_through(), oid, post_log(), and register_service().

Referenced by plugin_do_run().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ mark_uucp_server()

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

Definition at line 553 of file nasl_builtin_find_service.c.

555 {
556  char tmp[255];
557 
558  snprintf (tmp, sizeof (tmp), "uucp/banner/%d", port);
559  plug_replace_key (desc, tmp, ARG_STRING, (char *) banner);
560 
561  register_service (desc, port, "uucp");
562 
563  snprintf (tmp, sizeof (tmp),
564  "An UUCP server seems to be running on this port%s",
565  get_encaps_through (trp));
566  post_log (oid, desc, port, tmp);
567 }

References ARG_STRING, get_encaps_through(), oid, plug_replace_key(), post_log(), and register_service().

Referenced by plugin_do_run().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ mark_veritas_backup()

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

Definition at line 1381 of file nasl_builtin_find_service.c.

1382 {
1383  char ban[512];
1384  register_service (desc, port, "VeritasNetBackup");
1385 
1386  snprintf (ban, sizeof (ban), "VeritasNetBackup is running on this port%s",
1387  get_encaps_through (trp));
1388  post_log (oid, desc, port, ban);
1389 }

References get_encaps_through(), oid, post_log(), and register_service().

Referenced by plugin_do_run().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ mark_vmware_auth()

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

Definition at line 1259 of file nasl_builtin_find_service.c.

1260 {
1261  char ban[512];
1262 
1263  register_service (desc, port, "vmware_auth");
1264 
1265  snprintf (ban, sizeof (ban),
1266  "A VMWare authentication daemon is running on this port%s:\n%s",
1267  get_encaps_through (trp), buffer);
1268  post_log (oid, desc, port, ban);
1269 }

References get_encaps_through(), oid, post_log(), and register_service().

Referenced by plugin_do_run().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ mark_vnc_server()

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

Definition at line 141 of file nasl_builtin_find_service.c.

142 {
143  char ban[512];
144  register_service (desc, port, "vnc");
145  snprintf (ban, sizeof (ban), "vnc/banner/%d", port);
146  plug_replace_key (desc, ban, ARG_STRING, buffer);
147 }

References ARG_STRING, plug_replace_key(), and register_service().

Referenced by plugin_do_run().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ mark_vqserver()

void mark_vqserver ( struct script_infos desc,
int  port 
)

Definition at line 168 of file nasl_builtin_find_service.c.

169 {
170  register_service (desc, port, "vqServer-admin");
171 }

References register_service().

Referenced by plugin_do_run().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ mark_vtun_server()

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

Definition at line 527 of file nasl_builtin_find_service.c.

529 {
530  char tmp[255];
531 
532  snprintf (tmp, sizeof (tmp), "vtun/banner/%d", port);
533  plug_replace_key (desc, tmp, ARG_STRING, (char *) banner);
534 
535  register_service (desc, port, "vtun");
536 
537  if (banner == NULL)
538  {
539  snprintf (tmp, sizeof (tmp),
540  "A VTUN server seems to be running on this port%s",
541  get_encaps_through (trp));
542  }
543  else
544  snprintf (tmp, sizeof (tmp),
545  "A VTUN server seems to be running on this port%s\n"
546  "Here is its banner:\n%s\n",
547  get_encaps_through (trp), banner);
548 
549  post_log (oid, desc, port, tmp);
550 }

References ARG_STRING, get_encaps_through(), oid, plug_replace_key(), post_log(), and register_service().

Referenced by plugin_do_run().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ mark_websm_server()

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

Definition at line 959 of file nasl_builtin_find_service.c.

960 {
961  char ban[255];
962  register_service (desc, port, "websm");
963  snprintf (ban, sizeof (ban), "A WEBSM server is running on this port%s",
964  get_encaps_through (trp));
965  post_log (oid, desc, port, ban);
966 }

References get_encaps_through(), oid, post_log(), and register_service().

Referenced by plugin_do_run().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ mark_whois_plus2_server()

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

Definition at line 766 of file nasl_builtin_find_service.c.

768 {
769  char ban[255];
770  register_service (desc, port, "whois++");
771  snprintf (ban, sizeof (ban), "whois++/banner/%d", port);
772  plug_replace_key (desc, ban, ARG_STRING, buffer);
773  snprintf (ban, sizeof (ban), "A whois++ server is running on this port%s",
774  get_encaps_through (trp));
775  post_log (oid, desc, port, ban);
776 }

References ARG_STRING, get_encaps_through(), oid, plug_replace_key(), post_log(), and register_service().

Referenced by plugin_do_run().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ mark_wild_shell()

void mark_wild_shell ( struct script_infos desc,
int  port 
)

Definition at line 447 of file nasl_builtin_find_service.c.

448 {
449  register_service (desc, port, "wild_shell");
450 
451  post_alarm (
452  oid, desc, port,
453  "A shell seems to be running on this port ! (this is a possible backdoor)");
454 }

References oid, post_alarm(), and register_service().

Referenced by plugin_do_run().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ mark_wrapped_svc()

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

Definition at line 1130 of file nasl_builtin_find_service.c.

1131 {
1132  char msg[256];
1133 
1134  snprintf (msg, sizeof (msg),
1135  "The service closed the connection after %d seconds "
1136  "without sending any data\n"
1137  "It might be protected by some TCP wrapper\n",
1138  delta);
1139  post_log (oid, desc, port, msg);
1140  /* Do NOT use plug_replace_key! */
1141  plug_set_key (desc, "Services/wrapped", ARG_INT, GSIZE_TO_POINTER (port));
1142 }

References ARG_INT, oid, plug_set_key(), and post_log().

Referenced by plugin_do_run().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ mark_zebra_server()

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

Definition at line 1298 of file nasl_builtin_find_service.c.

1299 {
1300  char ban[512];
1301 
1302  register_service (desc, port, "zebra");
1303  snprintf (ban, sizeof (ban), "zebra/banner/%d", port);
1304  plug_replace_key (desc, ban, ARG_STRING, buffer);
1305  snprintf (ban, sizeof (ban),
1306  "A zebra daemon (bgpd or zebrad) is running on this port%s",
1307  get_encaps_through (trp));
1308  post_log (oid, desc, port, ban);
1309 }

References ARG_STRING, get_encaps_through(), oid, plug_replace_key(), post_log(), and register_service().

Referenced by plugin_do_run().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ may_be_time()

static int may_be_time ( time_t *  rtime)
static

Definition at line 1467 of file nasl_builtin_find_service.c.

1468 {
1469 #ifndef ABS
1470 #define ABS(x) (((x) < 0) ? -(x) : (x))
1471 #endif
1472  time_t now = time (NULL);
1473  int rt70 = ntohl (*rtime) - DIFF_1970_1900;
1474 
1475  if (ABS (now - rt70) < MAX_SHIFT)
1476  return 1;
1477  else
1478  return 0;
1479 }

References ABS, DIFF_1970_1900, and MAX_SHIFT.

Referenced by plugin_do_run().

Here is the caller graph for this function:

◆ plugin_do_run()

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

Definition at line 1482 of file nasl_builtin_find_service.c.

1483 {
1484  char *head = "Ports/tcp/", *host_fqdn;
1485  u_short unknown[65535];
1486  int num_unknown = 0;
1487  size_t len_head = strlen (head);
1488 
1489  int rw_timeout = 20, cnx_timeout = 20, wrap_timeout = 20;
1490  int x, timeout;
1491  char *rw_timeout_s = get_plugin_preference (oid, RW_TIMEOUT_PREF, -1);
1492  char *cnx_timeout_s = get_plugin_preference (oid, CNX_TIMEOUT_PREF, -1);
1493  char *wrap_timeout_s = get_plugin_preference (oid, WRAP_TIMEOUT_PREF, -1);
1494  unsigned char *p;
1495  fd_set rfds, wfds;
1496  struct timeval tv;
1497  char k[32], *http_get;
1498 
1499  host_fqdn = plug_get_host_fqdn (desc);
1500  http_get = g_strdup_printf ("GET / HTTP/1.0\r\nHost: %s\r\n\r\n", host_fqdn);
1501  g_free (host_fqdn);
1502 
1503  if (rw_timeout_s != NULL && (x = atoi (rw_timeout_s)) > 0)
1504  rw_timeout = x;
1505  if (cnx_timeout_s != NULL && (x = atoi (cnx_timeout_s)) > 0)
1506  cnx_timeout = x;
1507  if (wrap_timeout_s != NULL && (x = atoi (wrap_timeout_s)) >= 0)
1508  wrap_timeout = x;
1509 
1510  bzero (unknown, sizeof (unknown));
1511 
1512  while (h)
1513  {
1514  if ((strlen (h->data) > len_head) && !strncmp (h->data, head, len_head))
1515  {
1516  int cnx;
1517  char *line;
1518  char *origline;
1519  int trp;
1520  char buffer[2049];
1521  unsigned char *banner = NULL, *bannerHex = NULL;
1522  size_t banner_len, i;
1523  int port = atoi (h->data + len_head);
1524  int flg = 0;
1525  int unindentified_service = 0;
1526  int three_digits = 0;
1527  int maybe_wrapped = 0;
1528  char kb[64];
1529  int get_sent = 0;
1530  struct timeval tv1, tv2;
1531  int diff_tv = 0, diff_tv2 = 0;
1532  int type, no_banner_grabbed = 0;
1533 
1534 #define DIFFTV1000(t1, t2) \
1535  ((t1.tv_sec - t2.tv_sec) * 1000 + (t1.tv_usec - t2.tv_usec) / 1000)
1536 
1537  bzero (buffer, sizeof (buffer));
1538  banner_len = 0;
1539  snprintf (kb, sizeof (kb), "BannerHex/%d", port);
1540  bannerHex = plug_get_key (desc, kb, &type, NULL, 0);
1541  if (type == ARG_STRING && bannerHex != NULL && bannerHex[0] != '\0')
1542  {
1543  int c1, c2;
1544  unsigned int i;
1545  banner_len = strlen ((char *) bannerHex) / 2;
1546  if (banner_len >= sizeof (buffer))
1547  banner_len = sizeof (buffer) - 1;
1548  for (i = 0; i < banner_len; i++)
1549  {
1550  c1 = bannerHex[2 * i];
1551  if (c1 >= 0 && c1 <= 9)
1552  c1 -= '0';
1553  else if (c1 >= 'a' && c1 <= 'f')
1554  c1 -= 'a';
1555  else if (c1 >= 'A' && c1 <= 'F')
1556  c1 -= 'A';
1557  else
1558  banner_len = 0; /* Invalid value */
1559  c2 = bannerHex[2 * i + 1];
1560  if (c2 >= 0 && c2 <= 9)
1561  c2 -= '0';
1562  else if (c2 >= 'a' && c2 <= 'f')
1563  c2 -= 'a';
1564  else if (c2 >= 'A' && c2 <= 'F')
1565  c2 -= 'A';
1566  else
1567  banner_len = 0; /* Invalid value */
1568  buffer[i] = c1 << 4 | c2;
1569  }
1570  buffer[i] = '\0';
1571  if (banner_len > 0)
1572  banner = (unsigned char *) buffer;
1573  }
1574  g_free (bannerHex);
1575  if (banner_len == 0)
1576  {
1577  snprintf (kb, sizeof (kb), "Banner/%d", port);
1578  banner = plug_get_key (desc, kb, &type, NULL, 0);
1579  if (banner)
1580  banner_len = strlen ((char *) banner);
1581  }
1582  if (banner_len > 0)
1583  {
1584  cnx = -1;
1585  trp = OPENVAS_ENCAPS_IP;
1586  }
1587  else
1588  {
1589  if (banner != NULL)
1590  {
1591  g_free (banner);
1592  banner = NULL;
1593  }
1594  /* If test_ssl is set, try with TLS first. */
1595  if (test_ssl)
1597  else
1598  trp = OPENVAS_ENCAPS_IP;
1599  gettimeofday (&tv1, NULL);
1600  cnx = open_stream_connection (desc, port, trp, cnx_timeout);
1601  if (cnx < 0 && test_ssl)
1602  {
1603  trp = OPENVAS_ENCAPS_IP;
1604  gettimeofday (&tv1, NULL);
1605  cnx = open_stream_connection (desc, port, trp, cnx_timeout);
1606  }
1607  gettimeofday (&tv2, NULL);
1608  diff_tv = DIFFTV1000 (tv2, tv1);
1609  }
1610 
1611  if (cnx >= 0 || banner_len > 0)
1612  {
1613  int line_len, realfd = -1;
1614  size_t len;
1615 
1616  if (cnx >= 0)
1617  {
1618  realfd = openvas_get_socket_from_connection (cnx);
1619  snprintf (k, sizeof (k), "FindService/CnxTime1000/%d", port);
1620  plug_replace_key (desc, k, ARG_INT,
1621  GSIZE_TO_POINTER (diff_tv));
1622  snprintf (k, sizeof (k), "FindService/CnxTime/%d", port);
1624  desc, k, ARG_INT,
1625  GSIZE_TO_POINTER (((diff_tv + 500) / 1000)));
1626  if (diff_tv / 1000 > cnx_timeout)
1627  plug_replace_key (desc, "/tmp/SlowFindService", ARG_INT,
1628  GSIZE_TO_POINTER (1));
1629  }
1630  plug_set_port_transport (desc, port, trp);
1631  (void) stream_set_timeout (port, rw_timeout);
1632 
1633  if (IS_ENCAPS_SSL (trp))
1634  {
1635  char report[160];
1636  snprintf (report, sizeof (report),
1637  "A %s server answered on this port\n",
1638  get_encaps_name (trp));
1639  post_log (oid, desc, port, report);
1640  plug_set_key (desc, "Transport/SSL", ARG_INT,
1641  GSIZE_TO_POINTER (port));
1642  }
1643 
1644  len = 0;
1645  timeout = 0;
1646  if (banner_len > 0)
1647  {
1648  len = banner_len;
1649  if (banner != (unsigned char *) buffer)
1650  {
1651  if (len >= sizeof (buffer))
1652  len = sizeof (buffer) - 1;
1653  memcpy (buffer, banner, len);
1654  buffer[len] = '\0';
1655  }
1656  }
1657  else
1658  {
1659  snprintf (kb, sizeof (kb), "/tmp/NoBanner/%d", port);
1660  p = plug_get_key (desc, kb, &type, NULL, 0);
1661  if (p != NULL)
1662  {
1663  if (type == ARG_INT)
1664  no_banner_grabbed = GPOINTER_TO_SIZE (p);
1665  else if (type == ARG_STRING)
1666  no_banner_grabbed = atoi ((char *) p);
1667  }
1668  g_free (p);
1669 
1670  if (!no_banner_grabbed)
1671  {
1672 #ifdef SMART_TCP_RW
1673  if (trp == OPENVAS_ENCAPS_IP && realfd >= 0)
1674  {
1675  select_again:
1676  FD_ZERO (&rfds);
1677  FD_ZERO (&wfds);
1678  FD_SET (realfd, &rfds);
1679  FD_SET (realfd, &wfds);
1680 
1681  (void) gettimeofday (&tv1, NULL);
1682  tv.tv_usec = 0;
1683  tv.tv_sec = rw_timeout;
1684  x = select (realfd + 1, &rfds, &wfds, NULL, &tv);
1685  if (x < 0)
1686  {
1687  if (errno == EINTR)
1688  goto select_again;
1689  perror ("select");
1690  }
1691  else if (x == 0)
1692  timeout = 1;
1693  else if (x > 0)
1694  {
1695  if (FD_ISSET (realfd, &rfds))
1696  {
1698  cnx, buffer, 1, sizeof (buffer) - 2);
1699  }
1700  }
1701  (void) gettimeofday (&tv2, NULL);
1702  diff_tv = DIFFTV1000 (tv2, tv1);
1703  }
1704  }
1705  else
1706  { /* No banner was found
1707  * by openvas_tcp_scanner */
1708  len = 0;
1709  timeout = 0;
1710  }
1711 
1712  if (len <= 0 && !timeout)
1713 #endif
1714  {
1716  strlen (http_get));
1717  (void) gettimeofday (&tv1, NULL);
1718  get_sent = 1;
1719  buffer[sizeof (buffer) - 1] = '\0';
1720  len = read_stream_connection (cnx, buffer,
1721  sizeof (buffer) - 1);
1722 #if 1
1723  /*
1724  * Try to work around broken
1725  * web server (or "magic
1726  * read" bug??)
1727  */
1728  if (len > 0 && len < 8
1729  && strncmp (buffer, "HTTP/1.", len) == 0)
1730  {
1731  int len2 = read_stream_connection (
1732  cnx, buffer + len, sizeof (buffer) - 1 - len);
1733  if (len2 > 0)
1734  len += len2;
1735  }
1736 #endif
1737  (void) gettimeofday (&tv2, NULL);
1738  diff_tv = DIFFTV1000 (tv2, tv1);
1739  }
1740  if (len > 0)
1741  {
1742  snprintf (k, sizeof (k), "FindService/RwTime1000/%d",
1743  port);
1744  plug_replace_key (desc, k, ARG_INT,
1745  GSIZE_TO_POINTER (diff_tv));
1746  snprintf (k, sizeof (k), "FindService/RwTime/%d", port);
1748  desc, k, ARG_INT,
1749  GSIZE_TO_POINTER ((diff_tv + 500) / 1000));
1750  if (diff_tv / 1000 > rw_timeout)
1751  plug_replace_key (desc, "/tmp/SlowFindService", ARG_INT,
1752  GSIZE_TO_POINTER (1));
1753  }
1754  }
1755 
1756  if (len > 0)
1757  {
1758  char *t;
1759  banner = g_malloc0 (len + 1);
1760  memcpy (banner, buffer, len);
1761  banner[len] = '\0';
1762 
1763  for (i = 0; i < len; i++)
1764  buffer[i] = (buffer[i] == '\0') ? 'x' : tolower (buffer[i]);
1765 
1766  line = g_strdup (buffer);
1767 
1768  t = strchr (line, '\n');
1769  if (t)
1770  t[0] = '\0';
1771  if (isdigit (banner[0]) && isdigit (banner[1])
1772  && isdigit (banner[2])
1773  && (banner[3] == '\0' || isspace (banner[3])
1774  || banner[3] == '-'))
1775  {
1776  /*
1777  * Do NOT use
1778  * plug_replace_key!
1779  */
1780  plug_set_key (desc, "Services/three_digits", ARG_INT,
1781  GSIZE_TO_POINTER (port));
1782  /*
1783  * Do *not* set
1784  * Known/tcp/<port> to
1785  * "three_digits": the
1786  * service must remain
1787  * "unknown"
1788  */
1789  three_digits = 1;
1790  }
1791  if (get_sent)
1792  snprintf (kb, sizeof (kb), "FindService/tcp/%d/get_http",
1793  port);
1794  else
1795  snprintf (kb, sizeof (kb), "FindService/tcp/%d/spontaneous",
1796  port);
1797  plug_replace_key (desc, kb, ARG_STRING, banner);
1798 
1799  {
1800  char buf2[sizeof (buffer) * 2 + 1];
1801  int flag = 0;
1802  unsigned int y;
1803 
1804  strcat (kb, "Hex");
1805 
1806  if (len >= sizeof (buffer))
1807  len = sizeof (buffer);
1808 
1809  for (y = 0; y < len; y++)
1810  {
1811  snprintf (buf2 + 2 * y, sizeof (buf2) - (2 * y), "%02x",
1812  (unsigned char) banner[y]);
1813  if (banner[y] == '\0')
1814  flag = 1;
1815  }
1816  buf2[2 * y] = '\0';
1817  if (flag)
1818  plug_replace_key (desc, kb, ARG_STRING, buf2);
1819  }
1820 
1821  origline = g_strdup ((char *) banner);
1822  t = strchr (origline, '\n');
1823  if (t)
1824  t[0] = '\0';
1825  line_len = strlen (origline);
1826 
1827  /*
1828  * Many services run on the top of an HTTP protocol,
1829  * so the HTTP test is not an 'ELSE ... IF'
1830  */
1831  if ((!strncmp (line, "http/1.", 7)
1832  || strstr ((char *) banner,
1833  "<title>Not supported</title>")))
1834  { /* <- broken hp
1835  * jetdirect */
1836  flg++;
1837  if (!(port == 5000
1838  && (strstr (line, "http/1.1 400 bad request")
1839  != NULL))
1840  && !(strncmp (line, "http/1.0 403 forbidden",
1841  strlen ("http/1.0 403 forbidden"))
1842  == 0
1843  && strstr (buffer, "server: adsubtract")
1844  != NULL))
1845  mark_http_server (desc, port, banner, trp);
1846  }
1847  /*
1848  * RFC 854 defines commands between 240 and 254
1849  * shouldn't we look for them too?
1850  */
1851  if (((u_char) buffer[0] == 255)
1852  && (((u_char) buffer[1] == 251)
1853  || ((u_char) buffer[1] == 252)
1854  || ((u_char) buffer[1] == 253)
1855  || ((u_char) buffer[1] == 254)))
1856  mark_telnet_server (desc, port, trp);
1857  else if (((u_char) buffer[0] == 0)
1858  && ((u_char) buffer[1] == 1)
1859  && ((u_char) buffer[2] == 1)
1860  && ((u_char) buffer[3] == 0))
1861  mark_gnome14_server (desc, port, trp);
1862  else if (strncmp (line, "http/1.0 403 forbidden",
1863  strlen ("http/1.0 403 forbidden"))
1864  == 0
1865  && strstr (buffer, "server: adsubtract") != NULL)
1866  {
1867  mark_locked_adsubtract_server (desc, port, banner, trp);
1868  }
1869  else if (strstr ((char *) banner, "Eggdrop") != NULL
1870  && strstr ((char *) banner, "Eggheads") != NULL)
1871  mark_eggdrop_server (desc, port, trp);
1872  else if (strncmp (line, "$lock ", strlen ("$lock ")) == 0)
1873  mark_direct_connect_hub (desc, port, trp);
1874  else if (len > 34 && strstr (&(buffer[34]), "iss ecnra"))
1875  mark_iss_realsecure (desc, port);
1876  else if (len == 4 && origline[0] == 'Q' && origline[1] == 0
1877  && origline[2] == 0 && origline[3] == 0)
1878  mark_fw1 (desc, port, origline, trp);
1879  else if (strstr (line, "adsgone blocked html ad") != NULL)
1880  mark_adsgone (desc, port, origline, trp);
1881  else if (strncmp (line, "icy 200 ok", strlen ("icy 200 ok"))
1882  == 0)
1883  mark_shoutcast_server (desc, port, origline, trp);
1884  else if ((!strncmp (line, "200", 3)
1885  && (strstr (line,
1886  "running eudora internet mail server")))
1887  || (strstr (line, "+ok applepasswordserver")
1888  != NULL))
1889  mark_pop3pw_server (desc, port, origline, trp);
1890  else if ((strstr (line, "smtp")
1891  || strstr (line, "simple mail transfer")
1892  || strstr (line, "mail server")
1893  || strstr (line, "messaging")
1894  || strstr (line, "Weasel"))
1895  && !strncmp (line, "220", 3))
1896  mark_smtp_server (desc, port, origline, trp);
1897  else if (strstr (line, "220 ***************")
1898  || strstr (line, "220 eSafe@")) /* CISCO SMTP (?) -
1899  * see bug #175 */
1900  mark_smtp_server (desc, port, origline, trp);
1901  else if (strstr (line, "220 esafealert") != NULL)
1902  mark_smtp_server (desc, port, origline, trp);
1903  else if (strncmp (line, "220", 3) == 0
1904  && strstr (line, "groupwise internet agent") != NULL)
1905  mark_smtp_server (desc, port, origline, trp);
1906  else if (strncmp (line, "220", 3) == 0
1907  && strstr (line, " SNPP ") != NULL)
1908  mark_snpp_server (desc, port, origline, trp);
1909  else if (strncmp (line, "200", 3) == 0
1910  && strstr (line, "mail ") != NULL)
1911  mark_smtp_server (desc, port, origline, trp);
1912  else if (strncmp (line, "421", 3) == 0
1913  && strstr (line, "smtp ") != NULL)
1914  mark_smtp_server (desc, port, origline, trp);
1915  // Null characters in buffer were replaced by 'x'.
1916  else if ((line[0] != '\0'
1917  || (strstr (buffer, "mysql") != NULL))
1918  && (regex_match (
1919  buffer,
1920  "^.x{3}\n[0-9.]+ [0-9a-z]+@[0-9a-z]+ release")
1921  || regex_match (
1922  buffer,
1923  "^.x{3}\n[0-9.]+-(id[0-9]+-)?release"
1924  " \\([0-9a-z-]+\\)")))
1925  mark_sphinxql (desc, port);
1926  else if (line[0] != '\0'
1927  && ((strncmp (buffer + 1, "host '", 6) == 0)
1928  || (strstr (buffer, "mysql") != NULL
1929  || strstr (buffer, "mariadb") != NULL)))
1930  mark_mysql (desc, port);
1931  else if (!strncmp (line, "efatal", 6)
1932  || !strncmp (line, "einvalid packet length",
1933  strlen ("einvalid packet length")))
1934  mark_postgresql (desc, port);
1935  else if (strstr (line, "cvsup server ready") != NULL)
1936  mark_cvsupserver (desc, port);
1937  else if (!strncmp (line, "cvs [pserver aborted]:", 22)
1938  || !strncmp (line, "cvs [server aborted]:", 21))
1939  mark_cvspserver (desc, port);
1940  else if (!strncmp (line, "cvslock ", 8))
1941  mark_cvslockserver (desc, port);
1942  else if (!strncmp (line, "@rsyncd", 7))
1943  mark_rsync (desc, port);
1944  else if ((len == 4) && may_be_time ((time_t *) banner))
1945  mark_time_server (desc, port, trp);
1946  else if (strstr (buffer, "rmserver")
1947  || strstr (buffer, "realserver"))
1948  mark_rmserver (desc, port, origline, trp);
1949  else if ((strstr (line, "ftp") || strstr (line, "winsock")
1950  || strstr (line, "axis network camera")
1951  || strstr (line, "netpresenz")
1952  || strstr (line, "serv-u")
1953  || strstr (line, "service ready for new user"))
1954  && !strncmp (line, "220", 3))
1955  mark_ftp_server (desc, port, origline, trp);
1956  else if (strncmp (line, "220-", 4) == 0) /* FTP server with a
1957  * long banner */
1958  mark_ftp_server (desc, port, NULL, trp);
1959  else if (strstr (line, "220") && strstr (line, "whois+"))
1960  mark_whois_plus2_server (desc, port, origline, trp);
1961  else if (strstr (line, "520 command could not be executed"))
1962  mark_mon_server (desc, port, origline, trp);
1963  else if (strstr (line, "ssh-"))
1964  mark_ssh_server (desc, port, origline);
1965  else if (!strncmp (line, "+ok", 3)
1966  || (!strncmp (line, "+", 1) && strstr (line, "pop")))
1967  mark_pop_server (desc, port, origline);
1968  else if (strstr (line, "imap4") && !strncmp (line, "* ok", 4))
1969  mark_imap_server (desc, port, origline, trp);
1970  else if (strstr (line, "*ok iplanet messaging multiplexor"))
1971  mark_imap_server (desc, port, origline, trp);
1972  else if (strstr (line, "*ok communigate pro imap server"))
1973  mark_imap_server (desc, port, origline, trp);
1974  else if (strstr (line, "* ok courier-imap"))
1975  mark_imap_server (desc, port, origline, trp);
1976  else if (strncmp (line, "giop", 4) == 0)
1977  mark_giop_server (desc, port, trp);
1978  else if (strstr (line, "microsoft routing server"))
1979  mark_exchg_routing_server (desc, port, origline, trp);
1980  /* Apparently an iPlanet ENS server */
1981  else if (strstr (line, "gap service ready"))
1982  mark_ens_server (desc, port, trp);
1983  else if (strstr (line, "-service not available"))
1984  mark_tcpmux_server (desc, port, trp);
1985  /*
1986  * Citrix sends 7f 7f 49 43 41, that
1987  * we converted to lowercase
1988  */
1989  else if (strlen (line) > 2 && line[0] == 0x7F
1990  && line[1] == 0x7F
1991  && strncmp (&line[2], "ica", 3) == 0)
1992  mark_citrix_server (desc, port, trp);
1993 
1994  else if (strstr (origline, " INN ")
1995  || strstr (origline, " Leafnode ")
1996  || strstr (line, " nntp daemon")
1997  || strstr (line, " nnrp service ready")
1998  || strstr (line, "posting ok")
1999  || strstr (line, "posting allowed")
2000  || strstr (line, "502 no permission")
2001  || (strcmp (line, "502") == 0
2002  && strstr (line, "diablo") != NULL))
2003  mark_nntp_server (desc, port, origline, trp);
2004  else if (strstr (buffer, "networking/linuxconf")
2005  || strstr (buffer, "networking/misc/linuxconf")
2006  || strstr (buffer, "server: linuxconf"))
2007  mark_linuxconf (desc, port, banner);
2008  else if (strncmp (buffer, "gnudoit:", 8) == 0)
2009  mark_gnuserv (desc, port);
2010  else if ((buffer[0] == '0'
2011  && strstr (buffer, "error.host\t1") != NULL)
2012  || (buffer[0] == '3'
2013  && strstr (
2014  buffer,
2015  "That item is not currently available")))
2016  mark_gopher_server (desc, port);
2017  else if (strstr (buffer,
2018  "www-authenticate: basic realm=\"swat\""))
2019  mark_swat_server (desc, port);
2020  else if (strstr (buffer, "vqserver")
2021  && strstr (buffer,
2022  "www-authenticate: basic realm=/"))
2023  mark_vqserver (desc, port);
2024  else if (strstr (buffer, "1invalid request") != NULL)
2025  mark_mldonkey (desc, port);
2026  else if (strstr (buffer, "get: command not found"))
2027  mark_wild_shell (desc, port);
2028  else if (strstr (buffer, "microsoft windows") != NULL
2029  && strstr (buffer, "c:\\") != NULL
2030  && strstr (buffer, "(c) copyright 1985-") != NULL
2031  && strstr (buffer, "microsoft corp.") != NULL)
2032  mark_wild_shell (desc, port);
2033  else if (strstr (buffer, "netbus"))
2034  mark_netbus_server (desc, port);
2035  else if (strstr (line, "0 , 0 : error : unknown-error")
2036  || strstr (line, "0, 0: error: unknown-error")
2037  || strstr (line, "get : error : unknown-error")
2038  || strstr (line, "0 , 0 : error : invalid-port"))
2039  mark_auth_server (desc, port);
2040  else if (!strncmp (line, "http/1.", 7)
2041  && strstr (line, "proxy")) /* my proxy "HTTP/1.1
2042  * 502 Proxy Error" */
2043  mark_http_proxy (desc, port, trp);
2044  else if (!strncmp (line, "http/1.", 7)
2045  && strstr (buffer, "via: "))
2046  mark_http_proxy (desc, port, trp);
2047  else if (!strncmp (line, "http/1.", 7)
2048  && strstr (buffer, "proxy-connection: "))
2049  mark_http_proxy (desc, port, trp);
2050  else if (!strncmp (line, "http/1.", 7)
2051  && strstr (buffer, "cache")
2052  && strstr (line, "bad request"))
2053  mark_http_proxy (desc, port, trp);
2054  else if (!strncmp (origline, "RFB 00", 6)
2055  && strstr (line, ".00"))
2056  mark_vnc_server (desc, port, origline);
2057  else if (!strncmp (line, "ncacn_http/1.", 13))
2058  mark_ncacn_http_server (desc, port, origline);
2059  else if (line_len >= 14 && /* no ending \r\n */
2060  line_len <= 18 && /* full GET request
2061  * length */
2062  strncmp (origline, http_get, line_len) == 0)
2063  mark_echo_server (desc, port);
2064  else if (strstr ((char *) banner, "!\"#$%&'()*+,-./")
2065  && strstr ((char *) banner, "ABCDEFGHIJ")
2066  && strstr ((char *) banner, "abcdefghij")
2067  && strstr ((char *) banner, "0123456789"))
2068  mark_chargen_server (desc, port);
2069  else if (strstr (line, "vtun server"))
2070  mark_vtun_server (desc, port, banner, trp);
2071  else if (strcmp (line, "login: password: ") == 0)
2072  mark_uucp_server (desc, port, banner, trp);
2073  else if (strcmp (line, "bad request") == 0
2074  || /* See bug # 387 */
2075  strstr (
2076  line,
2077  "invalid protocol request (71): gget / http/1.0")
2078  || (strncmp (line, "lpd:", 4) == 0)
2079  || (strstr (line, "lpsched") != NULL)
2080  || (strstr (line, "malformed from address") != NULL)
2081  || (strstr (line, "no connect permissions") != NULL)
2082  || /* <- RH 8 lpd */
2083  strcmp (line, "bad request") == 0)
2084  mark_lpd_server (desc, port, trp);
2085  else if (strstr (line, "%%lyskom unsupported protocol"))
2086  mark_lyskom_server (desc, port, trp);
2087  else if (strstr (line, "598:get:command not recognized"))
2088  mark_ph_server (desc, port, trp);
2089  else if (strstr (line, "BitTorrent prot"))
2090  mark_BitTorrent_server (desc, port, trp);
2091  else if (banner[0] == 'A' && banner[1] == 0x01
2092  && banner[2] == 0x02 && banner[3] == '\0')
2093  mark_smux_server (desc, port, trp);
2094  else if (!strncmp (line, "0 succeeded\n",
2095  strlen ("0 succeeded\n")))
2096  mark_LISa_server (desc, port, trp);
2097  else if (strlen ((char *) banner) == 3 && banner[2] == '\n')
2098  mark_msdtc_server (desc, port);
2099  else if ((!strncmp (line, "220", 3)
2100  && strstr (line, "poppassd")))
2101  mark_pop3pw_server (desc, port, origline, trp);
2102  else if (strstr (line, "welcome!psybnc@") != NULL)
2103  mark_psybnc (desc, port, origline, trp);
2104  else if (strncmp (line, "* acap ", strlen ("* acap ")) == 0)
2105  mark_acap_server (desc, port, origline, trp);
2106  else if (strstr (origline, "Sorry, you (") != NULL
2107  && strstr (origline,
2108  "are not among the allowed hosts...\n")
2109  != NULL)
2110  mark_nagiosd_server (desc, port, trp);
2111  else if (strstr (line, "[ts].error") != NULL
2112  || strstr (line, "[ts].\n") != NULL)
2113  mark_teamspeak2_server (desc, port, trp);
2114  else if (strstr (origline, "Language received from client:")
2115  && strstr (origline, "Setlocale:"))
2116  mark_websm_server (desc, port, trp);
2117  else if (strncmp (origline, "CNFGAPI", 7) == 0)
2118  mark_ofa_express_server (desc, port, trp);
2119  else if (strstr (line, "suse meta pppd") != NULL)
2120  mark_smppd_server (desc, port, trp);
2121  else if (strncmp (origline, "ERR UNKNOWN-COMMAND",
2122  strlen ("ERR UNKNOWN-COMMAND"))
2123  == 0)
2124  mark_upsmon_server (desc, port, trp);
2125  else if (strncmp (line, "connected. ", strlen ("connected. "))
2126  == 0
2127  && strstr (line, "legends") != NULL)
2128  mark_sub7_server (desc, port, trp);
2129  else if (strncmp (line, "spamd/", strlen ("spamd/")) == 0)
2130  mark_spamd_server (desc, port, trp);
2131  else if (strstr (line, " dictd ")
2132  && strncmp (line, "220", 3) == 0)
2133  mark_dictd_server (desc, port, origline, trp);
2134  else if (strncmp (line, "220 ", 4) == 0
2135  && strstr (line, "vmware authentication daemon")
2136  != NULL)
2137  mark_vmware_auth (desc, port, origline, trp);
2138  else if (strncmp (line, "220 ", 4) == 0
2139  && strstr (line, "interscan version") != NULL)
2140  mark_interscan_viruswall (desc, port, origline, trp);
2141  else if ((strlen ((char *) banner) > 1) && (banner[0] == '~')
2142  && (banner[strlen ((char *) banner) - 1] == '~')
2143  && (strchr ((char *) banner, '}') != NULL))
2144  mark_ppp_daemon (desc, port, trp);
2145  else if (strstr ((char *) banner, "Hello, this is zebra ")
2146  != NULL)
2147  mark_zebra_server (desc, port, origline, trp);
2148  else if (strstr (line, "ircxpro ") != NULL)
2149  mark_ircxpro_admin_server (desc, port, trp);
2150  else if (strncmp (origline, "version report",
2151  strlen ("version report"))
2152  == 0)
2153  mark_gnocatan_server (desc, port, trp);
2154  else if (strncmp (origline, "RTSP/1.0", strlen ("RTSP/1.0"))
2155  && strstr (origline, "QTSS/") != NULL)
2156  mark_quicktime_streaming_server (desc, port, trp);
2157  else if (strlen (origline) >= 2 && origline[0] == 0x30
2158  && origline[1] == 0x11 && origline[2] == 0)
2159  mark_dameware_server (desc, port, trp);
2160  else if (strstr (line, "stonegate firewall") != NULL)
2161  mark_stonegate_auth_server (desc, port, trp);
2162  else if (strncmp (line, "pbmasterd", strlen ("pbmasterd"))
2163  == 0)
2164  mark_pbmaster_server (desc, port, origline, trp);
2165  else if (strncmp (line, "pblocald", strlen ("pblocald")) == 0)
2166  mark_pblocald_server (desc, port, origline, trp);
2167  else if (strncmp (
2168  line, "<stream:error>invalid xml</stream:error>",
2169  strlen (
2170  "<stream:error>invalid xml</stream:error>"))
2171  == 0)
2172  mark_jabber_server (desc, port, trp);
2173  else if (strncmp (line, "/c -2 get ctgetoptions",
2174  strlen ("/c -2 get ctgetoptions"))
2175  == 0)
2176  mark_avotus_mm_server (desc, port, origline, trp);
2177  else if (strncmp (line, "error:wrong password",
2178  strlen ("error:wrong password"))
2179  == 0)
2180  mark_pnsclient (desc, port, trp);
2181  else if (strncmp (line, "1000 2", strlen ("1000 2"))
2182  == 0)
2183  mark_veritas_backup (desc, port, trp);
2184  else if (strstr (line,
2185  "the file name you specified is invalid")
2186  && strstr (line, "listserv"))
2187  mark_listserv_server (desc, port, trp);
2188  else if (strncmp (line, "control password:",
2189  strlen ("control password:"))
2190  == 0)
2191  mark_fssniffer (desc, port, trp);
2192  else if (strncmp (line, "remotenc control password:",
2193  strlen ("remotenc control password:"))
2194  == 0)
2195  mark_remote_nc_server (desc, port, trp);
2196  else if (((p = (unsigned char *) strstr (
2197  (char *) banner, "finger: GET: no such user"))
2198  != NULL
2199  && strstr ((char *) banner,
2200  "finger: /: no such user")
2201  != NULL
2202  && strstr ((char *) banner,
2203  "finger: HTTP/1.0: no such user")
2204  != NULL))
2205  {
2206  char c = '\0';
2207  if (p != NULL)
2208  {
2209  while (p - banner > 0 && isspace (*p))
2210  p--;
2211  c = *p;
2212  *p = '\0';
2213  mark_finger_server (desc, port, trp);
2214  }
2215 
2216  if (p != NULL)
2217  *p = c;
2218  }
2219  else if (banner[0] == 5 && banner[1] <= 8 && banner[2] == 0
2220  && banner[3] <= 4)
2221  mark_socks_proxy (desc, port, 5);
2222  else if (banner[0] == 0 && banner[1] >= 90 && banner[1] <= 93)
2223  mark_socks_proxy (desc, port, 4);
2224  else
2225  unindentified_service = !flg;
2226  g_free (line);
2227  g_free (origline);
2228  }
2229  /* len >= 0 */
2230  else
2231  {
2232  unindentified_service = 1;
2233 #define TESTSTRING "OpenVAS Wrap Test"
2234  if (trp == OPENVAS_ENCAPS_IP && wrap_timeout > 0)
2235  maybe_wrapped = 1;
2236  }
2237  if (cnx > 0)
2239 
2240  /*
2241  * I'll clean this later. Meanwhile, we will not print a silly
2242  * message for rsh and rlogin.
2243  */
2244  if (port == 513 /* rlogin */ || port == 514 /* rsh */)
2245  maybe_wrapped = 0;
2246 
2247  if (maybe_wrapped /* && trp ==
2248  * OPENVAS_ENCAPS_IP &&
2249  wrap_timeout > 0 */ )
2250  {
2251  int nfd, fd, x, flag = 0;
2252  char b;
2253 
2254  nfd = open_stream_connection (desc, port, OPENVAS_ENCAPS_IP,
2255  cnx_timeout);
2256  if (nfd >= 0)
2257  {
2259  select_again2:
2260  FD_ZERO (&rfds);
2261  FD_SET (fd, &rfds);
2262  tv.tv_sec = wrap_timeout;
2263  tv.tv_usec = 0;
2264 
2265  signal (SIGALRM, SIG_IGN);
2266 
2267  (void) gettimeofday (&tv1, NULL);
2268  x = select (fd + 1, &rfds, NULL, NULL, &tv);
2269  (void) gettimeofday (&tv2, NULL);
2270  diff_tv2 = DIFFTV1000 (tv2, tv1);
2271  if (x < 0)
2272  {
2273  if (errno == EINTR)
2274  goto select_again2;
2275  perror ("select");
2276  }
2277  else if (x > 0)
2278  {
2279  errno = 0;
2280  x = recv (fd, &b, 1, MSG_DONTWAIT);
2281  if (x == 0 || (x < 0 && errno == EPIPE))
2282  {
2283  /*
2284  * If the service quickly closes the connection
2285  * when we send garbage but not when we don't send
2286  * anything, it is not wrapped
2287  */
2288  flag = 1;
2289  }
2290  }
2291  else
2292  {
2293  /*
2294  * Timeout - one last
2295  * check
2296  */
2297  errno = 0;
2298  if (send (fd, "Z", 1, MSG_DONTWAIT) < 0)
2299  {
2300  perror ("send");
2301  if (errno == EPIPE)
2302  flag = 1;
2303  }
2304  }
2306  if (flag)
2307  {
2308  if (diff_tv2 <= 2 * diff_tv + 1)
2309  {
2310  mark_wrapped_svc (desc, port, diff_tv2 / 1000);
2311  unindentified_service = 0;
2312  }
2313  }
2314  }
2315  }
2316 
2317  if (unindentified_service && port != 139 && port != 135
2318  && port != 445)
2319  /*
2320  * port 139 can't be marked as
2321  * 'unknown'
2322  */
2323  {
2324  unknown[num_unknown++] = port;
2325  /*
2326  * find_service_3digits will run
2327  * after us
2328  */
2329  if (!three_digits)
2330  mark_unknown_svc (desc, port, banner, trp);
2331  }
2332  g_free (banner);
2333  }
2334  }
2335  h = h->next;
2336  }
2337  g_free (http_get);
2338 
2339  return 0;
2340 }

References ARG_INT, ARG_STRING, close_stream_connection(), CNX_TIMEOUT_PREF, DIFFTV1000, get_encaps_name(), get_plugin_preference(), http_get(), IS_ENCAPS_SSL, 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_fssniffer(), 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_ncacn_http_server(), mark_netbus_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_sub7_server(), mark_swat_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_vnc_server(), mark_vqserver(), mark_vtun_server(), mark_websm_server(), mark_whois_plus2_server(), mark_wild_shell(), mark_wrapped_svc(), mark_zebra_server(), may_be_time(), oid, open_stream_connection(), OPENVAS_ENCAPS_IP, OPENVAS_ENCAPS_TLScustom, openvas_get_socket_from_connection(), plug_get_host_fqdn(), plug_get_key(), plug_replace_key(), plug_set_key(), plug_set_port_transport(), post_log(), read_stream_connection(), read_stream_connection_min(), regex_match(), RW_TIMEOUT_PREF, stream_set_timeout(), timeval(), WRAP_TIMEOUT_PREF, and write_stream_connection().

Referenced by plugin_run_find_service().

Here is the caller graph for this function:

◆ plugin_run_find_service()

tree_cell* plugin_run_find_service ( lex_ctxt lexic)

Definition at line 2373 of file nasl_builtin_find_service.c.

2374 {
2375  struct script_infos *desc = lexic->script_infos;
2376 
2377  oid = lexic->oid;
2378 
2379  kb_t kb = plug_get_kb (desc);
2380  struct kb_item *kbitem, *kbitem_tmp;
2381 
2382  GSList *sons_args[MAX_SONS];
2383  int num_ports = 0;
2384  char *num_sons_s;
2385  int num_sons = 6;
2386  int port_per_son;
2387  int i;
2388  int test_ssl = 1;
2389  char *key = get_plugin_preference (oid, KEY_FILE, -1);
2390  char *cert = get_plugin_preference (oid, CERT_FILE, -1);
2391  char *pempass = get_plugin_preference (oid, PEM_PASS, -1);
2392  char *cafile = get_plugin_preference (oid, CA_FILE, -1);
2393  char *test_ssl_s = get_plugin_preference (oid, TEST_SSL_PREF, -1);
2394 
2395  if (key && key[0] != '\0')
2396  key = (char *) get_plugin_preference_fname (desc, key);
2397  else
2398  key = NULL;
2399 
2400  if (cert && cert[0] != '\0')
2401  cert = (char *) get_plugin_preference_fname (desc, cert);
2402  else
2403  cert = NULL;
2404 
2405  if (cafile && cafile[0] != '\0')
2406  cafile = (char *) get_plugin_preference_fname (desc, cafile);
2407  else
2408  cafile = NULL;
2409 
2410  if (test_ssl_s != NULL)
2411  {
2412  if (strcmp (test_ssl_s, "None") == 0)
2413  test_ssl = 0;
2414  }
2415  g_free (test_ssl_s);
2416  if (key || cert)
2417  {
2418  if (!key)
2419  key = cert;
2420  if (!cert)
2421  cert = key;
2422  plug_set_ssl_cert (desc, cert);
2423  plug_set_ssl_key (desc, key);
2424  }
2425  if (pempass != NULL)
2426  plug_set_ssl_pem_password (desc, pempass);
2427  if (cafile != NULL)
2428  plug_set_ssl_CA_file (desc, cafile);
2429 
2430  signal (SIGTERM, sigterm);
2431  signal (SIGCHLD, sigchld);
2432  num_sons_s = get_plugin_preference (oid, NUM_CHILDREN, -1);
2433  if (num_sons_s != NULL)
2434  num_sons = atoi (num_sons_s);
2435  g_free (num_sons_s);
2436 
2437  if (num_sons <= 0)
2438  num_sons = 6;
2439 
2440  if (num_sons > MAX_SONS)
2441  num_sons = MAX_SONS;
2442 
2443  for (i = 0; i < num_sons; i++)
2444  {
2445  sons[i] = 0;
2446  sons_args[i] = NULL;
2447  }
2448 
2449  if (kb == NULL)
2450  return NULL; // TODO: in old days returned "1". Still relevant?
2451 
2452  kbitem = kb_item_get_pattern (kb, "Ports/tcp/*");
2453 
2454  /* count the number of open TCP ports */
2455  kbitem_tmp = kbitem;
2456  while (kbitem_tmp != NULL)
2457  {
2458  num_ports++;
2459  kbitem_tmp = kbitem_tmp->next;
2460  }
2461 
2462  port_per_son = num_ports / num_sons;
2463 
2464  /* The next two loops distribute the ports across a number of 'sons'.
2465  */
2466 
2467  kbitem_tmp = kbitem;
2468 
2469  for (i = 0; i < num_sons; i = i + 1)
2470  {
2471  int j;
2472 
2473  if (kbitem_tmp != NULL)
2474  {
2475  for (j = 0; j < port_per_son && kbitem_tmp != NULL;)
2476  {
2477  sons_args[i] =
2478  g_slist_prepend (sons_args[i], g_strdup (kbitem_tmp->name));
2479  j++;
2480  kbitem_tmp = kbitem_tmp->next;
2481  }
2482  }
2483  else
2484  break;
2485  }
2486 
2487  for (i = 0; (i < num_ports % num_sons) && kbitem_tmp != NULL;)
2488  {
2489  sons_args[i] =
2490  g_slist_prepend (sons_args[i], g_strdup (kbitem_tmp->name));
2491  i++;
2492  kbitem_tmp = kbitem_tmp->next;
2493  }
2494 
2495  kb_item_free (kbitem);
2496 
2497  for (i = 0; i < num_sons; i++)
2498  if (sons_args[i] == NULL)
2499  break;
2500 
2501  num_sons = i;
2502 
2503  for (i = 0; i < num_sons; i++)
2504  {
2505  usleep (5000);
2506  if (sons_args[i] != NULL)
2507  {
2508  sons[i] = fork ();
2509  if (sons[i] == 0)
2510  {
2511  kb_lnk_reset (kb);
2512  nvticache_reset ();
2513  signal (SIGTERM, _exit);
2514  plugin_do_run (desc, sons_args[i], test_ssl);
2515  exit (0);
2516  }
2517  else
2518  {
2519  if (sons[i] < 0)
2520  sons[i] = 0; /* Fork failed */
2521  }
2522  g_slist_free_full (sons_args[i], g_free);
2523  }
2524  }
2525 
2526  for (;;)
2527  {
2528  int flag = 0;
2529 
2530  for (i = 0; i < num_sons; i++)
2531  {
2532  if (sons[i] != 0)
2533  {
2534  while (waitpid (sons[i], NULL, WNOHANG) && errno == EINTR)
2535  ;
2536 
2537  if (kill (sons[i], 0) >= 0)
2538  flag++;
2539  }
2540  }
2541 
2542  if (flag == 0)
2543  break;
2544  usleep (100000);
2545  }
2546 
2547  return NULL;
2548 }

References CA_FILE, CERT_FILE, get_plugin_preference(), get_plugin_preference_fname(), KEY_FILE, MAX_SONS, NUM_CHILDREN, struct_lex_ctxt::oid, oid, PEM_PASS, plug_get_kb(), plug_set_ssl_CA_file(), plug_set_ssl_cert(), plug_set_ssl_key(), plug_set_ssl_pem_password(), plugin_do_run(), struct_lex_ctxt::script_infos, sigchld(), sigterm(), sons, and TEST_SSL_PREF.

Here is the call graph for this function:

◆ port_to_name()

static const char* port_to_name ( int  port)
static

Definition at line 1145 of file nasl_builtin_find_service.c.

1146 {
1147  /* Note: only includes services that are recognized by this plugin! */
1148  switch (port)
1149  {
1150  case 7:
1151  return "Echo";
1152  case 19:
1153  return "Chargen";
1154  case 21:
1155  return "FTP";
1156  case 22:
1157  return "SSH";
1158  case 23:
1159  return "Telnet";
1160  case 25:
1161  return "SMTP";
1162  case 37:
1163  return "Time";
1164  case 70:
1165  return "Gopher";
1166  case 79:
1167  return "Finger";
1168  case 80:
1169  return "HTTP";
1170  case 98:
1171  return "Linuxconf";
1172  case 109:
1173  return "POP2";
1174  case 110:
1175  return "POP3";
1176  case 113:
1177  return "AUTH";
1178  case 119:
1179  return "NNTP";
1180  case 143:
1181  return "IMAP";
1182  case 220:
1183  return "IMAP3";
1184  case 443:
1185  return "HTTPS";
1186  case 465:
1187  return "SMTPS";
1188  case 563:
1189  return "NNTPS";
1190  case 593:
1191  return "Http-Rpc-Epmap";
1192  case 873:
1193  return "Rsyncd";
1194  case 901:
1195  return "SWAT";
1196  case 993:
1197  return "IMAPS";
1198  case 995:
1199  return "POP3S";
1200  case 1109:
1201  return "KPOP"; /* ? */
1202  case 2309:
1203  return "Compaq Management Server";
1204  case 2401:
1205  return "CVSpserver";
1206  case 3128:
1207  return "Squid";
1208  case 3306:
1209  return "MySQL";
1210  case 5000:
1211  return "VTUN";
1212  case 5432:
1213  return "Postgres";
1214  case 8080:
1215  return "HTTP-Alt";
1216  }
1217  return NULL;
1218 }

Referenced by mark_unknown_svc().

Here is the caller graph for this function:

◆ 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.

Definition at line 94 of file nasl_builtin_find_service.c.

95 {
96  regex_t re;
97  int ret = 1;
98 
99  if (regcomp (&re, pattern, REG_EXTENDED | REG_NOSUB | REG_ICASE))
100  ret = 0;
101  if (regexec (&re, string, 0, NULL, 0))
102  ret = 0;
103 
104  regfree (&re);
105  return ret;
106 }

Referenced by plugin_do_run().

Here is the caller graph for this function:

◆ register_service()

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

Definition at line 60 of file nasl_builtin_find_service.c.

61 {
62  char k[265];
63 
64  /* Old "magical" key set */
65  snprintf (k, sizeof (k), "Services/%s", proto);
66  /* Do NOT use plug_replace_key! */
67  plug_set_key (desc, k, ARG_INT, GSIZE_TO_POINTER (port));
68 
69  /*
70  * 2002-08-24 - MA - My new key set There is a problem: if
71  * register_service is called twice for a port, e.g. first with HTTP
72  * and then with SWAT, the plug_get_key function will fork. This
73  * would not happen if we registered a boolean (i.e. "known") instead
74  * of the name of the protocol. However, we *need* this name for some
75  * scripts. We'll just have to keep in mind that a fork is
76  * possible...
77  *
78  * 2005-06-01 - MA - with plug_replace_key the problem is solved, but I
79  * wonder if this is so great...
80  */
81  snprintf (k, sizeof (k), "Known/tcp/%d", port);
82  plug_replace_key (desc, k, ARG_STRING, (char *) proto);
83 }

References ARG_INT, ARG_STRING, plug_replace_key(), and plug_set_key().

Referenced by 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_fssniffer(), 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_ncacn_http_server(), mark_netbus_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_sub7_server(), mark_swat_server(), mark_tcpmux_server(), mark_teamspeak2_server(), mark_telnet_server(), mark_time_server(), mark_upsmon_server(), mark_uucp_server(), mark_veritas_backup(), mark_vmware_auth(), mark_vnc_server(), mark_vqserver(), mark_vtun_server(), mark_websm_server(), mark_whois_plus2_server(), mark_wild_shell(), and mark_zebra_server().

Here is the call graph for this function:

◆ sigchld()

static void sigchld ( int  s)
static

Definition at line 2361 of file nasl_builtin_find_service.c.

2362 {
2363  int i;
2364 
2365  (void) s;
2366  for (i = 0; i < MAX_SONS; i++)
2367  {
2368  waitpid (sons[i], NULL, WNOHANG);
2369  }
2370 }

References MAX_SONS, and sons.

Referenced by plugin_run_find_service().

Here is the caller graph for this function:

◆ sigterm()

static void sigterm ( int  s)
static

Definition at line 2347 of file nasl_builtin_find_service.c.

2348 {
2349  int i;
2350 
2351  (void) s;
2352  for (i = 0; i < MAX_SONS; i++)
2353  {
2354  if (sons[i] != 0)
2355  kill (sons[i], SIGTERM);
2356  }
2357  _exit (0);
2358 }

References MAX_SONS, and sons.

Referenced by plugin_run_find_service().

Here is the caller graph for this function:

Variable Documentation

◆ oid

const char* oid

Definition at line 57 of file nasl_builtin_find_service.c.

Referenced by check_dependency_cycles(), exec_nasl_script(), get_plugin_preference(), get_script_oid(), launch_plugin(), 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_fssniffer(), 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_netbus_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_sub7_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_wild_shell(), mark_wrapped_svc(), mark_zebra_server(), nasl_plugin_launch(), plugin_add(), plugin_do_run(), plugin_run_find_service(), plugins_scheduler_enable(), post_alarm(), post_error(), post_log(), proto_post_alarm(), proto_post_error(), proto_post_log(), proto_post_wrapped(), required_ports_in_list(), simple_register_host_detail(), simult_ports(), and update_running_processes().

◆ sons

pid_t sons[MAX_SONS]
static

Definition at line 2344 of file nasl_builtin_find_service.c.

Referenced by plugin_run_find_service(), sigchld(), and sigterm().

WRAP_TIMEOUT_PREF
#define WRAP_TIMEOUT_PREF
Definition: nasl_builtin_find_service.c:46
mark_chargen_server
static void mark_chargen_server(struct script_infos *desc, int port)
Definition: nasl_builtin_find_service.c:109
mark_time_server
static void mark_time_server(struct script_infos *desc, int port, int trp)
Definition: nasl_builtin_find_service.c:607
mark_echo_server
void mark_echo_server(struct script_infos *desc, int port)
Definition: nasl_builtin_find_service.c:116
mark_ftp_server
void mark_ftp_server(struct script_infos *desc, int port, char *buffer, int trp)
Definition: nasl_builtin_find_service.c:275
script_infos
Definition: scanneraux.h:43
mark_cvsupserver
void mark_cvsupserver(struct script_infos *desc, int port)
Definition: nasl_builtin_find_service.c:425
mark_lpd_server
static void mark_lpd_server(struct script_infos *desc, int port, int trp)
Definition: nasl_builtin_find_service.c:570
mark_nagiosd_server
static void mark_nagiosd_server(struct script_infos *desc, int port, int trp)
Definition: nasl_builtin_find_service.c:918
KEY_FILE
#define KEY_FILE
Definition: nasl_builtin_find_service.c:41
mark_iss_realsecure
static void mark_iss_realsecure(struct script_infos *desc, int port)
Definition: nasl_builtin_find_service.c:1252
DIFF_1970_1900
#define DIFF_1970_1900
Definition: nasl_builtin_find_service.c:1464
plug_replace_key
void plug_replace_key(struct script_infos *args, char *name, int type, void *value)
Definition: plugutils.c:646
mark_finger_server
static void mark_finger_server(struct script_infos *desc, int port, int trp)
Definition: nasl_builtin_find_service.c:514
post_alarm
void post_alarm(const char *oid, struct script_infos *desc, int port, const char *action)
Definition: plugutils.c:355
plug_get_key
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.
Definition: plugutils.c:730
may_be_time
static int may_be_time(time_t *rtime)
Definition: nasl_builtin_find_service.c:1467
OPENVAS_ENCAPS_IP
@ OPENVAS_ENCAPS_IP
Definition: network.h:45
MAX_SONS
#define MAX_SONS
Definition: nasl_builtin_find_service.c:2342
mark_ircxpro_admin_server
static void mark_ircxpro_admin_server(struct script_infos *desc, int port, int trp)
Definition: nasl_builtin_find_service.c:1312
plug_get_kb
kb_t plug_get_kb(struct script_infos *args)
Definition: plugutils.c:658
sons
static pid_t sons[MAX_SONS]
Definition: nasl_builtin_find_service.c:2344
mark_mon_server
static void mark_mon_server(struct script_infos *desc, int port, char *buffer, int trp)
Definition: nasl_builtin_find_service.c:788
open_stream_connection
int open_stream_connection(struct script_infos *args, unsigned int port, int transport, int timeout)
Definition: network.c:992
mark_http_server
void mark_http_server(struct script_infos *desc, int port, unsigned char *buffer, int trp)
Definition: nasl_builtin_find_service.c:183
mark_dameware_server
static void mark_dameware_server(struct script_infos *desc, int port, int trp)
Definition: nasl_builtin_find_service.c:1068
plug_get_host_fqdn
char * plug_get_host_fqdn(struct script_infos *args)
Definition: plugutils.c:211
mark_mldonkey
void mark_mldonkey(struct script_infos *desc, int port)
Definition: nasl_builtin_find_service.c:174
mark_fw1
static void mark_fw1(struct script_infos *desc, int port, char *buffer, int trp)
Definition: nasl_builtin_find_service.c:800
mark_swat_server
void mark_swat_server(struct script_infos *desc, int port)
Definition: nasl_builtin_find_service.c:162
plug_set_ssl_key
void plug_set_ssl_key(struct script_infos *args, char *key)
Definition: plugutils.c:915
mark_netbus_server
void mark_netbus_server(struct script_infos *desc, int port)
Definition: nasl_builtin_find_service.c:497
mark_remote_nc_server
void mark_remote_nc_server(struct script_infos *desc, int port, int trp)
Definition: nasl_builtin_find_service.c:1115
mark_lyskom_server
static void mark_lyskom_server(struct script_infos *desc, int port, int trp)
Definition: nasl_builtin_find_service.c:583
openvas_get_socket_from_connection
int openvas_get_socket_from_connection(int fd)
Definition: network.c:367
mark_cvspserver
void mark_cvspserver(struct script_infos *desc, int port)
Definition: nasl_builtin_find_service.c:417
plugin_do_run
static int plugin_do_run(struct script_infos *desc, GSList *h, int test_ssl)
Definition: nasl_builtin_find_service.c:1482
timeval
struct timeval timeval(unsigned long val)
Definition: nasl_builtin_synscan.c:105
mark_gnocatan_server
static void mark_gnocatan_server(struct script_infos *desc, int port, int trp)
Definition: nasl_builtin_find_service.c:1325
RW_TIMEOUT_PREF
#define RW_TIMEOUT_PREF
Definition: nasl_builtin_find_service.c:45
mark_pop3pw_server
static void mark_pop3pw_server(struct script_infos *desc, int port, char *buffer, int trp)
Definition: nasl_builtin_find_service.c:740
get_encaps_name
const char * get_encaps_name(openvas_encaps_t code)
Definition: network.c:1546
plug_set_ssl_CA_file
void plug_set_ssl_CA_file(struct script_infos *args, char *key)
Definition: plugutils.c:931
mark_teamspeak2_server
static void mark_teamspeak2_server(struct script_infos *desc, int port, int trp)
Definition: nasl_builtin_find_service.c:935
mark_adsgone
static void mark_adsgone(struct script_infos *desc, int port, char *buffer, int trp)
Definition: nasl_builtin_find_service.c:859
post_log
void post_log(const char *oid, struct script_infos *desc, int port, const char *action)
Post a log message about a tcp port.
Definition: plugutils.c:375
mark_vtun_server
static void mark_vtun_server(struct script_infos *desc, int port, unsigned char *banner, int trp)
Definition: nasl_builtin_find_service.c:527
mark_LISa_server
static void mark_LISa_server(struct script_infos *desc, int port, int trp)
Definition: nasl_builtin_find_service.c:715
mark_giop_server
static void mark_giop_server(struct script_infos *desc, int port, int trp)
Definition: nasl_builtin_find_service.c:644
mark_ppp_daemon
static void mark_ppp_daemon(struct script_infos *desc, int port, int trp)
Definition: nasl_builtin_find_service.c:1286
OPENVAS_ENCAPS_TLScustom
@ OPENVAS_ENCAPS_TLScustom
Definition: network.h:52
mark_acap_server
static void mark_acap_server(struct script_infos *desc, int port, char *buffer, int trp)
Definition: nasl_builtin_find_service.c:890
oid
const char * oid
Definition: nasl_builtin_find_service.c:57
mark_smppd_server
static void mark_smppd_server(struct script_infos *desc, int port, int trp)
Definition: nasl_builtin_find_service.c:990
mark_pop_server
void mark_pop_server(struct script_infos *desc, int port, char *buffer)
Definition: nasl_builtin_find_service.c:331
mark_ens_server
static void mark_ens_server(struct script_infos *desc, int port, int trp)
Definition: nasl_builtin_find_service.c:619
mark_jabber_server
static void mark_jabber_server(struct script_infos *desc, int port, int trp)
Definition: nasl_builtin_find_service.c:1406
plug_set_port_transport
void plug_set_port_transport(struct script_infos *args, int port, int tr)
Definition: plugutils.c:872
mark_zebra_server
static void mark_zebra_server(struct script_infos *desc, int port, char *buffer, int trp)
Definition: nasl_builtin_find_service.c:1298
mark_postgresql
void mark_postgresql(struct script_infos *desc, int port)
Definition: nasl_builtin_find_service.c:392
mark_telnet_server
void mark_telnet_server(struct script_infos *desc, int port, int trp)
Definition: nasl_builtin_find_service.c:457
port_to_name
static const char * port_to_name(int port)
Definition: nasl_builtin_find_service.c:1145
mark_rsync
void mark_rsync(struct script_infos *desc, int port)
Definition: nasl_builtin_find_service.c:440
CNX_TIMEOUT_PREF
#define CNX_TIMEOUT_PREF
Definition: nasl_builtin_find_service.c:44
read_stream_connection
int read_stream_connection(int fd, void *buf0, int len)
Definition: network.c:1272
IS_ENCAPS_SSL
#define IS_ENCAPS_SSL(x)
Definition: network.h:56
mark_quicktime_streaming_server
static void mark_quicktime_streaming_server(struct script_infos *desc, int port, int trp)
Definition: nasl_builtin_find_service.c:1056
mark_vnc_server
void mark_vnc_server(struct script_infos *desc, int port, char *buffer)
Definition: nasl_builtin_find_service.c:141
mark_citrix_server
static void mark_citrix_server(struct script_infos *desc, int port, int trp)
Definition: nasl_builtin_find_service.c:632
get_plugin_preference
char * get_plugin_preference(const char *oid, const char *name, int pref_id)
Get the a plugins preference.
Definition: plugutils.c:408
struct_lex_ctxt::oid
const char * oid
Definition: nasl_lex_ctxt.h:42
mark_interscan_viruswall
static void mark_interscan_viruswall(struct script_infos *desc, int port, char *buffer, int trp)
Definition: nasl_builtin_find_service.c:1272
mark_mysql
void mark_mysql(struct script_infos *desc, int port)
Definition: nasl_builtin_find_service.c:409
read_stream_connection_min
int read_stream_connection_min(int fd, void *buf0, int min_len, int max_len)
Definition: network.c:1212
mark_whois_plus2_server
static void mark_whois_plus2_server(struct script_infos *desc, int port, char *buffer, int trp)
Definition: nasl_builtin_find_service.c:766
mark_gnome14_server
void mark_gnome14_server(struct script_infos *desc, int port, int trp)
Definition: nasl_builtin_find_service.c:470
mark_smtp_server
void mark_smtp_server(struct script_infos *desc, int port, char *buffer, int trp)
Definition: nasl_builtin_find_service.c:230
ABS
#define ABS(x)
mark_pbmaster_server
static void mark_pbmaster_server(struct script_infos *desc, int port, char *buffer, int trp)
Definition: nasl_builtin_find_service.c:1339
get_encaps_through
const char * get_encaps_through(openvas_encaps_t code)
Definition: network.c:1577
struct_lex_ctxt::script_infos
struct script_infos * script_infos
Definition: nasl_lex_ctxt.h:41
mark_wrapped_svc
static void mark_wrapped_svc(struct script_infos *desc, int port, int delta)
Definition: nasl_builtin_find_service.c:1130
mark_sphinxql
void mark_sphinxql(struct script_infos *desc, int port)
Definition: nasl_builtin_find_service.c:400
mark_veritas_backup
static void mark_veritas_backup(struct script_infos *desc, int port, int trp)
Definition: nasl_builtin_find_service.c:1381
register_service
static void register_service(struct script_infos *desc, int port, const char *proto)
Definition: nasl_builtin_find_service.c:60
mark_BitTorrent_server
static void mark_BitTorrent_server(struct script_infos *desc, int port, int trp)
Definition: nasl_builtin_find_service.c:686
mark_listserv_server
void mark_listserv_server(struct script_infos *desc, int port, int trp)
Definition: nasl_builtin_find_service.c:1089
PEM_PASS
#define PEM_PASS
Definition: nasl_builtin_find_service.c:42
mark_websm_server
static void mark_websm_server(struct script_infos *desc, int port, int trp)
Definition: nasl_builtin_find_service.c:959
mark_shoutcast_server
static void mark_shoutcast_server(struct script_infos *desc, int port, char *buffer, int trp)
Definition: nasl_builtin_find_service.c:841
mark_vmware_auth
static void mark_vmware_auth(struct script_infos *desc, int port, char *buffer, int trp)
Definition: nasl_builtin_find_service.c:1259
mark_gnuserv
static void mark_gnuserv(struct script_infos *desc, int port)
Definition: nasl_builtin_find_service.c:1245
mark_eggdrop_server
void mark_eggdrop_server(struct script_infos *desc, int port, int trp)
Definition: nasl_builtin_find_service.c:483
mark_ph_server
static void mark_ph_server(struct script_infos *desc, int port, int trp)
Definition: nasl_builtin_find_service.c:596
get_plugin_preference_fname
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".
Definition: plugutils.c:486
mark_cvslockserver
void mark_cvslockserver(struct script_infos *desc, int port)
Definition: nasl_builtin_find_service.c:432
ARG_INT
#define ARG_INT
Definition: plugutils.h:34
mark_auth_server
void mark_auth_server(struct script_infos *desc, int port)
Definition: nasl_builtin_find_service.c:381
sigterm
static void sigterm(int s)
Definition: nasl_builtin_find_service.c:2347
mark_snpp_server
void mark_snpp_server(struct script_infos *desc, int port, char *buffer, int trp)
Definition: nasl_builtin_find_service.c:255
MAX_SHIFT
#define MAX_SHIFT
Definition: nasl_builtin_find_service.c:1463
mark_smux_server
static void mark_smux_server(struct script_infos *desc, int port, int trp)
Definition: nasl_builtin_find_service.c:698
mark_fssniffer
void mark_fssniffer(struct script_infos *desc, int port, int trp)
Definition: nasl_builtin_find_service.c:1102
mark_direct_connect_hub
static void mark_direct_connect_hub(struct script_infos *desc, int port, int trp)
Definition: nasl_builtin_find_service.c:1443
DIFFTV1000
#define DIFFTV1000(t1, t2)
mark_uucp_server
static void mark_uucp_server(struct script_infos *desc, int port, unsigned char *banner, int trp)
Definition: nasl_builtin_find_service.c:553
mark_wild_shell
void mark_wild_shell(struct script_infos *desc, int port)
Definition: nasl_builtin_find_service.c:447
CERT_FILE
#define CERT_FILE
Definition: nasl_builtin_find_service.c:40
mark_nntp_server
void mark_nntp_server(struct script_infos *desc, int port, char *buffer, int trp)
Definition: nasl_builtin_find_service.c:150
CA_FILE
#define CA_FILE
Definition: nasl_builtin_find_service.c:43
mark_unknown_svc
static void mark_unknown_svc(struct script_infos *desc, int port, const unsigned char *banner, int trp)
Definition: nasl_builtin_find_service.c:1221
plug_set_ssl_cert
void plug_set_ssl_cert(struct script_infos *args, char *cert)
Definition: plugutils.c:909
http_get
tree_cell * http_get(lex_ctxt *lexic)
Definition: nasl_http.c:199
mark_stonegate_auth_server
static void mark_stonegate_auth_server(struct script_infos *desc, int port, int trp)
Definition: nasl_builtin_find_service.c:1078
plug_set_ssl_pem_password
void plug_set_ssl_pem_password(struct script_infos *args, char *key)
Definition: plugutils.c:921
regex_match
static int regex_match(char *string, char *pattern)
Compares string with the regular expression. Null characters in buffer are replaced by 'x'.
Definition: nasl_builtin_find_service.c:94
mark_sub7_server
static void mark_sub7_server(struct script_infos *desc, int port, int trp)
Definition: nasl_builtin_find_service.c:1027
plug_set_key
void plug_set_key(struct script_infos *args, char *name, int type, const void *value)
Definition: plugutils.c:616
write_stream_connection
int write_stream_connection(int fd, void *buf0, int n)
Definition: network.c:1396
mark_ssh_server
void mark_ssh_server(struct script_infos *desc, int port, char *buffer)
Definition: nasl_builtin_find_service.c:310
mark_locked_adsubtract_server
void mark_locked_adsubtract_server(struct script_infos *desc, int port, unsigned char *buffer, int trp)
Definition: nasl_builtin_find_service.c:196
close_stream_connection
int close_stream_connection(int fd)
Definition: network.c:1518
sigchld
static void sigchld(int s)
Definition: nasl_builtin_find_service.c:2361
TEST_SSL_PREF
#define TEST_SSL_PREF
Definition: nasl_builtin_find_service.c:47
mark_http_proxy
void mark_http_proxy(struct script_infos *desc, int port, int trp)
Definition: nasl_builtin_find_service.c:320
mark_upsmon_server
static void mark_upsmon_server(struct script_infos *desc, int port, int trp)
Definition: nasl_builtin_find_service.c:1008
mark_ncacn_http_server
void mark_ncacn_http_server(struct script_infos *desc, int port, char *buffer)
Definition: nasl_builtin_find_service.c:123
mark_tcpmux_server
static void mark_tcpmux_server(struct script_infos *desc, int port, int trp)
Definition: nasl_builtin_find_service.c:674
mark_socks_proxy
static void mark_socks_proxy(struct script_infos *desc, int port, int ver)
Definition: nasl_builtin_find_service.c:1431
mark_msdtc_server
static void mark_msdtc_server(struct script_infos *desc, int port)
Definition: nasl_builtin_find_service.c:733
mark_avotus_mm_server
static void mark_avotus_mm_server(struct script_infos *desc, int port, char *buffer, int trp)
Definition: nasl_builtin_find_service.c:1417
mark_gopher_server
static void mark_gopher_server(struct script_infos *desc, int port)
Definition: nasl_builtin_find_service.c:210
mark_ofa_express_server
static void mark_ofa_express_server(struct script_infos *desc, int port, int trp)
Definition: nasl_builtin_find_service.c:973
mark_pblocald_server
static void mark_pblocald_server(struct script_infos *desc, int port, char *buffer, int trp)
Definition: nasl_builtin_find_service.c:1392
mark_dictd_server
static void mark_dictd_server(struct script_infos *desc, int port, char *buffer, int trp)
Definition: nasl_builtin_find_service.c:1354
ARG_STRING
#define ARG_STRING
Definition: plugutils.h:33
NUM_CHILDREN
#define NUM_CHILDREN
Definition: nasl_builtin_find_service.c:49
mark_vqserver
void mark_vqserver(struct script_infos *desc, int port)
Definition: nasl_builtin_find_service.c:168
mark_imap_server
void mark_imap_server(struct script_infos *desc, int port, char *buffer, int trp)
Definition: nasl_builtin_find_service.c:367
mark_rmserver
void mark_rmserver(struct script_infos *desc, int port, char *buffer, int trp)
Definition: nasl_builtin_find_service.c:217
mark_psybnc
static void mark_psybnc(struct script_infos *desc, int port, char *buffer, int trp)
Definition: nasl_builtin_find_service.c:823
mark_linuxconf
void mark_linuxconf(struct script_infos *desc, int port, unsigned char *buffer)
Definition: nasl_builtin_find_service.c:504
mark_exchg_routing_server
static void mark_exchg_routing_server(struct script_infos *desc, int port, char *buffer, int trp)
Definition: nasl_builtin_find_service.c:657
mark_pnsclient
static void mark_pnsclient(struct script_infos *desc, int port, int trp)
Definition: nasl_builtin_find_service.c:1367
mark_spamd_server
static void mark_spamd_server(struct script_infos *desc, int port, int trp)
Definition: nasl_builtin_find_service.c:1044
stream_set_timeout
int stream_set_timeout(int fd, int timeout)
Definition: network.c:1033