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())
def refresh_command(self, widget): """Try to set a new CommandProfile and delete the current profile, unless find some kind of problem (i.e. Profile not found or not able to be deleted.""" #log.debug(">>> Refresh Command") profile = self.toolbar.selected_profile target = self.toolbar.selected_target #log.debug(">>> Profile: %s" % profile) #log.debug(">>> Target: %s" % target) if target == '': target = self.empty_target try: cmd_profile = CommandProfile() command = cmd_profile.get_command(profile) % target del (cmd_profile) self.command_toolbar.command = command except ProfileNotFound: pass #self.profile_not_found_dialog() except TypeError: pass # That means that the command string convertion "%" didn't work
def collect_umit_info(self, command, parsed): profile = CommandProfile() profile_name = command.profile parsed.target = command.target parsed.profile_name = profile_name parsed.nmap_command = command.command parsed.profile = profile.get_command(profile_name) parsed.profile_description = profile.get_description(profile_name) parsed.profile_options = profile.get_options(profile_name) del (profile)
def refresh_command_target(self, widget): """Refreshes the command target only if the selected profile is not empty.""" #log.debug(">>> Refresh Command Target") profile = self.toolbar.selected_profile #log.debug(">>> Profile: %s" % profile) if profile != '': target = self.toolbar.selected_target #log.debug(">>> Target: %s" % target) try: cmd_profile = CommandProfile() command = cmd_profile.get_command(profile) % target del (cmd_profile) self.command_toolbar.command = command except ProfileNotFound: pass # Go without a profile except TypeError: pass # The target is empty...