def creation(username): error = True while error: has = 0 for i in range(0, len(os.listdir())): if os.listdir( )[i] == username: #if the username matches a folder or the admin's password file, you have to try again has += 1 if os.listdir()[i] == 'adminpass.txt' and username == "admin": has += 1 if has == 0: error = False elif has >= 1: print("user already exists") error = True while error: password = getpass.getpass('password > ') againpass = getpass.getpass( "confirm password > " ) #you have to confirm your password if you're making a new one if password == againpass: login(username, password, "create") #if the passwords match, the program moves on error = False elif password != againpass: print("\nsomething went wrong, please try again\n" ) #you have to enter your password until you get it password = getpass.getpass("password > ") againpass = getpass.getpass("confirm password > ")
def go_to_your_content(driver, wait): # Login link_text_content = "Your Content" login(driver, wait, link_text_content) # Go to Your Content driver.find_element_by_link_text(link_text_content).click()
def reg(): global a,b,c,d,e,f a=str(e1.get()) b=e2.get() c=str(e3.get()) d=str(e4.get()) e=str(e5.get()) f=str(e6.get()) g=str(e7.get()) h=str(e8.get()) if f!=g: t=tkMessageBox.showinfo("Alert","Error occurred!!!!!!!! Please Use same password for confirmation") else: file1=open("name.txt","w") file1.write(a) file1=open("reg.txt","w") file1.write(b) file1=open("section.txt","w") file1.write(c) file1=open("email.txt","w") file1.write(e) file1=open("password.txt","w") file1.write(f) file1=open("security.txt","w") file1.write(h) t=tkMessageBox.showinfo("alert","Successfully registered") file1.close() login()
def login(): for i in range(3): username = input("pls enter your username: "******"pls enter pass: "******"Welcome ") break else: print("Username and passwored not recognised") again = input("Do u want to try again?(y/n): ") if again.lower() == "n": print("Good Bye") time.sleep(1) break
def return_login(): ''' 再建窗口 ''' sleep(1) log = Gui() gui.close() login(log,mysql)
def test_content_wrong(): with webdriver.Chrome() as driver: wait = WebDriverWait(driver, 10) # Login login(driver, wait, "Your Content") # Go to Your Content - intentional fail driver.find_element_by_link_text("Your Not Content Ha Ha").click()
def post(self, request): form = UserAuthenticateForm(request.POST) if form.is_valid(): user = authenticate(username=form.cleaned_data['username'], password=form.cleaned_data['password']) if user is not None: login(request, user) return redirect('main') else: return redirect('login')
def post(self,request): form = RegistroForm(request.POST) username = request.POST.get('usuario') password = request.POST.get('contra') if form.is_valid(): form.save() user = authenticate(username=username, password=password) login(request,user) return redirect('/') else: return redirect('/registro')
def initialise(): ''' This function is the starting page of the software return type - none ''' option_type = get_option() if option_type == 1: login() else: create_new_account()
def main(): login() #stats_get() //*[@id="userMenu"]/ul/li[1]/a album_element = driver.find_element_by_xpath(r"//*[@id='libraryMenu']/a") root_album_url = album_element.get_attribute('href') album_list = album_list_get(root_album_url) print("Album url list:",album_list) albums_download(album_list)
def run(settings): sid=login(settings['region'],settings['user'],settings['password'],settings['one_time_password']) (settings['actual_sid'],settings['version']) = get_actual_sid(sid,settings['path']) launch = gen_launcher_command(settings) for i in launch: print(i,end=' ') subprocess.run(launch)
def login_endpoint(): data = request.json try: return login(data["email"], data["password"]) except: return {"status": "failed"}
def user_input(): nacom_input = input() if nacom_input == 'nacom --help': help() if nacom_input == 'nacom register': import register register() if nacom_input == 'nacom login': import login login() if nacom_input == 'nacom logout': import signout signout() user_input()
def login_func(): date = datetime.now().date() #Now get rid of seconds and microseconds component: not_exist, not_uni, email, name, university, debug_mode = login(app_DB) if debug_mode: return render_template('index.html', year=datetime.now().year, not_uni=not_uni, not_exist=not_exist, debug_mode=debug_mode, email=email, username=name) if not_exist is False and not_uni is False: return render_template('menu.html', year=datetime.now().year, date=date, university=university, email=email, username=name, title='Menu') else: return render_template('index.html', year=datetime.now().year, not_uni=not_uni, not_exist=not_exist, email=email)
def get(context, name): lims = login(context) for row in context.table: samples = lims.get_samples(name=row['name']) assert len(samples) > 0 return samples
def replace_note_by_id(): #replaces a note's content in ArchivesSpace using a persistent ID values = login() csvfile = opencsv() txtfile = opentxt() dirpath = setdirectory() for row in csvfile: record_uri = row[4] persistent_id = row[5] proposed_note_text = row[1] try: resource_json = requests.get(values[0] + record_uri, headers=values[1]).json() outfile = openjson(dirpath, record_uri[1:].replace('/','_')) json.dump(resource_json, outfile) for note in resource_json['notes']: if note['jsonmodel_type'] == 'note_multipart': if note['persistent_id'] == persistent_id: note['subnotes'][0]['content'] = proposed_note_text resource_data = json.dumps(resource_json) resource_update = requests.post(values[0] + record_uri, headers=values[1], data=resource_data).json() print(resource_update) if 'error' in resource_update.keys(): txtfile.write('error: could not update ' + str(resource_uri) + '\n') txtfile.write('log: ' + str(resource_update.get('error')) + '\n') print(resource_update) except Exception as exc: print('Something went wrong. Could not update ' + str(record_uri)) print(traceback.format_exc()) print(exc) txtfile.write('Something went wrong. Could not update ' + str(record_uri) + '\n') txtfile.write(str(traceback.format_exc()) + '\n') txtfile.write(str(exc) + '\n') continue txtfile.close()
def menu(): logged = False while True: if logged == False: try: selection = int(input("1. LOGIN\n" "2. SEARCH\n")) except: print("INVALID SELECTION!") exit() if selection == 1: manager = login() log = manager.log() if log: logged = True else: employee.Employee.specEmployee(employee) else: try: selection = int( input("1. CREATE EMPLOYEE\n" "2. CREATE MANAGER\n" "3. DELETE EMPLOYEE\n" "4. DELETE MANAGER\n")) except: print("INVALID SELECTION!") exit()
def __init__(self, root): self.root = root generate_starting_sqlTables = startingSQLTables() self.log = login(self.root, self) self.tkcalendar = None self.root.configure(background="white") self.color = "#2b2727"
def createnewsamples(context, sample_name, container_name, project_name): containers = create_containers(login(context), len(context.table.rows), container_name) project = get_project(login(context), project_name) samples = [] i = 0 for row in context.table: samples.append(generate_sample(login(context), project, containers[i], "1:1", row)) i += 1 assert len(samples) == len(context.table.rows) assert len(samples) == len(containers)
def admin_menu(): system('cls') print('Welcome To Admin Pannel') while True: print("Enter Your Choice") print("\n\n\t1. Register New User") print("\n\n\t2. Login Existing User") print("\n\n\t3. Exit") option = int(input()) if option == 1: system('cls') signin() if option == 2: system('cls') login() else: break
def get(context, LIMSid): lims = login(context) for row in context.table: project = Project(lims, id=row['LIMSid']) assert project is not None print(project) assert project.udf.items() is not None print(project.udf.items()) return project
def get(context, LIMSid): lims = login(context) for row in context.table: artifacts = lims.get_artifacts(samplelimsid=row['LIMSid']) assert artifacts is not None artifacts = lims.get_batch(artifacts) assert artifacts is not None for artifact in artifacts: print(artifact, artifact.name, artifact.state)
def get_all(context): lims = login(context) artifacts = lims.get_artifacts() assert len(artifacts) > 0 print(len(artifacts), 'total artifacts') artifacts = lims.get_batch(artifacts) assert artifacts is not None for artifact in artifacts: print(artifact, artifact.name, artifact.state)
def get(context, LIMSid): api = login(context) process = Process(api, id=LIMSid) print(process, process.id, process.type, process.type.name) for input, output in process.input_output_maps: if input: return input.items() if output: return output.items()
def run(settings): sid = login(settings['region'], settings['user'], settings['password'], settings['one_time_password']) (settings['actual_sid'], settings['version']) = get_actual_sid(sid, settings['path']) launch = gen_launcher_command(settings) for i in launch: print(i, end=' ') subprocess.run(launch)
def generate_main_window(self): self.log = login(self.root, self) if self.log.is_user_logged_in: self.tkcalendar = TkinterCalendar(self.root, self.log.user_info["username"]) self.show_Cal() self.show_left_navigation() else: self.log.show_login_page()
def user_login(): if request.method == 'POST': if validate_json(request.data): return login(request.data) else: error = 'Invalid input data' return error else: error = 'Only accepts POST method' return error
def isLogin(): global username, password, email, cookie username = userInfo.get("username") password = userInfo.get("password") email = userInfo.get("email") if login(username, password): cookie = getCookie() return True else: return False
def get(context, qc_status): lims = login(context) for row in context.table: artifacts = lims.get_artifacts(qc_flag=row['qc_status']) print(len(artifacts)) #context.artifacts = artifacts assert len(artifacts) > 0 artifacts = lims.get_batch(artifacts) assert artifacts is not None for artifact in artifacts: print(artifact, artifact.name, artifact.state)
def get(context): lims = login(context) samples = lims.get_samples() assert len(samples) > 0 # sample = samples[0] submitter, artifact = [], [] for sample in samples[:2]: submitter.append(sample.submitter) artifact.append(sample.artifact) return submitter, artifact
def get(context, LIMSid): lims = login(context) for row in context.table: project = Project(lims, id=row['LIMSid']) samples = lims.get_samples(projectlimsid=project.id) assert len(samples) > 0 sample = samples[0] assert sample is not None return len( samples ), project, sample.id, sample.name, sample.date_received, sample.uri
def getAllFriendsInfoAct(): #1.登陆 passportDict = getPassWd() (hostName, hostId, s, fDict) = login(passportDict) #2.获取朋友列表 fDict = getFriends(s, fDict) #3.保存好友信息,删除自己 del fDict[hostName] getAllFriendsInfo(tmpDir, imgDir, hostName, fDict)
def execute(): token = login() graph = facebook.GraphAPI(token) profile = graph.get_object("me") permissions = graph.get_connections("me", "permissions") permission_list = [p['permission'] for p in permissions['data']] # Get friends (in util.py) #dumpFriendlist(graph, "friends.txt") # Get groups (in util.py) #dumpGrouplist(graph, "groups.txt") # Get uploaded photos dumpPhotos(graph, "my_photo_corpus_uploaded",5000)
def __init__(self, email, password, d = True): self.token = login(email, password) self.d = d
def main(argv): loginType = 0 accounts = [] transactions = [] deletions = [] withdrawals = {} if (not len(argv) == 2): return # Infinite loop for receiving input. while True: command = input() # Disallow any actions until login. if (not loginType and command != 'login'): print "Error, please login before entering other commands." # Disallow multiple logins. elif (loginType and command == 'login'): print "You are already logged in." # Execute login elif command == 'login': loginType = login(accounts, argv[0]) # Execute logout elif command == 'logout': loginType = logout(transactions, argv[1]) # Disallow create in retail mode elif loginType == 2 and command == 'create': print "Error, please use agent mode to create accounts." # Execute create elif command == 'create': create(accounts, deletions, transactions) # Disallow delete in retail mode elif loginType == 2 and command == 'delete': print "Error, please use agent mode to delete accounts." # Execute delete elif command == 'delete': delete(accounts, deletions, transactions) # Execute deposit elif command == 'deposit': deposit(loginType, accounts, deletions, transactions) # Execute withdraw elif command == 'withdraw': withdraw(loginType, accounts, deletions, transactions, withdrawals) # Execute transfer elif command == 'transfer': transfer(loginType, accounts, deletions, transactions) else: print "Error, command not recognized." if loginType == 0: withdrawals = {} deletions = []
def main(): login()
m2m_mid = str(uuid.getnode()) f_content='class login:\r\n def __init__(self):\r\n self.pw="'+m2m_pw+'"\n self.mid="'+m2m_mid+'"\n' rw() file=open(os.path.join(os.path.dirname(os.path.realpath(__file__)),"login.py"),"w") file.write(f_content) file.close() return (m2m_mid,m2m_pw) ###################### try import login ####################### register_mode=0 if(os.path.isfile(os.path.join(os.path.dirname(os.path.realpath(__file__)),"login.py"))): from login import * l = login() # login m2m_pw=l.pw p.rint("STARTUP, login.py found, password loaded","l") try: p.rint("STARTUP, login.py found, mid loaded","l") m2m_mid = l.mid except: p.rint("STARTUP, login.py without mid loaded, create new one","l") (m2m_mid,m2m_pw) = create_login("", m2m_pw) else: register_mode=1 # first time connection, create a password and send it to the server (m2m_mid,m2m_pw) = create_login("", "") p.rint("STARTUP, no login.py found, running in register mode","l")
def __init__(self, email, password, d = True): logger.debug('__init__') self.token = login(email, password) self.d = d
def testLength_passwordLengthNine(self): oLogin = login() oLength = oLogin.length_password("pa$$w0rD.") # longitud 9 self.assertEqual(9,oLength)
def testEncriptLengthEightNotSpecialCharacters(self): oLogin = login() oHash = oLogin.encript("1F09irA2") # longitud 8 sin caracteres especiales self.assertEqual("",oHash)
from bs4 import BeautifulSoup import time import Image from pytesser import pytesser import os import json from globalVal import * from login import * from get_answer import * if __name__=="__main__": login() while True: #qID = raw_input("Question ID: ") get_answer("37167038") break
#!/usr/bin/python #-*-coding:utf-8-*- import httplib,urllib,json,os,Queue,time; #加载模块 from login import * from pub import * from song import * s = songs(login()) #测试打印歌单 print s.song_lists.qsize() while not s.song_lists.empty(): song = s.song_lists.get() print song['title'],song['like'] sid = song['sid'] if s.song_lists.qsize() < 1: s.flushSongList(sid)
def testLength_passwordOnlySpaces(self): oLogin = login() oLength = oLogin.length_password(" ") self.assertEqual(3,oLength)
def testCheck_passwordLengthSeventeenNotSpecialCharacters(self): oLogin = login() message = "JFFefn93kNJK43672" # longitud 17 sin caracteres especiales encriptedMessage = oLogin.encript(message) result = oLogin.check_password(encriptedMessage,message) self.assertFalse(result)
def testLength_passwordLargestRepresentableNumber(self): oLogin = login() oLength = oLogin.length_password((2**28)*"a") self.assertEqual(2**28,oLength)
def testLength_passwordLengthEight(self): oLogin = login() oLength = oLogin.length_password("pa$$w0rD") # longitud 8 self.assertEqual(8,oLength)
def testLength_passwordLengthSeven(self): oLogin = login() oLength = oLogin.length_password("M3A0$d8") # Longitud 7 self.assertEqual(7,oLength)
def testLength_passwordLengthSeventeen(self): oLogin = login() oLength = oLogin.length_password("C*@d$.3Aca#a3aE+$") # longitud 17 self.assertEqual(17,oLength)
# -*- coding: utf-8 -*- import os,sys,time,re,random,redis from scrapy.selector import Selector from scrapy.http import HtmlResponse from pyquery import PyQuery as pq from login import * from config import * reload(sys) sys.setdefaultencoding('utf-8') if isLogin(): print('您已经登录') else: login(secret, account) ## def get_html(url=None): try: r = session.get(url, headers=headers) return r.content except Exception,err: raise err ##使用PyQuery模块,用jQuery选择器的方式解析htmk文本 def Pquery(content=None): class_name = u'toggle-expand'
def test_view_create(self): from views import view_create_test request = testing.DummyRequest() request.params['login'] = '******' request.params['password'] = '******' login(request) info = view_create_test(request) self.assertTrue('form' in info.keys()) ###Test creating a multipleChoice question with one correct answer### request = testing.DummyRequest(_createFormData(multipleChoiceData)) info = view_create_test(request) tests = self.session.query(Test).all() self.assertEqual(1, len(tests)) test = tests[0] self.assertEqual("Math Test", test.name) questions = self.session.query(Question).all() self.assertEqual(1, len(questions)) question = questions[0] self.assertEqual(question.question, "1+1 = ?") self.assertEqual(question.question_type, "multipleChoice") answers = self.session.query(Answer).all() self.assertEqual(2, len(answers)) self.assertEqual('1', answers[0].answer) self.assertFalse(answers[0].correct) self.assertEqual('2', answers[1].answer) self.assertTrue(answers[1].correct) _clearTestingDB(self.session) ###Test creating a selectTrue question with more than one correct answer### request = testing.DummyRequest(_createFormData(selectTrueData)) info = view_create_test(request) tests = self.session.query(Test).all() self.assertEqual(1, len(tests)) test = tests[0] self.assertEqual("Math Test", test.name) questions = self.session.query(Question).all() self.assertEqual(1, len(questions)) question = questions[0] self.assertEqual(question.question, "1+1 = ?") self.assertEqual(question.question_type, "selectTrue") answers = self.session.query(Answer).filter( Answer.question_id == question.id).all() self.assertEqual(2, len(answers)) self.assertEqual('1', answers[0].answer) self.assertTrue(answers[0].correct) self.assertEqual('2', answers[1].answer) self.assertTrue(answers[1].correct) _clearTestingDB(self.session) ###Test creating a shortAnswer question with more than one correct answer## request = testing.DummyRequest(_createFormData(shortAnswerData)) info = view_create_test(request) tests = self.session.query(Test).all() self.assertEqual(1, len(tests)) test = tests[0] self.assertEqual("Short Answer", test.name) questions = self.session.query(Question).all() self.assertEqual(1, len(questions)) question = questions[0] self.assertEqual(question.question, "What is you're name?") self.assertEqual(question.question_type, "shortAnswer") answers = self.session.query(Answer).all() self.assertEqual(0, len(answers)) _clearTestingDB(self.session) ###Test creating one of each type of question### request = testing.DummyRequest(_createFormData(allTypesData)) info = view_create_test(request) tests = self.session.query(Test).all() self.assertEqual(1, len(tests)) test = tests[0] self.assertEqual("All Types", test.name) questions = self.session.query(Question).all() self.assertEqual(3, len(questions)) self.assertEqual("multipleChoice", questions[0].question_type) self.assertEqual("selectTrue", questions[1].question_type) self.assertEqual("shortAnswer", questions[2].question_type) self.assertEqual('1+1 = ?', questions[0].question) self.assertEqual('x^2 = 1', questions[1].question) self.assertEqual("What is you're name?", questions[2].question) self.assertEqual(1, questions[0].id) self.assertEqual(2, questions[1].id) self.assertEqual(3, questions[2].id) answers = self.session.query(Answer).filter( Answer.question_id==questions[0].id).all() self.assertEqual(1, answers[0].id) self.assertEqual(2, answers[1].id) self.assertEqual("1", answers[0].answer) self.assertEqual("2", answers[1].answer) self.assertFalse(answers[0].correct) self.assertTrue(answers[1].correct) answers = self.session.query(Answer).filter( Answer.question_id==questions[1].id).all() self.assertEqual(3, answers[0].id) self.assertEqual(4, answers[1].id) self.assertEqual(5, answers[2].id) self.assertEqual("-1", answers[0].answer) self.assertEqual("1", answers[1].answer) self.assertEqual("2", answers[2].answer) self.assertTrue(answers[0].correct) self.assertTrue(answers[1].correct) self.assertFalse(answers[2].correct) answers = self.session.query(Answer).filter( Answer.question_id==questions[2].id).all() self.assertEqual(0, len(answers))
#!/usr/bin/python # coding=utf-8 import urllib import urllib2 import cookielib import sys from time import sleep from login import * html=login('http://3g.renren.com/myfriendlist.do') html=html[html.find('全部'):] last='123' total=0 n=0 i=0 while html.find('下一页')>=0: html=html[html.find('全部'):html.find('下一页')] j=0 while html.find('profile.do?h')>=0 and j<5: #urllib.urlretrieve(url) #print html html=html[html.find('<img'):] html=html[html.find('src'):] temp=html[html.find('http'):html.find('" />')] n+=1 print temp print urllib.urlretrieve(temp,'/home/godfather/code/python/photo/'+str(n)+'.jpg') #sleep(0.5) ` j+=1 #print temp
def testEncriptLengthSixteenInvalidCharacters(self): oLogin = login() oHash = oLogin.encript("_k?¡[ñ]<z]>o8E{}") # longitud 16 caracteres invalidos self.assertEqual("",oHash)
def testLength_passwordLengthZero(self): oLogin = login() oLength = oLogin.length_password("") self.assertEqual(0,oLength)
def testLength_passwordLengthFifteen(self): oLogin = login() oLength = oLogin.length_password("16.9rh@AgwxQzp0") # longitud 15 self.assertEqual(15,oLength) # #Fin de Casos Login
def testLength_passwordExists(self): oLogin = login() oLength = oLogin.length_password("ABC.123")
def testCheck_passwordLengthSeventeenNotCapitalizedNotSpecialCharacters(self): oLogin = login() message = "i3u48712384uioiqm" # longitud 17 sin mayusculas ni caracteres especiales encriptedMessage = oLogin.encript(message) result = oLogin.check_password(encriptedMessage,message) self.assertFalse(result)
def testEncriptLengthEightNotCapitalizedNotSpecialCharacters(self): oLogin = login() oHash = oLogin.encript("irj1290k") # longitud 8 sin mayusculas ni caracteres especiales self.assertEqual("",oHash)
def testLength_passwordLengthSixteen(self): oLogin = login() oLength = oLogin.length_password("16.9rh@Ag5wxQzp0") # longitud 16 self.assertEqual(16,oLength)
def testCheck_passwordLengthSeventeenNotCapitalized(self): oLogin = login() message = "@#$+zj*ic71c22x.." # longitud 17 sin mayusculas encriptedMessage = oLogin.encript(message) result = oLogin.check_password(encriptedMessage,message) self.assertFalse(result)