The implementation of the TcpSend option is very basic. It merely open a tcp socket and send the data on the wire to the destination. Obviously this is not secure because the data is sent unencrypted in plaintext. Now there are a few options available for using that feature in a secure way. The following examples are all based on the assumption that you have a ssh server endpoint available. This way we can transfer the files securely through a SSH tunnel.
In all examples we use local port 6666 and remote port 7777 at the tunnel endpoints. That is, we use port 6666 on the RawCopy part and port 7777 on the remote netcat (or similar) part. For RawCopy we will thus use a command like this;
The remote netcat command would then be something like this;
nc -l -p 7777 >logfile.bin
For the creation of the encrypted tunnel:
Configure a regular ssh connection and specify local and remote destination in the tunnel options like this;
Now there's not yet any listening end, so open netcat inside the putty shell to receive the file from rawcopy;
This is the command line equivalent of putty that. Logic is still the same. Create the tunnel by plink command like this;
And use netcat in the shell as with putty.
We will use the ssh client of Microsoft's Win32-OpenSSH, which is a fork of OpenSSH. This time we will nest all commands together in one command so that it could be suited for scripting. In short we will add the remote netcat command into the ssh command like this;
That would be much better with automation.