Skip to content

Instantly share code, notes, and snippets.

View ytlvy's full-sized avatar

Yt ytlvy

View GitHub Profile
@ytlvy
ytlvy / processInfo.m
Created October 7, 2015 09:44
OS X获取当前运行的所有进程信息
//
// main.m
// process
//
// Created by piao on 15/8/13.
// Copyright (c) 2015年 piao. All rights reserved.
//
#import <Foundation/Foundation.h>
#import <sys/sysctl.h>
@ytlvy
ytlvy / theos_64
Created October 7, 2015 10:50
theos 支持arm64的标准makefile写法
ARCHS = armv7 armv7s arm64
TARGET = iphone:8.4:7.0
#TARGET = iPhone:latest:7.0
#ARCHS这些定义一定要放到include之上
include theos/makefiles/common.mk
TWEAK_NAME = test
test_FILES = Tweak.xm
test_FRAMEWORKS = UIKit
@ytlvy
ytlvy / 0_reuse_code.js
Created October 7, 2015 11:06
Here are some things you can do with Gists in GistBox.
// Use Gists to store code you would like to remember later on
console.log(window); // log the "window" object to the console
@ytlvy
ytlvy / xnu 内存读写模块
Last active October 8, 2015 13:53
xnu 内存读写模块
#include <mach/host_info.h>
#include <mach/mach_host.h>
#include <mach/shared_region.h>
#include <mach/mach.h>
#include <mach-o/dyld.h>
#include <stdlib.h>
#include <stdio.h>
#import <dlfcn.h>
@ytlvy
ytlvy / parameter_dig.m
Created October 7, 2015 11:24
armv7、arm64传参研究
////////////////////////////////////////////////////////////////////////
/// armv7传参研究
////////////////////////////////////////////////////////////////////////
//---------------------------------------------------------------------
int func(int a, int b, int c, int d, int e, int f)
{
int ret = a + b + c + d + e + f;
return ret;
}
_func:
@ytlvy
ytlvy / checkArch.m
Created October 7, 2015 12:48
__arm64__ 、__arm__宏判断平台架构
// 参考官方判断方法:http://www.opensource.apple.com/source/cctools/cctools-870/include/mach/arm/thread_status.h
void checkArch(){
#if defined (__arm64__)/* || defined (__aarch64__) */
printf("[PiaoYun]running 64-bit [__arm64__ arch]\n");
#elif defined(__arm64__)
printf("[PiaoYun]runing 32-bit [__arm__ arch]\n");
#else
#error [PiaoYun]Unknown arch
#endif
}
@ytlvy
ytlvy / getLR
Created October 7, 2015 12:57
iOS裸函数应用实战
//
// main.c
// iOS_ARM
//
// Created by piao on 15/7/21.
// Copyright (c) 2015年 __MyCompanyName__. All rights reserved.
//
#if defined (__arm64__) /*|| defined (__aarch64__)*/
@ytlvy
ytlvy / getRsp
Created October 7, 2015 13:01
OSX裸函数应用实战
//
// main.m
// debug
//
// Created by piao on 15/7/20.
// Copyright (c) 2015年 piao. All rights reserved.
//
#import <Foundation/Foundation.h>
@ytlvy
ytlvy / DYLD_INTERPOSE
Created October 7, 2015 13:06
利用 DYLD_INTERPOSE 宏 完成OS X系统函数hook
// 演示代码
// #import <mach-o/dyld-interposing.h>
// from dyld-interposing.h
#define DYLD_INTERPOSE(_replacement,_replacee) __attribute__((used)) static struct{ const void* replacement; const void* replacee; } _interpose_##_replacee __attribute__ ((section ("__DATA,__interpose"))) = { (const void*)(unsigned long)&_replacement, (const void*)(unsigned long)&_replacee };
ssize_t hacked_write(int fildes, const void *buf, size_t nbyte)
{
printf("[++++]into hacked_write---by piaoyun");
return write(fildes, buf, nbyte);
}
@ytlvy
ytlvy / UIButton+Extensions.h
Created November 11, 2015 06:16 — forked from 123nobody/UIButton+Extensions.h
Making UIButton's hit area larger than the default hit area
@interface UIButton (Extensions)
@property(nonatomic, assign) UIEdgeInsets hitTestEdgeInsets;
@end