Archive for May, 2013

Securing Synergy

At work, I have several computers on my desk, but I prefer to only use one mouse and keyboard to control all of them. To accomplish this, I use Synergy. The more recent versions of Synergy come with the ability to perform encryption on the connections through Synergy itself, but I did not feel it adequate enough or easy enough to use for my needs. Instead, I run Synergy on my machine which has the keyboard and mouse attached to it, then on my client machines, I tunnel the remote server’s synergy port to the local machine, and connect locally, This tunnels all Synergy traffic through SSH transparently, and is extremely secure. I like this level of security because often times, I am typing personal, sensitive, or confidential information on one of the client machines using the server’s keyboard.

In my setup, is the Synergy server. All SSH is done through public key encryption to make the connection painless.
Here is the script I use:

#!/bin/bash -x

function clean()
    for job in `ps -eo pid,args | grep ssh | grep 24800 | grep -v grep | awk '{print $1}'`
        kill -9 $job

trap clean SIGINT

ssh -f -N -L
synergyc -f localhost

I hope this helps someone else looking for an easy way to secure down Synergy.

Fun with GMail, Google Voice, & Python

Lately I have been getting lots of Google Voice and GMail messages, and it can be a royal pain to go through and mark them all read on the web interfaces, so I threw together a couple of script that help to solve this problem from the shell for me.


#!/usr/bin/env python

import imaplib
obj = imaplib.IMAP4_SSL('', '993')
obj.login('', 'my_password')'Inbox')
typ ,data =,'UnSeen')
try:[0].replace(' ',','),'+FLAGS','\Seen')
    print "Messages marked as read"
    print "No messages to mark"


#!/usr/bin/env python

from googlevoice import Voice,util

voice = Voice()
voice.login('', 'my_password')

while True :
    folder ='is:unread')
    if folder.totalSize <= 0 :
    for message in folder.messages:
        if not

Now, to tie it all together, a bash script:




touch $voice_file
touch $gmail_file

echo "Marking text messages read"
~/bin/voice_mark_as_read &> $voice_file &
echo "Marking gmail messages read"
~/bin/gmail_mark_as_read &> $gmail_file &


echo "GVoice:"
cat $voice_file
echo "GMail:"
cat $gmail_file

rm $gmail_file $voice_file

Now, I do not claim to be the original author of the first 2 scripts here, they were taken from various stack exchange posts and what not (I lost the URLs and I have modified the scripts, so unfortunately I cannot give due credit, but I will not take it for myself). The last bash script was my little work, and it does its job perfectly. I hope this helps someone else to fix the problem that I was also facing.