Nmap Development mailing list archives

Re: Updated DHCP scripts


From: David Fifield <david () bamsoftware com>
Date: Mon, 16 Aug 2010 10:20:05 -0600

On Sat, Aug 14, 2010 at 12:09:09AM -0500, Ron wrote:
Hey all,

I took some time this evening and abstracted most of the code from dhcp-discover.nse into a library. I was working on 
the "add targets" with DHCP this week, and realized that the DHCP code really needed to be put into a library. 

The attached patch shouldn't affect the behaviour/output of dhcp-discover.nse at all, besides some cleaned-up output 
and some other minor improvements, but the DHCP code now resides in a nselib and has a much cleaner interface. 

Let me know if you have any issues before I commit it! 

You need to make dhcp.lua into a proper module so it doesn't just store
everything globally. I think you just have to add the line

        module(... or "dhcp", package.seeall)

at the top. Then in the script you need to change everything like

        dhcp_make_request(host.ip, host.interface, request_type, "0.0.0.0", mac_addr)

to

        dhcp.dhcp_make_request(host.ip, host.interface, request_type, "0.0.0.0", mac_addr)

In fact, I would get rid of the "dhcp_" prefix on exported names,
because they will already be qualified by "dhcp.".

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: