### PowerShell Example Source: https://gitlab.com/wireshark/wireshark/-/blob/master/doc/common_src/typographic_conventions.adoc Example of a PowerShell prompt with a comment and a command to list installed software. ```powershell PS$> choco list -l ``` -------------------------------- ### BSD Systems Setup Script Options Source: https://gitlab.com/wireshark/wireshark/-/blob/master/doc/wsdg_src/wsdg_quick_setup.adoc View options for the BSD systems setup script to install optional software. ```bash tools/bsd-setup.sh --help ``` -------------------------------- ### Debian/Ubuntu Setup Script Options Source: https://gitlab.com/wireshark/wireshark/-/blob/master/doc/wsdg_src/wsdg_quick_setup.adoc View options for the Debian/Ubuntu setup script to install optional software, .deb dependencies, test dependencies, and Qt6 dependencies. ```bash tools/debian-setup.sh --help ``` -------------------------------- ### RPM-based Linux Setup Script Options Source: https://gitlab.com/wireshark/wireshark/-/blob/master/doc/wsdg_src/wsdg_quick_setup.adoc View options for the RPM-based Linux setup script to install optional software, .rpm dependencies, and Qt6 dependencies. ```bash tools/rpm-setup.sh --help ``` -------------------------------- ### Run Automatic Development Setup Script (Linux) Source: https://gitlab.com/wireshark/wireshark/-/blob/master/doc/wsdg_src/wsdg_quick_setup.adoc Execute the setup script for Linux to configure commit templates, hooks, and install dependencies. ```bash tools/setup-dev.sh ``` -------------------------------- ### Alpine Linux Setup Script Options Source: https://gitlab.com/wireshark/wireshark/-/blob/master/doc/wsdg_src/wsdg_quick_setup.adoc View options for the Alpine Linux setup script to install packages and dependencies. ```bash tools/alpine-setup.sh --help ``` -------------------------------- ### Arch Linux Setup Script Options Source: https://gitlab.com/wireshark/wireshark/-/blob/master/doc/wsdg_src/wsdg_quick_setup.adoc View options for the Arch Linux setup script to install packages, dependencies, and test packages. ```bash tools/arch-setup.sh --help ``` -------------------------------- ### SSHDump Examples Source: https://gitlab.com/wireshark/wireshark/-/blob/master/doc/man_pages/sshdump.adoc Examples demonstrating how to use sshdump for various tasks, including getting help, version, interfaces, and interface details. ```APIDOC ## SSHDump Examples ### Description Examples demonstrating how to use sshdump for various tasks, including getting help, version, interfaces, and interface details. ### Method N/A (Command-line tool) ### Endpoint N/A (Command-line tool) ### Examples To see program arguments: ```bash sshdump --help ``` To see program version: ```bash sshdump --version ``` To see interfaces: ```bash sshdump --extcap-interfaces ``` Example output for interfaces: ``` interface {value=sshdump}{display=SSH remote capture} ``` To see interface DLTs: ```bash sshdump --extcap-interface=sshdump --extcap-dlts ``` Example output for DLTs: ``` dlt {number=147}{name=sshdump}{display=Remote capture dependent DLT} ``` To see interface configuration options: ```bash sshdump --extcap-interface=sshdump --extcap-config ``` Example output for configuration options: ``` arg {number=0}{call=--remote-host}{display=Remote SSH server address}{type=string}{tooltip=The remote SSH host. It can be both an IP address or a hostname}{required=true}{group=Server} arg {number=1}{call=--remote-port}{display=Remote SSH server port}{type=unsigned}{default=22}{tooltip=The remote SSH host port (1-65535)}{range=1,65535}{group=Server} arg {number=2}{call=--remote-username}{display=Remote SSH server username}{type=string}{tooltip=The remote SSH username. If not provided, the current user will be used}{group=Authentication} arg {number=3}{call=--remote-password}{display=Remote SSH server password}{type=password}{tooltip=The SSH password, used when other methods (SSH agent or key files) are unavailable.}{group=Authentication} arg {number=4}{call=--sshkey}{display=Path to SSH private key}{type=fileselect}{tooltip=The path on the local filesystem of the private SSH key (OpenSSH format)}{mustexist=true}{group=Authentication} arg {number=5}{call=--sshkey-passphrase}{display=SSH key passphrase}{type=password}{tooltip=Passphrase to unlock the SSH private key}{group=Authentication} arg {number=6}{call=--proxycommand}{display=ProxyCommand}{type=string}{tooltip=The command to use as proxy for the SSH connection}{group=Authentication} arg {number=7}{call=--remote-interface}{display=Remote interface}{type=string}{tooltip=The remote network interface used for capture}{group=Capture} arg {number=8}{call=--remote-capture-command-select}{display=Remote capture command selection}{type=radio}{tooltip=The remote capture command to build a command line for}{group=Capture} value {arg=8}{value=dumpcap}{display=dumpcap} value {arg=8}{value=tcpdump}{display=tcpdump}{default=true} value {arg=8}{value=other}{display=Other:} arg {number=9}{call=--remote-capture-command}{display=Remote capture command}{type=string}{tooltip=The remote command used to capture}{group=Capture} arg {number=10}{call=--remote-priv}{display=Gain capture privilege on the remote machine}{type=radio}{tooltip=Optionally prepend the capture command with sudo or doas on the remote machine}{group=Capture} value {arg=10}{value=none}{display=none}{default=true} value {arg=10}{value=sudo}{display=sudo} value {arg=10}{value=doas -n}{display=doas} arg {number=11}{call=--remote-priv-user}{display=Privileged user name for sudo or doas}{type=string}{tooltip=User name of privileged user to execute the capture command on the remote machine}{group=Capture} arg {number=12}{call=--remote-noprom}{display=No promiscuous mode}{type=boolflag}{tooltip=Don't use promiscuous mode on the remote machine}{group=Capture} arg {number=13}{call=--remote-filter}{display=Remote capture filter}{type=string}{tooltip=The remote capture filter}{default=not ((host myhost) and port 22)}{group=Capture} arg {number=14}{call=--remote-count}{display=Packets to capture}{type=unsigned}{default=0}{tooltip=The number of remote packets to capture. (Default: inf)}{group=Capture} arg {number=15}{call=--log-level}{display=Set the log level}{type=selector}{tooltip=Set the log level}{required=false}{group=Debug} value {arg=14}{value=message}{display=Message}{default=true} value {arg=14}{value=info}{display=Info} ``` ``` -------------------------------- ### Build All Wireshark Guides Source: https://gitlab.com/wireshark/wireshark/-/blob/master/doc/wsdg_src/wsdg_quick_setup.adoc Builds both the Wireshark User's Guide and the Wireshark Developer's Guide. Detailed instructions are in doc/README.documentation.adoc. ```sh make all_guides ``` -------------------------------- ### Install Plugin from Plugin Directory Source: https://gitlab.com/wireshark/wireshark/-/blob/master/doc/wsdg_src/wsdg_plugins.adoc After recompiling, navigate to the specific plugin's directory (e.g., _plugins/foo_) and run 'make install' to install the plugin. This assumes the build environment has been set up correctly. ```sh make install ``` -------------------------------- ### sshdig - Example Capture Configuration Source: https://gitlab.com/wireshark/wireshark/-/blob/master/doc/man_pages/sshdig.adoc Example of how to configure and start a capture session using sshdig with specific remote host and capture command. ```APIDOC ## sshdig - Example Capture Configuration ### Description This example demonstrates how to initiate a capture from a remote host using a specified capture command. ### Method N/A (Command-line tool) ### Endpoint N/A ### Parameters #### Query Parameters - **--extcap-interface** (string) - Required: Specifies the interface to use, e.g., 'eth0'. - **--fifo** (string) - Required: Path to a file or pipe to save captured data. - **--capture** (flag) - Required: Initiates the capture process. - **--remote-host** (string) - Required: The hostname or IP address of the remote server. - **--remote-port** (integer) - Optional: The SSH port on the remote server (defaults to 22). - **--remote-username** (string) - Required: The username for SSH login. - **--remote-capture-command** (string) - Required: The command to execute on the remote host for capture (e.g., 'sysdig --unbuffered --write=-'). ### Request Example ```bash sshdig --extcap-interface=eth0 --fifo=/tmp/capture.pcap --capture --remote-host=myremotehost --remote-port=22 --remote-username=user --remote-capture-command='sysdig --unbuffered --write=-' ``` ### Response #### Success Response (200) Raw packet data is written to the specified FIFO path. No direct console output for successful capture initiation. #### Response Example (No direct console output; data is streamed to the FIFO) ``` -------------------------------- ### Bourne Shell Root User Example Source: https://gitlab.com/wireshark/wireshark/-/blob/master/doc/common_src/typographic_conventions.adoc Example of a Bourne shell prompt for a root user, including a comment and a ninja install command. ```shell # ninja install ``` -------------------------------- ### macOS Homebrew Setup Script Options Source: https://gitlab.com/wireshark/wireshark/-/blob/master/doc/wsdg_src/wsdg_quick_setup.adoc View options for the macOS Homebrew setup script to install required/optional third-party libraries, .dmg dependencies, and Sparkle updater. ```bash tools/macos-setup-brew.sh --help ``` -------------------------------- ### Install Qt DLLs for Wireshark Source: https://gitlab.com/wireshark/wireshark/-/blob/master/CMakeLists.txt Installs Wireshark by executing the windeployqt tool during the install step to ensure all necessary Qt DLLs are copied to the installation directory. ```cmake install(CODE "execute_process(COMMAND \"${QT_WINDEPLOYQT_EXECUTABLE}\" --no-compiler-runtime \" ${CMAKE_INSTALL_PREFIX}/${CMAKE_INSTALL_BINDIR}/Wireshark.exe\")" ``` -------------------------------- ### Command Line Example (Windows) Source: https://gitlab.com/wireshark/wireshark/-/blob/master/doc/README.documentation.adoc This is an example of a command-line prompt and command for Windows systems. ```batch C:\> echo Windows ``` -------------------------------- ### Build WiX Installer Source: https://gitlab.com/wireshark/wireshark/-/blob/master/packaging/wix/README.adoc Use these msbuild commands to build the WiX installer. Ensure you have the WiX toolset installed and configured. ```bash > msbuild /m /p:Configuration=RelWithDebInfo wireshark_wix_prep.vcxproj > msbuild /m /p:Configuration=RelWithDebInfo wireshark_wix.vcxproj ``` -------------------------------- ### Install HTML Documentation Chunks Source: https://gitlab.com/wireshark/wireshark/-/blob/master/CMakeLists.txt Installs generated HTML documentation chunks for user and developer guides, conditionally based on Asciidoctor and xsltproc availability. ```cmake if(ASCIIDOCTOR_FOUND AND XSLTPROC_EXECUTABLE) install( DIRECTORY "${CMAKE_BINARY_DIR}/doc/wsug_html_chunked" DESTINATION "${CMAKE_INSTALL_DOCDIR}" COMPONENT "UserGuide" EXCLUDE_FROM_ALL ) install( DIRECTORY "${CMAKE_BINARY_DIR}/doc/wsdg_html_chunked" DESTINATION "${CMAKE_INSTALL_DOCDIR}" COMPONENT "DeveloperGuide" EXCLUDE_FROM_ALL ) endif() ``` -------------------------------- ### Example: Start Button Macro Source: https://gitlab.com/wireshark/wireshark/-/blob/master/doc/README.documentation.adoc This Asciidoctor macro is used to represent buttons in the UI. It requires the ':experimental:' attribute to be enabled. ```asciidoc btn:[Start] ``` -------------------------------- ### Install Documentation Files Source: https://gitlab.com/wireshark/wireshark/-/blob/master/CMakeLists.txt Installs documentation files to the designated documentation directory. ```cmake install( FILES ${DOC_FILES} DESTINATION ${CMAKE_INSTALL_DOCDIR} ) ``` -------------------------------- ### Command Line Example (Linux/UNIX) Source: https://gitlab.com/wireshark/wireshark/-/blob/master/doc/README.documentation.adoc This is an example of a command-line prompt and command for Linux and UNIX-based systems. ```bash $ echo Linux and UNIX ``` -------------------------------- ### Install Qt using AQt CLI Installer Source: https://gitlab.com/wireshark/wireshark/-/blob/master/doc/wsdg_src/wsdg_quick_setup.adoc Installs a specific version of Qt for Windows desktop with MSVC 2022 64-bit, including Qt 5 compatibility and debug information. This method bypasses the need for a Qt account. ```cmd mkdir C:\Development\Qt cd C:\Development\Qt curl.exe -LOJ https://github.com/miurahr/aqtinstall/releases/download/v3.3.0/aqt_x64.exe .\aqt_x64.exe install-qt windows desktop 3.6.8 win64_msvc2022_64 -m qt5compat debug_info qtmultimedia ``` -------------------------------- ### Install Project Files Source: https://gitlab.com/wireshark/wireshark/-/blob/master/CMakeLists.txt Installs project files to the specified destination directory, handling path normalization and permissions. ```cmake if (ENABLE_SEPARATE_PROJECT_NAME) # CMake 3.31 and later warn, if normalization changes a path (CMP0177). # As we want to normalize without the warning, we do it explicitly. cmake_path(SET TMP_DST_PATH NORMALIZE "${CMAKE_INSTALL_DATADIR}/${PROJECT_NAME}") else() set(TMP_DST_PATH "${CMAKE_INSTALL_DATADIR}") endif() install( FILES ${INSTALL_FILES} PERMISSIONS OWNER_WRITE OWNER_READ GROUP_READ WORLD_READ DESTINATION ${TMP_DST_PATH} ) ``` -------------------------------- ### Run Wireshark Installer Source: https://gitlab.com/wireshark/wireshark/-/blob/master/doc/wsdg_src/wsdg_quick_setup.adoc Tests the newly built Wireshark installer. It's recommended to test on a different machine. ```cmd packaging\nsis\wireshark-{wireshark-version}-myprotocol123-x64.exe ``` -------------------------------- ### Install Wireshark with Optional Components (Windows) Source: https://gitlab.com/wireshark/wireshark/-/blob/master/doc/wsug_src/wsug_build_install.adoc Use the /EXTRACOMPONENTS flag to install specific extcap binaries like sshdump or udpdump during Wireshark installation on Windows. Ensure the desired components are listed as a comma-separated string. ```bash Wireshark-4.2.5-x64.exe /S /EXTRACOMPONENTS=sshdump,udpdump ``` -------------------------------- ### Install Pkgconfig File Source: https://gitlab.com/wireshark/wireshark/-/blob/master/CMakeLists.txt Installs the Wireshark pkgconfig file. The destination path is normalized using `cmake_path` to ensure consistency. ```cmake cmake_path(SET TMP_DST_PATH NORMALIZE "${CMAKE_INSTALL_LIBDIR}/pkgconfig") install(FILES "${CMAKE_BINARY_DIR}/resources/wireshark.pc" DESTINATION ${TMP_DST_PATH} COMPONENT "Development" EXCLUDE_FROM_ALL ) ``` -------------------------------- ### Install WSL2 and Debian Source: https://gitlab.com/wireshark/wireshark/-/blob/master/doc/wsdg_src/wsdg_quick_setup.adoc Installs the WSL2 feature and the Debian distribution on Windows. Requires administrator privileges. ```cmd wsl --install wsl --install -d Debian ``` -------------------------------- ### Install Include Directory Source: https://gitlab.com/wireshark/wireshark/-/blob/master/CMakeLists.txt Installs the contents of the 'include/' directory to the project's include path for development. ```cmake install(DIRECTORY include/ DESTINATION ${PROJECT_INSTALL_INCLUDEDIR} COMPONENT "Development" EXCLUDE_FROM_ALL ) ``` -------------------------------- ### Install Qt and Modules via aqtinstall Source: https://gitlab.com/wireshark/wireshark/-/blob/master/doc/wsdg_src/wsdg_quick_setup.adoc Use this command to install Qt and recommended modules using the unofficial aqtinstall CLI tool. Ensure you replace placeholders with your specific Qt version and desired modules. ```sh aqt install-qt mac desktop {macos-qt6-lts-version} clang_64 --modules qt5compat qtmultimedia debug_info ``` -------------------------------- ### Starts With AVP Operator Example Source: https://gitlab.com/wireshark/wireshark/-/blob/master/doc/wsug_src/wsug_mate.adoc Illustrates the 'starts with' operator ('^') for matching the beginning of an AVP value. ```text attrib=abcd matches attrib^abc + attrib=abc matches attrib^abc + attrib=ab does not match attrib^abc + attrib=abcd does not match attrib^bcd + attrib=abc does not match attrib^abcd ``` -------------------------------- ### Install Wireshark Plugin Source: https://gitlab.com/wireshark/wireshark/-/blob/master/plugins/ui/pluginifdemo/CMakeLists.txt Installs the built plugin library and its UI components to the appropriate Wireshark plugin directory. ```cmake install_plugin(pluginifdemo ui) ``` -------------------------------- ### Build All Guides (MSBuild) Source: https://gitlab.com/wireshark/wireshark/-/blob/master/doc/README.documentation.adoc Use this command to build all documentation targets with MSBuild on Windows. ```bash msbuild doc\all_guides.vcxproj ``` -------------------------------- ### Build Wireshark Documentation Source: https://gitlab.com/wireshark/wireshark/-/blob/master/doc/wsdg_src/wsdg_quick_setup.adoc Build the Wireshark User's Guide and Developer's Guide by targeting the 'all_guides' project. ```cmd cd C:\Development\wsbuild64 msbuild doc\all_guides.vcxproj ``` -------------------------------- ### Build All Guides (Ninja) Source: https://gitlab.com/wireshark/wireshark/-/blob/master/doc/README.documentation.adoc Use this command to build all documentation targets when using the Ninja build system. ```bash ninja all_guides ``` -------------------------------- ### Example link.exe Output Source: https://gitlab.com/wireshark/wireshark/-/blob/master/doc/wsdg_src/wsdg_tools.adoc This is an example output when running the 'link' command, showing the Microsoft Incremental Linker version and usage information. ```text Microsoft (R) Incremental Linker Version 14.23.28106.4 Copyright (C) Microsoft Corporation. All rights reserved. usage: LINK [options] [files] [@commandfile] ... ``` -------------------------------- ### Ethernet Address Examples Source: https://gitlab.com/wireshark/wireshark/-/blob/master/doc/wsug_src/wsug_files.adoc Examples of hardware MAC and EUI-64 addresses in the _ethers_ file format. Addresses can use colons, dashes, or periods as separators. Comments start with '#'. ```text ff-ff-ff-ff-ff-ff Broadcast c0-00-ff-ff-ff-ff TR_broadcast 00.2b.08.93.4b.a1 Freds_machine 00:00:00:00:00:00:00:00 zb_zero_broadcast ``` -------------------------------- ### Decode Traffic as HTTP by TCP Port Range via Length Source: https://gitlab.com/wireshark/wireshark/-/blob/master/doc/man_pages/dissection-options.adoc This variant of 'decode as' specifies a range of ports by a starting port and a count. This example decodes traffic over three TCP ports starting from 8888 as HTTP. ```bash -d tcp.port==8888:3,http ``` -------------------------------- ### Console Session: Load File and Get Status Source: https://gitlab.com/wireshark/wireshark/-/blob/master/doc/man_pages/sharkd.adoc An example of a console session where a capture file is loaded and its status is retrieved using JSON-RPC requests. ```bash $ echo '{"jsonrpc":"2.0","id":1,"method":"load","params":{"file":"/path/to/capture.pcapng"}}' | sharkd - $ echo '{"jsonrpc":"2.0","id":2,"method":"status"}' | sharkd - ``` -------------------------------- ### List Interface Configuration Options Source: https://gitlab.com/wireshark/wireshark/-/blob/master/doc/man_pages/dumpcalls.adoc This command displays the configuration arguments available for a specified interface. The example shows options for the 'cloudtrail' interface, including plugin source, S3 download concurrency, and SQS message deletion. ```bash dumpcalls --extcap-interface=cloudtrail --extcap-config ``` -------------------------------- ### Configure WiX Installer Variables Source: https://gitlab.com/wireshark/wireshark/-/blob/master/packaging/wix/CMakeLists.txt Sets various variables for the WiX installer configuration, such as user guide directory, VC redistributable version and directory, SMI directory, MMDB resolve executable, architecture, and WiX UI extension. It also specifies include paths and output directories. ```cmake set( "WIX_INSTALLER_DEPENDENT_COMPONENTS" -dUsersGuideDir=${ARCHIVE_OUTPUT_PATH}/${CMAKE_CFG_INTDIR}/doc/wsug_html_chunked -dVCRedistVersion=VC${MSVC_TOOLSET_VERSION} -dVCRedistDir=${MERGE_MODULE_DIR} ${d_smi_dir} ${d_mmdbresolve_exe} -arch ${WIRESHARK_TARGET_PLATFORM} -ext WixUIExtension -I${CMAKE_SOURCE_DIR}/packaging/wix -out ${CMAKE_CURRENT_BINARY_DIR}/ PARENT_SCOPE ) ``` -------------------------------- ### Implicit String to Byte Conversion Source: https://gitlab.com/wireshark/wireshark/-/blob/master/doc/man_pages/wireshark-filter.adoc Byte sequences are implicitly converted to UTF-8 byte representations when compared with literal strings. This example shows equivalent filters for 'GET'. ```wireshark tcp.payload contains "GET" ``` ```wireshark tcp.payload contains 47.45.54 ``` -------------------------------- ### List Configuration Options for sdjournal Interface Source: https://gitlab.com/wireshark/wireshark/-/blob/master/doc/man_pages/sdjournal.adoc This command displays the configuration options available for the sdjournal interface. The '--start-from' option allows specifying the journal starting position. ```bash sdjournal --extcap-interface=sdjournal --extcap-config ``` -------------------------------- ### Subnet Mapping Example Source: https://gitlab.com/wireshark/wireshark/-/blob/master/doc/wsug_src/wsug_files.adoc Maps IP address ranges to custom names for display in Wireshark. This file is read at program start and reloaded when opening new capture files or changing profiles. ```text 192.168.0.0/24 ws_test_network ``` ```text 2001:DB8::/32 documentation ``` -------------------------------- ### Start Stratoshark with Custom Remote Capture Command Source: https://gitlab.com/wireshark/wireshark/-/blob/master/doc/man_pages/sshdig.adoc This example shows how to configure Stratoshark to use a custom remote capture command with sshdig. It specifies the remote host and a tcpdump command for capture. ```bash stratoshark '-oextcap.sshdig.remotehost:"remotehost"' -oextcap.sshdig.remotecapturecommand:"tcpdump -i eth0 -Uw- not port 22" -i sshdig -k ``` -------------------------------- ### Get Capture File Times Source: https://gitlab.com/wireshark/wireshark/-/blob/master/doc/man_pages/mergecap.adoc Retrieves capture file information, including start and end times in seconds since the epoch. This is a prerequisite step for calculating time adjustments when merging capture files with specific time offsets. ```bash capinfos -aeS a.pcap b.pcap ``` -------------------------------- ### Example cl.exe Output Source: https://gitlab.com/wireshark/wireshark/-/blob/master/doc/wsdg_src/wsdg_tools.adoc This is an example output when running the 'cl' command, showing the Microsoft C/C++ Optimizing Compiler version and usage information. ```text Microsoft (R) C/C++ Optimizing Compiler Version 19.23.28106.4 for x64 Copyright (C) Microsoft Corporation. All rights reserved. usage: cl [ option... ] filename... [ /link linkoption... ] ``` -------------------------------- ### Start Wireshark with a Configuration Profile Source: https://gitlab.com/wireshark/wireshark/-/blob/master/doc/wsug_src/wsug_customize.adoc Launch Wireshark using a specific configuration profile. This allows for pre-defined settings and layouts to be applied upon startup. ```bash wireshark -C "My Profile" ``` -------------------------------- ### Install NSIS using Chocolatey Source: https://gitlab.com/wireshark/wireshark/-/blob/master/doc/wsdg_src/wsdg_tools.adoc Installs NSIS (Nullsoft Scriptable Install System), a tool used to generate Wireshark Windows installers, via Chocolatey. ```cmd PS$> choco install nsis ``` -------------------------------- ### Install Plugin Source: https://gitlab.com/wireshark/wireshark/-/blob/master/plugins/epan/falco_events/CMakeLists.txt Installs the Falco Events plugin into the Epan directory of the Wireshark installation. ```cmake install_plugin(falco-events epan) ``` -------------------------------- ### Install Stratoshark Qt DLLs Source: https://gitlab.com/wireshark/wireshark/-/blob/master/CMakeLists.txt Installs Stratoshark by executing windeployqt during the install step, ensuring all necessary Qt DLLs are copied to the installation directory for the Stratoshark executable. ```cmake install(CODE "execute_process(COMMAND \"${QT_WINDEPLOYQT_EXECUTABLE}\" --no-compiler-runtime \" ${CMAKE_INSTALL_PREFIX}/${CMAKE_INSTALL_BINDIR}/Stratoshark.exe\")" ``` -------------------------------- ### Install Development Headers Source: https://gitlab.com/wireshark/wireshark/-/blob/master/CMakeLists.txt Defines a custom target to install development headers. It uses a CMake script for the installation process. ```cmake add_custom_target(install-headers COMMAND ${CMAKE_COMMAND} -DCOMPONENT=Development -P cmake_install.cmake ) ``` -------------------------------- ### Example Extcap Interface Query Response Source: https://gitlab.com/wireshark/wireshark/-/blob/master/doc/wsdg_src/wsdg_capture.adoc An example of the output format when querying an extcap binary for interfaces. It includes version, help URL, and interface definitions. ```bash $ extcap_example.py --extcap-interfaces --extcap-version=4.0 extcap {version=1.0}{help=Some help url} interface {value=example1}{display=Example interface 1 for extcap} interface {value=example2}{display=Example interface 2 for extcap} ``` -------------------------------- ### Copy HTML User's Guide to Build Directory (Windows) Source: https://gitlab.com/wireshark/wireshark/-/blob/master/doc/CMakeLists.txt Conditionally copies the chunked HTML User's Guide to the build directory. This is specifically handled for Windows to ensure the UI help can locate the local file. ```cmake if(WIN32) set(WSUG_DIR "${DATAFILE_DIR}/${WSUG_TITLE}") else() set(WSUG_DIR "${DATAFILE_DIR}/wsug_html_chunked") endif() # CMake 3.26 has copy_directory_if_different add_custom_command( TARGET user_guide_html POST_BUILD COMMAND ${CMAKE_COMMAND} -E copy_directory "${CMAKE_CURRENT_BINARY_DIR}/wsug_html_chunked" "${WSUG_DIR}" VERBATIM ) ``` -------------------------------- ### Install wsutil Library and Headers Source: https://gitlab.com/wireshark/wireshark/-/blob/master/wsutil/CMakeLists.txt Defines the installation rules for the wsutil library and its public headers. This ensures the library and its associated development files are correctly placed after the build process. ```cmake install(TARGETS wsutil EXPORT WiresharkTargets RUNTIME DESTINATION ${CMAKE_INSTALL_BINDIR} LIBRARY DESTINATION ${CMAKE_INSTALL_LIBDIR} ARCHIVE DESTINATION ${CMAKE_INSTALL_LIBDIR} ) install(FILES ${WMEM_PUBLIC_HEADERS} DESTINATION "${PROJECT_INSTALL_INCLUDEDIR}/wsutil/wmem" COMPONENT "Development" EXCLUDE_FROM_ALL ) install(FILES ${WSUTIL_PUBLIC_HEADERS} DESTINATION "${PROJECT_INSTALL_INCLUDEDIR}/wsutil" COMPONENT "Development" EXCLUDE_FROM_ALL ) ``` -------------------------------- ### Install Package Configuration Files Source: https://gitlab.com/wireshark/wireshark/-/blob/master/CMakeLists.txt Installs the generated `WiresharkConfig.cmake` and `WiresharkConfigVersion.cmake` files to the development component directory. These files are excluded from the default installation. ```cmake install( FILES ${CMAKE_BINARY_DIR}/WiresharkConfig.cmake ${CMAKE_BINARY_DIR}/WiresharkConfigVersion.cmake DESTINATION ${WIRESHARK_INSTALL_CMAKEDIR} COMPONENT "Development" EXCLUDE_FROM_ALL ) ``` -------------------------------- ### Preference Setting Example Source: https://gitlab.com/wireshark/wireshark/-/blob/master/doc/wsug_src/wsug_files.adoc This file contains Wireshark preferences, such as capture and display defaults. Settings in the personal file override those in the global file. ```text variable: value ``` -------------------------------- ### Install WiX Toolset using Chocolatey Source: https://gitlab.com/wireshark/wireshark/-/blob/master/doc/wsdg_src/wsdg_tools.adoc Installs the WiX Toolset, used for generating Windows Installer (.msi) packages, using Chocolatey. ```cmd PS$> choco install wixtoolset ``` -------------------------------- ### Generate HTML User's Guide (Single-Page) Source: https://gitlab.com/wireshark/wireshark/-/blob/master/doc/CMakeLists.txt Generates a single-page HTML version of the User's Guide if Asciidoctor and xsltproc are found. This is useful for a consolidated view of the documentation. ```cmake if(ASCIIDOCTOR_FOUND AND XSLTPROC_EXECUTABLE) XML2HTML( user_guide wsug single-page user-guide.xml WSUG_GRAPHICS ) endif() ``` -------------------------------- ### Install Stratoshark Freedesktop Files Source: https://gitlab.com/wireshark/wireshark/-/blob/master/CMakeLists.txt Installs Freedesktop.org integration files specifically for Stratoshark. Similar to Wireshark's installation but uses Stratoshark-specific filenames. ```cmake install(FILES resources/freedesktop/org.wireshark.Stratoshark-mime.xml DESTINATION "${CMAKE_INSTALL_DATAROOTDIR}/mime/packages" RENAME org.wireshark.Stratoshark.xml ) install(FILES resources/freedesktop/org.wireshark.Stratoshark.metainfo.xml DESTINATION "${CMAKE_INSTALL_DATAROOTDIR}/metainfo" ) if(BUILD_wireshark AND QT_FOUND) install(FILES resources/freedesktop/org.wireshark.Stratoshark.desktop DESTINATION "${CMAKE_INSTALL_DATAROOTDIR}/applications") endif() ``` -------------------------------- ### Configure Windows Installation Directories Source: https://gitlab.com/wireshark/wireshark/-/blob/master/CMakeLists.txt Overrides default installation directory variables on Windows (excluding MSYS) to consolidate all installations into a single root folder. ```cmake if(WIN32 AND NOT USE_MSYSTEM) # Override some values on Windows, to match the existing # convention of installing everything to a single root folder. set(CMAKE_INSTALL_BINDIR ".") set(CMAKE_INSTALL_LIBDIR ".") set(CMAKE_INSTALL_INCLUDEDIR "include") set(CMAKE_INSTALL_DATADIR ".") set(CMAKE_INSTALL_DOCDIR ".") elseif(CMAKE_SYSTEM_NAME MATCHES "Haiku") # By default INSTALL_DATADIR is set to INSTALL_DATAROOTDIR, set the # proper value here. set(CMAKE_INSTALL_DATADIR "data/${PROJECT_NAME}" CACHE PATH "Read-only architecture-independent data" ) endif() include(GNUInstallDirs) ``` -------------------------------- ### Using CMake Presets for Configuration Source: https://gitlab.com/wireshark/wireshark/-/blob/master/doc/wsdg_src/wsdg_tools.adoc Example of using a predefined CMake preset for configuring the build with Ninja and ccache. ```sh cmake --preset ninja_ccache cmake --build build ``` -------------------------------- ### Configuring and Building with a Custom Preset Source: https://gitlab.com/wireshark/wireshark/-/blob/master/doc/wsdg_src/wsdg_tools.adoc Commands to configure the build using a custom preset and then build the project. ```sh cmake --preset mydev cmake --build ../build ``` -------------------------------- ### Install Plugin Library Source: https://gitlab.com/wireshark/wireshark/-/blob/master/doc/plugins.example/CMakeLists.txt Installs the compiled plugin library to the Wireshark plugin directory. This target is relocatable and respects DESTDIR or cmake --install. ```cmake install(TARGETS hello LIBRARY DESTINATION "${Wireshark_PLUGIN_LIBDIR}/epan" NAMELINK_SKIP ) ``` -------------------------------- ### Example Console Session Source: https://gitlab.com/wireshark/wireshark/-/blob/master/doc/man_pages/sharkd.adoc Demonstrates how to interact with sharkd in console mode by sending JSON-RPC requests via standard input. ```APIDOC ## Example Console Session ### Description This example shows how to use `sharkd` in console mode, loading a capture file and then querying its status using JSON-RPC requests piped to standard input. ### Request Example ```bash # Load a capture file $ echo '{"jsonrpc":"2.0","id":1,"method":"load","params":{"file":"/path/to/capture.pcapng"}}' | sharkd - # Get the status of the loaded file $ echo '{"jsonrpc":"2.0","id":2,"method":"status"}' | sharkd - ``` ### Response Example (Illustrative) *For the `load` request, a success response would typically confirm the file was loaded.* ```json { "jsonrpc": "2.0", "id": 1, "result": null } ``` *For the `status` request, a response would detail the capture file's status.* ```json { "jsonrpc": "2.0", "id": 2, "result": { "file": "/path/to/capture.pcapng", "frames": 1000, "elapsed_time": 120.5 // ... other status details } } ``` ``` -------------------------------- ### Install CMake Export Targets Source: https://gitlab.com/wireshark/wireshark/-/blob/master/CMakeLists.txt Installs CMake export targets, which are used for inter-project dependencies. These are placed in the development component directory and excluded from the default installation. ```cmake install(EXPORT WiresharkTargets DESTINATION ${WIRESHARK_INSTALL_CMAKEDIR} COMPONENT "Development" EXCLUDE_FROM_ALL ) ``` -------------------------------- ### Build Stratoshark NSIS Installer Source: https://gitlab.com/wireshark/wireshark/-/blob/master/packaging/nsis/CMakeLists.txt Defines a custom target to build the Stratoshark NSIS installer using the 'makensis' executable. It passes NSIS options and the installer script. ```cmake add_custom_target(stratoshark_nsis COMMAND ${MAKENSIS_EXECUTABLE} ${NSIS_OPTIONS} $<$:-DBUNDLE_DEBUG_DLLS> stratoshark.nsi ) set_target_properties(stratoshark_nsis PROPERTIES FOLDER "Packaging" EXCLUDE_FROM_DEFAULT_BUILD True ) ``` -------------------------------- ### QSS Token Usage Example Source: https://gitlab.com/wireshark/wireshark/-/blob/master/resources/themes/README.md Shows how to use theme tokens within a .qss file to apply dynamic colors based on the selected theme. ```css /* In a .qss file: */ #welcomeHeader { background: qlineargradient( stop:0 @header.gradient-start@, stop:1 @header.gradient-end@ ); } ``` -------------------------------- ### GOG Tree Structure Example Source: https://gitlab.com/wireshark/wireshark/-/blob/master/doc/wsug_src/wsug_mate.adoc Illustrates the hierarchical structure of a GOG, showing nested GOPs and their attributes and timings. ```mate mate http_pdu:4->http_req:2->http_use:1 http_pdu: 4 http_pdu time: 1.309847 http_pdu time since beginning of Gop: 0.218930 http_req: 2 ... (the gop's tree for http_req: 2) .. http_use: 1 http_use Attributes host: www.example.com http_use Times http_use start time: 0.000000 http_use duration: 1.309847 number of GOPs: 3 dns_req: 1 ... (the gop's tree for dns_req: 1) .. http_req: 1 ... (the gop's tree for http_req: 1) .. http_req of current frame: 2 ``` -------------------------------- ### Build Wireshark Installer with MSVC and NSIS Source: https://gitlab.com/wireshark/wireshark/-/blob/master/doc/wsdg_src/wsdg_quick_setup.adoc Builds the Wireshark installer using MSVC and NSIS. Ensure you have NSIS installed and the Visual Studio Command Prompt prepared. ```cmd msbuild /m /p:Configuration=RelWithDebInfo wireshark_nsis_prep.vcxproj msbuild /m /p:Configuration=RelWithDebInfo wireshark_nsis.vcxproj ``` -------------------------------- ### Build Wireshark NSIS Installer Source: https://gitlab.com/wireshark/wireshark/-/blob/master/packaging/nsis/CMakeLists.txt Defines a custom target to build the Wireshark NSIS installer using the 'makensis' executable. It passes NSIS options and the main installer script. ```cmake add_custom_target(wireshark_nsis COMMAND ${MAKENSIS_EXECUTABLE} ${NSIS_OPTIONS} $<$:-DBUNDLE_DEBUG_DLLS> $<$:-DUSE_VCREDIST> wireshark.nsi ) set_target_properties(wireshark_nsis PROPERTIES FOLDER "Packaging" EXCLUDE_FROM_DEFAULT_BUILD True ) ``` -------------------------------- ### Set Wireshark Installer Variables Source: https://gitlab.com/wireshark/wireshark/-/blob/master/packaging/wix/CMakeLists.txt Defines essential variables for the WiX installer, such as the program name and version information. These are used within the WiX source files to customize the installer. ```cmake set(PROGRAM_NAME ${CMAKE_PROJECT_NAME}) file(TO_NATIVE_PATH "${CMAKE_SOURCE_DIR}" TOP_SRC_DIR) # STAGING_DIR depends on the build configuration so we pass it # on the command line below. file(TO_NATIVE_PATH "${CMAKE_BINARY_DIR}/doc" DOC_DIR) # To do: # - Sync the various version names between CMake and Wix. # - Set CMakeLists.txt version strings in tools/make-version.py # - Add a VERSION_EXTRA cmake option set (VERSION "${PROJECT_VERSION}") set(PRODUCT_VERSION ${PROJECT_MAJOR_VERSION}.${PROJECT_MINOR_VERSION}.${PROJECT_PATCH_VERSION}.${PROJECT_BUILD_VERSION}) ``` -------------------------------- ### Show Interface Configuration Options Source: https://gitlab.com/wireshark/wireshark/-/blob/master/doc/man_pages/dpauxmon.adoc This command displays the configuration options available for a specified interface, including required parameters like 'Interface Id'. ```bash dpauxmon --extcap-interface=dpauxmon --extcap-config ``` -------------------------------- ### Check Python Version on Windows (Chocolatey) Source: https://gitlab.com/wireshark/wireshark/-/blob/master/doc/wsdg_src/wsdg_tools.adoc Verifies the installed Python 3 version on Windows when installed via Chocolatey. This command is run from the Chocolatey Python installation directory. ```cmd rem Chocolatey C:> cd \tools\python3 C:\tools\python3> python --version ``` -------------------------------- ### Set Installation Prefix for Wireshark Plugins Source: https://gitlab.com/wireshark/wireshark/-/blob/master/doc/plugins.example/CMakeLists.txt Configures the installation prefix for the plugin to match Wireshark's expected plugin directory. This ensures plugins are installed in the correct location. ```cmake if(CMAKE_INSTALL_PREFIX_INITIALIZED_TO_DEFAULT) set(CMAKE_INSTALL_PREFIX "${Wireshark_INSTALL_PREFIX}" CACHE PATH "Installation prefix" FORCE ) endif() ``` -------------------------------- ### Check Python Version on Windows (Official Package) Source: https://gitlab.com/wireshark/wireshark/-/blob/master/doc/wsdg_src/wsdg_tools.adoc Verifies the installed Python 3 version on Windows when installed via the official package. This command is run from the Python installation directory. ```cmd rem Official package C:> cd python35 C:Python35> python --version ```