Update enyo from git and huge refactoring in r2wui

This commit is contained in:
pancake 2013-01-11 04:33:00 +01:00
parent 8879796427
commit 3f12cb2cb1
23 changed files with 9323 additions and 18 deletions

2
shlr/www/enyo/Makefile Normal file
View File

@ -0,0 +1,2 @@
all:
rsync --safe-links -avz * radare.org:/srv/http/lolcathostorg/b/

1161
shlr/www/enyo/build/app.css Normal file

File diff suppressed because it is too large Load Diff

3601
shlr/www/enyo/build/app.js Normal file

File diff suppressed because it is too large Load Diff

View File

@ -0,0 +1,177 @@
/* ../source/dom/dom.css */
/* things we always want */
body {
font-family: 'Helvetica Neue', 'Nimbus Sans L', Arial, sans-serif;
}
/* allow hw-accelerated scrolling on platforms that support it */
body.webkitOverflowScrolling {
-webkit-overflow-scrolling: touch;
}
/* for apps */
.enyo-document-fit {
margin: 0;
height: 100%;
/* note: giving html overflow: auto is odd and was only ever done to avoid duplication
however, android 4.04 sometimes does not hide nodes when their display is set to none
if document is overflow auto.
*/
position: relative;
}
.enyo-body-fit {
margin: 0;
height: 100%;
/* helps prevent ios page scroll */
overflow: auto;
position: relative;
}
.enyo-no-touch-action {
-ms-touch-action: none;
}
/* reset */
button {
font-size: inherit;
font-family: inherit;
}
/* user selection */
.enyo-unselectable {
cursor: default;
-ms-user-select: none;
-webkit-user-select: none;
-moz-user-select: -moz-none;
user-select: none;
}
.enyo-unselectable::selection, .enyo-unselectable ::selection {
color: transparent;
}
.enyo-selectable {
cursor: auto;
-ms-user-select: element;
-webkit-user-select: text;
-moz-user-select: text;
user-select: text;
}
.enyo-selectable::selection, .enyo-selectable ::selection {
background: #3297FD;
color: #FFF;
}
/* layout */
body .enyo-fit {
position: absolute;
left: 0;
top: 0;
right: 0;
bottom: 0;
}
.enyo-clip {
overflow: hidden;
}
.enyo-border-box {
-webkit-box-sizing: border-box;
-moz-box-sizing: border-box;
box-sizing: border-box;
}
/* compositing */
.enyo-composite {
-webkit-transform: translateZ(0);
-moz-transform: translateZ(0);
-ms-transform: translateZ(0);
-o-transform: translateZ(0);
transform: translateZ(0);
}
/* ../source/touch/Thumb.css */
.enyo-thumb {
position: absolute;
-moz-box-sizing: border-box;
box-sizing: border-box;
border-radius: 4px;
background: #333;
border: 1px solid #666;
opacity: 0.75;
z-index: 1;
}
.enyo-vthumb {
top: 0;
right: 2px;
width: 4px;
}
.enyo-hthumb {
left: 0;
bottom: 2px;
height: 4px;
}
/* ../source/touch/Scroller.css */
.enyo-scroller {
position: relative;
}
.enyo-fit.enyo-scroller {
position: absolute;
}
.enyo-touch-scroller {
overflow: hidden;
}
.enyo-touch-strategy-container {
overflow: hidden;
}
.enyo-scrollee-fit {
height: 100%;
}
/* ../source/ui/ui.css */
.enyo-inline, .enyo-tool-decorator {
display: inline-block;
}
.enyo-children-inline > *, .enyo-tool-decorator > * {
display: inline-block;
}
.enyo-children-middle > *, .enyo-tool-decorator > * {
vertical-align: middle;
}
.enyo-positioned {
position: relative;
}
.enyo-fill {
position: relative;
width: 100%;
height: 100%;
}
.enyo-popup {
position: absolute;
z-index: 10;
}

3855
shlr/www/enyo/build/enyo.js Normal file

File diff suppressed because it is too large Load Diff

Binary file not shown.

After

Width:  |  Height:  |  Size: 5.3 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 676 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 255 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 255 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 2.6 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 2.6 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 303 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 447 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 3.0 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.9 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.9 KiB

BIN
shlr/www/enyo/icon.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.5 KiB

22
shlr/www/enyo/index.html Normal file
View File

