Jump to content

How to decode icons from Firefox bookmarks.html


Recommended Posts

Hi,

in the Firefox-profile-folder is stored the bookmarks.html which contains the users' favorites with date of entry, description, url and so on and the favicon.

The favicon is stored as text. In front of the hexadecimal string is a

ICON="data:image/x-icon;base64,

I would think it is encoded in base64. How can I decode such a string and store in an single *.ico file?

Thx in advance...

Regards,

Buffo

Link to comment
Share on other sites

I thought this would be sort of fun so I wrote this up for you real fast:

#include "_Base64.au3"
$s_Path = FileOpenDialog("Select Firefox Bookmarks.html","C:\Documents And Settings\", "Bookmarks File (bookmarks.html)")
If @error Then
    MsgBox(4096,"","No Bookmark file chosen!")
    Exit
EndIf
$s_Bfile = FileRead($s_Path, FileGetSize($s_Path))
$a_Icons = StringRegExp($s_Bfile, 'base64,(.+?)" LAST_CHARSET', 3)
If NOT IsArray($a_Icons) Then
    MsgBox(0, "Error", "No encoded icons were found!")
Exit
EndIf
;_ArrayDisplay($a_icons, "Array containing B64 Data")
For $i = 0 To UBound($a_Icons) - 1
    $s_Decode = _Base64Decode($a_Icons[$i], "Converting Icon #: "&$i)
    FileWrite(@ScriptDir&"\Icon"&$i&".ico", $s_Decode)
Next
MsgBox(0,"Finished", UBound($a_Icons)&" were decoded from the bookmarks.html file!")

Requires the Base64 UDF made by: mikeytown2

Direct Link: http://www.autoitscript.com/forum/index.ph...pe=post&id=7480

AutoIt Scripts:Aimbot: Proof of Concept - PixelSearching Aimbot with several search/autoshoot/lock-on techniques.Sliding Toolbar - Add a nice Sliding Toolbar to your next script. Click the link to see an animation of it in action!FontInfo UDF - Get list of system fonts, or search to see if a particular font is installed.Get Extended Property UDF - Retrieve a files extended properties (e.g., video/image dimensions, file version, bitrate of song/video, etc)
Link to comment
Share on other sites

;_ArrayDisplay($a_icons, "Array containing B64 Data")

For $i = 0 To UBound($a_Icons) - 1

$s_Decode = _Base64Decode($a_Icons[$i], "Converting Icon #: "&$i)

FileWrite(@ScriptDir&"\Icon"&$i&".ico", $s_Decode)

Next

Great work! I located the base64 UDF from mikeytown2 but my english isn't good enough by half to understand the whole thread. But with your example it's very easy.

Thank you very much :)

Regards,

Buffo

Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
 Share

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...