Imagine you are conducting a penetration test and need to transfer a file from your attacking machine to a compromised Windows host. You decide to use a networking utility known for its simplicity and effectiveness in creating ad-hoc connections between two machines. What command should be executed on the attacker's machine to serve a file named 'payload.exe' over port 4444?
The correct line 'nc -lvp 4444 < payload.exe' listens on port 4444 and serves 'payload.exe' to any client that connects. The '-l' flag tells the utility to listen for incoming connections, '-v' stands for verbose output (providing feedback and debugging information), and '-p 4444' specifies the port number. Redirection '<' is used to serve a file. The other options are incorrect: '-p' should not be used with the client mode (without '-l'), 'nc -l -p 4444 > payload.exe' wrongly suggests the file is being received (using '>'), and 'nc -ulvp 4444 < payload.exe' incorrectly includes the '-u' flag, which is used for UDP protocol instead of TCP.
Ask Bash
Bash is our AI bot, trained to help you pass your exam. AI Generated Content may display inaccurate information, always double-check anything important.
What does 'nc' stand for and what is its purpose?
Open an interactive chat with Bash
Can you explain the flags used in the command 'nc -lvp 4444'?
Open an interactive chat with Bash
What is the difference between using TCP and UDP with Netcat?