Nmap Development mailing list archives

Re: Feature request: scanning an AS


From: David Fifield <david () bamsoftware com>
Date: Mon, 6 Feb 2012 00:21:58 -0800

On Wed, Sep 07, 2011 at 07:48:58PM +0200, John Bond wrote:

Okay, I think this is a nice script. Here are a few things I'd like to
see:

We should get permission from the operators of the whois server, like we
did for the asn-query script. We just don't want them to be mad if the
script being distributed with Nmap causes them a lot of extra load.
Would you email them and ask if they object to the script.
I have already emailed them and they are happy for us to use the
service, i can forward you the thread if needed.

The script needs to go into the "external" category.

I think this is unnecessary:
       newtargets = stdnse.get_script_args('asn-to-prefix.newtargets')
Just plain "newtarget" already sets target.ALLOW_NEW_TARGETS.
no problem

Instead of doing socket:receive_lines(1000000), do
socket:receive_lines(1) in a loop. That way you can limit how much you
will read and not stall forever if the server gives you a lot of data.
You still need to split on newlines because receive_lines(1) may return
more than one line.
Ok ill take a look at this in a bit

Sorry i just checked and think i updated this all ages ago but forgot
to send it in.  let me know if there is anything else that needs doing
and ill try to respond in less then 5 months

John, I've just committed this script. There are some funny whitespace
issues (blank lines) in the output sometimes. Can you check it out?

$ ./nmap --script=asn-to-prefix --script-args asn-to-prefix.asn=46749 -d

Starting Nmap 5.61TEST4 ( http://nmap.org ) at 2012-02-06 00:20 PST
PORTS: Using top 1000 ports found open (TCP:1000, UDP:0, SCTP:0)
--------------- Timing report ---------------
  hostgroups: min 1, max 100000
  rtt-timeouts: init 1000, min 100, max 10000
  max-scan-delay: TCP 1000, UDP 1000, SCTP 1000
  parallelism: min 0, max 0
  max-retries: 10, host-timeout: 0
  min-rate: 0, max-rate: 0
---------------------------------------------
NSE: Loaded 1 scripts for scanning.
NSE: Script Pre-scanning.
NSE: Starting runlevel 1 (of 1) scan.
NSE: Starting asn-to-prefix.
Initiating NSE at 00:20
NSE: Finished asn-to-prefix.
Completed NSE at 00:20, 0.09s elapsed
Pre-scan script results:
| asn-to-prefix:
|   46749
|     38.114.142.0/23
|
|     68.65.160.0/20
|_

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

Current thread: