mirror of
https://github.com/radareorg/radare2.git
synced 2025-01-18 20:03:47 +00:00
Add r2preweb rarun2 rule to start the webserver in a thread in r2preload
This commit is contained in:
parent
6fa460a741
commit
721ad8de26
@ -14,11 +14,18 @@ static void sigusr1(int s) {
|
||||
}
|
||||
static void _libwrap_init() __attribute__ ((constructor));
|
||||
static void _libwrap_init() {
|
||||
char *web;
|
||||
signal (SIGUSR1, sigusr1);
|
||||
printf ("libr2 initialized. send SIGUSR1 to %d in order to reach the r2 prompt\n", getpid ());
|
||||
printf ("kill -USR1 %d\n", getpid());
|
||||
web = r_sys_getenv ("RARUN2_WEB");
|
||||
core = r_core_new ();
|
||||
r_core_loadlibs (core, R_CORE_LOADLIBS_ALL, NULL);
|
||||
if (web) {
|
||||
r_core_cmd0 (core, "=H&");
|
||||
r_sys_setenv ("RARUN2_WEB", NULL);
|
||||
free (web);
|
||||
}
|
||||
// TODO: maybe reopen every time a signal is spawned to reload memory regions information
|
||||
// TODO: open io_self
|
||||
}
|
||||
|
@ -1,4 +1,4 @@
|
||||
/* radare2 - Copyleft 2011-2014 - pancake */
|
||||
/* radare2 - Copyleft 2011-2015 - pancake */
|
||||
|
||||
#include <r_util.h>
|
||||
#include <r_socket.h>
|
||||
|
@ -242,6 +242,7 @@ R_API int r_run_parseline (RRunProfile *p, char *b) {
|
||||
else if (!strcmp (b, "libpath")) p->_libpath = strdup (e);
|
||||
else if (!strcmp (b, "preload")) p->_preload = strdup (e);
|
||||
else if (!strcmp (b, "r2preload")) p->_r2preload = parseBool (e);
|
||||
else if (!strcmp (b, "r2preweb")) r_sys_setenv ("RARUN2_WEB", "yes");
|
||||
else if (!strcmp (b, "setuid")) p->_setuid = strdup (e);
|
||||
else if (!strcmp (b, "seteuid")) p->_seteuid = strdup (e);
|
||||
else if (!strcmp (b, "setgid")) p->_setgid = strdup (e);
|
||||
|
@ -52,6 +52,8 @@ preload a library (not supported on Windows, only linux,osx,bsd)
|
||||
path to program to be executed
|
||||
.It Ar r2preload
|
||||
preload with libr2
|
||||
.It Ar r2preweb
|
||||
run the webserver in a thread just at starting the r2preload
|
||||
.It Ar setenv
|
||||
set value for given environment variable
|
||||
.It Ar setegid
|
||||
|
Loading…
x
Reference in New Issue
Block a user