120
120
COMMAND('x', 0, "show xrefs of the current offset", xrefs_here),
121
121
COMMAND('i', 0, "insert mode (tab to change hex,asm,ascii, q to back)", insert),
122
122
COMMAND('I', 0, "invert current block", invert),
123
COMMAND('_', 0, "set block size", setblocksize),
123
//COMMAND('_', 0, "set block size", setblocksize),
124
124
COMMAND('z', 0, "zoom full/block with pO", zoom),
125
125
COMMAND('Z', 0, "resets zoom preferences", zoom_reset),
126
126
COMMAND('w', 1, "write hex string", insert_hexa_string),
137
137
void visual_show_help()
139
int fus = cons_flushable;
139
141
cons_strcat("\x1b[2J\x1b[0;0H\n");
141
143
cons_printf("Visual keybindings:\n");
144
":<cmd> radare command (vi like)\n"
145
"; edit or add comment\n"
146
"\" change metadata of current cursor seek\n"
147
",. ',' marks an offset, '.' seeks to mark or eip if no mark\n"
148
"m' m1 -> mark current position as char '1'. '1 will jump to mark 1\n"
149
"g,G seek to beggining or end of file\n"
150
"+-*/ +1, -1, +width, -width -> block size\n"
151
"<> seek block aligned (cursor mode = folder code)\n"
152
"[] adjust screen width\n"
153
"a,A,= insert patch assembly, rsc asm or !hack\n"
154
"i insert mode (tab to switch btw hex,asm,ascii, 'q' to normal)\n"
155
"f,F seek between flag list (f = forward, F = backward)\n"
156
"n,N seek between hits of the hit0 search\n"
157
"t visual track/browse flagspaces and flags\n"
158
"e visual eval configuration variables\n"
159
"C toggle scr.color\n"
160
"d convert cursor selected bytes to ascii, code or hex\n"
161
// "b[k][cmd] binds key 'k' to the specified command\n"
162
"m applies rfile magic on this block\n" // ???
163
"I invert block (same as pIx or so)\n"
164
"y,Y yank and Yankee aliases for copy and paste\n"
165
"f,F go next, previous flag (cursor mode to add/remove)\n"
166
"h,j,k,l scroll view to left, down, up, right.\n"
167
"J,K up down scroll one block.\n"
168
"H,L scroll left, right by 2 bytes (16 bits).\n"
169
"p,P switch between hex, bin and string formats\n"
170
"x show xrefs of the current offset\n"
171
"w write hexpair bytes in cursor\n"
172
"q exits visual mode\n");
146
" :<cmd> radare command (vi like)\n"
147
" ; edit or add comment\n"
148
" \" change metadata of current cursor seek\n"
149
" ,. ',' marks an offset, '.' seeks to mark or eip if no mark\n"
150
" m' m1 -> mark current position as char '1'. '1 will jump to mark 1\n"
151
" g,G seek to beggining or end of file\n"
152
" +-*/ +1, -1, +width, -width -> block size\n"
153
" <> seek block aligned (cursor mode = folder code)\n"
154
" []{}() adjust screen width, move horitzontally and vertically\n"
155
" a,A,= insert patch assembly, rsc asm or !hack\n"
156
" i insert mode (tab to switch btw hex,asm,ascii, 'q' to normal)\n"
157
" f,F seek between flag list (f = forward, F = backward)\n"
158
" n,N seek between hits of the hit0 search\n"
159
" t visual track/browse flagspaces and flags\n"
160
" e visual eval configuration variables\n"
161
" C toggle scr.color\n"
162
" d convert cursor selected bytes to ascii, code or hex\n"
163
// " b[k][cmd] binds key 'k' to the specified command\n"
164
" m,' ma, 'a, will mark current seek as 'a' and 'a will jump there\n"
165
" I invert block (same as pIx or so)\n"
166
" y,Y yank and Yankee aliases for copy and paste\n"
167
" f,F go next, previous flag (cursor mode to add/remove)\n"
168
" h,j,k,l scroll view to left, down, up, right.\n"
169
" J,K up down scroll one block.\n"
170
" H,L scroll left, right by 2 bytes (16 bits).\n"
171
" p,P switch between hex, bin and string formats\n"
172
" x show xrefs of the current offset\n"
173
" w write hexpair bytes in cursor\n"
174
" q exits visual mode\n");
174
176
cons_printf("\nCursor mode:\n");
177
"c toggle cursor mode\n"
178
"hjkl move cursor (also arrows)\n"
179
"HJKL select bytes (shift+arrows)\n"
180
"f/F set/unset flag at cursor\n");
179
" c toggle cursor mode\n"
180
" hjkl move cursor (also arrows)\n"
181
" HJKL select bytes (shift+arrows)\n"
182
" f/F set/unset flag at cursor\n");
181
183
if (config.debug) {
183
185
cons_printf("\nDebugger keybindings:\n");
186
"! show debugger commands help\n"
188
"F2 set breakpoint (execute)\n"
189
"F3 set watchpoint (read)\n"
190
"F4 continue until cursor or here (for loops)\n"
191
"F6 continue until syscall (!contsc)\n"
192
"F7 step in debugger user code (!step)\n"
193
"F8 step over in debugger (!stepo)\n"
194
"F9 continue execution (!cont)\n"
195
"F10 continue until user code (!contu)\n"
188
" ! show debugger commands help\n"
189
" F1 commands help\n"
190
" F2 set breakpoint (execute)\n"
191
" F3 set watchpoint (read)\n"
192
" F4 continue until cursor or here (for loops)\n"
193
" F6 continue until syscall (!contsc)\n"
194
" F7 F8 !step and !stepover\n"
195
" F9 continue execution (!cont)\n"
196
" F10 continue until user code (!contu)\n"
200
cons_flushable = fus;
201
204
CMD_DECL(visual_bind_run)
423
427
cmd_yank_paste(input);
431
yank_buffer = slurp(input+2, &yank_buffer_size);
432
eprintf("Yanking %d bytes into the clipboard from '%s'\n",
433
yank_buffer_size, input+2);
434
//radare_cmd("yi", 0);
426
radare_move(input+1);
442
/* ytf -> yank to file */
443
if (input[2]!= ' ') {
444
eprintf("Usage: ytf [file]\n");
445
} else file_dump(input+3, yank_buffer, yank_buffer_size);
448
/* ytf -> yank to file */
452
radare_move(input+1);
455
eprintf("Unknown yt subcommand. try y?\n");
459
cons_printf("buffer=");
460
for(i=0;i<yank_buffer_size;i++) {
461
cons_printf("%02x", yank_buffer[i]);
463
cons_printf("\nsize=%d\n", yank_buffer_size);
429
466
if (ptr[0]=='?') {
430
eprintf("Usage: y[ft] [length]\n");
431
eprintf(" > y 10 @ eip ; yanks 10 bytes from eip\n");
432
eprintf(" > yy @ edi ; write these bytes where edi points\n");
433
eprintf(" > yt [len] dst ; copy N bytes from here to dst\n");
467
eprintf("Usage: y[ft] [length]\n"
468
" > y 10 @ eip ; yanks 10 bytes from eip\n"
469
" > yi ; show information about the yanked data\n"
470
" > yy @ edi ; write these bytes where edi points\n"
471
" > yt [len] dst ; copy N bytes from here to dst\n"
472
" > yf file ; yank file into clipboard\n"
473
" > ytf file ; paste clipboard buffer to file\n");
474
//" > yF/ytF file ; yank file hexpairs into clipboard (TODO)\n");
437
477
free(yank_buffer);
438
478
yank_buffer_size = get_math(ptr);
439
479
if (yank_buffer_size > config.block_size || yank_buffer_size == 0)