@ -0,0 +1,22 @@
<!DOCTYPE html>
<html>
<head>
<meta http-equiv="content-type" content="text/html; charset=UTF-8">
<meta content="yes" name="apple-mobile-web-app-capable" />
<meta name="viewport" content="width=220, initial-scale=1, maximum-scale=1, minimum-scale=1, user-scalable=0" />
<link rel="apple-touch-icon" href="icon.png"/>
<title> onyx r2ui </title>
<!-- enyo+onyx -->
<script type='text/javascript' src='build/enyo.js'></script>
<script type='text/javascript' src='build/app.js'></script>
<link href="build/enyo.css" rel="stylesheet">
<link href="build/app.css" rel="stylesheet">
<!-- my code -->
<script type='text/javascript' src="r2.js"> </script>
<script type='text/javascript' src="main.js"> </script>
<link href="main.css" rel="stylesheet">
</head>
<body>
<!-- nothing to see here -->
</body>
</html>

30
shlr/www/enyo/main.css Normal file
View File

@ -0,0 +1,30 @@
.app-panels > * {
width: 320px;
background-color: #EAEAEA;
box-shadow: -4px -4px 4px rgba(0,0,0,0.3);
}
.menu-button {
clear:none;
float:left;
margin:10px !important;
width:150px;
}
.rowline {
width:200px
}
@media all and (max-width: 600px) {
.app-panels > * {
min-width: 100%;
max-width: 100%;
}
}
.onyx-sample-tools {
padding-bottom:10px;
}
.onyx-sample-tools > * {
margin: 3px;
}

344
shlr/www/enyo/main.js Normal file
View File

