{"id":15021202,"url":"https://github.com/arvanaghi/sessiongopher","last_synced_at":"2025-05-16T10:08:41.082Z","repository":{"id":41497677,"uuid":"84270886","full_name":"Arvanaghi/SessionGopher","owner":"Arvanaghi","description":"SessionGopher is a PowerShell tool that uses WMI to extract saved session information for remote access tools such as WinSCP, PuTTY, SuperPuTTY, FileZilla, and Microsoft Remote Desktop. It can be run remotely or locally.","archived":false,"fork":false,"pushed_at":"2022-11-22T21:33:23.000Z","size":20,"stargazers_count":1262,"open_issues_count":4,"forks_count":173,"subscribers_count":50,"default_branch":"master","last_synced_at":"2025-05-16T10:08:34.749Z","etag":null,"topics":["artifacts","pentesting","powershell","red-team","registry","windows"],"latest_commit_sha":null,"homepage":"","language":"PowerShell","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":null,"status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/Arvanaghi.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":null,"code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null}},"created_at":"2017-03-08T02:49:32.000Z","updated_at":"2025-05-15T11:04:12.000Z","dependencies_parsed_at":"2023-01-22T14:30:53.492Z","dependency_job_id":null,"html_url":"https://github.com/Arvanaghi/SessionGopher","commit_stats":null,"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Arvanaghi%2FSessionGopher","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Arvanaghi%2FSessionGopher/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Arvanaghi%2FSessionGopher/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Arvanaghi%2FSessionGopher/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/Arvanaghi","download_url":"https://codeload.github.com/Arvanaghi/SessionGopher/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":254509478,"owners_count":22082892,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["artifacts","pentesting","powershell","red-team","registry","windows"],"created_at":"2024-09-24T19:56:16.740Z","updated_at":"2025-05-16T10:08:36.073Z","avatar_url":"https://github.com/Arvanaghi.png","language":"PowerShell","readme":"Copyright 2017 FireEye, created by Brandon Arvanaghi ([@arvanaghi](https://twitter.com/arvanaghi))\n\nLicensed under the Apache License, Version 2.0 (the \"License\");\nyou may not use this file except in compliance with the License.\nYou may obtain a copy of the License at\n\n    http://www.apache.org/licenses/LICENSE-2.0\n\nUnless required by applicable law or agreed to in writing, software\ndistributed under the License is distributed on an \"AS IS\" BASIS,\nWITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\nSee the License for the specific language governing permissions and\nlimitations under the License.\n\n---\n# SessionGopher\n### Quietly digging up saved session information for PuTTY, WinSCP, FileZilla, SuperPuTTY, and RDP\n\nSessionGopher 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.\nIts best use case is to identify systems that may connect to Unix systems, jump boxes, or point-of-sale terminals.\n\nSessionGopher 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.\nWhen 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.\n\n## Usage\n**-Thorough**: searches all drives for PuTTY private key (.ppk), Remote Desktop Connecton (.rdp), and RSA (.sdtid) files. \n\n**-o**: outputs the data to a folder of .csv files\n\n**-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`.\n\n**-AllDomain**: SessionGopher will query Active Directory for all domain-joined systems and run against all of them.\n\n**-Target**: a specific host you want to target. Provide the target host after `-Target`.\n\n### To run locally\n```\n. .\\SessionGopher.ps1\nInvoke-SessionGopher -Thorough\n```\n\n### To run remotely (-iL, -AllDomain, -Target)\nTo 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, \nSessionGopher 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\nis local admin for the target system, or doing a _runas_ with either of the two, you won't need to supply credentials).\n\n```\nImport-Module path\\to\\SessionGopher.ps1;\nInvoke-SessionGopher -AllDomain -u domain.com\\adm-arvanaghi -p s3cr3tP@ss\n```\nor\n```\nImport-Module path\\to\\SessionGopher.ps1;\nInvoke-SessionGopher -iL computerlist.txt -u domain.com\\adm-arvanaghi -p s3cr3tP@ss -o\n```\nor \n```\nImport-Module path\\to\\SessionGopher.ps1;\nInvoke-SessionGopher -Target brandonArvanaghi_win7 -Thorough\n```\n\nAny 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\nmore than a small set of systems at a time. \n\nRunning 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. \n\n### To write to CSV (whether remote or local)\nTo have SessionGopher create a folder to neatly contain .csvs of the extracted sessions:\n```\nImport-Module path\\to\\SessionGopher.ps1;\nInvoke-SessionGopher -AllDomain -o\n```\n... that's it. \n\nAccessing the saved session information for every user in `HKEY_USERS` requires local admin privileges. Without local admin privileges, you will still receive saved session\ninformation for that user.\n\n### Sample output (-Thorough):\n\n```\n[+] Digging on Win7-Arvanaghi ...\nWinSCP Sessions\n\nSession  : admin-anthony@198.273.212.334\nHostname : 198.273.212.334\nUsername : admin-anthony\nPassword : Super*p@ssw0rd\n\nSession  : Freddy@204.332.455.213\nHostname : 204.332.455.213\nUsername : Freddy\nPassword : angelico1892\n\nFileZilla Sessions\n\nName     : BarrySite\nPassword : imr34llytheFl@sh\nHost     : 10.8.30.21\nUser     : BarryAllen\nProtocol : Use FTP over TLS if available\nAccount  : BarryAllenAccount\nPort     : 22\n\nPuTTY Sessions\n\nSession  : PointOfSaleTerminal\nHostname : 10.8.0.10\n\nPuTTY Private Key Files (.ppk)\n\nPath                   : C:\\Users\\Brandon Arvanaghi\\Documents\\mykey.ppk\nProtocol               : ssh-rsa\nComment                : rsa-key-20170116\nPrivate Key Encryption : none\nPrivate Key            : {AAABAEazxtDz6E9mDeONOmz07sG/n1eS1pjKI8fOCuuLnQC58LeCTlysOmZ1/iC4, g4HyRpmdKJGhIxj66/RQ135hVesyk02StleepK4+Tnvz3zmdr4Do5W99qKkrWI3D, T9GOxOIoR9Zc6j57D+fdesJq4ItEIxcQZlXC1F9KZcbXjSJ3iBmCsbG/aRJmMJNx, \n                         nCMaZkySr4R4Z/E+l1JOzXaHh5WQ2P0K4YM1/6XG6C4VzDjvXwcY67MYsobTeCR2...}\nPrivate MAC            : b7e47819fee39a95eb374a97f939c3c868f880de\n\n\nMicrosoft Remote Desktop (RDP) Sessions\n\nHostname : us.greatsite.com\nUsername : Domain\\tester \n\nMicrosoft Remote Desktop .rdp Files\n\nPath                    : C:\\Users\\Brandon Arvanaghi\\Desktop\\config\\PenTestLab-Win.RDP\nHostname                : dc01.corp.hackerplaypen.com\nGateway                 : rds01.corp.hackerplaypen.com\nPrompts for Credentials : No\nAdministrative Session  : Does not connect to admin session on remote host\n\n```\n\n---\n\nWritten by Brandon Arvanaghi ([@arvanaghi](https://twitter.com/arvanaghi \"Arvanaghi's Twitter\"))\n\nThis code was initially developed at FireEye. However, any subsequent update is done by the author outside of FireEye. \n","funding_links":[],"categories":[],"sub_categories":[],"project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Farvanaghi%2Fsessiongopher","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Farvanaghi%2Fsessiongopher","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Farvanaghi%2Fsessiongopher/lists"}