Nmap Development mailing list archives

Re: [PATCH] [Ncat] Fix EOF handling (server side)


From: Daniel Roethlisberger <daniel () roe ch>
Date: Sat, 2 May 2009 19:54:23 +0200

David Fifield <david () bamsoftware com> 2009-04-19:
So it's hard to pick a good default. The documentation at
http://nc110.sourceforge.net/ has not quitting on EOF as a feature:
  You may be asking "why not just use telnet to connect to
  arbitrary ports?" Valid question, and here are some reasons.
  Telnet has the "standard input EOF" problem, so one must
  introduce calculated delays in driving scripts to allow network
  output to finish.
Then there is a -w <secs> option to quit after some period of
inactivity.

I don't have experience with earliers Netcats so I don't know what's
best. I guess my bias would be to leave connections running by default,
and add a switch to close on stdin EOF, the reason being that in case of
user error it's better to receive extra data than to potentially throw
data away.

Current default behaviour actually seems to *loose* data on
SIGINT because of buffering.  I tried sending an odd number of
bytes to an Ncat listener piping into hexdump (hd).  The last few
bytes never made it to hexdump after pressing Ctrl+C.  Same thing
with other consumers such as tar.

I'll look into that. You're not at all obligated to do this, but it
would help if you could write a failing test for this in
test/ncat-test.pl. Then we can demonstrate when it's fixed and avoid
reintroducing it in the future.

ncat-test.pl gives me a lot of failed tests with r13157 already.
Is this expected or am I missing something?

PASS Server default listen address and port
PASS Server default port
PASS Server default listen address
PASS Connection persistence (TCP)
FAIL Connection persistence (UDP)
     Server got "", not "abc\n" at ./ncat-test.pl line 308.
FAIL --send-only client (TCP)
     Read timeout at ./ncat-test.pl line 322.
PASS --send-only client (UDP)
FAIL --send-only client (SSL)
     Read timeout at ./ncat-test.pl line 322.
PASS --send-only server (TCP)
PASS --send-only server (UDP)
FAIL --send-only server (SSL)
     Read timeout at ./ncat-test.pl line 340.
FAIL --send-only broker
     Read timeout at ./ncat-test.pl line 357.
PASS --recv-only client (TCP)
FAIL --recv-only client (SSL)
     Read timeout at ./ncat-test.pl line 380.
PASS --recv-only server (TCP)
PASS --recv-only server (UDP)
FAIL --recv-only server (SSL)
     Read timeout at ./ncat-test.pl line 390.
PASS --recv-only broker
PASS HTTP proxy bad request
PASS HTTP CONNECT no port number
FAIL HTTP CONNECT good request
     Expected response code 200, got 504 at ./ncat-test.pl line 452.
PASS HTTP CONNECT IPv6 address, no port number
PASS HTTP CONNECT IPv6 address, good request
FAIL HTTP CONNECT proxy relays
     Read timeout at ./ncat-test.pl line 485.
PASS HTTP CONNECT client hides proxy server response
FAIL HTTP CONNECT server doesn't consume anything after request
     Expected response code 200, got 504 at ./ncat-test.pl line 508.
PASS HTTP CONNECT overlong Request-Line
PASS HTTP CONNECT overlong header
FAIL HTTP GET hostname only
     Read timeout at ./ncat-test.pl line 541.
FAIL HTTP GET path only
     Read timeout at ./ncat-test.pl line 551.
FAIL HTTP GET absolute URI
     Read timeout at ./ncat-test.pl line 561.
FAIL HTTP GET absolute URI, no path
     Read timeout at ./ncat-test.pl line 570.
FAIL HTTP GET percent escape
     Read timeout at ./ncat-test.pl line 579.
FAIL HTTP GET remove Connection header fields
     Read timeout at ./ncat-test.pl line 588.
FAIL HTTP GET combine multiple headers with the same name
     Read timeout at ./ncat-test.pl line 601.
PASS HTTP GET request loop
PASS HTTP GET IPv6 request loop
FAIL HTTP HEAD absolute URI
     Read timeout at ./ncat-test.pl line 637.
FAIL HTTP POST
     Read timeout at ./ncat-test.pl line 647.
FAIL HTTP POST short Content-Length
     Read timeout at ./ncat-test.pl line 658.
FAIL HTTP POST long Content-Length
     Read timeout at ./ncat-test.pl line 669.
FAIL HTTP POST chunked transfer encoding
     Read timeout at ./ncat-test.pl line 688.
FAIL HTTP proxy unknown method
     Read timeout at ./ncat-test.pl line 700.