@ -0,0 +1,344 @@
function dump(obj) {
var x = "";
for (var a in obj) x += a+"\n";
alert (x);
}
function Ajax (method, uri, body, fn) {
var x = new XMLHttpRequest ();
x.open (method, uri, false);
x.setRequestHeader ('Accept', 'text/plain');
x.setRequestHeader ('Accept', 'text/html');
x.setRequestHeader ("Content-Type",
"application/x-ww-form-urlencoded; charset=UTF-8");
x.onreadystatechange = function (e) {
if (x.status == 200) {
if (fn) fn (x.responseText);
} else {
fn (null); //console.error ("ajax "+x.status)
}
}
x.send (body);
}
function getfile(file, cb) {
Ajax ("GET", file, null, cb);
}
//getfile ("myfile", function (x) { alert ("myfile: "+x); });
function objtostr(obj) {
var str = "";
for (var a in obj)
str += a+": "+obj[a] + ",\n";
return str;
}
enyo.kind({
name: "About",
kind: "Scroller",
style: "background-color:#303030",
components: [
{tag: "center", components: [
{tag: "h1", style: "color:#f0f0f0", content: "About r2wui"},
{kind: "Image", src: "icon.png" },
{tag: "h2", style: "color:#a0a0a0", content: "author: pancake 2013"},
{tag: "h2", style: "color:#a0a0a0", content: "version: 0.9.3git"},
]}
]
});
enyo.kind({
name: "Preferences",
classes: "panels-sample-sliding-content",
kind: "Scroller",
tag: "div",
style:"margin-left:16px",
components: [
{kind: "FittableRows", fit: false, classes: "fittable-sample-box fittable-sample-mtb fittable-sample-o", components: [
{tag: "h2", content: "CPU" }
,{kind: "onyx.InputDecorator", components: [
{tag: "p", content: "Arch", classes:"rowline"},
{kind: "onyx.PickerDecorator", components: [
{},
{kind: "onyx.Picker", components: [
{content: "x86", active: true},
{content: "arm"},
{content: "ppc"},
{content: "bf"}
]}
]}
]}
,{kind: "onyx.InputDecorator", components: [
{tag: "p", content: "Bits", classes:"rowline"},
{kind: "onyx.PickerDecorator", components: [
{},
{kind: "onyx.Picker", components: [
{content: "8"},
{content: "16"},
{content: "32", active: true},
{content: "64"}
]}
]}
]}
,{kind: "onyx.InputDecorator", components: [
{tag: "p", content: "Endian", classes:"rowline"},
{kind: "onyx.PickerDecorator", components: [
{},
{kind: "onyx.Picker", components: [
{content: "little", active: true},
{content: "big"},
]}
]}
]}
,{tag: "h2", content: "Disassembly" },
{kind: "onyx.InputDecorator", components: [
{tag: "p", content: "Show bytes", classes:"rowline", ontap: "nextPanel"},
{kind: "onyx.ToggleButton", name: "toggle_bytes "},
]}
,{kind: "onyx.InputDecorator",components: [
{tag: "p", content: "Show offsets", classes:"rowline", ontap: "nextPanel"},
{kind: "onyx.ToggleButton", name: "toggle_offset" },
]}
,{kind: "onyx.InputDecorator",components: [
{tag: "p", content: "Show lines", classes:"rowline", ontap: "nextPanel"},
{kind: "onyx.ToggleButton", name: "toggle_lines" },
]}
,{kind: "onyx.InputDecorator",components: [
{tag: "p", content: "Pseudo", classes:"rowline", ontap: "nextPanel"},
{kind: "onyx.ToggleButton", name: "toggle_pseudo" },
]}
]}
,{tag: "h2", content: "Save changes?" }
,{tag: "div",style:"margin-left:50px", components: [
{kind: "onyx.Button", style: "position:relative;left:0px", content: "Reset"},
{kind: "onyx.Button", style: "position:relative;left:50px", content: "Save", classes: "onyx-affirmative"}
]}
,{tag: "div", style: "height:64px"}
]
});
enyo.kind({
name: "MainPanel",
classes: "onyx",
//kind: enyo.Control,
kind: "FittableRows",
tag: "div",
classes: "enyo-fit",
style: "background-color: #c0c0c0",
buttonClicked: function (x) {
alert ("let's play!");
},
cancelClicked: function (x) {
alert ("nothing to see here! move along.");
},
components: [
{kind: "FittableColumns", noStretch: true, classes: "onyx-toolbar onyx-toolbar-inline", components: [
{kind: "Scroller", thumb: false, fit: true, touch: false, vertical: "hidden", style: "margin: 0;", components: [
{classes: "onyx-toolbar-inline", style: "white-space: nowrap;", components: [
{kind: "onyx.PickerDecorator", components: [
{kind: "onyx.Button", content: "Actions"},
{kind: "onyx.Picker", components: [
{content: "Analyze"},
{content: "Rename"},
{content: "Comment"},
{content: "Flag"}
]}
]},
{kind: "onyx.Button", content: "<", ontap: "prevPanel"},
{kind: "onyx.Button", content: ">", ontap: "nextPanel"},
{kind: "onyx.InputDecorator", style: "width: 200px;", components: [
{kind: "onyx.Input", value: 0, onchange: "gotoPanel"}
]},
{kind: "onyx.Button", content: "Go", ontap: "gotoPanel"},
/*
{kind: "onyx.Button", content: "Add", ontap: "addPanel"},
{kind: "onyx.Button", content: "Delete", ontap: "deletePanel"}
*/
]}
]}
]},
{kind: "Panels", name:"samplePanels", fit:true, draggable: false,
realtimeFit: true, classes: "panels-sample-panels enyo-border-box", components: [
{name:"page0", content:0, style:"background:red;"},
{name:"page1", content:1, style:"background:orange;"},
{name:"page2", content:2, style:"background:yellow;"},
{name:"page3", content:3, style:"background:green;"},
{kind:"Preferences", name:"pagePreferences"},
{kind:"About", name: "pageAbout"},
]}
],
create: function() {
this.inherited(arguments);
// this.$.samplePanels.setArrangerKind ("CardArranger");
// if (enyo.Panels.isScreenNarrow()) {
this.$.samplePanels.setIndex(1);
},
rendered: function() {
this.inherited(arguments);
},
openPage: function(idx) {
var str, sp = this.$.samplePanels;
eval ("var x = this.$.page"+idx);
switch (idx) {
case "Settings": idx = 4; break;
case "About": idx = 5; break;
}
//x.setContent (str);
sp.setIndex (idx);
},
gotoPanel: function() {
this.openPage (this.$.input.getValue());
/*
var sp = this.$.samplePanels;
//sp.components[3].setContent ("JAJAJ");
this.$.page3.setContent ("PUTA");
alert (sp.components[3].content);
sp.components[3].content = "JAJAJ";
sp.reflow();
sp.render ();
sp.setIndex(3);
var i = 3;
var p = sp.createComponent ({
style:"background: red",
content:i
});
p.render();
sp.reflow();
sp.setIndex(3);
*/
}
});
/*
{ tag: "h2", content: "Menu", style: "margin-left:12px" },
{ layoutKind: "FittableRowsLayout", components: [
{ kind: "onyx.Toolbar", title:"jaja", components: [
*/
enyo.kind({
name: "RightPanel",
classes: "onyx onyx-toolbar",
kind: enyo.Control,
style: "width:25px",
components: [
{kind: "onyx.MenuDecorator", onSelect: "itemSelected", components: [
{content: "List elements"},
{kind: "onyx.Menu", components: [
{content: "symbols", value: "1"},
{content: "imports", value: "1"},
{content: "functions", value: "1"},
{content: "comments", value: "1"},
{content: "registers", value: "1"},
{content: "stack", value: "2"},
{content: "backtrace", value: "3"},
{classes: "onyx-menu-divider"},
{content: "settings", value: "4"},
]}
]},
]
});
enyo.kind({
name: "LeftPanel",
classes: "onyx-toolbar",
kind: "Scroller", //enyo.Control,
fit:true,
style: "width: 220px;height:100%",
components: [
{tag: "h2", content: "crackme01", style: "margin-left:12px; margin-top:0px;margin-bottom:50px;height:10px;width:190px,overflow:hidden" },
//{kind: "List", name:"list", style:"height:100%", realtimeFit:false, onSetupItem: "setupItem", components: [
{kind: "Group", onActivate:"buttonActivated", classes: "enyo-border-box group", defaultKind: "onyx.Button", highlander: true, components: [
{content: "Disassembler", active: true, classes: "onyx-dark menu-button" },
{content: "Assembler", classes: "onyx-dark menu-button" },
{content: "Hexdump", classes: "onyx-dark menu-button" },
{content: "Console", classes: "onyx-dark menu-button" },
{content: "Settings", classes: "onyx-dark menu-button", ontap:"openAbout", name: "Settings" },
{content: "About", classes: "onyx-dark menu-button" , ontap: "openAbout", name:"About"},
]}
/*
{kind: "List", name: "list", style:"height:400px", realtimeFit:false, onSetupItem: "setupItem", components: [
{kind: "onyx.Item", layoutKind: "HFlexLayout", style:"padding:0px", components: [
{name:"separator", tag: "hr", style:"height:1px;visibility:hidden"},
{kind: "onyx.Button", name: "button", style: "width:100%", fit:true, active: true, ontap: "rowTap"}
]}
]}
*/
],
openAbout: function (x) {
if (enyo.Panels.isScreenNarrow())
this.ra.setIndex (1);
if (this.openCallback)
this.openCallback (x.name);
},
ra: null,
oldSender: null,
rowTap: function (inSender, inIndex) {
if (this.oldSender)
this.oldSender.setStyle ("width:100%"); // background of row
// TODO. use applystall
//this.$.list.render ();
inSender.setStyle ("background-color: #202020;width:100%"); // background of row
this.oldSender = inSender;
if (this.openCallback)
this.openCallback (inIndex.index); //this.data[inIndex.index]);
},
openCallback: undefined,
data: [],
iter: 1,
refresh: function () {
this.iter++;
/*
this.$.list.setCount (this.data.length);
this.$.list.refresh ();
*/
},
setupItem: function (inSender, inIndex) {
var item = this.data[inIndex.index];
if (item.separator) {
this.$.separator.setStyle("visibility:visible;border:0;background-color:#404040");
} else {
this.$.separator.setStyle("visibility:hidden");
}
this.$.button.setContent (item.name);
return true;
}
});
enyo.kind ({
name: "RadareApp",
kind: "Panels",
classes: "panels enyo-unselectable",
realtimeFit: true,
arrangerKind: "CollapsingArranger",
components: [
{ name: "lp", kind: "LeftPanel" },
{ name: "mp", kind: "MainPanel" },
{ name: "rp", kind: "RightPanel" }
],
setPanel0: function () {
this.$.RadareApp.setIndex (1);
},
create: function() {
this.inherited (arguments);
var mp = this.$.mp;
var ra = this.$.RadareApp;
this.$.lp.openCallback = function (idx) {
mp.openPage (idx);
};
this.$.lp.ra = this;
this.$.lp.data = [
{ name: "Disassembly" },
{ name: "Assembler" },
{ name: "Hexdump" },
{ name: "Console" },
{ name: "Settings", separator: true },
{ name: "About" }
];
this.$.lp.refresh ();
}
});
window.onload = function() {
var obj = new RadareApp ().renderInto (document.body)
}

