#include "manage.h"
#include "manage_sql.h"
#include "sql.h"
#include <assert.h>
Go to the source code of this file.
◆ G_LOG_DOMAIN
#define G_LOG_DOMAIN "md main" |
◆ check_config_system_discovery()
int check_config_system_discovery |
( |
const char * |
uuid | ) |
|
Ensure the Discovery config is up to date.
- Parameters
-
- Returns
- 0 success, -1 error.
Definition at line 202 of file manage_config_system_discovery.c.
210 if (
sql_int (
"SELECT count (*) FROM nvt_selectors" 211 " WHERE name = (SELECT nvt_selector FROM configs" 212 " WHERE uuid = '%s')" 213 " AND family_or_nvt = '1.3.6.1.4.1.25623.1.0.51662';",
217 sql (
"INSERT INTO nvt_selectors (name, exclude, type, family_or_nvt, family)" 218 " VALUES ((SELECT nvt_selector FROM configs WHERE uuid = '%s'), 0," 220 " '1.3.6.1.4.1.25623.1.0.51662', 'General');",
int sql_int(char *sql,...)
Get a particular cell from a SQL query, as an int.
void sql(char *sql,...)
Perform an SQL statement, retrying if database is busy or locked.
#define NVT_SELECTOR_TYPE_NVT
NVT selector type for "NVT" rule.
void update_config_cache_init(const char *)
References NVT_SELECTOR_TYPE_NVT, sql(), sql_int(), and update_config_cache_init().
◆ make_config_system_discovery()
void make_config_system_discovery |
( |
char *const |
uuid, |
|
|
char *const |
selector_name |
|
) |
| |
Make System Discovery Scan Config.
Caller must lock the db.
- Parameters
-
[in] | uuid | UUID for new scan config. |
[in] | selector_name | Name of NVT selector to use. |
Definition at line 47 of file manage_config_system_discovery.c.
53 sql (
"INSERT into configs (uuid, name, owner, nvt_selector, comment," 54 " family_count, nvt_count, nvts_growing, families_growing," 55 " type, creation_time, modification_time)" 56 " VALUES ('%s', 'System Discovery', NULL," 57 " '%s', 'Network System Discovery scan configuration.'," 58 " 0, 0, 0, 0, 0, m_now (), m_now ());",
66 sql (
"INSERT INTO nvt_selectors (name, exclude, type, family_or_nvt, family)" 68 " '1.3.6.1.4.1.25623.1.0.100315', 'Port scanners');",
70 sql (
"INSERT INTO nvt_selectors (name, exclude, type, family_or_nvt, family)" 72 " '1.3.6.1.4.1.25623.1.0.14259', 'Port scanners');",
74 sql (
"INSERT INTO nvt_selectors (name, exclude, type, family_or_nvt, family)" 76 " '1.3.6.1.4.1.25623.1.0.50282', 'General');",
78 sql (
"INSERT INTO nvt_selectors (name, exclude, type, family_or_nvt, family)" 80 " '1.3.6.1.4.1.25623.1.0.51662', 'General');",
82 sql (
"INSERT INTO nvt_selectors (name, exclude, type, family_or_nvt, family)" 84 " '1.3.6.1.4.1.25623.1.0.96207', 'Windows');",
86 sql (
"INSERT INTO nvt_selectors (name, exclude, type, family_or_nvt, family)" 88 " '1.3.6.1.4.1.25623.1.0.103621', 'Windows');",
90 sql (
"INSERT INTO nvt_selectors (name, exclude, type, family_or_nvt, family)" 92 " '1.3.6.1.4.1.25623.1.0.103220', 'Product detection');",
94 sql (
"INSERT INTO nvt_selectors (name, exclude, type, family_or_nvt, family)" 96 " '1.3.6.1.4.1.25623.1.0.102002', 'Product detection');",
98 sql (
"INSERT INTO nvt_selectors (name, exclude, type, family_or_nvt, family)" 100 " '1.3.6.1.4.1.25623.1.0.103633', 'Product detection');",
102 sql (
"INSERT INTO nvt_selectors (name, exclude, type, family_or_nvt, family)" 104 " '1.3.6.1.4.1.25623.1.0.103804', 'Product detection');",
106 sql (
"INSERT INTO nvt_selectors (name, exclude, type, family_or_nvt, family)" 108 " '1.3.6.1.4.1.25623.1.0.96200', 'Product detection');",
110 sql (
"INSERT INTO nvt_selectors (name, exclude, type, family_or_nvt, family)" 112 " '1.3.6.1.4.1.25623.1.0.103675', 'Product detection');",
114 sql (
"INSERT INTO nvt_selectors (name, exclude, type, family_or_nvt, family)" 116 " '1.3.6.1.4.1.25623.1.0.103817', 'Product detection');",
118 sql (
"INSERT INTO nvt_selectors (name, exclude, type, family_or_nvt, family)" 120 " '1.3.6.1.4.1.25623.1.0.103628', 'Product detection');",
122 sql (
"INSERT INTO nvt_selectors (name, exclude, type, family_or_nvt, family)" 124 " '1.3.6.1.4.1.25623.1.0.803719', 'Product detection');",
126 sql (
"INSERT INTO nvt_selectors (name, exclude, type, family_or_nvt, family)" 128 " '1.3.6.1.4.1.25623.1.0.103799', 'Product detection');",
130 sql (
"INSERT INTO nvt_selectors (name, exclude, type, family_or_nvt, family)" 132 " '1.3.6.1.4.1.25623.1.0.103685', 'Product detection');",
134 sql (
"INSERT INTO nvt_selectors (name, exclude, type, family_or_nvt, family)" 136 " '1.3.6.1.4.1.25623.1.0.103809', 'Product detection');",
138 sql (
"INSERT INTO nvt_selectors (name, exclude, type, family_or_nvt, family)" 140 " '1.3.6.1.4.1.25623.1.0.103707', 'Product detection');",
142 sql (
"INSERT INTO nvt_selectors (name, exclude, type, family_or_nvt, family)" 144 " '1.3.6.1.4.1.25623.1.0.103418', 'Product detection');",
146 sql (
"INSERT INTO nvt_selectors (name, exclude, type, family_or_nvt, family)" 148 " '1.3.6.1.4.1.25623.1.0.10267', 'Product detection');",
150 sql (
"INSERT INTO nvt_selectors (name, exclude, type, family_or_nvt, family)" 152 " '1.3.6.1.4.1.25623.1.0.103417', 'Product detection');",
154 sql (
"INSERT INTO nvt_selectors (name, exclude, type, family_or_nvt, family)" 156 " '1.3.6.1.4.1.25623.1.0.103648', 'Product detection');",
158 sql (
"INSERT INTO nvt_selectors (name, exclude, type, family_or_nvt, family)" 160 " '1.3.6.1.4.1.25623.1.0.103779', 'Product detection');",
162 sql (
"INSERT INTO nvt_selectors (name, exclude, type, family_or_nvt, family)" 164 " '1.3.6.1.4.1.25623.1.0.103997', 'Service detection');",
166 sql (
"INSERT INTO nvt_selectors (name, exclude, type, family_or_nvt, family)" 168 " '1.3.6.1.4.1.25623.1.0.10884', 'Service detection');",
170 sql (
"INSERT INTO nvt_selectors (name, exclude, type, family_or_nvt, family)" 172 " '1.3.6.1.4.1.25623.1.0.102011', 'Service detection');",
174 sql (
"INSERT INTO nvt_selectors (name, exclude, type, family_or_nvt, family)" 176 " '1.3.6.1.4.1.25623.1.0.101013', 'Service detection');",
178 sql (
"INSERT INTO nvt_selectors (name, exclude, type, family_or_nvt, family)" 180 " '1.3.6.1.4.1.25623.1.0.103416', 'SNMP');",
185 sql (
"UPDATE configs" 186 " SET family_count = %i, nvt_count = %i," 187 " modification_time = m_now ()"
resource_t sql_last_insert_id()
Get the ID of the last inserted row.
void sql(char *sql,...)
Perform an SQL statement, retrying if database is busy or locked.
#define NVT_SELECTOR_TYPE_NVT
NVT selector type for "NVT" rule.
int nvt_selector_nvt_count(const char *, const char *, int)
int nvt_selector_family_count(const char *, int)
References nvt_selector_family_count(), nvt_selector_nvt_count(), NVT_SELECTOR_TYPE_NVT, sql(), and sql_last_insert_id().