Nmap Development mailing list archives
Re: [NSE] get Nmap interfaces
From: Kris Katterjohn <katterjohn () gmail com>
Date: Thu, 30 Sep 2010 01:47:52 -0500
-----BEGIN PGP SIGNED MESSAGE----- Hash: SHA1 On 09/29/2010 03:06 PM, David Fifield wrote:
On Thu, Sep 16, 2010 at 06:34:09PM +0100, Djalal Harouni wrote:* get_iface(): This is for the pre-scanning phase scripts, it will return the interface name that Nmap should use. This function can be combined with the results of get_interfaces() to determine the current IP address, the hardware type and the broadcast address of the interface.
<snip>
I think that your patch is good, I just want to make sure the programming interface is a good as possible. This implementation creates a brand new interface table from scratch each that nmap.get_interfaces is called. Another option would be to generate the table once, and after that to return a reference to it. Another idea is to have one function that returns a list of interface names (strings only), and another function to return an interface table given a name. A further variation would be to return the interfaces in a table indexed by name, instead of an array indexed by number. Would you comment on the benefits and drawbacks of these representations? Which is the best programming interface in your opinion?
Judging by the patch (I haven't tested yet), it looks like if o.device isn't set, then get_iface() will return "". I think nil is more appropriate (an empty string does us no good, and returning nil is consistent with how host.interface behaves). Actually, upon glancing at the NSEdoc for the function, it appears nil is the documented return value for this case but isn't implemented correctly. So I guess this is a bug report rather than a suggestion :)
David Fifield
Cheers, Kris Katterjohn -----BEGIN PGP SIGNATURE----- Version: GnuPG v1.4.10 (GNU/Linux) Comment: Using GnuPG with Mozilla - http://enigmail.mozdev.org/ iQIcBAEBAgAGBQJMpDKYAAoJEEQxgFs5kUfulIEP/0YP8kce3Smp1uKd67wD6LvT IimrPyzbQEguGNEpEA69k5vr0A7UZXjjCTDMqKEDfMC7tRvgKSGc83A0mdbhos/1 YVeOGApKJwf62joOrOBgWpGvKVhk7W1Fgx3W+LVjwP8Qm7d8qoMxPEiMRxU44f2C k0Z7fUYgh1zTM3ZF+7n7ApucmGYpWY7TBOZWrY/ErUxmKaJt8SHNFe8xinE7cFKh wkQE/0J/zvLPYB5nwUhtOKBUwjGyTZ5gdeFEXv2e+zrFKzAxkjl+CEsYs85T2hur 4H5pGWLnn0EguvE8ZkFn/kr9za4CDWi8Slc/T9f2QZrL9w5r+n3ij2e2OESyBUX+ 3D2h7XbokksKxdQIFv9FZQ00y9+2xP4q+VxUHshvnenGElKCruI1iiI237Wx+P39 3mOFfyKW8M3jkg32xP/A630104XT90jNgFVMUE8+B3AtWcJ0tSM/Ri/LBJMaDAp9 fao2vLaJXG9CntRCif9W9WlIwuQ8eBCnCZxNE5H2UE0jlof64/wZGPgY7othQ6+J s5H0V2EDFIcxXCWrQS8rznXpSMBE3kJY8lzvevrxaRB31mniLS123DyAjghEKRQw pda2v0e51iP8x/KQJ07RtN6mFHOW6Uft18B4C43oymJ9JplbHHvYs5ghq2FGcyJz qpt5Xbb5uGOKfVGXAGj0 =n1ZH -----END PGP SIGNATURE----- _______________________________________________ Sent through the nmap-dev mailing list http://cgi.insecure.org/mailman/listinfo/nmap-dev Archived at http://seclists.org/nmap-dev/
Current thread:
- [NSE] get Nmap interfaces Djalal Harouni (Sep 16)
- Re: [NSE] get Nmap interfaces David Fifield (Sep 29)
- Re: [NSE] get Nmap interfaces Kris Katterjohn (Sep 29)
- Re: [NSE] get Nmap interfaces David Fifield (Sep 29)