facebook fishhook
来源:互联网 发布:淘宝丝袜买家晒图 编辑:程序博客网 时间:2024/04/28 05:35
- #import <dlfcn.h>
- #import <UIKit/UIKit.h>
- #import "AppDelegate.h"
- #import "fishhook.h"
- static int (*orig_close)(int);
- static int (*orig_open)(const charchar *, int, ...);
- void save_original_symbols() {
- orig_close = dlsym(RTLD_DEFAULT, "close");
- orig_open = dlsym(RTLD_DEFAULT, "open");
- }
- int my_close(int fd) {
- printf("Calling real close(%d)\n", fd);
- return orig_close(fd);
- }
- int my_open(const charchar *path, int oflag, ...) {
- va_list ap = {0};
- mode_t mode = 0;
- if ((oflag & O_CREAT) != 0) {
- // mode only applies to O_CREAT
- va_start(ap, oflag);
- mode = va_arg(ap, int);
- va_end(ap);
- printf("Calling real open('%s', %d, %d)\n", path, oflag, mode);
- return orig_open(path, oflag, mode);
- } else {
- printf("Calling real open('%s', %d)\n", path, oflag);
- return orig_open(path, oflag, mode);
- }
- }
- int main(int argc, charchar * argv[])
- {
- @autoreleasepool {
- save_original_symbols();
- //fishhook用法
- rebind_symbols((struct rebinding[2]){{"close", my_close}, {"open", my_open}}, 2);
- // Open our own binary and print out first 4 bytes (which is the same
- // for all Mach-O binaries on a given architecture)
- int fd = open(argv[0], O_RDONLY);
- uint32_t magic_number = 0;
- read(fd, &magic_number, 4);
- printf("Mach-O Magic Number: %x \n", magic_number);
- close(fd);
- return UIApplicationMain(argc, argv, nil, NSStringFromClass([AppDelegate class]));
- }
- }
0 0
- facebook fishhook
- fishhook
- Fishhook
- fishhook 源码分析
- FishHook钩子库开发日志
- iOS逆向工程之fishhook
- iOS安全攻防(十七):Fishhook
- iOS安全攻防(十七):Fishhook
- iOS安全攻防(十七):Fishhook
- [模板]求解欧拉路径,欧拉回路
- 自定义控件三部曲之动画篇(四)——ValueAnimator基本使用
- CPU密集型和I/O密集型区别
- Android多线程编程之Handler篇(消息机制)
- 写于杭州的一个黄昏
- facebook fishhook
- 清空任务栈
- 浅谈iOS中MVVM的架构设计与团队协作
- 数据库触发器
- java编程自学记录(day12)
- iOS小团队创业经验分享
- Apache2.2.4 + Tomcat7集群配置
- 三步实现jQuery方式处理事件
- Centos7安装配置Apache Nutch 1.12