Mercurial > farol > farolluz
comparison farolluz/templates/nasl_core.j2 @ 0:e18b61a73a68
Initial Release
author | Benoît Allard <benoit.allard@greenbone.net> |
---|---|
date | Tue, 23 Sep 2014 15:19:14 +0200 |
parents | |
children |
comparison
equal
deleted
inserted
replaced
-1:000000000000 | 0:e18b61a73a68 |
---|---|
1 {# | |
2 # Description: | |
3 # Template macros for generation of NASL documents | |
4 # | |
5 # Authors: | |
6 # BenoƮt Allard <benoit.allard@greenbone.net> | |
7 # | |
8 # Copyright: | |
9 # Copyright (C) 2014 Greenbone Networks GmbH | |
10 # | |
11 # This program is free software; you can redistribute it and/or | |
12 # modify it under the terms of the GNU General Public License | |
13 # as published by the Free Software Foundation; either version 2 | |
14 # of the License, or (at your option) any later version. | |
15 # | |
16 # This program is distributed in the hope that it will be useful, | |
17 # but WITHOUT ANY WARRANTY; without even the implied warranty of | |
18 # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | |
19 # GNU General Public License for more details. | |
20 # | |
21 # You should have received a copy of the GNU General Public License | |
22 # along with this program; if not, write to the Free Software | |
23 # Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. | |
24 -#} | |
25 | |
26 {% macro isrpmvuln(plist, ptree) %} | |
27 {%- set done = [] %} | |
28 {% for prod in plist %} | |
29 {%- set os, package = ptree.decomposeProduct(prod._productid) %} | |
30 {%- if os is not none %} | |
31 {%- set rls = os._name | release_map %} | |
32 {%- set rpm = package._name | for_rpmvuln %} | |
33 {%- if rls != 'UNKNOWN' %} | |
34 {%- if (rls, rpm) not in done %} | |
35 # {{ package._name }} on {{ os._name }} | |
36 if ((res = isrpmvuln(pkg:"{{ package._name | package_name }}", rpm:"{{ rpm }}", rls:"{{ rls }}")) != NULL) | |
37 { | |
38 security_message(data:res); | |
39 exit(0); | |
40 } | |
41 {{- done.append((rls, rpm)) or '' }} | |
42 {%- endif %} | |
43 {%- else %} | |
44 # Unknown release: {{ os._name }} | |
45 {%- endif %} | |
46 {%- endif %} | |
47 {%- endfor %} | |
48 {% endmacro %} | |
49 | |
50 {% macro notes(cvrf, name) %} | |
51 {%- for note in cvrf._notes %} | |
52 {%- if note._type == name or note._title == name %}{{ note._note.replace('"', "'") }}{% endif %} | |
53 {%- endfor %} | |
54 {%- for vulnerability in cvrf._vulnerabilities %} | |
55 {%- for note in vulnerability._notes %} | |
56 {%- if note._type == name or note._title == name %}{{ note._note.replace('"', "'") }}{% endif %} | |
57 {%- endfor %} | |
58 {%- endfor %} | |
59 {% endmacro %} |