本文整理汇总了Python中zenmapCore.UmitConf.CommandProfile类的典型用法代码示例。如果您正苦于以下问题:Python CommandProfile类的具体用法?Python CommandProfile怎么用?Python CommandProfile使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。
在下文中一共展示了CommandProfile类的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: _profile_entry_changed
def _profile_entry_changed(self, widget):
"""Update the command based on the contents of the target and profile
entries. If the command corresponding to the current profile is not
blank, use it. Otherwise use the current contents of the command
entry."""
profile_name = self.toolbar.get_selected_profile()
target_string = self.toolbar.get_selected_target()
cmd_profile = CommandProfile()
command_string = cmd_profile.get_command(profile_name)
del(cmd_profile)
if command_string == "":
command_string = self.command_toolbar.get_command()
ops = NmapOptions()
ops.parse_string(command_string)
# Use the targets from the command entry, if there are any, otherwise
# use any targets from the profile.
targets = split_quoted(target_string)
if len(targets) > 0:
ops.target_specs = targets
else:
self.toolbar.set_selected_target(join_quoted(ops.target_specs))
self.set_command_quiet(ops.render_string())
示例2: update
def update(self):
profile = CommandProfile()
profiles = profile.sections()
profiles.sort()
del(profile)
self.set_profiles(profiles)
示例3: __init__
def __init__(self, command=None, profile_name=None,
deletable=True, overwrite=False):
HIGWindow.__init__(self)
self.connect("delete_event", self.exit)
self.set_title(_('Profile Editor'))
self.set_position(gtk.WIN_POS_CENTER)
self.deletable = deletable
self.profile_name = profile_name
self.overwrite = overwrite
# Used to block recursive updating of the command entry when the
# command entry causes the OptionBuilder widgets to change.
self.inhibit_command_update = False
self.__create_widgets()
self.__pack_widgets()
self.profile = CommandProfile()
self.ops = NmapOptions()
if profile_name:
log.debug("Showing profile %s" % profile_name)
prof = self.profile.get_profile(profile_name)
# Interface settings
self.profile_name_entry.set_text(profile_name)
self.profile_description_text.get_buffer().set_text(
prof['description'])
command_string = prof['command']
self.ops.parse_string(command_string)
if command:
self.ops.parse_string(command)
self.option_builder = OptionBuilder(
Path.profile_editor, self.ops,
self.update_command, self.help_field.get_buffer())
log.debug("Option groups: %s" % str(self.option_builder.groups))
log.debug("Option section names: %s" % str(
self.option_builder.section_names))
#log.debug("Option tabs: %s" % str(self.option_builder.tabs))
for tab in self.option_builder.groups:
self.__create_tab(
_(tab),
_(self.option_builder.section_names[tab]),
self.option_builder.tabs[tab])
self.update_command()
示例4: ProfileEditor
class ProfileEditor(HIGWindow):
def __init__(self, command=None, profile_name=None,
deletable=True, overwrite=False):
HIGWindow.__init__(self)
self.connect("delete_event", self.exit)
self.set_title(_('Profile Editor'))
self.set_position(gtk.WIN_POS_CENTER)
self.deletable = deletable
self.profile_name = profile_name
self.overwrite = overwrite
# Used to block recursive updating of the command entry when the
# command entry causes the OptionBuilder widgets to change.
self.inhibit_command_update = False
self.__create_widgets()
self.__pack_widgets()
self.profile = CommandProfile()
self.ops = NmapOptions()
if profile_name:
log.debug("Showing profile %s" % profile_name)
prof = self.profile.get_profile(profile_name)
# Interface settings
self.profile_name_entry.set_text(profile_name)
self.profile_description_text.get_buffer().set_text(
prof['description'])
command_string = prof['command']
self.ops.parse_string(command_string)
if command:
self.ops.parse_string(command)
self.option_builder = OptionBuilder(
Path.profile_editor, self.ops,
self.update_command, self.help_field.get_buffer())
log.debug("Option groups: %s" % str(self.option_builder.groups))
log.debug("Option section names: %s" % str(
self.option_builder.section_names))
#log.debug("Option tabs: %s" % str(self.option_builder.tabs))
for tab in self.option_builder.groups:
self.__create_tab(
_(tab),
_(self.option_builder.section_names[tab]),
self.option_builder.tabs[tab])
self.update_command()
def command_entry_changed_cb(self, widget):
command_string = self.command_entry.get_text().decode("UTF-8")
self.ops.parse_string(command_string)
self.inhibit_command_update = True
self.option_builder.update()
self.inhibit_command_update = False
def update_command(self):
"""Regenerate and display the command."""
if not self.inhibit_command_update:
# Block recursive updating of the OptionBuilder widgets when they
# cause a change in the command entry.
self.command_entry.handler_block(self.command_entry_changed_cb_id)
self.command_entry.set_text(self.ops.render_string())
self.command_entry.handler_unblock(
self.command_entry_changed_cb_id)
def update_help_name(self, widget, extra):
self.help_field.get_buffer().set_text(
"Profile name\n\nThis is how the profile will be identified "
"in the drop-down combo box in the scan tab.")
def update_help_desc(self, widget, extra):
self.help_field.get_buffer().set_text(
"Description\n\nThe description is a full description of what "
"the scan does, which may be long.")
def __create_widgets(self):
###
# Vertical box to keep 3 boxes
self.main_whole_box = HIGVBox()
self.upper_box = HIGHBox()
self.middle_box = HIGHBox()
self.lower_box = HIGHBox()
#self.main_vbox = HIGVBox()
self.command_entry = gtk.Entry()
self.command_entry_changed_cb_id = self.command_entry.connect(
"changed", self.command_entry_changed_cb)
self.scan_button = HIGButton(_("Scan"))
self.scan_button.connect("clicked", self.run_scan)
self.notebook = gtk.Notebook()
# Profile info page
#.........这里部分代码省略.........