So I created a simple server on an Ubuntu box on port 8000 by doing this:
python -m SimpleHTTPServer
10.127.11.18 - - [14/Aug/2014 15:11:55] "GET / HTTP/1.1" 200 -
10.127.11.18 - - [14/Aug/2014 15:11:55] code 404, message File not found
10.127.11.18 - - [14/Aug/2014 15:11:55] "GET /favicon.ico HTTP/1.1" 404 -
10.127.11.18 - - [14/Aug/2014 15:12:02] "GET /crazysean/ HTTP/1.1" 200 -
10.127.11.18 - - [14/Aug/2014 15:12:37] "GET /crazysean/ HTTP/1.1" 200 -
10.127.11.18 - - [14/Aug/2014 15:12:52] "GET /crazysean/?url=www.google.com&x=200&y=400 HTTP/1.1" 301 -
10.127.11.18 - - [14/Aug/2014 15:12:52] "GET /crazysean/?url=www.google.com&x=200&y=400/ HTTP/1.1" 200 -
10.127.11.18 - - [14/Aug/2014 15:13:10] "GET /crazysean/?url=www.google.com&x=200&y=400/ HTTP/1.1" 200 -
I am trying to parse out the GET data that is sent, such as URL, x position and y position.
I assume my first step should be creating a new script like so:
import SimpleHTTPServer
import SocketServer
PORT = 8000
Handler = SimpleHTTPServer.SimpleHTTPRequestHandler
httpd = SocketServer.TCPServer(("", PORT), Handler)
print "serving at port", PORT
httpd.serve_forever()
But I am unsure of how to make amendments to this script to capture the GET data, because eventually I want to dump the data into a sqlite3 db.
GETrequests as they come in.GET HTTP/1.1 /crazysean/?url=www.google.com&x=200&y=400. You can get the pieces of that by subclassing the handler. If you want the rest of the log information, like the 301, that's not part of the request; that's the handler explaining what it did about the request.