Home page logo
/

nmap-dev logo Nmap Development mailing list archives

Ndiff minor modification
From: Daniel Miller <bonsaiviking () gmail com>
Date: Fri, 28 Jan 2011 12:28:47 -0600

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.

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()

Thanks for a great tool!
Dan

--- builds/nmap/ndiff/ndiff        2010-05-13 14:45:58.217628240 -0500
+++ ndiff.py    2011-01-28 12:20:48.192515224 -0600
@@ -425,7 +425,7 @@
             print >> f, u" %s" % banner_a

         for host in self.hosts:
-            print
+            print >> f

             h_diff = self.host_diffs[host]
             h_diff.print_text(f)
_______________________________________________
Sent through the nmap-dev mailing list
http://cgi.insecure.org/mailman/listinfo/nmap-dev
Archived at http://seclists.org/nmap-dev/


  By Date           By Thread  

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