Пример #1
0
def parserule(path):
    gvid=[]
    for line in open(path):
        line=line.strip()
        if line:
            rinfo=lib_rule.parserule(line)
            if rinfo:
                gvid.append(getvid4info(rinfo['body']))
    return gvid
Пример #2
0
    outinfo.write('desc:%s\n' %desc)
    mylock.release()

i=1
pool=lib_TheardPool.threadpool()
mylock=threading.RLock()

dinfo=['msg','sid','gid','rev','reference']

for line in inrule:
    line=line.strip()
    if line:
        if line.find('noalert')>0:
            printerror("noalert: %s" %line)
            continue
        prule=lib_rule.parserule(line,i)
        vinfo=['msg','sid','gid','rev','','','']
        for info in prule['body']:
            try:
                index=dinfo.index(info[0].strip())
                if index<4:
                    vinfo[index]=lib_rule.mystrip(info[1])
                else:
                    key,value=info[1].split(',')
                    try:
                        index=['cve','bugtraq','cnvd'].index(key)
                        vinfo[index+4]=value
                    except ValueError:
                        pass
            except ValueError:
                pass