Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Startissue #921

Closed
wants to merge 9 commits into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion librz/core/cdebug.c
Original file line number Diff line number Diff line change
Expand Up @@ -581,5 +581,5 @@ RZ_IPI void rz_core_debug_attach(RzCore *core, int pid) {
}
rz_debug_select(core->dbg, core->dbg->pid, core->dbg->tid);
rz_config_set_i(core->config, "dbg.swstep", (core->dbg->h && !core->dbg->h->canstep));
rz_core_cmdf(core, "=! \"pid %d\"", core->dbg->pid);
rz_core_cmdf(core, "R! \"pid %d\"", core->dbg->pid);
}
4 changes: 2 additions & 2 deletions librz/core/cfile.c
Original file line number Diff line number Diff line change
Expand Up @@ -1150,7 +1150,7 @@ RZ_API RzCoreFile *rz_core_file_open(RzCore *r, const char *file, int flags, ut6
const bool openmany = rz_config_get_i(r->config, "file.openmany");
RzCoreFile *fh = NULL;

if (!strcmp(file, "-")) {
if (!strcmp(file, "-Pm")) {
file = "malloc://512";
}
//if not flags was passed open it with -r--
Expand Down Expand Up @@ -1233,7 +1233,7 @@ RZ_API RzCoreFile *rz_core_file_open(RzCore *r, const char *file, int flags, ut6
if (loadaddr != UT64_MAX) {
rz_config_set_i(r->config, "bin.laddr", loadaddr);
}
rz_core_cmd0(r, "=!");
rz_core_cmd0(r, "R!");
beach:
r->times->file_open_time = rz_time_now_mono() - prev;
return fh;
Expand Down
2 changes: 1 addition & 1 deletion librz/core/cmd.c
Original file line number Diff line number Diff line change
Expand Up @@ -6611,7 +6611,7 @@ RZ_API void rz_core_cmd_init(RzCore *core) {
{ "-", "open cfg.editor and run script", rz_cmd_stdin },
{ ".", "interpret", rz_cmd_interpret },
{ "/", "search kw, pattern aes", rz_cmd_search },
{ "=", "io pipe", rz_cmd_remote },
{ "R", "io pipe", rz_cmd_remote },
{ "?", "help message", rz_cmd_help },
{ "<", "pipe into RzCons.readChar", rz_cmd_pipein },
{ "0", "alias for s 0x", rz_cmd_ox },
Expand Down
2 changes: 1 addition & 1 deletion librz/core/cmd_api.c
Original file line number Diff line number Diff line change
Expand Up @@ -473,7 +473,7 @@ RZ_API int rz_cmd_call(RzCmd *cmd, const char *input) {
rz_cons_strcat(ji + 1);
return true;
} else {
nstr = rz_str_newf("=! %s", input);
nstr = rz_str_newf("R! %s", input);
input = nstr;
}
}
Expand Down
31 changes: 17 additions & 14 deletions librz/core/cmd_descs/cmd_descs.c
Original file line number Diff line number Diff line change
Expand Up @@ -3936,45 +3936,48 @@ RZ_IPI void newshell_cmddescs_init(RzCore *core) {
RzCmdDesc *cmd_search_cd = rz_cmd_desc_oldinput_new(core->rcmd, root_cd, "/", rz_cmd_search, &cmd_search_help);
rz_warn_if_fail(cmd_search_cd);

RzCmdDesc *equal__cd = rz_cmd_desc_group_new(core->rcmd, root_cd, "=", rz_remote_handler, &remote_help, &equal__help);
RzCmdDesc *equal__cd = rz_cmd_desc_group_new(core->rcmd, root_cd, "=", NULL, NULL, &equal__help);
rz_warn_if_fail(equal__cd);
RzCmdDesc *remote_send_cd = rz_cmd_desc_argv_new(core->rcmd, equal__cd, "=<", rz_remote_send_handler, &remote_send_help);
RzCmdDesc *remote_cd = rz_cmd_desc_argv_new(core->rcmd, equal__cd, "R", rz_remote_handler, &remote_help);
rz_warn_if_fail(remote_cd);

RzCmdDesc *remote_send_cd = rz_cmd_desc_argv_new(core->rcmd, equal__cd, "R<", rz_remote_send_handler, &remote_send_help);
rz_warn_if_fail(remote_send_cd);

RzCmdDesc *io_system_run_oldhandler_cd = rz_cmd_desc_oldinput_new(core->rcmd, equal__cd, "=!", rz_io_system_run_oldhandler, &io_system_run_oldhandler_help);
RzCmdDesc *io_system_run_oldhandler_cd = rz_cmd_desc_oldinput_new(core->rcmd, equal__cd, "R!", rz_io_system_run_oldhandler, &io_system_run_oldhandler_help);
rz_warn_if_fail(io_system_run_oldhandler_cd);

RzCmdDesc *remote_add_cd = rz_cmd_desc_argv_new(core->rcmd, equal__cd, "=+", rz_remote_add_handler, &remote_add_help);
RzCmdDesc *remote_add_cd = rz_cmd_desc_argv_new(core->rcmd, equal__cd, "R+", rz_remote_add_handler, &remote_add_help);
rz_warn_if_fail(remote_add_cd);

RzCmdDesc *remote_del_cd = rz_cmd_desc_argv_new(core->rcmd, equal__cd, "=-", rz_remote_del_handler, &remote_del_help);
RzCmdDesc *remote_del_cd = rz_cmd_desc_argv_new(core->rcmd, equal__cd, "R-", rz_remote_del_handler, &remote_del_help);
rz_warn_if_fail(remote_del_cd);

RzCmdDesc *remote_open_cd = rz_cmd_desc_argv_new(core->rcmd, equal__cd, "==", rz_remote_open_handler, &remote_open_help);
RzCmdDesc *remote_open_cd = rz_cmd_desc_argv_new(core->rcmd, equal__cd, "R=", rz_remote_open_handler, &remote_open_help);
rz_warn_if_fail(remote_open_cd);

RzCmdDesc *remote_mode_enable_cd = rz_cmd_desc_argv_new(core->rcmd, equal__cd, "=!=", rz_remote_mode_enable_handler, &remote_mode_enable_help);
RzCmdDesc *remote_mode_enable_cd = rz_cmd_desc_argv_new(core->rcmd, equal__cd, "R!=", rz_remote_mode_enable_handler, &remote_mode_enable_help);
rz_warn_if_fail(remote_mode_enable_cd);

RzCmdDesc *remote_mode_disable_cd = rz_cmd_desc_argv_new(core->rcmd, equal__cd, "!=!", rz_remote_mode_disable_handler, &remote_mode_disable_help);
RzCmdDesc *remote_mode_disable_cd = rz_cmd_desc_argv_new(core->rcmd, equal__cd, "R=!", rz_remote_mode_disable_handler, &remote_mode_disable_help);
rz_warn_if_fail(remote_mode_disable_cd);

RzCmdDesc *remote_rap_cd = rz_cmd_desc_argv_new(core->rcmd, equal__cd, "=:", rz_remote_rap_handler, &remote_rap_help);
RzCmdDesc *remote_rap_cd = rz_cmd_desc_argv_new(core->rcmd, equal__cd, "R:", rz_remote_rap_handler, &remote_rap_help);
rz_warn_if_fail(remote_rap_cd);

RzCmdDesc *equal_g_handler_old_cd = rz_cmd_desc_oldinput_new(core->rcmd, equal__cd, "=g", rz_equal_g_handler_old, &equal_g_handler_old_help);
RzCmdDesc *equal_g_handler_old_cd = rz_cmd_desc_oldinput_new(core->rcmd, equal__cd, "Rg", rz_equal_g_handler_old, &equal_g_handler_old_help);
rz_warn_if_fail(equal_g_handler_old_cd);

RzCmdDesc *equal_h_handler_old_cd = rz_cmd_desc_oldinput_new(core->rcmd, equal__cd, "=h", rz_equal_h_handler_old, &equal_h_handler_old_help);
RzCmdDesc *equal_h_handler_old_cd = rz_cmd_desc_oldinput_new(core->rcmd, equal__cd, "Rh", rz_equal_h_handler_old, &equal_h_handler_old_help);
rz_warn_if_fail(equal_h_handler_old_cd);

RzCmdDesc *equal_H_handler_old_cd = rz_cmd_desc_oldinput_new(core->rcmd, equal__cd, "=H", rz_equal_H_handler_old, &equal_H_handler_old_help);
RzCmdDesc *equal_H_handler_old_cd = rz_cmd_desc_oldinput_new(core->rcmd, equal__cd, "RH", rz_equal_H_handler_old, &equal_H_handler_old_help);
rz_warn_if_fail(equal_H_handler_old_cd);

RzCmdDesc *remote_tcp_cd = rz_cmd_desc_argv_new(core->rcmd, equal__cd, "=t", rz_remote_tcp_handler, &remote_tcp_help);
RzCmdDesc *remote_tcp_cd = rz_cmd_desc_argv_new(core->rcmd, equal__cd, "Rt", rz_remote_tcp_handler, &remote_tcp_help);
rz_warn_if_fail(remote_tcp_cd);

RzCmdDesc *remote_rap_bg_cd = rz_cmd_desc_argv_new(core->rcmd, equal__cd, "=&:", rz_remote_rap_bg_handler, &remote_rap_bg_help);
RzCmdDesc *remote_rap_bg_cd = rz_cmd_desc_argv_new(core->rcmd, equal__cd, "R&:", rz_remote_rap_bg_handler, &remote_rap_bg_help);
rz_warn_if_fail(remote_rap_bg_cd);

RzCmdDesc *cmd_help_search_cd = rz_cmd_desc_argv_modes_new(core->rcmd, root_cd, "?*", RZ_OUTPUT_MODE_STANDARD | RZ_OUTPUT_MODE_JSON, rz_cmd_help_search_handler, &cmd_help_search_help);
Expand Down
28 changes: 14 additions & 14 deletions librz/core/cmd_descs/cmd_remote.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
---
name: cmd_remote
commands:
- name: "="
- name: "R"
cname: remote
summary: List all open connections / Exec <cmd> at remote <fd>
args_str: " [[<fd>] <cmd>]"
Expand All @@ -13,7 +13,7 @@ commands:
optional: true
- name: cmd
type: RZ_CMD_ARG_TYPE_CMD
- name: =<
- name: R<
cname: remote_send
summary: Send output of local <cmd> to remote <fd>
args:
Expand All @@ -22,43 +22,43 @@ commands:
optional: true
- name: cmd
type: RZ_CMD_ARG_TYPE_CMD
- name: =!
- name: R!
cname: io_system_run_oldhandler
summary: Run <cmd> via rz_io_system
type: RZ_CMD_DESC_TYPE_OLDINPUT
args_str: "[<cmd>]"
options: ""
- name: =+
- name: R+
cname: remote_add
summary: Connect to remote host:port
args:
- name: "[proto://]host:port"
type: RZ_CMD_ARG_TYPE_STRING
- name: =-
- name: R-
cname: remote_del
summary: remove all hosts or host 'fd'
args:
- name: fd
type: RZ_CMD_ARG_TYPE_NUM
optional: true
- name: ==
- name: R=
cname: remote_open
summary: Open remote session with host 'fd', 'q' to quit
args:
- name: fd
type: RZ_CMD_ARG_TYPE_NUM
- name: =!=
- name: R!=
cname: remote_mode_enable
summary: Enable remote cmd mode, sending commands to remote <fd> server
args:
- name: fd
type: RZ_CMD_ARG_TYPE_NUM
default_value: "0"
- name: "!=!"
- name: "R=!"
cname: remote_mode_disable
summary: Disable remote cmd mode
args: []
- name: "=:"
- name: "R:"
cname: remote_rap
summary: Start the rap server (o rap://9999) / Execute <cmd> on rap server
args:
Expand All @@ -67,19 +67,19 @@ commands:
- name: cmd
type: RZ_CMD_ARG_TYPE_CMD
optional: true
- name: =g
- name: Rg
cname: equal_g_handler_old
summary: Start the gdbserver
type: RZ_CMD_DESC_TYPE_OLDINPUT
- name: =h
- name: Rh
cname: equal_h_handler_old
summary: Start the http webserver
type: RZ_CMD_DESC_TYPE_OLDINPUT
- name: =H
- name: RH
cname: equal_H_handler_old
summary: Start the http webserver (and launch the web browser)
type: RZ_CMD_DESC_TYPE_OLDINPUT
- name: =t
- name: Rt
cname: remote_tcp
summary: Start the tcp server
args:
Expand All @@ -88,7 +88,7 @@ commands:
- name: cmd
type: RZ_CMD_ARG_TYPE_CMD
optional: true
- name: "=&:"
- name: "R&:"
cname: remote_rap_bg
summary: Start rap server in background (same as '&_=h')
args:
Expand Down
78 changes: 39 additions & 39 deletions librz/core/cmd_remote.c
Original file line number Diff line number Diff line change
Expand Up @@ -9,51 +9,51 @@
static const char *help_msg_equal[] = {
"Usage:", " =[:!+-=ghH] [...]", " # connect with other instances of rizin",
"\nremote commands:", "", "",
"=", "", "list all open connections",
"=<", "[fd] cmd", "send output of local command to remote fd", // XXX may not be a special char
"=", "[fd] cmd", "exec cmd at remote 'fd' (last open is default one)",
"=!", " cmd", "run command via rz_io_system",
"=+", " [proto://]host:port", "connect to remote host:port (*rap://, raps://, tcp://, udp://, http://)",
"=-", "[fd]", "remove all hosts or host 'fd'",
"==", "[fd]", "open remote session with host 'fd', 'q' to quit",
"=!=", "", "disable remote cmd mode",
"!=!", "", "enable remote cmd mode",
"R", "", "list all open connections",
"R<", "[fd] cmd", "send output of local command to remote fd", // XXX may not be a special char
"R", "[fd] cmd", "exec cmd at remote 'fd' (last open is default one)",
"R!", " cmd", "run command via rz_io_system",
"R+", " [proto://]host:port", "connect to remote host:port (*rap://, raps://, tcp://, udp://, http://)",
"R-", "[fd]", "remove all hosts or host 'fd'",
"R=", "[fd]", "open remote session with host 'fd', 'q' to quit",
"R!=", "", "disable remote cmd mode",
"R=!", "", "enable remote cmd mode",
"\nservers:", "", "",
".:", "9000", "start the tcp server (echo x|nc ::1 9090 or curl ::1:9090/cmd/x)",
"=:", "port", "start the rap server (o rap://9999)",
"=g", "[?]", "start the gdbserver",
"=h", "[?]", "start the http webserver",
"=H", "[?]", "start the http webserver (and launch the web browser)",
"R:", "port", "start the rap server (o rap://9999)",
"Rg", "[?]", "start the gdbserver",
"Rh", "[?]", "start the http webserver",
"RH", "[?]", "start the http webserver (and launch the web browser)",
"\nother:", "", "",
"=&", ":port", "start rap server in background (same as '&_=h')",
"=", ":host:port cmd", "run 'cmd' command on remote server",
"R&", ":port", "start rap server in background (same as '&_=h')",
"R", ":host:port cmd", "run 'cmd' command on remote server",
"\nexamples:", "", "",
"=+", "tcp://localhost:9090/", "connect to: rizin -c.:9090 ./bin",
// "=+", "udp://localhost:9090/", "connect to: rizin -c.:9090 ./bin",
"=+", "rap://localhost:9090/", "connect to: rizin rap://:9090",
"=+", "http://localhost:9090/cmd/", "connect to: rizin -c'=h 9090' bin",
"R+", "tcp://localhost:9090/", "connect to: rizin -c.:9090 ./bin",
// "R+", "udp://localhost:9090/", "connect to: rizin -c.:9090 ./bin",
"R+", "rap://localhost:9090/", "connect to: rizin rap://:9090",
"R+", "http://localhost:9090/cmd/", "connect to: rizin -c'=h 9090' bin",
"o ", "rap://:9090/", "start the rap server on tcp port 9090",
NULL
};

static const char *help_msg_equalh[] = {
"Usage:", " =[hH] [...]", " # http server",
"http server:", "", "",
"=h", " port", "listen for http connections (rizin -qc=H /bin/ls)",
"=h-", "", "stop background webserver",
"=h--", "", "stop foreground webserver",
"=h*", "", "restart current webserver",
"=h&", " port", "start http server in background",
"=H", " port", "launch browser and listen for http",
"=H&", " port", "launch browser and listen for http in background",
"Rh", " port", "listen for http connections (rizin -qc=H /bin/ls)",
"Rh-", "", "stop background webserver",
"Rh--", "", "stop foreground webserver",
"Rh*", "", "restart current webserver",
"Rh&", " port", "start http server in background",
"RH", " port", "launch browser and listen for http",
"RH&", " port", "launch browser and listen for http in background",
NULL
};

static const char *help_msg_equalg[] = {
"Usage:", " =[g] [...]", " # gdb server",
"gdbserver:", "", "",
"=g", " port file [args]", "listen on 'port' debugging 'file' using gdbserver",
"=g!", " port file [args]", "same as above, but debug protocol messages (like gdbserver --remote-debug)",
"Rg", " port file [args]", "listen on 'port' debugging 'file' using gdbserver",
"Rg!", " port file [args]", "same as above, but debug protocol messages (like gdbserver --remote-debug)",
NULL
};

Expand Down Expand Up @@ -100,13 +100,13 @@ RZ_IPI int rz_equal_H_handler_old(void *data, const char *input) {
RZ_IPI int rz_cmd_remote(void *data, const char *input) {
RzCore *core = (RzCore *)data;
switch (*input) {
case '\0': // "="
case '\0': // "R"
rz_core_rtr_list(core);
break;
case 'j': // "=j"
case 'j': // "Rj"
eprintf("TODO: list connections in json\n");
break;
case '!': // "=!"
case '!': // "R!"
if (input[1] == 'q') {
RZ_FREE(core->cmdremote);
} else if (input[1] == '=') { // =!=0 or =!= for iosystem
Expand All @@ -120,29 +120,29 @@ RZ_IPI int rz_cmd_remote(void *data, const char *input) {
}
}
break;
case '+': // "=+"
case '+': // "R+"
rz_core_rtr_add(core, input + 1);
break;
case '-': // "=-"
case '-': // "R-"
rz_core_rtr_remove(core, input + 1);
break;
//case ':': rz_core_rtr_cmds (core, input + 1); break;
case '<': // "=<"
case '<': // "R<"
rz_core_rtr_pushout(core, input + 1);
break;
case '=': // "=="
case '=': // "R="
rz_core_rtr_session(core, input + 1);
break;
case 'g': // "=g"
case 'g': // "Rg"
rz_equal_g_handler_old(core, input + 1);
break;
case 'h': // "=h"
case 'h': // "Rh"
rz_equal_h_handler_old(core, input + 1);
break;
case 'H': // "=H"
case 'H': // "RH"
rz_equal_H_handler_old(core, input + 1);
break;
case '?': // "=?"
case '?': // "R?"
rz_core_cmd_help(core, help_msg_equal);
break;
default:
Expand Down
2 changes: 1 addition & 1 deletion librz/core/core.c
Original file line number Diff line number Diff line change
Expand Up @@ -2833,7 +2833,7 @@ static void set_prompt(RzCore *r) {
char *s = rz_core_cmd_str(r, "s");
r->offset = rz_num_math(NULL, s);
free(s);
remote = "=!";
remote = "R!";
}

if (rz_config_get_i(r->config, "scr.color")) {
Expand Down
22 changes: 11 additions & 11 deletions librz/io/p/io_gdb.c
Original file line number Diff line number Diff line change
Expand Up @@ -209,18 +209,18 @@ static char *__system(RzIO *io, RzIODesc *fd, const char *cmd) {
}
if (cmd[0] == '?' || !strcmp(cmd, "help")) {
eprintf("Usage: =!cmd args\n"
" =!pid - show targeted pid\n"
" =!pkt s - send packet 's'\n"
" =!rd - show reverse debugging availability\n"
" =!dsb - step backwards\n"
" =!dcb - continue backwards\n"
" =!monitor cmd - hex-encode monitor command and pass"
" R!pid - show targeted pid\n"
" R!pkt s - send packet 's'\n"
" R!rd - show reverse debugging availability\n"
" R!dsb - step backwards\n"
" R!dcb - continue backwards\n"
" R!monitor cmd - hex-encode monitor command and pass"
" to target interpreter\n"
" =!detach [pid] - detach from remote/detach specific pid\n"
" =!inv.reg - invalidate reg cache\n"
" =!pktsz - get max packet size used\n"
" =!pktsz bytes - set max. packet size as 'bytes' bytes\n"
" =!exec_file [pid] - get file which was executed for"
" R!detach [pid] - detach from remote/detach specific pid\n"
" R!inv.reg - invalidate reg cache\n"
" R!pktsz - get max packet size used\n"
" R!pktsz bytes - set max. packet size as 'bytes' bytes\n"
" R!exec_file [pid] - get file which was executed for"
" current/specified pid\n");
return NULL;
}
Expand Down
Loading