From 15e9b55aa8bb395041d664c5c951ddd396d8225b Mon Sep 17 00:00:00 2001 From: Curtis McEnroe Date: Thu, 6 Oct 2016 01:44:35 -0400 Subject: Define IMMED_PUSH macro in jrp --- .bin/jrp.c | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) (limited to '.bin/jrp.c') 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); -- cgit 1.4.1