11#include " repl.h"
22#include " color.hpp"
33
4- BOOL axor;
4+ void shelldev_print_assembly (unsigned char * encode, size_t size)
5+ {
6+ printf (" assembled (%zu bytes): " , size);
7+
8+ for (size_t i = 0 ; i < size; ++i)
9+ if (encode[i] == 0x0 )
10+ std::cout << std::hex << dye::light_red (" 0x" ) << dye::light_red (static_cast <int >(encode[i])) << " " ;
11+ else
12+ std::cout << std::hex << " 0x" << static_cast <int >(encode[i]) << " " ;
13+
14+ printf (" \n " );
15+ }
516
617static BOOL shelldev_command_kernel32 (shell_t * sh, std::vector<std::string> parts)
718{
@@ -354,19 +365,29 @@ static BOOL shelldev_toshell(std::vector<asm_t>* assemblies, std::vector<std::st
354365 return TRUE ;
355366}
356367
368+ static BOOL shelldev_command_delete (shell_t * sh, std::vector<asm_t >* assemblies, std::vector<std::string> parts)
369+ {
370+ assemblies->erase (assemblies->begin () + std::stoi (parts[0 ]));
371+
372+ shelldev_run_shellcode (sh, assemblies);
373+
374+ return TRUE ;
375+ }
376+
377+
357378static BOOL winrepl_command_help ()
358379{
359380 std::cout << " .help\t\t\t Show this help screen." << std::endl;
360381 std::cout << " .registers\t\t Show more detailed register info." << std::endl;
361382 std::cout << " .list\t\t\t Show list of previously executed assembly instructions." << std::endl;
362383 std::cout << " .edit line\t\t Edit specified line in list." << std::endl;
363- std::cout << " .toshell format \t\t Convert list to selected shellcode format. Available formats: c " << std::endl;
384+ std::cout << " .del line \t\t Delete specified line from list. " << std::endl;
364385 std::cout << " .read addr size\t\t Read from a memory address." << std::endl;
365386 std::cout << " .write addr hexdata\t Write to a memory address." << std::endl;
387+ std::cout << " .toshell format\t\t Convert list to selected shellcode format. Available formats: c" << std::endl;
366388 std::cout << " .allocate size\t\t Allocate a memory buffer." << std::endl;
367389 std::cout << " .loadlibrary path\t Load a DLL into the process." << std::endl;
368390 std::cout << " .kernel32 func\t\t Get address of a kernel32 export." << std::endl;
369- // std::cout << ".dep [0/1]\t\tEnable or disable NX-bit." << std::endl;
370391 std::cout << " .shellcode hexdata\t Execute raw shellcode." << std::endl;
371392 std::cout << " .peb\t\t\t Loads PEB into accumulator." << std::endl;
372393 std::cout << " .reset\t\t\t Start a new environment." << std::endl;
@@ -392,6 +413,8 @@ BOOL shelldev_run_command(shell_t* sh, std::string command, std::vector<asm_t>*
392413 return shelldev_toshell (assemblies, parts);
393414 else if (mainCmd == " .read" )
394415 return shelldev_command_read (sh, parts);
416+ else if (mainCmd == " .del" )
417+ return shelldev_command_delete (sh, assemblies, parts);
395418 else if (mainCmd == " .write" )
396419 return shelldev_command_write (sh, parts);
397420 else if (mainCmd == " .allocate" )
0 commit comments