Nmap Development mailing list archives
Re: Two NSE questions
From: Fyodor <fyodor () insecure org>
Date: Sat, 29 Aug 2009 22:57:22 -0700
On Sat, Aug 29, 2009 at 08:46:39PM -0500, Ron wrote:
First, I need to set my source port to UDP/68 for these transactions. I don't see any way to do that using the connect() function. I realize that UDP/68 is reserved so r00t is required, but -sU requires root anyways.
This is supported by Nsock, but there may not currently be an NSE binding for using this feature. Ncat supports this (try ncat -u -p 68 scanme.nmap.org). In Nsock, I think you basically just call this function: /* Sets the local address to bind to before connect() */ int nsi_set_localaddr(nsock_iod nsi, struct sockaddr_storage *ss, size_t sslen); The local address and/or port number can be specified in the sockaddr_storage. Here is how ncat does it: if (srcport != -1) { if (o.listen) bye("-l and -p are incompatible. Specify the address and port to bind to like you would a host to connect to."); if (srcaddr.storage.ss_family == AF_UNSPEC) srcaddr.storage.ss_family = o.af; if (o.af == AF_INET) { srcaddr.in.sin_port = htons((unsigned short) srcport); if (!srcaddrlen) srcaddrlen = sizeof(srcaddr.in); } #ifdef HAVE_IPV6 else { srcaddr.in6.sin6_port = htons((unsigned short) srcport); if (!srcaddrlen) srcaddrlen = sizeof(srcaddr.in6); } #endif } Cheers, -F _______________________________________________ Sent through the nmap-dev mailing list http://cgi.insecure.org/mailman/listinfo/nmap-dev Archived at http://SecLists.Org
Current thread:
- Two NSE questions Ron (Aug 29)
- Re: Two NSE questions Patrick Donnelly (Aug 29)
- Re: Two NSE questions Ron (Aug 29)
- Re: Two NSE questions Fyodor (Aug 29)
- Re: Two NSE questions Ron (Aug 31)
- Re: Two NSE questions David Fifield (Sep 01)
- Re: Two NSE questions Kris Katterjohn (Sep 01)
- Re: Two NSE questions Kris Katterjohn (Sep 01)
- Re: Two NSE questions David Fifield (Sep 29)
- Re: Two NSE questions Ron (Sep 29)
- Re: Two NSE questions David Fifield (Sep 30)
- Re: Two NSE questions Kris Katterjohn (Sep 30)
- Re: Two NSE questions Ron (Aug 31)
- Re: Two NSE questions Patrick Donnelly (Aug 29)