Пример #1
0
def croak(error, message_writer=message):
    """Throw an exception in the Maltego GUI containing error_msg."""
    if isinstance(error, MaltegoException):
        message_writer(MaltegoTransformExceptionMessage(exceptions=[error]))
    else:
        message_writer(
            MaltegoTransformExceptionMessage(
                exceptions=[MaltegoException(error)]))
Пример #2
0
def croak(cause):
    """Throw an exception in the Maltego GUI containing cause.

    :param cause: a string containing the issue description.
    """
    return MaltegoMessage(message=MaltegoTransformExceptionMessage(
        exceptions=[MaltegoException(cause)])).render()
Пример #3
0
def croak(error_msg):
    """Throw an exception in the Maltego GUI containing error_msg."""
    s = StringIO()
    Message(
        MaltegoMessage(
            MaltegoTransformExceptionMessage(
                exceptions=MaltegoException(error_msg)))).write(file=s)
    return s.getvalue()
Пример #4
0
def croak(error_msg, r):
    """Throw an exception in the Maltego GUI containing error_msg."""

    r.send_response(200)
    r.send_header('Content-Type', 'text/xml')
    r.send_header('Connection', 'close')
    r.end_headers()

    Message(
        MaltegoMessage(
            MaltegoTransformExceptionMessage(
                exceptions=MaltegoException(error_msg)))).write(file=r.wfile)
Пример #5
0
def croak(error_msg, response):
    """Throw an exception in the Maltego GUI containing error_msg."""

    response.send_response(200)
    response.send_header('Content-Type', 'text/xml')
    response.send_header('Connection', 'close')
    response.end_headers()

    response.wfile.write(
        MaltegoMessage(
            message=MaltegoTransformExceptionMessage(exceptions=[MaltegoException(error_msg)])
        ).render(fragment=True)
    )
Пример #6
0
def croak(error_msg):
    """Throw an exception in the Maltego GUI containing error_msg."""
    return MaltegoMessage(message=MaltegoTransformExceptionMessage(
        exceptions=[MaltegoException(error_msg)])).render()