Beispiel #1
0
def log_sum_2( src, results ):
	srcSuccess=[]
	for line in src:
		# Filter lines based on whether or not they contain the HTTP result-code '200':
		mo = re.search( filterResultExt, line )
		mo = re.search( filterResult, mo.string[ mo.start(0):mo.end(0) ] )
		if mo.string[ mo.start(0):mo.end(0) ] in str(httpSuccess):
			srcSuccess.append( line )

	log_sum_c( srcSuccess, results )
Beispiel #2
0
			q = Queries.Queries_f

# Get the last argument (filename):
filename = sys.argv[-1] # HACK

# Load the specified file:
src = open( filename, 'r' ) # r for readonly?

# Filter the input according to date:
src = log_sum_filterDate( src, date )

# Call the specified query:
results=[]
if q == Queries.Queries_c:
	results.append( "Connection attempts:" )
	log_sum_c( log_sum_filterQueries( src, ["GET"] ), results )	# Allow only GET-queries.
elif q == Queries.Queries_2:
	results.append( "Connection attempts indicating success:" )
	log_sum_2( log_sum_filterQueries( src, ["GET"] ), results )	# Allow only GET-queries.
elif q == Queries.Queries_r:
	results.append( "Common response codes:" )
	log_sum_r( log_sum_filterQueries( src, httpQueries ), results )	# Allow all HTTP-queries.
elif q == Queries.Queries_F:
	results.append( "Common response codes indicating error:" )
	log_sum_F( log_sum_filterQueries( src, httpQueries ), results )	# Allow all HTTP-queries.
elif q == Queries.Queries_t:
	results.append( "IPs recieving the highest amount of bytes:" )
	log_sum_t( log_sum_filterQueries( src, httpQueries ), results )	# Allow all HTTP-queries.
elif q == Queries.Queries_f:
	results.append( "IPs sending the highest amount of bytes:" )
	log_sum_f( log_sum_filterQueries( src, ["PUT", "POST"] ), results )	# Allow only PUT- and POST-queries.