Reversing Skype


So there’s a few things that the Skype API’s don’t provide which I needed in the Pidgin/Adium/libpurple plugins. Thought I’d document them here in case other people want to do the same.

One of the first hurdles I ran into was that on OSX, you need to link with the Skype.Framework bundle to access the Skype API commands. Unfortunately, linking with non-GPL libraries is forbidden in the GPL so I set out to work out how and what it does to ‘talk’ to Skype. Turns out that OSX has a few different ways of “inter-process communication”, but there was only one way that used Carbon as well as Cocoa… Long story short, I managed to work out that it was a CFNotificationCenter which was used to send/receive messages. So I created a debug function to see what the key/value pairs that Skype.Framework sent to Skype and managed to work it all out. It turned out that this reverse-engineering proved helpful for the Skype4Py team, who used it to get Skype4Py working on OSX. You too can use my GPL’d version of the framework at http://code.google.com/p/skype4pidgin/source/browse/trunk/skype_messaging_carbon2.c

The next problem was that I wanted to send/receive typing notifications, but the Skype API didn’t provide any way of doing this. In the end, I created an API app2app stream, called “libpurple_typing” which sends datagrams of “PURPLE_TYPING”, “PURPLE_NOT_TYPING” and “PURPLE_TYPED”, which directly relate to the libpurple typing notifications.  I haven’t seen any other Skype API wrappers (Trillian/Miranda/Fring) doing anything like this, but if I’m wrong let me know and I’ll get the plugin working with them.  Maybe all us 3rd parties can get together some day and agree on a common way of sending typing states. 🙂

Last thing I’ve managed to do was get avatars on platforms (Linux and until recently, OSX) that didn’t support the “GET AVATAR” api command.  Originally it was to get avatars for the SkypeNet (no-skype-needed) version of the plugin.  Turns out they were all stored in user{number}.dbb files, which are apparently Kazaa storage blobs.  Some kind of database that noone’s been able to work out.  From the looks of things now, Skype for Windows uses a SQLlite db for storage so this method won’t work there, but the way to find the avatar, is to loop through all the user*.dbb files and find the Skype username of the avatar in the file.  Then just skip ahead to a 0xFF,0xD8 block (header for a JPEG) and grab all the data up until 0xFF,0xD9.  If you hit 0x6C,0x33,0x33,0x6C (db entry boundary), you’ve gone too far.

I guess the rest of the features that Skype don’t provide that I’m working on would be:

  • Sending a file without using the Skype-provided file picker
  • Accepting/rejecting a file without opening Skype
  • Automatic authorization of the plugin with Skype

All the above features should allow the plugin to work without a Skype GUI using something like Finch, since these days not everyone has flash graphics stuff 🙂

Anyways.   I hope that’s useful to other developers out there.  I had fun doing it 🙂

  1. #1 by Thomas on 2009-11-19 - 5:08 am

    Hi, I hope the recent announcement in Skype API opening will help you to get rid of the necessity to run Skype aside Pidgin. Skype is regularly crashing Pidgin when I wake up my laptop. It seems that Pidgin or your plugin doesn’t like not having Internet for few seconds. I don’t get any error messages, just Pidgin has disappear when I got my desktop back from suspended mode in Ubuntu 9.04 with Wifi. Otherwise than that it’s great work this plugin to help having all your network on one interface. Thanks a lot for that.

Comments are closed.