Friday, December 19, 2014

Friday, June 27, 2014

PNGDrive - The easiest path to plausible deniability.

PNGDrive is a free file system for Linux licensed under the GPL 3. It is as a steganographic file system that allows users to access file systems hidden within PNG images.

By default the data is both encrypted and stored on the least significant bits of each pixel meaning that the image remains very similar to the original and the existence of a file system becomes untraceable unless both bit mask and password are available. 

Using this tool you can access any PNG image as if it were a file-system, meaning you can copy files into it, edit files from it, remove, etc... and once you've finished its just a picture.

Usage: pngdrive [-debug] [-key=<key>] [-mask=<mask>] [-format] <png image file>
  • debug: enables verbose/debug mode
  • key: uses <key> to encript the data
  • mask: is an hexacimal 32bits integer starting with 0x, each bit set in the mask will be used to store data, while bits that are not set remain unchanged. (e.g. -mask=0xFF0000 will mean that only the Red channel will contain data RGB images?). Default mask is 0x01010300.
  • format: creates an empty filesystem using current values for 'key' and 'mask'.
How to create an image that can be used for mouting?
To create the PNG (RGBA) from JPG:
  • convert sample.jpg -depth 8 -transparent none sample.png
Note: Requires package ImageMagick
  • aptitude install libpng-dev libssl-doc libssl-dev
  • make
Installing (as root):
  • make install

Monday, June 2, 2014


Sometimes it's you remember something and then you're happy there is an internet archive.

Thursday, May 15, 2014

Google Drive orphan files

Google Drive is not your traditional filesystem.. 

And... it so happened that I had shared a folder with my wife and from her account had copied a big chunk of our picture album into my folder before realizing that I was exceeding her quota..

At that moment I cancelled the operation and deleted the folder from my account.

However in Google Drive somehow files have more of a database like approach, in fact Google Drive even allows for a folder to contain multiple files with the same name (because they have different IDs).

What happened after I deleted my folder with her files was that all of her files remained in her account (and thus taking quota) but nowhere to be found (because I deleted my 'parent' folder).

I googled but could not find any solution, even Google's own specific link ( didn't work.

I found that I could go see the files on the 'All items' option of Google Drive ( in detailed view the files have the parent folder name right after them, in orphan files there's nothing).
However to select manually over 9000 files and then move each bunch of files manually from the "All items" was taking forever.. 

At some point I found this guy's webpage:

It claimed to fix things but it wasn't working.. so I saw that I had to take it into my own hands..

Brought up eclipse and started on it..

The first tutorial was straight forward:

After that, I had to locate all files.
With the demo running, I just added the sample here:

After that, to locate the orphaned files, it was simple once I saw that Parents is an attribute of files.

try {
 FileList files = request.execute();
 for (File f : files.getItems()) {
  if (f.getParents().size() == 0) 

To play it safe I had to check for repeated filenames. Filenames in Goole Drive are "Titles" and as said before they can be repeated (I did not dare test how it would show in your explorer's replica of Google Drive if you have two files with the same name on the same folder).

First, there was an easy to copy source code somewhere in the API guide about how to rename files (it couldn't be as easy as file.setTitle :) )

 private static File renameFile(Drive service, String fileId, String newTitle) {
  try {
   File file = new File();

   // Rename the file.
   Files.Patch patchRequest = service.files().patch(fileId, file);

   File updatedFile = patchRequest.execute();
   return updatedFile;
  } catch (IOException e) {
   System.out.println("An error occurred: " + e);
   return null;

With that out of the way, I could now rename files that shared the same name:

 List<File> list = retrieveAllFilesWithoutParents(service);
 HashMap<String, Vector<File>> filemap = new HashMap<String, Vector<File>>();

 for (File f : list) {
  String name = getName(f);
  if (!filemap.containsKey(name)) {
   filemap.put(name, new Vector<File>());

 for (String name : filemap.keySet()) {
  if (filemap.get(name).size() != 1) {
   System.out.println(name + " count is "
      + filemap.get(name).size());
   String[] sp = name.split("\\.(?=[^\\.]+$)");
   int count = 0;
   for (File f : filemap.get(name)) {
    String newname = sp[0] + "_" + ++count + "." + sp[1];
    System.out.println(name + " will be renamed to " + newname);
    renameFile(service, f.getId(), newname);
(the code above basically ensure that any repeated filename (e.g. a.txt) will be renamed acordingly (e.g. a_1.txt, a_2.txt...)

I didn't dare moving the files immediately after renaming because I was unsure how Google's eventual consistency would react, so I waited a few seconds an then ran the code to move the files into a new folder.

Creating the new folder was easy:
File body = new File();
String folder_name = "OrphanFiles_" + System.currentTimeMillis();
File folder = service.files().insert(body).execute();

And moving the files into the folder:
List<File> list = retrieveAllFilesWithoutParents(service);
for (File f : list) {
 System.out.println("Moving "+ getName(filemap.get(name).elementAt(0))   
      + " into "+ folder_name);
 insertFileIntoFolder(service, folder.getId(), filemap.get(name)

That was all, I hope you find it useful.

Thursday, January 30, 2014

Kickstarter project: Loving Vincent - Bringing the paintings of Van Gogh to life

Here's a very interesting project, only 6 days to go, I hope they make it.

Loving Vincent features over 120 of Vincent Van Gogh's greatest paintings. The plot, drawn from the 800 letters written by the painter himself, leads us to the significant people and events in the time leading up to his unexpected death. Vincent wrote in his last letter: “Well, the truth is, we cannot speak other than by our paintings”, and that is what we are doing- letting his paintings tell the story of what the painter had inside his heart, and ultimately, what happened to him.
Was it suicide, or was he shot? And if it was suicide, what would have led him to such a dramatic act, when he at last was gaining recognition for his work?