actions
This commit is contained in:
parent
6276dfea72
commit
b4974a5f68
16
server.py
16
server.py
|
@ -3,19 +3,25 @@
|
|||
from twisted.internet import protocol, reactor, endpoints
|
||||
import bcrypt
|
||||
|
||||
salt = b'$2b$12$mwSIOyxLJid1jFLgnU0s0.'
|
||||
salt = b'$2b$12$mvJMOyxLJid1jFLgaU1s0.'
|
||||
|
||||
def hash(inp):
|
||||
return bcrypt.hashpw(inp.encode('utf-8'), salt)
|
||||
return bcrypt.hashpw(inp.encode('utf-8'), salt).decode('utf-8')
|
||||
|
||||
|
||||
|
||||
actions = []
|
||||
|
||||
class Reply(protocol.Protocol):
|
||||
def dataReceived(self, data):
|
||||
data = str(data).split(':')
|
||||
output = 'ERROR:INVALID_INP'
|
||||
data = data.decode('utf-8').split(':')
|
||||
if len(data) > 4:
|
||||
data.pop(0)
|
||||
output=hash(data[0])
|
||||
if data[0] in actions:
|
||||
output = actions[data[0]](data[1:])
|
||||
#output=hash(data[0])
|
||||
else:
|
||||
output = 'ERROR:INVALID_INP'
|
||||
self.transport.write('LICKTHECOIN:{}\n'.format(output).encode('utf-8'))
|
||||
|
||||
class Factory(protocol.Factory):
|
||||
|
|
Loading…
Reference in New Issue