예제 #1
0
def sessionhandlingaction_perform():
    reg_id = request.args.get('rid')
    action_handler = Registry.get_by_id(reg_id)
    updates = []
    if action_handler is not None:
        # SessionHandlingActionRequest
        session_handling_action_request = request.json
        wrapped_message = WrappedMessage(session_handling_action_request)
        macros = []
        for macro in request.json.get('macroItems'):
            macros.append(WrappedMessage(macro))
        updates = action_handler.perform_action(wrapped_message, macros)

    return jsonify([u.get_data() for u in updates])
예제 #2
0
    def get_proxy_history(self, start, stop):
        """
        Get the burp proxy history

        :param start: First entry to fetch from the list
        :type start: int
        :param stop: Last entry to fetch from the list
        :type stop: int
        :return: List of WrappedMessage containing the request/response
        :rtype list of WrappedMessage
        """
        result = []
        params = {'start': start, 'stop': stop}
        response = self._do_json_request('/getproxyhistory', params)
        try:
            message = response.read()
            # should contain list of objects like:
            # {"request":"base64...",
            # "response":"base64...",
            # "analyzedRequest":
            #   {"bodyOffset":516,"url":"http...","contentType":0,"headers":["GET...","Host: ...","User-Agent: ...",
            #   "Cookie: ..."],"method":"GET","parameters":[{"nameStart":123,"nameEnd":456,"valueStart":329,
            #   "valueEnd":334,"name":"foobar","value":"de-DE","type":2},}]},
            # "analyzedResponse":
            #   {"bodyOffset":254,"statedMimeType":"HTML","inferredMimeType":"HTML","cookies":[],
            # "  statusCode":200,"headers":["HTTP/1.1 200 OK","Cache-Control: ...","Content-Length: 123"]}}
            result = json.loads(WrappedMessage(message))
        except:
            LOGGER.exception('Error while getting proxy history')

        return result
예제 #3
0
def scannercheck_passive():
    reg_id = request.args.get('rid')
    action_handler = Registry.get_by_id(reg_id)
    scan_issues = []
    if action_handler is not None:
        scanner_check_request = request.json
        wrapped_message = WrappedMessage(scanner_check_request)
        scan_issues = action_handler.get_passive_scan_issues(wrapped_message)

    return jsonify([s.get_data() for s in scan_issues])
예제 #4
0
def proxylistener_processmsg():
    reg_id = request.args.get('rid')
    proxy_listener = Registry.get_by_id(reg_id)
    updates = []
    if proxy_listener is not None:
        # InterceptedMessage
        intercepted_message = request.json
        wrapped_message = WrappedMessage(intercepted_message)
        updates = proxy_listener.process_proxy_message(wrapped_message)

    return jsonify([u.get_data() for u in updates])
예제 #5
0
def httplistener_processmsg():
    reg_id = request.args.get('rid')
    http_listener = Registry.get_by_id(reg_id)
    updates = []
    if http_listener is not None:
        # AnalyzedMessage
        analyzed_message = request.json
        wrapped_message = WrappedMessage(analyzed_message)
        updates = http_listener.process_http_message(wrapped_message)

    return jsonify([u.get_data() for u in updates])
예제 #6
0
def get_processed_message_display():
    reg_id = request.args.get('rid')
    message_processor = Registry.get_by_id(reg_id)
    updates = []
    if message_processor is not None:
        # AnalyzedMessage
        analyzed_message = request.json
        wrapped_message = WrappedMessage(analyzed_message)
        updates = message_processor.get_readable_content_updates(
            wrapped_message)

    return jsonify([u.get_data() for u in updates])
예제 #7
0
    def get_header(header, analyzed_request_response):
        """
        Get the given header from a request or an empty string, if the header is not found.

        :param header: Header name
        :type header: str
        :param analyzed_request_response: The burp analyzed request or response
        :type analyzed_request_response: dict
        :return: str or None
        """
        return WrappedMessage.get_header(header,
                                         analyzed_request_response['headers'])