Connector Source Code Documentation
The Connector provides an interface between a Honeypot and a Bro. Between
accepting messages and forwarding them to Bro, the Connector actually
transforms those messages into the correct format, using easily to configure
mappings.
Connector
connector.py
Provides the main class (of) the Connector. This provides the entry-point to
the connector, enables receiving, mapping and sending of messages.
Messages are received via http (default: 0.0.0.0:8080) and sent via broker to
the peered Bro-instance. The incoming messages are mapped via a matching
mapping to be properly processed on the other side.
The module can be executed directly.
-
class
connector.
ConnConfig
(data=None, default=None)[source]
Connection configuration.
Provides a proper (default) configuration access as described in
iss/mp-ids#85.
-
update
(ndict)[source]
Update the current dict with the new one.
-
class
connector.
Connector
(config=None)[source]
The Connector
See module description for more context.
-
handle_receive
(message)[source]
Handle message via mapping.
Parameters: | message – The message to map and send. (json) |
-
connector.
main
()[source]
Run the connector.
Execute the connector with command line arguments and/or a configuration
file.
Receiver
receiver.py
Provides the Receiver, which listens to the given address and reacts on data.
The method Receiver.on_data()
is called upon a valid json message. Start
it by calling listen()
.
This implementation uses Flask (http://flask.pocoo.org/)!
-
class
receiver.
Receiver
(name, address, port)[source]
See module description.
-
listen
(route, on_data)[source]
Listen on route and call on_data.
Parameters: |
- route – The path to listen on. (str)
- on_data – The callback function. (func(json))
|
Mapper
mapper.py
Provides the Mapper, which maps json input data to Broker messages.
-
class
mapper.
Mapper
(mappings)[source]
The mapper.
Maps messages over mappings to broker-messages.
-
transform
(data)[source]
Map data to the appropriate Broker message.
Parameters: | data – The data to map. (json) |
Returns: | The corresponding Broker message. (pybroker.Message) |
Sender
sender.py
Provides the Sender, which wraps Broker to send messages to the associated
communication partner.
-
class
sender.
Sender
(master_address, master_port, broker_endpoint, broker_topic, connector_id)[source]
The sender.
Sends Broker messages to an Broker endpoint.
-
send
(msg)[source]
Send the Broker message to the peer.
Parameters: | msg – The message to be sent. (Broker message) |