def account_pulls_from_340(): start = datetime.datetime.now() directory = filedialog.askdirectory(title="Point to a new empty directory!") msg = "Enter Arguments to pull 340" title = "Requesting 340 Accounts for SOX" fieldNames = ["Subsidiary to pull", "Year to pull", "IDS username", "IDS password"] fieldValues = [] # we start with blanks for the values fieldValues = multpasswordbox(msg, title, fieldNames) # make sure that none of the fields was left blank while 1: if fieldValues == None: break errmsg = "" for i in range(len(fieldNames)): if fieldValues[i].strip() == "": errmsg = errmsg + ('"%s" is a required field.\n\n' % fieldNames[i]) if (len(fieldValues[0]) != 3): errmsg = errmsg + "\nSubsidiary should be a 3 letter code, e.g 'CSA', 'CUS'." try: fieldValues[1] = int(fieldValues[1]) except: errmsg = errmsg + "\nYear should be a 4 digit integer, e.g 2018." if errmsg == "": break # no problems found fieldValues = multpasswordbox(errmsg, title, fieldNames, fieldValues) data_340 = get_accounts_to_pull(fieldValues[2], fieldValues[3], fieldValues[0].upper() + "R0340", fieldValues[1], directory) process_340(data_340, directory) print((datetime.datetime.now() - start).total_seconds())
def download_all(directory): dir_path = directory.strip() msg = "Download all from IDS" title = "IDS credentials" fieldNames = ["IDS username", "IDS password"] fieldValues = [] # we start with blanks for the values fieldValues = multpasswordbox(msg, title, fieldNames) # make sure that none of the fields was left blank while 1: if fieldValues == None: break errmsg = "" for i in range(len(fieldNames)): if fieldValues[i].strip() == "": errmsg = errmsg + ('"%s" is a required field.\n\n' % fieldNames[i]) if errmsg == "": break # no problems found fieldValues = multpasswordbox(errmsg, title, fieldNames, fieldValues) user = fieldValues[0] password = fieldValues[1] chrome_options = webdriver.ChromeOptions() prefs = {'download.default_directory': dir_path} chrome_options.add_experimental_option('prefs', prefs) driver = webdriver.Chrome('Resources/chromedriver.exe',chrome_options=chrome_options) driver.get("http://idssprd.cusa.canon.com/") driver.find_element_by_name("user").send_keys(user) driver.find_element_by_name("password").send_keys(password) driver.find_element_by_name("login").send_keys(Keys.RETURN) driver.get("http://idssprd.cusa.canon.com/scripts/rds/cgirpts.exe") start = datetime.datetime.now() x = arange(2, 53, 1) counter = 0 try: while (True): for l in x: path_txt = '/html/body/form/center[1]/table/tbody/tr[2]/td[2]/table/tbody/tr[{0}]/td[4]/font'.format( l) path_dl = '/html/body/form/center[1]/table/tbody/tr[2]/td[2]/table/tbody/tr[{0}]/td[5]/font/a[4]'.format( l) elem = driver.find_element_by_xpath(path_txt) driver.find_element_by_xpath(path_dl).click() counter += 1 f_name = elem.text[16:24] + '_' + elem.text[25:33] + " - " + elem.text[0:7] + " to" + elem.text[ 7:15] next_btn = driver.find_element_by_xpath( '/html/body/form/center[1]/table/tbody/tr[1]/td[2]/a/img').click() except Exception as e: print("All Done!") time_rn = datetime.datetime.now() - start print("Total time to download", counter, "reports was", time_rn, "seconds.") print("Time right now is", datetime.datetime.now())
def main(): msg1 = "Welcome, please pick a cryptosystem." crypto_choices = ["Encryption", "Decryption"] crypto_mode = buttonbox(msg1, title, choices=crypto_choices) msg2 = "Please pick a crypto mode to use." cryptosystem_choicess = ["Affine Cipher", "Vigenere Cipher"] cryptosystem_mode = buttonbox(msg2, title, choices=cryptosystem_choicess) msg3 = "Would you like plaintext or cipher text?" text_choices = ["Plaintext", "Cipher text"] text_mode = buttonbox(msg3, title, choices=text_choices) msg4 = "Please enter your text and key." if cryptosystem_mode == 'Affine Cipher': field_names = ["Text", "A", "B"] field_values = multpasswordbox(msg4, title, field_names) # make sure that none of the fields was left blank while 1: if field_values is None: break errmsg = "" for i in range(len(field_names)): if field_values[i].strip() == "": errmsg = errmsg + ('"%s" is a required field.\n\n' % field_names[i]) if errmsg == "": break # no problems found field_values = multpasswordbox(errmsg, title, field_names, field_values) my_text = field_values[0] a = field_values[1] b = field_values[2] print("[Affine Cipher]") print('%s message' % (crypto_mode.title())) print(affine_cipher(a, b, my_text, crypto_mode, text_mode)) elif cryptosystem_mode == 'Vigenere Cipher': field_names = ["Text", "Key"] field_values = multpasswordbox(msg4, title, field_names) # make sure that none of the fields was left blank while 1: if field_values is None: break errmsg = "" for i in range(len(field_names)): if field_values[i].strip() == "": errmsg = errmsg + ('"%s" is a required field.\n\n' % field_names[i]) if errmsg == "": break # no problems found field_values = multpasswordbox(errmsg, title, field_names, field_values) my_text = field_values[0] my_key = field_values[1] print("[Vigenere Cipher]") print('%s message' % (crypto_mode.title())) print(vigenere_cipher(my_key, my_text, crypto_mode, text_mode))
def get_access_token(): data = {"grant_type": "client_credentials"} msg = "Please enter your client credentials and company base url.\nIf you need help finding your credentials, " \ "please visit:\n" \ "https://arthurosipyan.github.io/JamaScript/" field_names = ["Base URL", "Client ID", "Client Secret"] field_values = multpasswordbox(msg, title, field_names) # make sure that none of the fields was left blank while 1: if field_values is None: break errmsg = "" for i in range(len(field_names)): if field_values[i].strip() == "": errmsg = errmsg + ('"%s" is a required field.\n\n' % field_names[i]) if errmsg == "": break # no problems found field_values = multpasswordbox(errmsg, title, field_names, field_values) global access_token, base_url base_url = field_values[0] username = field_values[1] password = field_values[2] try: requests.post(base_url + "/rest/oauth/token", data=data, auth=(username, password)) except: msg = 'ERROR: Please enter the correct base url.' if ccbox(msg, title): get_access_token() else: exit() try: response = requests.post(base_url + "/rest/oauth/token", data=data, auth=(username, password)) access_token = response.json()['access_token'] user = response.json()['application_data']["JAMA_CORE"] global welcome welcome = ("Welcome, " + user) except KeyError: response = requests.post(base_url + "/rest/oauth/token", data=data, auth=(username, password)) msg = ( 'ERROR: Please enter the correct client credentials.\nSTATUS: ' + str(response.json()['status']) + ' ' + response.json()['error'] + '\n' + 'MESSAGE: ' + response.json()['message']) if ccbox(msg, title): get_access_token() else: exit()
def make_config_packing_station(self): packing_config = easygui.multpasswordbox( 'Connection data for Packing station', 'Packing Station', [ "DayReport2", "Folder", "Ip address packing station", "Name Packing station", "Login", "Password" ]) salt_key = int(datetime.timestamp(datetime.now())) name_file = packing_config[0] name_folder = packing_config[1] ip_address = packing_config[2] name_p_s = packing_config[3] cipher_login = encrypt(packing_config[4], str(salt_key)) cipher_password = encrypt(packing_config[5], str(salt_key)) print(cipher_password) encoded_cipher_login = b64encode(str(cipher_login).encode('utf-8')) encoded_cipher_password = b64encode( str(cipher_password).encode('utf-8')) url_file = '\\10.49.150.154\\History\\2018_11_15' if cipher_password != None: self.write_credentials(login=str(encoded_cipher_login), password=str(encoded_cipher_password), salt_key=salt_key, name_file=name_file, name_folder=name_folder, ip_address=ip_address, name_packing_station=name_p_s, url_file=url_file) else: logging.warning('Incorect data')
def new_account(): # Deze loop vraagt om aanmaakgegevens en herhaalt bij een verkeerd ingevoerd wachtwoord, anders returns invoer while True: cred_msg = "Voer je gegevens in" cred_title = "Accountgegevens" cred_fields = ["Loginnaam", "Wachtwoord"] cred_value = eg.multpasswordbox(cred_msg, cred_title, cred_fields) if cred_value in [None, False]: break else: dbentry = dbcheck(cred_value, "name") # Checkt de database op duplicaat if cred_value[0] in str(dbentry): eg.msgbox("Deze gebruikersnaam is al in... Gebruik.", cred_title) else: check_value = eg.passwordbox( "Herhaal je wachtwoord", cred_title) # Herhaal wachtwoord, kon niks anders bedenken if check_value in [None, False]: pass else: if cred_value[ 1] == check_value: # Hier gebeurt de magie van het opslaan van alle accountzooi in een lijst pwhash = gen_pass(str(cred_value[1])) dbinsert([cred_value[0], pwhash]) eg.msgbox( "Succes!\nAccount aangemaakt met de volgende gegevens:\n\nLoginnaam: {0}\nWachtwoord: {1}\nHex: {2}" .format(cred_value[0], cred_value[1], pwhash)) # DEL hash break else: eg.msgbox("Je wachtwoorden komen niet overeen!")
def load(cls): try: with open("Configuration/user.conf", "r") as f: data = f.read().split() user = User(data[0], data[1], data[2]) if not user.login(): return None user.set_private_key() return user except FileNotFoundError: if gui.ynbox( "Do you want to enter your credentials for an existing account? Otherwise you will be asked to register an account.", 'Existing Account?', ('Existing Account', 'Register new Account')): username, email, password = gui.multpasswordbox( "Enter account information:", 'Account', ['Username', 'Email', 'Password']) if username and email and password: user = User(username, email, password) if user.login(): user.save() user.set_private_key() return user else: terminate = gui.ynbox( "Could not login to specified account.", 'Login failed', ('Quit', 'Register new Account')) if terminate: CONN.close() quit() return None
def do_login(self, sc): """ 玩家登录界面 :param sc:传入的客户端套接字 :return: 玩家用户的权限和用户id """ msg = "请输入账号和密码" while True: title = "用户登录" user_info = g.multpasswordbox(msg, title, ["账号", "密码"]) if not user_info: break user_info_str = "".join(user_info) if len(user_info_str) == 0: continue else: data = "login" + "$" + "$".join(user_info) sc.send(data.encode()) mes = sc.recv(1024).decode() mes_list = mes.split("$") if mes_list[0] == "ok": return mes_list[1], user_info[0] elif mes_list[0] == "wrong": msg = "账号密码不符" continue else: msg = "账号不存在" continue
def set(self, setting): # set a setting pro = openKeyboard() if ('wifi' in setting): wifistate = isInternet() if (wifistate): wifistate = 'Connected' else: wifistate = 'Disconnected' username = easygui.enterbox( 'Enter New username', 'Wifi Username - ' + wifistate, ) newpass = easygui.multpasswordbox( 'Password', 'Enter your password - ' + wifistate, ['Save, Cancel']) closeKeyboard(pro) if (username == None or newpass == None): return False else: connect(username, newpass) return True if (not setting in self.config.keys()): return False val = easygui.enterbox( 'Enter Setting for ' + str(setting) + '. Currently ' + str(self.config[setting]), str(setting)) closeKeyboard(pro) if (val == None): return val self.config[setting] = val if (setting == 'upsi' or setting == "ltimeout" or setting == 'lpsi'): self.config[setting] = float(val)
def land(): global username, password number_of_time = 1 value = [] value = g.multpasswordbox(msg="Land( Press 'OK' to go to the next step )", fields=("Username : "******"Password : "******"哈哈只有这一步是中文,我是Cyg,这个程序是我一个人编写出来的,有什么报错给我说下哈,启动turing机器人") turing.turing() elif value[0] != now_username: choice = g.msgbox("Username error , do you want to tyr again?") if choice and number_of_time <= 2: number_of_time += 1 else: choice = g.ccbox(msg="Password error, do you want to try again?") if choice and number_of_time <= 2: number_of_time += 1 else: forpassword = g.ccbox(msg="Forget Password?", choices=("Yes", "No")) if forpassword: forget_password() else: g.msgbox("See you next time!")
def login(browser, cookies): if not path.exists(config["mechanize/cookie_jar"]): u, p = multpasswordbox("Enter your facebook credentials.", "Facebook Login", ["Email", "Password"]) credentials = { "email": u, "pass": p, "default_persistent": 1, "lsd": "aaaaaaaa", "charset_test": "%E2%82%AC%2C%C2%B4%2C%E2%82%AC%2C%C2%B4%2C%E6%B0%B4%2C%D0%94%2C%D0%84", "timezone": "240", "lgnrnd": "000000_0A0A", "lgnjs": int(time.time()), "local": "en_US", } browser.open("https://www.facebook.com/") r = browser.open("https://www.facebook.com/login.php?login_attempt=1", urlencode(credentials)) if r.code == 200: cookies.save(ignore_discard=True, ignore_expires=True) else: cookies.load(config["mechanize/cookie_jar"], ignore_discard=True, ignore_expires=True) fb_cookies = cookies._cookies[".facebook.com"]["/"] return fb_cookies["c_user"].value if "c_user" in fb_cookies else 0
def login_interface(self): while 1: title = '校团委实践部文件管理系统(demo@Fan)' msg = '请选择你的身份' choice = ('管理员', '游客') identity = g.ccbox(msg, title, choice) #管理员是TURE,游客是FALSE while (identity): msg = '请输入账号和密码' fields = ('账号', '密码') ret = g.multpasswordbox(msg, title, fields) if (ret == None): # 点击右上角的xx return 0 if ret != ['admin', '123456']: #现在暂时固定密码,之后可能会放到一个加密文件夹中 msg = '账号或密码输入错误,请选择重新输入还是返回上一步' choice = g.ccbox(msg, title, choices=('返回上一步', '重新输入')) if (choice == None): return 0 if (choice): break else: continue else: return 'admin' else: return 'tourist'
def multpassword(): msg = 'My dear customer,wellcome login !' title = 'login' fields = ('*用户名', '*密码', '安全码') #可以有多个,只有最后一个用户输入时是**** values = ('请在此处输出您的用户名', '请在此处输入您的密码', '安全码') m = g.multpasswordbox(msg, title, fields, values) print(m)
def login(): while True: login_msg = "Voer je gegevens in" login_title = "Logingegevens" login_fields = ["Login", "Wachtwoord"] login_value = eg.multpasswordbox( login_msg, login_title, login_fields, ) if login_value in [False, None]: break else: login_creds = [login_value[0], gen_pass(login_value[1])] dbname = dbcheck(login_creds, "name") dbdata = dbcheck(login_creds, "account") if dbname == None: eg.msgbox( "Geen geregistreerd account met de naam {0}.".format( login_creds[0]), login_title) elif dbdata == tuple(login_creds): eg.msgbox("Je bent ingelogd als {0}.".format(login_value[0]), "Gegevens") account_options(login_creds) break else: eg.msgbox("Fout wachtwoord ingevoerd.", login_title)
def setup_write(): auth = DEFAULT_AUTH_URL tenant = DEFAULT_TENANT user = USERNAME if _default_global_options['os_auth_url']: auth = _default_global_options['os_auth_url'] if _default_global_options['os_tenant_name']: tenant = _default_global_options['os_tenant_name'] if _default_global_options['os_username']: user = _default_global_options['os_username'] msg = "Enter the Swift connection settings" title = "OpenStack Swift Authentication" fieldNames = ["Swift Auth URL", "Swift Tenant Name", "User Name", "Password"] fieldValues = [auth, tenant, user, ""] fieldValues = easygui.multpasswordbox(msg,title, fieldNames, fieldValues) OS = sys.platform if OS == "linux2" or OS == "linux": return setup_write_linux(fieldValues) elif OS == "win32": return setup_write_win(fieldValues) elif OS == "darwin": return setup_write_mac(fieldValues) else: print("Could not detect your platform: '%s'" % OS) return setup_write_linux(fieldValues)
def main(): instruction() msg = "Enter your GMAIL Username and Password" title = "Welcome to CheckMail" fieldNames = [ "VirusTotal API key", "Gmail Username", "Gmail Password", ] fieldValues = [] #easygui box for password box to get the API key, gmail username and password! fieldValues = multpasswordbox(msg, title, fieldNames) emailid = fieldValues[1] password = fieldValues[2] api = fieldValues[0] latest_mail_uid = 0 while (1): try: uid = latest_mail_uid latest_mail_uid, from_addr, email_message = login( emailid=emailid, password=password) if latest_mail_uid > uid: get_first_text_block(email_message_instance=email_message, sender_addr=from_addr, api_key=api) create_report(from_addr=from_addr) time.sleep(1) except: continue
def login(browser, cookies): if not path.exists(config['mechanize/cookie_jar']): u, p = multpasswordbox("Enter your facebook credentials.", "Facebook Login", ["Email", "Password"]) credentials = { 'email': u, 'pass': p, 'default_persistent': 1, 'lsd': 'aaaaaaaa', 'charset_test': '%E2%82%AC%2C%C2%B4%2C%E2%82%AC%2C%C2%B4%2C%E6%B0%B4%2C%D0%94%2C%D0%84', 'timezone': '240', 'lgnrnd': '000000_0A0A', 'lgnjs': int(time.time()), 'local': 'en_US' } browser.open("https://www.facebook.com/") r = browser.open("https://www.facebook.com/login.php?login_attempt=1", urlencode(credentials)) if r.code == 200: cookies.save(ignore_discard=True, ignore_expires=True) else: cookies.load(config['mechanize/cookie_jar'], ignore_discard=True, ignore_expires=True) fb_cookies = cookies._cookies['.facebook.com']['/'] return fb_cookies['c_user'].value if 'c_user' in fb_cookies else 0
def send_email(): send_email = [] msg='请输入你的eamil地址和密码' title="你的email" field = ["*email地址", "*密码"] while True: #输入用户名和密码框,密码为不显示明文 send_email=easygui.multpasswordbox(msg, title,field) #点击取消退出测试 if send_email == None : print "退出自动化测试" sys.exit(0) #地址和密码都不输入,提示 elif send_email == ["",""]: easygui.msgbox("你必须输入email地址和密码!","错误") continue #地址为空,提示 elif send_email[0].strip()=="": easygui.msgbox("你必须输入email地址!","错误") continue #密码为空,提示 elif send_email[1].strip()=="": easygui.msgbox("你必须输入密码!","错误") else: break return send_email
def login(): global ADMIN x = easygui.multpasswordbox("Please enter your usr/pwd:", 'NOS_FILE', ("Username", "Password")) if x == None: sys.exit(401) if os.path.isfile('auth.key'): xObj = open('auth.key', 'r') xComp = xObj.readlines() usr = dec(xComp[1].strip(), int(xComp[0].strip())) pwd = dec(xComp[2].strip(), int(xComp[0].strip())) if x[0] == usr and x[1] == pwd: print("Auth complete!") else: print("Incorrect credentials.") sysExit(401) try: if dec(xComp[3].strip(),int(xComp[0].strip())) == 'admin': ADMIN = 1 print("Admin enabled!") else: ADMIN = 0 except: ADMIN = 0 return x[0] else: easygui.msgbox("No auth.key detected!") sys.exit(401)
def ask(message, title, host): field_names = [] if host == '': field_names.append("Etki Alanı Sunucusu:") field_names.append("Yetkili Kullanıcı") field_names.append("Parola") field_values = multpasswordbox(msg=message, title=title, fields=(field_names)) if field_values is None: return print('N') is_fieldvalue_empty = False for value in field_values: if value == '': is_fieldvalue_empty = True if is_fieldvalue_empty: msgbox("Lütfen zorunlu alanları giriniz.", ok_button="Tamam") return print('Z') if host == '': print(field_values[0], field_values[1], field_values[2]) else: print(field_values[0], field_values[1])
def get_user_credentials(): # show the user/password entry box msg = 'Enter Azure logon information' title = 'Azure subscription logon' field_names = ['Username', 'Subscription name', 'Password'] field_values = [] field_values = easygui.multpasswordbox(msg, title, field_names) while 1: for i in range(len(field_names)): errmsg = '' if field_values[i].strip() == '': errmsg = errmsg + ('"%s" is a required field.\n\n' % field_names[i]) if errmsg == '': break field_values = easygui.multpasswordbox(errmsg, title, field_names, field_values) return field_values
def askAtlasConnectionDetails(): #Asks for MongoDB Atlas details msg = "Enter the login details :" fieldNames = [ "Hosting server :", "Cluster ID :", "User ID :", "Password :" ] detailsList = eg.multpasswordbox(msg, title, fieldNames, atlasExamples) if detailsList is None: quit() return detailsList
def login_ui(): fields = ('使用者名稱:', '密碼:') msg = '請輸入使用者名稱和密碼' title = '登入' tmp = g.multpasswordbox(msg, title, fields) if not tmp: sys.exit(0) return tmp
def login(self): while True: msg = "Vul de gegevens van je Google-account in:" title = "youtube-follower" fieldNames = ["Gebruikersnaam", "Wachtwoord"] fieldValues = [] # we start with blanks for the values fieldValues = easygui.multpasswordbox(msg, title, fieldNames) while True: if fieldValues == None: break errmsg = "" for i in range(len(fieldNames)): if fieldValues[i].strip() == "": errmsg = errmsg + ('"%s" niet ingevuld.\n\n' % fieldNames[i]) if errmsg == "": break # no problems found fieldValues = easygui.multpasswordbox(errmsg, title, fieldNames, fieldValues) login_html = self.ses.get( 'https://accounts.google.com/ServiceLogin') soup_login = BeautifulSoup( login_html.content).find('form').find_all('input') my_dict = {} for u in soup_login: if u.has_attr('value'): my_dict[u['name']] = u['value'] # override the inputs without login and pwd: print my_dict my_dict['Email'] = fieldValues[0] my_dict['Passwd'] = fieldValues[1] self.ses.post('https://accounts.google.com/ServiceLoginAuth', data=my_dict) m = self.check_login() if m == None: if easygui.ynbox( 'Inloggen mislukt. Wil je het opnieuw proberen?', 'youtube-folower', ('Ja', 'Nee')): continue else: return m else: return m
def askOnlineConnectionDetails(): #Asks for online instance of MongoDB details msg = "Enter the login details :" fieldNames = [ "Server IP Address :", "Port Number:", "Database Name :", "User ID :", "Password :" ] detailsList = eg.multpasswordbox(msg, title, fieldNames, onlineExamples) if detailsList is None: quit() return detailsList
def registration(self): while True: auswahlAnmeldung = easygui.buttonbox("Wilkommen bei Schoollife", "Schoollife", ["Anmelden", "Registrieren"]) if auswahlAnmeldung == "Anmelden": anmeldedaten = easygui.multpasswordbox("Anmelden", "Schoollife", ["E-Mail", "Passwort"]) user = self.datenbase.readUser(anmeldedaten[0]) if (user is None): # User nicht in DB gefunden easygui.msgbox("User exestiert nicht") elif user["passwort"] != anmeldedaten[ 1]: # Passwort stimmt nicht mit DB ueberein easygui.msgbox("Falsches Passwort, haste gesoffen?") else: if user["freigeschaltet"] == "false": code = easygui.passwordbox( "Bitte Accoount freischalten", ["Bestaetigungscode:"]) print("code: " + code + " random: " + user["random"]) if code == user["random"]: user["freigeschaltet"] = "true" easygui.msgbox("Anmeldung war erfolgreich") self.datenbase.saveDatabase() else: easygui.msgbox("Falscher Bestätigungscode") return user elif auswahlAnmeldung == "Registrieren": registrierungsdaten = easygui.multenterbox( "REGISTRIEREN", "SCHOOLLIFE", [ "Nachname", "Vorname", "E-mail Adresse", "Passwort", "Passwort bestaetigen" ]) if registrierungsdaten[3] != registrierungsdaten[4]: easygui.msgbox("Passwoerter stimmen nicht uebernrin") elif self.datenbase.readUser(registrierungsdaten[2]) is not None: easygui.msgbox("Benutzer mit email exestiert schon!") else: code = str(random.randint(100000, 999999)) neuerUser = { "nachname": registrierungsdaten[0], "vorname": registrierungsdaten[1], "email": registrierungsdaten[2], "passwort": registrierungsdaten[3], "random": code, "freigeschaltet": "false" } self.datenbase.saveUser(neuerUser) self.email.send_registration_mail(registrierungsdaten[2], code) self.datenbase.saveDatabase() easygui.msgbox("Benutzer wurde erfolgreich angelegt!")
def signup_page(userData): msg = "Enter following details for signup" title = "SignUp Box" fieldNames = ["User Name",'Name',"Password"] fieldValues = [] # we start with blanks for the values fieldValues = easygui.multpasswordbox(msg,title, fieldNames) # make sure that none of the fields was left blank while 1: if fieldValues == None: break errmsg = "" if userData.check_username(fieldValues[0]) == False : errmsg = errmsg + ('"%s" username already taken\n' % fieldValues[0]) for i in range(len(fieldNames)): if fieldValues[i].strip() == "": errmsg = errmsg + ('"%s" is a required field.\n' % fieldNames[i]) if errmsg == "": break # no problems found fieldValues = easygui.multpasswordbox(errmsg, title, fieldNames, fieldValues) return fieldValues
def login_page(userData): msg = "Enter User Name and Password" title = "Login Box" fieldNames = ["User Name","Password"] fieldValues = [] # we start with blanks for the values fieldValues = easygui.multpasswordbox(msg,title, fieldNames) # make sure that none of the fields was left blank while 1: if fieldValues == None: break errmsg = "" if userData.check_username_pssword(fieldValues[0], fieldValues[1]) == False : errmsg = errmsg + ('Wrong Credentials\n') for i in range(len(fieldNames)): if fieldValues[i].strip() == "": errmsg = errmsg + ('"%s" is a required field.\n\n' % fieldNames[i]) if errmsg == "": break # no problems found fieldValues = easygui.multpasswordbox(errmsg, title, fieldNames, fieldValues) return fieldValues
def login(): fields = ('使用者名稱:', '密碼:') msg = '請輸入使用者名稱和密碼' title = '登入' tmp = g.multpasswordbox(msg, title, fields) if tmp == None: return "取消登入" else: iptAct, iptPwd = tmp if not islogin(iptAct, iptPwd): g.msgbox('密碼錯誤,請重新輸入!', ok_button='確定') login()
def __init__(self, tryNum=5): _LOGGING.info("UserLoginCheck init...") self.tryNum = tryNum self.dbconn = pymysql.connect(**DATABASE) self.cur = self.dbconn.cursor() self.login_username = '' # get host_name self.sys_username = getpass.getuser() _LOGGING.info("self.sys_username: "******"!!!\n\n\n有疑问请邮箱联系管理员杨志祥([email protected])!!!" self.msg = "请输入用户名和密码" self.title = "欢迎使用后台自动登录系统" self.fieldNames = ["用户名", "密码"] self.fieldValues = [] self.login_id_list = [] # step 1 : check mac self.mac = self.getMacAddress() # get or generate log table self.log_table_name = "amz_auto_login_log" errorMsg = self.checkMacInfo(self.mac) if errorMsg == "": # log into db self.log_to_db(self.sys_username, self.mac, 'checkMac', 'success', '') self.fieldValues = g.multpasswordbox(self.msg, self.title, self.fieldNames) if self.fieldValues is None: # log into db self.log_to_db(self.sys_username, self.mac, 'check user info', 'failed_8', 'no username or password inputed') sys.exit(0) else: # log into db self.log_to_db(self.sys_username, self.mac, 'checkMac', 'failed_5', errorMsg) self.fieldValues = g.msgbox(msg=errorMsg, title=self.title, ok_button="再见") close_attr(self, 'cur') close_attr(self, 'dbconn') sys.exit(0)
def LoadConfig(filename, route, reconfig=False): car = route ArchivoConfig = os.path.join(car, "", filename + '.txt') MiConfig = AppConfig(ArchivoConfig) MiConfig.restore() if MiConfig.host == '' or MiConfig.dbname == '' or MiConfig.user == '' or MiConfig.password == '' or reconfig: host = decrypt(MiConfig.host) dbname = decrypt(MiConfig.dbname) user = decrypt(MiConfig.user) password = decrypt(MiConfig.password) tipo = decrypt(MiConfig.tipo) lectura = decrypt(MiConfig.lectura) escritura = decrypt(MiConfig.escritura) sitio_externa = decrypt(MiConfig.sitio_externa) campos = [ 'Host', 'Nombre DB', 'Usuario', 'Tipo de Base(PG/FM)', 'Lectura(True/False)', 'Escritura(True/False)', 'Sitio/Externa(S/E)', 'Password' ] data = [ host, dbname, user, tipo, lectura, escritura, sitio_externa, password ] msg = eg.multpasswordbox(msg='Set data base information', title='Config File Data', fields=campos, values=data) MiConfig.host = encrypt(msg[0]) MiConfig.dbname = encrypt(msg[1]) MiConfig.user = encrypt(msg[2]) MiConfig.lectura = encrypt(msg[4]) MiConfig.escritura = encrypt(msg[5]) MiConfig.sitio_externa = encrypt(msg[6]) MiConfig.password = encrypt(msg[7]) MiConfig.tipo = encrypt(msg[3]) MiConfig.relative_name = encrypt(filename) MiConfig.store() MiConfig.restore() MiConfig.lectura = decrypt(MiConfig.lectura) MiConfig.escritura = decrypt(MiConfig.escritura) MiConfig.password = decrypt(MiConfig.password) MiConfig.host = decrypt(MiConfig.host) MiConfig.dbname = decrypt(MiConfig.dbname) MiConfig.user = decrypt(MiConfig.user) MiConfig.tipo = decrypt(MiConfig.tipo) MiConfig.sitio_externa = decrypt(MiConfig.sitio_externa) MiConfig.relative_name = decrypt(MiConfig.relative_name) return MiConfig
def param(): msg="Entrez les infos:" title="Parametrage du socket" champs=["Hote","Port","Mot de passe"] defaultvalues=["127.0.0.1","80",""] #defaultvalues=["172.21.30.31","80",""] valeurs_des_champs=eg.multpasswordbox(msg,title,champs,defaultvalues) H = valeurs_des_champs[0] P = int(valeurs_des_champs[1]) return(H,P)
def loginGUI(): global username global password msg = "Enter MyFitnessPal Login Information" title = "Log In" fieldNames = ["Username", "Password"] fieldValues = [] fieldValues = multpasswordbox(msg, title, fieldNames) # make sure each field gets an input while 1: if fieldValues is None: break errmsg = "" for i in range(len(fieldNames)): if fieldValues[i].strip() == "": errmsg = errmsg + ('"%s" is a required field.\n\n' % fieldNames[i]) if errmsg == "": break # no problems found fieldValues = multpasswordbox(errmsg, title, fieldNames, fieldValues) username = fieldValues[0] password = fieldValues[1]
def youxi(): while 1: ass = '用户' can = '密码' s = g.multpasswordbox('请输入你的账号和密码', '账号输入', [ass, can]) if s[0] == '3117004628' and s[1] == '123': g.msgbox('欢迎来到你的专属sex空间~~~', ok_button='oh~yeah~') break else: g.msgbox('输入错误,无法享受sex空间!') #猜数字 g.msgbox('来玩个猜数字游戏吧~,猜对了才有福利哦', '猜数字', '嗯?!') g.msgbox('警告:该游戏只能玩三次,三次不过的话就没福利了!!!', '猜数字', ok_button='好的,我知道了!') ass = g.integerbox(msg='请输入1~10任一个数字', lowerbound=1, upperbound=10) shu = a.randint(1, 10) i = 0 while 1: if shu > ass: g.msgbox('小了小了~', ok_button='知道了') i += 1 ass = g.integerbox(msg='请输入1~10任一个数字', lowerbound=1, upperbound=10) elif shu == ass: g.msgbox('猜对咯!') break elif shu < ass: g.msgbox('大了大了!', ok_button='知道了') i += 1 ass = g.integerbox(msg='请输入1~10任一个数字', lowerbound=1, upperbound=10) else: if i == 2: g.msgbox('与福利擦身而过了,下次加油吧', ok_button='知道了') sys.exit(0) #通过游戏,提问考验 sea = g.buttonbox('你渴望奈子么??', '选择吧,让我听到你的心声!', image='gg.gif', choices=('是的!', '额..(⊙o⊙)其实我更喜欢屁股~')) if sea == '是的!': g.msgbox('恭喜你!获得奈子!') we = g.buttonbox('怎么样?', image='sex1.gif', choices=('还可以', '我觉得不行!')) if we == '我觉得不行!': g.msgbox('滚犊子!再见!', '恩~,不要嘛~') sys.exit(0) else: g.msgbox('祝你身体愉快,生活健康,再见~', '我还想要怎么办???') sys.exit(0) else: g.msgbox('再见,没有福利了!', '...其实奈子是不错的!!') sys.exit(0)
def prompt_login (self): msg = "QUIZLET LOG IN" form_q = ['Username', 'Password'] while (True): user_info = eg.multpasswordbox(msg, self.window_name, form_q) if user_info: self.app = AQ.AutoApp(user_info) if self.app.login(): break else: msg= 'Incorrect username/password' else: exit(1)
def GetDSNPassword(): msg = "Enter logon information" title = "DSN Info" fieldNames = ["User ID", "Password"] fieldValues = [] # we start with blanks for the values fieldValues = easygui.multpasswordbox(msg,title, fieldNames) # make sure that none of the fields were left blank while 1: if fieldValues == None: break errmsg = "" for i in range(len(fieldNames)): if fieldValues[i].strip() == "": errmsg = errmsg + ('"%s" is a required field.\n\n' % fieldNames[i]) if errmsg == "": break # no problems found fieldValues = multpasswordbox(errmsg, title, fieldNames, fieldValues) return fieldValues
def login(): s = None fn = cookie('nessus') if not path.exists(fn): f = fsemaphore(fn, 'wb') f.lockex() fv = ['localhost', '8834'] errmsg = '' while True: import sploitego.hacks.gui fv = multpasswordbox(errmsg, 'Nessus Login', ['Server:', 'Port:', 'Username:'******'Password:'******'host' : fv[0], 'port' : fv[1], 'token': s.token}))
def login(): global current_user # Data to be displayed in the window: message, title, login labels and inputs msg = "Hello and welcome to the App!" title = "Real Estate App" fieldNames = ["Email", "Password"] fieldValues = [] form = eg.multpasswordbox(msg, title, fieldNames) login = 1 while login == 1: if form == None: break errmsg = "" for i in range(len(form)): # make sure that none of the fields were left blank if form[i].strip() == "": errmsg = errmsg + ('"%s" is a required field.\n\n' % fieldNames[i]) # otherwise, proceed to authentication if errmsg == "": entered_email = form[0] entered_pass = form[1] users = db.get_from_db("SELECT cust_email, password, cust_id, fname, lname FROM customer") # this can be improved to be less inefficient # Check if the email is if the users table for usr in users: email = usr[0] password = usr[1] user_id = usr[2] fname = usr[3] lname = usr[4] if email == entered_email: if entered_pass == password: # Create a new user instance for use later. current_user = User(user_id, fname, lname) login = 0 # stops the login process # If the user has been authenticated, we let them know now via a message: msg = "Thank you for logging in, " + current_user.name() + " \n Press ok to get started." eg.msgbox(msg)
def login(): global current_user #Data to be displayed in the window: message, title, login labels and inputs msg = "Hello and welcome to the App!" title = "Real Estate App" fieldNames = ["Email", "Password"] fieldValues = [] #Loop until user is authenticated/until login = 0 login = 1 while login == 1: form = eg.multpasswordbox(msg,title, fieldNames) entered_email = form[0] entered_pass = form[1] #Uses the get_from_db function that is equivalent to execute #This query returns a list of email, password, cust_id, and full name from customer table where the email is the same as the entered email user = db.get_from_db("SELECT cust_email, password, cust_id, fname, lname FROM customer WHERE cust_email =" + "'"+str(entered_email)+"'") #Get_from_db function returns a list of rows which consist of a single row; inside row are fields from select statement #User email and password verification if user: email = user[0][0]; #User is a list inside of a list of users password = user[0][1] user_id = user[0][2] fname = user[0][3] lname = user[0][4] if (email == entered_email): if (password == entered_pass): current_user = User(user_id, fname, lname) login = 0 #If the user has been authenticated, we let them know now via a message: msg = "Thank you for logging in, " + current_user.name() + "."+" \n Press ok to get started." eg.msgbox(msg) menu() else: #If the user uses the incorrect password, we let them know via a message: msg = "Wrong password." b = list(user) #Check to see if the SQl query returns anything that matches specific email/password combination #Check to see if credentials match the database if (len(b) <= 0): #If there is nothing in the user list, there is no email and password combination in the database #If the user inputs an incorrect email and password combination, we let them know via a message: msg = "No such email and password combination."
def main(): #____________________ Username and password ________________________ Username, Password = eg.multpasswordbox(msg = "Enter your username and password", title = "2013iowavcm Database log in", fields = ["Username: "******"Password: "******"isis.roadview.com", Username, Password, "2013iowavcm") #___________Get the file path for the CSV file from the workstation __________________ Tk().withdraw() #Not a full GUI so we take this part out. A random box pops up without this line. Maybe easygui next time for the input. titlePrep = "Choose your Measurement Table CSV File" messagePrep = "This script will fix the Measurement Table's CSV file from Workstation for the delivery to Iowa." filePath = askopenfilename(title = titlePrep, message = messagePrep) #This will open a folder for the user to open a file. #__________________ Create the new text csv file name __________________ csv_text_file_name = os.path.basename(filePath) basename = os.path.basename(csv_text_file_name).rsplit('.', 1) newtextcsv = os.path.join(os.path.dirname(filePath), ".".join([basename[0]+ "_new", basename[1]])) #__________________ Open the original Measurement table file __________________ textCSV = readCSV(filePath) textCSV.pop(0) # take out that first line. newtextcsvfile = open(newtextcsv, "w") #first row in the CSV file: newtextcsvfile.write("VC_ID, Structure_Number, Struccode, Latitude, Longitude, Direction, LEP_Vertical_Clearance_FT, LEP_Vertical_Clearance_IN, Lane_1_Vertical_Clearance_FT, Lane_1_Vertical_Clearance_IN, Lane_2_Vertical_Clearance_FT, Lane_2_Vertical_Clearance_IN, Lane_3_Vertical_Clearance_FT, Lane_3_Vertical_Clearance_IN, Lane_4_Vertical_Clearance_FT, Lane_4_Vertical_Clearance_IN, Lane_5_Vertical_Clearance_FT, Lane_5_Vertical_Clearance_IN, Lane_6_Vertical_Clearance_FT, Lane_6_Vertical_Clearance_IN, Lane_7_Vertical_Clearance_FT, Lane_7_Vertical_Clearance_IN, Lane_8_Vertical_Clearance_FT, Lane_8_Vertical_Clearance_IN, REP_Vertical_Clearance_FT, REP_Vertical_Clearance_IN, Oversize_Horizontal_Clearance_FT, Oversize_Horizontal_Clearance_IN, Posted_Height_FT, Posted_Height_IN, Date_Processed, Date_Collected, Invalid_Struccode") newtextcsvfile.write('\n') # new line after the header #______________________Write the rest of the lines based off of the rows in the textCSV file (Measurement Table)__________________________ for row in textCSV: Structure_Number = (row[0]) Struccode = (row[1]) statement = "SELECT VC_ID FROM iowa_structures WHERE FHWANUM = '" + Structure_Number + "' AND STRUCCODE = '" + Struccode + "'" queryreturn = sqlToList(statement, db)[0] #get the only item in the list. newtextcsvfile.write(str(queryreturn)) # write in the VC_ID number newtextcsvfile.write(" , " + Structure_Number) # write it to the file newtextcsvfile.write(" , " + Struccode) newtextcsvfile.write(" , " + row[6]) # Latitude newtextcsvfile.write(" , " + row[7]) # Longitude newtextcsvfile.write(" , " + row[8]) # Direction # Lane heights in FT and IN for colnum in range(15, 25): # range stops before the last number. (the colnums only go up to 24.) if row[colnum] == "": newtextcsvfile.write(" , " + " ") newtextcsvfile.write(" , " + " ") else: feet = row[colnum].split('.', 1)[0] inches = float("0." + row[colnum].split('.', 1)[1])*12 newtextcsvfile.write(" , " + str(feet)) newtextcsvfile.write(" , " + str(inches)) # Oversize_Horizontal_Clearance_FT and IN if row[13] == "": newtextcsvfile.write(" , " + "") newtextcsvfile.write(" , " + "") else: feet = row[13].split('.', 1)[0] inches = float("0." + row[13].split('.', 1)[1])*12 newtextcsvfile.write(" , " + str(feet)) newtextcsvfile.write(" , " + str(inches)) newtextcsvfile.write(" , " + row[9]) # Posted_Height_FT newtextcsvfile.write(" , " + row[10]) # Posted_Height_IN newtextcsvfile.write(" , " + row[11]) # Date Processed newtextcsvfile.write(" , " + row[12]) # Date Collected newtextcsvfile.write(" , " + row[3]) # Invalid_Struccode newtextcsvfile.write('\n') newtextcsvfile.close() eg.msgbox(msg = "Measurement Table Completed", title = "Measurement Table")
# to a CSV ########################################################################################### # Initilize gui, get values from user # imports import easygui as eg import re msg = "This program will grab links from the body and sidebars, test them, and store the information in a CSV in the C:\scraper directory." title = "Link Scraper/Tester v. 0.5" fieldNames = ["Google Docs Spreadsheet URL","U-M email address (ex. [email protected])","Name of output file (must end in .csv)","CMS Password"] fieldValues = [] # we start with blanks for the values fieldValues = eg.multpasswordbox(msg,title, fieldNames) # make sure that none of the fields was left blank while 1: # do forever, until we find acceptable values and break out errmsg = "" if fieldValues == None: break # look for errors in the returned values for i in range(len(fieldNames)): if fieldValues[i].strip() == "": errmsg = errmsg + ('"%s" is a required field.\n\n' % fieldNames[i]) if errmsg == "": break # no problems found
import easygui as g import sys import random g.multpasswordbox(msg="请输入您的信息:",title="猜数字游戏",fields=("用户名","密码"),values="") choice=("简单","中级","难","超级难") g.buttonbox(msg="请选择游戏等级:",title="游戏等级",choices=choice) # b=100 # if g.buttonbox(choices=choice(o)): # b=10 # elif g.buttonbox(choices=choice(1)): # b=50 # elif g.buttonbox(choices=choice(2)): # b=100 # elif g.buttonbox(choices=choice(3)): # b=1000 secret=random.randint(0,1000) while True: while True: temp=g.integerbox(msg="请输入一个数字: ",title="猜数字",default="",lowerbound=0,upperbound=1000) guess=int(temp) if guess > 1000 or guess < 0: g.msgbox(msg="输入不合法。请重新输入!",title="输入有误",ok_button="确定") else: break if guess == secret: g.msgbox(msg="太厉害啦,你居然猜对啦!",title="congratulations!",ok_button="你好棒!") g.choicebox(msg="要不要再玩一次?",title="继续游戏",choices=("好呀好呀","不用啦,谢谢!")) if g.ccbox(): pass
cursor=(cursor[0]+(opos[0]-pos[0]),cursor[1]+(opos[1]-pos[1])) last_d_time=0 mpos=(0,0) rcm="x" rcmp=(0,0) rcmh=0 try: font=pygame.font.Font(None,16) login=easygui.multpasswordbox("Login","Hyperspace",["Username","Password"]) cursor = (600,(768/2)) screen = pygame.display.set_mode((1200,768),0*FULLSCREEN) heart=pygame.image.load("images/hp.png").convert_alpha() bolt=pygame.image.load("images/energy.png").convert_alpha() cs=pygame.image.load("images/cursor.png").convert_alpha() imgs={"images/earth.png":pygame.transform.scale(pygame.image.load("images/earth.png").convert_alpha(),(256,256))} ships_i=[pygame.image.load("images/ship1.png").convert_alpha()] stations_i=[pygame.transform.scale(pygame.image.load("images/station1.png").convert_alpha(),(256,256))]
answer = box.buttonbox("Do you want to continue", "Prompt", choices) # 3. Dette behandler return fra buttonbox def continue_program(a): while 1: if a == "Yes": break elif a == "No": sys.exit() elif a == "Maybe": box.msgbox("Make up your mind you damned fool!") a = box.buttonbox("Do you want to continue", "Prompt", choices) continue_program(answer) scr.bye() # 1. Messagebox med endret ok_knapp box.msgbox("Backup complete!", ok_button="Good job!") # 4, 5 og 6 - inputbokser box.enterbox("Enter your name: ", "Facebook") box.integerbox("Enter your age: ", "Facebook") box.multenterbox("More info: ", "Facebook", ["Your weight", "Your status", "your employment"]) # 7. Passordboks - Siste feltet blir regnet som passordfeletet box.multpasswordbox("Insert username and password", "Facebook", ["Username: "******"Password: "])
# ------------------------------------------------- # For subclasses of EgStore, these must be # the last two statements in __init__ # ------------------------------------------------- self.filename = filename # this is required self.restore() # restore values from the storage file if possible ftpServ = ftpData(os.path.join("ftp.ui")) if not ftpServ.ftpSet: turnOn = easygui.ynbox("Would you like to sync music with an FTP server?", "FTP Server") ftpServ.ftpOn = turnOn ftpServ.ftpSet = True if ftpServ.ftpOn: ftpInfo = easygui.multpasswordbox("Please enter the FTP server details. Please note that the FTP account must have read / write permissions. Anonymous is not supported.", "FTP Server Configuration", ["IP Address", "Username", "Password"], [str(ftpServ.ftpHost), str(ftpServ.ftpUser), str(ftpServ.ftpPass)]) if ftpInfo is not None: ftpServ.ftpHost = ftpInfo[0] ftpServ.ftpUser = ftpInfo[1] ftpServ.ftpPass = ftpInfo[2] else: ftpServ.ftpOn = False ftpServ.ftpSet = False def traverse(ftp, depth=0): # many thanks to abbott at # http://stackoverflow.com/questions/1854572/traversing-ftp-listing """ return a recursive listing of an ftp server contents (starting from the current directory)
self.filename = filename self.restore() connSettings = ServerDetails("conn.xe") pre = [ connSettings.nickname, connSettings.ip, connSettings.port, connSettings.channel, connSettings.password ] details = easygui.multpasswordbox("Please enter IRC Connection Details. \ Settings marked with an asterisk (*) are required.", "Connect to IRC.", ["Your Nickname (*)", "Server Address (*)", "Server Port (*)", "Channel (*)", "NickServ Password"], pre) if details is None: sys.exit(0) connSettings.nickname = details[0] connSettings.ip = details[1] connSettings.port = int(details[2]) connSettings.channel = details[3] connSettings.password = details[4] connSettings.store() botnick = connSettings.nickname