You can use a secure shell to route traffic or access files, but there's something else you can do. Transfer files. There are loads of solutions for transferring files, like Dropbox, FTP, torrents, etc., but what about for a special ordeal? Most commonly, the way people get shells are from free servers online.
The reason that we consider using free shells a "special ordeal' is because we are often times not allowed to use any form of X session over a SSH tunnel, so programs like Dropbox get ousted, and even FTP, because most servers do not allow hosting of that kind for free. So we need to be able to push and pull files... yet somehow not use anything but the tools that come stock on the server.
Our answer? Pipe commands. And no... not SCP.
In this Null Byte, get ready to learn how to send and receive files over SSH using only pipe commands and some clever command line tricks.
- SHH client installed
Using strictly pipes and BASH tricks, follow along with me in the video below and watch me push and pull a file named "cow".
cat localfile | ssh firstname.lastname@example.org cat ">" remotefile
ssh target_address cat remotefile > localfile
You could turn this into a cool Python program, too. I picture something like this would be used to create the shortest possible script.
os.system('cat '+sys.argv+' | ssh '+sys.argv+' ">" '+sys.argv)
With a syntax like:
program.py <user@host> <localfile> <remotefile>
Be a Part of Null Byte!
Want to start making money as a white hat hacker? Jump-start your hacking career with our 2020 Premium Ethical Hacking Certification Training Bundle from the new Null Byte Shop and get over 60 hours of training from cybersecurity professionals.
Other worthwhile deals to check out: