This commit is contained in:
lickthecheese 2020-03-11 18:18:56 -04:00
parent 6276dfea72
commit b4974a5f68
1 changed files with 11 additions and 5 deletions

View File

@ -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):