IOS Theos Tweak 之 HelloWorld

一、目标

Theos是什么?

是一套跨平台的开发工具套件,不仅可以开发Ios,Mac、Windows和Linux也可以的哦,开源免费。

Tweak是什么?

可以理解成动态链接库,有搞过Windows下dll注入的同学应该可以秒懂了。Android的同学可以把它理解成IOS下的Xposed。

HelloWorld是什么?

是萌新程序员的信仰,在一个平台写下HelloWorld,证明我来了。

二、步骤

Mac下安装Theos

1、检测是否有 /opt目录,没有就新建一个

# 先切换到root权限
sudo su
cd /
mkdir opt
cd /opt 

2、 在新建的/opt目录下clone项目源码

git clone --recursive https://github.com/theos/theos.git 

3、打开 ~/.bash_profile文件,添加以下四行

# theos
export THEOS=/opt/theos
export PATH=$THEOS/bin:$PATH
# iPhone手机的ssh地址
export THEOS_DEVICE_IP=localhost
export THEOS_DEVICE_PORT=2222 

4、按照 之前的 Ios逆向环境搭建 (一) 配置好 SSH。

是的就这样就够了。 (可能还需要 ldid 和 dpkg-deb,用brew装下)

HelloWorld

开始创建一个 Tweak模板

# 创建模板命令 nic.pl 类似新建一个空工程
nic.pl
------------------------------[1.] iphone/activator_event[2.] iphone/application_modern[3.] iphone/cydget[4.] iphone/flipswitch_switch[5.] iphone/framework[6.] iphone/ios7_notification_center_widget[7.] iphone/library[8.] iphone/notification_center_widget[9.] iphone/preference_bundle_modern[10.] iphone/tool[11.] iphone/tweak[12.] iphone/xpc_service
# 选择 11 iphone/tweak ,我之前装的是 11, 最新的是 15
Choose a Template (required): 11
# 输入工程名称
Project Name (required): helloworld
# 输入工程包名
Package Name [com.yourcompany.helloworld]: com.fefei.helloworld
# 作者必须是我了
Author/Maintainer Name [fenfei]: fenfei
# 要hook的程序包名,我们这里正好要hook springboard
[iphone/tweak] MobileSubstrate Bundle filter [com.apple.springboard]:
# 开发完成之后,安装好了我们的tweak,要重启的app名称,一般都是我们要hook的app的主程序名称,这里是 SpringBoard
[iphone/tweak] List of applications to terminate upon installation (space-separated, '-' for none) [SpringBoard]: 
Instantiating iphone/tweak in helloworld/...
Done. 

这就搞定了

一共生成了4个文件

  • Makefile 编译的脚本
  • Tweak.xm 源代码
  • control 工程描述
  • helloworld.plist 要hook的App列表

迫不及待了,我们先写代码吧

#import <SpringBoard/SpringBoard.h>

// hook 了 SpringBoard类的 applicationDidFinishLaunching 方法,
// 具体现象就是 进入ios系统桌面之前弹出提示框
%hook SpringBoard

-(void)applicationDidFinishLaunching:(id)application {%orig;UIAlertView *alert = [[UIAlertView alloc] initWithTitle:@"Welcome"message:@"456 Hello world,你好世界"delegate:nilcancelButtonTitle:@"确定"otherButtonTitles:nil];[alert show];[alert release];
}

%end

// 初始化执行
%ctor{NSLog(@"fenfei: 666 ctor!!!");%init(_ungrouped);
} 

编译和安装

make package install 

安装后会自动重启SpringBoard,然后就会弹出我们的HelloWorld

我们再说说这个 NSLog ,这个很有用的,类似Android的 __android_log_print。 但是它从哪看呢?

Mac系统有个叫 控制台 的程序,可以看到每个设备输出的Log。

木问题,收工。

三、总结

玩Ios难点在哪? 不在于Arm汇编,而在于没有设备。你起码得需要一个Mac电脑和Iphone。

