Archive

Posts Tagged ‘karaka’

retrieve skype contact photos using python

September 5, 2009 1 comment

tonight i was looking for a way to retrieve display pictures of my skype contacts from .dbb files and ended up with this small piece of code. i don’t find it much useful though but someone might be interesting so here it is.

#!/usr/bin/env python
#
# Author Ghulam Mustafa <mustafa.pk@gmail.com>
#
## This program is free software; you can redistribute it and/or
## modify it under the terms of the GNU General Public License version
## 2 as published by the Free Software Foundation.

## This program is distributed in the hope that it will be useful, but
## WITHOUT ANY WARRANTY; without even the implied warranty of
## MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
## General Public License version 2 for more details.

## You should have received a copy of the GNU General Public License
## version 2 along with this program; if not, write to the Free
## Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston,
## MA 02110-1301, USA.

profile = '/home/mustafa/.Skype/cyrenity/'

skypefiles = ["user256", "user1024", "user4096", "user16384", "user32768", "user65536",
              "profile256", "profile1024", "profile4096", "profile16384", "profile32768"]

##retrieve contents of skype binary files and store them in a single variable
skbin = []
n = 0
for f in skypefiles:
 fil = "%s%s.dbb" % (profile, f)
 try: skbin.append(file(fil, "rb").read())
 except: pass
 n = n + 1

binary = "".join(skbin)
##

## get_icon(username, binary)
## returns
##    True if successfull
##     None if failed
##    -1 if user not found
def get_icon(buddy, binary):
 startmark = "\xff\xd8"
 endmark = "\xff\xd9"

 startfix = 0
 endfix = 2

 nick_start = "\x03\x10%s" % buddy
 nick_end = "0"

 nickstart = binary.find(nick_start)
 if nickstart == -1: return -1
 nickend = binary.find(nick_end, nickstart)
 handle = binary[nickstart+2:nickend]
 blockstart = binary.rfind("l33l", 0, nickend)
 imgstart = binary.find(startmark, blockstart, nickend)
 imgend = binary.find(endmark, imgstart)

 imgstart += startfix
 imgend += endfix
 if (imgstart < 1): return None
 ##print "JPG %s from %d to %d" % (handle, imgstart, imgend)
 jpg = binary[imgstart:imgend]
 jpgfile = file("%s.jpg" % (handle), "wb")
 jpgfile.write(jpg)
 jpgfile.close()
 return True

users = ['cyrenity', 'gmustafa9']
for user in users:
 status = get_icon(user, binary)
 if status and status != -1:
  print "success [%s]" % user
 else:
  print "failed[%s] [%s]" % (status, user)


p.s. you are encouraged to send me update if you found a bug or fix something. :)

howto install Karaka: xmpp gateway to skype!

July 16, 2009 2 comments

You came here searching for howto install karaka. Vipdia Limited doesn’t tell much on how to setup karaka step by step, yesterday someone asked this question on karaka-discuss mailing list, this post is helpful for you if you are thinking about giving karaka a try.

more here: http://groups.google.com/group/karaka-discuss/browse_thread/thread/d6eb8fcd61bd3e05

Follow

Get every new post delivered to your Inbox.