• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    公众号

C++ r_core_cmd_help函数代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

本文整理汇总了C++中r_core_cmd_help函数的典型用法代码示例。如果您正苦于以下问题:C++ r_core_cmd_help函数的具体用法?C++ r_core_cmd_help怎么用?C++ r_core_cmd_help使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。



在下文中一共展示了r_core_cmd_help函数的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的C++代码示例。

示例1: r_comment_var_help

void r_comment_var_help(RCore *core, char type) {
	const char *help_bp[] = {
		"Usage:", "Cvb", "[name] [comment]",
		"Cvb?", "", "show this help",
		"Cvb", "", "list all base pointer args/vars comments in human friendly format",
		"Cvb*", "", "list all base pointer args/vars comments in r2 format",
		"Cvb-", "[name]", "delete comments for var/arg at current offset for base pointer",
		"Cvb", " [name]", "Show comments for var/arg at current offset for base pointer",
		"Cvb", " [name] [comment]", "add/append comment for the variable with the current name",
		"Cvb!", "[name]", "edit comment using cfg editor",
		NULL
	};
	const char *help_sp[] = {
		"Usage:", "Cvs", "[name] [comment]",
		"Cvs?", "", "show this help",
		"Cvs", "", "list all stack based args/vars comments in human friendly format",
		"Cvs*", "", "list all stack based args/vars comments in r2 format",
		"Cvs-", "[name]", "delete comments for stack pointer var/arg with that name",
		"Cvs", "[name]", "Show comments for stack pointer var/arg with that name",
		"Cvs", "[name] [comment]", "add/append comment for the variable",
		"Cvs!", "[name]", "edit comment using cfg editor",
		NULL
	};
	const char *help_reg[] = {
		"Usage:", "Cvr", "[name] [comment]",
		"Cvr?", "", "show this help",
		"Cvr", "", "list all register based args comments in human friendly format",
		"Cvr*", "", "list all register based args comments in r2 format",
		"Cvr-", "[name]", "delete comments for register based arg for that name",
		"Cvr", "[name]", "Show comments for register based arg for that name",
		"Cvr", "[name] [comment]", "add/append comment for the variable",
		"Cvr!", "[name]", "edit comment using cfg editor",
		NULL
	};

	switch (type) {
	case 'b':
		r_core_cmd_help (core, help_bp);
		break;
	case 's':
		r_core_cmd_help (core, help_sp);
		break;
	case 'r':
		r_core_cmd_help (core, help_reg);
		break;
	default:
		r_cons_printf("See Cvb, Cvs and Cvr\n");
	}
}
开发者ID:Lukas-Dresel,项目名称:radare2,代码行数:49,代码来源:cmd_meta.c


示例2: cmd_type_noreturn

static void cmd_type_noreturn(RCore *core, const char *input) {
	const char *help_msg[] = {
		"Usage:", "tn [-][0xaddr|symname]", " manage no-return marks",
		"tn[a]", " 0x3000", "stop function analysis if call/jmp to this address",
		"tn[n]", " sym.imp.exit", "same as above but for flag/fcn names",
		"tn", "-*", "remove all no-return references",
		"tn", "", "list them all",
		NULL };
	switch (input[0]) {
	case '-': // "tn-"
		r_anal_noreturn_drop (core->anal, input + 1);
		break;
	case ' ': // "tn"
		if (input[1] == '0' && input[2] == 'x') {
			r_anal_noreturn_add (core->anal, NULL,
					r_num_math (core->num, input + 1));
		} else {
			r_anal_noreturn_add (core->anal, input + 1,
					r_num_math (core->num, input + 1));
		}
		break;
	case 'a': // "ta"
		if (input[1] == ' ') {
			r_anal_noreturn_add (core->anal, NULL,
					r_num_math (core->num, input + 1));
		} else {
			r_core_cmd_help (core, help_msg);
		}
		break;
	case 'n': // "tnn"
		if (input[1] == ' ') {
			/* do nothing? */
		} else {
			r_core_cmd_help (core, help_msg);
		}
		break;
	case '*':
	case 'r': // "tn*"
		r_anal_noreturn_list (core->anal, 1);
		break;
	case 0: // "tn"
		r_anal_noreturn_list (core->anal, 0);
		break;
	default:
	case '?':
		r_core_cmd_help (core, help_msg);
		break;
	}
}
开发者ID:EliaGeretto,项目名称:radare2,代码行数:49,代码来源:cmd_type.c


示例3: show_help

