mirror of
https://github.com/nmap/nmap.git
synced 2025-12-06 12:41:29 +00:00
Fix pep8 errors in all of zenmap
This commit is contained in:
@@ -133,12 +133,12 @@ PORTS_HEADER = [
|
||||
_('Port'), _('Protocol'), _('State'), _('Service'), _('Method')]
|
||||
EXTRAPORTS_HEADER = [_('Count'), _('State'), _('Reasons')]
|
||||
|
||||
SERVICE_COLORS = {'open': '#ffd5d5',
|
||||
'closed': '#d5ffd5',
|
||||
'filtered': '#ffffd5',
|
||||
'unfiltered': '#ffd5d5',
|
||||
'open|filtered': '#ffd5d5',
|
||||
'closed|filtered': '#d5ffd5'}
|
||||
SERVICE_COLORS = {'open': '#ffd5d5', # noqa
|
||||
'closed': '#d5ffd5', # noqa
|
||||
'filtered': '#ffffd5', # noqa
|
||||
'unfiltered': '#ffd5d5', # noqa
|
||||
'open|filtered': '#ffd5d5', # noqa
|
||||
'closed|filtered': '#d5ffd5'} # noqa
|
||||
UNKNOWN_SERVICE_COLOR = '#d5d5d5'
|
||||
|
||||
TRACE_HEADER = [_('TTL'), _('RTT'), _('IP'), _('Hostname')]
|
||||
@@ -148,8 +148,8 @@ TRACE_TEXT = _(
|
||||
|
||||
NO_TRACE_TEXT = _("No traceroute information available.")
|
||||
|
||||
HOP_COLOR = {'known': '#ffffff',
|
||||
'unknown': '#cccccc'}
|
||||
HOP_COLOR = {'known': '#ffffff', # noqa
|
||||
'unknown': '#cccccc'} # noqa
|
||||
|
||||
SYSTEM_ADDRESS_TEXT = "[%s] %s"
|
||||
|
||||
|
||||
@@ -184,6 +184,7 @@ def find_hop_by_ttl(hops, ttl):
|
||||
return h
|
||||
return None
|
||||
|
||||
|
||||
def make_graph_from_hosts(hosts):
|
||||
#hosts = parser.get_root().search_children('host', deep=True)
|
||||
graph = Graph()
|
||||
@@ -249,9 +250,9 @@ def make_graph_from_hosts(hosts):
|
||||
else:
|
||||
graph.set_connection(node, prev_node)
|
||||
else:
|
||||
# Add an "anonymous" node only if there isn't already a node
|
||||
# equivalent to it (i.e. at same distance from the previous
|
||||
# "real" node)
|
||||
# Add an "anonymous" node only if there isn't already a
|
||||
# node equivalent to it (i.e. at same distance from the
|
||||
# previous "real" node)
|
||||
|
||||
pre_hop = None
|
||||
pre_hop_distance = 0
|
||||
@@ -269,16 +270,19 @@ def make_graph_from_hosts(hosts):
|
||||
post_hop_distance = i
|
||||
break
|
||||
|
||||
assert pre_hop is not None, "pre_hop should have become localhost if nothing else"
|
||||
assert pre_hop is not None, \
|
||||
"pre_hop should have become localhost if nothing else" # noqa
|
||||
|
||||
ancestor_key = (pre_hop["ipaddr"], pre_hop_distance)
|
||||
descendant_key = None
|
||||
if post_hop is not None:
|
||||
descendant_key = (post_hop["ipaddr"], post_hop_distance)
|
||||
descendant_key = \
|
||||
(post_hop["ipaddr"], post_hop_distance)
|
||||
|
||||
if ancestor_key in ancestor_node_cache:
|
||||
node = ancestor_node_cache[ancestor_key]
|
||||
elif descendant_key is not None and descendant_key in descendant_node_cache:
|
||||
elif (descendant_key is not None and
|
||||
descendant_key in descendant_node_cache):
|
||||
node = descendant_node_cache[descendant_key]
|
||||
graph.set_connection(node, prev_node)
|
||||
else:
|
||||
@@ -286,7 +290,8 @@ def make_graph_from_hosts(hosts):
|
||||
nodes.append(node)
|
||||
|
||||
node.set_draw_info({"valid": False})
|
||||
node.set_draw_info({"color":(1,1,1), "radius":NONE_RADIUS})
|
||||
node.set_draw_info(
|
||||
{"color": (1, 1, 1), "radius": NONE_RADIUS})
|
||||
|
||||
graph.set_connection(node, prev_node)
|
||||
|
||||
|
||||
@@ -381,15 +381,15 @@ for dir in dirs:
|
||||
continue
|
||||
|
||||
if os.path.isdir(output):
|
||||
os.chmod(output, S_IRWXU | \
|
||||
S_IRGRP | \
|
||||
S_IXGRP | \
|
||||
S_IROTH | \
|
||||
os.chmod(output, S_IRWXU |
|
||||
S_IRGRP |
|
||||
S_IXGRP |
|
||||
S_IROTH |
|
||||
S_IXOTH)
|
||||
else:
|
||||
os.chmod(output, S_IRUSR | \
|
||||
S_IWUSR | \
|
||||
S_IRGRP | \
|
||||
os.chmod(output, S_IRUSR |
|
||||
S_IWUSR |
|
||||
S_IRGRP |
|
||||
S_IROTH)
|
||||
|
||||
def fix_paths(self):
|
||||
|
||||
@@ -15,15 +15,18 @@ import xml.sax
|
||||
|
||||
directory = None
|
||||
|
||||
|
||||
def escape(s):
|
||||
return '"' + s.encode("UTF-8").replace('"', '\\"') + '"'
|
||||
|
||||
|
||||
def output_msgid(msgid, locator):
|
||||
print
|
||||
print u"#: %s:%d" % (locator.getSystemId(), locator.getLineNumber())
|
||||
print u"msgid", escape(msgid)
|
||||
print u"msgstr", escape(u"")
|
||||
|
||||
|
||||
class Handler (xml.sax.handler.ContentHandler):
|
||||
def setDocumentLocator(self, locator):
|
||||
self.locator = locator
|
||||
|
||||
@@ -7,7 +7,7 @@ if __name__ == "__main__":
|
||||
import glob
|
||||
import os
|
||||
if not hasattr(unittest.defaultTestLoader, "discover"):
|
||||
print("Python unittest discovery missing. Requires Python 2.7 or newer.")
|
||||
print("Python unittest discovery missing. Requires Python 2.7 or newer.") # noqa
|
||||
sys.exit(0)
|
||||
|
||||
os.chdir("..")
|
||||
|
||||
@@ -256,7 +256,8 @@ class NetworkInventory(object):
|
||||
#remove ports which are no longer up
|
||||
if old_date < new_date:
|
||||
for defunct_port in old_list:
|
||||
#Check if defunct_port is in ports and that the protocol matches
|
||||
# Check if defunct_port is in ports
|
||||
# and that the protocol matches
|
||||
port_number = int(defunct_port['portid'])
|
||||
if port_number in ports:
|
||||
if defunct_port['protocol'] in ports[port_number]:
|
||||
@@ -520,9 +521,9 @@ class FilteredNetworkInventory(NetworkInventory):
|
||||
return len(self.network_inventory.hosts)
|
||||
|
||||
def match_keyword(self, host, keyword):
|
||||
return self.match_os(host, keyword) or\
|
||||
self.match_target(host, keyword) or\
|
||||
self.match_service(host, keyword)
|
||||
return (self.match_os(host, keyword) or
|
||||
self.match_target(host, keyword) or
|
||||
self.match_service(host, keyword))
|
||||
|
||||
def match_target(self, host, name):
|
||||
return HostSearch.match_target(host, name)
|
||||
@@ -663,8 +664,8 @@ class FilteredNetworkInventoryTest(unittest.TestCase):
|
||||
|
||||
class PortChangeTest(unittest.TestCase):
|
||||
def test_port(self):
|
||||
"""Verify that the port status (open/filtered/closed) is displayed """ \
|
||||
"""correctly when the port status changes in newer scans"""
|
||||
"""Verify that the port status (open/filtered/closed) is displayed
|
||||
correctly when the port status changes in newer scans"""
|
||||
from zenmapCore.NmapParser import NmapParser
|
||||
inv = NetworkInventory()
|
||||
scan1 = NmapParser()
|
||||
|
||||
@@ -261,10 +261,11 @@ class NmapCommand(object):
|
||||
os.kill(self.command_process.pid, SIGTERM)
|
||||
for i in range(10):
|
||||
sleep(0.5)
|
||||
if self.command_process.poll() is not None: # Process has been TERMinated
|
||||
if self.command_process.poll() is not None:
|
||||
# Process has been TERMinated
|
||||
break
|
||||
else:
|
||||
log.debug(">>> SIGTERM has not worked even after waiting for 5 seconds. Using SIGKILL.")
|
||||
log.debug(">>> SIGTERM has not worked even after waiting for 5 seconds. Using SIGKILL.") # noqa
|
||||
os.kill(self.command_process.pid, SIGKILL)
|
||||
self.command_process.wait()
|
||||
except:
|
||||
|
||||
@@ -552,7 +552,7 @@ class NmapOptions(object):
|
||||
opt, arg = result
|
||||
if opt in ("6", "A", "F", "h", "n", "R", "r", "V"):
|
||||
self["-" + opt] = True
|
||||
elif opt in (\
|
||||
elif opt in (
|
||||
"allports",
|
||||
"append-output",
|
||||
"badsum",
|
||||
@@ -591,7 +591,7 @@ class NmapOptions(object):
|
||||
self["-" + opt] = arg
|
||||
else:
|
||||
self.extras.extend(("-" + opt, arg))
|
||||
elif opt in (\
|
||||
elif opt in (
|
||||
"datadir",
|
||||
"data-length",
|
||||
"dns-servers",
|
||||
@@ -796,7 +796,8 @@ class NmapOptions(object):
|
||||
|
||||
for opt in ("--min-hostgroup", "--max-hostgroup",
|
||||
"--min-parallelism", "--max-parallelism",
|
||||
"--min-rtt-timeout", "--max-rtt-timeout", "--initial-rtt-timeout",
|
||||
"--min-rtt-timeout", "--max-rtt-timeout",
|
||||
"--initial-rtt-timeout",
|
||||
"--scan-delay", "--max-scan-delay",
|
||||
"--min-rate", "--max-rate",
|
||||
"--max-retries", "--max-os-tries", "--host-timeout"):
|
||||
@@ -815,7 +816,7 @@ class NmapOptions(object):
|
||||
elif self["-PB"]:
|
||||
opt_list.append("-PB")
|
||||
|
||||
for opt in (\
|
||||
for opt in (
|
||||
"--allports",
|
||||
"--append-output",
|
||||
"--badsum",
|
||||
@@ -851,7 +852,7 @@ class NmapOptions(object):
|
||||
if self[opt]:
|
||||
opt_list.append(opt)
|
||||
|
||||
for opt in (\
|
||||
for opt in (
|
||||
"-b",
|
||||
"-D",
|
||||
"--datadir",
|
||||
|
||||
@@ -133,14 +133,15 @@ class RecentScans(object):
|
||||
except:
|
||||
self.recent_scans_file = False
|
||||
|
||||
if self.recent_scans_file and \
|
||||
(access(self.recent_scans_file, R_OK and W_OK) or \
|
||||
access(dirname(self.recent_scans_file), R_OK and W_OK)):
|
||||
if (self.recent_scans_file and
|
||||
(access(self.recent_scans_file, R_OK and W_OK) or
|
||||
access(dirname(self.recent_scans_file), R_OK and W_OK))):
|
||||
self.using_file = True
|
||||
|
||||
# Recovering saved targets
|
||||
recent_file = open(self.recent_scans_file, "r")
|
||||
self.temp_list = [t for t in recent_file.read().split(";") \
|
||||
self.temp_list = [
|
||||
t for t in recent_file.read().split(";")
|
||||
if t != "" and t != "\n"]
|
||||
recent_file.close()
|
||||
else:
|
||||
|
||||
@@ -278,10 +278,8 @@ class SearchResult(object):
|
||||
log.debug("Comparing: %s == %s ??" % (
|
||||
str(self.parsed_scan.profile_name).lower(),
|
||||
"*%s*" % profile.lower()))
|
||||
if profile == "*" or profile == "" or \
|
||||
profile.lower() in str(self.parsed_scan.profile_name).lower():
|
||||
return True
|
||||
return False
|
||||
return (profile == "*" or profile == "" or
|
||||
profile.lower() in str(self.parsed_scan.profile_name).lower())
|
||||
|
||||
def match_option(self, option):
|
||||
log.debug("Match option: %s" % option)
|
||||
@@ -535,9 +533,9 @@ class SearchDir(SearchResult, object):
|
||||
log.debug(">>> SearchDir initialized")
|
||||
self.search_directory = search_directory
|
||||
|
||||
if type(file_extensions) in StringTypes:
|
||||
if isinstance(file_extensions, StringTypes):
|
||||
self.file_extensions = file_extensions.split(";")
|
||||
elif type(file_extensions) == type([]):
|
||||
elif isinstance(file_extensions, list):
|
||||
self.file_extensions = file_extensions
|
||||
else:
|
||||
raise Exception(
|
||||
|
||||
@@ -134,14 +134,15 @@ class TargetList(object):
|
||||
self.target_list_file = False
|
||||
|
||||
#import pdb; pdb.set_trace()
|
||||
if self.target_list_file and \
|
||||
(access(self.target_list_file, R_OK and W_OK) or \
|
||||
access(dirname(self.target_list_file), R_OK and W_OK)):
|
||||
if (self.target_list_file and
|
||||
(access(self.target_list_file, R_OK and W_OK) or
|
||||
access(dirname(self.target_list_file), R_OK and W_OK))):
|
||||
self.using_file = True
|
||||
|
||||
# Recovering saved targets
|
||||
target_file = open(self.target_list_file, "r")
|
||||
self.temp_list = [t for t in target_file.read().split(";") \
|
||||
self.temp_list = [
|
||||
t for t in target_file.read().split(";")
|
||||
if t != "" and t != "\n"]
|
||||
target_file.close()
|
||||
else:
|
||||
|
||||
@@ -173,7 +173,7 @@ class SearchConfig(UmitConfigParser, object):
|
||||
config_parser.set(self.section_name, p_name, value)
|
||||
|
||||
def boolean_sanity(self, attr):
|
||||
if attr == True or \
|
||||
if attr is True or \
|
||||
attr == "True" or \
|
||||
attr == "true" or \
|
||||
attr == "1":
|
||||
@@ -192,18 +192,18 @@ class SearchConfig(UmitConfigParser, object):
|
||||
return self._get_it("file_extension", "xml").split(";")
|
||||
|
||||
def set_file_extension(self, file_extension):
|
||||
if type(file_extension) == type([]):
|
||||
if isinstance(file_extension, list):
|
||||
self._set_it("file_extension", ";".join(file_extension))
|
||||
elif type(file_extension) in StringTypes:
|
||||
elif isinstance(file_extension, StringTypes):
|
||||
self._set_it("file_extension", file_extension)
|
||||
|
||||
def get_save_time(self):
|
||||
return self._get_it("save_time", "60;days").split(";")
|
||||
|
||||
def set_save_time(self, save_time):
|
||||
if type(save_time) == type([]):
|
||||
if isinstance(save_time, list):
|
||||
self._set_it("save_time", ";".join(save_time))
|
||||
elif type(save_time) in StringTypes:
|
||||
elif isinstance(save_time, StringTypes):
|
||||
self._set_it("save_time", save_time)
|
||||
|
||||
def get_store_results(self):
|
||||
@@ -413,8 +413,8 @@ class CommandProfile (Profile, object):
|
||||
self._set_it(profile, 'description', description)
|
||||
|
||||
def get_profile(self, profile_name):
|
||||
return {'profile': profile_name, \
|
||||
'command': self.get_command(profile_name), \
|
||||
return {'profile': profile_name,
|
||||
'command': self.get_command(profile_name),
|
||||
'description': self.get_description(profile_name)}
|
||||
|
||||
|
||||
@@ -428,10 +428,9 @@ class NmapOutputHighlight(object):
|
||||
property_name = "%s_highlight" % p_name
|
||||
|
||||
try:
|
||||
return self.sanity_settings([config_parser.get(property_name,
|
||||
prop,
|
||||
True) \
|
||||
for prop in self.setts])
|
||||
return self.sanity_settings([
|
||||
config_parser.get(
|
||||
property_name, prop, True) for prop in self.setts])
|
||||
except:
|
||||
settings = []
|
||||
prop_settings = self.default_highlights[p_name]
|
||||
@@ -450,8 +449,8 @@ class NmapOutputHighlight(object):
|
||||
property_name = "%s_highlight" % property_name
|
||||
settings = self.sanity_settings(list(settings))
|
||||
|
||||
[config_parser.set(property_name, self.setts[pos], settings[pos]) \
|
||||
for pos in xrange(len(settings))]
|
||||
for pos in xrange(len(settings)):
|
||||
config_parser.set(property_name, self.setts[pos], settings[pos])
|
||||
|
||||
def sanity_settings(self, settings):
|
||||
"""This method tries to convert insane settings to sanity ones ;-)
|
||||
@@ -481,7 +480,7 @@ class NmapOutputHighlight(object):
|
||||
return settings
|
||||
|
||||
def boolean_sanity(self, attr):
|
||||
if attr == True or attr == "True" or attr == "true" or attr == "1":
|
||||
if attr is True or attr == "True" or attr == "true" or attr == "1":
|
||||
return 1
|
||||
return 0
|
||||
|
||||
@@ -546,7 +545,7 @@ class NmapOutputHighlight(object):
|
||||
return True
|
||||
|
||||
def set_enable(self, enable):
|
||||
if enable == False or enable == "0" or enable is None or enable == "":
|
||||
if enable is False or enable == "0" or enable is None or enable == "":
|
||||
config_parser.set(
|
||||
"output_highlight", "enable_highlight", str(False))
|
||||
else:
|
||||
|
||||
@@ -246,7 +246,7 @@ class ScanWindow(UmitScanWindow):
|
||||
except:
|
||||
about_icon = None
|
||||
|
||||
self.main_actions = [ \
|
||||
self.main_actions = [
|
||||
# Top level
|
||||
('Scan', None, _('Sc_an'), None),
|
||||
|
||||
@@ -580,7 +580,7 @@ class ScanWindow(UmitScanWindow):
|
||||
if widget is None:
|
||||
# Don't have a Print menu item for lack of support.
|
||||
return
|
||||
entry = self.scan_interface.scan_result.scan_result_notebook.nmap_output.get_active_entry()
|
||||
entry = self.scan_interface.scan_result.scan_result_notebook.nmap_output.get_active_entry() # noqa
|
||||
widget.set_sensitive(entry is not None)
|
||||
|
||||
def _load_recent_scan(self, widget):
|
||||
@@ -771,8 +771,7 @@ This scan has not been run yet. Start the scan with the "Scan" button first.'))
|
||||
try:
|
||||
scan_interface.inventory.save_to_file(
|
||||
saved_filename, selected_index, format)
|
||||
scan_interface.inventory.get_scans()[selected_index].unsaved = \
|
||||
False
|
||||
scan_interface.inventory.get_scans()[selected_index].unsaved = False # noqa
|
||||
except (OSError, IOError), e:
|
||||
alert = HIGAlertDialog(
|
||||
message_format=_("Can't save file"),
|
||||
@@ -916,7 +915,7 @@ This scan has not been run yet. Start the scan with the "Scan" button first.'))
|
||||
|
||||
def _print_cb(self, *args):
|
||||
"""Show a print dialog."""
|
||||
entry = self.scan_interface.scan_result.scan_result_notebook.nmap_output.get_active_entry()
|
||||
entry = self.scan_interface.scan_result.scan_result_notebook.nmap_output.get_active_entry() # noqa
|
||||
if entry is None:
|
||||
return False
|
||||
zenmapGUI.Print.run_print_operation(
|
||||
|
||||
@@ -372,7 +372,8 @@ class NmapOutputViewer (gtk.VBox):
|
||||
buf.insert(buf.get_end_iter(), new_output)
|
||||
# Highlight the new text.
|
||||
self.apply_highlighting(
|
||||
buf.get_iter_at_mark(prev_end_mark), buf.get_end_iter())
|
||||
buf.get_iter_at_mark(prev_end_mark),
|
||||
buf.get_end_iter())
|
||||
except MemoryError:
|
||||
self.show_large_output_message(self.command_execution)
|
||||
return
|
||||
|
||||
@@ -496,9 +496,8 @@ class OptionBuilder(object):
|
||||
return dic
|
||||
|
||||
def __parse_groups(self):
|
||||
return [g_name.getAttribute(u'name') for g_name in \
|
||||
self.xml.getElementsByTagName(u'groups')[0].\
|
||||
getElementsByTagName(u'group')]
|
||||
return [g_name.getAttribute(u'name') for g_name in
|
||||
self.xml.getElementsByTagName(u'groups')[0].getElementsByTagName(u'group')] # noqa
|
||||
|
||||
def __parse_tabs(self):
|
||||
dic = {}
|
||||
|
||||
@@ -374,12 +374,13 @@ class ProfileEditor(HIGWindow):
|
||||
command = self.ops.render_string()
|
||||
|
||||
buf = self.profile_description_text.get_buffer()
|
||||
description = buf.get_text(buf.get_start_iter(),\
|
||||
buf.get_end_iter())
|
||||
description = buf.get_text(
|
||||
buf.get_start_iter(), buf.get_end_iter())
|
||||
|
||||
try:
|
||||
self.profile.add_profile(profile_name,\
|
||||
command=command,\
|
||||
self.profile.add_profile(
|
||||
profile_name,
|
||||
command=command,
|
||||
description=description)
|
||||
except ValueError:
|
||||
alert = HIGAlertDialog(
|
||||
|
||||
@@ -323,7 +323,7 @@ class ScanInterface(HIGVBox):
|
||||
|
||||
def go_to_host(self, hostname):
|
||||
"""Scroll the text output to the appearance of the named host."""
|
||||
self.scan_result.scan_result_notebook.nmap_output.nmap_output.go_to_host(hostname)
|
||||
self.scan_result.scan_result_notebook.nmap_output.nmap_output.go_to_host(hostname) # noqa
|
||||
|
||||
def __create_toolbar(self):
|
||||
self.toolbar = ScanToolbar()
|
||||
@@ -456,7 +456,7 @@ class ScanInterface(HIGVBox):
|
||||
def update_cancel_button(self):
|
||||
"""Make the Cancel button sensitive or not depending on whether the
|
||||
currently displayed scan is running."""
|
||||
entry = self.scan_result.scan_result_notebook.nmap_output.get_active_entry()
|
||||
entry = self.scan_result.scan_result_notebook.nmap_output.get_active_entry() # noqa
|
||||
if entry is None:
|
||||
self.toolbar.cancel_button.set_sensitive(False)
|
||||
else:
|
||||
@@ -464,7 +464,7 @@ class ScanInterface(HIGVBox):
|
||||
|
||||
def _cancel_scan_cb(self, widget):
|
||||
"""Cancel the scan whose output is shown."""
|
||||
entry = self.scan_result.scan_result_notebook.nmap_output.get_active_entry()
|
||||
entry = self.scan_result.scan_result_notebook.nmap_output.get_active_entry() # noqa
|
||||
if entry is not None and entry.running:
|
||||
self.cancel_scan(entry.command)
|
||||
|
||||
@@ -472,14 +472,14 @@ class ScanInterface(HIGVBox):
|
||||
"""This is like _cancel_scan_cb, but it cancels the scans that are
|
||||
currently selected in the scans list, not the one whose output is
|
||||
currently shown."""
|
||||
model, selection = self.scan_result.scan_result_notebook.scans_list.scans_list.get_selection().get_selected_rows()
|
||||
model, selection = self.scan_result.scan_result_notebook.scans_list.scans_list.get_selection().get_selected_rows() # noqa
|
||||
for path in selection:
|
||||
entry = model.get_value(model.get_iter(path), 0)
|
||||
if entry.running:
|
||||
self.cancel_scan(entry.command)
|
||||
|
||||
def _remove_scan_cb(self, widget):
|
||||
model, selection = self.scan_result.scan_result_notebook.scans_list.scans_list.get_selection().get_selected_rows()
|
||||
model, selection = self.scan_result.scan_result_notebook.scans_list.scans_list.get_selection().get_selected_rows() # noqa
|
||||
selected_refs = []
|
||||
for path in selection:
|
||||
# Kill running scans and remove finished scans from the inventory.
|
||||
@@ -656,7 +656,7 @@ class ScanInterface(HIGVBox):
|
||||
try:
|
||||
parsed.nmap_output = command.get_output()
|
||||
except MemoryError:
|
||||
self.scan_result.scan_result_notebook.nmap_output.nmap_output.show_large_output_message(command)
|
||||
self.scan_result.scan_result_notebook.nmap_output.nmap_output.show_large_output_message(command) # noqa
|
||||
self.update_ui()
|
||||
self.scans_store.finish_running_scan(command, parsed)
|
||||
|
||||
@@ -839,7 +839,8 @@ class ScanInterface(HIGVBox):
|
||||
host.comment = comment
|
||||
for scan in self.inventory.get_scans():
|
||||
for h in scan.get_hosts():
|
||||
if h.get_ip() == host.get_ip() and h.get_ipv6() == host.get_ipv6():
|
||||
if (h.get_ip() == host.get_ip() and
|
||||
h.get_ipv6() == host.get_ipv6()):
|
||||
h.set_comment(host.comment)
|
||||
scan.unsaved = True
|
||||
break
|
||||
@@ -929,10 +930,10 @@ class ScanResult(gtk.HPaned):
|
||||
self.pack2(self.scan_result_notebook, True, False)
|
||||
|
||||
def set_nmap_output(self, msg):
|
||||
self.scan_result_notebook.nmap_output.nmap_output.text_view.get_buffer().set_text(msg)
|
||||
self.scan_result_notebook.nmap_output.nmap_output.text_view.get_buffer().set_text(msg) # noqa
|
||||
|
||||
def clear_nmap_output(self):
|
||||
self.scan_result_notebook.nmap_output.nmap_output.text_view.get_buffer().set_text("")
|
||||
self.scan_result_notebook.nmap_output.nmap_output.text_view.get_buffer().set_text("") # noqa
|
||||
|
||||
def get_host_selection(self):
|
||||
return self.scan_host_view.host_view.get_selection()
|
||||
|
||||
@@ -358,8 +358,8 @@ class HostOpenPorts(HIGVBox):
|
||||
|
||||
self.port_columns['hostname'].set_visible(False)
|
||||
|
||||
self.scroll_ports_hosts.set_policy(gtk.POLICY_AUTOMATIC,\
|
||||
gtk.POLICY_AUTOMATIC)
|
||||
self.scroll_ports_hosts.set_policy(
|
||||
gtk.POLICY_AUTOMATIC, gtk.POLICY_AUTOMATIC)
|
||||
|
||||
def port_mode(self):
|
||||
child = self.scroll_ports_hosts.get_child()
|
||||
|
||||
@@ -313,16 +313,16 @@ class ScriptInterface:
|
||||
status = process.scan_state()
|
||||
except:
|
||||
status = None
|
||||
log.debug("Script interface: script_list_timer_callback %s" % \
|
||||
log.debug("Script interface: script_list_timer_callback %s" %
|
||||
repr(status))
|
||||
|
||||
if status == True:
|
||||
if status is True:
|
||||
# Still running, schedule this timer to check again.
|
||||
return True
|
||||
|
||||
self.script_list_widget.set_sensitive(True)
|
||||
|
||||
if status == False:
|
||||
if status is False:
|
||||
# Finished with success.
|
||||
callback(True, process)
|
||||
else:
|
||||
|
||||
@@ -167,8 +167,8 @@ class HIGAlertDialog(gtk.MessageDialog):
|
||||
# "Alert windows have no titles, as the title would usually
|
||||
# unnecessarily duplicate the alert's primary text"
|
||||
self.set_title("")
|
||||
self.set_markup("<span weight='bold'size='larger'>%s</span>" \
|
||||
% message_format)
|
||||
self.set_markup(
|
||||
"<span weight='bold'size='larger'>%s</span>" % message_format)
|
||||
if secondary_text:
|
||||
# GTK up to version 2.4 does not have secondary_text
|
||||
try:
|
||||
|
||||
@@ -198,15 +198,11 @@ class HIGSpinnerImages:
|
||||
self.animated_pixbufs = new_animated
|
||||
|
||||
for k in self.static_pixbufs:
|
||||
self.static_pixbufs[k] = self.static_pixbufs[k].\
|
||||
scale_simple(width,
|
||||
height,
|
||||
gtk.gdk.INTERP_BILINEAR)
|
||||
self.static_pixbufs[k] = self.static_pixbufs[k].scale_simple(
|
||||
width, height, gtk.gdk.INTERP_BILINEAR)
|
||||
|
||||
self.rest_pixbuf = self.rest_pixbuf.\
|
||||
scale_simple(width,
|
||||
height,
|
||||
gtk.gdk.INTERP_BILINEAR)
|
||||
self.rest_pixbuf = self.rest_pixbuf.scale_simple(
|
||||
width, height, gtk.gdk.INTERP_BILINEAR)
|
||||
|
||||
self.images_width = width
|
||||
self.images_height = height
|
||||
@@ -275,7 +271,7 @@ class HIGSpinnerCache:
|
||||
|
||||
for x in range(0, grid_width, size):
|
||||
for y in range(0, grid_height, size):
|
||||
self.spinner_images.add_animated_pixbuf(\
|
||||
self.spinner_images.add_animated_pixbuf(
|
||||
self.__extract_frame(grid_pixbuf, x, y, size, size))
|
||||
|
||||
def load_static_from_lookup(self, icon_name="gnome-spinner-rest",
|
||||
|
||||
Reference in New Issue
Block a user