127
shlr/www/enyo/r2.js Normal file
View File

@ -0,0 +1,127 @@
var r2 = {};
r2.root = ""; // prefix path
function Ajax (method, uri, body, fn) {
var x = new XMLHttpRequest ();
x.open (method, uri, false);
x.setRequestHeader ('Accept', 'text/plain');
x.onreadystatechange = function (y) {
if (x.status == 200) {
if (fn) fn (x.responseText);
} else console.error ("ajax "+x.status)
}
x.send (body);
}
r2.get_opcodes = function (off, n, cb) {
r2.cmd ("pdj @"+off+"!"+n, function (json) {
var o = JSON.parse (json);
cb (o);
});
}
r2.get_bytes = function (off, n, cb) {
r2.cmd ("pcj @"+off+"!"+n, function (json) {
var o = JSON.parse (json);
cb (o);
});
}
r2.get_info = function (cb) {
r2.cmd ("ij", function (json) {
cb (JSON.parse (json));
});
}
r2.bin_imports = function (cb) {
r2.cmd ("iij", function (json) {
cb (JSON.parse (json));
});
}
r2.bin_symbols = function (cb) {
r2.cmd ("isj", function (json) {
cb (JSON.parse (json));
});
}
r2.bin_sections = function (cb) {
r2.cmd ("iSj", function (json) {
var o = JSON.parse (json);
cb (o);
});
}
r2.cmd = function (c, cb) {
Ajax ('GET', r2.root+"/cmd/"+encodeURI (c), '', function (x) {
if (cb) cb (x);
});
}
r2.alive = function (cb) {
r2.cmd ("b", function (o) {
var ret = false;
if (o && o.length () > 0)
ret = true;
if (cb) cb (o);
});
}
r2.get_logger = function (obj) {
if (typeof (obj) != "object")
obj = {};
obj.last = 0;
obj.events = {};
obj.interval = null;
r2.cmd ("ll", function (x) {
obj.last = +x;
});
obj.load = function (cb) {
r2.cmd ("lj "+(obj.last+1), function (ret) {
var json = JSON.parse (ret);
if (cb) cb (json);
});
}
obj.clear = function (cb) {
// XXX: fix l-N
r2.cmd ("l-", cb); //+obj.last, cb);
}
obj.send = function (msg, cb) {
r2.cmd ("l "+msg, cb);
}
obj.refresh = function (cb) {
obj.load (function (ret) {
//obj.last = 0;
for (var i = 0; i< ret.length; i++) {
var message = ret[i];
obj.events["message"] ({
"id": message[0],
"text": message[1]
});
if (message[0] > obj.last)
obj.last = message[0];
}
if (cb) cb ();
});
}
obj.autorefresh = function (n) {
if (!n) {
if (obj.interval)
obj.interval.stop ();
return;
}
function to() {
obj.refresh (function () {
//obj.clear ();
});
setTimeout (to, n*1000);
return true;
}
obj.interval = setTimeout (to, n*1000);
}
obj.on = function (ev, cb) {
obj.events[ev] = cb;
return obj;
}
return obj;
}