static void show_help(RCore *core) {
	const char *help_message[] = {
		"Usage: t", "", "# cparse types commands",
		"t", "", "List all loaded types",
		"t", " <type>", "Show type in 'pf' syntax",
		"t*", "", "List types info in r2 commands",
		"t-", " <name>", "Delete types by its name",
		"t-*", "", "Remove all types",
		//"t-!", "",          "Use to open $EDITOR",
		"tb", " <enum> <value>", "Show matching enum bitfield for given number",
		"te", "", "List all loaded enums",
		"te", " <enum> <value>", "Show name for given enum number",
		"td", " <string>", "Load types from string",
		"tf", "", "List all loaded functions signatures",
		"tk", " <sdb-query>", "Perform sdb query",
		"tl", "[?]", "Show/Link type to an address",
		//"to",  "",         "List opened files",
		"to", " -", "Open cfg.editor to load types",
		"to", " <path>", "Load types from C header file",
		"tos", " <path>", "Load types from parsed Sdb database",
		"tp", " <type>  = <address>", "cast data at <adress> to <type> and print it",
		"ts", "", "print loaded struct types",
		"tu", "", "print loaded union types",
		//"| ts k=v k=v @ link.addr set fields at given linked type\n"
		NULL };
	r_core_cmd_help (core, help_message);
}
开发者ID:HKingz,项目名称:radare2,代码行数:27,代码来源:cmd_type.c


示例4: cmd_fz

static void cmd_fz(RCore *core, const char *input) {
	switch (*input) {
	case '?':
		r_core_cmd_help (core, help_msg_fz);
		break;
	case '.':
		{
			const char *a = NULL, *b = NULL;
			r_flag_zone_around (core->flags, core->offset, &a, &b);
			r_cons_printf ("%s %s\n", a?a:"~", b?b:"~");
		}
		break;
	case ':':
		{
			const char *a, *b;
			int a_len = 0;
			int w = r_cons_get_size (NULL);
			r_flag_zone_around (core->flags, core->offset, &a, &b);
			if (a) {
				r_cons_printf ("[<< %s]", a);
				a_len = strlen (a) + 4;
			}
			int padsize = (w / 2)  - a_len;
			int title_size = 12;
			if (a || b) {
				char *title = r_str_newf ("[ 0x%08"PFMT64x" ]", core->offset);
				title_size = strlen (title);
				padsize -= strlen (title) / 2;
				const char *halfpad = r_str_pad (' ', padsize);
				r_cons_printf ("%s%s", halfpad, title);
				free (title);
			}
			if (b) {
				padsize = (w / 2) - title_size - strlen (b) - 4;
				const char *halfpad = padsize > 1? r_str_pad (' ', padsize): "";
				r_cons_printf ("%s[%s >>]", halfpad, b);
			}
			if (a || b) {
				r_cons_newline();
			}
		}
		break;
	case ' ':
		r_flag_zone_add (core->flags, r_str_trim_ro (input + 1), core->offset);
		break;
	case '-':
		if (input[1] == '*') {
			r_flag_zone_reset (core->flags);
		} else {
			r_flag_zone_del (core->flags, input + 1);
		}
		break;
	case '*':
		r_flag_zone_list (core->flags, '*');
		break;
	case 0:
		r_flag_zone_list (core->flags, 0);
		break;
	}
}
开发者ID:rlaemmert,项目名称:radare2,代码行数:60,代码来源:cmd_flag.c


示例5: show_help

static void show_help(RCore *core) {
	const char * help_message[] = {
		"Usage: t", "",    "# cparse types commands",
		"t",   "",         "List all loaded types",
		"t",   " <type>",  "Show type in 'pf' syntax",
		"t*",  "",         "List types info in r2 commands",
		"t-",  " <name>",  "Delete types by its name",
		"t-*", "",         "Remove all types",
		//"t-!", "",          "Use to open $EDITOR",
		"tb",  " <enum> <value>","Show matching enum bitfield for given number",
		"te",  " <enum> <value>","Show name for given enum number",
		"td",  " <string>","Load types from string",
		"td-", "<name>",   "Undefine type by name",
		"tf",  " <addr>",  "View linked type at given address",
		"tl",  "[?]",      "Show/Link type to a address",
		//"to",  "",         "List opened files",
		"to",  " -",       "Open cfg.editor to load types",
		"to",  " <path>",  "Load types from C header file",
		"tk",  " <sdb-query>", "Perform sdb query",
		"ts",  " <k>=<v>", "Set fields at curseek linked type",
		//"| ts k=v k=v @ link.addr set fields at given linked type\n"
		NULL
	};
	r_core_cmd_help (core, help_message);
}
开发者ID:DePierre,项目名称:radare2,代码行数:25,代码来源:cmd_type.c


示例6: cmd_quit

static int cmd_quit(void *data, const char *input) {
	RCore *core = (RCore *)data;
	const char* help_msg[] = {
		"Usage:",  "q[!] [retval]", "",
		"q","","quit program",
		"q!","","force quit (no questions)",
		"q"," 1","quit with return value 1",
		"q"," a-b","quit with return value a-b",
		NULL};
	if (input)
	switch (*input) {
	case '?':
		r_core_cmd_help (core, help_msg);
		break;
	case ' ':
	case '!':
		input++;
	case '\0':
		// TODO
	default:
		r_line_hist_save (R2_HOMEDIR"/history");
		if (*input)
			r_num_math (core->num, input);
		else core->num->value = 0LL;
		//exit (*input?r_num_math (core->num, input+1):0);
		//if (core->http_up) return R_FALSE; // cancel quit when http is running
		return -2;
	}
	return R_FALSE;
}
开发者ID:CodingFree,项目名称:radare2,代码行数:30,代码来源:cmd_quit.c


