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 key or password), 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
Use the following modules to interact with a server via SSH.
- connect - Test to see if the credentials work
- command -c COMMAND - Execute an arbitrary command
- download -f REMOTEFILE -d LOCALPATH - Download a file to a local path
- upload -f LOCALFILE -d REMOTEPATH Upload a file to a remote path
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 -c "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 -f /etc/passwd -d C:\users\skawa\downloads\
[+] Downloading '/etc/passwd' to 'C:\users\skawa\downloads\'
[+] File downloaded to 'C:\users\skawa\downloads\passwd'
SSHClient.exe -a Key -s 18.191.138.12 -p 22 -u ubuntu -k c:\users\skawa\aws.key -m upload -f C:\Users\skawa\Desktop\test.py -d /home/ubuntu
[+] Uploading 'C:\Users\skawa\Desktop\test.py' to '/home/ubuntu'
[+] File uploaded to '/home/ubuntu/test.py'