3

while running the cap.sniff(timeout=20),pyshark in python, i got the following errorTraceback (most recent call last): File "<stdin>", line 1, in <module> File "C:\Users\user\AppData\Local\Programs\Python\Python36-32\lib\site-packages\pyshark\capture\capture.py", line 132, in load_packets self.apply_on_packets(keep_packet, timeout=timeout) File "C:\Users\user\AppData\Local\Programs\Python\Python36-32\lib\site-packages\pyshark\capture\capture.py", line 247, in apply_on_packets return self.eventloop.run_until_complete(coro) File "C:\Users\user\AppData\Local\Programs\Python\Python36-32\lib\asyncio\base_events.py", line 468, in run_until_complete return future.result() File "C:\Users\user\AppData\Local\Programs\Python\Python36-32\lib\asyncio\tasks.py", line 362, in wait_for raise futures.TimeoutError() concurrent.futures._base.TimeoutError

what is this error about and how can i solve it to run my capturing successfull

1 Answers1

0

The error given is a TimeoutError, so that probably means that timeout that you set is too low. If the the task takes longer than the timeout (in seconds), it will cause a TimeoutError.

To fix this, you need to set a higher timeout. Try cap.sniff(timeout=50) to see if 50 seconds is long enough. You should try some different timeouts to see how long you need.

Luke B
  • 2,075
  • 2
  • 18
  • 26
  • i have tried 50,60,70,90,100,150 still the same error – user3306040 Aug 13 '18 at 15:58
  • i have tried 50,60,70,90,100,150 also 500 still the same error – user3306040 Aug 13 '18 at 16:15
  • @user3306040 does it wait 70 seconds before the error happens if you use 70 for the timeout? (Or whatever number you try?) – Luke B Aug 13 '18 at 17:04
  • it waits for that amount of time. and now after the error it is showing ' TShark seems to have crashed (retcode: 1). Try rerunning in debug mode [ capture_obj.set_debug() ] or try updating tshark.' i tried pip install tshark but got this on 'Could not find a version that satisfies the requirement tshark (from versions: ) No matching distribution found for tshark' – user3306040 Aug 13 '18 at 17:12
  • @user3306040 what happens if you do `cap.set_debug()` before the `cap.sniff` line? See if there is anything special printed to the console. – Luke B Aug 13 '18 at 18:44
  • when run with cap=pyshark.LiveCapture(output_file='p.pcap') error :---- dumpcap: There is no interface with that adapter index and when interface is specified cap=pyshark.LiveCapture(interface='wlan0',output_file='p.pcap') error---- Capturing on 'wlan0' dumpcap: The capture session could not be initiated on interface 'wlan0' (Error opening adapter: The system cannot find the device specified. (20)). Please check that "wlan0" is the proper interface. – user3306040 Aug 13 '18 at 20:22
  • is there problem with my system – user3306040 Aug 13 '18 at 21:03