Question

What does this command do? cat /tmp/f | /bin/sh -i 2>&1 | nc -l 1234 >/tmp/f

What does this command do?

cat /tmp/f | /bin/sh -i 2>&1 | nc -l 1234 >/tmp/f

Homework Answers

Answer #1

Simple webserver using netcat.You can think of it more simply as sh and nc are redirecting to each other in a loop. The rest of the command is just fluff.

  • cat /tmp/f is printing whatever is written to that named pipe and the output of cat /tmp/f is been piped to /bin/sh

  • /bin/sh is running interactively and stderr is redirected to stdout.
  • `the output is then piped to nc which is listening on port 1234
  • and the out put is finally redirected to the named pipe again.

when run, connecting to the remote server on that port i.e 1234 opens a shell prompt and the client can execute arbitrary commands.

Know the answer?
Your Answer:

Post as a guest

Your Name:

What's your source?

Earn Coins

Coins can be redeemed for fabulous gifts.

Not the answer you're looking for?
Ask your own homework help question
Similar Questions
Write a command sequence or a script to insert a line “GHIJKLM” at every 10th line...
Write a command sequence or a script to insert a line “GHIJKLM” at every 10th line of a file? I am using this on Docker Quickstart Terminal version 19. I can't seem to execute it on the command line or get it to work. I'm not sure what I have to fix. This is what I have written so far. ---------------------------------------------------- JennyM07@DESKTOP-3XD60LM MINGW64 ~/CIT270/Lab_1$ ls -l total 1 -rwxr-xr-x 1 JennyM07 197121 100 Aug 26 21:41 file8.sh* -rw-r--r-- 1 JennyM07...
What does the following script do? #!/bin/bash echo $(ls|grep -E "*\.$1$"|wc -l)
What does the following script do? #!/bin/bash echo $(ls|grep -E "*\.$1$"|wc -l)
1. Switch to a command-line terminal (tty5) by pressing Ctrl+Alt+F5 and log in to the terminal...
1. Switch to a command-line terminal (tty5) by pressing Ctrl+Alt+F5 and log in to the terminal using the user name of root and the password of LINUXrocks!. 2. At the command prompt, type vi diskconfig.sh and press Enter to open a new file for editing called diskconfig.sh in your home directory. Why is it good form to use a .sh extension for shell scripts? 3. Enter the following text into the diskconfig.sh file. As you are typing the contents, ensure...
what is the bin-1 gene? how does it relate to Alzheimer's disease?
what is the bin-1 gene? how does it relate to Alzheimer's disease?
What does it mean to run command as an elevated user? How do you accomplish this?...
What does it mean to run command as an elevated user? How do you accomplish this? List four types of information that the ipconfig command with the /all parameter provides that the ipconfig command without the parameter does not. What type of server resolves a domain name to an IP address?
What command do I use to run my pcap file through SNORT?
What command do I use to run my pcap file through SNORT?
Consider a function (fx) such that L(f)(2) = 1; f(0)=1; f'(0)=0 Where L(f)(s) denotes the Laplace...
Consider a function (fx) such that L(f)(2) = 1; f(0)=1; f'(0)=0 Where L(f)(s) denotes the Laplace transform of f(t) Calculate L(f'')(2)
a.)Consider the function f (x) = 3x/ x^2 +1 i) Evaluate f (x+1), and f (x)+1....
a.)Consider the function f (x) = 3x/ x^2 +1 i) Evaluate f (x+1), and f (x)+1. Explain the difference. Do the same for f (2x) and 2f (x). ii) Sketch y = f (x) on the interval [−2, 2]. iii) Solve the equations f (x) = 1.2 and f (x) = 2. In each case, if a solution does not exist, explain. iv) What is the domain of f (x)? b.)Let f (x) = √x −1 and g (x) =...
1. Does the Town of Cary, NC maintain any permanent funds? Yes or No If so,...
1. Does the Town of Cary, NC maintain any permanent funds? Yes or No If so, are they major or non-major funds? For what purpose? 2. Does the Town of Cary, NC maintain any fiduciary funds? Yes or No For what purpose? 3. Does the Town of Cary, NC contribute to one or more pension plans? Are they defined benefit plans or defined contribution plans? If defined benefit plans, are they single employer (maintained by the Town of Cary itself)...
Linux Operation SECTION 2 – File and Directory Permissions: FILE PERMISSIONS: What is the command used...
Linux Operation SECTION 2 – File and Directory Permissions: FILE PERMISSIONS: What is the command used to find out which user account you are logged into?      . This command may come in handy in the following exercises. Ensure you are in your home directory of the student1 account. Use the echo command with output redirection to create a file called labfile4 and put the following text in this file: “This is the first line of labfile4”. Using the symbolic notation...