summaryrefslogtreecommitdiff
path: root/server.py
diff options
context:
space:
mode:
authorJesusaves <cpntb1@ymail.com>2020-12-19 17:12:38 -0300
committerJesusaves <cpntb1@ymail.com>2020-12-19 17:12:38 -0300
commit4835dc8a7792e135719558a1982354d9eb213a42 (patch)
tree268fb59d9d147313dbc4131a12b20d8ccbecbbd0 /server.py
parent2ea74f4b720936b3502af1a51bb47056bcb61a87 (diff)
downloadserver-4835dc8a7792e135719558a1982354d9eb213a42.tar.gz
server-4835dc8a7792e135719558a1982354d9eb213a42.tar.bz2
server-4835dc8a7792e135719558a1982354d9eb213a42.tar.xz
server-4835dc8a7792e135719558a1982354d9eb213a42.zip
Add token field to connection. Send connection to protocol parser.
Add new constants for the results (non-boolean) so laterâ„¢ score can be smart.
Diffstat (limited to 'server.py')
-rwxr-xr-xserver.py7
1 files changed, 4 insertions, 3 deletions
diff --git a/server.py b/server.py
index 3d61e11..9a068da 100755
--- a/server.py
+++ b/server.py
@@ -9,7 +9,7 @@ from websock import WebSocketServer, WebSocket
## Local Modules
from utils import stdout, now
-from consts import MAX_CLIENTS
+from consts import MAX_CLIENTS, PACKET_ACK
import protocol, security, traceback
###############################################################
@@ -37,13 +37,14 @@ class WebSocketConn(WebSocket):
"""
print("Message received from %s - %s" % (self.address[0], self.data))
try:
- r=protocol.parse(self.data)
+ r=protocol.parse(self.data, self)
print("Status: %s" % str(r[0]))
print("Reply: %s" % r[1])
- if r[0] is not True:
+ if r[0] < PACKET_ACK:
stdout("%s - %s" % (self.address[0], r[1]))
syslog.syslog(LOG_AUTH, "%s - %s" % (self.address[0], r[1]))
self.send_message("NACK\n")
+ # FIXME: Parse the packet error score
security.score(self, 5)
else:
self.send_message(r[1])