Skip to content

Instantly share code, notes, and snippets.

Brandon Azad bazad

Block or report user

Report or block bazad

Hide content and notifications from this user.

Learn more about blocking users

Contact Support about this user’s behavior.

Learn more about reporting abuse

Report abuse
View GitHub Profile
@bazad
bazad / vmmap.c
Created Nov 8, 2019
A simple vmmap implementation for macOS.
View vmmap.c
// Brandon Azad
#include <assert.h>
#include <errno.h>
#include <libproc.h>
#include <mach/mach.h>
#include <mach/mach_vm.h>
#include <stdbool.h>
#include <stdio.h>
#include <stdlib.h>
@bazad
bazad / build-xnu-4903.241.1.sh
Created Sep 13, 2019
A script to build XNU version 4903.241.1 (macOS High Sierra 10.14.3) on macOS 10.14.6 with Xcode 9.4.1.
View build-xnu-4903.241.1.sh
#! /bin/bash
#
# build-xnu-4903.241.1.sh
# Brandon Azad
#
# A script showing how to build XNU version 4903.241.1 (which corresponds to
# macOS 10.14.3) on macOS High Sierra 10.14.6 with Xcode 9.4.1.
#
# Note: This process will OVERWRITE files in Xcode's MacOSX10.13.sdk. Make a
# backup of this directory first!
@bazad
bazad / if_value.h
Created Sep 11, 2019
A C preprocessor macro to test whether a macro parameter has a value.
View if_value.h
//
// if_value.h
// Brandon Azad
//
// Public domain
//
#ifndef IF_VALUE
/*
@bazad
bazad / A12-page-table-walk.c
Created May 17, 2019
A C implementation of a simple page table walk on A12 devices (iOS 12.1.2).
View A12-page-table-walk.c
uint64_t
aarch64_page_table_lookup(uint64_t ttbr, uint64_t vaddr,
uint64_t *l1_tte_, uint64_t *l2_tte_, uint64_t *l3_tte_) {
const uint64_t pg_bits = 14;
const uint64_t l1_size = 3;
const uint64_t l2_size = 11;
const uint64_t l3_size = 11;
const uint64_t tte_physaddr_mask = ((1uLL << 40) - 1) & ~((1 << pg_bits) - 1);
uint64_t l1_index = (vaddr >> (l2_size + l3_size + pg_bits)) & ((1 << l1_size) - 1);
uint64_t l2_index = (vaddr >> (l3_size + pg_bits)) & ((1 << l2_size) - 1);
@bazad
bazad / build-xnu-4903.221.2.sh
Created Jan 28, 2019
A script to build XNU version 4903.221.2 (macOS High Sierra 10.14.1) on macOS 10.14.1 with Xcode 9.4.1.
View build-xnu-4903.221.2.sh
#! /bin/bash
#
# build-xnu-4903.221.2.sh
# Brandon Azad
#
# A script showing how to build XNU version 4903.221.2 (which corresponds to
# macOS 10.14.1) on macOS High Sierra 10.14.1 with Xcode 9.4.1.
#
# Note: This process will OVERWRITE files in Xcode's MacOSX10.13.sdk. Make a
# backup of this directory first!
@bazad
bazad / build-xnu-4570.61.1.sh
Created Nov 13, 2018
A script to build XNU version 4570.61.1 (macOS High Sierra 10.13.5) on macOS 10.13.5 with Xcode 9.4.
View build-xnu-4570.61.1.sh
#! /bin/bash
#
# build-xnu-4570.61.1.sh
# Brandon Azad
#
# A script showing how to build XNU version 4570.61.1 (which corresponds to
# macOS 10.13.5) on macOS High Sierra 10.13.5 with Xcode 9.4.
#
# Note: This process will OVERWRITE files in Xcode's MacOSX10.13.sdk. Make a
# backup of this directory first!
@bazad
bazad / build-xnu-4570.71.2.sh
Created Nov 8, 2018
A script to build XNU version 4570.71.2 (macOS High Sierra 10.13.6) on macOS 10.13.6 with Xcode 9.4.1.
View build-xnu-4570.71.2.sh
#! /bin/bash
#
# build-xnu-4570.71.2.sh
# Brandon Azad
#
# A script showing how to build XNU version 4570.71.2 (which corresponds to
# macOS 10.13.6) on macOS High Sierra 10.13.6 with Xcode 9.4.1.
#
# Note: This process will OVERWRITE files in Xcode's MacOSX10.13.sdk. Make a
# backup of this directory first!
@bazad
bazad / ios-12-kernelcache-tagged-pointers.py
Created Jun 20, 2018
Working with the new iOS 12 kernelcache's tagged pointers in IDA.
View ios-12-kernelcache-tagged-pointers.py
#
# ios-12-kernelcache-tagged-pointers.py
# Brandon Azad
#
# An idapython script that shows how to work with the new tagged pointers in the iOS 12
# kernelcache.
#
import idc
import idaapi
@bazad
bazad / build-xnu-4570.41.2.sh
Created Jun 12, 2018
A script to build XNU version 4570.41.2 (macOS High Sierra 10.13.3) on macOS 10.13.5 with Xcode 9.4.
View build-xnu-4570.41.2.sh
#! /bin/bash
#
# build-xnu-4570.41.2.sh
# Brandon Azad
#
# A script showing how to build XNU version 4570.41.2 on macOS High Sierra
# 10.13.5 with Xcode 9.4.
#
# Note: This process will OVERWRITE files in Xcode's MacOSX10.13.sdk. Make a
# backup of this directory first!
@bazad
bazad / git-xnu.sh
Last active Sep 12, 2019
A script to create a git repository for Apple's XNU kernel source.
View git-xnu.sh
#! /bin/bash
#
# git-xnu.sh
# Brandon Azad
#
# A script to download Apple's XNU kernel source code and create a git
# repository.
#
XNU_DIR="xnu"
You can’t perform that action at this time.