Chat server

First way

Type in some text and the line will appear on the other machine when you press enter. You won’t be able to see who wrote what, but hey, it’s good enough if you want to communicate with someone.

Second way

The new fancier way of starting a chat-server is by using –chat:

1

ncat--chat-l10100

Users who then want to connect to the chat:

1

ncat<server>10100

The output will be something along the lines of:

1

2

<user0>Hello?

<user5>Isit me you're looking for?

The user IDs generated by ncat are based on the file descriptor for each connection and must be considered arbitrary. Also, you won’t see <userX> in front of the text you type, but others will see it. The main difference when using –chat is that you and every user connected to the server will get a <userX> tag, making it easier to see who wrote what.

Mail client

ncat also works as a mail client. Expect to type a lot:

1

ncat-Cmail.example.com25

..followed up by typing:

1

2

3

4

5

6

7

8

9

10

11

12

13

14

15

16

17

18

220mail.example.com ESMTP

HELO client.example.com

250mail.example.com Hello client.example.com

MAIL FROM:a@example.com

250OK

RCPT TO:b@example.com

250Accepted

DATA

354Enter message,ending with"."onaline by itself

From:a@example.com

To:b@example.com

Subject:Greetings from ncat

Thisshortmessage isbrought toyou by ncat.

.

250OK

QUIT

221mail.example.com closing connection

TCP/UDP daytime server

The daytime service, defined in RFC 867, sends a human-readable date and time string over TCP or UDP port 13. It ignores any input. So, we can use:

1

ncat-l13--keep-open--send-only--exec"/bin/date"

Add –udp to create an UDP daytime server instead.

Access control

Allow one host, deny others

1

ncat-l--allow10.0.0.2

Deny one host, allow others

1

ncat-l--deny10.0.0.2

Allow or deny hosts from file

1

ncat-l--allowfile trusted-hosts.txt

Replace –allowfile with –denyfile to deny and trusted-hosts.txt with a file that contains the hosts to be denied.

These are just a few of the things that you can do with ncat. Have fun exploring the rest!