24.07.2017 Views

Hacking Gmail

You also want an ePaper? Increase the reach of your titles

YUMPU automatically turns print PDFs into web optimized ePapers that Google loves.

220 Part III — Conquering <strong>Gmail</strong><br />

Representing All of This in E-Mail<br />

But lest you forget, you’re trying to represent all of this data in e-mail messages<br />

and not a proper storage medium. The translation between the two is the job of<br />

FUSE and <strong>Gmail</strong>FS. Together, they handle the requests from the operating system<br />

for the data inside the directories, the inodes, and then the datablocks, and<br />

feed it back in the manner that the kernel expects.<br />

To do that, <strong>Gmail</strong>FS needs to store all of these different types of data within the<br />

framework that e-mail provides. Think on this: What is the framework available<br />

for data within e-mail?<br />

It’s easy, actually. You can use the subject line, the body of the message itself, and<br />

any number of attachments. That is how <strong>Gmail</strong>FS works.<br />

The Actual Data in Action<br />

<strong>Gmail</strong>FS just uses the subject line and the attachments. Nothing is held in the<br />

message body itself. There are three types of messages used.<br />

Directory and file entry messages: These hold the parent path and name of<br />

a file or a directory. The subject of these messages has a reference to the file’s<br />

or directory’s inode.<br />

Inode messages: The subject line of these messages holds the information<br />

found in an inode.<br />

Datablock messages: These messages hold the file’s data in attachments.<br />

The subject of the messages holding these structures contains a reference to<br />

the file’s inode as well as the current block number. Because <strong>Gmail</strong> has a size<br />

limit of 5MB for attachments, this message may contain more than one<br />

attachment.<br />

So, now when you run the cat supersecretpasswords.txt command on a file<br />

within the <strong>Gmail</strong>FS system, FUSE and the <strong>Gmail</strong>FS script first use Libgmail to<br />

request the corresponding file entry message. This command points them to the<br />

inode message, which then points them to the datablock message and the data<br />

you need.<br />

As previously mentioned in a sidebar, each of the messages’ subject lines contains<br />

the file system name. This allows you to use more than one file system off the<br />

same <strong>Gmail</strong> account, and also provides some security. The security comes from<br />

the way that <strong>Gmail</strong>FS adds data to itself — by sending mail to itself. Without the<br />

hard-to-guess file system name, it would be possible for an outside party to send<br />

messages to the account that added data to the file system.

Hooray! Your file is uploaded and ready to be published.

Saved successfully!

Ooh no, something went wrong!