示例7: cmd_quit

static int cmd_quit(void *data, const char *input) {
	RCore *core = (RCore *)data;
	const char* help_msg[] = {
		"Usage:",  "q[!][!] [retval]", "",
		"q","","quit program",
		"q!","","force quit (no questions)",
		"q!!","","force quit without saving history",
		"q"," 1","quit with return value 1",
		"q"," a-b","quit with return value a-b",
		NULL};
	if (input)
	switch (*input) {
	case '?':
		r_core_cmd_help (core, help_msg);
		break;
	case '!':
		if (input[1] == '!')
			r_config_set (core->config, "scr.histsave", "false");
		core->num->value = -1;
		return -2;
	case '\0':
		core->num->value = 0LL;
		return -2;
	default:
		if (*input == ' ')
			input++;
		if (*input)
			r_num_math (core->num, input);
		else core->num->value = 0LL;
		//exit (*input?r_num_math (core->num, input+1):0);
		//if (core->http_up) return R_FALSE; // cancel quit when http is running
		return -2;
	}
	return R_FALSE;
}
开发者ID:Bayinformationtechnologies,项目名称:radare2,代码行数:35,代码来源:cmd_quit.c


示例8: cmd_wf

static bool cmd_wf(RCore *core, const char *input) {
	if (!core || !*input) {
		return false;
	}
	if (input[1] == '?') {
		eprintf ("Usage: wf [file] ([size] ([offset]))\n");
		r_core_cmd_help (core, help_msg_wf);
		return false;
	}
	if (input[1] == 's') { // "wfs"
		return cmd_wfs (core, input + 1);
	}
	if (input[1] == 'f') { // "wff"
		return cmd_wff (core, input + 1);
	}
	char *args = r_str_trim (strdup (input + 1));
	char *arg = strchr (args, ' ');
	int len = core->blocksize;
	if (arg) {
		*arg++ = 0;
		len = r_num_math (core->num, arg);
	}
	ut64 addr = r_num_math (core->num, args);
	ioMemcpy (core, core->offset, addr, len);
	free (args);
	r_core_block_read (core);
	return true;
}
开发者ID:agatti,项目名称:radare2,代码行数:28,代码来源:cmd_write.c


示例9: cmd_meta

static int cmd_meta(void *data, const char *input) {
	RCore *core = (RCore*)data;
	int i;
	RAnalFunction *f;

	switch (*input) {
	case 'j':
	case '*':
		r_meta_list (core->anal, R_META_TYPE_ANY, *input);
		break;
	case 'L':
		cmd_meta_lineinfo (core, input + 1);
		break;
	case 'C':
		cmd_meta_comment (core, input);
		break;
	case 'h': /* comment */
	case 's': /* string */
	case 'd': /* data */
	case 'm': /* magic */
	case 'f': /* formatted */
		cmd_meta_hsdmf (core, input);
		break;
	case '-':
		if (input[1]!='*') {
			i = r_num_math (core->num, input+((input[1]==' ')?2:1));
			r_meta_del (core->anal, R_META_TYPE_ANY, core->offset, i, "");
		} else r_meta_cleanup (core->anal, 0LL, UT64_MAX);
		break;
	case '\0':
	case '?':{
			const char* help_msg[] = {
				"Usage:", "C[-LCvsdfm?] [...]", " # Metadata management",
				"C*", "", "list meta info in r2 commands",
				"C-", " [len] [[@]addr]", "delete metadata at given address range",
				"CL", "[-][*] [file:line] [addr]", "show or add 'code line' information (bininfo)",
				"CC", "[-] [comment-text] [@addr]", "add/remove comment",
				"CC!", " [@addr]", "edit comment with $EDITOR",
				"CCa", "[-at]|[at] [text] [@addr]", "add/remove comment at given address",
				"CCu", " [comment-text] [@addr]", "add unique comment",
				"Cs", "[-] [size] [@addr]", "add string",
				"Ch", "[-] [size] [@addr]", "hide data",
				"Cd", "[-] [size] [@addr]", "hexdump data",
				"Cf", "[-] [sz] [fmt..] [@addr]", "format memory (see pf?)",
				"Cm", "[-] [sz] [fmt..] [@addr]", "magic parse (see pm?)",
				NULL};
			r_core_cmd_help (core, help_msg);
			}
		break;
	case 'F':
		f = r_anal_get_fcn_in (core->anal, core->offset,
			R_ANAL_FCN_TYPE_FCN|R_ANAL_FCN_TYPE_SYM);
		if (f) r_anal_str_to_fcn (core->anal, f, input+2);
		else eprintf ("Cannot find function here\n");
		break;
	}
	return R_TRUE;
}
开发者ID:AnwarMohamed,项目名称:radare2,代码行数:58,代码来源:cmd_meta.c


