o Added --ip-options support for the connect() scan (-sT). [Kris]

This commit is contained in:
kris 2008-07-14 20:02:30 +00:00
parent ffb3d8202d
commit 299e0de19e
4 changed files with 16 additions and 0 deletions

View file

@ -58,6 +58,8 @@ o Nsock now supports binding to a local address and setting IPv4 options
o Nmap's Nsock-utilizing subsystems (DNS, NSE, version detection) have been
updated to support the -S and --ip-options flags. [Kris]
o Added --ip-options support for the connect() scan (-sT). [Kris]
Nmap 4.68 [2008-6-28]
o Doug integrated all of your version detection submissions and

View file

@ -2588,6 +2588,8 @@ static UltraProbe *sendConnectScanProbe(UltraScanInfo *USI, HostScanStats *hss,
unblock_socket(CP->sd);
init_socket(CP->sd);
set_ttl(CP->sd, o.ttl);
if (o.ipoptionslen)
set_ipoptions(CP->sd, o.ipoptions, o.ipoptionslen);
if (hss->target->TargetSockAddr(&sock, &socklen) != 0) {
fatal("Failed to get target socket address in %s", __func__);
}

View file

@ -161,6 +161,16 @@ setsockopt(sd, IPPROTO_IP, IP_HDRINCL, (const char *) &one, sizeof(one));
#endif
}
void set_ipoptions(int sd, void *opts, size_t optslen)
{
#ifdef IP_OPTIONS
if (sd == -1)
return;
setsockopt(sd, IPPROTO_IP, IP_OPTIONS, opts, optslen);
#endif
}
void set_ttl(int sd, int ttl)
{
#ifdef IP_TTL

View file

@ -663,6 +663,8 @@ pcap_if_t *getpcapinterfaces();
struct sys_route *getsysroutes(int *howmany);
void sethdrinclude(int sd);
void set_ipoptions(int sd, void *opts, size_t optslen);
void set_ttl(int sd, int ttl);
/* Fill buf (up to buflen -- truncate if necessary but always