Go to the source code of this file.
◆ error_message()
Definition at line 964 of file nasl_scanner_glue.c.
void proto_post_error(const char *oid, struct arglist *desc, int port, const char *proto, const char *action)
void post_error(const char *oid, struct arglist *desc, int port, const char *action)
◆ get_kb_item()
Definition at line 749 of file nasl_scanner_glue.c.
References alloc_tree_cell(), CONST_DATA, CONST_INT, get_int_var_by_num(), get_str_var_by_num(), TC::i_val, KB_TYPE_INT, plug_get_key(), struct_lex_ctxt::script_infos, TC::size, TC::str_val, arglist::type, TC::type, val, and TC::x.
751 struct arglist *script_infos = lexic->script_infos;
758 if (kb_entry == NULL)
void * plug_get_key(struct arglist *args, char *name, int *type, int single)
long int get_int_var_by_num(lex_ctxt *, int, int)
char * get_str_var_by_num(lex_ctxt *, int)
tree_cell * alloc_tree_cell(int lnb, char *s)
◆ get_kb_list()
Definition at line 690 of file nasl_scanner_glue.c.
References alloc_tree_cell(), DYN_ARRAY, get_str_var_by_num(), nasl_perror(), plug_get_kb(), TC::ref_val, struct_lex_ctxt::script_infos, TC::type, and TC::x.
692 struct arglist *script_infos = lexic->script_infos;
702 nasl_perror (lexic,
"get_kb_list() usage : get_kb_list(<NameOfItem>)\n");
713 top = res = kb_item_get_pattern (
kb, kb_mask);
718 bzero (&v,
sizeof (v));
void kb_item_free(struct kb_item *)
Release a KB item (or a list).
Knowledge base item (defined by name, type (int/char*) and value). Implemented as a singly linked lis...
union st_a_nasl_var::@9 v
void deref_cell(tree_cell *c)
int add_var_to_array(nasl_array *a, char *name, const anon_nasl_var *v)
kb_t plug_get_kb(struct arglist *args)
Top-level KB. This is to be inherited by KB implementations.
void nasl_perror(lex_ctxt *lexic, char *msg,...)
char * get_str_var_by_num(lex_ctxt *, int)
tree_cell * alloc_tree_cell(int lnb, char *s)
◆ get_script_oid()
◆ log_message()
Definition at line 958 of file nasl_scanner_glue.c.
void post_log(const char *oid, struct arglist *desc, int port, const char *action)
Post a log message about a tcp port.
void proto_post_log(const char *oid, struct arglist *desc, int port, const char *proto, const char *action)
Post a log message.
◆ nasl_get_preference()
Definition at line 970 of file nasl_scanner_glue.c.
References alloc_typed_cell(), CONST_DATA, get_str_var_by_num(), name, nasl_perror(), prefs_get(), TC::size, TC::str_val, arglist::value, and TC::x.
988 retc->
size = strlen (value);
const gchar * prefs_get(const gchar *key)
Get a string preference value via a key.
tree_cell * alloc_typed_cell(int typ)
void nasl_perror(lex_ctxt *lexic, char *msg,...)
char * get_str_var_by_num(lex_ctxt *, int)
◆ nasl_scanner_add_port()
◆ nasl_scanner_get_port()
If the plugin is a port scanner, it needs to report the list of open ports back to openvas scanner, and it also needs to know which ports are to be scanned.
Definition at line 1014 of file nasl_scanner_glue.c.
References alloc_tree_cell(), CONST_INT, get_int_var_by_num(), getpts(), TC::i_val, nasl_perror(), prefs_get(), TC::type, and TC::x.
1018 const char *prange =
prefs_get (
"port_range");
1020 static u_short *ports = NULL;
1027 nasl_perror (lexic,
"Argument error in scanner_get_port()\n");
1028 nasl_perror (lexic,
"Correct usage is : num = scanner_get_port(<num>)\n");
1030 "Where <num> should be 0 the first time you call it\n");
1036 ports = (u_short *)
getpts ((
char *)prange, &num);
1050 retc->
x.
i_val = ports[idx];
const gchar * prefs_get(const gchar *key)
Get a string preference value via a key.
unsigned short * getpts(char *origexpr, int *len)
Converts a string like "-100,200-1024,3000-4000,60000-" into an array.
long int get_int_var_by_num(lex_ctxt *, int, int)
void nasl_perror(lex_ctxt *lexic, char *msg,...)
tree_cell * alloc_tree_cell(int lnb, char *s)
◆ nasl_scanner_status()
◆ nasl_vendor_version()
◆ network_targets()
◆ replace_kb_item()
Definition at line 795 of file nasl_scanner_glue.c.
References ARG_INT, ARG_STRING, FAKE_CELL, get_int_local_var_by_name(), get_local_var_type_by_name(), get_str_local_var_by_name(), name, nasl_perror(), plug_replace_key(), struct_lex_ctxt::script_infos, arglist::type, arglist::value, and VAR2_INT.
797 struct arglist *script_infos = lexic->script_infos;
803 nasl_perror (lexic,
"Syntax error with replace_kb_item() [null name]\n",
813 GSIZE_TO_POINTER (
value));
816 "Syntax error with replace_kb_item(%s) [value=-1]\n",
825 "Syntax error with replace_kb_item(%s) [null value]\n",
void plug_replace_key(struct arglist *args, char *name, int type, void *value)
long int get_int_local_var_by_name(lex_ctxt *, const char *, int)
char * get_str_local_var_by_name(lex_ctxt *, const char *)
int get_local_var_type_by_name(lex_ctxt *, const char *)
void nasl_perror(lex_ctxt *lexic, char *msg,...)
◆ safe_checks()
◆ scan_phase()
Definition at line 621 of file nasl_scanner_glue.c.
References alloc_tree_cell(), arg_get_value(), CONST_INT, TC::i_val, struct_lex_ctxt::script_infos, TC::type, arglist::value, and TC::x.
623 struct arglist *script_infos = lexic->script_infos;
632 if (strcmp (
value,
"busy") == 0)
tree_cell * alloc_tree_cell(int lnb, char *s)
void * arg_get_value(struct arglist *args, const char *name)
◆ script_add_preference()
Definition at line 472 of file nasl_scanner_glue.c.
References add_plugin_preference(), FAKE_CELL, get_str_local_var_by_name(), name, nasl_perror(), struct_lex_ctxt::script_infos, arglist::type, and arglist::value.
477 struct arglist *script_infos = lexic->script_infos;
482 "Argument error in the call to script_add_preference()\n");
char * get_str_local_var_by_name(lex_ctxt *, const char *)
void nasl_perror(lex_ctxt *lexic, char *msg,...)
void add_plugin_preference(struct arglist *desc, const char *name, const char *type, const char *defaul)
◆ script_bugtraq_id()
◆ script_category()
Definition at line 288 of file nasl_scanner_glue.c.
References arg_get_value(), FAKE_CELL, get_int_var_by_num(), nasl_perror(), nvti_set_category(), and struct_lex_ctxt::script_infos.
290 struct arglist *script_infos = lexic->script_infos;
296 nasl_perror (lexic,
"Argument error in function script_category()\n");
297 nasl_perror (lexic,
"Function usage is : script_category(<category>)\n");
int nvti_set_category(nvti_t *n, const gint category)
Set the category type of a NVT Info.
long int get_int_var_by_num(lex_ctxt *, int, int)
void nasl_perror(lex_ctxt *lexic, char *msg,...)
void * arg_get_value(struct arglist *args, const char *name)
◆ script_copyright()
◆ script_cve_id()
◆ script_dependencies()
Definition at line 313 of file nasl_scanner_glue.c.
References FAKE_CELL, get_str_var_by_num(), nasl_perror(), plug_set_dep(), and struct_lex_ctxt::script_infos.
315 struct arglist *script_infos = lexic->script_infos;
321 nasl_perror (lexic,
"Argument error in function script_dependencies()\n");
322 nasl_perror (lexic,
"Function usage is : script_dependencies(<name>)\n");
323 nasl_perror (lexic,
"Where <name> is the name of another script\n");
328 for (i = 0; dep != NULL; i++)
void plug_set_dep(struct arglist *desc, const char *depname)
void nasl_perror(lex_ctxt *lexic, char *msg,...)
char * get_str_var_by_num(lex_ctxt *, int)
◆ script_exclude_keys()
Definition at line 411 of file nasl_scanner_glue.c.
References arg_get_value(), FAKE_CELL, get_str_var_by_num(), nasl_perror(), nvti_add_excluded_keys(), and struct_lex_ctxt::script_infos.
418 nasl_perror (lexic,
"Argument error in function script_exclude_keys()\n");
419 nasl_perror (lexic,
"Function usage is : script_exclude_keys(<name>)\n");
420 nasl_perror (lexic,
"Where <name> is the name of a key\n");
424 for (i = 0; keys != NULL; i++)
void nasl_perror(lex_ctxt *lexic, char *msg,...)
char * get_str_var_by_num(lex_ctxt *, int)
int nvti_add_excluded_keys(nvti_t *n, const gchar *key)
Add a excluded key of a NVT.
void * arg_get_value(struct arglist *args, const char *name)
◆ script_family()
◆ script_get_preference()
Definition at line 491 of file nasl_scanner_glue.c.
References alloc_tree_cell(), FAKE_CELL, get_plugin_preference(), get_str_var_by_num(), nasl_perror(), struct_lex_ctxt::oid, and arglist::value.
500 "Argument error in the function script_get_preference()\n");
502 "Function usage is : pref = script_get_preference(<name>)\n");
void nasl_perror(lex_ctxt *lexic, char *msg,...)
char * get_str_var_by_num(lex_ctxt *, int)
tree_cell * alloc_tree_cell(int lnb, char *s)
char * get_plugin_preference(const char *oid, const char *name)
◆ script_get_preference_file_content()
Definition at line 529 of file nasl_scanner_glue.c.
References alloc_tree_cell(), CONST_DATA, FAKE_CELL, get_plugin_preference(), get_plugin_preference_file_content(), get_plugin_preference_file_size(), get_str_var_by_num(), nasl_perror(), struct_lex_ctxt::oid, struct_lex_ctxt::script_infos, TC::size, TC::str_val, TC::type, arglist::value, and TC::x.
531 struct arglist *script_infos = lexic->script_infos;
541 "Argument error in the function script_get_preference()\n");
543 "Function usage is : pref = script_get_preference_file_content(<name>)\n");
555 if (contentsize <= 0)
557 nasl_perror (lexic,
"script_get_preference_file_content: could not get " 558 " size of file from preference %s\n", pref);
564 retc->
size = contentsize;
char * get_plugin_preference_file_content(struct arglist *desc, const char *identifier)
Get the file contents of a plugins preference that is of type "file".
void nasl_perror(lex_ctxt *lexic, char *msg,...)
char * get_str_var_by_num(lex_ctxt *, int)
tree_cell * alloc_tree_cell(int lnb, char *s)
long get_plugin_preference_file_size(struct arglist *desc, const char *identifier)
Get the file size of a plugins preference that is of type "file".
char * get_plugin_preference(const char *oid, const char *name)
◆ script_get_preference_file_location()
Definition at line 572 of file nasl_scanner_glue.c.
References alloc_typed_cell(), CONST_DATA, get_plugin_preference(), get_plugin_preference_fname(), get_str_var_by_num(), nasl_perror(), struct_lex_ctxt::oid, struct_lex_ctxt::script_infos, TC::size, TC::str_val, arglist::value, and TC::x.
574 struct arglist *script_infos = lexic->script_infos;
577 const char *
value, *local;
583 "script_get_preference_file_location: no preference name!\n");
591 "script_get_preference_file_location: could not get preference %s\n",
599 len = strlen (local);
602 retc->
x.
str_val = g_malloc0 (len + 1);
603 memcpy (retc->
x.
str_val, local, len + 1);
const char * get_plugin_preference_fname(struct arglist *desc, const char *filename)
Get the file name of a plugins preference that is of type "file".
tree_cell * alloc_typed_cell(int typ)
void nasl_perror(lex_ctxt *lexic, char *msg,...)
char * get_str_var_by_num(lex_ctxt *, int)
char * get_plugin_preference(const char *oid, const char *name)
◆ script_id()
Definition at line 104 of file nasl_scanner_glue.c.
References arg_get_value(), FAKE_CELL, get_int_var_by_num(), LEGACY_OID, nvti_set_oid(), oid, and struct_lex_ctxt::script_infos.
int nvti_set_oid(nvti_t *n, const gchar *oid)
Set the OID of a NVT Info.
long int get_int_var_by_num(lex_ctxt *, int, int)
void * arg_get_value(struct arglist *args, const char *name)
◆ script_mandatory_keys()
Definition at line 363 of file nasl_scanner_glue.c.
References arg_get_value(), FAKE_CELL, get_str_var_by_name(), get_str_var_by_num(), nasl_perror(), nvti_add_mandatory_keys(), and struct_lex_ctxt::script_infos.
372 "Argument error in function script_mandatory_keys()\n");
374 "Function usage is : script_mandatory_keys(<name>)\n");
375 nasl_perror (lexic,
"Where <name> is the name of a key\n");
381 splits = g_strsplit (re,
"=", 0);
383 if (!splits[0] || !splits[1] || !*splits[1] || splits[2])
389 for (i = 0; keys != NULL; i++)
393 if (splits && keys && !strcmp (keys, splits[0]))
char * get_str_var_by_name(lex_ctxt *, const char *)
int nvti_add_mandatory_keys(nvti_t *n, const gchar *key)
Add a mandatory key of a NVT.
void nasl_perror(lex_ctxt *lexic, char *msg,...)
char * get_str_var_by_num(lex_ctxt *, int)
void * arg_get_value(struct arglist *args, const char *name)
◆ script_name()
◆ script_oid()
◆ script_require_keys()
Definition at line 340 of file nasl_scanner_glue.c.
References arg_get_value(), FAKE_CELL, get_str_var_by_num(), nasl_perror(), nvti_add_required_keys(), and struct_lex_ctxt::script_infos.
347 nasl_perror (lexic,
"Argument error in function script_require_keys()\n");
348 nasl_perror (lexic,
"Function usage is : script_require_keys(<name>)\n");
349 nasl_perror (lexic,
"Where <name> is the name of a key\n");
353 for (i = 0; keys != NULL; i++)
void nasl_perror(lex_ctxt *lexic, char *msg,...)
char * get_str_var_by_num(lex_ctxt *, int)
int nvti_add_required_keys(nvti_t *n, const gchar *key)
Add a required key of a NVT.
void * arg_get_value(struct arglist *args, const char *name)
◆ script_require_ports()
◆ script_require_udp_ports()
◆ script_summary()
◆ script_tag()
Definition at line 205 of file nasl_scanner_glue.c.
References FAKE_CELL, get_str_var_by_name(), name, nasl_perror(), plug_set_tag(), struct_lex_ctxt::script_infos, and arglist::value.
207 struct arglist *script_infos = lexic->script_infos;
213 nasl_perror (lexic,
"script_tag() syntax error - should be" 214 " script_tag(name:<name>, value:<value>)\n");
234 if (strchr (
value,
'|'))
void plug_set_tag(struct arglist *desc, char *name, char *value)
char * get_str_var_by_name(lex_ctxt *, const char *)
void nasl_perror(lex_ctxt *lexic, char *msg,...)
◆ script_timeout()
◆ script_version()
Definition at line 255 of file nasl_scanner_glue.c.
References arg_get_value(), FAKE_CELL, get_str_var_by_num(), nasl_perror(), nvti_set_version(), and struct_lex_ctxt::script_infos.
262 nasl_perror (lexic,
"Argument error in function script_version()\n");
263 nasl_perror (lexic,
"Function usage is : script_version(<version>)\n");
264 nasl_perror (lexic,
"Where <version> is the version of this script\n");
The structure of a information record that corresponds to a NVT.
int nvti_set_version(nvti_t *n, const gchar *version)
Set the version of a NVT.
void nasl_perror(lex_ctxt *lexic, char *msg,...)
char * get_str_var_by_num(lex_ctxt *, int)
void * arg_get_value(struct arglist *args, const char *name)
◆ script_xref()
Definition at line 168 of file nasl_scanner_glue.c.
References FAKE_CELL, get_str_var_by_name(), name, nasl_perror(), plug_set_xref(), struct_lex_ctxt::script_infos, and arglist::value.
170 struct arglist *script_infos = lexic->script_infos;
178 "script_xref() syntax error - should be" 179 " script_xref(name:<name>, value:<value>)\n");
char * get_str_var_by_name(lex_ctxt *, const char *)
void plug_set_xref(struct arglist *desc, char *name, char *value)
void nasl_perror(lex_ctxt *lexic, char *msg,...)
◆ security_message()
Send a security message to the client.
- Parameters
-
- Returns
- FAKE_CELL.
Definition at line 952 of file nasl_scanner_glue.c.
void proto_post_alarm(const char *oid, struct arglist *desc, int port, const char *proto, const char *action)
void post_alarm(const char *oid, struct arglist *desc, int port, const char *action)
◆ set_kb_item()
Definition at line 836 of file nasl_scanner_glue.c.
References ARG_INT, ARG_STRING, FAKE_CELL, get_int_local_var_by_name(), get_local_var_type_by_name(), get_str_local_var_by_name(), name, nasl_perror(), plug_set_key(), struct_lex_ctxt::script_infos, arglist::type, arglist::value, and VAR2_INT.
838 struct arglist *script_infos = lexic->script_infos;
844 nasl_perror (lexic,
"Syntax error with set_kb_item() [null name]\n",
856 "Syntax error with set_kb_item() [value=-1 for name '%s']\n",
865 "Syntax error with set_kb_item() [null value for name '%s']\n",
void plug_set_key(struct arglist *args, char *name, int type, const void *value)
long int get_int_local_var_by_name(lex_ctxt *, const char *, int)
char * get_str_local_var_by_name(lex_ctxt *, const char *)
int get_local_var_type_by_name(lex_ctxt *, const char *)
void nasl_perror(lex_ctxt *lexic, char *msg,...)