Radare2: emscripten distribution

Created on 30 Oct 2016  Â·  14Comments  Â·  Source: radareorg/radare2

I am trying to parse a windows Portable Executable in javascript - because it needs to work in the browser. I started writing this by hand, before a friend put me on to radare2! I realized at the same time that the avaliable spec for PE is vague, which makes it _very difficult_ to implement, but radare works great!

I also noticed that there is an emscripten build, it would be great if the output of that could be published on npm, as that would allow using r2 without the difficulty of building it, would this be possible?

buildsystem

All 14 comments

Yep that is possible, but requires some more work to expose the js apis or at least the bare ones to create rcore and call core_cmd_str() to get r2pipe via emscripten.

I have already built web apps on top of parts of r2 compiled to js with emscripten. You can see the rax2 app in the firefox marketplace as example.

https://marketplace.firefox.com/app/rax2

Feel free to try sys/emscripten.sh and send pullreqs to fix the remaining bits to get this working.

Also i would recommend you to disable the dynamic plugin support which is not supported by emscripten and put the minimum number of plugins in the core.

I also though about doing this two years ago but i was busy with other stuff and put the task on hold. So if you are in the mood. Go on!

Sent from my iPhone

On 30 Oct 2016, at 16:49, Dominic Tarr [email protected] wrote:

I am trying to parse a windows Portable Executable in javascript - because it needs to work in the browser. I started writing this by hand, before a friend put me on to radare2! I realized at the same time that the avaliable spec for PE is vague, which makes it very difficult to implement, but radare works great!

I also noticed that there is an emscripten build, it would be great if the output of that could be published on npm, as that would allow using r2 without the difficulty of building it, would this be possible?

—
You are receiving this because you are subscribed to this thread.
Reply to this email directly, view it on GitHub, or mute the thread.

great, okay I am on it!

I can put and maintain the npm packages when ready too

On 30 Oct 2016, at 16:49, Dominic Tarr [email protected] wrote:

I am trying to parse a windows Portable Executable in javascript - because it needs to work in the browser. I started writing this by hand, before a friend put me on to radare2! I realized at the same time that the avaliable spec for PE is vague, which makes it very difficult to implement, but radare works great!

I also noticed that there is an emscripten build, it would be great if the output of that could be published on npm, as that would allow using r2 without the difficulty of building it, would this be possible?

—
You are receiving this because you are subscribed to this thread.
Reply to this email directly, view it on GitHub, or mute the thread.

For you, the best is to check r2pipe, and the commands: "i?" for example: "iV", "isj", ...

image

And the command pfj.

image

r2pipe requires a native r2 to talk with. He wants a full r2 in js

On 30 Oct 2016, at 19:04, Maijin [email protected] wrote:

For you, the best is to check r2pipe, and the commands: "i?" for example: "iV", "isj", ...

And the command pfj.

—
You are receiving this because you commented.
Reply to this email directly, view it on GitHub, or mute the thread.

okay, I managed to get emscripten installed... got to here:

...
cleaning temporally files... done

Final report:
 - PREFIX = /usr
 - HAVE_LIB_GMP = 0
 - HAVE_OPENSSL = 0
 - USE_CAPSTONE = 0
 - HAVE_FORK = 1
 - VERSION = 0.99.9-git
 - USE_LIB_ZIP = 0
 - USE_LIB_MAGIC = 0
 - DEBUGGER = 0
 - CC = emcc --ignore-dynamic-linking
 - USERCC = emscripten
 - USEROSTYPE = auto
 - LIBVERSION = 0.99.9-git
 - BUILD = x86_64-unknown-linux-gnu
 - HOST = emscripten
 - TARGET = x86_64-unknown-linux-gnu
Generating r_version.h file

OSTYPE: linux
ERROR: Unknown platform

make[1]: *** [../../libr/config.mk:209: main] Error 1

are you using sys/emscripten?

i dont have time for this, but fixing the build for the last version of emscriptn should be difficult, did you tried again?

Sorry, I couldn't get it to work. I also tried going back to the version where emscripten was announced and couldn't get that to work either... eventually, just made an http service that shelled out to rabin2

I've been working on some pure javascript reversing tools myself and its a daunting task. I'd be very interested in knowing if someone can get the emscripten build working, I've tried myself with the same results.

i’ll give a try before 1.2 :)

On 02 Jan 2017, at 16:53, cloudtracer notifications@github.com wrote:

I've been working on some pure javascript reversing tools myself and its a daunting task. I'd be very interested in knowing if someone can get the emscripten build working, I've tried myself with the same results.

—
You are receiving this because you commented.
Reply to this email directly, view it on GitHub https://github.com/radare/radare2/issues/6078#issuecomment-269989200, or mute the thread https://github.com/notifications/unsubscribe-auth/AA3-ls2QkMvXrjwpo_6-Ssi3fhTkf5-2ks5rOR1cgaJpZM4KkaOe.

we can use dockcross with emscripten target with the radare2-release. that will simplfy a lot the distribution of r2 in js. i have opened an issue there and @brainstorm will have a look soon

On 02 Jan 2017, at 19:27, [email protected] wrote:

i’ll give a try before 1.2 :)

On 02 Jan 2017, at 16:53, cloudtracer <[email protected] notifications@github.com> wrote:

I've been working on some pure javascript reversing tools myself and its a daunting task. I'd be very interested in knowing if someone can get the emscripten build working, I've tried myself with the same results.

—
You are receiving this because you commented.
Reply to this email directly, view it on GitHub https://github.com/radare/radare2/issues/6078#issuecomment-269989200, or mute the thread https://github.com/notifications/unsubscribe-auth/AA3-ls2QkMvXrjwpo_6-Ssi3fhTkf5-2ks5rOR1cgaJpZM4KkaOe.

Done! :D 1.2 will come with an asmjs build (fully compiled master yesterday)

Was this page helpful?
0 / 5 - 0 ratings

Related issues

0ki picture 0ki  Â·  6Comments

XVilka picture XVilka  Â·  7Comments

MariasStory picture MariasStory  Â·  6Comments

NotAFile picture NotAFile  Â·  6Comments

crowell picture crowell  Â·  8Comments