Automating TrueCrypt container creation with Sikuli

When storing private data at a file hosting service I prefer to store it in one or several TrueCrypt containers. Besides the fact you have to transfer the container when the content has been modified (hence the relative small container size), the other drawback is that you actually have to create the container. While it’s a relative easy thing to do, creating enough random noise is a time consuming process.

If you’re using GNU/Linux this simple script will assist you in moving the mouse around while you go on your lunch break.

#!/bin/bash
# Install xte, use xdotool getmouselocation to get coordinates
TOPX="508"
BOTX="1174"
TOPY="608"
BOTY="987"

SEC=0

while [ $SEC -le 1000000 ]
do
OX=`shuf -i $TOPX-$BOTX -n1`
OY=`shuf -i $TOPY-$BOTY -n1`
echo mousemove $OX $OY | xte
echo "$SEC X:$OX Y:$OY"
SEC=$[$SEC+1]
done

A more complete solution is using Sikuli.
The following code will generate a 50MB container using Serpent-Twofish-AES with the SHA-512 hash. The password will be 24 characters containing ASCII letters and digits and the filename will be 10 lowercase letters.
All you have to do is start TrueCrypt.


import random,string

volume_size = '50' # Size of container in MB
show_pass = 'Y' # Display password

def password_generator(size=24, chars=string.ascii_letters + string.digits):
return ''.join(random.choice(chars) for x in range(size))

def filename_generator(size=10, chars=string.ascii_lowercase):
str0 = ''.join(random.choice(chars) for x in range(size))
str1 = '.tc'
return str0+str1

def num():
return random.randrange(-250, 250, 1)

def cred_log():
print 'Filename: %s' % (filename)
print 'Password: %s' % (password)

def rand_mouse():
mouseMove(targetAppWiz)
mLoc=Env.getMouseLocation()
mouseMove(mLoc.offset(num(),num()))
mouseMove(mLoc.offset(num(),num()))

Settings.MoveMouseDelay = 0.1
target = App("TrueCrypt")
target.focus()
targetApp = App.focusedWindow()

filename = filename_generator()
password = password_generator()

mouseMove(targetApp)
cred_log()

click(Image)
click(Image)
click(Image)
click(Image)
type(Image, str(filename))
click(Image)
click(Image)
click(Image)
click(Image)
click(Image)
click(Image)
type(Image, str(volume_size))
click(Image)

if show_pass == 'Y':
click(Image)

type(Image, str(password))
type(Image, str(password))
click(Image)

targetWiz = App("TrueCrypt Volume Creation Wizard")
targetWiz.focus()
targetAppWiz = App.focusedWindow()

for i in range(1000): # Amount of mouse movement
rand_mouse()

click(Image)
click(Image)
click(Image)

About these ads

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s

Follow

Get every new post delivered to your Inbox.

%d bloggers like this: