From Facebook's Hackathon, TCP re-implemented over chat in a post-SOPA world

Eugen Leitl eugen at
Sun Dec 4 12:55:54 PST 2011

>From Facebook's Hackathon, TCP re-implemented over chat in a post-SOPA world

99 points by xxbondsxx 14 hours ago | 25 comments

For Facebook's Hackathon finals between the finalists from 15 different
colleges, myself and the two other hackers from UC Berkeley decided to
imagine a post-apocalyptic world in which SOPA has passed and is enforced _to
the letter_. We took it to the extreme by imagining that file transfer is no
longer possible for US citizens. Corporations now control the internet, and
we are forced to use only their products.

To re-implement file transfer, we decided to hijack Facebook's speedy chat
service to do our own packet transmission. This is the way it works:

-A python localhost server converts binary data into base64 ASCII and forms
packets with uuid's, timestamps, seqnums, and the whole 9 yards.

-These packets get pumped over localhost to a user script (aka a Greasemonkey
script) running on

-This user script handles the scrubbing of incoming chat messages (packets)
and populating the chatbox with outgoing packets.

-Facebook does _not_ make sending a chat message easy with custom JS, so in
order to actually send a chat message, we signal the python localhost server
to run a bash script that tells applescript to emulate a keydown event.
Hacked up, I know, but it works! Also, this works for any application
(desktop, flash embedded, etc) because it's as legit as a real keypress.

Just pumping the packets was the first challenge which we finished around
2am. The second obstacle was that facebook decides to drop about 50% of our
packets after the first 15, so we then implemented a crude TCP style
acknowledgement/handshake method that ensures each packet gets delivered.
Implementing TCP inside of TCP... as meta as you get.

If you want to watch a video of a nyan cat GIF transmission, go here:

The main point is that despite even the most extreme legal restrictions on
the internet, the next generation will always find a way :D


Happy to answer any questions. Techcrunch also showed up and filmed / walked
around the office (which was surprising considering the relationship between
the two). I remember the techcrunch guy specifically saying "I feel like I'm
at the Deathstar" when he walked through Facebook's double doors.

More information about the cypherpunks-legacy mailing list