@@ -68,25 +68,22 @@ static BOOL shelldev_command_shellcode(shell_t* sh, std::vector<std::string> par
6868 return TRUE ;
6969}
7070
71- static BOOL shelldev_command_peb (shell_t * sh, std::vector<std::string> parts)
71+ static BOOL shelldev_command_peb (shell_t * sh, std::vector<std::string> parts, std::vector< asm_t >* assemblies )
7272{
73+ std::string instructions;
7374#ifdef _M_X64
7475 // xor eax, eax
7576 // mov rax, gs:[eax+0x60]
76- unsigned char bytes[] = { 0x31 , 0xc0 , 0x65 , 0x48 , 0x8b , 0x40 , 0x60 };
77+ // unsigned char bytes[] = { 0x31, 0xc0, 0x65, 0x48, 0x8b, 0x40, 0x60 };
78+ instructions = " xor eax, eax;mov rax, gs:[eax+0x60]" ;
7779#elif defined(_M_IX86)
7880 // xor eax, eax
7981 // mov eax, fs:[eax+0x30]
80- unsigned char bytes[] = { 0x31 , 0xC0 , 0x64 , 0x8B , 0x40 , 0x30 };
82+ // unsigned char bytes[] = { 0x31, 0xC0, 0x64, 0x8B, 0x40, 0x30 };
83+ instructions = " xor eax, eax;mov eax, fs:[eax+0x30]" ;
8184#endif
82- if (!shelldev_write_shellcode (sh, bytes, sizeof (bytes)))
83- {
84- shelldev_print_errors (" Unable to allocate shellcode!" );
85- return TRUE ;
86- }
8785
88- shelldev_debug_shellcode (sh);
89- shelldev_print_registers (sh);
86+ shelldev_run_shellcode (sh, instructions, assemblies);
9087
9188 return TRUE ;
9289}
@@ -465,7 +462,7 @@ BOOL shelldev_run_command(shell_t* sh, std::string command, std::vector<asm_t>*
465462 else if (mainCmd == " .shellcode" )
466463 return shelldev_command_shellcode (sh, parts);
467464 else if (mainCmd == " .peb" )
468- return shelldev_command_peb (sh, parts);
465+ return shelldev_command_peb (sh, parts, assemblies );
469466 else if (mainCmd == " .quit" || mainCmd == " .exit" )
470467 ExitProcess (0 );
471468 else
0 commit comments