aboutsummaryrefslogtreecommitdiffstats
path: root/english/security/oval
diff options
context:
space:
mode:
authorCarsten Schoenert <c.schoenert@t-online.de>2023-08-28 12:25:33 +0530
committerThomas Lange <lange@debian.org>2023-12-02 16:47:00 +0100
commitd843a4bbb581b385face0a3a1880c9a25c892acb (patch)
tree6c335665d2d329234702a98185161aec78573a0b /english/security/oval
parent19ecc8e853305277116b69fa196dd69c3ebb2ae2 (diff)
generator.py: Unnecessary parens after 'return' keyword
Diffstat (limited to 'english/security/oval')
-rw-r--r--english/security/oval/oval/definition/generator.py104
1 files changed, 52 insertions, 52 deletions
diff --git a/english/security/oval/oval/definition/generator.py b/english/security/oval/oval/definition/generator.py
index 714475d68b0..9af16c95786 100644
--- a/english/security/oval/oval/definition/generator.py
+++ b/english/security/oval/oval/definition/generator.py
@@ -56,7 +56,7 @@ def __createXMLElement(name, descr=None, attrs={}, nsmap={}):
descr = descr[:match.start()] + "?" + descr[match.end():]
element.text= descr
- return (element)
+ return element
namespace = "oval:org.debian.oval"
tests = __createXMLElement("tests")
@@ -97,7 +97,7 @@ def __getNewId(type):
result = "%s:ste:%d" % (namespace, statesCurId)
statesCurId += 1
- return (result)
+ return result
def __createOVALDpkginfoObject(name):
""" Generate OVAL dpkginfo_object definition """
@@ -105,15 +105,15 @@ def __createOVALDpkginfoObject(name):
if name not in testsHash["obj"]:
objectId = __getNewId("object");
object = __createXMLElement("dpkginfo_object",
- attrs={"id":objectId,
- "version":"1",
- "xmlns":"http://oval.mitre.org/XMLSchema/oval-definitions-5#linux"})
+ attrs={"id": objectId,
+ "version": "1",
+ "xmlns": "http://oval.mitre.org/XMLSchema/oval-definitions-5#linux"})
object.append(__createXMLElement("name", name))
objects.append(object)
testsHash["obj"][name] = objectId
- return (testsHash["obj"][name])
+ return testsHash["obj"][name]
def __createOVALTextfilecontentObject(pattern, path="/etc", filename="debian_version"):
""" Generate OVAL textfilecontent54_object definition """
@@ -122,9 +122,9 @@ def __createOVALTextfilecontentObject(pattern, path="/etc", filename="debian_ver
if name not in testsHash["obj"]:
objectId = __getNewId("object");
object = __createXMLElement("textfilecontent54_object",
- attrs={"id":objectId,
- "version":"1",
- "xmlns":"http://oval.mitre.org/XMLSchema/oval-definitions-5#independent"})
+ attrs={"id": objectId,
+ "version": "1",
+ "xmlns": "http://oval.mitre.org/XMLSchema/oval-definitions-5#independent"})
object.append(__createXMLElement("path", path))
object.append(__createXMLElement("filename", filename))
object.append(__createXMLElement("pattern", pattern, attrs={"operation": "pattern match"}))
@@ -133,7 +133,7 @@ def __createOVALTextfilecontentObject(pattern, path="/etc", filename="debian_ver
testsHash["obj"][name] = objectId
- return (testsHash["obj"][name])
+ return testsHash["obj"][name]
def __createOVALUnameObject():
""" Generate OVAL uname_object definition """
@@ -142,14 +142,14 @@ def __createOVALUnameObject():
if name not in testsHash["obj"]:
objectId = __getNewId("object");
object = __createXMLElement("uname_object",
- attrs={"id":objectId,
- "version":"1",
- "xmlns":"http://oval.mitre.org/XMLSchema/oval-definitions-5#unix"})
+ attrs={"id": objectId,
+ "version": "1",
+ "xmlns": "http://oval.mitre.org/XMLSchema/oval-definitions-5#unix"})
objects.append(object)
testsHash["obj"][name] = objectId
- return (testsHash["obj"][name])
+ return testsHash["obj"][name]
def __getEvr(value):
""" Generate evr from version
@@ -170,17 +170,17 @@ def __createOVALState(value, operation="less than"):
stateId = __getNewId("state")
state = __createXMLElement("dpkginfo_state",
- attrs={"id":stateId,
- "version":"1",
+ attrs={"id": stateId,
+ "version": "1",
"xmlns":"http://oval.mitre.org/XMLSchema/oval-definitions-5#linux"})
state.append(__createXMLElement("evr", __getEvr(value),
- {"datatype":"debian_evr_string",
- "operation":operation}))
+ {"datatype": "debian_evr_string",
+ "operation": operation}))
states.append(state)
testsHash["dpkgSte"][operation] = {value: stateId}
- return (testsHash["dpkgSte"][operation][value])
+ return testsHash["dpkgSte"][operation][value]
def __createOVALUnameState(field, value, operation="equals"):
""" Generate OVAL uname state definition
@@ -198,16 +198,16 @@ def __createOVALUnameState(field, value, operation="equals"):
stateId = __getNewId("state")
state = __createXMLElement("uname_state",
- attrs={"id":stateId,
- "version":"1",
- "xmlns":"http://oval.mitre.org/XMLSchema/oval-definitions-5#unix"})
+ attrs={"id": stateId,
+ "version": "1",
+ "xmlns": "http://oval.mitre.org/XMLSchema/oval-definitions-5#unix"})
state.append(__createXMLElement(field, value,
- {"operation":operation}))
+ {"operation": operation}))
states.append(state)
testsHash["unameSte"][operation] = {value: stateId}
- return (testsHash["unameSte"][operation][value])
+ return testsHash["unameSte"][operation][value]
def __createOVALTextfilecontentState(value, operation="equals"):
""" Generate OVAL state definition
@@ -219,34 +219,34 @@ def __createOVALTextfilecontentState(value, operation="equals"):
stateId = __getNewId("state")
state = __createXMLElement("textfilecontent54_state",
- attrs={"id":stateId,
- "version":"1",
- "xmlns":"http://oval.mitre.org/XMLSchema/oval-definitions-5#independent"})
+ attrs={"id": stateId,
+ "version": "1",
+ "xmlns": "http://oval.mitre.org/XMLSchema/oval-definitions-5#independent"})
state.append(__createXMLElement("subexpression", value,
- {"operation":operation}))
+ {"operation": operation}))
states.append(state)
testsHash["fileSte"][operation] = {value: stateId}
- return (testsHash["fileSte"][operation][value])
+ return testsHash["fileSte"][operation][value]
def __createDPKGTest(name, version):
""" Generate OVAL DPKG test """
ref = __getNewId("test")
test = __createXMLElement("dpkginfo_test",
- attrs={"id":ref,
- "version":"1",
- "check":"all",
- "check_existence":"at_least_one_exists",
- "comment":"%s is earlier than %s" % (name, version),
- "xmlns":"http://oval.mitre.org/XMLSchema/oval-definitions-5#linux"
+ attrs={"id": ref,
+ "version": "1",
+ "check": "all",
+ "check_existence": "at_least_one_exists",
+ "comment": "%s is earlier than %s" % (name, version),
+ "xmlns": "http://oval.mitre.org/XMLSchema/oval-definitions-5#linux"
})
test.append(__createXMLElement("object", attrs={"object_ref": __createOVALDpkginfoObject(name)}))
test.append(__createXMLElement("state", attrs={"state_ref": __createOVALState(version)}))
tests.append(test)
- return (ref)
+ return ref
def __createTest(testType, value):
""" Generate OVAL test for release or architecture cases"""
@@ -261,12 +261,12 @@ def __createTest(testType, value):
comment = "Debian GNU/Linux %s is installed" % value
test = __createXMLElement("textfilecontent54_test",
- attrs={"id":ref,
- "version":"1",
- "check":"all",
- "check_existence":"at_least_one_exists",
- "comment":comment,
- "xmlns":"http://oval.mitre.org/XMLSchema/oval-definitions-5#independent"
+ attrs={"id": ref,
+ "version": "1",
+ "check": "all",
+ "check_existence": "at_least_one_exists",
+ "comment": comment,
+ "xmlns": "http://oval.mitre.org/XMLSchema/oval-definitions-5#independent"
})
test.append(__createXMLElement("object", attrs={"object_ref": objectId}))
test.append(__createXMLElement("state", attrs={"state_ref": __createOVALTextfilecontentState(value, "equals")}))
@@ -276,12 +276,12 @@ def __createTest(testType, value):
comment = "Installed architecture is %s" % value
test = __createXMLElement("uname_test",
- attrs={"id":ref,
- "version":"1",
- "check":"all",
- "check_existence":"at_least_one_exists",
- "comment":comment,
- "xmlns":"http://oval.mitre.org/XMLSchema/oval-definitions-5#unix"
+ attrs={"id": ref,
+ "version": "1",
+ "check": "all",
+ "check_existence": "at_least_one_exists",
+ "comment": comment,
+ "xmlns": "http://oval.mitre.org/XMLSchema/oval-definitions-5#unix"
})
test.append(__createXMLElement("object", attrs={"object_ref": objectId}))
if value != "all":
@@ -291,7 +291,7 @@ def __createTest(testType, value):
testsHash[testType][value] = ref
- return (testsHash[testType][value])
+ return testsHash[testType][value]
def __createGeneratorHeader():
"""
@@ -306,7 +306,7 @@ def __createGeneratorHeader():
generator.append(__createXMLElement("{%s}schema_version" % nsmap['oval'], "5.11.2"))
generator.append(__createXMLElement("{%s}timestamp" % nsmap['oval'], datetime.datetime.now().strftime("%Y-%m-%dT%H:%M:%S.188-04:00")))
- return (generator)
+ return generator
def createPlatformDefinition(release, data, cve):
""" Generate OVAL definitions for current release
@@ -404,7 +404,7 @@ def createPlatformDefinition(release, data, cve):
softwareCriteria.append(archCriteria)
- return (softwareCriteria)
+ return softwareCriteria
def createDefinition(cve, oval):
""" Generate OVAL header of Definition tag
@@ -497,7 +497,7 @@ def createDefinition(cve, oval):
### Definition : Criteria END ###
- return (definition)
+ return definition
def createOVALDefinitions(ovals):
""" Generate XML OVAL definition tree for range of CVE

© 2014-2024 Faster IT GmbH | imprint | privacy policy