modifié: m/fichier/conf

modifié:         m/loadConf.py
	modifié:         m/log.py
	modifié:         m/login.py
	modifié:         superTornado.py
	nouveau fichier: test/AllowTest
	nouveau fichier: test/ConfTest
	nouveau fichier: test/MiEmulator.py
	nouveau fichier: test/a
	nouveau fichier: test/botTest.py
	nouveau fichier: test/mfp.cookies
	nouveau fichier: test/testFichier.py
	nouveau fichier: test/testMISignaux.py
	modifié:         v/illegal.html
	modifié:         v/index.html
This commit is contained in:
sidya82
2014-03-30 22:11:36 +02:00
parent 160ab41dfe
commit 73a1d1e3e4
18 changed files with 2876 additions and 74 deletions

View File

@ -3,6 +3,8 @@ camera=192.168.1.13
portCamera=80
idUrlCamera=test:a
endUrlCamera=/image.jpg
serv=192.168.1.12
serv=127.0.0.1
portServ=80
ipDomoMi=192.168.16.150
portDomoMi=80

View File

@ -1,11 +1,18 @@
class LoadConf(object):
"""Loading configuration file"""
def __init__(self,path):
"""
Define file path for load config
"""
self.path = path
def loadValue(self, key):
"""
Return the value associate to the key into conf file (fichier/conf)
Else return "error"
"""
with open("m/fichier/conf", "r") as source :
with open(self.path , "r") as source :
for ligne in source:
data = ligne.rstrip('\r\n').split('=')
if data[0] == key :
@ -68,6 +75,18 @@ class LoadConf(object):
"""
def endUrlCamera(self) :
return self.loadValue("endUrlCamera")
"""
Return ipDomoMi configuration
Else "error"
"""
def ipDomo(self) :
return self.loadValue("ipDomoMi")
"""
Return portDomoMi configuration
Else "error"
"""
def portDomo(self) :
return self.loadValue("portDomoMi")

View File

@ -85,15 +85,15 @@ class Log(object):
pLvl : level of log message
"""
if pLvl == lvl.DEBUG :
pMsg = bcolors.DEBUG + pMsg + bcolors.ENDC
pMsg = bcolors.DEBUG + str(pMsg) + bcolors.ENDC
elif pLvl == lvl.INFO :
pMsg = bcolors.INFO + pMsg + bcolors.ENDC
pMsg = bcolors.INFO + str(pMsg) + bcolors.ENDC
elif pLvl == lvl.SUCCESS :
pMsg = bcolors.SUCCESS + pMsg + bcolors.ENDC
pMsg = bcolors.SUCCESS + str(pMsg) + bcolors.ENDC
elif pLvl == lvl.WARNING :
pMsg = bcolors.WARNING + pMsg + bcolors.ENDC
pMsg = bcolors.WARNING + str(pMsg) + bcolors.ENDC
elif pLvl == lvl.FAIL :
pMsg = bcolors.FAIL + pMsg + bcolors.ENDC
pMsg = bcolors.FAIL + str(pMsg) + bcolors.ENDC
self.logger.log(pLvl,pMsg)

View File

@ -1,11 +1,16 @@
import hashlib
import httplib
class Login(object):
"""
Login manager
"""
def __init__(self,path):
"""
Define file path for login information
"""
self.path = path
def checkLogin(self,pLog,pPasswd):
"""
Check if login and password are correct (in file fichier/allow)
@ -15,12 +20,12 @@ class Login(object):
return : true if correct login
false else
"""
hashMdp = hashlib.sha224(pPasswd).hexdigest()
with open("m/fichier/allow", "r") as source :
hashPasswd = hashlib.sha224(pPasswd).hexdigest()
with open(self.path, "r") as source :
for ligne in source :
data = ligne.rstrip('\n\r').split(',')
if data[0] == pLog :
if data[1] == hashMdp :
if data[1] == hashPasswd :
source.close()
return True
source.close()