Skip to content

Instantly share code, notes, and snippets.

uint64_t offset = section->offset;
struct segment_64 *text_segment = (struct segment_64 *)text_segment_pointer;
uint64_t addr_offset = section->addr - text_segment->vm_addr;
if (section->offset != addr_offset) {
offset = addr_offset;
}
uint64_t offset = section->offset;
struct segment_32 *text_segment = (struct segment_32 *)text_segment_pointer;
uint64_t addr_offset = section->addr - text_segment->vm_addr;
@epetousis
epetousis / compile.sh
Created December 29, 2011 12:31
Tools for loading a kernel panic image into the kernel of OSX
#Instead of building everything manually, you could use this script. Just open Terminal and write chmod 755, press the space bar and then drag this file in.
DIR="$( cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd )"
cd "$DIR"
echo "Compiling load_panic_image.c"
gcc load_panic_image.c -o load_panic_image
echo "Finished compiling load_panic_image.c"
echo "Compiling panic_test.c"
gcc panic_test.c -o panic_test
echo "Finished compiling panic_test.c"
echo "Done! Newly compiled commands can be found at $DIR"
//
// KBCollectionExtensions.h
//
// Created by Guy English on 25/02/08.
// Copyright 2008 Kickingbear. All rights reserved.
//
#import <Cocoa/Cocoa.h>
/*
/*
* Dodgy POC for my CVE-2018-4150 bug - @cmwdotme
*
* Bad locking lets you use BIOCSDLT and race BIOCSBLEN to increase the length without
* increasing/reallocating the buffer.. which lets you overflow ;) Should work up to iOS 11.2.6
*
*/
#include <fcntl.h>
#include <pthread.h>
@mrtj
mrtj / TJIntegerArray.h
Last active July 18, 2018 19:47
Simple Objective C wrapper around a C integer array. Supports fast enumeration via NSNumber objects. #integer #array #objective-c License: BSD
// Author: janos.tolgyesi@gmail.com
// License: BSD
#import <Foundation/Foundation.h>
@interface TJIntegerArray : NSObject <NSFastEnumeration>
{
NSInteger* _array;
}
@aepryus
aepryus / String+AE.swift
Created March 1, 2018 00:48
Swift String Extension for accessing Characters via Int; plus conversion to C
//
// String+AE.swift
// Aepryus
//
// Created by Joe Charlier on 11/20/17.
// Copyright © 2017 Aepryus Software. All rights reserved.
//
import Foundation
@jordanekay
jordanekay / Dictionary.swift
Last active February 11, 2021 16:01
Mapping dictionaries in Swift
extension Dictionary {
public func map<T: Hashable, U>(@noescape transform: (Key, Value) -> (T, U)) -> [T: U] {
var result: [T: U] = [:]
for (key, value) in self {
let (transformedKey, transformedValue) = transform(key, value)
result[transformedKey] = transformedValue
}
return result
}
@Bogidon
Bogidon / GrowingTextView.swift
Last active February 15, 2021 20:06
A UITextView subclass that grows with its text but allows scrolling according to AutoLayout constraints. Updates intrinsicContentSize. For an animatable version see https://gist.github.com/Bogidon/632e265b784ef978d5d8c0b86858c2ee
//
// GrowingTextView.swift
// https://gist.github.com/Bogidon/cc0c9ae6f041413c39fb0ff146ad1b18
//
// Created by Bogdan Vitoc on 02/22/2017.
// Distributed under the MIT License: https://gist.github.com/Bogidon/cc0c9ae6f041413c39fb0ff146ad1b18#file-license
//
import UIKit
@dgym
dgym / comic.py
Created May 7, 2013 12:15
A comic like effect using OpenCV
import sys
import numpy
import cv2
def comic(img):
# do edge detection on a grayscale image
gray = cv2.cvtColor(img, cv2.COLOR_BGRA2GRAY)
edges = cv2.blur(gray, (3, 3)) # this blur gets rid of some noise
@cgarvey
cgarvey / pwd.php
Last active September 22, 2021 09:40
Utility PHP file to use WordPress' password utility to generate a hashed (and salted) version of a typed password. Why? So you can easily generate passwords for use in MySQL scripts / SQL command line, like resetting passwords or adding new users.
<?php
/*
Author
======
Author: Cathal Garvey.
Website: http://cgarvey.ie/
Help/Details Page: http://cgarvey.ie/blog/archive/2013/01/23/manually-generating-salted-hashed-wordpress-passwords/
Copyright