Пышарк не может пройти через PCAP - PullRequest
0 голосов
/ 09 января 2019

Я пытаюсь извлечь некоторые важные детали из файла PCAP. Я пробовал Pyshark и Scapy, но каждый раз, когда я пытаюсь перебрать файл, возникает исключение.

def process_pcap(pcap_file):
packet_stats = {}
log.info('Opening PCAP file')
packet_data = pyshark.FileCapture(pcap_file)
summaries = pyshark.FileCapture(pcap_file, only_summaries=True)
packets = zip(packet_data, summaries) 
log.info('Starting to parse PCAP file and collect stats')
for pkt, summary in packets:
    log.DEBUG(pkt.eth.scr, summary)
    # Count the total number of packets 
    if pkt.eth.scr or pkt.eth.dst in packet_stats.keys():
        total_packets[pkt.eth.dst][0] += 1   
    else:
        total_packets[pkt.eth.dst][0] = 1
        total_packets[pkt.eth.dst][1] = 0
    # Count the total number of retransmissions
    if 'retransmission' in summary.lower:
        total_packets[pkt.eth.dst][1] += 1 
log.info('Completed parsing and collecting stats')
return packet_stats

Выдает эту ошибку -> RuntimeError: Невозможно запустить цикл обработки событий во время выполнения другого цикла

Кто-нибудь имел эту проблему?

...