Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Linux tool to send raw data to a TCP server

Tags:

linux

tcp

I am aware that this is not a direct 'development' question but I need this info to test a development project, so I think someone could've hit similar problem.

I will test a software that runs a TCP server and according to sent commands replies some answers. I will test the software and do not want to write code if it doesn't work well. So I want to send those commands and test drive the server software.

How can I achieve this with a Linux box?

like image 694
paul simmons Avatar asked Jun 09 '10 22:06

paul simmons


People also ask

How do you transfer data to TCP ports?

The TCP Open Connection node opens a connection to the server at the port and address you specify. The address must match the IP address of the server, and the port you specify on the client must match the port you specify on the server. TCP Write nodes write data to the specified port and send commands to the server.

Does PuTTY use TCP?

Resolution. The PuTTY TCP/UDP should be configured as: Ports: 22. Protocol: TCP.


2 Answers

From bash with dd:

dd if=/dev/zero bs=9000 count=1000 > /dev/tcp/$target_host/$port 

or even with cat:

cat < /dev/urandom > /dev/tcp/$target_host/$port 
like image 81
Dummy00001 Avatar answered Sep 21 '22 08:09

Dummy00001


netcat or telnet, i have used both in the past to test simple text based protocols. netcat is more flexible.

like image 24
luke Avatar answered Sep 23 '22 08:09

luke