Skip to content

Instantly share code, notes, and snippets.

View pwnee's full-sized avatar

pwnee

View GitHub Profile
@enigmaticape
enigmaticape / part1.m
Created November 14, 2012 19:59
You want to use NSObject performSelector with multiple parameters, but you can't ? (1)
- ( id ) methodWithOneParam:( id ) theParam {
// Do amazing stuff
return @"Srsly, Amazing!";
}
- ( id ) methodWithFirst:( id ) firstParam
andSecond:( id ) secondParam
{
// Do doubly amazing stuff
@Coneko
Coneko / gist:4234842
Created December 7, 2012 17:24
How to get your code to run on different cores in OSX / iOS without CHUD.
#import <pthread.h>
#import <mach/thread_act.h>
// These two functions are declared in mach/thread_policy.h, but are commented out.
// They are documented here: https://developer.apple.com/library/mac/#releasenotes/Performance/RN-AffinityAPI/_index.html
kern_return_t thread_policy_set(
thread_t thread,
thread_policy_flavor_t flavor,
thread_policy_t policy_info,
mach_msg_type_number_t count);
@yrp604
yrp604 / xnu-syscall-life-amd64.md
Last active October 2, 2023 15:59
The life of an XNU unix syscall on amd64

XNU syscall path

Chart

             +------------------+
             |These push their  |                                  +-----------------------+
             |respective syscall|                                  |This overwrites the    |
             |dispatch functions|                                  |saved dispatch function|
             |onto the stack    |                                  |with hndl_alltraps     |
@ryo
ryo / aarch64-cond.txt
Created February 15, 2018 05:16
aarch64 condition code cheat sheet
meaning cmp A, B sign flags
------------------------------- ------- --------------- --------------- -------------------
equal eq A == B - Z == 1
not equal ne A != B - Z == 0
carry set cs,hs A >= B unsigned C == 1
carry clear cc,lo A < B unsigned C == 0
higher hi A > B unsigned C == 1 && Z == 0
lower or same ls A <= B unsigned !(C == 1 && Z == 0)
@PsychoTea
PsychoTea / PanicParser.py
Last active February 26, 2024 01:43
Parses an iOS .ips panic log and gives useful stack trace output
import sys
import json
import re
kslide = 0x0
if len(sys.argv) < 2:
print("Usage: PanicParser.py [file path]")
exit()
@fay59
fay59 / Quirks of C.md
Last active January 23, 2024 04:24
Quirks of C

Here's a list of mildly interesting things about the C language that I learned mostly by consuming Clang's ASTs. Although surprises are getting sparser, I might continue to update this document over time.

There are many more mildly interesting features of C++, but the language is literally known for being weird, whereas C is usually considered smaller and simpler, so this is (almost) only about C.

1. Combined type and variable/field declaration, inside a struct scope [https://godbolt.org/g/Rh94Go]

struct foo {
   struct bar {
 int x;
@stefanesser
stefanesser / BHEU.markdown
Last active July 8, 2024 08:41
BlackHat EU - Wrong information in Talk "Eternal War in XNU Kernel Objects"

It has come to my attention that BlackHat EU had talks from Alibaba Security about iOS security topics. It seems to be from the same people that have previously presented at DEFCON. Back then I had publicly discussed how their talk is basically just a summary of other people's work that is heavily miscredited to the wrong people.

Considering this history it is surprising that BlackHat would allow the same people to give a talk again on iOS security topics. But I have given up a long time ago on the BlackHat review board and their decisions, which is one of the reasons why I have stopped submitting to them years ago.

But I am digressing from the actual reason for this GIST. And no it is not about the fact that the talk once again starts with summarizing other people's work and crediting the wrong parties for the work done. In this GIST I want to go over one of the slides from the "summary part" of the talk, because not a single item on that slide is correct information.

So here is the offending slide:

![Fr

@htr3n
htr3n / macos-ramdisk.md
Last active July 26, 2024 18:20
Creating RAM disk in macOS

Built-in

diskutil erasevolume HFS+ 'RAM Disk' `hdiutil attach -nobrowse -nomount ram://XXXXX`

where XXXXX is the size of the RAM disk in terms of memory blocks.

Notes:

@andrewpetrochenkov
andrewpetrochenkov / defaults.sh
Last active February 24, 2023 17:58
macOS security
#!/usr/bin/env bash
# Disable Face Detect in Photos app
defaults write com.apple.iPhoto PKFaceDetectionEnabled 0
defaults write com.apple.gamed Disabled -bool true
defaults write com.apple.NetworkBrowser DisableAirDrop -bool YES # log out, log in
@jmpews
jmpews / IOSurfaceDig.md
Last active April 1, 2023 09:05
reversing IOSurface kext and framework

xnu libkern c++ 初始化.

先初始化 metavtable

OSMetaClass *IOSurface_InitFunc_7()
{
  OSMetaClass *result; // x0

  result = OSMetaClass::OSMetaClass(