From dc0e4309de7d7f4ad53b79af46156049c9779811 Mon Sep 17 00:00:00 2001 From: mitty Date: Mon, 9 Jan 2012 13:49:56 +0000 Subject: [PATCH] * 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 --- misc/chrome-about.cache.pl | 61 ++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 61 insertions(+) create mode 100644 misc/chrome-about.cache.pl 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))); +} -- 1.7.9.5