BVB Source Codes

voltron Show disassemble.py Source code

Return Download voltron: download disassemble.py Source code - Download voltron Source code - Type:.py
  1. import voltron
  2. import logging
  3.  
  4. from voltron.api import *
  5. from voltron.plugin import *
  6.  
  7. log = logging.getLogger('api')
  8.  
  9. class APIDisassembleRequest(APIRequest):
  10.     """
  11.    API disassemble request.
  12.  
  13.    {
  14.        "type":         "request",
  15.        "request":      "disassemble"
  16.        "data": {
  17.            "target_id":    0,
  18.            "address":      0x12341234,
  19.            "count":        16,
  20.            "use_capstone": False
  21.        }
  22.    }
  23.  
  24.    `target_id` is optional.
  25.    `address` is the address at which to start disassembling. Defaults to
  26.    instruction pointer if not specified.
  27.    `count` is the number of instructions to disassemble.
  28.    `use_capstone` a flag to indicate whether or not Capstone should be used
  29.    instead of the debugger's disassembler.
  30.    """
  31.     _fields = {'target_id': False, 'address': False, 'count': True, 'use_capstone': False}
  32.  
  33.     target_id = 0
  34.     address = None
  35.     count = 16
  36.  
  37.     @server_side
  38.     def dispatch(self):
  39.         try:
  40.             if self.address == None:
  41.                 pc_name, self.address = voltron.debugger.program_counter(target_id=self.target_id)
  42.             if self.use_capstone:
  43.                 disasm = voltron.debugger.disassemble_capstone(target_id=self.target_id, address=self.address,
  44.                                                                count=self.count)
  45.             else:
  46.                 disasm = voltron.debugger.disassemble(target_id=self.target_id, address=self.address, count=self.count)
  47.             res = APIDisassembleResponse()
  48.             res.disassembly = disasm
  49.             try:
  50.                 res.flavor = voltron.debugger.disassembly_flavor()
  51.             except:
  52.                 res.flavor = 'NA'
  53.             res.host = voltron.debugger._plugin.host
  54.         except NoSuchTargetException:
  55.             res = APINoSuchTargetErrorResponse()
  56.         except TargetBusyException:
  57.             res = APITargetBusyErrorResponse()
  58.         except Exception as e:
  59.             msg = "Unhandled exception {} disassembling: {}".format(type(e), e)
  60.             log.exception(msg)
  61.             res = APIErrorResponse(code=0, message=msg)
  62.  
  63.         return res
  64.  
  65.  
  66. class APIDisassembleResponse(APISuccessResponse):
  67.     """
  68.    API disassemble response.
  69.  
  70.    {
  71.        "type":         "response",
  72.        "status":       "success",
  73.        "data": {
  74.            "disassembly":  "mov blah blah"
  75.        }
  76.    }
  77.    """
  78.     _fields = {'disassembly': True, 'formatted': False, 'flavor': False, 'host': False}
  79.  
  80.     disassembly = None
  81.     formatted = None
  82.     flavor = None
  83.     host = None
  84.  
  85.  
  86. class APIDisassemblePlugin(APIPlugin):
  87.     request = 'disassemble'
  88.     request_class = APIDisassembleRequest
  89.     response_class = APIDisassembleResponse
  90.  
downloaddisassemble.py Source code - Download voltron Source code
Related Source Codes/Software:
IGListKit - A data-driven UICollectionView framework for build... 2017-01-11
androidmvp - MVP Android Example 2017-01-11
svelte - The magical disappearing UI framework ... 2017-01-11
kcptun - A Simple UDP Tunnel Based On KCP 2017-01-11
poisontap - Exploits locked/password protected computers over ... 2017-01-10
ecma262 - Status, process, and documents for ECMA262 ... 2017-01-11
react-native-elements - React Native Elements UI Toolkit 2017-01-11
tensorflow-zh - Google new open source ai system TensorFlow Chines... 2017-01-11
forum - Blue light (the Lantern) the official BBS 2017-01-11
socketcluster - Highly scalable realtime framework ... 2017-01-11
CRYENGINE - CRYENGINE is a powerful real-time game development... 2017-06-11
postal - 2017-06-11
reactide - Reactide is the first dedicated IDE for React web ... 2017-06-11
rkt - rkt is a pod-native container engine for Linux. It... 2017-06-11
uWebSockets - Tiny WebSockets https://for... 2017-06-11
realworld - TodoMVC for the RealWorld - Exemplary fullstack Me... 2017-06-11
goreplay - GoReplay is an open-source tool for capturing and ... 2017-06-10
pyenv - Simple Python version management 2017-06-10
redux-saga - An alternative side effect model for Redux apps ... 2017-06-10
angular-starter - 2017-06-10

 Back to top