#
# CDDL HEADER START
#
# The contents of this file are subject to the terms of the
# Common Development and Distribution License (the "License").
# You may not use this file except in compliance with the License.
#
# You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
# See the License for the specific language governing permissions
# and limitations under the License.
#
# When distributing Covered Code, include this CDDL HEADER in each
# file and include the License file at usr/src/OPENSOLARIS.LICENSE.
# If applicable, add the following below this CDDL HEADER, with the
# fields enclosed by brackets "[]" replaced with your own identifying
# information: Portions Copyright [yyyy] [name of copyright owner]
#
# CDDL HEADER END
#
#
#
import GeoIP
import md5
import sys
import time
# Translate an apache log line into a format that is smaller and easier to parse:
# <ip md5> <country code> <date> <operation> <operation args> <size>
#
# Apache log format:
# 1.2.3.4 - - [12/Aug/2008:19:21:28 -0700] "GET /manifest/0/SUNWkos@0.5.11%2C5.11-0.94%3A20080721T212150Z HTTP/1.1" 200 19748 "-" "pkg/d974bb176266 (sunos i86pc; 5.11 snv_86; full)"
cnt = {}
for x in ops:
cnt[x] = 0
while True:
break
#print("line: [{0}]".format(line))
del fields
# Get country code and translate ip -> md5 of ip
# Goofy date -> UTS
# Figure out op and opargs
if "1p.png" in op:
continue
# only interested in catalog/0 operations
continue
if op == "search":
if op == "file":
# TODO: also need to grab size
for x in ops: