diff options
author | June McEnroe <programble@gmail.com> | 2016-10-06 01:44:35 -0400 |
---|---|---|
committer | June McEnroe <programble@gmail.com> | 2016-10-06 01:44:35 -0400 |
commit | 15e9b55aa8bb395041d664c5c951ddd396d8225b (patch) | |
tree | 7036d3e1414bd40c3ca3d6048d1317c1c726483e /.bin | |
parent | Rearrange OP_PUSH so immediate is high dword in jrp (diff) | |
download | src-15e9b55aa8bb395041d664c5c951ddd396d8225b.tar.gz src-15e9b55aa8bb395041d664c5c951ddd396d8225b.zip |
Define IMMED_PUSH macro in jrp
Diffstat (limited to '')
-rwxr-xr-x | .bin/jrp.c | 8 |
1 files changed, 5 insertions, 3 deletions
diff --git a/.bin/jrp.c b/.bin/jrp.c index cd117f23..b0060386 100755 --- a/.bin/jrp.c +++ b/.bin/jrp.c @@ -34,6 +34,8 @@ enum { OP_SHR = 0x906666242cd34859, // pop rcx; shr qword [rsp], cl }; +#define IMMED_PUSH(x) ((op)(x) << 32) + int main() { int error; int page = getpagesize(); @@ -47,8 +49,8 @@ int main() { op *p = ops; *p++ = OP_PROL; - *p++ = OP_PUSH | (op)1 << 32; - *p++ = OP_PUSH | (op)2 << 32; + *p++ = OP_PUSH | IMMED_PUSH(1); + *p++ = OP_PUSH | IMMED_PUSH(2); *p++ = OP_ADD; *p++ = OP_DUP; *p++ = OP_MUL; @@ -57,7 +59,7 @@ int main() { error = mprotect(ops, page, PROT_READ | PROT_EXEC); if (error) err(EX_OSERR, "mprotect"); - fptr fn = (fptr) ops; + fptr fn = (fptr)ops; stack = fn(stack); printf("%lld\n", *stack); |