不建议装黑苹果,升级和鼓捣太麻烦了。 某鱼搞个二手Mac Pro最低有2k的, Iphone搞个6或者6s, 有3-400的。 Mac电脑系统起码要能装 macOS Mojave 10.14.x 。 Iphone要无锁的,最好国行,系统就所谓了,最好低点 13以下。这样 Xcode 11.3也能玩。

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
// // main.m // Hello World_Code // #import #import "AppDelegate.h" int main(int argc, char *argv[]) { @autoreleasepool { return UIApplicationMain(argc, argv, nil, NSStringFromClass([AppDelegate class])); } } // // AppDelegate.h // Hello World_Code // #import @interface AppDelegate : UIResponder @property (strong, nonatomic) UIWindow *window; @end // // AppDelegate.m // Hello World_Code // #import "AppDelegate.h" @implementation AppDelegate - (void)dealloc { [_window release]; [super dealloc]; } - (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(NSDictionary *)launchOptions { self.window = [[[UIWindow alloc] initWithFrame:[[UIScreen mainScreen] bounds]] autorelease]; self.window.backgroundColor = [UIColor whiteColor]; [self.window makeKeyAndVisible]; UILabel *label = [[UILabel alloc] initWithFrame:CGRectMake(320/2.0 - 140/2.0, 80, 140, 40)]; // 1 label.text = @"Hello World"; label.backgroundColor = [UIColor cyanColor]; label.textAlignment = NSTextAlignmentCenter; [self.window addSubview:label]; // 2 [label release]; // 1 return YES; } - (void)applicationWillResignActive:(UIApplication *)application { // Sent when the application is about to move from active to inactive state. This can occur for certain types of temporary interruptions (such as an incoming phone call or SMS message) or when the user quits the application and it begins the transition to the background state. // Use this method to pause ongoing tasks, disable timers, and throttle down OpenGL ES frame rates. Games should use this method to pause the game. } - (void)applicationDidEnterBackground:(UIApplication *)application { // Use this method to release shared resources, save user data, invalidate timers, and store enough application state information to restore your application to its current
Ubuntu Tweak是一款专门为Ubuntu(GNOME桌面)准备的配置、调整工具,主要面向新手级的普通用户。它可以设置很多并不能在系统首选项中设置的隐藏选项,以满足用户自定义的乐趣。即使是新手,也可以方便地通过它来进行适合自己的系统调整。\[1\]在Ubuntu 10.10上安装Ubuntu Tweak的方法是:首先,检查是否有对应的扩展目录,如果没有则新建一个。然后,打开对应扩展目录下的metadata.json文件,查看uuid,将刚才移过来的目录名重命名为uuid中的内容。最后,关闭并重新打开gnome-tweaks,如果仍然没有刷新出来,可以使用alt+f2打开gnome-shell,输入r重启gnome-shell或重启电脑。\[2\]另外,如果想更换主题,可以搜索User Themes进行安装,这样就能在gnome-tweak中启用shell主题的更换,而/usr/share/themes中存放的是gnome-shell的主题。\[2\]如果想安装插件,可以通过“显示应用程序->工具->优化”打开Ubuntu Tweak,然后通过浏览器安装GNOME扩展网站,安装浏览器扩展后刷新扩展网站页面,会提示安装本地扩展,使用命令sudo apt install chrome-gnome-shell即可安装插件。\[3\] #### 引用[.reference_title] - *1* [在Ubuntu 10.10上安装Ubuntu Tweak的方法](https://blog.csdn.net/on_way_/article/details/8566631)[target="_blank" data-report-click={"spm":"1018.2226.3001.9630","extra":{"utm_source":"vip_chatgpt_common_search_pc_result","utm_medium":"distribute.pc_search_result.none-task-cask-2~all~insert_cask~default-1-null.142^v91^control_2,239^v3^insert_chatgpt"}} ] [.reference_item] - *2* *3* [Ubuntu桌面美化教程(GNOME Tweak Tool安装教程)](https://blog.csdn.net/qq_35395195/article/details/125266461)[target="_blank" data-report-click={"spm":"1018.2226.3001.9630","extra":{"utm_source":"vip_chatgpt_common_search_pc_result","utm_medium":"distribute.pc_search_result.none-task-cask-2~all~insert_cask~default-1-null.142^v91^control_2,239^v3^insert_chatgpt"}} ] [.reference_item] [ .reference_list ]

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值