Home page logo

nmap-dev logo 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

David Fifield
Sent through the nmap-dev mailing list
Archived at http://seclists.org/nmap-dev/

  By Date           By Thread  

Current thread:
[ Nmap | Sec Tools | Mailing Lists | Site News | About/Contact | Advertising | Privacy ]