conpot.protocols.http package

Submodules

conpot.protocols.http.command_responder module

class conpot.protocols.http.command_responder.CommandResponder(host, port, template, docpath)

Bases: object

serve_forever()
stop()
class conpot.protocols.http.command_responder.HTTPServer(request, client_address, server)

Bases: http.server.BaseHTTPRequestHandler

do_GET()

Handle GET requests

do_HEAD()

Handle HEAD requests.

do_OPTIONS()

Handle OPTIONS requests.

do_POST()

Handle POST requests

do_TRACE()

Handle TRACE requests.

get_entity_headers(rqfilename, headers, configuration)
get_entity_trailers(rqfilename, configuration)
get_status_headers(status, headers, configuration)
get_status_trailers(status, configuration)
get_trigger_appendix(rqfilename, rqparams, configuration)
load_entity(requeststring, headers, configuration, docpath)

Retrieves status, headers and payload for a given entity, that can be stored either local or on a remote system

load_status(status, requeststring, requestheaders, headers, configuration, docpath, method='GET', body=None)

Retrieves headers and payload for a given status code. Certain status codes can be configured to forward the request to a remote system. If not available, generate a minimal response

log(version, request_type, addr, request, response=None)
send_chunked(chunks, payload, trailers)

Send payload via chunked transfer encoding to the client, followed by eventual trailers.

send_error(code, message=None)

Send and log an error reply. This method is overloaded to make use of load_status() to allow handling of “Unsupported Method” errors.

send_response(code, message=None)

Send the response header and log the response code. This function is overloaded to change the behaviour when loggers and sending default headers.

substitute_template_fields(payload)
class conpot.protocols.http.command_responder.SubHTTPServer(server_address, RequestHandlerClass, template, docpath)

Bases: conpot.protocols.http.command_responder.ThreadedHTTPServer

this class is necessary to allow passing custom request handler into the RequestHandlerClass

config_sanitize_tarpit(value)
daemon_threads = True
do_tarpit(delay)
class conpot.protocols.http.command_responder.TemplateParser(data)

Bases: html.parser.HTMLParser

handle_startendtag(tag, attrs)

handles template tags provided in XHTML notation.

Expected format: <condata source=”(engine)” key=”(descriptor)” /> Example: <condata source=”databus” key=”SystemDescription” />

at the moment, the parser is space- and case-sensitive(!), this could be improved by using REGEX for replacing the template tags with actual values.

class conpot.protocols.http.command_responder.ThreadedHTTPServer(server_address, RequestHandlerClass, bind_and_activate=True)

Bases: socketserver.ThreadingMixIn, http.server.HTTPServer

Handle requests in a separate thread.

conpot.protocols.http.web_server module

Module contents