Welcome to OStack Knowledge Sharing Community for programmer and developer-Open, Learning and Share
Welcome To Ask or Share your Answers For Others

Categories

0 votes
383 views
in Technique[技术] by (71.8m points)

popen - starting tshark with python - invalid command

I'm trying to start tshark with python. Testing the command in command line seems to be OK. but while starting it with python, I'm getting error as described below.

Any idea what is going wrong?

cmd1='"tshark -i 1 -Y "ssdp" -T fields -E separator=, -E header=y -e ip.id -e ip.checksum"'
cmd=shlex.split(cmd1)

try:
    tsharkProc = subprocess.Popen(cmd,
                                  shell=True,
                                  stdout=subprocess.PIPE,
                                  executable="C:\Program Files\Wireshark\tshark.exe")
except:
    print("ERROR {} while running {}".format(sys.exc_info()[1], cmd))

And the error:

Capturing on 'Ethernet 2' tshark: Invalid capture filter "/c tshark -i 1 -Y ssdp -T fields -E separator=, -E header=y -e ip.id -e ip.checksum" for interface 'Ethernet 2'.

That string isn't a valid capture filter (can't parse filter expression: syntax error). See the User's Guide for a description of the capture filter syntax. 0 packets captured

question from:https://stackoverflow.com/questions/65861538/starting-tshark-with-python-invalid-command

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome To Ask or Share your Answers For Others

1 Answer

0 votes
by (71.8m points)
Waitting for answers

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome to OStack Knowledge Sharing Community for programmer and developer-Open, Learning and Share
Click Here to Ask a Question

...