I wanted to copy over some of my tools into a remote host via VPN. The remote host was locked down so emailing files to myself or downloading files from a website or local drive was not possible. The only thing that was allowed was the clipboard so copying/pasting worked.
There have been previous articles and discussions about converting binary content into text to move files in and out of VPN and other similar technologies so I searched for and found some tools on Internet that I could use but they were kludgy, bloated, or cumbersome to use.
So here’s a quick, little tool I wrote with the least creative name I could come up with and the UI to match. 🙂 It converts a binary file into text which shows up in the text box which you can copy/paste over to a receiving program which converts text back into a binary file.
To get the receiving program into the remote host, click on the “Create VBS File” button. The textbox will populate with a VBS script.
You just copy the text, switch over to the remote host, and paste it into a text document then save it as “file.vbs” and run it.
When the script runs, a “lite version” of the program will be written out.
In my example, I zipped up my tools on the local host:
Then I clicked on “Read Binary File”. The program converts the binary file into text. I just right-clicked and choose “Select All” then “Copy”.
I went over to the remote host and pasted the text into the textbox. When I clicked on “Write Binary File”, the zipped file appeared on the desktop.
I probably need to mention that companies should already know about this threat. Antivirus should protect against moving malware into the remote host and DLP should protect against data exfiltration. If the security gap is still too big then you can disable the clipboard via group policy.
Last thing. VB Classic was used to code this program. Textboxes in VB Classic is limited to 64K, however, a smart fellow came up with a way to break this barrier. Credit and thanks to Tom Moran. I think I’ll be using his code snippet in my projects since it works great and seems stable (albeit slowly when dealing with large files). This program is available as-is, without warranties.
Filename: Binary File Converter.zip