diff options
author | Gerald Combs <gerald@wireshark.org> | 2018-10-08 13:25:36 -0700 |
---|---|---|
committer | Gerald Combs <gerald@wireshark.org> | 2018-11-16 19:28:11 +0000 |
commit | f300676beca0a6358a7e1ca0349b7160f7cf6de5 (patch) | |
tree | 106109e36e559c23cc33a8b5098aeb48a4a28861 /test/subprocesstest.py | |
parent | 377f5d0de76628371b7ef436783c6720de36b588 (diff) |
Dumpcap: Fix writing SHBs and IDBs.
If we have a single capture source and that capture source is pcapng and
we're writing a pcapng file, do the following:
- Pass its SHB and IDBs through unmodified. Don't save or write command
line interface IDBs.
- Save the most recent SHB and IDBs so that we can write them when we're
writing multiple output files.
If we have multiple capture sources, do the following:
- Write Dumpcap's SHB.
- Keep a global list of IDBs, consisting of both command line interfaces
and IDBs read from pcapng sources.
- When reading an EPB or ISB, remap its local interface number to its
corresponding global number.
Add Dumpcap pcapng section tests. Make the application IDs in the
"many_interfaces" captures unique.
Change-Id: I2005934c1f83d839727421960005f106d6c682dd
Reviewed-on: https://code.wireshark.org/review/30085
Petri-Dish: Gerald Combs <gerald@wireshark.org>
Tested-by: Petri Dish Buildbot
Reviewed-by: Gerald Combs <gerald@wireshark.org>
Diffstat (limited to 'test/subprocesstest.py')
-rw-r--r-- | test/subprocesstest.py | 14 |
1 files changed, 13 insertions, 1 deletions
diff --git a/test/subprocesstest.py b/test/subprocesstest.py index 9f6b2f001f..2510ce8992 100644 --- a/test/subprocesstest.py +++ b/test/subprocesstest.py @@ -9,7 +9,6 @@ # '''Subprocess test case superclass''' -import config import difflib import io import os @@ -35,6 +34,19 @@ def cat_dhcp_command(mode): sd_cmd += os.path.join(this_dir, 'util_dump_dhcp_pcap.py ' + mode) return sd_cmd +def cat_cap_file_command(cap_files): + '''Create a command string for dumping one or more capture files to stdout''' + # XXX Do this in Python in a thread? + if isinstance(cap_files, str): + cap_files = [ cap_files ] + quoted_paths = ' '.join('"{}"'.format(cap_file) for cap_file in cap_files) + if sys.platform.startswith('win32'): + # https://docs.microsoft.com/en-us/previous-versions/windows/it-pro/windows-xp/bb491026(v=technet.10) + # says that the `type` command "displays the contents of a text + # file." Copy to the console instead. + return 'copy {} CON'.format(quoted_paths) + return 'cat {}'.format(quoted_paths) + class LoggingPopen(subprocess.Popen): '''Run a process using subprocess.Popen. Capture and log its output. |