comparison farolluz/parsers/cpe.py @ 41:bb1dd2a55643

CPE: Add a generic 'parse' method
author Benoît Allard <benoit.allard@greenbone.net>
date Mon, 29 Dec 2014 14:58:29 +0100
parents 1d9b2b06067e
children 3826f2701ff2
comparison
equal deleted inserted replaced
40:1d9b2b06067e 41:bb1dd2a55643
1 # -*- coding: utf-8 -*-
2 # Description:
3 # Methods for parsing CPEs
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
1 """\ 25 """\
2 a cpe class to ease the creation of a producttree based on cpe 26 a cpe class to ease the creation of a producttree based on cpe
3 27
4 This is based on: 28 This is based on:
5 29
255 self.target_sw = v 279 self.target_sw = v
256 elif idx == 11: 280 elif idx == 11:
257 self.target_hw = v 281 self.target_hw = v
258 elif idx == 12: 282 elif idx == 12:
259 self.other = v 283 self.other = v
284
285 def parse(s):
286 cpe = CPE()
287 if s[:5] == 'cpe:/':
288 cpe.unbind_URI(s)
289 elif s[:8] == 'cpe:2.3:':
290 cpe.unbind_fs(s)
291 else:
292 raise ValueError(s)
293 return cpe
This site is hosted by Intevation GmbH (Datenschutzerklärung und Impressum | Privacy Policy and Imprint)