βSSH
SSH - SCP
Generate Key Pair
if you manage to upload a reverse-shell and get access to the machine you might be able to enter using ssh. Which might give you a better shell and more stability, and all the other features of SSH. Like transferring files.
So, in the /home/user directory you can find the hidden .ssh files by typing ls -la. Then you need to do two things:
Create a new keypair, You do that with:
This will create two files, one called nameOfMyKey and another called nameOfMyKey_pub. The one with the _pub is of course your public key. And the other key is your private.
Add your public key to authorized_keys.
Now you copy the content of nameOfMyKey_pub. On the compromised machine you go to ~/.ssh and then run add the public key to the file authorized_keys. Like this
Log in.
SCP File Transfer
Copy a file:
Copy a directory:
non-interactive SCP
The only reason that a one-liner doesnβt work is because SCP prompts the user for a password, and simply echoing the password and piping it to the command wonβt work. The list of commands to build the file looks like this:
To run this file
you MUST use single quotes to surround the lines, as using double quotes will overlap with the double quotes that are included within the line, and will cause an issue with the first line
Last updated