Quick File Transfer Hack

Chad Sigler
Jul 1 · 2 min read

Virtru Python SDK with Magic Wormhole

Image for post
Image for post
Photo by John Paul Summers on Unsplash

Hello from a freshly cleaned and sanitized workspace! I stumbled onto (again) a really useful and easy tool, Magic Wormhole. It is quite possibly the easiest file transfer tool around for on-demand one-off file transfers. I think it is fantastic and well implemented from a usability standpoint. But what if I need to transfer “sensitive” data? I have an answer! Today I will be diving into encrypting data using the Virtru Python SDK and transferring it using Magic Wormhole.

But, I will be using PyPi to get the Virtru SDK onto my system.

Magic Wormhole Usage

Sender

apt install magic-wormhole
wormhole send test.txt
Sending 57.6 kB file named 'test.txt'
On the other computer, please run: wormhole receive
Wormhole code is: 8-dictator-artist
Sending (->relay:tcp:magic-wormhole-transit.debian.net:4001)..
100%|███████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████| 57.6k/57.6k [00:00<00:00, 2.04MB/s]
File sent.. waiting for confirmation
Confirmation received. Transfer complete.

Receiver

apt install magic-wormhole
wormhole receive
Enter receive wormhole code: 8-dictator-artist
(note: you can use <Tab> to complete words)
Receiving file (57.6 kB) into: test.txt
ok? (y/N): y
Receiving (->relay:tcp:magic-wormhole-transit.debian.net:4001)..
100%|███████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████| 57.6k/57.6k [00:00<00:00, 1.03MB/s]
Received file written to test.txt

That's it!

Secure Wormhole Transfer

To ensure my data is not available to unwanted persons, I will be using the following gist project to encrypt and decrypt the data. To make it easier the code is parameterized for reusability clarity.

Virtru Code

Usage

virtru-app.py [-h] -o OWNER -p APPID -a {encrypt,decrypt} -s SOURCE -t TARGET [-u USERS]optional arguments:
-h, --help show this help message and exit
-o OWNER, --owner OWNER
AppId Owner (user@domain.com)
-p APPID, --appid APPID
AppId (1522710c-833f-4a69-8a26-0bbb00b1345c)
-a {encrypt,decrypt}, --action {encrypt,decrypt}
Action
-s SOURCE, --source SOURCE
Source File (Full path or reference path)
-t TARGET, --target TARGET
Target File (Full path or reference path)
-u USERS, --users USERS
Additional users added to the policy
('user1@example.com,user2@domain.com')

Encrypt and Send

pip3 install virtru-sdkpython3 virtru-app.py \
-a encrypt \
-o "bob@example.com" \
-p "aaaaaaaa-aaaa-aaaa-aaaa-aaaaaaaaaaaa" \
-s "test.txt" \
-t "test.txt.tdf3" \
-u "karen@demo.com"
wormhole send test.txt.tdf3

Receive and Decrypt

pip3 install virtru-sdkwormhole receive test.txt.tdf3python3 virtru-app.py \
-a decrypt \
-o "karen@demo.com" \
-p "bbbbbbbb-bbbb-bbbb-bbbb-bbbbbbbbbbbb" \
-s "test.txt.tdf3" \
-t "test.txt" \

Conclusion

After refinding the wormhole tool, I will definitely use it when I need to move files around on console sessions and do not want to use SFTP or the like. Another fantastic tool from the open-source community.

Virtru Technology Blog

Building developer tools in the interest of data protection…

Medium is an open platform where 170 million readers come to find insightful and dynamic thinking. Here, expert and undiscovered voices alike dive into the heart of any topic and bring new ideas to the surface. Learn more

Follow the writers, publications, and topics that matter to you, and you’ll see them on your homepage and in your inbox. Explore

If you have a story to tell, knowledge to share, or a perspective to offer — welcome home. It’s easy and free to post your thinking on any topic. Write on Medium

Get the Medium app

A button that says 'Download on the App Store', and if clicked it will lead you to the iOS App store
A button that says 'Get it on, Google Play', and if clicked it will lead you to the Google Play store