File: angularview.py

package info (click to toggle)
voltron 0.1.8-1
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid
  • size: 668 kB
  • sloc: python: 5,724; sh: 252; javascript: 118; ansic: 49; makefile: 5
file content (38 lines) | stat: -rw-r--r-- 977 bytes parent folder | download | duplicates (5)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
import logging
import pygments
from voltron.plugin import *
from voltron.lexers import *
from voltron.api import *

from flask import *

log = logging.getLogger('api')


class AngularViewPlugin(WebPlugin):
    name = 'angularview'


class FormatDisassemblyRequest(APIRequest):
    _fields = {'disassembly': True}

    def dispatch(self):
        try:
            res = FormatDisassemblyResponse(
                disassembly=pygments.highlight(self.disassembly.strip(), LLDBIntelLexer(), pygments.formatters.HtmlFormatter()))
        except Exception as e:
            msg = "Exception formatting disassembly: {}".format(repr(e))
            log.exception(msg)
            res = APIGenericErrorResponse(msg)

        return res


class FormatDisassemblyResponse(APIResponse):
    _fields = {'disassembly': True}


class FormatDisassemblyPlugin(APIPlugin):
    request = "format_disasm"
    request_class = FormatDisassemblyRequest
    response_class = FormatDisassemblyResponse