From: mitty Date: Mon, 9 Jan 2012 13:49:56 +0000 (+0000) Subject: * convert Google Chrome cache file to regular file X-Git-Url: http://lab.mitty.jp/git/?a=commitdiff_plain;h=dc0e4309de7d7f4ad53b79af46156049c9779811;p=lab.git * convert Google Chrome cache file to regular file * cache files from chrome://cache/ git-svn-id: https://lab.mitty.jp/svn/lab/trunk@129 7d2118f6-f56c-43e7-95a2-4bb3031d96e7 --- diff --git a/misc/chrome-about.cache.pl b/misc/chrome-about.cache.pl new file mode 100644 index 0000000..02f2dfd --- /dev/null +++ b/misc/chrome-about.cache.pl @@ -0,0 +1,61 @@ +#! /usr/bin/perl -w + +use strict; +use warnings; + +my $cachefile = shift @ARGV || die "usage: $0 cache.file [filename.to.save]"; +if (! -r $cachefile) { + die "$0: cannot read $cachefile"; +} +my $savefile = shift @ARGV; + +open CACHE, "<$cachefile"; + + +my $hrcount = 2; +my $filename; +my $line; +while ($hrcount > 0) { + $line = ; + if ($line =~ /
/) { $hrcount--; } + if ($line =~ /https?:.+\/([^\/<]+) 0) { + $line = ; + if ($line =~ /
/) { $hrcount--; } +} + +$line = substr $line, 15; + +open SAVE, ">$savefile" || die "$0: cannot write $savefile"; +binmode(SAVE); + +$hrcount = 1; +while ($hrcount > 0) { + print SAVE hex2bin($line); + + $line = ; + if ($line =~ /
/) { $hrcount--; } +} + +print STDERR "$0: done\n"; + +sub hex2bin { + my $str = shift @_; + + $str = substr $str, 11, 64; + + return pack("H*", join("", split(" ", $str))); +}