This commit is contained in:
parent
74cb4168de
commit
f30308351f
1 changed files with 5 additions and 7 deletions
12
server.py
12
server.py
|
@ -36,7 +36,7 @@ def getident(hostt:str, clientport:int, ssll:bool):
|
||||||
return {"success": False, "response": f"Could not connect to your ident server: {ex}"}
|
return {"success": False, "response": f"Could not connect to your ident server: {ex}"}
|
||||||
serverport = "6697" if ssll else "6667"
|
serverport = "6697" if ssll else "6667"
|
||||||
try:
|
try:
|
||||||
identsender.sendall(bytes(f"{clientport} , {serverport}\r\n", "UTF-8"))
|
identsender.sendall(bytes(f"{serverport}, {clientport}\r\n", "UTF-8"))
|
||||||
responsee = identsender.recv(2048).decode()
|
responsee = identsender.recv(2048).decode()
|
||||||
print(responsee)
|
print(responsee)
|
||||||
except Exception as ex:
|
except Exception as ex:
|
||||||
|
@ -51,15 +51,13 @@ def getident(hostt:str, clientport:int, ssll:bool):
|
||||||
for i, v in enumerate(responsee.split(" ")):
|
for i, v in enumerate(responsee.split(" ")):
|
||||||
if i == 0 and v != str({clientport}):
|
if i == 0 and v != str({clientport}):
|
||||||
return {"success": False, "response": "The ident server sent an invalid client port."}
|
return {"success": False, "response": "The ident server sent an invalid client port."}
|
||||||
elif i == 1 and v != ",":
|
elif i == 1 and v != serverport:
|
||||||
return {"success": False, "response": "The ident server sent an invalid response."}
|
|
||||||
elif i == 2 and v != serverport:
|
|
||||||
return {"success": False, "response": "The ident server doesn't know what the server port is."}
|
return {"success": False, "response": "The ident server doesn't know what the server port is."}
|
||||||
elif i == 3 and v != ":":
|
elif i == 2 and v != ":":
|
||||||
return {"success": False, "response": "The ident server sent an invalid response."}
|
return {"success": False, "response": "The ident server sent an invalid response."}
|
||||||
elif i == 5 and v != ":":
|
elif i == 4 and v != ":":
|
||||||
return {"success": False, "response": "The ident server sent an invalid response."}
|
return {"success": False, "response": "The ident server sent an invalid response."}
|
||||||
elif i == 6:
|
elif i == 5:
|
||||||
return {"success": True, "response": v}
|
return {"success": True, "response": v}
|
||||||
return {"success": False, "response": "Unknown error."}
|
return {"success": False, "response": "Unknown error."}
|
||||||
except:
|
except:
|
||||||
|
|
Loading…
Add table
Reference in a new issue