1
0
mirror of https://github.com/nmap/nmap.git synced 2025-12-08 05:31:31 +00:00

Fix up some LGTM issues in ndiff. #1834

This commit is contained in:
dmiller
2019-12-29 20:05:05 +00:00
parent 33346f7651
commit 156cb98fd0
2 changed files with 3 additions and 6 deletions

View File

@@ -69,11 +69,8 @@ class Scan(object):
def load_from_file(self, filename):
"""Load a scan from the Nmap XML file with the given filename."""
f = open(filename, "r")
try:
with open(filename, "r") as f:
self.load(f)
finally:
f.close()
def write_nmaprun_open(self, writer):
attrs = {}
@@ -327,6 +324,8 @@ class Port(object):
def spec_string(self):
return u"%d/%s" % self.spec
__hash__ = None
def __cmp__(self, other):
d = cmp(self.spec, other.spec)
if d != 0:
@@ -560,7 +559,6 @@ class ScanDiff(object):
h_diff = HostDiff(host_a, host_b)
cost += h_diff.cost
if h_diff.cost > 0 or verbose:
host = host_a or host_b
self.output_host_diff(h_diff)
post_script_result_diffs = ScriptResultDiff.diff_lists(

View File

@@ -102,7 +102,6 @@ def repl_hostname(match):
def anonymize_file(f):
for line in f:
repls = []
line = re.sub(mac_re, repl_addr, line)
line = re.sub(ipv4_re, repl_addr, line)
line = re.sub(ipv6_re, repl_addr, line)