def messageTest(): if msg.confirm(text='CONFIRM_TEXT', title='CONFIRM_TITLE', buttons=['OK', 'Cancel']) == 'OK': msg.alert(text='u r pressed OK', title='ALERT_TITLE', button='OK') else: msg.alert(text='u r pressed CANCEL', title='ALERT_TITLE', button='OK') msg.password(text='', title='', default='', mask='*')
def decrypt_db(): values = get_data() all_done = True pwd = b'' for ind, val in enumerate(values): if ind == int(config['get_vals']): all_done = False alert(f'Decrypted {ind} values, aborting.', 'Task finished', 'OK') break print('\n\n', ind, val, '\n\n') done = False while hashlib.sha1(pwd).hexdigest() != val[1] and not done: alert( f'Password stored in memory does not match password of value at index {ind}.', 'There\'s a problem', 'OK') pwd_ = password('Please enter the password.', 'Password', mask='\u00b7') if not pwd_ or not pwd_.strip(): alert('Skipping value as password was not entered.', 'Warning', 'OK') done = True break pwd = pwd_.encode() if done: cconfirm('It seems you did not enter the password. Quit the program?', 'Hmm...', [ 'Continue', 'Quit']) continue insert_value(val, pwd) if all_done: alert('Decrypted all values.', 'Task finished', 'OK')
def alertMeNegK(): pymsgbox.alert("Process Failed! Web and net is up, but there is no secure K drive Connection. Please Try Again.") response = pymsgbox.password('Please enter password to confirm') print response if response == "None": alertMeNegK() if not response: alertMeNegK()
def alertMeNegInt(): pymsgbox.alert("Process Failed! No Internet Connection. Please Try Again.") response = pymsgbox.password('Please enter password to confirm') print response if response == "None": alertMeNegInt() if not response: alertMeNegInt()
def alertMePos(): pymsgbox.alert("Success! Photo Roster Data from Canvas has been UPDATED for today!") response = pymsgbox.password('Please enter password to confirm') print response if response == "None": alertMePos() if not response: alertMePos()
def ui_handler(_): label = ( 'Use the numeric keypad to describe number positions.\n' 'The layout is:\n' ' 7 8 9\n' ' 4 5 6\n' ' 1 2 3\n' 'Please enter PIN:') scrambled_pin = pymsgbox.password(label) return self._defs.PinMatrixAck(pin=scrambled_pin)
def test_timeout(self): # Note: If these test's fail, the unit tests will hang. self.assertEqual(pymsgbox.alert('timeout test', timeout=1000), pymsgbox.TIMEOUT_TEXT) self.assertEqual(pymsgbox.confirm('timeout test', timeout=1000), pymsgbox.TIMEOUT_TEXT) self.assertEqual(pymsgbox.prompt('timeout test', timeout=1000), pymsgbox.TIMEOUT_TEXT) self.assertEqual(pymsgbox.password('timeout test', timeout=1000), pymsgbox.TIMEOUT_TEXT)
def test_timeout(self): # Note: If these test's fail, the unit tests will hang. self.assertEqual(pymsgbox._alertTkinter('timeout test', timeout=300), pymsgbox.TIMEOUT_RETURN_VALUE) self.assertEqual(pymsgbox._confirmTkinter('timeout test', timeout=300), pymsgbox.TIMEOUT_RETURN_VALUE) self.assertEqual(pymsgbox.prompt('timeout test', timeout=300), pymsgbox.TIMEOUT_RETURN_VALUE) self.assertEqual(pymsgbox.password('timeout test', timeout=300), pymsgbox.TIMEOUT_RETURN_VALUE)
def terminateUser(userDelete): global userData usTmp = str(userDelete) idxDel = int(checkUser(userDelete)) if (idxDel != -1): tmpPass = pymsgbox.password('Enter password to delete!') tempPass = str(tmpPass) canDel = passwordCheck(usTmp, tempPass, idxDel) if (canDel): userData = userData.drop(idxDel) userData.to_csv('chatbot_spreadsheet.csv', encoding='utf-8', index=False) pymsgbox.alert('The account has been deleted!') else: pymsgbox.alert('Wrong Password!') else: pymsgbox.alert('User does not exist!')
def sendEmail(mTo, mSubject, mMsg): global loggedIn global mUsr global mPwd if loggedIn == False: mUsr = pymsgbox.prompt("From Address/Gmail user Name:") mPwd = pymsgbox.password("Enter your password:"******"From: " + mUsr + "\n\nTo: " + mTo + "\n\nSub: " + mSubject + "\n\nMsg: \n" + mMsg message = Message(From=mUsr, To=mTo.split(","), Subject=mSubject, Body=mMsg) #message.Subject = mSubject #message.Html = mMsg #Turn on Low Security App Usage in Gmail for the following to work sender = Mailer('smtp.gmail.com', use_tls=True, usr=mUsr, pwd=mPwd) pymsgbox.alert(mMail, "Message to be sent") mConfirm = pymsgbox.confirm(" Ready to Send?", "Confirm Send", ["Yes", "No"]) if (mConfirm == "Yes"): try: sender.send(message) pymsgbox.alert("\nMessage Sent\n") return True except: pymsgbox.alert("\nMessage Failed to Send.") else: pass return False
def cb_run(n): global Launches, msgBox, msgBoxWait if msgBoxWait is not None: return item = Launches[n] if item["state"] == 0: fg = True if "pass" in item: fg = False alert = "" w = item["tag"] msgBox = tk.Toplevel() geom = "300x130+" + str( w.winfo_rootx()) + "+" + str(w.winfo_rooty() + 25) msgBox.geometry(geom) msgBoxWait = msgBox.after(1000, cb_wait_nop) msg = "Enter password" result = pymsgbox.password(root=msgBox, text=msg, geom=geom) if result[0].startswith('O'): #OK if result[1] == Config["password"]: fg = True else: alert = "password is incorrect" elif not result[0].startswith("C"): #Cancel alert = "enter password error" if alert: msgBox.after_cancel(msgBoxWait) msgBox.destroy() msgBox = tk.Toplevel() msgBox.geometry("250x100+" + str(w.winfo_rootx()) + "+" + str(w.winfo_rooty())) msgBoxWait = msgBox.after(500, cb_lift) pymsgbox.alert(root=msgBox, text=alert) msgBox.after_cancel(msgBoxWait) msgBoxWait = None msgBox.destroy() if fg: if ".launch" in item["file"]: cmd = ["roslaunch", item["package"], item["file"]] else: cmd = ["xterm", "-e", "rosrun", item["package"], item["file"]] if "args" in item: for k in item["args"]: cmd.append(k + ":=" + str(item["args"][k])) proc = subprocess.Popen(cmd) item["tag"]["foreground"] = litcolor item["tag"]["font"] = boldfont item["button"]["image"] = stopicon item["process"] = proc item["state"] = 1 timeout.set(functools.partial(cb_runstat, n), 3) if "pre" in item: print "dash pre", item["pre"] subprocess.Popen(item["pre"].split()) elif item["state"] == 2: if "confirm" in item: if item["confirm"]: w = item["tag"] msgBox = tk.Toplevel() msgBox.geometry("250x100+" + str(w.winfo_rootx()) + "+" + str(w.winfo_rooty())) msgBoxWait = msgBox.after(500, cb_lift) msg = item["label"] + Config["confirm"] if "message" in Config: if "halt" in Config["message"]: msg = Config["message"]["halt"] elif "launch" in Config["message"]: msg = Config["message"]["launch"] elif "label" in Config: if "confirm" in Config["label"]: msg = Config["label"]["confirm"] msg = item["label"] + msg f = pymsgbox.confirm(root=msgBox, text=msg, buttons=['OK', 'CANCEL']) msgBox.after_cancel(msgBoxWait) msgBoxWait = None msgBox.destroy() if f.startswith("C"): #Cancel return item["process"].terminate() item["state"] = 3 timeout.set(functools.partial(cb_stop, n), 1)
if s == "Alert": title1=str(input("Title here: ")) text1=str(input("Text here: ")) button1=str(input("Button here: ")) pymsgbox.alert(text=text1, title=title1, button=button1) elif s == "Confirm": title1=str(input("Title here: ")) text1=str(input("Text here: ")) button1=str(input("Button here: ")) button2=str(input("Button here: ")) pymsgbox.confirm(text=text1, title=title1, buttons=[button1, button2]) elif s == "Prompt": title1=str(input("Title here: ")) text1=str(input("Text here: ")) default1=str(input("Default: ")) pymsgbox.prompt(text=text1, title=title1, default=default1) elif s == "Password": title1=str(input("Title here: ")) text1=str(input("Text here: ")) default1=str(input("Default: ")) mask1=str(input("Mask: ")) pymsgbox.password(text=text1, title=title1, default=default1, mask=mask1) else: print("Invalid dummy") #===========FURRO404============#
import pymsgbox import subprocess from subprocess import STDOUT import os passwd = pymsgbox.password('ostdeveloper password:'******'"' + passwd + '"' + " dpkg --add-architecture i386" proc = subprocess.Popen(command, shell=True, stdin=None, stdout=open(os.devnull, "wb"), stderr=STDOUT, executable="/bin/bash") proc.wait() command1 = "sudo -S <<< " + '"' + passwd + '"' + " apt-get update" proc = subprocess.Popen(command1, shell=True, stdin=None, stdout=open(os.devnull, "wb"), stderr=STDOUT, executable="/bin/bash") proc.wait() command2 = "sudo -S <<< " + '"' + passwd + '"' + " apt-get -y install wine32" proc = subprocess.Popen(command2, shell=True, stdin=None, stdout=open(os.devnull, "wb"), stderr=STDOUT, executable="/bin/bash") proc.wait()
#!/usr/bin/env python3 # -*- coding: utf-8 -*- __author__ = 'ipetrash' # pip install PyMsgBox from pymsgbox import password result = password(text='My Text', title='My Title', default='Default Text', mask='*') print(result) result = password(text='My Text', title='My Title', default='Default Text', mask='?') print(result)
"""Simple, cross-platform UI for entering a PIN/passhprase.""" import sys import pymsgbox sys.stdout.write(pymsgbox.password(sys.stdin.read()))