mirror of
https://github.com/nmap/nmap.git
synced 2025-12-08 21:51:28 +00:00
Fix up some LGTM issues in ndiff. #1834
This commit is contained in:
@@ -69,11 +69,8 @@ class Scan(object):
|
|||||||
|
|
||||||
def load_from_file(self, filename):
|
def load_from_file(self, filename):
|
||||||
"""Load a scan from the Nmap XML file with the given filename."""
|
"""Load a scan from the Nmap XML file with the given filename."""
|
||||||
f = open(filename, "r")
|
with open(filename, "r") as f:
|
||||||
try:
|
|
||||||
self.load(f)
|
self.load(f)
|
||||||
finally:
|
|
||||||
f.close()
|
|
||||||
|
|
||||||
def write_nmaprun_open(self, writer):
|
def write_nmaprun_open(self, writer):
|
||||||
attrs = {}
|
attrs = {}
|
||||||
@@ -327,6 +324,8 @@ class Port(object):
|
|||||||
def spec_string(self):
|
def spec_string(self):
|
||||||
return u"%d/%s" % self.spec
|
return u"%d/%s" % self.spec
|
||||||
|
|
||||||
|
__hash__ = None
|
||||||
|
|
||||||
def __cmp__(self, other):
|
def __cmp__(self, other):
|
||||||
d = cmp(self.spec, other.spec)
|
d = cmp(self.spec, other.spec)
|
||||||
if d != 0:
|
if d != 0:
|
||||||
@@ -560,7 +559,6 @@ class ScanDiff(object):
|
|||||||
h_diff = HostDiff(host_a, host_b)
|
h_diff = HostDiff(host_a, host_b)
|
||||||
cost += h_diff.cost
|
cost += h_diff.cost
|
||||||
if h_diff.cost > 0 or verbose:
|
if h_diff.cost > 0 or verbose:
|
||||||
host = host_a or host_b
|
|
||||||
self.output_host_diff(h_diff)
|
self.output_host_diff(h_diff)
|
||||||
|
|
||||||
post_script_result_diffs = ScriptResultDiff.diff_lists(
|
post_script_result_diffs = ScriptResultDiff.diff_lists(
|
||||||
|
|||||||
@@ -102,7 +102,6 @@ def repl_hostname(match):
|
|||||||
|
|
||||||
def anonymize_file(f):
|
def anonymize_file(f):
|
||||||
for line in f:
|
for line in f:
|
||||||
repls = []
|
|
||||||
line = re.sub(mac_re, repl_addr, line)
|
line = re.sub(mac_re, repl_addr, line)
|
||||||
line = re.sub(ipv4_re, repl_addr, line)
|
line = re.sub(ipv4_re, repl_addr, line)
|
||||||
line = re.sub(ipv6_re, repl_addr, line)
|
line = re.sub(ipv6_re, repl_addr, line)
|
||||||
|
|||||||
Reference in New Issue
Block a user