示例10: r_core_hack_help

void r_core_hack_help(const RCore *core) {
	const char* help_msg[] = {
		"wao", " [op]", "performs a modification on current opcode",
		"wao", " nop", "nop current opcode",
		"wao", " jz", "make current opcode conditional (zero)",
		"wao", " jnz", "make current opcode conditional (not zero)",
		"wao", " ret1", "make the current opcode return 1",
		"wao", " ret0", "make the current opcode return 0",
		"wao", " retn", "make the current opcode return -1",
		"wao", " nocj", "remove conditional operation from branch (make it unconditional)",
		"wao", " trap", "make the current opcode a trap",
		"wao", " recj", "reverse (swap) conditional branch instruction",
		"NOTE:", "", "those operations are only implemented for x86 and arm atm.", //TODO
		NULL
	};
	r_core_cmd_help (core, help_msg);
}
开发者ID:megabug,项目名称:radare2,代码行数:17,代码来源:hack.c


示例11: main

int main (int argc, char **argv) {
	r_anal_esil_set_pc (core->anal->esil, fcn ? fcn->addr : core->offset);
	switch (*input) {
	case '\0': // "aft"
	{
		seek = core->offset;
		r_anal_esil_set_pc (core->anal->esil, fcn ? fcn->addr : core->offset);
		r_core_anal_type_match (core, fcn);
		r_core_seek (core, seek, true);
		break;
	}
	case '?':
	default:
		r_core_cmd_help (core, help_msg_aft);
		break;
	}
	return 0;
}
开发者ID:aronsky,项目名称:radare2,代码行数:18,代码来源:indent-example.c


示例12: r_core_rtr_help

R_API void r_core_rtr_help(RCore *core) {
	const char* help_msg[] = {
	"Usage:", " =[:!+-=hH] [...]", " # radare remote command execution protocol",
	"=", ":port", "listen on given port using rap protocol (o rap://9999)",
	"=", ":host:port cmd", "run 'cmd' command on remote server",
	"\nrap commands:", "", "",
	"=", "", "list all open connections",
	"=<", "[fd] cmd", "send output of local command to remote fd",
	"=", "[fd] cmd", "exec cmd at remote 'fd' (last open is default one)",
	"=!", " cmd", "run command via r_io_system",
	"=+", " [proto://]host", "add host (default=rap://, tcp://, udp://)",
	"=-", "[fd]", "remove all hosts or host 'fd'",
	"==", "[fd]", "open remote session with host 'fd', 'q' to quit",
	"\nhttp server:", "", "",
	"=h", "", "listen for http connections (r2 -qc=H /bin/ls)",
	"=H", "", "launch browser and listen for http",
	NULL};
	r_core_cmd_help (core, help_msg);
}
开发者ID:dialeth,项目名称:radare2,代码行数:19,代码来源:rtr.c


示例13: cmd_hash

static int cmd_hash(void *data, const char *input) {
	RCore *core = (RCore *)data;

	if (*input == '!') {
		return cmd_hash_bang (core, input);
	}
	if (*input == '?') {
		const char *helpmsg3[] = {
		"Usage #!interpreter [<args>] [<file] [<<eof]","","",
		" #", "", "comment - do nothing",
		" #!","","list all available interpreters",
		" #!python","","run python commandline",
		" #!python"," foo.py","run foo.py python script (same as '. foo.py')",
		//" #!python <<EOF        get python code until 'EOF' mark\n"
		" #!python"," arg0 a1 <<q","set arg0 and arg1 and read until 'q'",
		NULL};
		r_core_cmd_help (core, helpmsg3);
		return false;
	}
	/* this is a comment - captain obvious
	   should not be reached, see r_core_cmd_subst() */
	return 0;
}
开发者ID:EliaGeretto,项目名称:radare2,代码行数:23,代码来源:cmd_hash.c


示例14: cmd_meta_comment

