SessionGopher: extract saved session information for remote access tools (WinSCP, PuTTY, SuperPuTTY, FileZilla, and Microsoft Remote Desktop)
SessionGopher
Quietly digging up saved session information for PuTTY, WinSCP, FileZilla, SuperPuTTY, and RDP
SessionGopher is a PowerShell tool that finds and decrypts saved session information for remote access tools. It has WMI functionality built in so it can be run remotely. Its best use case is to identify systems that may connect to Unix systems, jump boxes, or point-of-sale terminals.
SessionGopher works by querying the HKEY_USERS
hive for all users who have logged onto a domain-joined box at some point. It extracts PuTTY, WinSCP, SuperPuTTY, FileZilla, and RDP saved session information. It automatically extracts and decrypts WinSCP, FileZilla, and SuperPuTTY saved passwords. When run in Thorough mode, it also searches all drives for PuTTY private key files (.ppk) and extracts all relevant private key information, including the key itself, as well as for Remote Desktop (.rdp) and RSA (.sdtid) files.
Download
Usage
-Thorough: searches all drives for PuTTY private key (.ppk), Remote Desktop Connecton (.rdp), and RSA (.sdtid) files.
-o: outputs the data to a folder of .csv files
-iL: provide a file with a list of hosts to run SessionGopher against, each host separated by a newline. Provide the path to the file after -iL.
-AllDomain: SessionGopher will query Active Directory for all domain-joined systems and run against all of them.
-Target: a specific host you want to target. Provide the target host after
To run locally
To run remotely (-iL, -AllDomain, -Target)
To run remotely, you can either provide a privileged account’s credentials for the remote system using the -u
and -p
flags. If you omit the -u
and -p
flags, SessionGopher will run under the security context of the account from which you run the script (e.g. if you are already logged in as DA account, or logged in as an account that is local admin for the target system, or doing a runas with either of the two, you won’t need to supply credentials).
or
or
Any of these commands can be coupled with -Thorough
, but note that it takes significantly longer as it queries the entire remote filesystem. It is not recommended you run in -Thorough
mode when querying more than a small set of systems at a time.
Running remotely by adding -o
(print to CSV) works nicely, as SessionGopher will accumulate all sessions it finds and tell you exactly where it found that saved session.
To write to CSV (whether remote or local)
To have SessionGopher create a folder to neatly contain .csvs of the extracted sessions:
Sample output (-Thorough):
Copyright 2017 FireEye, created by Brandon Arvanaghi (@arvanaghi)
Source: https://github.com/Arvanaghi/