TShark seems to have crashed (retcode: 2). Try rerunning in debug mode [ capture_obj.set_debug() ] or try updating tshar

See original GitHub issue

my code example1

        caps = pyshark.FileCapture(self.filename)
        caps.set_debug()
        #self.caps_len = len(caps)
    
        src_host = ""
        dst_host = ""
        flow_packet = 0
        flow_bytes = 0
        index = 0 
        for counter,packet in enumerate(caps):
            if 'tcp' in dir(packet):
                #print(packet.tcp.stream)
                print(counter)
                src_host = packet.ip.src
                dst_host = packet.ip.dst
                flow_packet += 1
                flow_bytes += int(packet.tcp.len,10)
                if packet.tcp.stream not in self.features:
                    self.features.update({packet.tcp.stream:[src_host,dst_host,flow_packet,flow_bytes]})
                else:
                    self.features[packet.tcp.stream][2]+=1  #ToDoList
                    self.features[packet.tcp.stream][3]+=flow_bytes
                    pass #todo list

        return src_host,dst_host,flow_packet,flow_bytes

there was wrong

TShark seems to have crashed (retcode: 2). Try rerunning in debug mode [ capture_obj.set_debug() ] or try updating tshar

but if I use code example2

    file = './peer0.org1.pcap'
    cap = pyshark.FileCapture(file)
    #cap.load_packets(timeout=100000000)
    #cap.set_debug()
    for counter, pkt in enumerate(cap):
        if "tcp" in dir(pkt):
            print(pkt.tcp.stream)
            print(counter)

there not any wrong , what should I do my example1 could work normal?

Issue Analytics

  • State:open
  • Created 2 years ago
  • Comments:5

github_iconTop GitHub Comments

1reaction
luoyexiaohecommented, Apr 29, 2022

gays, I know how to deal with this. call the function named set_debug ,then you could see what’s the problem in console. my problem is that my wireshark is break. when I install it again , problem gone . good luck !

0reactions
wangzeyu9766commented, Jul 12, 2022

You need version correspondence me : Wireshark-win64-2.4.2/ pyshark==0.4.2.7 This error will also occur if you illegally block and intercept good luck!

Read more comments on GitHub >

github_iconTop Results From Across the Web

tshark crashes: reading large packet captures via lua_script
Hi, I am trying to read and process a packet captures(pcap)of 1 GB, using tshark & lua_script using listerners, but the system memory ......
Read more >
Debugging Application Errors — Flask Documentation (2.2.x)
The debugger is enabled by default when the development server is run in debug mode. $ flask --app hello --debug run. When running...
Read more >
Pyshark - tshark can't use user plugin in 'decode_as'
TSharkCrashException : TShark seems to have crashed (retcode: 1). Try rerunning in debug mode [ capture_obj.set_debug() ] or try updating ...
Read more >
Manual: Debug C# code in Unity
The Build Settings menu with Development Build, Script Debugging, and Wait for Managed Debugger enabled. Attach your code editor to the Unity Player....
Read more >
Debug DAGs | Astronomer Documentation
Run airflow dags list with the Airflow CLI to make sure that Airflow has registered the DAG in the metastore. If the DAG...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found