瀏覽代碼

added a protected method

advaced criterias are now implemented
master
DragonSkills99 6 年之前
父節點
當前提交
bf69f182f1
共有 1 個檔案被更改,包括 8 行新增 和 1 行删除
  1. 8
    1
      chap-server.py

+ 8
- 1
chap-server.py 查看文件

# initializes class-instance and instance variables # initializes class-instance and instance variables
def __init__(self): def __init__(self):
self.key = ''; self.key = '';
self.authenticated = 0;
self.authenticated = False;


# tells the server to start the autentification process # tells the server to start the autentification process
# and send the generated random salt # and send the generated random salt
self.authenticated = passhash == password_hash self.authenticated = passhash == password_hash
return self.authenticated return self.authenticated


# a little method that refuses to say hi, if you
# are not authenticated
def hello(self):
if ( self.authenticated ):
return 'Hi, you are authenticated'
else:
return 'Sorry, please authenticate first'
server.register_instance(CHAP()) server.register_instance(CHAP())
# Run the server's main loop # Run the server's main loop
server.serve_forever() server.serve_forever()

Loading…
取消
儲存