static int cmd_meta_comment(RCore *core, const char *input) {
	ut64 addr = core->offset;
	switch (input[1]) {
	case '?': {
		const char* help_msg[] = {
			"Usage:", "CC[-+!*au] [base64:..|str] @ addr", "",
			"CC", "", "list all comments in human friednly form",
			"CC*", "", "list all comments in r2 commands",
			"CC.", "", "show comment at current offset",
			"CC", " or maybe not", "append comment at current address",
			"CC+", " same as above", "append comment at current address",
			"CC!", "", "edit comment using cfg.editor (vim, ..)",
			"CC-", " @ cmt_addr", "remove comment at given address",
			"CCu", " good boy @ addr", "add good boy comment at given address",
			"CCu", " base64:AA== @ addr", "add comment in base64",
			NULL};
		r_core_cmd_help (core, help_msg);
		} break;
	case '.':
		  {
			  char *comment = r_meta_get_string (
					  core->anal, R_META_TYPE_COMMENT, addr);
			  if (comment) {
				  r_cons_printf ("%s\n", comment);
				  free (comment);
			  }
		  }
		break;
	case 0:
		r_meta_list (core->anal, R_META_TYPE_COMMENT, 0);
		break;
	case '!':
		{
			char *out, *comment = r_meta_get_string (
					core->anal, R_META_TYPE_COMMENT, addr);
			out = r_core_editor (core, NULL, comment);
			if (out) {
				//r_meta_add (core->anal->meta, R_META_TYPE_COMMENT, addr, 0, out);
				r_core_cmdf (core, "[email protected]%08"PFMT64x, addr);
				//r_meta_del (core->anal->meta, input[0], addr, addr+1, NULL);
				r_meta_set_string (core->anal,
						R_META_TYPE_COMMENT, addr, out);
				free (out);
			}
			free (comment);
		}
		break;
	case '+':
	case ' ':
		{
		const char* newcomment = input+2;
		char *text, *nc;
		while (*newcomment==' ') newcomment++;
		char *comment = r_meta_get_string (
				core->anal, R_META_TYPE_COMMENT, addr);
		nc = strdup (newcomment);
		r_str_unescape (nc);
		if (comment) {
			text = malloc (strlen (comment)+strlen (newcomment)+2);
			strcpy (text, comment);
			strcat (text, "\n");
			strcat (text, nc);
			r_meta_set_string (core->anal, R_META_TYPE_COMMENT,
					addr, text);
			free (text);
		} else {
			r_meta_set_string (core->anal, R_META_TYPE_COMMENT,
					addr, nc);
		}
		free (nc);
		}
		break;
	case '*':
		r_meta_list (core->anal, R_META_TYPE_COMMENT, 1);
		break;
	case '-':
		r_meta_del (core->anal, R_META_TYPE_COMMENT, core->offset, 1, NULL);
		break;
	case 'u':
		//
		{
		char *newcomment;
		const char *arg = input+2;
		while (*arg && *arg == ' ') arg++;
		if (!strncmp (arg, "base64:", 7)) {
			char *s = (char *)sdb_decode (arg+7, NULL);
			if (s) {
				newcomment = s;
			} else {
				newcomment = NULL;
			}
		} else {
			newcomment = strdup (arg);
		}
		if (newcomment) {
			char *comment = r_meta_get_string (
					core->anal, R_META_TYPE_COMMENT, addr);
			if (!comment || (comment && !strstr (comment, newcomment))) {
				r_meta_set_string (core->anal, R_META_TYPE_COMMENT,
						addr, newcomment);
//.........这里部分代码省略.........
开发者ID:8500616886,项目名称:radare2,代码行数:101,代码来源:cmd_meta.c


示例15: cmd_meta

static int cmd_meta(void *data, const char *input) {
	RCore *core = (RCore*)data;
	int i;
	RAnalFunction *f;

	switch (*input) {
	case 'j':
	case '*':
		r_meta_list (core->anal, R_META_TYPE_ANY, *input);
		break;
	case 'L':
		cmd_meta_lineinfo (core, input + 1);
		break;
	case 'C':
		cmd_meta_comment (core, input);
		break;
	case 'h': /* comment */
	case 's': /* string */
	case 'd': /* data */
	case 'm': /* magic */
	case 'f': /* formatted */
		cmd_meta_hsdmf (core, input);
		break;
	case '-':
		if (input[1]!='*') {
			i = r_num_math (core->num, input+((input[1]==' ')?2:1));
			r_meta_del (core->anal, R_META_TYPE_ANY, core->offset, i, "");
		} else r_meta_cleanup (core->anal, 0LL, UT64_MAX);
		break;
	case '\0':
	case '?':{
			const char* help_msg[] = {
				"Usage:", "C[-LCvsdfm?] [...]", " # Metadata management",
				"C*", "", "list meta info in r2 commands",
				"C-", " [len] [[@]addr]", "delete metadata at given address range",
				"CL", "[-][*] [file:line] [addr]", "show or add 'code line' information (bininfo)",
				"CS", "[-][space]", "manage meta-spaces to filter comments, etc..",
				"CC", "[-] [comment-text] [@addr]", "add/remove comment",
				"CC!", " [@addr]", "edit comment with $EDITOR",
				"CCa", "[-at]|[at] [text] [@addr]", "add/remove comment at given address",
				"CCu", " [comment-text] [@addr]", "add unique comment",
				"Cs", "[-] [size] [@addr]", "add string",
				"Ch", "[-] [size] [@addr]", "hide data",
				"Cd", "[-] [size] [@addr]", "hexdump data",
				"Cf", "[-] [sz] [fmt..] [@addr]", "format memory (see pf?)",
				"Cm", "[-] [sz] [fmt..] [@addr]", "magic parse (see pm?)",
				NULL};
			r_core_cmd_help (core, help_msg);
			}
		break;
	case 'F':
		f = r_anal_get_fcn_in (core->anal, core->offset,
			R_ANAL_FCN_TYPE_FCN|R_ANAL_FCN_TYPE_SYM);
		if (f) r_anal_str_to_fcn (core->anal, f, input+2);
		else eprintf ("Cannot find function here\n");
		break;
	case 'S':
		 {
		RSpaces *ms = &core->anal->meta_spaces;
		/** copypasta from `fs`.. this must be refactorized to be shared */
		switch (input[1]) {
		case '?':
			{
			const char *help_msg[] = {
			"Usage: CS","[*] [+-][metaspace|addr]", " # Manage metaspaces",
			"CS","","display metaspaces",
			"CS"," *","select all metaspaces",
			"CS"," metaspace","select metaspace or create if it doesn't exist",
			"CS","-metaspace","remove metaspace",
			"CS","-*","remove all metaspaces",
			"CS","+foo","push previous metaspace and set",
			"CS","-","pop to the previous metaspace",
		//	"CSm"," [addr]","move metas at given address to the current metaspace",
			"CSr"," newname","rename selected metaspace",
			NULL};
			r_core_cmd_help (core, help_msg);
			}
			break;
		case '+':
			r_space_push (ms, input+2);
			break;
		case 'r':
			if (input[2]==' ')
				r_space_rename (ms, NULL, input+2);
			else eprintf ("Usage: CSr [newname]\n");
			break;
		case '-':
			if (input[2]) {
				if (input[2]=='*') {
					r_space_unset (ms, NULL);
				} else {
					r_space_unset (ms, input+2);
				}
			} else {
				r_space_pop (ms);
			}
			break;
		case 'j':
		case '\0':
		case '*':
//.........这里部分代码省略.........
开发者ID:8500616886,项目名称:radare2,代码行数:101,代码来源:cmd_meta.c


示例16: cmd_log

static int cmd_log(void *data, const char *input) {
	RCore *core = (RCore *)data;
	const char *arg, *input2;
	int n, n2;

	if (!input)
		return 1;

	input2 = (input && *input) ? input+1 : "";
	arg = strchr (input2, ' ');
	n = atoi (input2);
	n2 = arg ? atoi (arg+1) : 0;

	switch (*input) {
	case 'e': // shell: less
		{
		char *p = strchr (input, ' ');
		if (p) {
			char *b = r_file_slurp (p+1, NULL);
			if (b) {
				r_cons_less_str (b, NULL);
				free (b);
			} else eprintf ("File not found\n");
		} else eprintf ("Usage: less [filename]\n");
		}
		break;
	case 'l':
		r_cons_printf ("%d\n", core->log->last-1);
		break;
	case '-':
		r_core_log_del (core, n);
		break;
	case '?':{
			const char* help_msg[] = {
			"Usage:", "T","[-][ num|msg]",
			"T", "", "List all Text log messages",
			"T", " new comment", "0x80480",
			"T", " 123", "List log from 123",
			"T", " 10 3", "List 3 log messages starting from 10",
			"T*", "", "List in radare commands",
			"T-", "", "Delete all logs",
			"T-", " 123", "Delete logs before 123",
			"Tl", "", "Get last log message id",
			"Tj", "", "List in json format",
			"Tm", " [idx]", "Display log messages without index",
			"Ts", "", "List files in current directory (see pwd, cd)",
			"Tp", "[-plug]", "Tist, load, unload plugins",
			"TT", "", "Enter into the text log chat console",
			NULL};
		r_core_cmd_help (core, help_msg);
		}
		break;
	case 'T':
		if (r_config_get_i (core->config, "scr.interactive")) {
			textlog_chat (core);
		} else eprintf ("Only available when the screen is interactive\n");
		break;
	case 'p':
		switch (input[1]) {
		case 0:
			r_lib_list (core->lib);
			break;
		case '-':
			r_lib_close (core->lib, input+2);
			break;
		case ' ':
			r_lib_open (core->lib, input+2);
			break;
		case '?': {
			const char* help_msg[] = {
			"Usage:", "Tp", "[-name][ file]",
			"Tp", "", "List all plugins loaded by RCore.lib",
			"Tp-", "duk", "Unload plugin matching in filename",
			"Tp", " blah."R_LIB_EXT, "Load plugin file",
			NULL};
			r_core_cmd_help(core, help_msg);
			}
			break;
		}
		break;
	case ' ':
		if (n>0) {
			r_core_log_list (core, n, n2, *input);
		} else {
			r_core_log_add (core, input+1);
		}
		break;
	case 'm':
		if (n>0) {
			r_core_log_list (core, n, 1, 't');
		} else {
			r_core_log_list (core, n, 0, 't');
		}
		break;
	case 'j':
	case '*':
	case '\0':
		r_core_log_list (core, n, n2, *input);
		break;
	}
//.........这里部分代码省略.........
开发者ID:13572293130,项目名称:radare2,代码行数:101,代码来源:cmd_log.c


示例17: cmd_type


//.........这里部分代码省略.........
			const char *filename = input + 2;
			if (!strcmp (filename, "-")) {
				char *out, *tmp;
				tmp = r_core_editor (core, NULL, "");
				if (tmp) {
					out = r_parse_c_string (tmp);
					if (out) {
				//		r_cons_strcat (out);
						sdb_query_lines (core->anal->sdb_types, out);
						free (out);
					}
					free (tmp);
				}
			} else {
				char *out = r_parse_c_file (filename);
				if (out) {
				//	r_cons_strcat (out);
					sdb_query_lines (core->anal->sdb_types, out);
					free (out);
				}
				//r_anal_type_loadfile (core->anal, filename);
			}
		}
		break;
	// td - parse string with cparse engine and load types from it
	case 'd':
		if (input[1] == '?') {
			const char * help_message[] = {
				"Usage:", "td[...]", "",
				"td", "[string]", "Load types from string",
				NULL
			 };

			r_core_cmd_help(core, help_message);
		} else
		if (input[1] == '-') {
			const char *arg = strchr (input+1, ' ');
			if (arg) arg++; else arg = input+2;
			r_anal_type_del (core->anal, arg);
		} else
		if (input[1] == ' ') {
			char tmp[8192];
			snprintf (tmp, sizeof (tmp)-1, "%s;", input+2);
			//const char *string = input + 2;
			//r_anal_str_to_type (core->anal, string);
			char *out = r_parse_c_string (tmp);
			if (out) {
				//r_cons_strcat (out);
				sdb_query_lines (core->anal->sdb_types, out);
				free (out);
			}
		} else {
			eprintf ("Invalid use of td. See td? for help\n");
		}
		break;
	// tl - link a type to an address
	case 'l':
		if (input[1]=='?') {
			const char * help_message[] = {
				"Usage: tl", " [typename|addr] ([addr])@[addr|function]", "",
				NULL
			 };

			r_core_cmd_help(core, help_message);
		} else if (input[1]) {
			ut64 addr = r_num_math (core->num, input+2);
开发者ID:openapt,项目名称:engine,代码行数:67,代码来源:cmd_type.c


示例18: cmd_write_op


//.........这里部分代码省略.........
			if (space) {
				*space++ = 0;
				key = space;
				space = strchr (key, ' ');
				if (space) {
					*space++ = 0;
					iv = space;
				}
			}
			algo = args;
			if (algo && *algo && key) {
				encrypt_or_decrypt_block (core, algo, key, direction, iv);
			} else {
				eprintf ("Usage: wo%c [algo] [key] [IV]\n", ((!direction)?'E':'D'));
				eprintf ("Currently supported hashes:\n");
				ut64 bits;
				int i;
				for (i = 0; ; i++) {
					bits = ((ut64)1) << i;
					const char *name = r_hash_name (bits);
					if (!name || !*name) break;
					printf ("  %s\n", name);
				}
				eprintf ("Available Encoders/Decoders: \n");
				// TODO: do not hardcode
				eprintf ("  base64\n");
				eprintf ("  base91\n");
				eprintf ("  punycode\n");
				eprintf ("Currently supported crypto algos:\n");
				for (i = 0; ; i++) {
					bits = ((ut64)1) << i;
					const char *name = r_crypto_name (bits);
					if (!name || !*name) break;
					printf ("  %s\n", name);
				}
			}
			free (args);
		}
		break;
	case 'p': // debrujin patterns
		switch (input[2]) {
		case 'D': // "wopD"
			len = (int)(input[3]==' ')
				? r_num_math (core->num, input + 3)
				: core->blocksize;
			if (len > 0) {
				/* XXX This seems to fail at generating long patterns (wopD 512K) */
				buf = (ut8*)r_debruijn_pattern (len, 0, NULL); //debruijn_charset);
				if (buf) {
					const ut8 *ptr = buf;
					ut64 addr = core->offset;
					if (input[3] == '*') {
						int i;
						r_cons_printf ("wx ");
						for (i = 0; i < len; i++) {
							r_cons_printf ("%02x", buf[i]);
						}
						r_cons_newline ();
					} else {
						while (true) {
							int res = r_core_write_at (core, addr, ptr, len);
							if (res < 1 || len == res) {
								break;
							}
							if (res < len) {
								ptr += res;
								len -= res;
								addr += res;
							}
						} 
					}
					free (buf);
				} else {
					eprintf ("Couldn't generate pattern of length %d\n", len);
				}
			}
			break;
		case 'O': // "wopO"
			if (strlen (input) > 4 && strncmp (input + 4, "0x", 2)) {
				eprintf ("Need hex value with `0x' prefix e.g. 0x41414142\n");
			} else if (input[3] == ' ') {
				value = r_num_get (core->num, input + 4);
				core->num->value = r_debruijn_offset (value, r_config_get_i (core->config, "cfg.bigendian"));
				r_cons_printf ("%"PFMT64d"\n", core->num->value);
			}
			break;
		case '\0':
		case '?':
		default:
			r_core_cmd_help (core, help_msg_wop);
			break;
		}
		break;
	case '\0':
	case '?':
	default:
		r_core_cmd_help (core, help_msg_wo);
		break;
	}
}
开发者ID:agatti,项目名称:radare2,代码行数:101,代码来源:cmd_write.c


示例19: cmd_write_value

static void cmd_write_value (RCore *core, const char *input) {
	int type = 0;
	ut64 off = 0LL;
	ut8 buf[sizeof(ut64)];
	int wseek = r_config_get_i (core->config, "cfg.wseek");
	bool be = r_config_get_i (core->config, "cfg.bigendian");

	if (!input)
		return;

	if (input[0])
	switch (input[1]) {
	case '?':
		r_core_cmd_help (core, help_msg_wv);
		return;
	case '1': type = 1; break;
	case '2': type = 2; break;
	case '4': type = 4; break;
	case '8': type = 8; break;
	}
	if (input && input[0] && input[1] && input[2]) {
		off = r_num_math (core->num, input+2);
	}
	if (core->file) {
		r_io_use_fd (core->io, core->file->fd);
	}
	ut64 res = r_io_seek (core->io, core->offset, R_IO_SEEK_SET);
	if (res == UT64_MAX) return;
	if (type == 0)
		type = (off&UT64_32U)? 8: 4;
	switch (type) {
	case 1:
		r_write_ble8 (buf, (ut8)(off & UT8_MAX));
		if (!r_io_write (core->io, buf, 1)) {
			cmd_write_fail ();
		} else {
			WSEEK (core, 1);
		}
		break;
	case 2:
		r_write_ble16 (buf, (ut16)(off & UT16_MAX), be);
		if (!r_io_write (core->io, buf, 2)) {
			cmd_write_fail ();
		} else {
			WSEEK (core, 2);
		}
		break;
	case 4:
		r_write_ble32 (buf, (ut32)(off & UT32_MAX), be);
		if (!r_io_write (core->io, buf, 4)) {
			cmd_write_fail ();
		} else {
			WSEEK (core, 4);
		}
		break;
	case 8:
		r_write_ble64 (buf, off, be);
		if (!r_io_write (core->io, buf, 8)) {
			cmd_write_fail ();
		} else {
			WSEEK (core, 8);
		}
		break;
	}
	r_core_block_read (core);
}
开发者ID:agatti,项目名称:radare2,代码行数:66,代码来源:cmd_write.c


示例20: cmd_project


//.........这里部分代码省略.........
					}
					free (str);
					free (data);
				}
				break;
			case 'j':
				if (!input[2]) {
					int len = 0;
					/* get base64 string */
					char *str = r_core_project_notes_file (core, fileproject);
					if (str) {
						char *data = r_file_slurp (str, &len);
						char *res = r_base64_encode_dyn (data, len);
						if (res) {
							r_cons_println (res);
							free (res);
						}
						free (data);
						free (str);
					}
				} else if (input[2] == ' ') {
					/* set base64 string */
					ut8 *data = r_base64_decode_dyn (input + 3, -1);
					if (data) {
						char *str = r_core_project_notes_file (core, fileproject);
						if (str) {
							r_file_dump (str, data, strlen ((const char *) data), 0);
							free (str);
						}
						free (data);
					}
				} else {
					eprintf ("Usage: `Pnj` or `Pnj ...`\n");
				}
				break;
			case 'x':
				r_core_project_execute_cmds (core, fileproject);
				break;
			case 0:
			{
				char *str = r_core_project_notes_file (core, fileproject);
				char *data = r_file_slurp (str, NULL);
				if (data) {
					r_cons_println (data);
					free (data);
				}
				free (str);
			}
			break;
			case '?':
			{
				const char *help_msg[] = {
					"Usage:", "Pn[j-?] [...]", "Project Notes",
					"Pn", "", "show project notes",
					"Pn", " -", "edit notes with cfg.editor",
					"Pn-", "", "delete notes",
					"Pn-", "str", "delete lines matching /str/ in notes",
					"Pnx", "", "run project note commands",
					"Pnj", "", "show notes in base64",
					"Pnj", " [base64]", "set notes in base64",
					NULL
				};
				r_core_cmd_help (core, help_msg);
			}
			break;
			}
		}
	 

鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
C++ r_core_seek函数代码示例发布时间:2022-05-30
下一篇:
C++ r_core_cmd0函数代码示例发布时间:2022-05-30
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap