# Medlir # fhdump at medlir dot com # http://www.medlir.com/code/fhdump.pl # # Takes one parameter, the path and filename to formhistory.dat, and dumps all # saved form data for form elements named "q", namely, Google's search query, # to fhdump.txt in the current directory. Free to use, modify, improve or # whatever. Would love to be emailed with improvements. Can easily be modified # to dump saved form data for any form element or all of them. # # e.g. ./fhdump.pl formhistory.dat # e.g. ./fhdump.pl ~/conf/firefox15/formhistory.dat #!/bin/perl -w use strict; my $file = $ARGV[0]; my $fid = 0; my %data = (); my @data2 = (); open(F,$file); my @data = ; close(F); my $data = join('',@data); @data = (); $data =~ s/\$00//g; $data =~ s/\r//g; $data =~ s/\t//g; $data =~ s/\n\s+\=/=/g; $data =~ s/\\\n//g; $data =~ s/\s+\(/\(/g; $data =~ s/\((.*?)\=(.*?)\)/\n\($1\=$2\)/g; @data = split("\n", $data); foreach (@data) { if ($_ =~ /^\((\w+)\=q\)$/) { $fid = $1; } elsif ($_ =~ /^\((\w+)=(.*?)\)$/) { $data{$1} = $2; } } foreach (@data) { if ($_ =~ /\[.*?\(\^83\^${fid}\)\(\^82\^(\w+)\)\]/) { push(@data2,$data{$1}); } } @data2 = sort(@data2); open(F,">fhdump.txt"); foreach (@data2) { print F $_."\n"; } close(F);