def write2file(vinfo): print "task======",vinfo if vinfo[6]: desc=lib_rule.getdesc4cnvd(vinfo[6],'gbk')[1] elif vinfo[4]: desc=lib_rule.getdesc4cve(vinfo[4])[1] desc=lib_rule.transen2zh(desc,'gbk') elif vinfo[5]: desc=lib_rule.getdesc4bid(vinfo[5])[1] desc=lib_rule.transen2zh(desc,'gbk') else: #printerror("Error in %s" %vinfo[1]) #exit(0) desc="" mylock.acquire() outinfo.write('@=========================\n') outinfo.write('msg:%s\n' %vinfo[0]) outinfo.write('sid:%s\n' %vinfo[1]) outinfo.write('gid:%s\n' %vinfo[2]) outinfo.write('rev:%s\n' %vinfo[3]) outinfo.write('cve:%s\n' %vinfo[4]) outinfo.write('bid:%s\n' %vinfo[5]) outinfo.write('cnvd:%s\n' %vinfo[6]) outinfo.write('desc:%s\n' %desc) mylock.release()
def getvid4cnvd(pool,cnvd):#,http): #print cnvd, edesc='' ename='' try: cve,bid,cname,cdesc=lib_rule.getdesc4cnvd(cnvd,code='gbk',vid=True)#,rhttp=http) if cve: c_bid,edesc=lib_rule.getdesc4cve(cve)#,rhttp=http) if bid=='NULL':bid=c_bid if bid: ename=lib_rule.getdesc4bid(bid)[0] if ename:ename=ename.encode('gbk') cnvdlist.append((cve,bid,cnvd,cname,cdesc,ename,edesc)) print cnvd, except Exception: print "\nError: %s" %cnvd