Babar Haq

Saturday, March 18, 2006

Extraction of Nokia nfb file

I recently lost my six months old nokia 6230i. 29th birthday gift from my wife. Besides the emotional attachment, I had a huge phone book with almost 300 entries in it. I am a sort of person who relies heavily on the phone book. Luckily a week before I lost it, I started using PC Nokia suite provided with the mobile. While getting a hang of it, I took a back up of my phone book. The back up created a file with extension of .nfb.

I didnt know how to extract the phone book from the .nfb file. Googling took me to http://www.dryfish.org/projects/nfb.html. From this website I downloaded some python scripts http://www.dryfish.org/projects/nfb-scripts.zip.

The zip file contains three python files namely: createnfb.py, nfb.py and nfbfile.py.

After struggling with the files for some time, I was able to extract my phone book from the backup nfb file on linux.


This is how I did it:
#./nfbfile.py -xv nameofnfbfile.nfb /PHONEBOOK > resultant_file


The resultant_file was perfectly viewable using the "cat" command but if opened using some text editor it would show a lot of "#" characters. These "#"'s were between each character. I resolved it by simply replacing all "#" with nothing (put nothing in the replace field).

The file looked something like this before

2#0#8# #0#2#6#0#6#8#1#8#1##0#1#8#3#9##_#C#O

Using openoffice's find and replace option I transformed it

200 PIT_CONTACT 208 +92514431878 202 Sufi 210 03037778319
200 PIT_CONTACT 202 Abbas Butt Com 208 03008555188


Each line seems to specify one entry in the contact book. Each entry has different fileds and its values. Each field vaule is preeceded by a three digit code representing the type of field. For example the name field is preceeded by 202.

Using this file, I could temporary look up contacts in my lost mobiles phonebook. Last month I bought a new nokia mobile 6020. This is a scaled down version of 6230i. I thought I would be able to directly restore my phonebook (nfb) to my new mobile. However I was yet to face more challanges :)

Whenever I tried to retrieve the phonebook using nokia PC suite, it exited giving some error. Again google came in handy. I found that Nokia PC suite provides two options for taking backups. One option creates nfb file type and the other nfc file type. Obviously nfb doesent work across different phones. Now Nokia has updated its PC suite a so that when you take a backup it creates both nfb and nfc files.

Therefore I opened the phone book file using vim (you could also use ultraedit). Using vertical text editing, I formated the file so that I was left with only two comma seperated fields. The file started looking something like this


Sufi,03037778319
Abbas Butt Com,03008555188

I named the file with a .csv extension and imported it into Outlook express address book. I chose the first field to represent name and the second to be telephone number. After I got this done I syncronised my mob with Outlook express address book. Its an option which is self explanatory in Nokia PC Suite.

8 Comments:

  • I used the same python script to extract a phone book, then I looked into the resultant_file, as you call it in your example. Actually I realized that there were zeros between every valid character, so I wrote a little C program to strip those zeros, and it worked like a charm (the very first character of the file was still invalid, but I removed it manually).

    You may find the source code of the program here: stripe-copy-v0.7.c

    just compile it:

    gcc -o stripe-copy stripe-copy-v0.7.c

    then run it:

    ./stripe-copy resultant_file final_resultant_file

    By Anonymous Anonymous, At 1:57 AM  

  • I am running windows XP and could not execute the script at all..always it throws syntax error..please help

    By Blogger venu, At 7:30 PM  

  • for a .nfb extractor, please try Noki. It's a fullfeatured Nokia backup file (.nfb, .nfc, .nbu, backup.arc and contacts.cdb) extractor.

    By Anonymous Anonymous, At 4:03 AM  

  • Hi,

    Thanks for sharing the link - but unfortunately it seems to be down? Does anybody here at babarhaq.blogspot.com have a mirror or another source?


    Thanks,
    Daniel

    By Anonymous Anonymous, At 1:07 PM  

  • Greetings,

    This is a inquiry for the webmaster/admin here at babarhaq.blogspot.com.

    May I use some of the information from your blog post above if I give a backlink back to your website?

    Thanks,
    Jules

    By Anonymous Anonymous, At 5:15 PM  

  • Hi,

    This is a question for the webmaster/admin here at babarhaq.blogspot.com.

    May I use some of the information from this post right above if I provide a backlink back to your site?

    Thanks,
    Alex

    By Anonymous Anonymous, At 12:46 AM  

  • Hey - I am definitely happy to find this. great job!

    By Anonymous Anonymous, At 9:11 AM  

  • Nice job, regards

    By Anonymous Anonymous, At 2:15 PM  

Post a Comment

Subscribe to Post Comments [Atom]



<< Home