Difference between revisions of "NetCat"
Line 36: | Line 36: | ||
hosted computer to get the shell from | hosted computer to get the shell from | ||
− | nc 127.0.0.1 1234 –e / | + | nc 127.0.0.1 1234 –e /bin/bash |
remote computer to use the shell | remote computer to use the shell | ||
Line 46: | Line 46: | ||
The host computer with the shell to access. | The host computer with the shell to access. | ||
− | nc –l –p 1234 –e / | + | nc –l –p 1234 –e /bin/bash |
Connect to the host computer with the following command. | Connect to the host computer with the following command. | ||
Line 53: | Line 53: | ||
Side note: You can create a simple script and run this with nohup in the background to insure this continues running. | Side note: You can create a simple script and run this with nohup in the background to insure this continues running. | ||
nohup ./script.sh & | nohup ./script.sh & | ||
+ | |||
+ | You can also pipe all commands into bash | ||
+ | nc -l 1234 | /bin/bash |
Revision as of 21:10, 27 April 2020
Redirect ports.
This one redirect port 24 to port 22.
24 stream tcp nowait nobody /usr/sbin/tcpd /bin/nc 192.168.1.1 22
This one redirects port 6000(x11) to port 25
x11 stream tcp nowait root /usr/local/bin/nc nc -n -w 3 127.0.0.1 25
Start a chat
host computer - 10.0.0.1
nc -l 8001
remote computer - 10.0.0.2
nc 10.0.0.1 8001
and then start typing
Send a file
This will send a file to another computer on the same network
hosted file computer - 10.0.0.1
cat file.doc | nc 10.0.0.2 8001
remote file to receive the file
nc -l 8001 > file.doc
Reverse Shell
This create a shell for a client to use.
hosted computer to get the shell from
nc 127.0.0.1 1234 –e /bin/bash
remote computer to use the shell
nc -l -p 1234
Shell Listener
This creates a listener shell, at which point any client can connect to and use the shell.
The host computer with the shell to access.
nc –l –p 1234 –e /bin/bash
Connect to the host computer with the following command.
nc 127.0.0.1 1234
Side note: You can create a simple script and run this with nohup in the background to insure this continues running.
nohup ./script.sh &
You can also pipe all commands into bash
nc -l 1234 | /bin/bash