Beispiel #1
0
       
       packet_import_to_db(filename[0],filename[1])

    #支持多进程,此处等待数据库写入完成  
    if commonlib.IsSupportMutiThread() != 0:
        httpmutithread.httpThreadReadEndSet(1)
        httpmutithread.threadwait()
    flag = True
    while flag:
        print "数据准备完成"
        print '请选择你需要的功能点,输入数字进行选择'
        print '1、输出一段时间内url的访问记录'
        print '2、在报文中查找关键字'
        print '3、退出'
        choice = str(raw_input())
        if choice == '1':
            cmdStr = url_make_cmdStr(dbTableName)
            statistics.url_Statistics(dbTableName,cmdStr)
        elif choice == '2':
            keyword = str(raw_input('请输入关键字 : '))
            n = str(raw_input('请输入需要打印的记录的条数 :'))
            #这里需要对参数n的有效性做校验
            statistics.keyword_statistcis(dbTableName,keyword,string.atoi(n))
        else :
            break
            

    
        
    
Beispiel #2
0
        #print 'this pcap file have been saved in DB'
        print 'pcap文件已经记录在数据库中,直接读取数据库数据'
        #print 'this pcap file pcap packet from %s to %s'%(timeformat_sec_to_date(firsttime),timeformat_sec_to_date(lasttime))
    else:
        print '读取pcap文件到数据库中,请稍等'

        packet_import_to_db(filename[0], filename[1])

    #支持多进程,此处等待数据库写入完成
    if commonlib.IsSupportMutiThread() != 0:
        httpmutithread.httpThreadReadEndSet(1)
        httpmutithread.threadwait()
    flag = True
    while flag:
        print "数据准备完成"
        print '请选择你需要的功能点,输入数字进行选择'
        print '1、输出一段时间内url的访问记录'
        print '2、在报文中查找关键字'
        print '3、退出'
        choice = str(raw_input())
        if choice == '1':
            cmdStr = url_make_cmdStr(dbTableName)
            statistics.url_Statistics(dbTableName, cmdStr)
        elif choice == '2':
            keyword = str(raw_input('请输入关键字 : '))
            n = str(raw_input('请输入需要打印的记录的条数 :'))
            #这里需要对参数n的有效性做校验
            statistics.keyword_statistcis(dbTableName, keyword, string.atoi(n))
        else:
            break
Beispiel #3
0
    else : 
        print 'read pcap file to database,please wait'
        #packet_import_to_db()


    flag = True
    while flag:
        print 'please select which function you want'
        print '1.sort the url record between time'
        print '2.find the keyword in http packet'
        print '3.exit'
        choice = str(raw_input())
        if choice == '1':
            cmdStr = url_make_cmdStr()
           
            statistics.url_Statistics(filename,cmdStr)
        elif choice == '2':
            keyword = str(raw_input('please input the keyword '))
            n = str(raw_input('please input the print item num '))
            statistics.keyword_statistcis(filename,keyword,string.atoi(n))
        else :
            break
            
=======


firsttime = 0
lasttime = 0
tabel_line = {}  #数据库行存储结构

def packet_import_to_db():