Skip to content

Instantly share code, notes, and snippets.

@mschmitt
Created July 28, 2011 11:15
Show Gist options
  • Save mschmitt/1111395 to your computer and use it in GitHub Desktop.
Save mschmitt/1111395 to your computer and use it in GitHub Desktop.
Playing with the Firefox session file...
#!/usr/bin/perl -w
use strict;
use diagnostics;
use JSON;
use Data::Dumper;
my $sessionstore = '/home/martin/.mozilla/firefox/12345678.default/sessionstore.js';
my $json_raw;
open my $fh_in, "<$sessionstore" or die "Can't open $sessionstore: $!\n";
while (<$fh_in>){
$json_raw .= $_;
}
my $json = JSON->new->utf8;
my $json_cooked = $json->decode($json_raw);
my @windows = @{$json_cooked->{'windows'}};
foreach my $window (@windows){
my $tabs = $window->{'tabs'};
print Dumper($tabs);
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment