desowin / usbpcap

USB packet capture for Windows
http://desowin.org/usbpcap
902 stars 170 forks source link

Rework commandline arguments handling #54

Closed desowin closed 6 years ago

desowin commented 6 years ago

Use getopt implementation from MinGW runtime.

Tested against Wireshark 2.0.16 and 2.9.0-1285. Everything works fine in the Wireshark Legacy (GTK+) interface in 2.0.16.

In Wireshark 2.9.0-1285, an empty --devices parameter immadietely before --capture-from-all-devices can be triggered by doing:

  1. Open Wireshark, select USBPcap interface, open options
  2. Expand any parent USB device, click on child device name
  3. Start capture
  4. Click Stop capture button in the toolbar
  5. Click Start capture button in toolbar, continue without saving data
  6. Watch that no packets are being captured

In point 5 USBPcapCMD is executed with following parameters: USBPcapCMD.exe -d \.\USBPcap3 -b 1048576 -o \.\pipe\wiresharkextcap\.\USBPcap3_20180728132117 --devices --capture-from-all-devices --capture-from-new-devices

This makes getopt to consider --capture-from-all-devices as a parameter to --devices and thus USBPcapCMD fails with the: "Malformed address list. Invalid character: -."

While it would be nice to implement extcap control message passing to display this error in Wireshark status bar, it is not done yet.