Jump to content
×
×
  • Create New...
  • 0

how to save password and login in client


neversayyes9981

Question

hi guys i want to ask for something... does on this forum exist topic about saving login and password in client?

 

im talking about simple buttons with save / show... 4 times ( player can save password for 4 diffrent accounts

 

 

can somewon help me please?

 

 

ps: im working on source 

Link to comment
  • Answers 3
  • Created
  • Last Reply

Top Posters For This Question

Top Posters For This Question

3 answers to this question

Recommended Posts

  • 0
2 hours ago, neversayyes9981 said:

up

Try this

Spoiler
import os
import sys
import string
from _winreg import *

	def __OnClickSaveButton(self):	
		id = self.idEditLine.GetText()
		pwd = self.pwdEditLine.GetText()
		self.__SaveAccountInfo(id, pwd)

	def __SaveAccountInfo(self, user, passw):
		try:
			userid = self.__encrypt(user).replace(' ', '-')
			passwd = self.__encrypt(passw).replace(' ', '-')
			aReg = ConnectRegistry(None, HKEY_CURRENT_USER)
			aKey = CreateKey(aReg, "software\\MyClientName\\")
			SetValueEx(aKey, "user", 0, REG_SZ, userid)
			SetValueEx(aKey, "pass", 0, REG_SZ, passwd)
			CloseKey(aKey)
			CloseKey(aReg)
			self.PopupNotifyMessage("Info: Dati di Login salvati.")
		except:
			self.PopupNotifyMessage("Info: Errore Salvataggio dati di Login.")
			return

	def __LoadAccountInfo(self):
		try:
			login_data = os.popen('reg QUERY "HKEY_CURRENT_USER\software\MyClientName" /v user').readlines()
			login_line = login_data[2].split()
			login_value = login_line[2].replace('-', ' ').strip('\n')
			passw_data = os.popen('reg QUERY "HKEY_CURRENT_USER\software\MyClientName" /v pass').readlines()
			passw_line = passw_data[2].split()
			passw_value = passw_line[2].replace('-', ' ').strip('\n')
			
			user=self.__decrypt(login_value)
			passw=self.__decrypt(passw_value)
				
			return user, passw

		except:
			print "LoginWindow.__LoadAccountInfo - OpenError"
			return -1, -1
			
	def __encrypt(self, string):
		aReg = ConnectRegistry(None, HKEY_CURRENT_USER)
		try:
			aKey = OpenKey(aReg, "software\\MyClientName\\")
		except WindowsError:
			try:
				key1_value = app.GetRandom(1,127)
				key2_value = app.GetRandom(1,32768)
				aKey = CreateKey(aReg, "software\\MyClientName\\")
				SetValueEx(aKey, "key1", 0, REG_DWORD, key1_value)
				SetValueEx(aKey, "key2", 0, REG_DWORD, key2_value)
				CloseKey(aKey)
				CloseKey(aReg)
			except:
				CloseKey(aReg)
				return
				
		key1_data = os.popen('reg QUERY "HKEY_CURRENT_USER\software\MyClientName" /v key1').readlines()
		key1_line = key1_data[2].split()
		key1_value = int(key1_line[2], 16)
		key2_data = os.popen('reg QUERY "HKEY_CURRENT_USER\software\MyClientName" /v key2').readlines()
		key2_line = key2_data[2].split()
		key2_value = int(key2_line[2], 16)
		
		a = string
		new_string = ''
		for x in a:
			new_string = new_string+str(int(ord(x) + key1_value) * key2_value)+' '
			
		return new_string
		
	def __decrypt(self, string):
		aReg = ConnectRegistry(None, HKEY_CURRENT_USER)
		try:
			aKey = OpenKey(aReg, "software\\MyClientName\\")
		except WindowsError:
			CloseKey(aReg)
			return
			
		CloseKey(aKey)
		CloseKey(aReg)
		key1_data = os.popen('reg QUERY "HKEY_CURRENT_USER\software\MyClientName" /v key1').readlines()
		key1_line = key1_data[2].split()
		key1_value = int(key1_line[2], 16)
		key2_data = os.popen('reg QUERY "HKEY_CURRENT_USER\software\MyClientName" /v key2').readlines()
		key2_line = key2_data[2].split()
		key2_value = int(key2_line[2], 16)
		
		a = string
		new_string = ''
		b = a.split()
		for x in b:
			new_string = new_string+chr((int(x) / key2_value) - key1_value)
			
		return new_string

 

 

Link to comment
  • 0
9 hours ago, Ikh said:

Try this

  Hide contents

import os
import sys
import string
from _winreg import *

	def __OnClickSaveButton(self):	
		id = self.idEditLine.GetText()
		pwd = self.pwdEditLine.GetText()
		self.__SaveAccountInfo(id, pwd)

	def __SaveAccountInfo(self, user, passw):
		try:
			userid = self.__encrypt(user).replace(' ', '-')
			passwd = self.__encrypt(passw).replace(' ', '-')
			aReg = ConnectRegistry(None, HKEY_CURRENT_USER)
			aKey = CreateKey(aReg, "software\\MyClientName\\")
			SetValueEx(aKey, "user", 0, REG_SZ, userid)
			SetValueEx(aKey, "pass", 0, REG_SZ, passwd)
			CloseKey(aKey)
			CloseKey(aReg)
			self.PopupNotifyMessage("Info: Dati di Login salvati.")
		except:
			self.PopupNotifyMessage("Info: Errore Salvataggio dati di Login.")
			return

	def __LoadAccountInfo(self):
		try:
			login_data = os.popen('reg QUERY "HKEY_CURRENT_USER\software\MyClientName" /v user').readlines()
			login_line = login_data[2].split()
			login_value = login_line[2].replace('-', ' ').strip('\n')
			passw_data = os.popen('reg QUERY "HKEY_CURRENT_USER\software\MyClientName" /v pass').readlines()
			passw_line = passw_data[2].split()
			passw_value = passw_line[2].replace('-', ' ').strip('\n')
			
			user=self.__decrypt(login_value)
			passw=self.__decrypt(passw_value)
				
			return user, passw

		except:
			print "LoginWindow.__LoadAccountInfo - OpenError"
			return -1, -1
			
	def __encrypt(self, string):
		aReg = ConnectRegistry(None, HKEY_CURRENT_USER)
		try:
			aKey = OpenKey(aReg, "software\\MyClientName\\")
		except WindowsError:
			try:
				key1_value = app.GetRandom(1,127)
				key2_value = app.GetRandom(1,32768)
				aKey = CreateKey(aReg, "software\\MyClientName\\")
				SetValueEx(aKey, "key1", 0, REG_DWORD, key1_value)
				SetValueEx(aKey, "key2", 0, REG_DWORD, key2_value)
				CloseKey(aKey)
				CloseKey(aReg)
			except:
				CloseKey(aReg)
				return
				
		key1_data = os.popen('reg QUERY "HKEY_CURRENT_USER\software\MyClientName" /v key1').readlines()
		key1_line = key1_data[2].split()
		key1_value = int(key1_line[2], 16)
		key2_data = os.popen('reg QUERY "HKEY_CURRENT_USER\software\MyClientName" /v key2').readlines()
		key2_line = key2_data[2].split()
		key2_value = int(key2_line[2], 16)
		
		a = string
		new_string = ''
		for x in a:
			new_string = new_string+str(int(ord(x) + key1_value) * key2_value)+' '
			
		return new_string
		
	def __decrypt(self, string):
		aReg = ConnectRegistry(None, HKEY_CURRENT_USER)
		try:
			aKey = OpenKey(aReg, "software\\MyClientName\\")
		except WindowsError:
			CloseKey(aReg)
			return
			
		CloseKey(aKey)
		CloseKey(aReg)
		key1_data = os.popen('reg QUERY "HKEY_CURRENT_USER\software\MyClientName" /v key1').readlines()
		key1_line = key1_data[2].split()
		key1_value = int(key1_line[2], 16)
		key2_data = os.popen('reg QUERY "HKEY_CURRENT_USER\software\MyClientName" /v key2').readlines()
		key2_line = key2_data[2].split()
		key2_value = int(key2_line[2], 16)
		
		a = string
		new_string = ''
		b = a.split()
		for x in b:
			new_string = new_string+chr((int(x) / key2_value) - key1_value)
			
		return new_string

 

should i add this to intrologin.py or loginwindow.py?

 

9 hours ago, Ikh said:

Try this

  Hide contents

import os
import sys
import string
from _winreg import *

	def __OnClickSaveButton(self):	
		id = self.idEditLine.GetText()
		pwd = self.pwdEditLine.GetText()
		self.__SaveAccountInfo(id, pwd)

	def __SaveAccountInfo(self, user, passw):
		try:
			userid = self.__encrypt(user).replace(' ', '-')
			passwd = self.__encrypt(passw).replace(' ', '-')
			aReg = ConnectRegistry(None, HKEY_CURRENT_USER)
			aKey = CreateKey(aReg, "software\\MyClientName\\")
			SetValueEx(aKey, "user", 0, REG_SZ, userid)
			SetValueEx(aKey, "pass", 0, REG_SZ, passwd)
			CloseKey(aKey)
			CloseKey(aReg)
			self.PopupNotifyMessage("Info: Dati di Login salvati.")
		except:
			self.PopupNotifyMessage("Info: Errore Salvataggio dati di Login.")
			return

	def __LoadAccountInfo(self):
		try:
			login_data = os.popen('reg QUERY "HKEY_CURRENT_USER\software\MyClientName" /v user').readlines()
			login_line = login_data[2].split()
			login_value = login_line[2].replace('-', ' ').strip('\n')
			passw_data = os.popen('reg QUERY "HKEY_CURRENT_USER\software\MyClientName" /v pass').readlines()
			passw_line = passw_data[2].split()
			passw_value = passw_line[2].replace('-', ' ').strip('\n')
			
			user=self.__decrypt(login_value)
			passw=self.__decrypt(passw_value)
				
			return user, passw

		except:
			print "LoginWindow.__LoadAccountInfo - OpenError"
			return -1, -1
			
	def __encrypt(self, string):
		aReg = ConnectRegistry(None, HKEY_CURRENT_USER)
		try:
			aKey = OpenKey(aReg, "software\\MyClientName\\")
		except WindowsError:
			try:
				key1_value = app.GetRandom(1,127)
				key2_value = app.GetRandom(1,32768)
				aKey = CreateKey(aReg, "software\\MyClientName\\")
				SetValueEx(aKey, "key1", 0, REG_DWORD, key1_value)
				SetValueEx(aKey, "key2", 0, REG_DWORD, key2_value)
				CloseKey(aKey)
				CloseKey(aReg)
			except:
				CloseKey(aReg)
				return
				
		key1_data = os.popen('reg QUERY "HKEY_CURRENT_USER\software\MyClientName" /v key1').readlines()
		key1_line = key1_data[2].split()
		key1_value = int(key1_line[2], 16)
		key2_data = os.popen('reg QUERY "HKEY_CURRENT_USER\software\MyClientName" /v key2').readlines()
		key2_line = key2_data[2].split()
		key2_value = int(key2_line[2], 16)
		
		a = string
		new_string = ''
		for x in a:
			new_string = new_string+str(int(ord(x) + key1_value) * key2_value)+' '
			
		return new_string
		
	def __decrypt(self, string):
		aReg = ConnectRegistry(None, HKEY_CURRENT_USER)
		try:
			aKey = OpenKey(aReg, "software\\MyClientName\\")
		except WindowsError:
			CloseKey(aReg)
			return
			
		CloseKey(aKey)
		CloseKey(aReg)
		key1_data = os.popen('reg QUERY "HKEY_CURRENT_USER\software\MyClientName" /v key1').readlines()
		key1_line = key1_data[2].split()
		key1_value = int(key1_line[2], 16)
		key2_data = os.popen('reg QUERY "HKEY_CURRENT_USER\software\MyClientName" /v key2').readlines()
		key2_line = key2_data[2].split()
		key2_value = int(key2_line[2], 16)
		
		a = string
		new_string = ''
		b = a.split()
		for x in b:
			new_string = new_string+chr((int(x) / key2_value) - key1_value)
			
		return new_string

 

 

should i add this to intrologin.py or loginwindow.py?

Link to comment

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now


Important Information

Terms of Use / Privacy Policy / Guidelines / We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.