#!/usr/bin/env python
import os.path, os
import sys

fileName = sys.argv[1]

f = open(fileName, 'rb')
# read first line of squid cache file
line1 = f.readline()
f.close()

# parse squid proxy secret number from cache file
#   - in squid cache file, key is offset 0x0a - 0x19 of file
key = line1[0x0a:0x19]

# in squid proxy cache files, URL starts at offset 0x3c
index=0x3c
url = ""

# parse out URI from squid proxy cache header data
while line1[index].encode("hex") != "00":
	url = url + line1[index]
	index = index + 1

#url = url + line1[index]

print sys.argv[1] + " " + key.encode("hex") + " " + url






