Esempio n. 1
0
def test_rule_info():
    test_info = {}
    cve = CveParse(rule_path, target_directory)
    tree = cve.parse_xml(rule_cve_path)
    root = tree.getroot()
    cves = root.findall('.//cve')
    for cvea in cves:
        test_info = cve.rule_info(cvea)
    assert 'cpe' in test_info
Esempio n. 2
0
def test_cve_info():
    test_info = {}
    cve = CveParse(rule_path, target_directory)
    tree = cve.parse_xml(cve.cve_file)
    root = tree.getroot()
    childs = root.findall('.//%sentry' % cve.NS)
    for child in childs:  # child is entry Element
        test_info = cve.cve_info(child)
    assert isinstance(test_info, dict)
Esempio n. 3
0
def test_rule_info():
    test_info = {}
    cve = CveParse(rule_path, target_directory)
    tree = cve.parse_xml(rule_cve_path)
    root = tree.getroot()
    cves = root.findall('.//cve')
    for cvea in cves:
        test_info = cve.rule_info(cvea)
    assert 'cpe' in test_info
Esempio n. 4
0
def test_cve_info():
    test_info = {}
    cve = CveParse(rule_path, target_directory)
    tree = cve.parse_xml(cve.cve_file)
    root = tree.getroot()
    childs = root.findall('.//%sentry' % cve.NS)
    for child in childs:  # child is entry Element
        test_info = cve.cve_info(child)
    assert isinstance(test_info, dict)
Esempio n. 5
0
def test_get_scan_result():
    cve = CveParse(rule_path, target_directory)
    cve.scan_cve(rule_cve_path)
    assert 'flask-migrate:==1.8.0' in cve.get_scan_result()
Esempio n. 6
0
def test_get_rule():
    cve = CveParse(rule_path, target_directory)
    cve.rule_parse(rule_cve_path)
    assert 'flask vul' in cve.get_rule()
Esempio n. 7
0
def test_rule_xml():
    cve = CveParse(rule_path, target_directory)
    cve.rule_xml()
    print(rule_cve_one)
    assert os.path.exists(rule_cve_one)
    os.remove(rule_cve_one)
Esempio n. 8
0
def test_get_result():
    cve = CveParse(rule_path, target_directory)
    cve.cve_parse()
    assert 'CVE-2017-5645' in cve.get_result()
Esempio n. 9
0
def test_parse_xml():
    cve = CveParse(rule_path, target_directory)
    tree = cve.parse_xml(cve.cve_file)
    root = eT.parse(rule_path)
    assert isinstance(tree, type(root))
Esempio n. 10
0
def test_get_scan_result():
    cve = CveParse(rule_path, target_directory)
    cve.scan_cve(rule_cve_path)
    assert 'flask:0.10.1' in cve.get_scan_result()
Esempio n. 11
0
def test_get_scan_result():
    cve = CveParse(rule_path, target_directory)
    cve.scan_cve(rule_cve_path)
    assert 'flask-migrate:==1.8.0' in cve.get_scan_result()
Esempio n. 12
0
def test_get_rule():
    cve = CveParse(rule_path, target_directory)
    cve.rule_parse(rule_cve_path)
    assert 'flask vul' in cve.get_rule()
Esempio n. 13
0
def test_rule_xml():
    cve = CveParse(rule_path, target_directory)
    cve.rule_xml()
    print(rule_cve_one)
    assert os.path.exists(rule_cve_one)
    os.remove(rule_cve_one)
Esempio n. 14
0
def test_get_result():
    cve = CveParse(rule_path, target_directory)
    cve.cve_parse()
    assert 'CVE-2017-5645' in cve.get_result()
Esempio n. 15
0
def test_parse_xml():
    cve = CveParse(rule_path, target_directory)
    tree = cve.parse_xml(cve.cve_file)
    root = eT.parse(rule_path)
    assert isinstance(tree, type(root))
Esempio n. 16
0
def test_get_scan_result():
    cve = CveParse(rule_path, target_directory)
    cve.scan_cve(rule_cve_path)
    assert 'flask:0.10.1' in cve.get_scan_result()