Mercurial > farol > farolluz
diff farolluz/templates/nasl.j2 @ 0:e18b61a73a68
Initial Release
author | Benoît Allard <benoit.allard@greenbone.net> |
---|---|
date | Tue, 23 Sep 2014 15:19:14 +0200 |
parents | |
children | e29e2d43bf0c |
line wrap: on
line diff
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/farolluz/templates/nasl.j2 Tue Sep 23 15:19:14 2014 +0200 @@ -0,0 +1,102 @@ +{# +# Description: +# Template for generation of NASL documents +# +# Authors: +# BenoƮt Allard <benoit.allard@greenbone.net> +# +# Copyright: +# Copyright (C) 2014 Greenbone Networks GmbH +# +# 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. +-#} + +{% import "nasl_core.j2" as nasl_core -%} +############################################################################### +# OpenVAS Vulnerability Test +# +# {{ cvrf._title }} ({{ cvrf._tracking._identification._id }}) +# +# Authors: +# System Generated Check +# +# Copyright: +# Copyright (C) {{ now.strftime('%Y') }} Greenbone Networks GmbH, http://www.greenbone.net +# +# This program is free software; you can redistribute it and/or modify +# it under the terms of the GNU General Public License version 2 +# (or any later version), as published by the Free Software Foundation. +# +# 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. +############################################################################### + +if(description) +{ + script_oid("1.3.6.1.4.1.25623.1.0.{{ script_id }}"); + script_version("$Revision$"); + script_tag(name:"check_type", value:"authenticated package test"); + script_tag(name:"last_modification", value:"$Date$"); + script_tag(name:"creation_date", value:"{{ now.strftime('%F %T %z (%a, %d %b %Y)') }}"); + script_cve_id({% for vuln in cvrf._vulnerabilities %}"{{ vuln._cve }}"{% if not loop.last %}, {% endif %}{% endfor %}); + script_tag(name:"cvss_base", value:"{{ cvrf.getHighestCVSS()._basescore }}"); + script_tag(name:"cvss_base_vector", value:"{{ cvrf.getHighestCVSS()._vector }}"); + script_name("{{ cvrf._title }} ({{ cvrf._tracking._identification._id }})"); + script_tag(name: "summary", value: "{{ nasl_core.notes(cvrf, 'Summary') }}"); + script_tag(name: "insight", value: "{{ nasl_core.notes(cvrf, 'Details') }}"); + script_tag(name: "affected" , value: " +{%- for product in cvrf.getProductList() %} + {{ product._name }} {% if not loop.last %}, {% endif %} + +{%- endfor %}"); + script_tag(name: "solution" , value:"Please Install the Updated Packages."); + + script_xref(name: "{{ cvrf._tracking._id }}", value: "{{ cvrf._tracking._id }}"); +{%- for ref in cvrf._references %} + script_xref(name: "URL" , value: "{{ ref._url }}"); +{%- endfor %} + script_summary("Check for the {{ cvrf._title }}"); + script_category(ACT_GATHER_INFO); + script_copyright("Copyright (C) {{ now.strftime('%Y') }} Greenbone Networks GmbH"); + script_family("{{ script_family }}"); + script_dependencies("gather-package-list.nasl"); + script_mandatory_keys({% if os_cpe %}"HostDetails/OS/{{ os_cpe }}", {% endif %}"login/SSH/success", "ssh/login/release"); + exit(0); +} + + +{% if red_hat %}include("pkg-lib-rpm.inc");{% endif %} + +release = get_kb_item("ssh/login/release"); + +res = ""; +if(release == NULL){ + exit(0); +} + +{%- if red_hat %} +{{ nasl_core.isrpmvuln(cvrf.getProductList(), cvrf._producttree) }} +{%- else %} +# Not red_hat +{%- endif %} + +if (__pkg_match) exit(99); # Not vulnerable. +exit(0);