PASS HTTP proxy auth base64 encoding: ""
PASS HTTP proxy auth base64 encoding: "a"
PASS HTTP proxy auth base64 encoding: "a:"
PASS HTTP proxy auth base64 encoding: ":a"
PASS HTTP proxy auth base64 encoding: "user:sss"
PASS HTTP proxy auth base64 encoding: "user:ssss"
PASS HTTP proxy auth base64 encoding: "user:sssss"
PASS HTTP proxy auth base64 encoding: "user:~~~"
FAIL HTTP proxy auth base64 encoding: "user:~~~~"
     Read timeout at ./ncat-test.pl line 710.
PASS HTTP proxy auth base64 encoding: "user:~~~~~"
PASS HTTP proxy server auth challenge (TCP)
PASS HTTP proxy server auth challenge (SSL)
FAIL HTTP proxy server correct auth (TCP)
     Expected response code 200, got 504 at ./ncat-test.pl line 745.
FAIL HTTP proxy server correct auth (SSL)
     Expected response code 200, got 504 at ./ncat-test.pl line 745.
FAIL HTTP proxy server wrong user (TCP)
     Read timeout at ./ncat-test.pl line 755.
PASS HTTP proxy server wrong user (SSL)
PASS HTTP proxy server wrong pass (TCP)
PASS HTTP proxy server wrong pass (SSL)
FAIL HTTP proxy server correct auth, different case (TCP)
     Expected response code 200, got 504 at ./ncat-test.pl line 784.
FAIL HTTP proxy server correct auth, different case (SSL)
     Expected response code 200, got 504 at ./ncat-test.pl line 784.
FAIL HTTP proxy server LWS (TCP)
     Expected response code 200, got 504 at ./ncat-test.pl line 798.
FAIL HTTP proxy server LWS (SSL)
     Expected response code 200, got 504 at ./ncat-test.pl line 798.
FAIL HTTP proxy server LWS (TCP)
     Exected response code 200, got 504 at ./ncat-test.pl line 811.
FAIL HTTP proxy server LWS (SSL)
     Expected response code 200, got 504 at ./ncat-test.pl line 811.
PASS HTTP proxy server no auth (TCP)
PASS HTTP proxy server no auth (SSL)
PASS HTTP proxy server broken auth (TCP)
PASS HTTP proxy server broken auth (SSL)
PASS HTTP proxy server extra auth (TCP)
FAIL HTTP proxy server extra auth (SSL)
     Read timeout at ./ncat-test.pl line 847.
PASS Allow localhost (IPv4 address) (TCP)
PASS Allow localhost (IPv4 address) (UDP)
FAIL Allow localhost (IPv4 address) (SSL)
     Read timeout at ./ncat-test.pl line 861.
PASS Allow localhost (host name) (TCP)
PASS Allow localhost (host name) (UDP)
FAIL Allow localhost (host name) (SSL)
     Read timeout at ./ncat-test.pl line 871.
PASS Allow non-localhost (TCP)
PASS Allow non-localhost (UDP)
PASS Allow non-localhost (SSL)
PASS --allow options accumulate (TCP)
FAIL --allow options accumulate (UDP)
     Read timeout at ./ncat-test.pl line 892.
FAIL --allow options accumulate (SSL)
     Read timeout at ./ncat-test.pl line 892.
PASS Deny localhost (IPv4 address) (TCP)
PASS Deny localhost (IPv4 address) (UDP)
PASS Deny localhost (IPv4 address) (SSL)
PASS Deny localhost (host name) (TCP)
PASS Deny localhost (host name) (UDP)
PASS Deny localhost (host name) (SSL)
PASS Deny non-localhost (TCP)
PASS Deny non-localhost (UDP)
FAIL Deny non-localhost (SSL)
     Read timeout at ./ncat-test.pl line 921.
PASS --deny options accumulate (TCP)
PASS --deny options accumulate (UDP)
PASS --deny options accumulate (SSL)
PASS Allow and deny (TCP)
PASS Allow and deny (UDP)
PASS Allow and deny (SSL)
PASS --allowfile (TCP)
PASS --allowfile (UDP)
FAIL --allowfile (SSL)
     Read timeout at ./ncat-test.pl line 961.
PASS --denyfile (TCP)
PASS --denyfile (UDP)
PASS --denyfile (SSL)
FAIL --allowfile (TCP)
     Read timeout at ./ncat-test.pl line 961.
PASS --allowfile (UDP)

-- 
Daniel Roethlisberger
http://daniel.roe.ch/

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


Current thread: