-
Notifications
You must be signed in to change notification settings - Fork 633
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Get the qod value or qod type from the nvti structure and add the val…
…ue to the result.
- Loading branch information
Showing
4 changed files
with
170 additions
and
4 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,81 @@ | ||
/* Portions Copyright (C) 2009-2021 Greenbone Networks GmbH | ||
* Based on work Copyright (C) 1998 - 2007 Tenable Network Security, Inc. | ||
* | ||
* SPDX-License-Identifier: GPL-2.0-or-later | ||
* | ||
* This program is free software; you can redistribute it and/or | ||
* modify it under the terms of the GNU General Public License | ||
* as published by the Free Software Foundation; either version 2 | ||
* of the License, or (at your option) any later version. | ||
* | ||
* This program is distributed in the hope that it will be useful, | ||
* but WITHOUT ANY WARRANTY; without even the implied warranty of | ||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | ||
* GNU General Public License for more details. | ||
* | ||
* You should have received a copy of the GNU General Public License | ||
* along with this program; if not, write to the Free Software | ||
* Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. | ||
*/ | ||
|
||
/** | ||
* @file | ||
* @brief Converts a qod_type string into a QoD value. | ||
* | ||
*/ | ||
|
||
#include "nvt_qod.h" | ||
#include <glib.h> | ||
|
||
#undef G_LOG_DOMAIN | ||
/** | ||
* @brief GLib logging domain. | ||
*/ | ||
#define G_LOG_DOMAIN "lib misc" | ||
|
||
static const struct { | ||
qod_val val; | ||
const char *type; | ||
} qod_types[] = { | ||
{EXPLOIT, "exploit"}, | ||
{REMOTE_VUL, "remote_vul"}, | ||
{REMOTE_APP, "remote_app"}, | ||
{PACKAGE, "package"}, | ||
{REGISTRY, "registry"}, | ||
{REMOTE_ACTIVE, "remote_active"}, | ||
{REMOTE_BANNER, "remote_banner"}, | ||
{EXECUTABLE_VERSION, "executable_version"}, | ||
{REMOTE_ANALYSIS, "remote_analysis"}, | ||
{REMOTE_PROBE, "remote_probe"}, | ||
{REMOTE_BANNER_UNRELIABLE, "remote_banner_unreliable"}, | ||
{EXECUTABLE_VERSION_UNRELIABLE, "executable_version_unreliable"}, | ||
{GENERAL_NOTE, "general_note"}, | ||
{DEFAULT, "default"} | ||
}; | ||
|
||
/** | ||
* @brief Converts a qod_type string into it value | ||
* | ||
* @param[in] qod_type String containing the qod type | ||
* | ||
* @return The value corresponding to the given qod type. Defaults to 70 if | ||
* the given type does not exist. -1 if a null pointer was given. | ||
*/ | ||
int | ||
qod_type2val (const char *qod_type) | ||
{ | ||
unsigned int i; | ||
|
||
g_message ("GGGGG %s",qod_type); | ||
|
||
if (!qod_type) | ||
return -1; | ||
|
||
for (i = 0; i < sizeof (qod_types) / sizeof (qod_types[i]); i++) | ||
{ | ||
g_message ("AAAAAAAAAAAAAAAAAAAAAAAAAAAAA %d %s",qod_types[i].val ,qod_types[i].type); | ||
if (!g_strcmp0(qod_types[i].type, qod_type)) | ||
return qod_types[i].val; | ||
} | ||
return DEFAULT; | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,52 @@ | ||
/* Portions Copyright (C) 2009-2021 Greenbone Networks GmbH | ||
* Based on work Copyright (C) 1998 - 2007 Tenable Network Security, Inc. | ||
* | ||
* SPDX-License-Identifier: GPL-2.0-or-later | ||
* | ||
* This program is free software; you can redistribute it and/or | ||
* modify it under the terms of the GNU General Public License | ||
* as published by the Free Software Foundation; either version 2 | ||
* of the License, or (at your option) any later version. | ||
* | ||
* This program is distributed in the hope that it will be useful, | ||
* but WITHOUT ANY WARRANTY; without even the implied warranty of | ||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | ||
* GNU General Public License for more details. | ||
* | ||
* You should have received a copy of the GNU General Public License | ||
* along with this program; if not, write to the Free Software | ||
* Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. | ||
*/ | ||
|
||
/** | ||
* @file nvt_qod_types.h | ||
* @brief QOD_TYPES definitions. | ||
* | ||
* This file contains defines for the QoD types of NVTs. | ||
*/ | ||
|
||
#ifndef _NVT_QOD_H | ||
#define _NVT_QOD_H | ||
|
||
typedef enum | ||
{ | ||
EXPLOIT = 100, | ||
REMOTE_VUL = 99, | ||
REMOTE_APP = 98, | ||
PACKAGE = 97, | ||
REGISTRY = 97, | ||
REMOTE_ACTIVE = 95, | ||
REMOTE_BANNER = 80, | ||
EXECUTABLE_VERSION = 80, | ||
REMOTE_ANALYSIS = 70, | ||
REMOTE_PROBE = 50, | ||
REMOTE_BANNER_UNRELIABLE = 30, | ||
EXECUTABLE_VERSION_UNRELIABLE = 30, | ||
GENERAL_NOTE = 1, | ||
DEFAULT = 70, | ||
} qod_val; | ||
|
||
int | ||
qod_type2val (const char *); | ||
|
||
#endif /* _NVT_QOD_H */ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters