nouveau fichier: loadConf.py
nouveau fichier: login.py
This commit is contained in:
parent
8b16109e3a
commit
ca251812bd
16
loadConf.py
Normal file
16
loadConf.py
Normal file
@ -0,0 +1,16 @@
|
|||||||
|
class LoadConf(object):
|
||||||
|
def loadHand(self):
|
||||||
|
with open("fichier/conf", "r") as source :
|
||||||
|
for ligne in source:
|
||||||
|
data = ligne.rstrip('\n\r').split('=')
|
||||||
|
if data[0] in 'handicap' :
|
||||||
|
source.close()
|
||||||
|
return data[1]
|
||||||
|
source.close()
|
||||||
|
return 0
|
||||||
|
|
||||||
|
def estAveugle(self):
|
||||||
|
if self.loadHand() == "1" :
|
||||||
|
return True
|
||||||
|
else :
|
||||||
|
return False
|
38
login.py
Normal file
38
login.py
Normal file
@ -0,0 +1,38 @@
|
|||||||
|
import time
|
||||||
|
import hashlib
|
||||||
|
import httplib
|
||||||
|
from datetime import datetime
|
||||||
|
|
||||||
|
class Login(object):
|
||||||
|
def verifLogin(self,pLog,pMdp):
|
||||||
|
hashMdp = hashlib.sha224(pMdp).hexdigest()
|
||||||
|
print "Hash pass " + hashMdp
|
||||||
|
with open("fichier/autorise", "r") as source :
|
||||||
|
for ligne in source :
|
||||||
|
data = ligne.rstrip('\n\r').split(',')
|
||||||
|
if data[0] in pLog :
|
||||||
|
if data[1] in hashMdp :
|
||||||
|
source.close()
|
||||||
|
return True
|
||||||
|
source.close()
|
||||||
|
return False
|
||||||
|
|
||||||
|
def enregDansLog(self,pLog,pMsg,pIP):
|
||||||
|
with open("fichier/log", "a") as dest :
|
||||||
|
d = datetime.now().strftime("%c")
|
||||||
|
dest.write("%s,%s,%s,%s\n" % (d,pLog,pMsg,pIP))
|
||||||
|
|
||||||
|
def connexion(self,pLog,pMdp):
|
||||||
|
if self.verifLogin(pLog,pMdp) == True :
|
||||||
|
return True
|
||||||
|
else :
|
||||||
|
return False
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
Reference in New Issue
Block a user