Nmap Development mailing list archives

Re: Ndiff minor modification


From: David Fifield <david () bamsoftware com>
Date: Fri, 28 Jan 2011 13:21:52 -0800

On Fri, Jan 28, 2011 at 12:28:47PM -0600, Daniel Miller wrote:
In ScanDiff.print_text, the kwarg f is used to define a file-like
object to print to. One print statement escaped, however, and will
print to sys.stdout no matter what. Patch below fixes this issue.

Thanks, applied.

As a side note, here was my workaround for getting the text output
into a variable:
class FileVar(object):
    string = u''
    def write(self, line):
        self.string += line
    def readall(self):
        return self.string

out = FileVar()
ndiff.ScanDiff(scan_a, scan_b).print_text( f=out )
text = out.readall()

There's a built-in Python module that does that; see StringIO or
cStringIO.

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: