def editEntry(ow, ou, op, nw, nu, np): """Update database with new data for specific entry.""" encryptObj = Encrypt() nw = encryptObj.encrypt(nw) nu = encryptObj.encrypt(nu) np = encryptObj.encrypt(np) dbq.updateEntry(ow, ou, op, nw, nu, np)
def pushEntry(web, user, passwd): """Encrypt data and send to database.""" encryptObj = Encrypt() if web != '': web = encryptObj.encrypt(web) user = encryptObj.encrypt(user) passwd = encryptObj.encrypt(passwd) dbq.addEntry(web, user, passwd) return True else: return False
def pushSignup(password, question, answer): """Hash and encrypt all data and send to database.""" encryptObj = Encrypt() if passwordRules(password) and answer != '': password = hashIt(password) question = encryptObj.encrypt(question) answer = encryptObj.encrypt(answer) key = dbq.selectKey()[0] dbq.updateMasterInfo(password[0], password[1], question, answer) return True else: return False
def run(self): global enc key = self.key_exchange() enc = Encrypt(key) self.client_socket.send( enc.encrypt(('Welcome to the Interview Portal'))) time.sleep(0.1) _LOGIN_STATUS = self.validate() if _LOGIN_STATUS == True: print('User', self._USER_NAME, 'has a log in status of', str(_LOGIN_STATUS)) logger.info('User {} has a login status of {}'.format( self._USER_NAME, str(_LOGIN_STATUS))) else: logger.warning('Invalid login attempt with username {}'.format( self._USER_NAME)) CredentialsException() self.terminate_session() return ##This assumes that the user is trying to take an interview. Additional## ##user options could be added easily by making the giveInterview call ## ##conditional user_role = self.currentuser.getPer() self.client_socket.send( enc.encrypt(str('{}'.format( db_interaction.getUserRole(user_role))))) if (user_role == 4): self.giveInterview() elif (user_role == 1): self.adminMenu() elif (user_role == 2): self.adminMenu() elif (user_role == 3): self.reviewInterview() self.terminate_session()
import sys, os from conf import * sys.path.insert(1, os.path.join(ROOT_DIR, "GUI/")) sys.path.insert(1, os.path.join(ROOT_DIR, "Encryptor/")) from encrypt import Encrypt from encrypt_gui import GUI if __name__ == '__main__': proc = Encrypt(sys.argv[1]) proc.encrypt() showProcGUI = GUI() showProcGUI.createWindow()
from encrypt import Encrypt unchanged_sentence = raw_input('Type some words to encrypt\n') our_encryptor = Encrypt() encrypted_text = our_encryptor.encrypt( unchanged_sentence ) print encrypted_text decrypted_message = our_encryptor.decrypt(encrypted_text) if decrypted_message == unchanged_sentence: print 'it worked' print decrypted_message