'\" t .\" Title: sshdump .\" Author: [see the "AUTHOR(S)" section] .\" Generator: Asciidoctor 2.0.23 .\" Date: 2024-10-13 .\" Manual: \ \& .\" Source: \ \& .\" Language: English .\" .TH "SSHDUMP" "1" "2024-10-13" "\ \&" "\ \&" .ie \n(.g .ds Aq \(aq .el .ds Aq ' .ss \n[.ss] 0 .nh .ad l .de URL \fI\\$2\fP <\\$1>\\$3 .. .als MTO URL .if \n[.g] \{\ . mso www.tmac . am URL . ad l . . . am MTO . ad l . . . LINKSTYLE blue R < > .\} .SH "NAME" sshdump \- Provide interfaces to capture from a remote host through SSH using a remote capture binary. .SH "SYNOPSIS" .sp \fBsshdump\fP [\~\fB\-\-help\fP\~] [\~\fB\-\-version\fP\~] [\~\fB\-\-extcap\-interfaces\fP\~] [\~\fB\-\-extcap\-dlts\fP\~] [\~\fB\-\-extcap\-interface\fP=\~] [\~\fB\-\-extcap\-config\fP\~] [\~\fB\-\-extcap\-capture\-filter\fP=\~] [\~\fB\-\-capture\fP\~] [\~\fB\-\-fifo\fP=\~] [\~\fB\-\-remote\-host\fP=\~] [\~\fB\-\-remote\-port\fP=\~] [\~\fB\-\-remote\-username\fP=\~] [\~\fB\-\-remote\-password\fP=\~] [\~\fB\-\-sshkey\fP=\~] [\~\fB\-\-sshkey\-passphrase\fP=\~] [\~\fB\-\-proxycommand\fP=\~] [\~\fB\-\-remote\-interface\fP=\~] [\~\fB\-\-remote\-capture\-command\-select\fP=\~] [\~\fB\-\-remote\-capture\-command\fP=\~] [\~\fB\-\-remote\-priv\fP=\~] [\~\fB\-\-remote\-priv\-user\fP=\~] [\~\fB\-\-remote\-noprom\fP\~] [\~\fB\-\-remote\-filter\fP=\~] [\~\fB\-\-remote\-count\fP=\~] .sp \fBsshdump\fP \fB\-\-extcap\-interfaces\fP .sp \fBsshdump\fP \fB\-\-extcap\-interface\fP= \fB\-\-extcap\-dlts\fP .sp \fBsshdump\fP \fB\-\-extcap\-interface\fP= \fB\-\-extcap\-config\fP .sp \fBsshdump\fP \fB\-\-extcap\-interface\fP= \fB\-\-fifo\fP= \fB\-\-capture\fP \fB\-\-remote\-host=myremotehost\fP \fB\-\-remote\-port=22\fP \fB\-\-remote\-username=user\fP \fB\-\-remote\-interface=eth2\fP \fB\-\-remote\-capture\-command=\*(Aqtcpdump\~\-U\~\-i\~eth0\~\-w\-\*(Aq\fP .SH "DESCRIPTION" .sp \fBSshdump\fP is an extcap tool that allows one to run a remote capture tool over a SSH connection. The requirement is that the capture executable must have the capabilities to capture from the wanted interface. .sp The feature is functionally equivalent to run commands like .sp .if n .RS 4 .nf .fam C $ ssh remoteuser@remotehost \-p 22222 \*(Aqtcpdump \-U \-i IFACE \-w \-\*(Aq > FILE & $ wireshark FILE .fam .fi .if n .RE .sp .if n .RS 4 .nf .fam C $ ssh remoteuser@remotehost \*(Aq/sbin/dumpcap \-i IFACE \-P \-w \- \-f "not port 22"\*(Aq > FILE & $ wireshark FILE .fam .fi .if n .RE .sp .if n .RS 4 .nf .fam C $ ssh somehost dumpcap \-P \-w \- \-f udp | tshark \-i \- .fam .fi .if n .RE .sp Typically sshdump is not invoked directly. Instead it can be configured through the Wireshark graphical user interface or its command line. The following will start Wireshark and start capturing from host \fBremotehost\fP: .sp .if n .RS 4 .nf .fam C $ wireshark \*(Aq\-oextcap.sshdump.remotehost:"remotehost"\*(Aq \-i sshdump \-k .fam .fi .if n .RE .sp To explicitly control the remote capture command: .sp .if n .RS 4 .nf .fam C $ wireshark \*(Aq\-oextcap.sshdump.remotehost:"remotehost"\*(Aq \(rs \*(Aq\-oextcap.sshdump.remotecapturecommand:"tcpdump \-i eth0 \-Uw\- not port 22"\*(Aq \(rs \-i sshdump \-k .fam .fi .if n .RE .sp Supported interfaces: .sp .RS 4 .ie n \{\ \h'-04' 1.\h'+01'\c .\} .el \{\ . sp -1 . IP " 1." 4.2 .\} ssh .RE .SH "OPTIONS" .sp \-\-help .RS 4 Print program arguments. .RE .sp \-\-version .RS 4 Print program version. .RE .sp \-\-extcap\-interfaces .RS 4 List available interfaces. .RE .sp \-\-extcap\-interface= .RS 4 Use specified interfaces. .RE .sp \-\-extcap\-dlts .RS 4 List DLTs of specified interface. .RE .sp \-\-extcap\-config .RS 4 List configuration options of specified interface. .RE .sp \-\-extcap\-capture\-filter= .RS 4 The capture filter. It corresponds to the value provided via the \fBtshark \-f\fP option, and the Capture Filter field next to the interfaces list in the Wireshark interface. .RE .sp \-\-capture .RS 4 Start capturing from specified interface and write raw packet data to the location specified by \-\-fifo. .RE .sp \-\-fifo= .RS 4 Save captured packet to file or send it through pipe. .RE .sp \-\-remote\-host= .RS 4 The address of the remote host for capture. .RE .sp \-\-remote\-port= .RS 4 The SSH port of the remote host. .RE .sp \-\-remote\-username= .RS 4 The username for SSH authentication. .RE .sp \-\-remote\-password= .RS 4 The password to use (if not ssh\-agent and pubkey are used). WARNING: the passwords are stored in plaintext and visible to all users on this system. It is recommended to use keyfiles with a SSH agent. .RE .sp \-\-sshkey= .RS 4 The path to a private key for authentication. NOTE: Only OPENSSH key/value pair format is supported. .RE .sp \-\-sshkey\-passphrase= .RS 4 The passphrase for the private key for authentication. .RE .sp \-\-proxycommand= .RS 4 The command to use as proxy for the SSH connection. .RE .sp \-\-remote\-interface= .RS 4 The remote network interface to capture from. .RE .sp \-\-remote\-capture\-command\-select= .RS 4 .sp The selection of the build\-in support for remote capture commands. Either \fBdumpcap\fP for a remote capture command using dumpcap, \fBtcpdump\fP for a remote capture command using tcpdump, or \fBother\fP, where the remote capture command is to be given with the \fB\-\-remote\-capture\-command\fP option. .sp Note that selecting dumpcap allows for specifying multiple capture interfaces as a whitespace separated list, while tcpdump does not. .RE .sp \-\-remote\-capture\-command= .RS 4 .sp A custom remote capture command that produces the remote stream that is shown in Wireshark. The command must be able to produce a PCAP stream written to STDOUT. See below for more examples. .sp If using tcpdump, use the \fB\-w\-\fP option to ensure that packets are written to standard output (stdout). Include the \fB\-U\fP option to write packets as soon as they are received. .sp When specified, this command will be used as is, options such as the capture filter (\fB\-\-extcap\-capture\-filter\fP) will not be appended. .RE .sp \-\-remote\-priv= .RS 4 The command to use to achieve privilege elevation to capture on the remote host. Either none, sudo or doas. .RE .sp \-\-remote\-priv\-user= .RS 4 If a command is used to achieve privilege elevation to capture on the remote host this may require a user name. If needed use this option to give that user name. .RE .sp \-\-remote\-filter= .RS 4 The remote capture filter. It corresponds to the value provided via the \fBtshark \-f\fP option, and the Capture Filter field next to the interfaces list in the Wireshark interface. .RE .sp \-\-remote\-count= .RS 4 The number of packets to capture. .RE .SH "EXAMPLES" .sp To see program arguments: .sp .if n .RS 4 .nf .fam C sshdump \-\-help .fam .fi .if n .RE .sp To see program version: .sp .if n .RS 4 .nf .fam C sshdump \-\-version .fam .fi .if n .RE .sp To see interfaces: .sp .if n .RS 4 .nf .fam C sshdump \-\-extcap\-interfaces .fam .fi .if n .RE .sp Only one interface (sshdump) is supported. .sp .B Example output .br .sp .if n .RS 4 .nf .fam C interface {value=sshdump}{display=SSH remote capture} .fam .fi .if n .RE .sp To see interface DLTs: .sp .if n .RS 4 .nf .fam C sshdump \-\-extcap\-interface=sshdump \-\-extcap\-dlts .fam .fi .if n .RE .sp .B Example output .br .sp .if n .RS 4 .nf .fam C dlt {number=147}{name=sshdump}{display=Remote capture dependent DLT} .fam .fi .if n .RE .sp To see interface configuration options: .sp .if n .RS 4 .nf .fam C sshdump \-\-extcap\-interface=sshdump \-\-extcap\-config .fam .fi .if n .RE .sp .B Example output .br .sp .if n .RS 4 .nf .fam C 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\*(Aqt 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} value {arg=14}{value=debug}{display=Debug} value {arg=14}{value=noisy}{display=Noisy} arg {number=16}{call=\-\-log\-file}{display=Use a file for logging}{type=fileselect} {tooltip=Set a file where log messages are written}{required=false}{group=Debug} .fam .fi .if n .RE .sp To capture: .sp .if n .RS 4 .nf .fam C sshdump \-\-extcap\-interface=sshdump \-\-fifo=/tmp/ssh.pcap \-\-capture \-\-remote\-host 192.168.1.10 \-\-remote\-username user \-\-remote\-filter "not port 22" .fam .fi .if n .RE .sp To use different capture binaries: .sp .if n .RS 4 .nf .fam C sshdump \-\-extcap\-interface=sshdump \-\-fifo=/tmp/ssh.pcap \-\-capture \-\-remote\-host 192.168.1.10 \-\-remote\-username user \-\-remote\-priv sudo \-\-remote\-capture\-command\-select tcpdump \-\-remote\-interface eth0 \-\-remote\-noprom .fam .fi .if n .RE .sp .if n .RS 4 .nf .fam C sshdump \-\-extcap\-interface=sshdump \-\-fifo=/tmp/ssh.pcap \-\-capture \-\-remote\-host 192.168.1.10 \-\-remote\-capture\-command=\*(Aqdumpcap \-i eth0 \-P \-w \-\*(Aq .fam .fi .if n .RE .sp .if n .RS 4 .nf .fam C sshdump \-\-extcap\-interface=sshdump \-\-fifo=/tmp/ssh.pcap \-\-capture \-\-remote\-host 192.168.1.10 \-\-remote\-capture\-command=\*(Aqsudo tcpdump \-i eth0 \-U \-w \-\*(Aq .fam .fi .if n .RE .if n .sp .RS 4 .it 1 an-trap .nr an-no-space-flag 1 .nr an-break-flag 1 .br .ps +1 .B Note .ps -1 .br .sp To stop capturing CTRL+C/kill/terminate the application. .sp .5v .RE .sp The sshdump binary can be renamed to support multiple instances. For instance if we want sshdump to show up twice in wireshark (for instance to handle multiple profiles), we can copy sshdump to sshdump\-host1 and sshdump\-host2. Each binary will show up an interface name same as the executable name. Those executables not being "sshdump" will show up as "custom version" in the interface description. .SH "SEE ALSO" .sp wireshark(1), tshark(1), dumpcap(1), extcap(4), tcpdump(1) .SH "NOTES" .sp \fBSshdump\fP is part of the \fBWireshark\fP distribution. The latest version of \fBWireshark\fP can be found at \c .URL "https://www.wireshark.org" "" "." .sp HTML versions of the Wireshark project man pages are available at .URL "https://www.wireshark.org/docs/man\-pages" "" "." .SH "AUTHORS" .sp .B Original Author .br Dario Lombardo