-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathcookieMonster.py
More file actions
34 lines (26 loc) · 959 Bytes
/
cookieMonster.py
File metadata and controls
34 lines (26 loc) · 959 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
#!/usr/bin/env python
from http.server import BaseHTTPRequestHandler, HTTPServer
from urllib.parse import urlparse, parse_qs
from datetime import datetime
class MyHandler(BaseHTTPRequestHandler):
def do_GET(self):
query_components = parse_qs(urlparse(self.path).query)
print("")
print("%s - %s\t%s" % (
datetime.now().strftime("%Y-%m-%d %I:%M %p"),
self.client_address[0],
self.headers['user-agent']))
print("-------------------"*6)
for k, v in list(query_components.items()):
print("%s\t\t\t%s" % (k.strip(), v))
return
def log_message(self, format, *args):
return
if __name__ == "__main__":
try:
server = HTTPServer(('0.0.0.0', 8888), MyHandler)
print('Started http server')
server.serve_forever()
except KeyboardInterrupt:
print('^C received, shutting down server')
server.socket.close()