View exc
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#include <stdio.h> | |
#include <stdlib.h> | |
#include <sys/types.h> | |
#include <unistd.h> | |
#include <spawn.h> | |
#include <sys/wait.h> | |
#ifndef _POSIX_SPAWN_DISABLE_ASLR | |
#define _POSIX_SPAWN_DISABLE_ASLR 0x0100 | |
#endif |
View machdemo
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/* | |
Copyright (c) 2003, Brian Alliet. All rights reserved. | |
Redistribution and use in source and binary forms, with or without | |
modification, are permitted provided that the following conditions are met: | |
1. Redistributions of source code must retain the above copyright notice, | |
this list of conditions and the following disclaimer. | |
2. Redistributions in binary form must reproduce the above copyright notice, |
View machdemo32
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/* | |
Copyright (c) 2003, Brian Alliet. All rights reserved. | |
Redistribution and use in source and binary forms, with or without | |
modification, are permitted provided that the following conditions are met: | |
1. Redistributions of source code must retain the above copyright notice, | |
this list of conditions and the following disclaimer. | |
2. Redistributions in binary form must reproduce the above copyright notice, |
View machdemo64
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/* | |
Copyright (c) 2003, Brian Alliet. All rights reserved. | |
Redistribution and use in source and binary forms, with or without | |
modification, are permitted provided that the following conditions are met: | |
1. Redistributions of source code must retain the above copyright notice, | |
this list of conditions and the following disclaimer. | |
2. Redistributions in binary form must reproduce the above copyright notice, |
View gist:5877105
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#include <stdio.h> | |
#include <stdlib.h> | |
#include <unistd.h> | |
#include <string> | |
#include <grp.h> | |
#include <sys/user.h> | |
#include <assert.h> | |
// mach | |
#include <mach/mach.h> | |
#include <mach/mach_init.h> |
View gist:5876878
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
mach_port_t install_debug_port(void) { | |
mach_port_t *exceptionPort = (mach_port_t *) malloc(sizeof(mach_port_t)); | |
mach_port_t me; | |
exception_mask_t mask = EXC_MASK_BAD_ACCESS | EXC_MASK_BAD_INSTRUCTION | EXC_MASK_ARITHMETIC | EXC_MASK_SOFTWARE | EXC_MASK_BREAKPOINT | EXC_MASK_SYSCALL; | |
// Create a port by allocating a receive right, and then create a send right | |
// accessible under the same name. | |
me = mach_task_self(); | |
mach_assert("mach_port_allocate()", mach_port_allocate(me, MACH_PORT_RIGHT_RECEIVE, exceptionPort)); | |
mach_assert("mach_port_insert_right()", mach_port_insert_right(me, *exceptionPort, *exceptionPort, MACH_MSG_TYPE_MAKE_SEND)); |
View gist:5876556
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
void mach_msg_server(mach_port_t exception_port) { | |
mach_msg_return_t r; | |
r = mach_msg(&msg.head, MACH_RCV_MSG|MACH_RCV_LARGE|MACH_RCV_TIMEOUT, 0, sizeof(msg), exception_port, 0, MACH_PORT_NULL); | |
assert(r != MACH_RCV_TIMED_OUT); | |
assert (r == MACH_MSG_SUCCESS); | |
mach_exc_server(&msg.head, &reply.head); | |
r = mach_msg(&reply.head, MACH_SEND_MSG|MACH_SEND_TIMEOUT, reply.head.msgh_size, 0, MACH_PORT_NULL, 0 ,MACH_PORT_NULL); |
View gist:5868699
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
int SetBreakPoint(uint64_t Address) { | |
BPID++; | |
Breakpoint B; | |
B.ID = BPID; | |
B.address = Address; | |
B.active = true; | |
B.max_hits = -1; | |
B.description = ""; | |
B.BP_Inst = REGULAR; |
View uuencoded ls binary
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
begin 555 /dev/stdout | |
MROZZO@````(!```'@````P``$````)J@````#`````<````#``"P````BW`` | |
M```,```````````````````````````````````````````````````````` | |
M```````````````````````````````````````````````````````````` | |
M```````````````````````````````````````````````````````````` | |
M```````````````````````````````````````````````````````````` | |
M```````````````````````````````````````````````````````````` | |
M```````````````````````````````````````````````````````````` | |
M```````````````````````````````````````````````````````````` | |
M```````````````````````````````````````````````````````````` |
View main.c
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#include <iostream> | |
#include <math.h> | |
#include <mach-o/loader.h> | |
#include <mach-o/nlist.h> | |
#include <mach-o/fat.h> | |