View File

@ -37,6 +37,8 @@
<img src="icon.png">
<br />
<h1><a href="/old">click here to use the old ui</a></b></h1>
<br /><br />
<h1><a href="/enyo">click here to use the enyo ui</a></b></h1>
</center>
</article>
@ -51,7 +53,7 @@ Lungo.init ({
]
});
</script>
<!-- windows -->
<!-- windows
<div id="exampleB" style="position:fixed!important;top:200px;left:10;width:250px;height:350px;background-color:#e0e0e0;border: 1px solid black;z-index:999">
<div id="exampleBHandle" style="height:20px;left:0px;top:0px;cursor:move;width:248px;background-color:#20a0e0;font-weight:bold;color:white;z-index:1000;border:1px solid black">&nbsp;Registers</div>
@ -77,7 +79,6 @@ eip = 0x08048520
</div>
</div>
<!--
<script type="text/javascript">
var exampA = null;
var exampB = null;
@ -90,21 +91,6 @@ function initialize() {
exampB.StartListening();
}
/*
function buttonClicked() {
var button = document.getElementById('dragButton');
if(exampA.IsListening()) {
exampA.StopListening(true);
exampB.StopListening(true);
button.value = "Resume Listening";
} else {
exampA.StartListening();
exampB.StartListening();
button.value = "Stop Listening";
}
}
*/
function exampleAEnd() {
// alert("Drag Ended.");
}

View File

@ -572,7 +572,7 @@ cmds:
<a href="javascript:r2.continue()">dc</a>
</div>
<textarea class="editor_textarea" id="console2_body" style="visibility:hidden">
patata barata
...
</textarea>
</td></tr>
</table>