BVB Source Codes

voltron Show entry.py Source code

Return Download voltron: download entry.py Source code - Download voltron Source code - Type:.py
  1. """
  2. This is the main entry point for Voltron from the debugger host's perspective.
  3. This file is loaded into the debugger through whatever means the given host
  4. supports.
  5.  
  6. LLDB:
  7.  
  8.    (lldb) command script import /path/to/voltron/entry.py
  9.  
  10. GDB:
  11.  
  12.    (gdb) source /path/to/voltron/entry.py
  13.  
  14. VDB:
  15.  
  16.    (vdb) script /path/to/voltron/entry.py
  17.  
  18. WinDbg/CDB (via PyKD):
  19.  
  20.    > .load pykd.pyd
  21.    > !py --global C:\path\to\voltron\entry.py
  22. """
  23.  
  24. log = None
  25.  
  26. try:
  27.     # fix path if it's clobbered by brew
  28.     import sys
  29.     if sys.platform == 'darwin':
  30.         py_base = '/System/Library/Frameworks/Python.framework/Versions/2.7/'
  31.         new_path = ['lib/python27.zip', 'lib/python2.7', 'lib/python2.7/plat-darwin', 'lib/python2.7/plat-mac',
  32.                     'lib/python2.7/plat-mac/lib-scriptpackages', 'Extras/lib/python', 'lib/python2.7/lib-tk',
  33.                     'lib/python2.7/lib-old', 'lib/python2.7/lib-dynload']
  34.         sys.path = [p for p in sys.path if 'Cellar' not in p] + [py_base + p for p in new_path]
  35. except:
  36.     pass
  37.  
  38. try:
  39.     import logging
  40.     import os
  41.     import sys
  42.     blessed = None
  43.     import blessed
  44.  
  45.     # add vtrace to the path so that dbg_vdb.py can import from vdb/vtrace.
  46.     if "vtrace" in locals():
  47.         def parent_directory(the_path):
  48.             return os.path.abspath(os.path.join(the_path, os.pardir))
  49.  
  50.         def add_vdb_to_path(vtrace):
  51.             sys.path.append(parent_directory(parent_directory(vtrace.__file__)))
  52.  
  53.         add_vdb_to_path(vtrace)
  54.     else:
  55.         pass
  56.  
  57.     import voltron
  58.     from voltron.plugin import pm
  59.     from voltron.core import Server
  60.  
  61.     log = voltron.setup_logging('debugger')
  62.  
  63.     # figure out in which debugger host we are running
  64.     args = []
  65.     host = None
  66.     try:
  67.         import lldb
  68.         host = "lldb"
  69.  
  70.         def invoke(*args):
  71.             voltron.command._invoke(*args)
  72.     except ImportError:
  73.         pass
  74.     try:
  75.         import gdb
  76.         host = "gdb"
  77.     except ImportError:
  78.         pass
  79.     try:
  80.         import pykd
  81.         host = "windbg"
  82.     except:
  83.         pass
  84.     if "vtrace" in locals():
  85.         host = "vdb"
  86.         args = [db]
  87.     if not host:
  88.         raise Exception("No debugger host is present")
  89.  
  90.     # register any plugins that were loaded
  91.     pm.register_plugins()
  92.  
  93.     # get the debugger plugin for the host we're in
  94.     plugin = pm.debugger_plugin_for_host(host)
  95.  
  96.     if not voltron.server:
  97.         # set up command and adaptor instances
  98.         voltron.debugger = plugin.adaptor_class(*args)
  99.         voltron.command = plugin.command_class(*args)
  100.  
  101.         # register command plugins now that we have a debugger host loaded
  102.         pm.register_command_plugins()
  103.  
  104.         # create and start the voltron server
  105.         voltron.server = Server()
  106.         voltron.server.start()
  107.  
  108.         print(blessed.Terminal().bold_red("Voltron loaded."))
  109.         if host == 'lldb' and not voltron.command.registered:
  110.             print("Run `voltron init` after you load a target.")
  111. except Exception as e:
  112.     import traceback
  113.     msg = ("An error occurred while loading Voltron:\n\n{}"
  114.            "\nPlease ensure Voltron is installed correctly per the documentation: "
  115.            "https://github.com/snare/voltron/wiki/Installation").format(traceback.format_exc())
  116.     if blessed:
  117.         msg = blessed.Terminal().bold_red(msg)
  118.     if log:
  119.         log.exception("Exception raised while loading Voltron")
  120.     print(msg)
  121.  
downloadentry.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