Exemplo n.º 1
0
	def __init__(self, parent = None, id = 0, passString = None): 
		super(passwordList, self).__init__(parent) 
		self.passStringLocal = passString
		self.table = QtWidgets.QTableWidget()
		self.tableItem = QtWidgets.QTableWidgetItem() 
		self.table.setWindowTitle("List of Accounts") 
		self.table.resize(800, 600) 
		self.table.setColumnWidth(100,100) 
		self.conn = sqlite3.connect("Data.db")
		self.c = self.conn.cursor()
		data = self.c.execute("SELECT * FROM PASSES WHERE ID = ?;",[(id)]) 
		self.counter = 0
		extData = [] 
		for i in data:
			self.counter += 1 
			extData.append(i)
		self.table.setRowCount(self.counter) 
		self.table.setColumnCount(3) 
		self.table.setColumnWidth(0, 200)
		self.table.setColumnWidth(1, 200)
		self.table.setColumnWidth(2, 200) 
		self.table.setHorizontalHeaderLabels(["Company", "Email/Username", "Password"]) 
		key = convertpass(self.passStringLocal)
		for i in range(self.counter): 
			iv = extData[i][4]
			cipher_decrypt = DES3.new(key, DES3.MODE_OFB, iv) 
			self.table.setItem(i, 0, QtWidgets.QTableWidgetItem(extData[i][1]))
			self.table.setItem(i, 1, QtWidgets.QTableWidgetItem(extData[i][2]))
			self.table.setItem(i, 2, QtWidgets.QTableWidgetItem(convertToOriginal(cipher_decrypt.decrypt(extData[i][3]).decode())))
		self.table.show()
Exemplo n.º 2
0
	def accepted(self):
		self.conn = sqlite3.connect("Data.db") 
		self.c = self.conn.cursor()
		key = convertpass(self.passStringAdd)
		iv = Random.new().read(DES3.block_size) 
		cipher_encrypt = DES3.new(key, DES3.MODE_OFB, iv) 
		passwordpadded = convertToMUL8(self.Password.text())
		self.c.execute("INSERT INTO PASSES VALUES(?, ?, ?, ?, ?)", [(self.id),(self.Company.text()), (self.Username.text()), (cipher_encrypt.encrypt(convertToMUL8(self.Password.text()))), (iv)])
		print("A New Password FIELD ADDED.") 
		self.conn.commit()
		self.accept()