Nmap Development mailing list archives

Re: [Zenmap] Slow "Open" for large files


From: Daniel Miller <bonsaiviking () gmail com>
Date: Mon, 9 Jun 2014 07:13:40 -0500

Jay,

I'm in favor of your speedup patch. For now, Nmap's output is always ASCII,
and if we decide to change that in the future, we'll probably have to have
a fallback to ASCII-only output anyway, so this code can stand.

Just a nitpick, but I would prefer to see the StringIO class (not module)
imported like so:

try:
    from cStringIO import StringIO
except ImportError:
    from StringIO import StringIO

Thereafter, use simply StringIO() instead of StringIO.StringIO(). Otherwise
it *looks* like we're always explicitly using the plain StringIO and never
cStringIO.

Dan


On Mon, Jun 9, 2014 at 6:21 AM, Jay Bosamiya <jaybosamiya () gmail com> wrote:

 Jacek,

There are some differences however [1].

"Unlike the StringIO module, this module is not able to accept Unicode
strings that cannot be encoded as plain ASCII strings."
AFAIK, I don't think we have a problem with Unicode that cannot be encoded
as plain ASCII.

"Another difference from the StringIO module is that calling StringIO()
with a string parameter creates a read-only object. Unlike an object
created without a string parameter, it does not have write methods."
This is the line that made me rethink. If you notice the last part in the
patch [2], then I had to modify the code to take care of this (only because
of cStringIO; the older one works fine with StringIO).

Cheers,
Jay

Links:
[1] https://docs.python.org/2/library/stringio.html#module-cStringIO
[2]
http://seclists.org/nmap-dev/2014/q2/att-440/speedUpOpen_followup.patch


On Monday 09 June 2014 04:28 PM, Jacek Wielemborek wrote:
Why not? The interface is the same, so it's like five lines of
code importing it and falling back to StringIO if it's not there.
IMHO definitely worth doing.

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


Current thread: