Netcat is a computer networking service for reading from and writing network connections using TCP or UDP
7
votes
3answers
3k views
Using in/out named pipes for a TCP connection
I've been fiddling with getting this to work for a while now, so I suspect some sort of fundamental misunderstanding about how pipes work is the root cause of my troubles.
My goal is to initiate a ...
6
votes
2answers
4k views
/dev/tcp listen instead of nc listen
With a netcat listener like:
nc -l <port> < ~/.bashrc
I can grab my .bashrc on a new machine (doesn't have nc or LDAP) with:
cat < /dev/tcp/<ip>/<port> > ~/.bashrc
My ...
5
votes
2answers
2k views
Howto create a permanent client connection with netcat?
I'm writing a bash script that constantly read a folder in a loop to send data to a server at a defined time interval. I'm using netcat as the tool to connect to the server and send the data. My ...
5
votes
1answer
2k views
Remote desktop over SSH reverse tunnel to replace TeamViewer
I want to open a remote desktop session from my laptop to desktop over my SSH (reverse) tunnel. That should be simple (or at least doable), right? Until now I've been using Team Viewer to log in to ...
4
votes
2answers
4k views
How to make netcat use an existing HTTP proxy
I can access a web page just fine by directly hitting my web server as follows:
$ echo "GET /sample" | nc web-server 80
This is contents of /sample...
$
Now, I would like netcat to go via a Squid ...
4
votes
2answers
319 views
is it possible to send the remote connector ip via netcat?
Actually I want to make something like ifconfig.me functionality but only for my internal network. I see it the way smth on server listens some port and send ip of connected remote machine.
Seems nc ...
4
votes
2answers
438 views
Why does this shell snippet to check if hosts are up using netcat stop prematurely?
Q: Why does the second iteration exits after 10.175.192.16? Can someone explain that? Or I just found a "while/netcat" bug?
a.txt's content:
$ cat a.txt
10.175.192.14
10.175.192.16
10.175.192.17
$
...
3
votes
2answers
476 views
Different redirection styles with netcat and tee giving different results
In trying to trace a simple HTTP GET request and its response with nc, I'm running into something strange.
This, for example, works fine: the in file ends up containing the HTTP GET request and the ...
2
votes
3answers
3k views
convert a hex string to binary and send with netcat
I have a binary file that I can send with netcat:
$ nc -l localhost 8181 < my.dat
The file contains this:
$ xxd my.dat
0000000: 0006 3030 3030 4e43 ..0000NC
What I really ...
2
votes
2answers
111 views
nc: bind failed: Address already in use
I am trying to execute nc command from a script , my script is executing nc command on different ports of Destination using the same source port.
e.g:
nc -p 8140 -z -v -n 10.X.X.9 9090
nc -p 8140 -z ...
2
votes
3answers
499 views
How can I read lines at a fixed speed?
I need to read a large log file and send it over a local network using (netbsd) netcat between two VMs on the same host workstation.
I know that netcat has an interval, but as far as I can tell, the ...
2
votes
2answers
2k views
SSH jumping over socks(4/5) proxy chain. Host -> socks proxy -> socks proxy -> destination
I got a great answer for my previous question about connecting from Machine A to Machine C via Socks proxy located on Machine B.
Say Machine B Ip is 218.62.97.105 and it is listening on port 1080
...
2
votes
1answer
147 views
cat file to udp, pt 2: send 1 udp packet per ^C-delimited line
Yesterday I asked a question about catting a file over a UDP socket in bash.
The solution we came up was netcat -c -w 1 -v -u -s 127.0.0.1 239.255.0.1 30001 < test.txt. This worked in the sense ...
2
votes
2answers
33 views
Output of one command is piped to another one; how to close both?
I call Qt Assistant like suggested on stackoverflow:
nc -lkU ~/.assistantfifo | assistant -enableRemoteControl &
Qt Assistant window is opened, and if I call jobs, it returns:
[1] + running ...
2
votes
3answers
417 views
Servers running from chrooted Ubuntu on HP TouchPad? [closed]
The problem: servers appear to be broken inside my Ubuntu chroot. No matter what kind of server I try to run, they all seem unresponsive (VLC server won't respond to client, mkRemote doesn't move the ...
2
votes
3answers
351 views
netcat doesn't work as expected when detached from console with nohup (Ubuntu/Debian 64bit)
I'm trying to leave netcat running and close the ssh session (even stop the ssh daemon). But it then exits before all of the data is written. I'm testing in a non-ssh (local) console:
nohup nc -l -p ...
2
votes
1answer
109 views
Log from TCP Port breaking messages on characters other than newline
I'm working on a set of scripts to monitor some external services that log to a TCP port.
function handleMessage {
while read message
do
# Handle $message
done
}
nc -d $ipadd $port | ...
2
votes
2answers
498 views
How to copy a partition over network
I want to copy a Windows 7 partition that came installed on my laptop to my desktop computer.
I've tried:
# bzip2 -c /dev/sda5 | nc 192.168.1.1 2222 # on laptop
# nc -l 2222 | bzip2 -d > ...
2
votes
1answer
3k views
netcat in shell script giving invalid connection
I have a shell script that uses netcat to listen to localhost on port 1111 for web requests. Every time I try accessing localhost:1111/index.html for example I get:
invalid connection to [127.0.0.1] ...
1
vote
1answer
44 views
How to avoid sending EOF from a script parsing requests from and sending answers to netcat
I made a simple server using netcat and backpipe:
mkfifo backpipe
nc -l 8080 < backpipe | parseRequests.sh > backpipe
The contents of "parseRequests.sh" is just:
#!/bin/sh
if [ "$1" = "1+1" ...
1
vote
1answer
465 views
Command line streaming string manipulation from netcat
I have a netcat udp connection listening with nc -l -u .... I've been trying to do a per packet manipulation of the incoming data with just command line, but it doesn't look like there is a flag in ...
1
vote
1answer
1k views
Stream Video using Netcat and VLC
I'm trying to use netcat on Linux server to stream video to my windows client using VLC
I started running netcat on Linux:
cat /media/HD1/myMovie.mkv | nc -l 8668
In VLC Windows Client I tried ...
1
vote
1answer
330 views
netcat throughput low but iperf high [closed]
I was testing the throughput between two pcs connected on the same router: one with 100mbps lan, the other with 54mbps wifi.
I tested both netcat and iperf and the throughtput I get is only 2.6mb/s.
...
1
vote
1answer
1k views
How to put value of echo pipe netcat commands into variable [duplicate]
I have this command succession:
echo -ne "/dev/shm/test.sh" | netcat 89.196.167.2 4567
and let's say it return a string like, for example "Hello...bla".
(on the 89.196.167.2 i have made a server ...
0
votes
1answer
45 views
Getting more output from NetCat
Currently I'm using the standard netcat -e /bin/sh to provide a remote shell for other computers to access.
The problem is however that this shell is rather terrible, since it has limited output. For ...
