Compare commits
2 Commits
863a42e982
...
48fd34117d
Author | SHA1 | Date | |
---|---|---|---|
48fd34117d | |||
d66cd15ec9 |
@ -13,7 +13,7 @@ from netsim import network_interface
|
|||||||
|
|
||||||
|
|
||||||
class NetWrapper:
|
class NetWrapper:
|
||||||
def __init__(self, privateKey: RsaKey, clientAddress: str, username: str, serverPubKey: RsaKey,
|
def __init__(self, privateKey: RsaKey, clientAddress: str, serverPubKey: RsaKey, username: str = "",
|
||||||
serverAddr: str = 'A'):
|
serverAddr: str = 'A'):
|
||||||
self.network = network_interface('./../../netsim/network/', clientAddress)
|
self.network = network_interface('./../../netsim/network/', clientAddress)
|
||||||
self.serverAddr = serverAddr
|
self.serverAddr = serverAddr
|
||||||
@ -105,6 +105,10 @@ class NetWrapper:
|
|||||||
print("Authentication error")
|
print("Authentication error")
|
||||||
|
|
||||||
def connectToServer(self, password: str) -> None:
|
def connectToServer(self, password: str) -> None:
|
||||||
|
if self.username == "":
|
||||||
|
raise Exception('Username is not initialized')
|
||||||
|
if password == "":
|
||||||
|
raise Exception('Passowrd may not be empty')
|
||||||
identStatus = self.identifyServer()
|
identStatus = self.identifyServer()
|
||||||
if not identStatus:
|
if not identStatus:
|
||||||
raise Exception('Server identification faliure')
|
raise Exception('Server identification faliure')
|
||||||
|
Loading…
Reference in New Issue
Block a user