コード例 #1
0
def populate_exploits(drop):
    """
    Populate default set of exploits into the system.

    :param drop: Drop the existing collection before trying to populate.
    :type: boolean
    """

    # define your CVE's here
    cves = ['CVE-2009-4329']
    if drop:
        Exploit.drop_collection()
    if len(Exploit.objects()) < 1:
        for cve in cves:
            ex = Exploit()
            ex.name = cve
            ex.save()
        print "Exploits: added %s exploits!" % len(cves)
    else:
        print "Exploits: existing documents detected. skipping!"