Christian Damken
25d3344104
- added loop to be able to process multiple commands within one session, send "exit" to exit - added code 004: Exit - added include/auth.py with init() and check_password() - added settings variable PASSWORD (stores a SHA512-encrypted password) - added authenticate() to class comm
23 lines
478 B
Python
23 lines
478 B
Python
# includes/auth.py
|
|
#
|
|
# module version: 0.0.20130617
|
|
# for protocol version 0.2.20130617
|
|
#
|
|
|
|
class auth:
|
|
passwd = ""
|
|
|
|
def init(password):
|
|
#from Crypto.Hash import Hash
|
|
import hashlib
|
|
|
|
global passwd
|
|
passwd = password
|
|
|
|
|
|
def check_passwd(incpass):
|
|
"""
|
|
checks a given password
|
|
"""
|
|
if hashlib.sha512(bytearray(incpass)).hexdigest() == passwd: return True
|
|
else: return False
|