BVB Source Codes

voltron Show registers.py Source code

Return Download voltron: download registers.py Source code - Download voltron Source code - Type:.py
  1. import voltron
  2. import logging
  3.  
  4. from voltron.api import *
  5.  
  6. log = logging.getLogger('api')
  7.  
  8.  
  9. class APIRegistersRequest(APIRequest):
  10.     """
  11.    API state request.
  12.  
  13.    {
  14.        "type":         "request",
  15.        "request":      "registers",
  16.        "data": {
  17.            "target_id": 0,
  18.            "thread_id": 123456,
  19.            "registers": ['rsp']
  20.        }
  21.    }
  22.  
  23.    `target_id` and `thread_id` are optional. If not present, the currently
  24.    selected target and thread will be used.
  25.  
  26.    `registers` is optional. If it is not included all registers will be
  27.    returned.
  28.    """
  29.     _fields = {'target_id': False, 'thread_id': False, 'registers': False}
  30.  
  31.     target_id = 0
  32.     thread_id = None
  33.     registers = []
  34.  
  35.     @server_side
  36.     def dispatch(self):
  37.         try:
  38.             regs = voltron.debugger.registers(target_id=self.target_id, thread_id=self.thread_id, registers=self.registers)
  39.             res = APIRegistersResponse()
  40.             res.registers = regs
  41.             res.deref = {}
  42.             for reg, val in regs.items():
  43.                 try:
  44.                     if val > 0:
  45.                         try:
  46.                             res.deref[reg] = voltron.debugger.dereference(pointer=val)
  47.                         except:
  48.                             res.deref[reg] = []
  49.                     else:
  50.                         res.deref[reg] = []
  51.                 except TypeError:
  52.                     res.deref[reg] = []
  53.         except TargetBusyException:
  54.             res = APITargetBusyErrorResponse()
  55.         except NoSuchTargetException:
  56.             res = APINoSuchTargetErrorResponse()
  57.         except Exception as e:
  58.             msg = "Exception getting registers from debugger: {}".format(repr(e))
  59.             log.exception(msg)
  60.             res = APIGenericErrorResponse(msg)
  61.  
  62.         return res
  63.  
  64.  
  65. class APIRegistersResponse(APISuccessResponse):
  66.     """
  67.    API status response.
  68.  
  69.    {
  70.        "type":         "response",
  71.        "status":       "success",
  72.        "data": {
  73.            "registers": { "rip": 0x12341234, ... },
  74.            "deref": {"rip": [(pointer, 0x12341234), ...]}
  75.        }
  76.    }
  77.    """
  78.     _fields = {'registers': True, 'deref': False}
  79.  
  80.  
  81. class APIRegistersPlugin(APIPlugin):
  82.     request = 'registers'
  83.     request_class = APIRegistersRequest
  84.     response_class = APIRegistersResponse
  85.  
downloadregisters.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
discover-flask - Full Stack Web Development with Flask. ... 2017-01-12
spring-mvc-showcase - Demonstrates the features of the Spring MVC web fr... 2017-01-12
tushare - TuShare is a utility for crawling historical data ... 2017-01-12
raml-spec - RAML Specification http://raml.... 2017-01-12
android-stackblur - Android StackBlur is a library that can perform a ... 2017-01-12
sound-redux - A Soundcloud client built with React / Redux ... 2017-01-12
httpstat - curl statistics made simple 2017-01-12
vim - Vim configuration file and plug-ins 2017-01-12
appframework - The definitive HTML5 mobile javascript framework ... 2017-01-12
BaiduExporter - Assistant for Baidu to export download links to ar... 2017-01-11

 Back to top