Decoding binary objects

bindecode is a little app I wrote to decode a bunch of bits into something more human friendly. Currently it supports most important IA64 registers and a few other things, though if someone wants to send me patches for other architectures that is cool.

A screenshot should suffice

ianw@lime:~/programs/junkcode/code/bindecode$ python ./bindecode.py

Bitmap Decoder
--------------
Tab shows bitmaps to complete, quit or Ctrl-D to exit

Input Bitmap Type >
386_pte           ia64_itir         ia64_psr          ia64_rr           to_32bit_binary   unix_permissions
ia64_ifa          ia64_pkr          ia64_pte          ia64_tlb_gr       to_64bit_binary

Input Bitmap Type > to_32bit_binary

to_32bit_binary value > 0xff
Decoded output for a Convert to a 32 bit binary
Bits | 0000 0000 0000 0000 0000 0000 1111 1111

to_32bit_binary value > o123
Decoded output for a Convert to a 32 bit binary
Bits | 0000 0000 0000 0000 0000 0000 0101 0011

to_32bit_binary value > b101010101010
Decoded output for a Convert to a 32 bit binary
Bits | 0000 0000 0000 0000 0000 1010 1010 1010

to_32bit_binary value > q

Input Bitmap Type > ia64_pte

ia64_pte value > 0x0210000005be01e1

Decoded output for a IA64 PTE Entry
           Present | True
          Reserved | 0
 Memory Attributes | 0x0
     Page Accessed | True
        Page Dirty | True
   Privilege Level | 0x3
     Access Rights | . . .
               PFN | 0x5be0
Exception Deferral | True
           Ignored | 0x10

ia64_pte value > q

Input Bitmap Type > q

The real thing is a bit more colourful with some ANSI colours.

xchat notifier plugin

I previously mentioned that there must be a better way to make xchat pop up a dialog box, and of course there is, the plugin!

It's so easy; though finding the text command to match is a bit obscure. Here it is

__module_name__ = "gnome-notifier-plugin"
__module_version__ = "1.0"
__module_description__ = "notify of channel events via gnome-notify"

import xchat
import os

def channel_message(word, word_eol, userdata):

    err = os.system("/usr/bin/gnome-notify " +
                    "\'<font color=\"red\">New channel message</font></br>" +
                    "<b>"+word[0]+"</b><br>"+word[1]+"\'")
    if (err != 0):
        print("Failed to launch gnome-notify!")
    return xchat.EAT_NONE

xchat.hook_print("Channel Msg Hilight", channel_message)

you just put that in your .xchat2 directory and next thing you know you should have screenshots like that below!

gnome-notifier xchat plugin

xchat notifier

In a previous post I mentioned I wanted an IRC notifier; I got the notifier working but can't really plug it into xchat.

As far as I can tell (and I didn't look that much, the only way I can get the notifier to fire when xchat matches my username in a message is to use the sound infrastructure. Each event can have sound play, and you can specifiy the program to play the sound. Thus I use this with a bogus filename like " You've got a message" ... the only problem is the box has the full path to the filename in it.

xchat must have a better way to handle this sort of thing ...