Skip to content

Instantly share code, notes, and snippets.

zhuowei

Block or report user

Report or block zhuowei

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
@zhuowei
zhuowei / bitcode2intel
Last active May 18, 2019 — forked from steventroughtonsmith/bitcode2intel
Modified version of Stroughtonsmith's bitcode2intel script; doesn't work; gives"ld: in section __TEXT,__swift5_types reloc 0: X86_64_RELOC_SUBTRACTOR must have r_extern=1 file 'F31BA3F0-12EE-482A-8399-26EEA2E654DD.o' for architecture x86_64"
View bitcode2intel
#!/bin/bash
TARGET="$( cd "$(dirname "$1")" ; pwd -P )/$1"
SYSROOT="/Applications/Xcode.app/Contents/Developer/Platforms/iPhoneSimulator.platform/Developer/SDKs/iPhoneSimulator.sdk"
TARGET_ARCH=x86_64
LLVMROOT="/Users/zhuowei/Documents/prog/clang+llvm-8.0.0-x86_64-apple-darwin"
export IPHONEOS_DEPLOYMENT_TARGET=12.2
rm -r /tmp/bitcode2intel
mkdir -p /tmp/bitcode2intel
View acpiview_qemu.txt
ACPIView output from EDK2 EFI Shell on QEMU Aarch64:
$ qemu-system-aarch64 --version
QEMU emulator version 2.11.1(Debian 1:2.11+dfsg-1ubuntu7.9)
Copyright (c) 2003-2017 Fabrice Bellard and the QEMU Project developers
$ qemu-system-aarch64 -M virt,gic-version=3 -m 1G -cpu cortex-a57 -nographic -bios workspace/Build/ArmVirtQemu-AARCH64/DEBUG_GCC5/FV/QEMU_EFI.fd
--------------- RSDP Table ---------------
Address : 0x7C020000
View nextfloat.c
#include <stdio.h>
int main() {
union {
unsigned int a;
float b;
} theunion;
theunion.a = (0x80 << 23) | 0x7fffff;
printf("%x %.30f\n", theunion.a, theunion.b);
theunion.a += 1;
View dumped.txt
bootrom.elf: file format elf64-littleriscv
SYMBOL TABLE:
0000000000010000 l d .data 0000000000000000 .data
0000000000010000 g .data 0000000000000000 _binary_bootrom_bin_start
0000000000013068 g .data 0000000000000000 _binary_bootrom_bin_end
0000000000003068 g *ABS* 0000000000000000 _binary_bootrom_bin_size
@zhuowei
zhuowei / avatars.db.dump
Created Aug 12, 2018
plutil -p - <~/Library/Developer/CoreSimulator/Devices/<device>/data/Library/Avatar/avatars.db and also a dump of that hex blob inside the first dump
View avatars.db.dump
{
"$archiver" => "NSKeyedArchiver"
"$objects" => [
0 => "$null"
1 => {
"$class" => <CFKeyedArchiverUID 0x7fb2a4c0d8d0 [0x7fffa1485af0]>{value = 12}
"domains" => <CFKeyedArchiverUID 0x7fb2a4c0d890 [0x7fffa1485af0]>{value = 2}
"records" => <CFKeyedArchiverUID 0x7fb2a4c0d8b0 [0x7fffa1485af0]>{value = 8}
}
2 => {
View crash.swift
// crashes Xcode 10 beta 4.
// the last line is supposed to error, not trigger a compiler segfault
import Foundation
import ObjectiveC
typealias BundleForClass_Type = @convention(c) (AnyClass, Selector, AnyClass) -> Bundle
private func AVTUIEnvironment_storeLocation_hook(bundleClass: AnyClass, selector: Selector) -> NSURL {
abort()
}
@zhuowei
zhuowei / treesort_nestedfunctions.py
Created Jul 24, 2018
Tree sort using a closure to hold tree nodes
View treesort_nestedfunctions.py
#!/usr/bin/env python3
# https://en.wikipedia.org/wiki/Tree_sort#Example
opRead = 0
opWrite = 1
varVal = 0
varLeft = 1
varRight = 2
# learned this was possible from https://aphyr.com/posts/340-reversing-the-technical-interview
@zhuowei
zhuowei / serialout
Created Jul 21, 2018
iOS 12b4 kernel in QEMU. It works!
View serialout
iBoot version:
corecrypto_kext_start called
FIPSPOST_KEXT [64144875] fipspost_post:156: PASSED: (4 ms) - fipspost_post_integrity
FIPSPOST_KEXT [64366750] fipspost_post:162: PASSED: (1 ms) - fipspost_post_hmac
FIPSPOST_KEXT [64504187] fipspost_post:163: PASSED: (0 ms) - fipspost_post_aes_ecb
FIPSPOST_KEXT [64659750] fipspost_post:164: PASSED: (0 ms) - fipspost_post_aes_cbc
FIPSPOST_KEXT [72129500] fipspost_post:165: PASSED: (117 ms) - fipspost_post_rsa_sig
FIPSPOST_KEXT [76481625] fipspost_post:166: PASSED: (67 ms) - fipspost_post_ecdsa
FIPSPOST_KEXT [77264187] fipspost_post:167: PASSED: (11 ms) - fipspost_post_ecdh
View gist:907ed33729d0bf7a30425f49f2dbec1e
$ /Applications/Xcode-beta.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/ld -o why -iosmac_version_min 12.0 why.o
ld: warning: Auto-Linking library not found for -lswiftCore
ld: warning: Auto-Linking library not found for -lswiftSwiftOnoneSupport
$ /Applications/Xcode-beta.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/otool -l why
why:
Mach header
magic cputype cpusubtype caps filetype ncmds sizeofcmds flags
0xfeedfacf 16777223 3 0x00 2 14 920 0x00000085
Load command 0
cmd LC_SEGMENT_64
View iosmac.txt
$ grep -r iosmac .
Binary file ./Developer/Platforms/AppleTVOS.platform/Developer/Library/CoreSimulator/Profiles/Runtimes/tvOS.simruntime/Contents/Resources/RuntimeRoot/System/Library/PrivateFrameworks/UIKitCore.framework/UIKitCore matches
Binary file ./Developer/Platforms/AppleTVOS.platform/Developer/Library/CoreSimulator/Profiles/Runtimes/tvOS.simruntime/Contents/Resources/RuntimeRoot/System/Library/PrivateFrameworks/RemoteTextInput.framework/RemoteTextInput matches
Binary file ./Developer/Platforms/iPhoneOS.platform/Developer/Library/CoreSimulator/Profiles/Runtimes/iOS.simruntime/Contents/Resources/RuntimeRoot/System/Library/PrivateFrameworks/RemoteTextInput.framework/RemoteTextInput matches
Binary file ./Developer/Platforms/iPhoneOS.platform/Developer/Library/CoreSimulator/Profiles/Runtimes/iOS.simruntime/Contents/Resources/RuntimeRoot/Applications/News.app/News matches
Binary file ./Developer/Platforms/WatchOS.platform/Developer/Library/CoreSimulator/Profiles/Runtimes/watchOS.simruntime/Contents/Resource
You can’t perform that action at this time.