mirror of https://github.com/pwndbg/pwndbg.git
fix: make mprotect command truly multi-arch (#1162)
* fix: make mprotect command truly multi-arch Added register saving based on reg_sets defined for each processor architecture, additionally shellcraft is used to generate the arch-specific shellcode. Unfortunately this command is not currently tested on platforms other than x86_64. * Update pwndbg/commands/mprotect.py Co-authored-by: Disconnect3d <dominik.b.czarnota@gmail.com> * mprotect: Add parsing, alignment to the addr argument This change makes sure that the addr argument is parsed as an gdb expression (so you can use registers for example) and aligns it to the nearest page boundary. * mprotect: Clean up register saving, print the result Cleaned up saving of registers and added printing of the results, as per disconnect's sugesstions. * Simplify the test for mprotect Simplify the code and remove the useless binary * Update tests/test_mprotect.py Co-authored-by: Disconnect3d <dominik.b.czarnota@gmail.com>pull/1296/head
parent
c50ba4612e
commit
1c06c52b47
@ -1,17 +0,0 @@
|
||||
#include <stdlib.h>
|
||||
#include <stdint.h>
|
||||
|
||||
//
|
||||
// pwnlib.asm.asm(pwnlib.shellcraft.amd64.linux.echo("mprotect_ok"), arch='amd64').hex()
|
||||
uint8_t func[] = {
|
||||
0x36, 0x38, 0x35, 0x65, 0x36, 0x65, 0x36, 0x61, 0x30, 0x31, 0x38, 0x31, 0x33, 0x34, 0x32, 0x34, 0x30, 0x31, 0x30, 0x31, 0x30, 0x31, 0x30, 0x31, 0x34, 0x38, 0x62, 0x38, 0x36, 0x64, 0x37, 0x30, 0x37, 0x32, 0x36, 0x66, 0x37, 0x34, 0x36, 0x35, 0x36, 0x33, 0x37, 0x34, 0x35, 0x30, 0x36, 0x61, 0x30, 0x31, 0x35, 0x38, 0x36, 0x61, 0x30, 0x31, 0x35, 0x66, 0x36, 0x61, 0x30, 0x62, 0x35, 0x61, 0x34, 0x38, 0x38, 0x39, 0x65, 0x36, 0x30, 0x66, 0x30, 0x35, 0x33, 0x31, 0x66, 0x66, 0x36, 0x61, 0x33, 0x63, 0x35, 0x38, 0x30, 0x66, 0x30, 0x35
|
||||
};
|
||||
|
||||
|
||||
int main() {
|
||||
|
||||
void (*f)() = (void (*)())func;
|
||||
printf("ptr = %p", f);
|
||||
// f();
|
||||
return 1;
|
||||
}
|
||||
Loading…
Reference in new issue