Home page logo
/

nmap-dev logo Nmap Development mailing list archives

Re: ncat - UNIX-domain sockets support
From: Tomas Hozza <thozza () redhat com>
Date: Sun, 11 Nov 2012 15:36:55 -0500 (EST)

Hi David.

Thank you for rebased patches.


One of the tests doesn't work in my tests:

PASS Server UNIX socket listen on ncat.unixsock (STREAM)
PASS Server UNIX socket listen on ncat.unixsock --udp (DGRAM)
FAIL Connect to UNIX datagram socket with -s
     Died at ./ncat-test.pl line 1279.

This is strange. When I run the test, it passes.

...
FAIL Connect through SOCKS4 proxy with -p
     Died at ./ncat-test.pl line 1260.
PASS Connect to UNIX datagram socket with -s
PASS HTTP proxy bad request
...

Maybe there is some issue with Perl.

My Perl:
This is perl 5, version 14, subversion 2 (v5.14.2) built for x86_64-linux-thread-multi

Copyright 1987-2011, Larry Wall

on Fedora 17 (3.6.3-1.fc17.x86_64)

I run these commands:
      ./ncat -l -U -k -vvv aaa
      ./ncat -U aaa -vvv
and I see these messages in the log:
      NCAT DEBUG: selecting, fdmax 3
      NCAT DEBUG: select returned 1 fds ready
      NCAT DEBUG: fd 3 is ready
      Ncat: Connection from .
      Ncat: Connection from .
      NCAT DEBUG: Added fd 4 to list, nfds 3, maxfd 4
      NCAT DEBUG: Added fd 4 to list, nfds 1, maxfd 4
      NCAT DEBUG: selecting, fdmax 4
I'm wondering why the client address is the empty string, and why
there

When using a STREAM UNIX domain socket to connect to a server, the client
doesn't create any socket (specified by a path) to be identified by, therefore
the client address is empty. The client doesn't create any socket, because
STREAM sockets are connection oriented (like TCP).
When using DATAGRAM UNIX sockets, things are different and the client
has to create a temporary socket to be able to receive messages from the
server.

are two "Connection from" messages after I've only made one
connection.

The message is doubled, because it is so also with IP sockets:
$ ./ncat -l -k -vvv
...
NCAT DEBUG: selecting, fdmax 4
NCAT DEBUG: select returned 1 fds ready
NCAT DEBUG: fd 4 is ready
Ncat: Connection from 127.0.0.1.
Ncat: Connection from 127.0.0.1:39645.
NCAT DEBUG: Added fd 5 to list, nfds 4, maxfd 5
NCAT DEBUG: Added fd 5 to list, nfds 1, maxfd 5
NCAT DEBUG: selecting, fdmax 5

I changed the output when using UNIX socket, so there is only
one message about incoming connection and without empty address.
 
Please resolve these warnings:
      ncat_main.c: In function ‘main’:
      ncat_main.c:707:8: warning: suggest explicit braces to avoid
      ambiguous ‘else’ [-Wparentheses]
      ncat_listen.c: In function ‘handle_connection’:
      ncat_listen.c:396:8: warning: suggest explicit braces to avoid
      ambiguous ‘else’ [-Wparentheses]
      util.c: In function ‘do_listen’:
      util.c:420:8: warning: suggest explicit braces to avoid ambiguous
      ‘else’ [-Wparentheses]
      util.c:433:8: warning: suggest explicit braces to avoid ambiguous
      ‘else’ [-Wparentheses]

I fixed this warnings.

Is it possible to use tempnam rather than mktemp, so that the TMPDIR
will be chosen automatically? I don't want to have "/tmp" hardcoded.

Path for temporary DATARAM socket is now generated using "tempnam".

The message you get when you fail to provide a socket name in listen
mode is confusing:
      $ ./ncat -l -U
      Ncat: You have to specify a socket to connect to. QUITTING.

These questions may be because I don't understand this type of socket
very well, so please explain if this is the case.

This message was really a mistake, it is fixed now.


Hope everything will be OK. If there is any other issue, please let
me know.

Thank you.

Regards,
Tomas Hozza

Attachment: 0001-Implementation-of-UNIX-domain-sockets-for-Nsock.patch
Description:

Attachment: 0002-Implementation-of-UNIX-domain-sockets-for-Ncat.patch
Description:

Attachment: 0003-Tests-for-UNIX-sockets-implementation-in-Ncat.patch
Description:

_______________________________________________
Sent through the nmap-dev mailing list
http://cgi.insecure.org/mailman/listinfo/nmap-dev
Archived at http://seclists.org/nmap-dev/

  By Date           By Thread  

Current thread:
[ Nmap | Sec Tools | Mailing Lists | Site News | About/Contact | Advertising | Privacy ]
AlienVault