Example #1
0
def main():
    #mkdir output_path
    APPCONFIG.mkdir_p(APPCONFIG.GlobalConfig["outputpathname"])
    xmlfile=open(APPCONFIG.GlobalConfig["xmlfilename"], 'r')
    root = etree.parse(xmlfile)
    for element in root.iter("session"):
    	line=element.attrib.items()
	APPCONFIG.xmlbuffer.append(line)
    if APPCONFIG.GlobalConfig["isNetdude"] == True:
        logging.info("splitting pcap trace into flows by netdude")
        #SplitPcapByNetdude()
        SplitPcapByTraverseNetdudeDir()
    if APPCONFIG.GlobalConfig["isSplit"]==True:
        logging.info("splitting pcap trace into flows")
        SplitPcap()
    if APPCONFIG.GlobalConfig["isMerge"]==True:
        logging.info("Merging flows into applications")
        MergepcapInDir(APPCONFIG.GlobalConfig["outputpathname"])
    if APPCONFIG.GlobalConfig["isFeature"]==True:
        logging.info("computing flow features")
        FeatureCompute(APPCONFIG.GlobalConfig["outputpathname"])
    if APPCONFIG.GlobalConfig['ismergearff']==True:
        logging.info ("merging arff filenames")
        MergeARFF(APPCONFIG.GlobalConfig["outputpathname"])
    logging.info("---done---")
Example #2
0
                   help="generate run.sh, default is ./runall.sh")
 (options, args) = parser.parse_args()
 
 output_real_arff_file_name=""
 
 arguments_list=[]
 items = set()
 
 if options.output_arff_path_name:
     if os.path.isdir(options.output_arff_path_name):
         output_real_path_file_name= os.path.abspath(options.output_arff_path_name)
     elif os.path.isfile(options.output_arff_path_name):
         print ("error, file exists, plz specify a director")
         exit()
     else:
         APPCONFIG.mkdir_p(options.output_arff_path_name)
         output_real_path_file_name=options.output_arff_path_name
 patern=re.compile('[a-zA-Z]')    
 if options.from_path:
     if os.path.isdir(options.from_path):
         #for f in glob.glob(os.path.join(options.from_path, '*.pcap')):
         #    if os.path.isfile(f):
         #        items.add(os.path.abspath(f))
         for (thisDir, subsHere, filesHere) in os.walk(options.from_path):
             for filename in filesHere:
                 (shortname, extension) = os.path.splitext(filename)
                 pcapfullname = os.path.join(thisDir,filename)
                 if( os.path.isfile(pcapfullname) and (extension==".pcap" or extension == ".PCAP" ) ):
                     m = shortname.split('.')[-1]
                     #print (m)
                     if   patern.search(m):  # in shortname.split('.')[-1]: