3 # Wireshark test dummy extcap
5 # Copyright (c) 2018-2019 Peter Wu <peter@lekensteyn.nl>
7 # SPDX-License-Identifier: GPL-2.0-or-later
9 import argparse
, codecs
, os
, sys
11 parser
= argparse
.ArgumentParser()
14 parser
.add_argument('--extcap-interfaces', action
='store_true')
15 parser
.add_argument('--extcap-dlts', action
='store_true')
16 parser
.add_argument('--extcap-config', action
='store_true')
17 parser
.add_argument('--capture', action
='store_true')
18 parser
.add_argument('--extcap-version')
20 parser
.add_argument('--extcap-interface', metavar
='IFACE')
22 parser
.add_argument('--extcap-capture-filter', metavar
='CFILTER')
23 parser
.add_argument('--fifo', metavar
='FIFO')
26 def extcap_interfaces():
27 print("extcap {version=1.0}")
28 print("interface {value=sampleif}{display=Remote dumpcap}")
32 # Required for the interface to show up in the interface list
33 print("dlt {number=147}{name=USER0}{display=Remote capture dependent DLT}")
37 print("arg {number=0}{call=--test1}{display=Remote SSH server address}{type=string}{tooltip=bla}{required=true}{group=Server}")
38 print("arg {number=1}{call=--test2}{display=[7] UrzÄ…dzenie kompozytowe USB}{type=string}{tooltip=X}{group=Capture}")
42 # In Python 3.6 and older, the encoding of stdout depends on the locale.
43 # Do not rely on that and force a sane encoding instead. Python 3.7 has
44 # improved, see https://www.python.org/dev/peps/pep-0540/
45 sys
.stdout
= codecs
.getwriter('utf-8')(sys
.stdout
.detach())
47 args
= parser
.parse_args()
48 if args
.extcap_interfaces
:
49 return extcap_interfaces()
53 elif args
.extcap_config
:
54 return extcap_config()
56 parser
.error('Unsupported')