Dropbox Hacking

Dropbox hacking


Table of Contents

  • Background
  • How Dropbox implement its command mode?
  • Loading image from serialized data

1 Background

Yesterday, I upgrade my ubuntu into Trusty Tahr, the development branch of the newest ubuntu. Dropbox is one of many problems after the upgrade, although I found the solution finally, I discovered that Dropbox's technology to release software is worth hacking. Another reason to hacking Dropbox is that I love it so much, my daily works in computers depended on it, it is the coolest cloud storage tool, absolutely the best one.

The first time I run dropbox after I install it, it emits a dialog to indicate the progress of download a package from its website, which is the real program to does the sync job, and its default install location is ~/.dropbox-dist. I think that's so cool, and I wanna learn how to do it.

This article is hacking Dropbox release package in a linux environment. I tried to hack its Mac OS X's package, but I still a junior in Mac field. So, Linux version first.

I believe I can release my software in this way in future.

2 How Dropbox implement its command mode?

After I install Dropbox into my ubuntu, I search in the directory tree to find out how many files are installed. To my surprise, there is only one python script in the deb package. More specifically, this article is about the technology behind that script.

The first thing paid my attention is how does it implement its command mode? The answer is python decorator, I was shocked to get that how it use a decorator to collect all commands, I was once thinking about that decorator can only be useful in markable language related programming like web development. I named this skill as command mode in python.

I upload an example into following links: 
https://github.com/suzp1984/parrot/blob/master/python/pattern_design/cmd_mode/CmdPattern.py

3 Loading image from serialized data

In dropbox, it uses PyGTK as the GUI framework, and I notice that the image resources are serialized into the source code as the string. In PyGTK, it uses gtk.gdk.pixbuf_newfromdata to generate the pixbuf object. I tried to do the same thing in pyqt5.

I upload all my experimental source code into the following link.
https://github.com/suzp1984/parrot/tree/master/python/gui/image

serialized_image.py is the target source code which loads the serialized image from a string buf. display_image.py is to display the image by loading its native image file. toString.py is used to generate the serialized string buf from a native image file, I was stuck in this step for a few hours because the encoding issue when I try to print or write the string into an file. The solution is to use str.encode('string-escape') method.

After that, I still have some confusion of operating images in pyqt and PIL image process library. I guess that's the topic of another article.

Comments

Popular posts from this blog

Bluedroid stack in android

How to setup a NAT server?

Network programming in elisp