A small SSH client written in C#.
You can grab a copy of SSHClient from the releases page. Alternatively, feel free to compile the solution yourself. Fody/Costura has been used to embed the SSH.NET reference.
The mandatory arguments consist of an authentication type (either Windows or Local), connection parameters and a module.
- -a - Authentication Type
- -a Password - Use password authentication.
- -a Key - Use key based authentication.
If the authentication type is Password, then you will need to supply the following parameters.
- -u USERNAME - SSH username
- -k PASSWORD - Password of SSH user
- -s SERVER - SSH server to connect to
- -p PORT - Port on the SSH server to connect to
If the authentication type is Key, then you will need to supply the following parameters.
- -u USERNAME - SSH username
- -k KEY - Path to the SSH key
- -s SERVER - SSH server to connect to
- -p PORT - Port on the SSH server to connect to
Standard modules are used to interact against a single MS SQL server.
- connect - Test to see if the credentials work
- command -o COMMAND - Execute an arbitrary command
- download -o PATH - Download a file to
C:\\Users\\Username\\Documents\\
SSHClient.exe -a Key -s 18.191.138.12 -p 22 -u ubuntu -k c:\users\skawa\aws.key -m connect
[+] Success! ubuntu can log in to 18.191.138.12:22
SSHClient.exe -a Key -s 18.191.138.12 -p 22 -u ubuntu -k c:\users\skawa\aws.key -m command -o "ps -eaf"
[+] Executing: ps -eaf
UID PID PPID C STIME TTY TIME CMD
root 1 0 0 Nov10 ? 00:00:12 /sbin/init
root 2 0 0 Nov10 ? 00:00:00 [kthreadd]
root 3 2 0 Nov10 ? 00:00:00 [rcu_gp]
root 4 2 0 Nov10 ? 00:00:00 [rcu_par_gp]
root 5 2 0 Nov10 ? 00:00:48 [kworker/0:0-events]
root 6 2 0 Nov10 ? 00:00:00 [kworker/0:0H-events_highpri]
root 9 2 0 Nov10 ? 00:00:00 [mm_percpu_wq]
root 10 2 0 Nov10 ? 00:00:00 [rcu_tasks_rude_]
<snipped>
SSHClient.exe -a Key -s 18.191.138.12 -p 22 -u ubuntu -k c:\users\skawa\aws.key -m download -o /home/ubuntu/file.txt
[+] Downloading: /home/ubuntu/file.txt
[+] File downloaded to: C:\Users\skawa\Documents\file.txt
The below techniques are on the roadmap for future releases
- Upload files
- Perhaps add an option to customize the the downloads directory, this is currently
C:\\Users\\Username\\Documents\\
- Authentication based on users session