DMP (Dropbox Messaging Protocol) is an off the cuff idea I had for a messaging protocol using dropbox's public folders. The basic idea is simple, you exchange dropbox IDs with your friend, and then each friend uploads "messages" to their respective dropbox folders and the other side looks at it and sends a response accordingly. Not particularly glamorous when done by hand, but if automated it can make for a very good signed or even encrypted message passing system, the great thing being a) neither side needs to have a server or a direct connection to the internet and b) neither side requires even an IP address to work, it's all built right on top of the Dropbox installed into your system. Included in the repository here is a simple ping server and client (dmpserver.py and dmpclient.py) to demonstrate how it works, and a helper library that isn't used by the ping server because it wasn't made until later, but that makes it really easy to send and receive DMP messages.
"But Josiah," I hear you asking, "why would you want to send messages over dropbox?" First, because I enjoy using things in ways they are not meant to be used. Really, that's the main reason. But, since I need another reason to appear sane, I created and implemented another protocol to go along with it, which I call DFTP (Dropbox File Transfer Protocol). The biggest problem with sending data over the internet is that it's basically impossible without giving someone money or having a server of your own (or a static IP or the ability to forward the ports on your router). Dropbox helps with this because it lets you upload large files and then lets other people download them. The problem is that dropbox only gives you 2GB of space for free, so you are limited to sending files that are 2GB in size. Using DMP and DFTP, we can chunk up the file and send arbitrarily large files through dropbox automatically, by only uploading pieces that will fit in our dropbox folder at any given time.
The protocol is very simple, the server sends a message with the filename for the client to save as. The message number on this is always 0. The client creates a file with that name somewhere on the machine and responds, saying "Received!", because it got the message. We can then start chunking up the file. The server takes the file, grabs the first chunk of n bytes (usually it should be in KB, but whatever) then writes that to a new file in the dropbox Public folder and waits for it to upload. Then, it sends a new message, with the last message number +1 and a filename for the new file (relative to the public folder, i.e. a file called
Public/foo/bar would use the name
foo/bar). The client then downloads the file it gets from the message and appends it to the file it created. This gets repeated until the server sends "Done!", signifiying the the file transfer is done and boh sides can disconnect.
Usage is fairly straightforward. First, get the dropbox ID of your friend (this is the numbers available in the dropbox public links, e.g. in
https://dl.dropboxusercontent.com/u/12345678/foo/bar, the id would be 12345678). Then get your ID and send it to him. The file sender runs
python dftpsender.py receiverID senderID filename [-bs blocksize], where the IDs are the ones mentioned earlier, filename is the path to a file to send, and blocksize is the number of bytes to send at a time.
-bs allows for the use of suffixes to determine size, e.g.
-bs 1k is translated into 1024 bytes. Other options are
g, case insensitive.
Following that, the receiver runs
python dftpreceiver.py senderID receiverID path, where path is a path to a directory where you want to save the file.
After that you just let it run and eventually you will get your file. Neat.
Because this relies on the public folder to work, it doesn't currently work on any dropbox accounts made after October 4, 2012. There might be a way around this, but it's really not worth trying to figure out.