Ejemplo n.º 1
0
def sendnotification(org=None, cve=None):
    if org is None or cve is None:
        return False
    for destination in r.smembers("d:"+org):
        for c in cve:
            print ("notification of " + c + " to " + destination)

# Redis db 10 (cpe)
# Redis db 11 (notification)

# Set of notification for an organization set(d:orgname) -> notification destination
# Set of cpe value for an organization set(c:orgname) -> cpe values
# Set of organizations set(orgs) -> organisations

# Set of state notification set(s:orgs) -> CVEs
r = Configuration.getRedisNotificationsConnection()

if args.a and args.r and args.n and args.f and args.l:
    argParser.print_help()
    exit(1)

if args.a:
    checkreq()
    if not r.sismember("orgs", args.g):
        if args.v:
            print ("Organization "+args.g+" added.")
        r.sadd("orgs", args.g)

    for cpe in args.c:
        r.sadd("c:"+args.g, cpe)
        if args.v: