BVB Source Codes

voltron Show common.py Source code

Return Download voltron: download common.py Source code - Download voltron Source code - Type:.py
  1. import logging
  2. from mock import Mock
  3.  
  4. LOGGER_DEFAULT = {
  5.     'handlers': ['file'],
  6.     'level': 'DEBUG',
  7.     'propagate': False
  8. }
  9.  
  10. LOG_CONFIG = {
  11.     'version': 1,
  12.     'disable_existing_loggers': False,
  13.     'formatters': {
  14.         'standard': {'format': '[%(levelname)s] %(message)s'},
  15.         'testing': {'format': "%(levelname)-7s %(filename)12s:%(lineno)-4s %(funcName)20s -- %(message)s"}
  16.     },
  17.     'handlers': {
  18.         'default': {
  19.             'class': 'logging.StreamHandler',
  20.             'formatter': 'standard'
  21.         },
  22.         'file': {
  23.             'class': 'logging.FileHandler',
  24.             'formatter': 'testing',
  25.             'filename': 'tests/test.log',
  26.             'delay': True
  27.         }
  28.     },
  29.     'loggers': {
  30.         '':         LOGGER_DEFAULT,
  31.         'debugger': LOGGER_DEFAULT,
  32.         'core':     LOGGER_DEFAULT,
  33.         'main':     LOGGER_DEFAULT,
  34.         'api':      LOGGER_DEFAULT,
  35.         'view':     LOGGER_DEFAULT,
  36.         'plugin':   LOGGER_DEFAULT,
  37.     }
  38. }
  39.  
  40. logging.config.dictConfig(LOG_CONFIG)
  41.  
  42. state_response = "stopped"
  43. targets_response = [{
  44.     "id":       0,
  45.     "file":     "/bin/ls",
  46.     "arch":     "x86_64",
  47.     "state":     "stopped"
  48. }]
  49. registers_response = (
  50.     {"gs": 0, "fooff": 0, "edi": 1, "edx": 1349115624, "r13w": 0, "r8l": 0, "fiseg": 0, "r8d": 0,
  51.         "r13d": 0, "r13l": 0, "fstat": 0, "r8w": 0, "ymm9": "n/a", "ymm8": "n/a", "r14": 0, "r15": 0, "r12": 0, "r13": 0,
  52.         "dh": 222, "di": 1, "ymm1": "n/a", "ymm0": "n/a", "ymm3": "n/a", "ymm2": "n/a", "ymm5": "n/a", "ymm4": "n/a",
  53.         "ymm7": "n/a", "ymm6": "n/a", "dx": 57064, "dil": 1, "xmm6": "n/a", "r10l": 0, "bpl": 200, "r10d": 1349110784,
  54.         "xmm10": "n/a", "xmm11": "n/a", "xmm12": "n/a", "xmm13": "n/a", "xmm14": "n/a", "xmm15": "n/a", "fioff": 0,
  55.         "sil": 216, "r10w": 52224, "mxcsr": 8064, "ebp": 1349115592, "ebx": 0, "r15d": 0, "fop": 0, "esp": 1349115576,
  56.         "r15l": 0, "r15w": 0, "ftag": 0, "esi": 1349115608, "bl": 0, "bh": 0, "xmm2": "n/a", "xmm3": "n/a", "xmm0": "n/a",
  57.         "xmm1": "n/a", "bp": 57032, "xmm7": "n/a", "xmm4": "n/a", "xmm5": "n/a", "xmm8": "n/a", "xmm9": "n/a", "bx": 0,
  58.         "ecx": 1349115632, "r9l": 0, "dl": 232, "r12w": 0, "r9d": 1349111808, "r8": 0, "rdx": 140734542503656, "r12d": 0,
  59.         "r9w": 53248, "rdi": 1, "r12l": 0, "ch": 222, "cl": 240, "stmm4": "n/a", "stmm5": "n/a", "stmm6": "n/a", "stmm7":
  60.         "n/a", "stmm0": "n/a", "stmm1": "n/a", "stmm2": "n/a", "stmm3": "n/a", "cx": 57072, "cs": 43,
  61.         "rcx": 140734542503664, "rflags": 582, "rsi": 140734542503640, "mxcsrmask": 65535, "eax": 257305888,
  62.         "rsp": 140734542503608, "trapno": 3, "r14d": 0, "faultvaddr": 4552486912, "err": 0, "rbx": 0, "r14l": 0,
  63.         "rbp": 140734542503624, "r14w": 0, "ah": 45, "al": 32, "rip": 4552273184, "r9": 140734542499840, "spl": 184,
  64.         "ax": 11552, "fctrl": 895, "rax": 4552273184, "r11l": 70, "r10": 140734542498816, "r11": 582, "r11d": 582,
  65.         "foseg": 0, "r11w": 582, "fs": 0, "ymm11": "n/a", "ymm10": "n/a", "ymm13": "n/a", "ymm12": "n/a", "ymm15": "n/a",
  66.         "ymm14": "n/a", "sp": 57016, "si": 57048})
  67. memory_response = "\xff" * 0x40
  68. stack_response = "\xff" * 0x40
  69. wait_response = "stopped"
  70. command_response = "inferior`main:\n-> 0x100000d20:  pushq  %rbp\n   0x100000d21:  movq   %rsp, %rbp\n   0x100000d24:  subq   $0x40, %rsp\n   0x100000d28:  movl   $0x0, -0x4(%rbp)\n   0x100000d2f:  movl   %edi, -0x8(%rbp)\n   0x100000d32:  movq   %rsi, -0x10(%rbp)\n   0x100000d36:  movl   $0x0, -0x14(%rbp)\n   0x100000d3d:  movq   $0x0, -0x20(%rbp)\n   0x100000d45:  cmpl   $0x1, -0x8(%rbp)\n   0x100000d4c:  jle    0x100000d94               ; main + 116\n   0x100000d52:  movq   -0x10(%rbp), %rax\n   0x100000d56:  movq   0x8(%rax), %rdi\n   0x100000d5a:  leaq   0x18a(%rip), %rsi         ; \"sleep\"\n   0x100000d61:  callq  0x100000ea0               ; symbol stub for: strcmp\n   0x100000d66:  cmpl   $0x0, %eax\n   0x100000d6b:  jne    0x100000d94               ; main + 116\n   0x100000d71:  leaq   0x179(%rip), %rdi         ; \"*** Sleeping for 5 seconds\\n\"\n   0x100000d78:  movb   $0x0, %al\n   0x100000d7a:  callq  0x100000e94               ; symbol stub for: printf\n   0x100000d7f:  movl   $0x5, %edi\n   0x100000d84:  movl   %eax, -0x24(%rbp)\n   0x100000d87:  callq  0x100000e9a               ; symbol stub for: sleep\n   0x100000d8c:  movl   %eax, -0x28(%rbp)\n   0x100000d8f:  jmpq   0x100000e88               ; main + 360\n   0x100000d94:  cmpl   $0x1, -0x8(%rbp)\n   0x100000d9b:  jle    0x100000dd6               ; main + 182\n   0x100000da1:  movq   -0x10(%rbp), %rax\n   0x100000da5:  movq   0x8(%rax), %rdi\n   0x100000da9:  leaq   0x15d(%rip), %rsi         ; \"loop\"\n   0x100000db0:  callq  0x100000ea0               ; symbol stub for: strcmp\n   0x100000db5:  cmpl   $0x0, %eax\n   0x100000dba:  jne    0x100000dd6               ; main + 182"
  71. disassemble_response = command_response
  72. dereference_response = [[u'pointer', 140734748778168], [u'pointer', 140735677462013], [u'symbol', u'start + 0x1']]
  73. breakpoints_response = {"status": "success", "data": {"breakpoints": [{"one_shot": False, "enabled": True, "id": 1, "hit_count": 1, "locations": [{"name": "inferior`main", "address": 4294970608}]}]}, "type": "response"}
  74.  
  75.  
  76. def inject_mock(adaptor):
  77.     adaptor.version = Mock(return_value='lldb-something')
  78.     adaptor.state = Mock(return_value=state_response)
  79.     adaptor.target = Mock(return_value=targets_response[0])
  80.     adaptor._target = Mock(return_value=targets_response[0])
  81.     adaptor.targets = Mock(return_value=targets_response)
  82.     adaptor.registers = Mock(return_value=registers_response)
  83.     adaptor.memory = Mock(return_value=memory_response)
  84.     adaptor.stack = Mock(return_value=stack_response)
  85.     adaptor.wait = Mock(return_value=wait_response)
  86.     adaptor.command = Mock(return_value=command_response)
  87.     adaptor.disassemble = Mock(return_value=disassemble_response)
  88.     adaptor.dereference = Mock(return_value=dereference_response)
  89.     adaptor.breakpoints = Mock(return_value=breakpoints_response)
  90.     adaptor.stack_pointer = Mock(return_value=('sp', 0))
  91.     adaptor.program_counter = Mock(return_value=('pc', 0))
  92.  
downloadcommon.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