Sign in to follow this  
Followers 0
Buffo

How to decode icons from Firefox bookmarks.html

5 posts in this topic

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

Share this post


Link to post
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)

Share this post


Link to post
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

Share this post


Link to post
Share on other sites

it gives me this:

C:\au3\_Base64.au3(237,46) : ERROR: BinaryString(): undefined function.

$s_Out &= StringLeft(BinaryString($i_Temp)

do I have to use the beta of autoit or?

Share this post


Link to post
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
Sign in to follow this  
Followers 0