Add new --no-shutdown option to Ncat. Closes #151, fixes #142

This commit is contained in:
dmiller 2015-11-10 21:07:30 +00:00
parent 37d517b32e
commit 1b4c4a9ef3
6 changed files with 21 additions and 1 deletions

View file

@ -1,5 +1,9 @@
# Nmap Changelog ($Id$); -*-text-*-
o [Ncat] [GH#151] [GH#142] New option --no-shutdown prevents Ncat from shutting
down when it reads EOF on stdin. This is the same as traditional netcat's
"-d" option. [Adam Saparona]
o [NSE] Added ip-https-discover for detecting support for Microsoft's IP over
HTTPS tunneling protocol. [Niklaus Schiess]

View file

@ -775,6 +775,19 @@
</listitem>
</varlistentry>
<varlistentry>
<term>
<option>--no-shutdown</option> (Do not shutdown into half-duplex mode)
<indexterm><primary><option>--no-shutdown</option> (Ncat option)</primary></indexterm>
</term>
<listitem>
<para>If this option is passed, Ncat will not invoke shutdown on a
socket aftering seeing EOF on stdin. This is provided for
backward-compatibility with OpenBSD netcat, which exhibits this
behavior when executed with its '-d' option.</para>
</listitem>
</varlistentry>
<varlistentry>
<term>
<option>-t</option>,

View file

@ -168,6 +168,7 @@ void options_init(void)
o.keepopen = 0;
o.sendonly = 0;
o.recvonly = 0;
o.noshutdown = 0;
o.telnet = 0;
o.linedelay = 0;
o.chat = 0;

View file

@ -161,6 +161,7 @@ struct options {
int keepopen;
int sendonly;
int recvonly;
int noshutdown;
int telnet;
int linedelay;
int chat;

View file

@ -393,7 +393,7 @@ static int ncat_listen_stream(int proto)
receiving anything, we can quit here. */
return 0;
}
shutdown_sockets(SHUT_WR);
if (!o.noshutdown) shutdown_sockets(SHUT_WR);
}
if (rc < 0)
return 1;

View file

@ -286,6 +286,7 @@ int main(int argc, char *argv[])
{"source-port", required_argument, NULL, 'p'},
{"source", required_argument, NULL, 's'},
{"send-only", no_argument, &o.sendonly, 1},
{"no-shutdown", no_argument, &o.noshutdown,1},
{"broker", no_argument, NULL, 0},
{"chat", no_argument, NULL, 0},
{"talk", no_argument, NULL, 0},