This commit is contained in:
parent
0874645719
commit
4bd161de54
@ -3,4 +3,5 @@ from server import Server
|
||||
|
||||
if __name__ == '__main__':
|
||||
server = Server()
|
||||
server.initServer()
|
||||
server.startServer()
|
||||
|
@ -12,8 +12,13 @@ class Server:
|
||||
self.sessionTimeout = sessionTimeout
|
||||
self.availableServer = availableServer
|
||||
self.executor = Executor(homeDirectory)
|
||||
|
||||
def initServer(self):
|
||||
print("Please enter your private key passphrase")
|
||||
passphrase = input()
|
||||
self.auth = Authetication()
|
||||
self.networkInstance = NetWrapper(self.auth.loadUserPublicKeys(),self.auth.loadServerPrivateKey(),self)
|
||||
self.networkInstance = NetWrapper(self.auth.loadUserPublicKeys(), self.auth.loadServerPrivateKey(passphrase),
|
||||
self)
|
||||
|
||||
def login(self, username: str, password: str) -> bool:
|
||||
self.isAuthenticated = True
|
||||
@ -107,14 +112,4 @@ class Server:
|
||||
def startServer(self):
|
||||
while True:
|
||||
message = self.networkInstance.recieveMessage().decode('UTF-8')
|
||||
command = self.parseCommand(message)
|
||||
#ha LINOK vagy LINERROR donothing
|
||||
if command == "LINERROR" or command == "LINOK" or command == "ERROR":
|
||||
print("not right commands")
|
||||
elif len(command) == 1:
|
||||
execute_message = self.execute(self,command, "", "")
|
||||
elif len(command) == 2:
|
||||
execute_message = self.execute(self, command, command[1], "")
|
||||
elif len(command) == 3:
|
||||
execute_message = self.execute(self, command, command[1], command[2])
|
||||
self.networkInstance.sendMessage(self, execute_message)
|
||||
self.parseCommand(message)
|
||||
|
Loading…
Reference in New Issue
Block a user