예제 #1
0
    def get(self, cpe):
        """
        convert 3 to 2

        Converts a CPE code to the CPE2.2 standard, stripped of appendices.
        CPE2.2 is the old standard, and is a lot less uniform than the CPE2.3 standard.
        """
        cpe = toOldCPE(cpe)
        if cpe is False:
            return api.abort(
                400, "Conversion failed, the CPE code you provided cannot be converted"
            )
        else:
            return cpe
예제 #2
0
파일: index.py 프로젝트: crudbug/cve-search
def cpe22(cpe):
    cpe = toOldCPE(cpe)
    if not cpe: cpe='None'
    return cpe
예제 #3
0
def cpe22(cpe):
    cpe = toOldCPE(cpe)
    if not cpe: cpe = 'None'
    return cpe
예제 #4
0
def cpe22(cpe):
    cpe = toOldCPE(cpe)
    if not cpe:
        cpe = "None"
    return cpe
예제 #5
0
 def api_cpe22(self, cpe):
     cpe = toOldCPE(cpe)
     return cpe, 200 if cpe else "None", 404
예제 #6
0
    'in': ['a', 'b', 'c', 'd', 'e', 'f'],
    'expect': ['a', 'b', 'c', 'd', 'e', 'f']
}]

result = []
for x in extend:
    result.append(
        resultOf(x['in'], toStringFormattedCPE(x['in'], autofill=True),
                 x['expect']))
printResults('Translate to 2.3 - success/autofill', result)

result = []
for x in trans:
    result.append(resultOf(x['in'], toStringFormattedCPE(x['in']),
                           x['expect']))
printResults('Translate to 2.3 - success/no autofill', result)

result = []
for x in old:
    result.append(resultOf(x['in'], toOldCPE(x['in']), x['expect']))
printResults('Translate to 2.2 - success/no autofill', result)

result = []
for x in pad1:
    result.append(resultOf(x['in'], pad(x['in'], 5), x['expect']))
for x in padtext1:
    result.append(resultOf(x['in'], pad(x['in'], 5, '-'), x['expect']))
for x in padtext2:
    result.append(resultOf(x['in'], pad(x['in'], 5, 'text'), x['expect']))
printResults('Padding lists    - empty, char and text - ', result)
예제 #7
0
          {'in':['a','b','c','d','e'],     'expect':['a','b','c','d','e']},
          {'in':['a','b','c','d','e','f'], 'expect':['a','b','c','d','e','f']}]
padtext2=[{'in':['a','b','c'],             'expect':['a','b','c','text','text']},
          {'in':['a','b','c','d','e'],     'expect':['a','b','c','d','e']},
          {'in':['a','b','c','d','e','f'], 'expect':['a','b','c','d','e','f']}]

result=[]
for x in extend:
  result.append(resultOf(x['in'],toStringFormattedCPE(x['in'],autofill=True),x['expect']))
printResults('Translate to 2.3 - success/autofill',result)

result=[]
for x in trans:
  result.append(resultOf(x['in'],toStringFormattedCPE(x['in']),x['expect']))
printResults('Translate to 2.3 - success/no autofill',result)

result=[]
for x in old:
  result.append(resultOf(x['in'],toOldCPE(x['in']),x['expect']))
printResults('Translate to 2.2 - success/no autofill',result)

result=[]
for x in pad1:
  result.append(resultOf(x['in'],pad(x['in'],5),x['expect']))
for x in padtext1:
  result.append(resultOf(x['in'],pad(x['in'],5,'-'),x['expect']))
for x in padtext2:
  result.append(resultOf(x['in'],pad(x['in'],5,'text'),x['expect']))
printResults('Padding lists    - empty, char and text - ',result)

예제 #8
0
파일: test.py 프로젝트: PidgeyL/cve-search
]
padtext2 = [
    {"in": ["a", "b", "c"], "expect": ["a", "b", "c", "text", "text"]},
    {"in": ["a", "b", "c", "d", "e"], "expect": ["a", "b", "c", "d", "e"]},
    {"in": ["a", "b", "c", "d", "e", "f"], "expect": ["a", "b", "c", "d", "e", "f"]},
]

result = []
for x in extend:
    result.append(resultOf(x["in"], toStringFormattedCPE(x["in"], autofill=True), x["expect"]))
printResults("Translate to 2.3 - success/autofill", result)

result = []
for x in trans:
    result.append(resultOf(x["in"], toStringFormattedCPE(x["in"]), x["expect"]))
printResults("Translate to 2.3 - success/no autofill", result)

result = []
for x in old:
    result.append(resultOf(x["in"], toOldCPE(x["in"]), x["expect"]))
printResults("Translate to 2.2 - success/no autofill", result)

result = []
for x in pad1:
    result.append(resultOf(x["in"], pad(x["in"], 5), x["expect"]))
for x in padtext1:
    result.append(resultOf(x["in"], pad(x["in"], 5, "-"), x["expect"]))
for x in padtext2:
    result.append(resultOf(x["in"], pad(x["in"], 5, "text"), x["expect"]))
printResults("Padding lists    - empty, char and text - ", result)