def remove_item(self, *args): store, item = self.tree_view.get_selection().get_selected() item_type = self.store[item][0]['type'] if item_type in ['app', 'group']: icon, name = [self.store[item][1].to_string(), self.store[item][2]] else: icon, name = ["list-remove-symbolic", _("Separator")] dialog = ConfirmDialog(icon, name) response = dialog.run() if response == Gtk.ResponseType.YES: if self.store.iter_has_child(item): # if deleted item is a group insert child's to root index = self.store.get_path(item)[0] for child in self.store[item].iterchildren(): data = { "icon": child[1].to_string(), "name": child[2], "command": child[3], "group": '' } self.store.insert(None, index, self.create_list_entry('app', data)) index += 1 self.store.remove(item) else: # if deleted item is an app parent = self.store[item].get_parent() self.store.remove(item) # delete parent if they are no child's left if parent is not None: if not self.store.iter_has_child(parent.iter): self.store.remove(parent.iter) self.list_changed()
def generate_payload(self): """ Generate a payload file and place it in the payloads directory. Payloads will be one item per line. """ filename = self.dataBankTab.mainWindow.dbankGenPayloadName.text() start = self.dataBankTab.mainWindow.dbankGenStart.text() stop = self.dataBankTab.mainWindow.dbankGenStop.text() step = self.dataBankTab.mainWindow.dbankGenStep.text() prepend = self.dataBankTab.mainWindow.dbankGenPre.text() postpend = self.dataBankTab.mainWindow.dbankGenPost.text() if filename == "": message = "You didn't specify a filename" dialog = SimpleDialog(message) dialog.exec_() return() if start == "": message = "You didn't specify a start of the range" dialog = SimpleDialog(message) dialog.exec_() return() if stop == "": message = "You didn't specify a end of the range" dialog = SimpleDialog(message) dialog.exec_() return() fullpath = self.payloads_dir + "/" + filename if os.path.exists(fullpath): message = "File already exists. Would you like to overwrite?" response = ConfirmDialog.display_confirm_dialog(self, message) if response == False: return() self.write_payload(fullpath, start, stop)
def del_fuzz_file(self): # Gets the current name of the file selected in the combobox filename = self.dataBankTab.mainWindow.dbankPayloadsBox.currentText() path = self.payloads_dir message = "Are you sure you want to delete: {0}".format(filename) response = ConfirmDialog.display_confirm_dialog(self, message) if response == True: os.remove(path + "/" + filename) self.dataBankTab.fill_payload_combo_box() # Clear the items from the textedit self.dataBankTab.mainWindow.dbankFuzzValuesEdit.clear()
def del_function_file(self): # Gets the current name of the file selected in the combobox filename = self.mainWindow.wfFunctionsComboBox.currentText() path = self.functions_dir message = "Are you sure you want to delete: {0}".format(filename) response = ConfirmDialog.display_confirm_dialog(self.mainWindow, message) if response == True: os.remove(os.path.join(path,filename)) self.fill_function_combo_box() # Clear the items from the scintilla widget #ToDo: This should be the default data for the function self.functionsEditScintilla.clear()