def getcnvdlist(): print "Get cnvdlist from pkl......" cnvdlist=[] for i in range(2002,2016): year=lib_pickle.get4file('F:\\CVEVD\\cnvd_%d.pkl' %i) cnvdlist.extend(year) return cnvdlist
def getcvelist(): print "get clear cvelist from pkl" cvelist=lib_pickle.get4file('F:/CVEVD/cvelist.pkl') for i in cvelist: i=isexist(cnvdlist,i[0],0) if i>=0: cvelist.remove(i) return cvelist
#end=line.find("[**]",f+4) return line[s+8:f]#,line[f+4:end-1] def getcwdpcap(line): s=line.find('"') e=line.find('"',s+1) return line[s+1:e] if len(sys.argv)<4: print "parameter is lack,again" exit(0) logname=sys.argv[1] rulename=sys.argv[2] outfname=sys.argv[3] grs=lib_pickle.get4file(rulename) """ f=open(logname) for line in f: sid=getinfo(line) if not sid: continue if len(grs[sid])<2: grs[sid].append(set([cwdpcap])) else: grs[sid][1].add(cwdpcap) outf=open(outfname,'w') """ for sid,info in grs.items():
if not os.path.isdir(args['-p']): print "the path must be a dir" exit(1) os.chdir(args['-p']) if args['-r']!='': if not os.path.isfile(args['-r']): print "%s is not exist,please input real path for rule file" %args['-r'] exit(1) grs=lib_rule.getinfo4rule(args['-r'],2) print "load numbers of rule:",len(grs) if len(grs): lib_pickle.dump2file(args['-p']+"/rule.pkl",grs) if args['-rpk']!='': if os.path.isfile("rule.pkl"): grs=lib_pickle.get4file("rule.pkl") print "load numbers of rule:",len(grs) else: print "rule.pkl is not exist,please input real path for rule file" exit(1) if not len(grs): print "load rules error,again" exit(1) snortlist(args['-p']) print "snort exit..." rsf=open('rs.txt','w') rsf.write(str(grs)) rsf.close()
tmax=50 ivt=1 start=2002 end=2016 getallcnvd() if pos==1: print "craw ok" exit() exit() getallcve() cnvdlist=getcnvdlist() cvelist=getcvelist() gvid=lib_pickle.get4file('F:/CVEVD/gvid.pkl') print len(cnvdlist),len(cvelist),len(gvid) clearover(gvid,cnvdlist,cvelist) os.system('shutdown /s /t 3') #cnvdlist=getcnvdlist() #cvebid=[] #getcnvdlist() #mylock=threading.RLock() #cvecnvd=getcvecnvd() #print len(cvecnvd) #lib_pickle.dict2txt('F:/CVEVD/cvecnvd.txt',cvecnvd) #getcve() #print len(cvebid)