-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathstatic.py
More file actions
41 lines (26 loc) · 890 Bytes
/
Copy pathstatic.py
File metadata and controls
41 lines (26 loc) · 890 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
35
36
37
38
39
40
41
#!/usr/bin/env python2
"""Serve static content underneath of /etc/.
curl -i http://localhost:8090/passwd
curl -i http://localhost:8090/shadow
"""
import sys
sys.path.insert(0, '.')
from datetime import datetime
from circuits import BaseComponent, Debugger, handler
from circuits.http.server.resource import Domain, StaticResource
from circuits.tools import graph
from server import HTTPServer as _HTTPServer
class BaseResource(StaticResource):
"""curl -i http://localhost:8090/passwd"""
channel = '/*path' # allows everything underneath of /etc/
channel = '/:path' # allows only files directly in /etc/
def directory(self, client):
return '/etc'
class HTTPServer(_HTTPServer):
def __init__(self):
super(HTTPServer, self).__init__()
self.localhost += BaseResource()
if __name__ == '__main__':
server = HTTPServer()
server += Debugger(events=True)
server.run()