Reputation: 17
os.system("'C:\Program Files\Wireshark\tshark.exe' -r B2.pcap -T fields -e frame.number -e frame.time -e ip.src -e tcp.srcport -e ip.dst -e tcp.dstport -e ip.proto -e ip.flags.syn -e ip.flags.nf -e ip.flags.df -e frame.len -E header=y -E separator=, > traffic.csv")
I'm trying to run the above command in python but its reading the \t in the \tshark.exe part as a tab character. How do I solve this?
Upvotes: 0
Views: 1047
Reputation: 2741
Probably because this one is wrapped in string?
"'C:\Program Files\Wireshark\tshark.exe'..."
try using raw string.
Upvotes: 0
Reputation: 307
try
os.system("'C:\Program Files\Wireshark\\tshark.exe' -r B2.pcap -T fields -e frame.number -e frame.time -e ip.src -e tcp.srcport -e ip.dst -e tcp.dstport -e ip.proto -e ip.flags.syn -e ip.flags.nf -e ip.flags.df -e frame.len -E header=y -E separator=, > traffic.csv")
Backslashes are used to "escape" characters and if you want to print out a backslash, you have to escape it with another backslash
Upvotes: 1