Skip to content

Reading MikroTik’s winbox addresses.wbx file format

MikroTik, a Latvian network equipment vendor makes a Linux-based router operating system called RouterOS. It has become a popular software platform for wireless networking, and the WISP industry.

While it has it’s fair share of bugs (OSPF instabilities in 2.9.x for example), I quite enjoy working with RouterOS. I recently noticed that version 3 sports some “grown up” router features, like MPLS support, as well as some innovative stuff like Xen integration.

Apart from a good CLI interface, RouterOS also has a Windows client application for configuration and monitoring called winbox. A convenient feature of winbox is that you can save device profiles, and optionally store their login credentials. If you want to move these saved profiles to another machine, you can use the Tools->Export/Import function, that respectively writes and reads a binary file called addresses.wbx.

If you’ve forgotten the login password for one of your RouterOS devices, but you chose to have winbox store it, you can use strings(1) to dump the contents of addresses.wbx to retrieve it.

Last week I wrote a little python script called wbx.py that reads this binary format and presents the output in a tabular format that is somewhat friendlier than what strings(1) (or notepad.exe for the unfortunate) would produce. Please be warned though, it’s not well tested, so your mileage may vary.

I’ve added a code page, where I intend to begin collecting any executable bits that I happen to blog about. You can find wbx.py there.

{ 4 } Comments

  1. Jan Jaros | 11 March 2009 at 7:41 am | Permalink

    Hi, I have spent quite a lot of time trying to find a reverse way. I want to create my own wbx files,but I cant find any documentation or clues how to. :(

  2. Simeon Miteff | 11 March 2009 at 9:14 am | Permalink

    Hi Jan

    A starting point would be to look at my Python script:
    http://localloop.co.za/wp-content/uploads/2008/10/wbx.py

    I would suggest that you look at the wbx file with a hex editor and try to make sense of the Python code.

    The file format seems to be:
    * A 4-byte header
    * A series of Name/Value pairs

    Each Name/Value pair starts with the name and value lengths as 8bit integers. My code just reads pairs until it gets to the end of the file, but it’s possible that the number of pairs is stored in the header.

    Unfortunately I don’t have a wbx file to check this.

    Good luck!

    Regards,
    Simeon.

  3. Jindřich Vrba | 2 November 2009 at 5:01 pm | Permalink

    Hello,
    thanks for help, maybe, somebody find useful this function:

    def winbox_item(ip,login,note,password):
      """
      Writes item to winbox \"addresses.wbx\" - usefull to import to
      winbox, or maybe to set as a winbox.cfg configuration.
      """
      f_winbox.write("\x09\x00\x04typeaddr")
      f_winbox.write("%s\x00\x04host%s" % (chr(len(ip)+5),ip))
      f_winbox.write("%s\x00\x05login%s" % (chr(len(login)+6),login))
      f_winbox.write("%s\x00\x04note%s" % (chr(len(note)+5),note))
      f_winbox.write("\x0d\x00\x0bsecure-mode\x01")
      f_winbox.write("\x0a\x00\x08keep-pwd\x01")
      f_winbox.write("%s\x00\x03pwd%s\x00\x00" % (chr(len(password)+4),password))
    

    To use it from main:

    if __name__ == "__main__":
      f_winbox = open("addresses.wbx",'w')
      f_winbox.write("\x0f\x10\xc0\xbe") #header
      winbox_item("10.9.8.7","some_user","some_note","some_password")
      f_winbox.close()
    
  4. Wolfen351 | 30 December 2011 at 12:59 pm | Permalink

    Hi there

    Just wanted to say thanks a million for posting this, saved me several hours of research.

    Wolfen351

{ 1 } Trackback

  1. Kuliah | KuliahKu | 21 October 2009 at 9:31 pm | Permalink

    [...] post: Local Loop : Reading MikroTik's winbox addresses.wbx file format 0 people like this post. Like  [Translate] Categories: Mikrotik – Wireless Networking [...]

Post a Comment

Your email is never published nor shared. Required fields are marked *