mirror of
https://github.com/radareorg/radare2.git
synced 2024-10-08 02:53:29 +00:00
Updated web ui
This commit is contained in:
parent
a5ae470e79
commit
44a027c027
@ -28,9 +28,11 @@ static int cmd_flag(void *data, const char *input) {
|
||||
break;
|
||||
case '-':
|
||||
if (input[1]) {
|
||||
const char *flagname = input+1;
|
||||
while (*flagname==' ') flagname++;
|
||||
if (strchr (input+1, '*'))
|
||||
r_flag_unset_glob (core->flags, input+1);
|
||||
else r_flag_unset (core->flags, input+1, NULL);
|
||||
r_flag_unset_glob (core->flags, flagname);
|
||||
else r_flag_unset (core->flags, flagname, NULL);
|
||||
} else r_flag_unset_i (core->flags, off, NULL);
|
||||
break;
|
||||
case 'l':
|
||||
|
@ -35,6 +35,7 @@ R_API int r_core_rtr_http(RCore *core, int launch) {
|
||||
int y = r_config_get_i (core->config, "scr.color");
|
||||
int z = r_config_get_i (core->config, "asm.bytes");
|
||||
int u = r_config_get_i (core->config, "scr.interactive");
|
||||
int v = r_config_get_i (core->config, "asm.cmtright");
|
||||
const char *port = r_config_get (core->config, "http.port");
|
||||
s = r_socket_new (R_FALSE);
|
||||
s->local = !r_config_get_i (core->config, "http.public");
|
||||
@ -49,6 +50,7 @@ R_API int r_core_rtr_http(RCore *core, int launch) {
|
||||
browser, atoi (port));
|
||||
r_sys_cmd (cmd);
|
||||
}
|
||||
r_config_set (core->config, "asm.cmtright", "false");
|
||||
r_config_set (core->config, "scr.html", "true");
|
||||
r_config_set (core->config, "scr.color", "false");
|
||||
r_config_set (core->config, "asm.bytes", "false");
|
||||
@ -91,6 +93,7 @@ R_API int r_core_rtr_http(RCore *core, int launch) {
|
||||
r_socket_http_response (rs, 404, "File not found\n", 0);
|
||||
}
|
||||
}
|
||||
#if 0
|
||||
} else
|
||||
if (!strcmp (rs->method, "POST")) {
|
||||
char *buf = malloc (rs->data_length+ 50);
|
||||
@ -99,6 +102,7 @@ R_API int r_core_rtr_http(RCore *core, int launch) {
|
||||
strcat (buf, (char*)rs->data);
|
||||
r_socket_http_response (rs, 200, buf, 0);
|
||||
free (buf);
|
||||
#endif
|
||||
} else {
|
||||
r_socket_http_response (rs, 404, "Invalid protocol", 0);
|
||||
}
|
||||
@ -110,6 +114,7 @@ R_API int r_core_rtr_http(RCore *core, int launch) {
|
||||
r_config_set_i (core->config, "scr.color", y);
|
||||
r_config_set_i (core->config, "asm.bytes", z);
|
||||
r_config_set_i (core->config, "scr.interactive", u);
|
||||
r_config_set_i (core->config, "asm.cmtright", v);
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
@ -1,10 +1,9 @@
|
||||
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
|
||||
<html xmlns="http://www.w3.org/1999/xhtml">
|
||||
<head>
|
||||
<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
|
||||
<title>js-graph.it homepage</title>
|
||||
<title>r2-js-graph.it</title>
|
||||
<script type="text/javascript" src="js-graph-it.js"></script>
|
||||
<link rel="stylesheet" type="text/css" href="jsgraph.css" />
|
||||
<link rel="stylesheet" type="text/css" href="js-graph-it.css" />
|
||||
<link rel="stylesheet" type="text/css" href="sf-homepage.css" />
|
||||
<style>
|
||||
p {
|
||||
@ -30,101 +29,78 @@ function Ajax (method, uri, body, fn) {
|
||||
function get_graph() {
|
||||
Ajax ('GET', "/cmd/ag $$", '', function (x) {
|
||||
document.getElementById ('mainCanvas').innerHTML = x;
|
||||
setMenu();
|
||||
resizeCanvas();
|
||||
initPageObjects();
|
||||
setMenu ();
|
||||
resizeCanvas ();
|
||||
initPageObjects ();
|
||||
});
|
||||
}
|
||||
<!--
|
||||
function onLoad() {
|
||||
get_graph ();
|
||||
}
|
||||
|
||||
/**
|
||||
* Resizes the main canvas to the maximum visible height.
|
||||
*/
|
||||
function resizeCanvas() {
|
||||
var divElement = document.getElementById("mainCanvas");
|
||||
var screenHeight = window.innerHeight || document.body.offsetHeight;
|
||||
divElement.style.height = (screenHeight - 16) + "px";
|
||||
}
|
||||
function onLoad() {
|
||||
get_graph ();
|
||||
}
|
||||
|
||||
/**
|
||||
* Resizes the main canvas to the maximum visible height.
|
||||
*/
|
||||
function resizeCanvas() {
|
||||
var divElement = document.getElementById("mainCanvas");
|
||||
var screenHeight = window.innerHeight || document.body.offsetHeight;
|
||||
divElement.style.height = (screenHeight - 16) + "px";
|
||||
}
|
||||
|
||||
/**
|
||||
* sets the active menu scanning for a menu item which url is a prefix
|
||||
* of the one of the current page ignoring file extension.
|
||||
* Nice trick!
|
||||
*/
|
||||
function setMenu()
|
||||
{
|
||||
var url = document.location.href;
|
||||
// strip extension
|
||||
url = stripExtension(url);
|
||||
|
||||
/**
|
||||
* sets the active menu scanning for a menu item which url is a prefix
|
||||
* of the one of the current page ignoring file extension.
|
||||
* Nice trick!
|
||||
*/
|
||||
function setMenu()
|
||||
var ulElement = document.getElementById("menu");
|
||||
var links = ulElement.getElementsByTagName("A");
|
||||
var i;
|
||||
for(i = 0; i < links.length; i++)
|
||||
{
|
||||
if(url.indexOf(stripExtension(links[i].href)) == 0)
|
||||
{
|
||||
var url = document.location.href;
|
||||
// strip extension
|
||||
url = stripExtension(url);
|
||||
|
||||
var ulElement = document.getElementById("menu");
|
||||
var links = ulElement.getElementsByTagName("A");
|
||||
var i;
|
||||
for(i = 0; i < links.length; i++)
|
||||
{
|
||||
if(url.indexOf(stripExtension(links[i].href)) == 0)
|
||||
{
|
||||
links[i].className = "active_menu";
|
||||
return;
|
||||
}
|
||||
}
|
||||
links[i].className = "active_menu";
|
||||
return;
|
||||
}
|
||||
|
||||
/**
|
||||
* Strips the file extension and everything after from a url
|
||||
*/
|
||||
function stripExtension(url) {
|
||||
var lastDotPos = url.lastIndexOf('.');
|
||||
return (lastDotPos <= 0)? url:
|
||||
url.substring(0, lastDotPos - 1);
|
||||
}
|
||||
|
||||
/**
|
||||
* this function opens a popup to show samples during explanations.
|
||||
*/
|
||||
function openSample(url) {
|
||||
var popup = window.open(url, "sampleWindow", "width=400,height=300");
|
||||
popup.focus();
|
||||
return false;
|
||||
}
|
||||
//-->
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Strips the file extension and everything after from a url
|
||||
*/
|
||||
function stripExtension(url) {
|
||||
var lastDotPos = url.lastIndexOf('.');
|
||||
return (lastDotPos <= 0)? url:
|
||||
url.substring(0, lastDotPos - 1);
|
||||
}
|
||||
|
||||
/**
|
||||
* this function opens a popup to show samples during explanations.
|
||||
*/
|
||||
function openSample(url) {
|
||||
var popup = window.open(url, "sampleWindow", "width=400,height=300");
|
||||
popup.focus();
|
||||
return false;
|
||||
}
|
||||
</script>
|
||||
</head>
|
||||
<body onload="onLoad();">
|
||||
<h1><a href="../"> back</a></h1>
|
||||
<table class="main_table" style="height: 100%;">
|
||||
<tr>
|
||||
<!--
|
||||
<td colspan=3>
|
||||
<a href=''>File</a> | Edit
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td width="1" style="vertical-align: top;" class="menu">
|
||||
<ul id="menu">
|
||||
<select>
|
||||
<option>Functions</option>
|
||||
<option>Exports</option>
|
||||
<option>Imports</option>
|
||||
</select>
|
||||
|
||||
</ul>
|
||||
</td>
|
||||
-->
|
||||
<td style="vertical-align: top; padding: 0px;">
|
||||
<div id="mainCanvas" class="canvas" style="width: 100%; height: 400px;">
|
||||
|
||||
<!-- filled with ajax -->
|
||||
|
||||
</div>
|
||||
</td>
|
||||
<td width="1" style="vertical-align: top;" class="menu">
|
||||
<ul id="menu"> </ul>
|
||||
</td>
|
||||
</tr>
|
||||
</table>
|
||||
</body>
|
||||
<tr>
|
||||
<td style="vertical-align: top; padding: 0px;">
|
||||
<div id="mainCanvas" class="canvas" style="width: 100%; height: 100%;"></div>
|
||||
</td>
|
||||
<td width="1" style="vertical-align: top;" class="menu">
|
||||
<ul id="menu"> </ul>
|
||||
</td>
|
||||
</tr>
|
||||
</table>
|
||||
</body>
|
||||
</html>
|
||||
|
File diff suppressed because it is too large
Load Diff
@ -1,27 +1,25 @@
|
||||
.draggable
|
||||
{
|
||||
.draggable {
|
||||
position: absolute;
|
||||
}
|
||||
|
||||
div.block, h1.block, h2.block, p.block
|
||||
{
|
||||
div.block, h1.block, h2.block, p.block {
|
||||
border: 1px solid #9DA3B3;
|
||||
background-color: #E0E8FF;
|
||||
/*background-color: #E0E8FF; */
|
||||
background-color: #404040;
|
||||
color: white;
|
||||
padding: 5px;
|
||||
}
|
||||
|
||||
div.canvas
|
||||
{
|
||||
border: 1px solid #262A37;
|
||||
background-color: white;
|
||||
div.canvas {
|
||||
border: 0px solid #262A37;
|
||||
background-color: black;
|
||||
background-image: url('gradient.jpg');
|
||||
background-repeat: no-repeat;
|
||||
background-position: top right;
|
||||
padding: 0px;
|
||||
}
|
||||
|
||||
.highlighter
|
||||
{
|
||||
.highlighter {
|
||||
border: 1px solid #CFDF62 !important;
|
||||
background-color: #F1FF90 !important;
|
||||
margin-bottom: 2px !important;
|
||||
@ -29,129 +27,91 @@ div.canvas
|
||||
z-index: 3;
|
||||
}
|
||||
|
||||
.highlighter .highlighter
|
||||
{
|
||||
.highlighter .highlighter {
|
||||
border: 1px solid #7DAB76 !important;
|
||||
background-color: #BAFFB0 !important;
|
||||
margin-left: 2px !important;
|
||||
margin-right: 2px !important;
|
||||
}
|
||||
|
||||
|
||||
html
|
||||
{
|
||||
html {
|
||||
padding: 0px;
|
||||
margin: 0px;
|
||||
}
|
||||
|
||||
body
|
||||
{
|
||||
body {
|
||||
font-family: verdana;
|
||||
font-size: 11px;
|
||||
color: #33333F;
|
||||
padding: 3px;
|
||||
margin: 0px;
|
||||
background-color: white;
|
||||
background-color: black;
|
||||
}
|
||||
|
||||
h1
|
||||
{
|
||||
h1 {
|
||||
color: #FF7521;
|
||||
margin: 0px;
|
||||
font-size: 20px;
|
||||
}
|
||||
|
||||
h2
|
||||
{
|
||||
h2 {
|
||||
font-size: 15px;
|
||||
margin: 0px;
|
||||
}
|
||||
|
||||
p, div
|
||||
{
|
||||
p, div {
|
||||
font-size: 11px;
|
||||
margin: 0px;
|
||||
}
|
||||
|
||||
a
|
||||
{
|
||||
a {
|
||||
text-decoration: none;
|
||||
color: #FF9900;
|
||||
}
|
||||
|
||||
.middle-label, .source-label, .destination-label
|
||||
{
|
||||
.middle-label, .source-label, .destination-label {
|
||||
font-size: 11px;
|
||||
font-weight: bold;
|
||||
padding: 5px;
|
||||
}
|
||||
|
||||
div.connector
|
||||
{
|
||||
div.connector {
|
||||
background-color: #ff9900;
|
||||
width: 5px;
|
||||
z-index: 1000;
|
||||
}
|
||||
|
||||
table.main_table
|
||||
{
|
||||
table.main_table {
|
||||
width: 100%;
|
||||
border-collapse: separate;
|
||||
}
|
||||
|
||||
td.menu
|
||||
{
|
||||
|
||||
td.menu {
|
||||
padding: 5px;
|
||||
}
|
||||
|
||||
.menu ul
|
||||
{
|
||||
.menu ul {
|
||||
margin: 0px;
|
||||
padding: 0px;
|
||||
list-style-type: none;
|
||||
list-style-position: outside;
|
||||
}
|
||||
|
||||
.menu li
|
||||
{
|
||||
.menu li {
|
||||
border: none;
|
||||
padding: 0px;
|
||||
font-size: 12px;
|
||||
margin-bottom: 3px;
|
||||
}
|
||||
|
||||
.menu li a
|
||||
{
|
||||
display: block;
|
||||
border: 1px solid #262A37;
|
||||
width: 100px;
|
||||
color: #262A37;
|
||||
text-decoration: none;
|
||||
padding: 1px;
|
||||
background-color: #E0E8FF;
|
||||
}
|
||||
|
||||
.menu li a.active_menu
|
||||
{
|
||||
color: #FF9900;
|
||||
border-color: #FF9900;
|
||||
}
|
||||
|
||||
.menu li a:hover
|
||||
{
|
||||
color: #FF9900;
|
||||
border-color: #FF9900;
|
||||
}
|
||||
|
||||
.block ol, .block ul
|
||||
{
|
||||
.block ol, .block ul {
|
||||
margin-top: 3px;
|
||||
margin-bottom: 3px;
|
||||
margin-left: 0px;
|
||||
padding-left: 25px;
|
||||
}
|
||||
|
||||
.code
|
||||
{
|
||||
.code {
|
||||
font-family: monospace;
|
||||
line-height: 1.5em !important;
|
||||
}
|
||||
|
@ -47,6 +47,11 @@ function panel_functions_load() {
|
||||
});
|
||||
}
|
||||
|
||||
function runcmd(x) {
|
||||
popup_hide ();
|
||||
cmd (x, function() { cmd (display)});
|
||||
}
|
||||
|
||||
function setmode (x) {
|
||||
popup_hide();
|
||||
display = x;
|
||||
@ -58,6 +63,12 @@ function setmode (x) {
|
||||
cmd (x);
|
||||
}
|
||||
|
||||
function runprompt (t, c) {
|
||||
popup_hide ();
|
||||
var msg = prompt (t);
|
||||
if (msg) cmd ('"'+c+msg+'"', function (x) {cmd (display);});
|
||||
}
|
||||
|
||||
function toggle(x) {
|
||||
popup_hide();
|
||||
display = "pd";
|
||||
@ -94,19 +105,19 @@ function show_popup_about () {
|
||||
"<hr size=1/>"+
|
||||
"<a href=\"javascript:setmode('fs',1)\" />flagspaces</a><br />"+
|
||||
"<a href=\"javascript:setmode('f',1)\" />flags</a><br />"+
|
||||
"<a href=\"javascript:cmd('f ',1)\" />set flag</a><br />"+
|
||||
"<a href=\"javascript:cmd('f-$$')\" />unset flag</a><br />"+
|
||||
"<a href=\"javascript:runprompt('Flag','f ')\" />set flag</a><br />"+
|
||||
"<a href=\"javascript:runprompt('Flag','f-')\" />unset flag</a><br />"+
|
||||
"</td><td valign=top>"+
|
||||
"Places"+
|
||||
"<hr size=1/>"+
|
||||
"<a href=\"javascript:popup_hide();seek('entry0')\" />entry0</a><br />"+
|
||||
"<a href=\"javascript:popup_hide();seek('entry0')\" />entry0</a> "+
|
||||
"<a href=\"javascript:popup_hide();seek('main')\" />main</a><br />"+
|
||||
"<br />"+
|
||||
"Settings"+
|
||||
"<hr size=1/>"+
|
||||
"<a href=\"javascript:toggle('asm.offset')\" />asm.offset</a><br />"+
|
||||
"<a href=\"javascript:toggle('asm.lines')\" />asm.lines</a><br />"+
|
||||
"<a href=\"javascript:toggle('asm.pseudo')\" />asm.pseudo</a><br />"+
|
||||
"<a href=\"javascript:toggle('asm.cmtright')\" />asm.cmtright</a><br />"+
|
||||
"<a href=\"javascript:toggle('asm.bytes')\" />asm.bytes</a><br />"+
|
||||
"<a href=\"javascript:toggle('cfg.bigendian')\" />cfg.bigendian</a><br />"+
|
||||
/*
|
||||
@ -118,11 +129,11 @@ a
|
||||
"<br />"+
|
||||
"Actions"+
|
||||
"<hr size=1/>"+
|
||||
"<a href=\"javascript:setmode('CC ')\" />set comment</a><br />"+
|
||||
"<a href=\"javascript:setmode('af')\" />analyze function</a><br />"+
|
||||
"<a href=\"javascript:popup_hide();cmd('aa');\">full analyze</a><br />"+
|
||||
"<a href=\"javascript:popup_hide();cmd('ap');\">analyze preludes</a><br />"+
|
||||
"<a href=\"/graph/\">graph demo</a>"+nl2+
|
||||
"<a href=\"javascript:runprompt('Comment','CC ')\" />set comment</a><br />"+
|
||||
"<a href=\"javascript:runcmd('af')\" />analyze function</a><br />"+
|
||||
"<a href=\"javascript:runcmd('aa');\">full analyze</a><br />"+
|
||||
"<a href=\"javascript:runcmd('ap');\">analyze preludes</a><br />"+
|
||||
"<a href=\"/graph/\">function graph</a>"+nl2+
|
||||
" "+
|
||||
"</td></tr></table>"+
|
||||
"";
|
||||
@ -139,6 +150,7 @@ function handleKeyPress(e, form) {
|
||||
function seek(x,back) {
|
||||
next_curoff = prev_curoff = x;
|
||||
cmd ("s "+x, function (x) {
|
||||
if (display[0]=='f') display="pd";
|
||||
cmd (display);
|
||||
window.scrollTo (0,0);
|
||||
});
|
||||
@ -204,6 +216,22 @@ function filter_asm(x) {
|
||||
}
|
||||
x = z;
|
||||
} else
|
||||
if (display[0] == 'f') {
|
||||
hasmore (false);
|
||||
if (display[1] == 's') {
|
||||
var z = "";
|
||||
for (var i=0; i<lines.length; i++) {
|
||||
var row = lines[i].replace (/\ +/g," ").split (/ /g);
|
||||
var mark = row[1]=='*'? '*': ' ';
|
||||
var space = row[2]? row[2]: row[1];
|
||||
if (!space) continue;
|
||||
z += row[0]+ " "+mark+" <a href=\"javascript:runcmd('fs "+
|
||||
space+"')\">"+space+"</a>\n";
|
||||
}
|
||||
x = z;
|
||||
} else {
|
||||
}
|
||||
} else
|
||||
if (display[0] == "i") {
|
||||
hasmore (false);
|
||||
if (display[1]) {
|
||||
@ -225,7 +253,7 @@ function filter_asm(x) {
|
||||
} else hasmore (true);
|
||||
|
||||
x = x.replace (/0x([a-zA-Z0-9]*)/g, "<a href='javascript:seek(\"0x$1\")'>0x$1</a>");
|
||||
if (display == "pd"||display=="pdf") {
|
||||
if (display[0]=='p' && display[1]=='d') {
|
||||
x = x.replace (/;(\s+)/g, ";");
|
||||
x = x.replace (/;(.*)/g, "// <span style='color:yellow'>$1</span>");
|
||||
x = x.replace (/(fcn|imp|loc).(.*)/g, "<a href='javascript:seek(\"$1.$2\")'>$1.$2</a>");
|
||||
@ -262,7 +290,7 @@ function input_activate () {
|
||||
}
|
||||
|
||||
function css(selector, property, value) {
|
||||
for (var i=0; i<document.styleSheets.length;i++) {
|
||||
for (var i=0; i<document.styleSheets.length; i++) {
|
||||
try {
|
||||
document.styleSheets[i].insertRule (
|
||||
selector+ ' {'+property+':'+value+'}',
|
||||
@ -276,6 +304,7 @@ function css(selector, property, value) {
|
||||
}
|
||||
}
|
||||
|
||||
/* probably unnecesary */
|
||||
window.onorientationchange = function() {
|
||||
var header = document.getElementById ('header');
|
||||
var orientation = window.orientation;
|
||||
@ -308,15 +337,17 @@ function popup_show (title, body) {
|
||||
var t = document.getElementById ("popup_title");
|
||||
var c = document.getElementById ("popup_content");
|
||||
var b = document.getElementById ("popup_background");
|
||||
if (body) {
|
||||
p.style.visibility="visible";
|
||||
c.innerHTML = body;
|
||||
b.style.visibility="visible";
|
||||
}
|
||||
if (title) {
|
||||
if (title)
|
||||
t.innerHTML = title;
|
||||
if (body) {
|
||||
var top = document.body.scrollTop+10;
|
||||
c.innerHTML = body;
|
||||
p.style.visibility =
|
||||
b.style.visibility = "visible";
|
||||
//c.style.top = top; /* XXX doesnt works */
|
||||
css ('.popup', 'top', top+"px"); //'220px');
|
||||
}
|
||||
b.height =100;
|
||||
b.height = 100;
|
||||
}
|
||||
|
||||
function init() {
|
||||
@ -330,11 +361,10 @@ function init() {
|
||||
</script>
|
||||
</head>
|
||||
<body onload="init()">
|
||||
<div class=popup_background id="popup_background"
|
||||
style="visibility:hidden"></div>
|
||||
<div class=popup_background id="popup_background" style="visibility:hidden"></div>
|
||||
|
||||
<div id="popup" style="visibility:hidden">
|
||||
<table class=popup >
|
||||
<table class=popup>
|
||||
<tr>
|
||||
<td style="text-align:left; width:100%">
|
||||
<div class=popup_title id="popup_title"></div>
|
||||
|
@ -1,9 +1,9 @@
|
||||
body {
|
||||
background-color: black;
|
||||
background-color: black;
|
||||
font-family: Verdana;
|
||||
border:0px;
|
||||
width:320px;
|
||||
margin:0px;
|
||||
margin:10px;
|
||||
}
|
||||
|
||||
p {
|
||||
@ -78,7 +78,6 @@ input {
|
||||
height:290px;
|
||||
border: 1px solid black;
|
||||
background-color: #505070;
|
||||
/* #a0cfe0; */
|
||||
}
|
||||
|
||||
a:link {
|
||||
|
Loading…
Reference in New Issue
Block a user