refactor of symbols menu, new entropy panel, refactor of string and setting panel in their own js

This commit is contained in:
Alvaro Muñoz 2014-12-03 22:14:25 +01:00 committed by pancake
parent 94cb42da4c
commit aa759f674d
8 changed files with 684 additions and 84 deletions

View File

@ -732,10 +732,15 @@ static int bin_imports (RCore *r, int mode, ut64 baddr, int va, const char *name
imports = r_bin_get_imports (r->bin);
if (mode & R_CORE_BIN_JSON) {
ut64 addr;
r_cons_printf ("[");
r_list_foreach (imports, iter, import)
r_cons_printf ("%s{\"name\":\"%s\"}",
iter->p?",":"", import->name);
r_list_foreach (imports, iter, import) {
if (name && strcmp (import->name, name))
continue;
addr = impaddr (r->bin, va, baddr, import->name);
r_cons_printf ("%s{\"name\":\"%s\", \"plt\":%"PFMT64d"}",
iter->p?",":"", import->name, addr);
}
r_cons_printf ("]");
} else
if ((mode & R_CORE_BIN_SIMPLE)) {
@ -1153,7 +1158,7 @@ static int bin_sections (RCore *r, int mode, ut64 baddr, ut64 laddr, int va, ut6
char *chkstr;
ut8 *data = malloc (section->size);
ut32 datalen = section->size;
// VA READ IS BROKEN?
// VA READ IS BROKEN?
r_io_pread (r->io, section->paddr, data, datalen);
chkstr = r_hash_to_string (NULL, chksum, data, datalen);
free (data);

View File

@ -10,27 +10,27 @@
<link rel="stylesheet" type="text/css" href="./lib/css/layout-default-latest.css" />
<link rel="stylesheet" type="text/css" href="./lib/css/jquery.ui.tabs.css" />
<link rel="stylesheet" type="text/css" href="./lib/css/jquery-ui.css" />
<link rel="stylesheet" type="text/css" href="../enyo/disasm.css" />
<link rel="stylesheet" type="text/css" href="./lib/css/tree.jquery.css" />
<link rel="stylesheet" type="text/css" href="./lib/css/main.css" />
<link rel="stylesheet" type="text/css" href="./lib/css/jquery.onoff.css" />
<script type="text/javascript" src="../enyo/js/viz.js"></script>
<script type="text/javascript" src="../enyo/js/r2.js"></script>
<script type="text/javascript" src="../enyo/js/r2ui.js"></script>
<script type="text/javascript" src="../enyo/js/disasm.js"></script>
<script type="text/javascript" src="./lib/js/jquery-1.9.0.js"></script>
<script type="text/javascript" src="./lib/js/jquery-ui-latest.js"></script>
<script type="text/javascript" src="./lib/js/jquery.onoff.js"></script>
<script type="text/javascript" src="./lib/js/jquery.ui-contextmenu.js"></script>
<script type="text/javascript" src="./lib/js/jquery.layout-latest.js"></script>
<script type="text/javascript" src="./lib/js/tree.jquery.js"></script>
<script type="text/javascript" src="./lib/js/jquery.layout.resizePaneAccordions-latest.js"></script>
<script type="text/javascript" src="./lib/js/jquery.scrollTo-latest.js"></script>
<script type="text/javascript" src="./lib/js/disasm_panel.js"></script>
<script type="text/javascript" src="./lib/js/entropy_panel.js"></script>
<script type="text/javascript" src="./lib/js/strings_panel.js"></script>
<script type="text/javascript" src="./lib/js/hex_panel.js"></script>
<script type="text/javascript" src="./lib/js/settings_panel.js"></script>
<script type="text/javascript" src="./lib/js/main.js"></script>
</head>
@ -53,18 +53,19 @@
<!-- CENTER -->
<div id="main_panel" class="ui-layout-center ec_background">
<!-- center Tabs layout -->
<ul style="-moz-border-radius-bottomleft: 0; -moz-border-radius-bottomright: 0;">
<li><a id="disasm_tab_link" href="#disasm_tab"><span>Disassembler</span></a></li>
<li><a href="#hex_tab"><span>Hex Dump</span></a></li>
<li><a href="#strings_tab"><span>Strings</span></a></li>
<li><a href="#entropy_tab"><span>Entropy</span></a></li>
<li><a href="#settings_tab"><span>Settings</span></a></li>
</ul>
<div id="center_panel" class="ui-layout-content ui-widget-content ui-corner-bottom" style="border-top: 0; padding-bottom: 1em;">
<div id="disasm_tab"></div>
<div id="hex_tab"></div>
<div id="strings_tab"><div id="strings" style="color:rgb(127,127,127);"></div></div>
<div id="settings_tab"><h3>Colors:</h3><iframe id="colors_frame" name="colors_frame" src="colors.html" width="100%" height="400px"></iframe></div>
<div id="strings_tab"></div>
<div id="entropy_tab"></div>
<div id="settings_tab"></div>
</div>
<div>
<h3 class="header-footer ui-state-default ui-corner-all" style="padding: 3px 5px 5px; margin-top: 1ex;" id="history">_</h3>

View File

@ -0,0 +1,83 @@
/**
* onoff.css
* Author: http://proto.io/freebies/onoff/
* Author: Timmy Willison
*/
.onoffswitch {
position: relative;
width: 70px;
-webkit-user-select: none;
-moz-user-select: none;
-ms-user-select: none;
user-select: none;
}
.onoffswitch-checkbox {
display: none;
}
.onoffswitch-label {
display: block;
overflow: hidden;
cursor: pointer;
border: 2px solid #999999;
border-radius: 20px;
}
.onoffswitch-inner {
display: block;
width: 200%;
margin-left: -100%;
-webkit-transition: margin 0.2s ease-in;
transition: margin 0.2s ease-in;
}
.onoffswitch-inner:before, .onoffswitch-inner:after {
float: left;
padding: 0;
width: 50%;
height: 26px;
color: white;
font: bold 14px/26px Trebuchet, Arial, sans-serif;
-webkit-box-sizing: border-box;
-moz-box-sizing: border-box;
box-sizing: border-box;
}
.onoffswitch-inner:before {
content: "YES";
padding-left: 10px;
color: #FFFFFF;
background-color: #464746;
}
.onoffswitch-inner:after {
content: "NO";
padding-right: 10px;
color: #999999;
background-color: #EEEEEE;
text-align: right;
}
.onoffswitch-switch {
position: absolute;
display: block;
top: 0;
bottom: 0;
right: 40px;
width: 18px;
margin: 4px;
background: white;
border: 2px solid #999999;
border-radius: 20px;
-webkit-transition: right 0.2s ease-in, -webkit-box-shadow 0.2s ease-in;
transition: right 0.2s ease-in, box-shadow 0.2s ease-in;
}
.onoffswitch-checkbox:checked + .onoffswitch-label .onoffswitch-inner {
margin-left: 0;
}
.onoffswitch-checkbox:checked + .onoffswitch-label .onoffswitch-switch {
right: 0;
}

View File

@ -0,0 +1,49 @@
// ENTROPY PANEL
var EntropyPanel = function () {
};
EntropyPanel.prototype.render = function() {
var table = "<table id='entropy_chart'>";
r2.cmd("p=", function(x) {
var blocks = x.split('\n');
for (var i in blocks) {
var block = blocks[i];
var idx = block.split(' ')[0];
var value = parseInt(block.split(' ')[1],16);
if (value > 0) {
table += "<tr><td>" + idx + "</td><td>" + value + "</td></tr>";
}
}
});
table += "</table>";
$("#entropy_tab").html("<pre id='hexdump' style='color:rgb(127,127,127);''>" + table + "</pre>");
$("#entropy_chart").horizontalTableGraph();
};
jQuery.fn.horizontalTableGraph = function() {
$(this).find("thead").remove();
var maxvalue = 0;
$(this).find("tr").each(function(i) {
$(this).removeClass();
$(this).find("td").eq(0).animate({width : '50px'}, 1000);
$(this).find("td").eq(1).animate({width : '500px'}, 1000).css("text-align","left");
$(this).find("td").eq(1).css("width","500px");
var getvalue = $(this).find("td").eq(1).html();
maxvalue = Math.max(maxvalue,getvalue);
});
$(this).find("tr").each(function(i) {
var thevalue = $(this).find("td").eq(1).html();
var newBar = $("<span>").html(thevalue);
newBar.css({
"display": "block",
"width": "0px",
"backgroundColor": "#600",
"marginBottom": "0px",
"padding": "0px",
"color": "#FFF"
});
$(this).find("td").eq(1).html(newBar);
newBar.animate({"width": (100 * thevalue / maxvalue) + "%"}, "slow");
})
};

View File

@ -0,0 +1,413 @@
/** jquery.onoff - v0.4.0 - 2014-10-30
* https://github.com/timmywil/jquery.onoff
* Copyright (c) 2014 Timmy Willison; Licensed MIT */
(function(global, factory) {
// AMD
if (typeof define === 'function' && define.amd) {
define([ 'jquery' ], factory);
// CommonJS/Browserify
} else if (typeof exports === 'object') {
factory(require('jquery'));
// Global
} else {
factory(global.jQuery);
}
}(this, function($) {
'use strict';
// Common properties to lift for touch or pointer events
var list = 'over out down up move enter leave cancel'.split(' ');
var hook = $.extend({}, $.event.mouseHooks);
var events = {};
// Support pointer events in IE11+ if available
if ( window.PointerEvent ) {
$.each(list, function( i, name ) {
// Add event name to events property and add fixHook
$.event.fixHooks[
(events[name] = 'pointer' + name)
] = hook;
});
} else {
var mouseProps = hook.props;
// Add touch properties for the touch hook
hook.props = mouseProps.concat(['touches', 'changedTouches', 'targetTouches', 'altKey', 'ctrlKey', 'metaKey', 'shiftKey']);
/**
* Support: Android
* Android sets pageX/Y to 0 for any touch event
* Attach first touch's pageX/pageY and clientX/clientY if not set correctly
*/
hook.filter = function( event, originalEvent ) {
var touch;
var i = mouseProps.length;
if ( !originalEvent.pageX && originalEvent.touches && (touch = originalEvent.touches[0]) ) {
// Copy over all mouse properties
while(i--) {
event[mouseProps[i]] = touch[mouseProps[i]];
}
}
return event;
};
$.each(list, function( i, name ) {
// No equivalent touch events for over and out
if (i < 2) {
events[ name ] = 'mouse' + name;
} else {
var touch = 'touch' +
(name === 'down' ? 'start' : name === 'up' ? 'end' : name);
// Add fixHook
$.event.fixHooks[ touch ] = hook;
// Add event names to events property
events[ name ] = touch + ' mouse' + name;
}
});
}
$.pointertouch = events;
var count = 1;
var slice = Array.prototype.slice;
/**
* Create an OnOff object for a given element
* @constructor
* @param {Element} elem - Element to use pan and zoom
* @param {Object} [options] - An object literal containing options
* to override default options (See OnOff.defaults)
*/
function OnOff(elem, options) {
// Allow instantiation without `new` keyword
if (!(this instanceof OnOff)) {
return new OnOff(elem, options);
}
// Sanity checks
if (elem.nodeName.toLowerCase() !== 'input' || elem.type !== 'checkbox') {
return $.error('OnOff should be called on checkboxes');
}
// Don't remake
var d = $.data(elem, OnOff.datakey);
if (d) {
return d;
}
// Extend default with given object literal
// Each instance gets its own options
this.options = options = $.extend({}, OnOff.defaults, options);
this.elem = elem;
this.$elem = $(elem).addClass(options.className);
this.$doc = $(elem.ownerDocument || document);
// Add guid to event namespace
options.namespace += $.guid++;
// Add an ID if none has been added
if (!elem.id) {
elem.id = 'onoffswitch' + count++;
}
// Enable
this.enable();
// Save the instance
$.data(elem, OnOff.datakey, this);
}
OnOff.datakey = '_onoff';
OnOff.defaults = {
// The event namespace
// Should always be non-empty
// Used to bind jQuery events without collisions
namespace: '.onoff',
// The class added to the checkbox (see the CSS file)
className: 'onoffswitch-checkbox'
};
OnOff.prototype = {
constructor: OnOff,
/**
* @returns {OnOff} Returns the instance
*/
instance: function() {
return this;
},
/**
* Wrap the checkbox and add the label element
*/
wrap: function() {
var elem = this.elem;
var $elem = this.$elem;
var options = this.options;
// Get or create elem wrapper
var $con = $elem.parent('.onoffswitch');
if (!$con.length) {
$elem.wrap('<div class="onoffswitch"></div>');
$con = $elem.parent()
.addClass(elem.className.replace(options.className, ''));
}
this.$con = $con;
// Get or create label
var $label = $elem.next('label[for="' + elem.id + '"]');
if (!$label.length) {
$label = $('<label/>')
.attr('for', elem.id)
.insertAfter(elem);
}
this.$label = $label.addClass('onoffswitch-label');
// Inner
var $inner = $label.find('.onoffswitch-inner');
if (!$inner.length) {
$inner = $('<span/>')
.addClass('onoffswitch-inner')
.prependTo($label);
}
this.$inner = $inner;
// Switch
var $switch = $label.find('.onoffswitch-switch');
if (!$switch.length) {
$switch = $('<span/>')
.addClass('onoffswitch-switch')
.appendTo($label);
}
this.$switch = $switch;
},
/**
* Handles the move event on the switch
*/
_handleMove: function(e) {
if (this.disabled) return;
this.moved = true;
this.lastX = e.pageX;
var right = Math.max(Math.min(this.startX - this.lastX, this.maxRight), 0);
this.$switch.css('right', right);
this.$inner.css('marginLeft', -(right / this.maxRight) * 100 + '%');
},
/**
* Bind the move and end events to the document
*/
_startMove: function(e) {
// Prevent default to avoid touch event collision
e.preventDefault();
var moveType, endType;
if (e.type === 'pointerdown') {
moveType = 'pointermove';
endType = 'pointerup';
} else if (e.type === 'touchstart') {
moveType = 'touchmove';
endType = 'touchend';
} else {
moveType = 'mousemove';
endType = 'mouseup';
}
var elem = this.elem;
var $elem = this.$elem;
var ns = this.options.namespace;
// Disable transitions
var $handle = this.$switch;
var handle = $handle[0];
var $t = this.$inner.add($handle).css('transition', 'none');
// Starting values
this.maxRight = this.$con.width() - $handle.width() -
$.css(handle, 'margin-left', true) -
$.css(handle, 'margin-right', true) -
$.css(handle, 'border-left-width', true) -
$.css(handle, 'border-right-width', true);
var startChecked = elem.checked;
this.moved = false;
this.startX = e.pageX + (startChecked ? 0 : this.maxRight);
// Bind document events
var self = this;
var $doc = this.$doc
.on(moveType + ns, $.proxy(this._handleMove, this))
.on(endType + ns, function() {
// Reenable transition
$t.css('transition', '');
$doc.off(ns);
setTimeout(function() {
// If there was a move
// ensure the proper checked value
if (self.moved) {
var checked = self.lastX > (self.startX - self.maxRight / 2);
if (elem.checked !== checked) {
elem.checked = checked;
// Trigger change in case it wasn't already fired
$elem.trigger('change');
}
}
// Normalize CSS and animate
self.$switch.css('right', '');
self.$inner.css('marginLeft', '');
});
});
},
/**
* Binds all necessary events
*/
_bind: function() {
this._unbind();
this.$switch.on(
$.pointertouch.down,
$.proxy(this._startMove, this)
);
},
/**
* Enable or re-enable the onoff instance
*/
enable: function() {
// Ensures the correct HTML before binding
this.wrap();
this._bind();
this.disabled = false;
},
/**
* Unbind all events
*/
_unbind: function() {
this.$doc.add(this.$switch).off(this.options.namespace);
},
/**
* Disable onoff
* Removes all added HTML
*/
disable: function() {
this.disabled = true;
this._unbind();
},
/**
* Removes all onoffswitch HTML and leaves the checkbox
* Also disables this instance
*/
unwrap: function() {
// Destroys this OnOff
this.disable();
this.$label.remove();
this.$elem.unwrap().removeClass(this.options.className);
},
/**
* @returns {Boolean} Returns whether the current onoff instance is disabled
*/
isDisabled: function() {
return this.disabled;
},
/**
* Destroy the onoff instance
*/
destroy: function() {
this.disable();
$.removeData(this.elem, OnOff.datakey);
},
/**
* Get/set option on an existing instance
* @returns {Array|undefined} If getting, returns an array of
* all values on each instance for a given key. If setting,
* continue chaining by returning undefined.
*/
option: function(key, value) {
var newOpts;
var options = this.options;
if (!key) {
// Avoids returning direct reference
return $.extend({}, options);
}
if (typeof key === 'string') {
if (arguments.length === 1) {
return options[ key ] !== undefined ?
options[ key ] :
null;
}
newOpts = {};
newOpts[ key ] = value;
} else {
newOpts = key;
}
// Set options
$.each(newOpts, $.proxy(function(k, val) {
switch(k) {
case 'namespace':
this._unbind();
break;
case 'className':
this.$elem.removeClass(options.className);
}
options[ k ] = val;
switch(k) {
case 'namespace':
this._bind();
break;
case 'className':
this.$elem.addClass(val);
}
}, this));
}
};
/**
* Extend jQuery
* @param {Object|String} options - The name of a method to call
* on the prototype or an object literal of options
* @returns {jQuery|Mixed} jQuery instance for regular chaining or
* the return value(s) of a onoff method call
*/
$.fn.onoff = function(options) {
var instance, args, m, ret;
// Call methods widget-style
if (typeof options === 'string') {
ret = [];
args = slice.call(arguments, 1);
this.each(function() {
instance = $.data(this, OnOff.datakey);
if (!instance) {
ret.push(undefined);
// Ignore methods beginning with `_`
} else if (options.charAt(0) !== '_' &&
typeof (m = instance[ options ]) === 'function' &&
// If nothing is returned, do not add to return values
(m = m.apply(instance, args)) !== undefined) {
ret.push(m);
}
});
// Return an array of values for the jQuery instances
// Or the value itself if there is only one
// Or keep chaining
return ret.length ?
(ret.length === 1 ? ret[0] : ret) :
this;
}
return this.each(function() { new OnOff(this, options); });
};
return ($.OnOff = OnOff);
}));

View File

@ -3,6 +3,11 @@ var myLayout;
$(document).ready( function() {
// create tabs FIRST so elems are correct size BEFORE Layout measures them
$("#main_panel").tabs({
select: function( event, ui ) {
if(ui.tab.innerText == "Entropy") r2ui._ent.render();
if(ui.tab.innerText == "Strings") r2ui._str.render();
if(ui.tab.innerText == "Settings") r2ui._set.render();
},
activate: function( event, ui ) {
r2ui.seek("$$", false);
scroll_to_element(r2ui._dis.selected);
@ -34,7 +39,13 @@ $(document).ready( function() {
// Create panels
var disasm_panel = new DisasmPanel();
var hex_panel = new HexPanel();
var entropy_panel = new EntropyPanel();
var strings_panel = new StringsPanel();
var settings_panel = new SettingsPanel();
r2ui._ent = entropy_panel;
r2ui._dis = disasm_panel;
r2ui._str = strings_panel;
r2ui._set = settings_panel;
r2ui._hex = hex_panel;
// For enyo compatibility
@ -124,6 +135,12 @@ $(document).ready( function() {
$(document).contextmenu("showEntry", "comment", false);
$(document).contextmenu("showEntry", "rename", false);
}
if (ui.target.hasClass('import')) {
$(document).contextmenu("showEntry", "define", false);
$(document).contextmenu("showEntry", "undefine", false);
$(document).contextmenu("showEntry", "comment", false);
$(document).contextmenu("showEntry", "rename", false);
}
},
select: function(event, ui) {
$(document).contextmenu("close");
@ -338,7 +355,8 @@ function do_rename(element, inEvent) {
var address = get_address_from_class(element);
if ($(element).hasClass("addr") && $(element).hasClass("flag")) {
var space = "*";
if ($(element).hasClass("symbol")) space = "functions";
if ($(element).hasClass("function")) space = "functions";
if ($(element).hasClass("import")) space = "functions";
if ($(element).hasClass("symbol")) space = "symbols";
if ($(element).hasClass("reloc")) space = "relocs";
if ($(element).hasClass("section")) space = "sections";
@ -407,37 +425,34 @@ function do_define(element) {
}
function rename(offset, old_value, new_value, space) {
var renamed = false;
// If current offset is the beggining of a function, rename it with afr
r2.cmdj("pdfj @ " + offset, function(x) {
if (x !== null && x !== undefined) {
if ("0x" + x.addr.toString(16) === offset) {
console.log("rename function");
r2.cmd("afn " + new_value + " " + offset, function() {
renamed = true;
});
}
}
});
// Otherwise just add a flag
if (space === undefined) space = "functions";
// r2.cmd("fs " + space + ";f~"+old_value, function(x) {
// console.log(x.length);
// });
if (!renamed) {
if (new_value !== "" && old_value !== "") {
var cmd = "fs " + space + ";fr " + old_value + " " + new_value;
console.log(cmd);
r2.cmd(cmd, function() {});
} else if (new_value === "" && old_value !== "") {
var cmd = "fs " + space + ";f-@" + offset;
console.log(cmd);
r2.cmd(cmd, function() {});
} else if (new_value !== "" && old_value === "") {
var cmd = "fs " + space + ";f " + new_value + " @ " + offset;
console.log(cmd);
r2.cmd(cmd, function() {});
}
if (space == "functions") {
// If current offset is the beggining of a function, rename it with afr
r2.cmdj("pdfj @ " + offset, function(x) {
if (x !== null && x !== undefined) {
if ("0x" + x.addr.toString(16) === offset) {
r2.cmd("afn " + new_value + " " + offset, function() {
console.log("rename function");
r2.update_flags();
return;
});
}
}
});
}
// Otherwise just add a flag
if (new_value !== "" && old_value !== "") {
var cmd = "fs " + space + ";fr " + old_value + " " + new_value;
console.log(cmd);
r2.cmd(cmd, function() {});
} else if (new_value === "" && old_value !== "") {
var cmd = "fs " + space + ";f-@" + offset;
console.log(cmd);
r2.cmd(cmd, function() {});
} else if (new_value !== "" && old_value === "") {
var cmd = "fs " + space + ";f " + new_value + " @ " + offset;
console.log(cmd);
r2.cmd(cmd, function() {});
}
r2.update_flags();
}
@ -531,15 +546,14 @@ function update_binary_details() {
r2.cmdj("isj", function(x) {
render_symbols(x);
});
// <div id="strings"></div>
r2.cmdj("izj", function(x) {
render_strings(x);
});
// <div id="functions"></div>
// <div id="imports"></div>
r2.cmdj("afj", function(x) {
render_functions(x);
});
// <div id="imports"></div>
r2.cmdj("iij", function(x) {
render_imports(x);
});
// <div id="relocs"></div>
r2.cmdj("irj", function(x) {
render_relocs(x);
@ -563,27 +577,23 @@ function update_binary_details() {
function render_functions(functions) {
// TODO: Sometimes undefined is printed
var imports = null;
r2.cmdj("iij", function(x) {
imports = x;
});
var fcn_data = [];
var imp_data = [];
for (var i in functions) {
var f = functions[i];
if (f.type == "sym" && f.name !== undefined) {
var id = {
label: "<span class='flag import addr addr_" + "0x" + f.offset.toString(16) + "'>" + f.name + "</span>",
children: [ {label: "offset: " + "0x" + f.offset.toString(16)}, {label: "size: " + f.size} ] };
if (f.callrefs.length > 0) {
var xrefs = {label: "xrefs:", children: []};
for (var j in f.callrefs) {
xrefs.children[xrefs.children.length] = "0x" + f.callrefs[j].addr.toString(16) + " (" + (f.callrefs[j].type == "C"? "call":"jump") + ")";
}
id.children[fd.children.length] = xrefs;
}
imp_data[fcn_data.length] = id;
}
if (f.type == "fcn" && f.name !== undefined) {
if (f.name !== undefined) {
var is_import = false;
for (var k in imports) if (f.offset === imports[k].plt) is_import = true;
if (is_import) continue;
var fd = {
label: "<span class='flag function addr addr_" + "0x" + f.offset.toString(16) + "'>" + f.name + "</span>",
children: [{label: "offset: " + "0x" + f.offset.toString(16)}, {label: "size: " + f.size} ] };
children: [{label: "offset: " + "0x" + f.offset.toString(16)}, {label: "size: " + f.size} ]
};
if (f.callrefs.length > 0) {
var xrefs = {label: "xrefs:", children: []};
for (var j in f.callrefs) {
@ -594,11 +604,27 @@ function render_functions(functions) {
fcn_data[fcn_data.length] = fd;
}
}
$('#imports').tree({data: [],selectable: false,slide: false,useContextMenu: false, autoEscape: false});
$('#functions').tree({data: [],selectable: false,slide: false,useContextMenu: false, autoEscape: false});
$('#imports').tree('loadData', imp_data);
$('#functions').tree('loadData', fcn_data);
}
function render_imports(imports) {
var imp_data = [];
for (var i in imports) {
var f = imports[i];
if (f.name !== undefined) {
var id = {
label: "<span class='flag import addr addr_" + "0x" + f.plt.toString(16) + "'>" + f.name + "</span>",
children: [ {label: "plt: " + "0x" + f.plt.toString(16)}, {label: "ord: " + i} ]
};
imp_data[imp_data.length] = id;
}
}
$('#imports').tree({data: [],selectable: false,slide: false,useContextMenu: false, autoEscape: false});
$('#imports').tree('loadData', imp_data);
}
function render_symbols(symbols) {
var data = [];
for (var i in symbols) {
@ -634,24 +660,6 @@ function render_flags(flags) {
$('#flags').tree({data: [],selectable: false,slide: false,useContextMenu: false, autoEscape: false});
$('#flags').tree('loadData', data);
}
function render_strings(strings) {
var data = [];
for (var i in strings) {
var f = strings[i];
var fd = {
label: f.string,
children: [
{label: "vaddr: " + "0x" + f.vaddr.toString(16)},
{label: "paddr: " + "0x" + f.paddr.toString(16)},
{label: "length: " + f.length},
{label: "type: " + f.type}
]
};
data[data.length] = fd;
}
$('#strings').tree({data: [],selectable: false,slide: false,useContextMenu: false});
$('#strings').tree('loadData', data);
}
function render_sections(sections) {
var data = [];
for (var i in sections) {

View File

@ -0,0 +1,14 @@
// SETTINGS PANEL
var SettingsPanel = function () {
};
SettingsPanel.prototype.render = function() {
var colors = '<div><h3>Colors:</h3><br/><iframe id="colors_frame" name="colors_frame" src="colors.html" width="100%" height="400px"></iframe></div><br/>';
var settings = '<div><h3>Settings:</h3><br/>';
settings += '<div>Test: <input id="test" type="checkbox" /></div>';
settings += '</div><br/>';
var html = settings + colors;
$('#settings_tab').html(html);
$('#settings_tab').css('color', "rgb(127,127,127);");
$('input[type=checkbox]').onoff();
};

View File

@ -0,0 +1,27 @@
// STRINGS PANEL
var StringsPanel = function () {
};
StringsPanel.prototype.render = function() {
$('#strings_tab').html('<div id="strings" style="color:rgb(127,127,127);"></div>');
r2.cmdj("izj", function(strings) {
var data = [];
for (var i in strings) {
var f = strings[i];
var fd = {
label: f.string,
children: [
{label: "vaddr: " + "0x" + f.vaddr.toString(16)},
{label: "paddr: " + "0x" + f.paddr.toString(16)},
{label: "length: " + f.length},
{label: "type: " + f.type}
]
};
data[data.length] = fd;
}
$('#strings').tree({data: [],selectable: false,slide: false,useContextMenu: false});
$('#strings').tree('loadData', data);
});
};