Ejemplo n.º 1
0
import json

from lib.PluginManager import PluginManager

pm = PluginManager()
pm.loadPlugins()

cves = {}
for _id in pm.getAllCVEIDs():
    cves[_id] = pm.getCVERefs(_id)

for _id in pm.getAllCVEIDs():
    cves[_id] = pm.updateRefs(_id, cves[_id])

open("VIA4CVE-feed.json", "w").write(json.dumps(cves))
Ejemplo n.º 2
0
        action='store_true',
        help="Verify that the created file passes the unit test")

    args = parser.parse_args()

    pm = PluginManager()  # Create plug-in manager
    pm.loadPlugins()  # Load all sources & parse data

    cves = {}  # Create empty dictionary to fill up
    path = args.file if args.file else "VIA4CVE-feed.json"  # Generate path based on user preferences

    for _id in pm.getAllCVEIDs():
        cves[_id] = pm.getCVERefs(_id)  # Get data per CVE
    if not args.no_update:
        for _id in cves.keys():
            pm.updateRefs(_id, cves[_id])  # Update data based on previous data
    if not args.no_cleanup:
        for _id in cves.keys():
            pm.cleanUp(_id, cves[_id])  # Clean data

    data = {
        'cves': cves,
        'metadata': {
            'searchables': pm.getSearchables(),
            'sources': pm.getPluginNames()
        }
    }

    open(path, "w").write(json.dumps(data))  # Write data to path

    if args.verify: