Python npyscreen.notify_confirm() Examples
The following are 28
code examples of npyscreen.notify_confirm().
You can vote up the ones you like or vote down the ones you don't like,
and go to the original project or source file by following the links above each example.
You may also want to check out all available functions/classes of the module
npyscreen
, or try the search function
.
Example #1
Source File: wat.py From raw-packet with MIT License | 6 votes |
def association(self, args): try: bssid = self.grid.selected_row()[1] assert bssid in self.wifi_instance.bssids.keys(), 'Could not find AP with BSSID: ' + bssid self.tm_instance.add_task(self.wifi_instance.send_association_request, bssid, self.wifi_instance.bssids[bssid]['essid'], True) except AssertionError as Error: npyscreen.notify_confirm(Error.args[0], title="Assertion Error") self.parentApp.switchFormPrevious() except IndexError: pass except TypeError: pass
Example #2
Source File: ble_read_state.py From apple_bleee with GNU General Public License v3.0 | 6 votes |
def upd_cell(self, argument): global resolved_devs cell = self.get_cell_name() if cell == 'Device': mac = self.get_mac_val_from_cell() thread2 = Thread(target=self.get_dev_name, args=(mac,)) # thread2 = Thread(target=self.get_all_dev_names()) thread2.daemon = True thread2.start() if cell == 'Phone': if self.get_phone_val_from_cell() == 'X': hashinfo = "Phone hash={}, email hash={}, AppleID hash={}, SSID hash={} ({})".format( hash2phone[self.get_mac_val_from_cell()]['ph_hash'], hash2phone[self.get_mac_val_from_cell()]['email_hash'], hash2phone[self.get_mac_val_from_cell()]['appleID_hash'], hash2phone[self.get_mac_val_from_cell()]['SSID_hash'], get_dict_val(dictOfss, hash2phone[self.get_mac_val_from_cell()]['SSID_hash'])) table = print_results2(hash2phone[self.get_mac_val_from_cell()]['phone_info']) rez = "{}\n\n{}".format(hashinfo, table) npyscreen.notify_confirm(rez, title="Phone number info", wrap=True, wide=True, editw=0)
Example #3
Source File: osinstall.py From power-up with Apache License 2.0 | 5 votes |
def h_help(self, char): npyscreen.notify_confirm(self.helpmsg, title=self.prev_field, editw=1)
Example #4
Source File: console.py From PRET with GNU General Public License v2.0 | 5 votes |
def usage(self, *args): message = ' < or >: collapse/expand node\n { or }: collapse/expand tree\n /: set search filter\n f: set datatype filter\n r: reset all filters\n n: move next filtered\n p: move prev filtered\n q: quit application' npyscreen.notify_confirm(message, title='Usage Help')
Example #5
Source File: stdfmemail.py From EDCOP with Apache License 2.0 | 5 votes |
def viewMessageSource(self,): npyscreen.notify_confirm(self.this_email.as_string(), wide=True)
Example #6
Source File: stdfmemail.py From EDCOP with Apache License 2.0 | 5 votes |
def viewAllHeaders(self,): s_header_list = [] for headers in list(self.this_email.keys()): these_headers = self.this_email.get_all(headers) if these_headers: for h in these_headers: s_header_list.append(str(headers).capitalize() + ": " + h.strip()) npyscreen.notify_confirm(s_header_list, wide=True, wrap=True)
Example #7
Source File: stdfmemail.py From EDCOP with Apache License 2.0 | 5 votes |
def viewShortHeaders(self,): s_header_list = [] for headers in self.SHORT_HEADER_LIST: these_headers = self.this_email.get_all(headers) if these_headers: for h in these_headers: s_header_list.append(str(headers).capitalize() + ": " + h.strip()) npyscreen.notify_confirm(s_header_list, wide=True, wrap=False)
Example #8
Source File: menu.py From EDCOP with Apache License 2.0 | 5 votes |
def on_ok(self): """Ok.""" self.parentApp.setNextForm("NETWORKSELECT") if self.enabled.value == [0]: try: self.network.enabled = True self.network.interface = self.parentApp.host.interfaces[self.interface.value[0]] except IndexError: npyscreen.notify_confirm("Please select a valid interface", title="Error")
Example #9
Source File: menu.py From EDCOP with Apache License 2.0 | 5 votes |
def on_ok(self): """Save network information to object.""" errors = '' try: self.network.bootproto = self.parentApp.bootproto[self.bootproto.value[0]] self.network.interface = self.parentApp.host.interfaces[self.interface.value[0]] if (validateIP(self.ipaddress.value) == True): self.network.ip_address = self.ipaddress.value else: errors += '\nIP Address' if (validateNetmask(self.netmask.value) == True): self.network.netmask = self.netmask.value else: errors += '\nNetmask' self.network.network = networkID(self.network.ip_address, self.network.netmask) self.network.dhcp_start = self.dhcp_start.value self.network.dhcp_end = self.dhcp_end.value # If there are no issues, jump to parent form, otherwise, alert so user can fix if (errors == ''): self.parentApp.switchFormPrevious() else: formMessage = "There appears to be missing or invalid data on the following fields: \n \n \n" + errors npyscreen.notify_confirm(formMessage, title="Error") except IndexError: npyscreen.notify_confirm("Please select a valid interface", title="Error")
Example #10
Source File: menu.py From EDCOP with Apache License 2.0 | 5 votes |
def on_ok(self): if (self.hostname.value != ""): try: self.parentApp.host.name = self.hostname.value except: npyscreen.notify_confirm("Something went wrong. Please check your hostname", title="Error") else: npyscreen.notify_confirm("You must enter a hostname.", title="Error")
Example #11
Source File: __init__.py From signal-curses with GNU General Public License v3.0 | 5 votes |
def afterEditing(self): log(self.tree.value) selected, is_group = self.getFromId(self.tree.value) log(selected) if not selected: npyscreen.notify_confirm( 'Invalid entry', title='Select User/Group') return self.parentApp.app.wMain.clearValues() self.parentApp.app.wMain.update() self.parentApp.updateState(selected, is_group) self.parentApp.setNextForm('APP')
Example #12
Source File: forms.py From signal-curses with GNU General Public License v3.0 | 5 votes |
def showQR(self): state = self.parentApp.state self.parentApp.setup.showingToken = True self.parentApp.tokenQR = self.getQR() self.parentApp.setup.showingToken = False npyscreen.blank_terminal() print("\r") for line in self.parentApp.tokenQR.splitlines(): print(line) print("\r", end='') print("") print("Open Signal > Settings > Linked Devices > Add and scan the QR code.\r") npyscreen.notify_confirm( self.getResponse(), title="Restart signal-curses to begin chatting") exit(0)
Example #13
Source File: forms.py From signal-curses with GNU General Public License v3.0 | 5 votes |
def getQR(self): if not self.parentApp.setup.showingToken: return while self.parentApp.setup.token is None: npyscreen.notify_wait( "Waiting for token...\n\nOpen Signal > Settings > Linked Devices > Add and scan the QR code.", title="Setup") time.sleep(0.1) if not self.parentApp.setup.token.startswith('tsdevice:'): npyscreen.notify_confirm( "There was not a valid registration token returned from signal-cli\n\nReturned token: {}".format(self.parentApp.setup.token), title="Setup") exit(0) return pyqrcode.create(self.parentApp.setup.token, error='L').terminal(quiet_zone=1)
Example #14
Source File: forms.py From signal-curses with GNU General Public License v3.0 | 5 votes |
def prompt(self): state = self.parentApp.state self.parentApp.setNextForm('LINK') npyscreen.notify_confirm("Couldn't open your signal config file for:\nPhone: {}\nConfig dir: {}".format(state.phone, state.configDir) + "\nDo you want to link a new device right now? Hit enter twice to select the OK button. To cancel, press Ctrl+C", title="No signal-cli config")
Example #15
Source File: editor.py From vent with Apache License 2.0 | 5 votes |
def on_cancel(self): """ Don't save changes made to vent.template """ npyscreen.notify_confirm('No changes made to ' + self.settings['tool_name'], title='Configurations not saved') self.change_screens()
Example #16
Source File: del_instances.py From vent with Apache License 2.0 | 5 votes |
def quit(self, *args, **kargs): """ Quit without making any changes to the tool """ npyscreen.notify_confirm('No changes made to instance(s)', title='Instance confiugration cancelled') self.change_screens()
Example #17
Source File: backup.py From vent with Apache License 2.0 | 5 votes |
def on_ok(self): """ Perform restoration on the backup file selected """ if self.dir_select.value: npyscreen.notify_wait('In the process of restoring', title='Restoring...') status = self.restore(self.dirs[self.dir_select.value[0]]) if status[0]: npyscreen.notify_confirm('Status of restore:\n' + status[1]) else: npyscreen.notify_confirm(status[1]) self.quit() else: npyscreen.notify_confirm('Choose a version to restore from')
Example #18
Source File: wat.py From raw-packet with MIT License | 5 votes |
def ap_info(self, args): try: npyscreen.notify_confirm(self.get_ap_info(self.grid.selected_row()[1]), title="AP information") self.parentApp.switchFormPrevious() except IndexError: pass
Example #19
Source File: wat.py From raw-packet with MIT License | 5 votes |
def help_info(self, args): help_string: str = \ 'Ctrl-E: Show Wireless access point information\n' + \ 'Ctrl-D: Send IEEE 802.11 deauth packets\n' + \ 'Ctrl-S: Switch WiFi channel\n' + \ 'Ctrl-A: Send IEEE 802.11 association packet\n' + \ 'Ctrl-R: Start scanner (switch between WiFi channels)\n' + \ 'Ctrl-H: Show help information\n' + \ 'Ctrl-C: Exit\n' npyscreen.notify_confirm(help_string, title='Help') self.parentApp.switchFormPrevious()
Example #20
Source File: tui.py From community-edition-setup with MIT License | 5 votes |
def do_while_waiting(self): if not queue.empty(): data = queue.get() if data[0] == COMPLETED: if self.parentApp.installObject.post_messages: npyscreen.notify_confirm('\n'.join(self.parentApp.installObject.post_messages), title="Post Install Messages", wide=True) npyscreen.notify_confirm(msg.installation_completed.format(self.parentApp.installObject.hostname), title="Completed") self.parentApp.do_notify = False self.parentApp.switchForm(None) elif data[0] == ERROR: npyscreen.notify_confirm(msg.installation_error +"\n"+data[2], title="ERROR") self.parentApp.do_notify = False self.parentApp.switchForm(None) self.prgress_percantage.value = data[0] self.prgress_percantage.update() self.installing.value = data[2] self.installing.update() if self.desc_value != data[1]: if hasattr(msg, 'installation_description_' + data[1]): desc = getattr(msg, 'installation_description_' + data[1]) else: desc = msg.installation_description_gluu self.description.value = '\n'.join(textwrap.wrap(desc, self.columns - 10)) self.description.update() self.desc_value = data[1]
Example #21
Source File: tui.py From community-edition-setup with MIT License | 5 votes |
def nextButtonPressed(self): if not self.hostname.value: npyscreen.notify_confirm(msg.enter_hostname, title="Info") return if self.hostname.value.lower() == 'localhost': npyscreen.notify_confirm(msg.enter_hostname_local, title="Info") return if not self.parentApp.installObject.check_email(self.admin_email.value): npyscreen.notify_confirm(msg.enter_valid_email, title="Info") return if not self.parentApp.installObject.isIP(self.ip.value): npyscreen.notify_confirm(msg.enter_valid_ip, title="Info") return if len(self.countryCode.value) < 2: npyscreen.notify_confirm(msg.enter_valid_countryCode, title="Info") return if len(self.oxtrust_admin_password.value) < 6: npyscreen.notify_confirm(msg.oxtrust_admin_password_warning, title="Info") return try: int(self.application_max_ram.value) except: npyscreen.notify_confirm(msg.max_ram_int_warning, title="Info") return for k in self.myfields_: f = getattr(self, k) setattr(self.parentApp.installObject, k, f.value) self.parentApp.installObject.application_max_ram = int(self.application_max_ram.value) self.parentApp.switchForm('ServicesForm')
Example #22
Source File: tui.py From community-edition-setup with MIT License | 5 votes |
def nextButtonPressed(self): if not self.license_confirm.value: npyscreen.notify_confirm(msg.acknowledge_lisence_ask, title="Info") return self.parentApp.switchForm("HostForm")
Example #23
Source File: tui.py From community-edition-setup with MIT License | 5 votes |
def display_help(self, code_of_key_pressed): class_name = self.__class__.__name__ if hasattr(msg, class_name+'Help'): help_text = getattr(msg, class_name+'Help') else: help_text = msg.no_help npyscreen.notify_confirm(help_text, title="Help", wide=True)
Example #24
Source File: osinstall.py From power-up with Apache License 2.0 | 4 votes |
def get_mask_and_prefix(self, mask_prefix): """ Extracts a mask and prefix from a string containing a mask and / or a prefix. Args: mask_prefix (str): Of the form 'ipmask prefix' or ipmask or prefix """ msg = '' mask_prefix = mask_prefix.strip() if mask_prefix: mask = mask_prefix.split()[0] prefix = mask_prefix.split()[-1] else: msg = ('Neither the netmask or prefix are valid.\n' 'Using default netmask and prefix') mask = '255.255.255.0' prefix = '24' prefix_match = re.search(r'^(\d{1,2})\s*$', prefix) if u.is_netmask(mask): pass else: mask = None if prefix_match: try: prefix = int(prefix_match.group(1)) prefix = prefix if 0 < prefix < 33 else None except (ValueError, TypeError): prefix = None else: prefix = None tmp = u.get_prefix(mask) if mask else 0 if prefix and mask and prefix != tmp: msg = ('The entered mask and prefix do not match. The prefix is ' 'given precendence. If you wish to enter just a netmask, ' 'a prefix will be calculated. If you wish to enter just ' 'a prefix, a netmask will be calulated.') mask = u.get_netmask(prefix) elif prefix and not mask: mask = u.get_netmask(prefix) elif mask and not prefix: prefix = u.get_prefix(mask) elif (not prefix) and not mask: msg = ('Neither the netmask or prefix are valid.\n' 'Using default netmask and prefix') mask = '255.255.255.0' prefix = '24' if msg: npyscreen.notify_confirm(msg, editw=1) return mask, prefix
Example #25
Source File: choose_tools.py From vent with Apache License 2.0 | 4 votes |
def on_ok(self): """ Take the tool selections and add them as plugins """ def diff(first, second): """ Get the elements that exist in the first list and not in the second """ second = set(second) return [item for item in first if item not in second] def popup(original_tools, branch, thr, title): """ Start the thread and display a popup of the tools being added until the thread is finished """ thr.start() tool_str = 'Adding tools...' npyscreen.notify_wait(tool_str, title=title) while thr.is_alive(): tools = diff(ManifestTools(), original_tools) if tools: tool_str = '' for tool in tools: pre_tool = 'Added: ' + branch + '/' + tool + '\n' tool_str = pre_tool + tool_str npyscreen.notify_wait(tool_str, title=title) time.sleep(1) return original_tools = ManifestTools() for branch in self.tools_tc: tools = [] for tool in self.tools_tc[branch]: if self.tools_tc[branch][tool].value: # get rid of temporary show for multiple tools in same # directory if tool == '/': tools.append(('.', '')) else: tools.append((tool, '')) repo = self.parentApp.repo_value['repo'] version = self.parentApp.repo_value['versions'][branch] api_action = Tools(version=version, branch=branch) thr = threading.Thread(target=api_action.new, args=(), kwargs={'tool_type': 'repo', 'uri': repo, 'tools': tools}) popup(original_tools, branch, thr, 'Please wait, adding tools for the ' + branch + ' branch...') npyscreen.notify_confirm('Done adding repository: ' + self.parentApp.repo_value['repo'], title='Added Repository') self.quit()
Example #26
Source File: menu.py From EDCOP with Apache License 2.0 | 4 votes |
def on_ok(self): """Next.""" # Validate all forms have the minimum required data hostnameComplete = False clusterNetworkComplete = False pxeNetworkComplete = False storageComplete = False incompleteForms = "" """ Hostname Validation """ if(KICKSTART_MENU.host.name!=""): hostnameComplete = True else: incompleteForms += "\nHostname" """ PXE Network Validation """ if((KICKSTART_MENU.network_pxe.ip_address != "") and (KICKSTART_MENU.network_pxe.netmask != "") and (KICKSTART_MENU.network_pxe.interface != None)): if((KICKSTART_MENU.network_pxe.bootproto == "dhcp") and (KICKSTART_MENU.network_pxe.dhcp_start != "") and (KICKSTART_MENU.network_pxe.dhcp_end != "")): pxeNetworkComplete = True elif(KICKSTART_MENU.network_pxe.bootproto == "static"): pxeNetworkComplete = True else: incompleteForms += "\nPXE Network" """ Cluster Network Valdiation """ if((KICKSTART_MENU.network_cluster.ip_address != "") and (KICKSTART_MENU.network_cluster.netmask != "") and (KICKSTART_MENU.network_cluster.interface != None)): clusterNetworkComplete = True else: incompleteForms += "\nCluster Network" """ Storage Validation """ if((KICKSTART_MENU.storage_os.mountpoint != "") and (KICKSTART_MENU.storage_os.disk != None)): storageComplete = True else: incompleteForms += "\nStorage (EDCOP OS)" # Raise an error to the user if they are missing data in any mandatory form if ((hostnameComplete==True) and (clusterNetworkComplete==True) and (pxeNetworkComplete==True) and (storageComplete==True)): try: self.editing = False self.parentApp.setNextForm(None) except: npyscreen.notify_confirm("Something went wrong. Please try again.", title="Error") else: formMessage = "There appears to be missing data on the following forms: \n \n \n" + incompleteForms npyscreen.notify_confirm(formMessage, title="Error")
Example #27
Source File: wat.py From raw-packet with MIT License | 4 votes |
def deauth(self, args): try: bssid = self.grid.selected_row()[1] assert bssid in self.wifi_instance.bssids.keys(), 'Could not find AP with BSSID: ' + bssid if len(self.wifi_instance.bssids[bssid]['clients']) > 0: clients_list: List[str] = self.make_client_list(self.wifi_instance.bssids[bssid]['clients']) popup_columns: int = len(max(clients_list, key=len)) + len(self.deauth_multi_select_name) + 22 popup_lines: int = len(clients_list) + 4 if popup_columns > int(3 * self.x // 4): popup_columns = int(3 * self.x // 4) if popup_lines > int(3 * self.y // 4): popup_lines = int(3 * self.y // 4) if popup_lines < 6: popup_lines = 6 popup = npyscreen.Popup(name=self.deauth_popup_name, columns=popup_columns, lines=popup_lines) deauth_clients = popup.add(npyscreen.TitleMultiSelect, name=self.deauth_multi_select_name, scroll_exit=True, values=clients_list) popup.edit() if len(deauth_clients.get_selected_objects()) > 0: if self.wifi_channel != self.wifi_instance.bssids[bssid]['channel']: self.wifi_channel = self.wifi_instance.bssids[bssid]['channel'] self.wifi_instance.set_wifi_channel(channel=self.wifi_instance.bssids[bssid]['channel']) for client in deauth_clients.get_selected_objects(): self.tm_instance.add_task(self.wifi_instance.send_deauth, bssid, client[0:17], 50) else: npyscreen.notify_confirm('Not found clients for AP: ' + self.wifi_instance.bssids[bssid]['essid'] + ' (' + bssid + ')', title="Deauth Error") self.parentApp.switchFormPrevious() except AssertionError as Error: npyscreen.notify_confirm(Error.args[0], title="Assertion Error") self.parentApp.switchFormPrevious() except IndexError: pass except TypeError: pass
Example #28
Source File: menu.py From EDCOP with Apache License 2.0 | 4 votes |
def on_ok(self): """Save network information to object.""" errors = '' try: interfaceList = [] for index in range(len(self.interface.value)): interfaceList.append(self.parentApp.host.interfaces[self.interface.value[index]]) self.network.interface = interfaceList self.network.bootproto = self.parentApp.bootproto[self.bootproto.value[0]] self.network.teaming = self.parentApp.teaming[self.teaming.value[0]] if (validateIP(self.ipaddress.value) == True): self.network.ip_address = self.ipaddress.value else: errors += '\nIP Address' if (validateNetmask(self.netmask.value) == True): self.network.netmask = self.netmask.value else: errors += '\nNetmask' self.network.network = networkID(self.network.ip_address, self.network.netmask) if (validateIP(self.dns1.value) == True): self.network.dns1 = self.dns1.value else: errors += '\nDNS1' if (validateIP(self.dns2.value) == True): self.network.dns2 = self.dns2.value else: errors += '\nDNS2' if (validateIP(self.gateway.value) == True): self.network.gateway = self.gateway.value else: errors += '\nGateway' # If there are no issues, jump to parent form, otherwise, alert so user can fix if (errors == ''): self.parentApp.switchFormPrevious() else: formMessage = "There appears to be missing or invalid data on the following fields: \n \n \n" + errors npyscreen.notify_confirm(formMessage, title="Error") except IndexError: npyscreen.notify_confirm("Please select a valid interface", title="Error")