back to the registry edit ↗

Gobby Syncing With Google Drive

Wiring up a collaborative editor to Google Drive for CTF prep with inotifywait and Grive.

Kind
wrote
Span
note
Tags
ctf, collaboration, tools, security, digitalocean
Read
4 min

Originally published on blog.benvirgilio.com

In preparation for the upcoming Mitre CTF my teammates and I are going through the practice challenges and trying to get a solid workflow down. Part of this workflow involves the ability to write and share code to help parse files related to the competition. What has been working for us so far is the use of Google Drive (I pay for a subscription and got a bonus early adopter 30GB credit to my account) and just creating a consistent directory structure within the shared folders. This is great for a few reasons, it’s updated and synced to others fairly quickly, but this isn’t a discussion about why we use Google Drive over other file sharing platforms. By using a shared drive system such as this we can also map the shared folders to VMware which allows us to access challenge files and scripts from within our work spaces.

Now for the code sharing part, it’s easy enough to just open up some code you are working on and save it in the shared folder, but this doesn’t really have any collaborative features and is kinda clunky. Enter Gobby and Infinoted.

Gobby is what I like to call Multi-Player Notepad. It allows you to host a server that multiple people can connect to and edit files together on. It then will automatically save those file to the server. It has numerous different syntax highlighting modes for various languages and is overall a fairly stable program. I am running a Infinoted server (the server that Gobby connects to) on my own Linux VPS (thanks to DigitalOcean) which using 2048 bit SHA1 encryption, signed with StartSSL just because.

Gobby Setup Guide: http://www.fabianrodriguez.com/blog/2010/02/05/gobby-server-in-3-steps

The Infinoted server will also sync the created and modified files to another directory of your choice. This feature is handy because the files that are created within Gobby have their own meta data, XML syntax and other bits of information built into what’s called a .InfText file, while the sync feature will only sync the actual text of the file and not the metadata that goes with it.

I have pointed that my Google Drive folder. For reference the command I use to start my server is below:

infinoted -k /var/gobby/key.pem -c /var/gobby/cert.pem -r /var/gobby/docroot --sync-directory=/var/google_drive/gobby --sync-interval=15 --autosave-interval=10 -d

Unfortunately Google Drive does not have a Linux client, which forces me to use a third-party utility Grive. It seems to work well enough, however it doesn’t sync automatically and seems to be a little buggy. I ended up writing a quick little inotifywait script:

#!/bin/bash
inotifywait -m -e CREATE -e MODIFY -e DELETE /var/google_drive/gobby |
        while read file; do
        grive
 done

This script will monitor my Google Drive folder for any changes, when when the Infinoted server syncs the files, the monitor script will run Grive and will automatically sync the new files we created on Gobby to all of our own computers (allowing us to run them easily while in our VMs using the mapped/shared drives feature in VMware).

Unfortunately Infinoted will not delete the files in the sync’d directory when they are deleted from within Gobby, so I will make a script to monitor for deleted files within the Infinoted root directory and remove the corresponding file on the sync’d directory.