netcat

How can I tail a remote file?

I am trying to find a good way to tail a file on a remote host. This is on an internal network of Linux machines. The requirements are: Must be well behaved (no extra process laying around, or continuing output) Cannot require someone's pet Perl module. Can be invoked through Perl. If possible, doesn't require a custom built script o...

Problem scripting a HTML header request with netcat

I'm trying to play around with netcat to learn more about how HTTP works. I'd like to script some of it in bash or Perl, but I've hit upon a stumbling block early on in my testing. If I run netcat straight from the prompt and type in a HEAD request, it works and I receive the headers for the web server I'm probing. This works: [...

Netcat anomaly in VMWare/Cygwin/Sockets environment

I'm happily running Ubuntu Linux in a VMWare box hosted on XP. My Linux application opens up your basic server socket port, to which I connect netcat (nc) as a client to listen in on the traffic I'm putting on that socket for the "real" clients. All's well. However, when I open up a Cygwin shell on the XP side and run nc from there it ...

How to create a netcat relay on OS X ?

I'm trying to troubleshoot my postfix so I decided to route its traffic to my isp smtp relay trough a netcat relay: nc -l <someport> 0<backpipe | nc <isp-smtp> 26 | tee backpipe And I configured my postfix to connect to localhost:. But to get the netcat relay working it needs a FIFO pipe made with mknod backpipe p and apparently this...

How can I close a netcat connection after a certain character is returned in the response?

We have a very simple tcp messaging script that cats some text to a server port which returns and displays a response. The part of the script we care about looks something like this: cat someFile | netcat somehost 1234 The response the server returns is 'complete' once we get a certain character code (specifically &001C) returned. H...

Java sockets and TCP tuning

Hello, I try to develop a file transfer application in Java, with an applet as client, and a standalone java app as server (on a dedicated machine hosted in a datacenter). I use DataOutputStream/DataInputStream to transfers the data on both sides. When I send big volumes of data, the bandwith is very variable : all is okay first, then t...

how to escape hex values in netcat

Hi, i want to send the following via netcat: 99||0x00 (4 ascii characters and a zero) how is this done? im under windows xp. thank you ...

netcat "Connection refused" on localhost

I'm trying to get a value from a netcat connection started at a php file, but it dies with: localhost [127.0.0.1] 2000 (?) : Connection refused I don't know why but it works well if I ssh it as apache user (www-data), this is what I've done: 1) Start an endless loop serving a date with a little delay: $ (while true; do nc -l -p 2000...

How to get the PID of a process that is piped to another process in Bash?

Hi, I am trying to implement a simple log server in Bash. It should take a file as a parameter and serve it on a port with netcat. ( tail -f $1 & ) | nc -l -p 9977 But the problem is that when the netcat terminates, tail is left behind running. (Clarification: If I don't fork the tail process it will continue to run forever even the ...

Bash script to connect to open port, send request, read response

Hi, I have a service running on localhost:port. In a bash script I want to connect to this port, send a request, and read back the response - essentially automating a telnet session. What's the best way of doing this? Am looking at /dev/tcp, netcat or telnet/expect. Thanks ...

Netcat implementation in Python

I found this and am using it as my base, but it wasn't working right out of the box. My goal is also to treat it as a package instead of a command line utility, so my code changes will reflect that. class Netcat: def __init__(self, hostname, port): self.hostname = hostname self.port = port def send(self, content)...

How to use NetCat for Windows to send a binary file to a TCP connection?

If I want to transfer a binary file "binary.bin" (located in the same directory as NetCat) to IP address 127.0.0.1 port 1200 using TCP, how do I specify this using NetCat for windows? ...

"ssh example.com" hangs but "ssh example.com bash -i" does not

Hello, everyday I encounter a very strange phenomenon. From my university internet connection, sshing to my machine ("ssh example.com") works without any problems. From my home adsl, "ssh example.com" my console gets stuck with this message: debug1: Server accepts key: pkalg ssh-rsa blen 533 debug1: Enabling compression at level 6....

POP3 netcat protocol error

I tried to connect to my POP3 school server as part of my assignment. Now, I can connect to the server but the real problem is when I try to log in using the "USER" command. c:/>nc server.pop3.com 110 +OK Microsoft Exchange Server 2003 POP3 server version 6.5.7638.1 (server.pop3.com) ready. USER myuserid -ERR Protocol error Now I'm wo...

How do I send a Carriage Return with Windows Netcat?

I want to type directly into the Powershell prompt too, not pipe in a text file. Foo`r doesn't work for me. For example: echo "RJ`r`n" | .\nc.exe -u 192.168.1.247 2639 but what I'd really like to do is just .\nc.exe -u 192.168.1.247 2639 then start typing into the prompt. ...

How do I get netcat to accept connections from outside the LAN?

I'm using netcat as a backend to shovel data back and forth for a program I'm making. I tested my program on the local network, and once it worked I thought it would be a matter of simply forwarding a port from my router to have my program work over the internet. Alas! This seems not to be the case. If I start netcat listening on port 6...

Netcat / Apache solution to send data to PHP

Hi, I have this device that sends XML data to a webserver in format as follows POST HTTP/1.1 Content-Type:text/xml Content-Length:369 Followed by XML The problem here is that apache simply sends 400 error for this and does not work. Is there anyway to create netcat to read xml and send to php? Any other solution welcome! Is it better...

Capturing network traffic on Linux

Question: I have one Windows laptop, one Linux laptop and a wireless router. Now I want to "investigate" the hotmail/windows live protocol. What I want to do is route network traffic from the windows laptop via ethernet to the linux laptop, capture it on the Linux computer, forward it wirelessly to the router, receive the hotmail respon...

Compiling netcat on AIX

I have been trying to compile netcat.c on AIX for some time (using the command make aix), but the compiler gives me some weird feedback such as : "netcat.c", line 117.12: 1506-275 (S) Unexpected text 'int' encountered. when checked the file netcat.c at line 117, I would find the line (second line in code below): #ifdef HAVE_BIND exter...

Stream a continously growing file over tcp/ip

Hello, I have a project I'm working on, where a piece of Hardware is producing output that is continuously being written into a textfile. What I need to do is to stream that file as it's being written over a simple tcp/ip connection. I'm currently trying to that through simple netcat, but netcat only sends the part of the file that is ...