77

I'm writing a TCP/IP client and I would need a "test server" to be able to test easily. It should listen on a configurable port, show me when a client connects, and what the client sent. It should allow me to manually enter text to send back to the client.

It should work on Windows.

Normally, I would have used the simple but powerful nc.exe (alias "Netcat" available on Unix and on Windows) but the antivirus software detects it as a "hacker tool", so my system administrator doesn't want me to use it at work.

Does anyone use another tool to test socket connections and is happy with it?

Matthias Braun
  • 32,039
  • 22
  • 142
  • 171
Name
  • 3,430
  • 4
  • 30
  • 34

6 Answers6

105

Hercules is fantastic. It's a fully functioning tcp/udp client/server, amazing for debugging sockets. More details on the web site.

patros
  • 7,719
  • 3
  • 28
  • 37
  • 1
    Good tool! It actually does exactly what I need and is listed on big freeware-sites (like CNET) so that the sysadmin shouldn't see it as a problem. The only small issue is the need to publish a link on the software for professional use (see the licence), but it is quite fair. – Name Feb 06 '09 at 10:56
  • 2
    Hercules is great. The only thing that has annoyed me a little is the length of the 'Send' text box. It can only accommodate 500 something characters. If the Send data to be tested it greater than that, then you need to do multiple sends. Unless there is another way of doing it that I am not aware of. – lucent Jun 08 '15 at 21:35
  • Link seems to be broken for me. But as mentioned it is listed on freeware pages. The commercial license is an "uhh" for a developer in a big company. – JackGrinningCat Apr 12 '18 at 10:01
  • Nice tool, unfortunately it misses features like simulation of error situations...like delayed SYN/ACK replies, etc. – Matthias Güntert Jul 11 '19 at 22:55
  • I would like to suggest scapy (https://scapy.net/) which is very, VERY, versatile... – Matthias Güntert Jul 11 '19 at 22:56
  • I have no affiliation to HWGroup. But I have been recommended two of their tools in two different occasions now. Both of them were really good tools. I find Hercules also in the same category. – C-- Sep 17 '20 at 17:23
  • 2
    I was going crazy trying to get Hercules to work. As it turns out, the Send button on the TCP Server does not automatically enter a line break \n at the end, so my TCP Client was waiting for the message indefinitely. For this, add to the end of your message. – OscarVanL Nov 03 '20 at 14:03
12

netcat (nc.exe) is the right tool. I have a feeling that any tool that does what you want it to do will have exactly the same problem with your antivirus software. Just flag this program as "OK" in your antivirus software (how you do this will depend on what type of antivirus software you use).

Of course you will also need to configure your sysadmin to accept that you're not trying to do anything illegal...

j_random_hacker
  • 50,331
  • 10
  • 105
  • 169
  • Well, netcat in bad hands could actually be used as an hacker tool, because you can easilly redirect the socket to a shell and use it as telnet server. If a tool would just display what it receives in a window, it couldn't be used so easilly as an hacker tool. – Name Feb 05 '09 at 10:47
  • Good point Name. You can remove this possibility by making sure that the only execute file permissions on nc.exe are for your Windows user. (I assume you are worried about an intruder compromising your machine, rather than your sysadmin worrying that YOU trying something sneaky!) – j_random_hacker Feb 05 '09 at 11:06
6

Try Wireshark or WebScarab second is better for interpolating data into the exchange (not sure Wireshark even can). Anyway, one of them should be able to help you out.

  • If his sysadmin is nagging him about netcat he's probably going to have fits about wireshark. – krosenvold Feb 05 '09 at 10:37
  • 1
    It doesn't seem to be exactly waht I'm looking for: WebScarac seems to be limited to HTTP. Wireshark seems to allow to capture the traffic but doesn't act as a test server, where I could input an answer for the client manually. – Name Feb 05 '09 at 10:54
  • I'm not sure but I think WebScarab has kind of grown bigger than it's orignal intended purpose. From how I've used it I think it could monitor any traffic sent through the port it's watching. Still all this stuff is a security concern. –  Feb 05 '09 at 11:03
  • There is also [SocketTester](https://gardinal.net/socket-tester) – Gardinal Apr 20 '23 at 11:42
4

I would go with netcat too , but since you can't use it , here is an alternative : netcat :). You can find netcat implemented in three languages ( python/ruby/perl ) . All you need to do is install the interpreters for the language you choose . Surely , that won't be viewed as a hacking tool .

Here are the links :

Perl implementation

Python implementation

Ruby Implementation

Geo
  • 93,257
  • 117
  • 344
  • 520
  • 1
    It would be quite ideal if it worked. I tested the 3 versions and got error messages with all. The perl version was at least partly usable. Could it be that those scripts were wrotten on Unix and have small difficulties on Windows? – Name Feb 06 '09 at 10:50
  • I'll try them and come back with a comment. Can you specify what were the arguments you ran the script with ? – Geo Feb 06 '09 at 10:56
  • One Server: -l -p 9988 And one client: -c -r localhost -p 9988 – Name Feb 06 '09 at 11:17
  • 1
    I tried to run the python script on linux , but it didn't work . – Geo Feb 06 '09 at 18:49
  • Bump. Has anyone gotten this to work yet? – byxor Nov 22 '16 at 19:45
2

In situations like this, why not write your own? A simple server app to test connections can be done in a matter of minutes if you know what you're doing, and you can make it respond exactly how you need to, and for specific scenarios.

David Anderson
  • 13,558
  • 5
  • 50
  • 76
  • 2
    Because you then have a client + a server to debug instead of just a client! And why write a software to do something that other software can already do really good? – Name Feb 06 '09 at 10:57
  • 1
    Because you will learn something in the process. – Aaron Hinni Feb 14 '09 at 22:04
2

Another tool is tcpmon. This is a java open-source tool to monitor a TCP connection. It's not directly a test server. It is placed in-between a client and a server but allow to see what is going through the "tube" and also to change what is going through.

Name
  • 3,430
  • 4
  • 30
  • 34