I am trying to capture remote host traffic via jumphost from a Windows machine and display in Wireshark.
When PUTTY GUI is used and configured as below
- Created and saved SSH session (bastion-host) for the jumphost
- Connection --> Data --> Auto-login username configured
- Connection --> SSH --> Auth --> jumphost private Key file for authentication configured
- Created and saved another SSH session (target-host), where traffic capture will happen
- Connection --> Data --> Auto-login username configured
- Connection --> Proxy --> Proxy hostname configured as proxy and port 22
- Connection --> Proxy --> Telnet command or local proxy command as
plink "bastion-host" -agent -nc %host:%port - Connection --> SSH --> Remote command as
"sudo tcpdump -i ens5 -w - not port 22" - Connection --> SSH --> Auth --> target-host private Key file for authentication configured
- Load and open saved session (target-host)
Result is
- I can see traffic being captured and displayed on windows PUTTY terminal.
- And "tcpdump" is actually executed on target-host.
At this stage, I don't know how to redirect this to Wireshark.
Next and this is what I am trying to achieve, execute above setup via command line. Below is the complete command
plink.exe -proxycmd "putty.exe -ssh <username>@<jumphost-address> -i <private-key-file> -agent -nc <target-host>:22" -ssh <target-username>@<target-host> -i <target-private-key> "sudo tcpdump -ni ens5 -s 0 -w - not port 22" | "C:\Program Files\Wireshark\Wireshark.exe" -k -i -
Wireshark pops up but no traffic captured as I can't see "tcpdump" command getting executed on .
To confirm plink works, I tested similar command on a directly accessible host and everything works. Wireshark pops up with live traffic capture.
plink.exe -ssh -pw <password> <username>@<my-host> "/usr/sbin/tcpdump -ni ens192 -s 0 -w - not port 22" | "C:\Program Files\Wireshark\Wireshark.exe" -k -i -
So, I reckon something is wrong with the way I am using plink command. Appreciate if someone can help me to rectify it.
Thanks
OS: Windows 7 Enterprise, 64 bit
PUTTY: Release 0.70