mirror of
https://github.com/avatao-content/baseimage-tutorial-framework
synced 2024-11-22 14:21:33 +00:00
Create PoC of solvable with hardcoded responses
This commit is contained in:
parent
eed3006055
commit
28e83de0d7
@ -15,4 +15,4 @@ class ControllerConnector(ZMQConnectorBase):
|
||||
self._zmq_rep_socket.connect('tcp://localhost:{}'.format(CONTROLLER_PORT))
|
||||
self._zmq_rep_stream = ZMQStream(self._zmq_rep_socket)
|
||||
|
||||
self.register_callback = self._zmq_rep_stream.on_recv
|
||||
self.register_callback = self._zmq_rep_stream.on_recv_stream
|
||||
|
@ -7,12 +7,28 @@ from tornado.ioloop import IOLoop
|
||||
from sql_injection_fsm import SQLInjectionFSM
|
||||
from tfw.config import tfwenv
|
||||
from tfw.config.logs import logging
|
||||
from tfw.networking.controller_connector import ControllerConnector
|
||||
from tfw.networking.serialization import deserialize_all, serialize_all
|
||||
|
||||
log = logging.getLogger(__name__)
|
||||
from tfw.networking.server.zmq_websocket_handler import FSMManagingSocketHandler
|
||||
|
||||
|
||||
def zmq_callback(stream, msg_parts):
|
||||
key, data = deserialize_all(*msg_parts)
|
||||
if key == 'test':
|
||||
stream.send_multipart(serialize_all(key, 'OK'))
|
||||
if key == 'solution_check':
|
||||
stream.send_multipart(serialize_all(key, {
|
||||
'solved': True,
|
||||
'message': 'solved'
|
||||
}))
|
||||
|
||||
|
||||
if __name__ == '__main__':
|
||||
fsm = SQLInjectionFSM()
|
||||
controller_connector = ControllerConnector()
|
||||
controller_connector.register_callback(zmq_callback)
|
||||
routes = [
|
||||
(r'/ws', FSMManagingSocketHandler, {'fsm': fsm}),
|
||||
]
|
||||
|
Loading…
Reference in New Issue
Block a user