Nmap Development mailing list archives

Re: [patch][Ndiff] Make Ndiff install as a library as well as a script


From: Fyodor <fyodor () nmap org>
Date: Fri, 11 Apr 2014 14:49:31 -0700

On Mon, Oct 14, 2013 at 9:04 PM, Daniel Miller <bonsaiviking () gmail com>wrote:


Yes, nmap/ndiff/ndiff would be renamed to nmap/ndiff/ndiff.py. I
didn't include that in the diff to keep the size down (since the diff
was treating it as a delete-and-new-file).


Having Ndiff accessible as a module sounds handy, but I'm a bit concerned
(and yes, I should have mentioned this months ago) that this rename could
cause problems for existing ndiff users.  In particular:

1) If they're calling ndiff from cron or some other script, they'll have to
change it
2) If they're used to just calling 'ndiff' (or if they find an ndiff
command in the Nmap book or on the Internet) they'll need to figure out
what the problem is and issue the new command.

Breaking the compatibility might be OK if the new name was better, but I
don't think adding .py to the end makes things easier for anyone.  And it
sort of hard codes an implementation detail which would be problematic if
we ever change the language ndiff is written in.  And we have changed
ndiff's implementation language in the past.

Is .py required for Python scripts to use modules like this?  If we need to
keep the .py version, maybe we'll just need an simple 'ndiff' shell script
which just calls ndiff.py with whatever arguments it is given.  What do you
think?  I guess this only affects Linux and probably Mac, since we make an
ndiff.exe on Windows.

I want to do an Nmap 6.45 release with the Hearbleed fix, but want to
resolve the ndiff issue first.

Cheers,
Fyodor







o Your patch creates nmap/ndiff/scripts/ndiff, which is only five lines
of
code.  So this would become the command line script people would call to
use
ndiff, and it basically relies on the newly renamed ndiff.py library to
do
all of its work?

Yes, the new script is basically a duplicate of the if
__name__=="__main__" section of the original Ndiff.


o  On Windows of course we use py2exe to create an executable ndiff.exe.
 I
assume this still works with your changes?

I didn't check this, but I don't see why it wouldn't work. I will look
at the Makefiles (and/or other build directives) to be sure that the
name change is propagated throughout. Please expect another patch in a
couple days if I find anything that needs to be changed.


Thanks,
Fyodor



Thanks for the feedback!

Dan

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


Current thread: