BVB Source Codes

voltron Show controllers.js Source code

Return Download voltron: download controllers.js Source code - Download voltron Source code - Type:.js
  1. function f_hex(number, pad)
  2. {
  3.     return ("000000000000000000000000000000" + number.toString(16)).substr(-pad).toUpperCase();
  4. }
  5.  
  6. angular.module('VoltronApp.controllers', []).
  7. controller('voltronController', function($scope, voltronAPIservice)
  8. {
  9.     $scope.version = null;
  10.     $scope.registers = [];
  11.     $scope.disassembly = null;
  12.     var state = null;
  13.     var new_regs = null;
  14.     var old_regs = [];
  15.  
  16.     voltronAPIservice.version().success(function (response) {
  17.         $scope.version = response.data;
  18.     });
  19.  
  20.     var format_registers = function(new_regs, old_regs, arch) {
  21.         fmt = []
  22.         if (arch == 'x86_64') {
  23.             regs = ['rip','rax','rbx','rcx','rdx','rbp','rsp','rdi','rsi','r8','r9','r10','r11','r12','r13','r14','r15']
  24.             for (i = 0; i < regs.length; i++) {
  25.                 fmt.push({
  26.                     name: (regs[i].length == 2 ? String.fromCharCode(160) + regs[i] : regs[i]),
  27.                     value: f_hex(new_regs[regs[i]], 16),
  28.                     class: (new_regs[regs[i]] != old_regs[regs[i]] ? "reg_highlight" : "reg_normal")
  29.                 })
  30.             }
  31.         }
  32.         return fmt
  33.     }
  34.  
  35.     var format_disasm = function(disasm) {
  36.         lines = disasm.split();
  37.  
  38.         // trim lldb's "inferior`main:" so hljs works
  39.         if (lines[0].indexOf("`") > -1) {
  40.             lines.splice(0, 1);
  41.         }
  42.  
  43.         return lines.join('\n');
  44.     }
  45.  
  46.     var update = function() {
  47.         // get target info
  48.         voltronAPIservice.targets().success(function (response) {
  49.             targets = response.data.targets;
  50.  
  51.             // make sure we have a target
  52.             if (targets[0]['arch'] != null) {
  53.                 // update registers
  54.                 voltronAPIservice.registers().success(function (response) {
  55.                     // get new register values
  56.                     new_regs = response.data.registers
  57.  
  58.                     // format registers
  59.                     $scope.registers = format_registers(new_regs, old_regs, targets[0]['arch']);
  60.  
  61.                     // keep old registers
  62.                     old_regs = new_regs;
  63.                 });
  64.  
  65.                 // update disassembly
  66.                 voltronAPIservice.disassemble(null, 32).success(function (response) {
  67.                     $scope.disassembly = response.data.formatted;
  68.                 });
  69.             }
  70.         });
  71.     }
  72.  
  73.     var poll = function() {
  74.         // wait for the next state change
  75.         response = voltronAPIservice.wait(30).success(function (response) {
  76.             if (response.status == "success") {
  77.                 update();
  78.             }
  79.  
  80.             // wait for the next state change
  81.             poll();
  82.         });
  83.     };
  84.  
  85.     // initial update
  86.     update();
  87.  
  88.     // start waiting for debugger stops
  89.     poll();
  90. });
downloadcontrollers.js 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
mobile-chrome-apps - Chrome apps on Android and iOS 2017-02-20
pycrumbs - Bits and bytes of Python from the Internet 2017-02-20
drupal - Verbatim mirror of the git.drupal.org repository f... 2017-02-20
elasticsearch-head - A web front end for an elastic search cluster 2017-02-19
launchrocket - A Mac PrefPane to manage all your Homebrew-install... 2017-02-19
jquery-boilerplate - A jump-start for jQuery plugins development ... 2017-02-19
MVVMReactiveCocoa - GitBucket iOS A 2017-02-19
ios-webkit-debug-proxy - A DevTools proxy (Chrome Remote Debugging Protocol... 2017-02-19
jump.js - A modern smooth scrolling library. ... 2017-02-19
GoSublime - A Golang plugin collection for SublimeText **3**, ... 2017-02-19

 Back to top