Skip to content

Instantly share code, notes, and snippets.

@dequis
Last active December 19, 2017 19:01
Show Gist options
  • Save dequis/77b478f35f93f64ac640 to your computer and use it in GitHub Desktop.
Save dequis/77b478f35f93f64ac640 to your computer and use it in GitHub Desktop.
MSN ApplicationId binary patcher for pidgin/bitlbee/etc - OBSOLETE now that pidgin/bitlbee have the correct fix - READ THE COMMENTS!
#!/usr/bin/env python
"""
MSN ApplicationId patcher for pidgin/bitlbee/whatever
(because you're too lazy to rebuild the whole thing.)
Usage examples:
python patch.py /usr/sbin/bitlbee
python patch.py /usr/lib/purple-2/libmsn.so
It will output the modified file to the current directory.
Backup the original file and replace it with the new version.
If you're lucky, it will work.
If not, don't be lazy and rebuild it.
"""
import os
import sys
import mmap
import shutil
WLM_2008_ID = b"CFE80F9D-180F-4399-82AB-413F33A1FA11" # blocked
WLM_2009_ID = b"AAD9B99B-58E6-4F23-B975-D9EC1F9EC24A" # blocked
WLM_2012_ID = b"484AAC02-7F59-41B7-9601-772045DCC569" # working, may be buggy
SKYPE_ID = b"F6D2794D-501F-443A-ADBE-8F1490FF30FD" # working, may be buggy
# "buggy" means you may show up as offline to others - test talking with a contact!
## you can try switching these around!
OLD_ID = WLM_2008_ID
NEW_ID = SKYPE_ID
## examples (remove # from the relevant lines)
## use the WLM 2012 key instead (may work better for you)
#OLD_ID = WLM_2008_ID
#NEW_ID = WLM_2012_ID
## if you want to patch an already patched binary to use 2012 instead of 2009:
#OLD_ID = WLM_2009_ID
#NEW_ID = WLM_2012_ID
def main():
if len(sys.argv) < 2:
print(__doc__.strip())
return
filename = sys.argv[1]
out_filename = os.path.abspath(os.path.basename(filename) + ".out")
shutil.copy(filename, out_filename)
print("Writing to " + out_filename)
fd = os.open(out_filename, os.O_RDWR | getattr(os, 'O_BINARY', 0))
map = mmap.mmap(fd, 0, access=mmap.ACCESS_WRITE)
changes = 0
offset = map.find(OLD_ID)
while offset != -1:
print("Found old ID at offset: %d (0x%x)" % (offset, offset))
map.seek(offset)
map.write(NEW_ID)
changes += 1
offset = map.find(OLD_ID)
if not changes:
print("Not found")
else:
print("%s IDs changed" % changes)
if __name__ == '__main__':
main()
@Chronia
Copy link

Chronia commented Nov 13, 2014

I can't get this to work for pidgin 2.10.10 on windows 7. I have followed the instructions, run python and the patch and it still doesn't not connect my msn accounts. I am not sure where to put the skype id, I have tried putting it in the 2009 slot and in the skype id slot I have tried changing new to skype_id instead of the msn on, but not luck. Help please? What do i need to change in the patch.py file and where to get this to work?

@amatecha
Copy link

Worked for Adium 1.5.10 on OS X 10.9.3

Unfortunately, as some others have said, I don't seem to get messages from other users, but they do see my messages.

@dequis
Copy link
Author

dequis commented Nov 14, 2014

Potential workaround for the issues of showing offline to others / one-way chat.

  1. Sign in to http://outlook.com with your msn account details (doesn't matter if it's not an outlook/hotmail email address)
  2. Let the webchat connect
  3. Connect with bitlbee/pidgin/adium/whatever
  4. Close outlook.com
  5. You should be able to use it normally now.

@dequis
Copy link
Author

dequis commented Nov 14, 2014

New workaround idea, for pidgin/adium/libpurple users only, install msn-pecan, which uses an even older version of the protocol (MSNP12) which handles contact lists in a different, much simpler way.

https://code.google.com/p/msn-pecan/

@j-cimb-barker
Copy link

To install MSN Pecan on Ubuntu I can do:

sudo apt-get install msn-pecan

Does anyone know of a build of the Adium plugin...? The project website doesn't seem to supply a recent build...

@MKEbrew
Copy link

MKEbrew commented Nov 14, 2014

