Skip to content

Instantly share code, notes, and snippets.

Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save aniversarioperu/9702860 to your computer and use it in GitHub Desktop.
Save aniversarioperu/9702860 to your computer and use it in GitHub Desktop.
inpt is an access log file from Apache
#!/usr/bin/env python
# -*- coding: utf-8 -*-
import sys
import codecs
import urllib
filename = sys.argv[1].strip()
f = codecs.open(filename, "r", "utf8")
lines = f.readlines()
f.close()
for line in lines:
line = line.strip()
if "POST" in line and "cgi" in line:
line = line.split("POST ")
if len(line) > 1:
line = line[1].split(" ")
if len(line) > 1:
url = line[0]
print urllib.unquote(url)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment