Reputation: 77
I want to capture pcap (logs) in Wireshark using python, so basically I have to launch Wireshark though Python script which can be achieved using subprocess.call() or os.system() or os.startfile(). Now how to select the interface [ Wi-Fi,Ethernet] using python and after selecting interface how to save the capture using python? (click on the stop capturing packets button in taskbar -> click on 'file' in taskbar -> click on 'save as'-> give the filename -> give the location-> save)
I don't want to use pyshark, i want to capture packet using Wireshark only .
Thank you
Upvotes: 2
Views: 9994
Reputation: 77
I recommend nice project that is practically a wrapper around tshark and written in python - pyshark. It is easy to use and you can play with pcaps or live streams.
Upvotes: 1
Reputation: 927
I sense an X Y problem. UI is meant for a User, not to be manipulated programmatically.
Instead take a look at....
tshark
- Dump and analyze network trafficTShark is a network protocol analyzer. It lets you capture packet data from a live network, or read packets from a previously saved capture file, either printing a decoded form of those packets to the standard output or writing the packets to a file. TShark's native capture file format is pcap format
dumpcap
- Dump network trafficDumpcap is a network traffic dump tool. It lets you capture packet data from a live network and write the packets to a file. Dumpcap's default capture file format is pcapng format. When the -P option is specified, the output file is written in the pcap format.
Fiddler supports a variety of command line arguments that control various options:
Fiddler Command-Line Help Usage:
fiddler.exe [options] [FileToLoad.saz]
tcpdump (Most of the above are based on this or use this)
This is the official web site of tcpdump, a powerful command-line packet analyzer; and libpcap, a portable C/C++ library for network traffic capture.
Upvotes: 2