Pecan worked for me (for now). Pidgin 2.10.10 on windows 7.

Thanks!

@jim42251
Copy link

Could really use an Adium version too. Tried to install the patch on my machine via terminal but it still won't let me log in.
If anyone could direct mac users such as myself on how to install MSN pecan it would be greatly appreciated.

@bjdevil21
Copy link

Following @zmx instructions and copying the patch's output file to /Applications/Adium.app/Contents/Frameworks/libpurple.framework/Versions/Current and replace libpurple worked for Adium (1.5.10) on OSX.

@jorgelf
Copy link

jorgelf commented Nov 14, 2014

Thanks, mate!! Worked like a charm on Ubuntu with my pidgin 2.10.3.

@dequis
Copy link
Author

dequis commented Nov 17, 2014

Bitlbee users: bzr revision 1064 (diff) includes fixes for the problem of showing offline. For users of the public server, testing.bitlbee.org is already updated to this revision.

These should arrive to pidgin's hg soon, and we'll have to do something about distributing those because a patch won't cut it this time.

@dimir
Copy link

dimir commented Nov 24, 2014

Thanks, worked perfectly well with patching libpurple (/usr/lib/purple-2/libmsn.so) that pidgin uses.

Debian Wheezy (7.6), libpurple 2.10.9, pidgin 2.10.9.

My steps were:

stop pidgin
$ mkdir /tmp/pidgin-patch
$ cd /tmp/pidgin-patch
$ wget https://gist.githubusercontent.com/dequis/77b478f35f93f64ac640/raw/164ea64b8db31f1d6d2aecb9b4a20e9b84b29770/patch.py
$ chmod +x patch.py
$ sudo cp /usr/lib/purple-2/libmsn.so /usr/lib/purple-2/libmsn.so.orig
$ sudo cp /usr/lib/purple-2/libmsn.so .
$ ./patch.py libmsn.so

(the output was:

Writing to /home/vl/tmp/pidgin/libmsn.so.out
Found old ID at offset: 260506 (0x3f99a)
Found old ID at offset: 262293 (0x40095)
Found old ID at offset: 263445 (0x40515)
Found old ID at offset: 265053 (0x40b5d)
Found old ID at offset: 266165 (0x40fb5)
Found old ID at offset: 267301 (0x41425)
Found old ID at offset: 268517 (0x418e5)
Found old ID at offset: 269965 (0x41e8d)
Found old ID at offset: 271125 (0x42315)
Found old ID at offset: 272421 (0x42825)
Found old ID at offset: 273709 (0x42d2d)
Found old ID at offset: 274869 (0x431b5)
Found old ID at offset: 276197 (0x436e5)
Found old ID at offset: 277221 (0x43ae5)
14 IDs changed)

$ sudo cp libmsn.so.out /usr/lib/purple-2/libmsn.so
start pidgin

@dequis
Copy link
Author

dequis commented Nov 25, 2014

Pidgin/libpurple users: 2.10.11 was released yesterday, includes fixes for the problem of showing offline. Upgrade to it instead of using this patch!

@MKEbrew
Copy link

MKEbrew commented Dec 5, 2014

Getting "connection refused" this morning with Pidgin 2.10.11 (Windows 7).

@cbenard
Copy link

cbenard commented Dec 5, 2014

Getting "connection refused" this morning too. Coworkers are getting the same thing. 2.10.10 (patched) and 2.10.11.

@cbenard
Copy link

cbenard commented Dec 5, 2014

MSN-pecan is also giving "connection refused". Maybe they finally shut it down.

@bengalih
Copy link

bengalih commented Dec 8, 2014

This patch worked for me Win 7 with 2.10.10 for a bit. Now I've got the issue again "connection refused" to MSN. Upgraded to 2.10.11 and still having it.

Does anyone know if pidgin devs are still aware of the issue and if there is a tracking bug for it?

UPDATE: They are aware on their IRC channel.
Directs you to:
http://ismsndeadyet.com/

Seems to work by enabling HTTP method in advanced for account.

@cbenard
Copy link

cbenard commented Dec 8, 2014

bengalih's recommendation worked for me. HTTP method works again.

@bjdevil21
Copy link

I can also confirm that this latest change (select Connect via HTTP under Options) re-enables for my patched version of Adium (https://gist.github.com/dequis/77b478f35f93f64ac640#comment-1337726).

@felipe1982
Copy link

HTTP method - works for me. (australia)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment