Tweak 安装hook插件成功,但是hook无效

新萌求助:
iPhone 5s 9.1完美越狱版本
我想尝试hook springboard 的视图方法。插件安装成功了
==> Installing…
(Reading database … 5064 files and directories currently installed.)
Preparing to replace com.jniying.sboard 0.0.1-2+debug (using /tmp/_theos_install.deb) …
Unpacking replacement com.jniying.sboard …
Setting up com.jniying.sboard (0.0.1-3+debug) …
==> Unloading SpringBoard…

cydia 也显示我安装的插件,但就是无效
我尝试hook其他app 还是没有效果
Makefile

INSTALL_TARGET_PROCESSES = SpringBoard

include $(THEOS)/makefiles/common.mk

TWEAK_NAME = sboard

sboard_FILES = Tweak.x
sboard_CFLAGS = -fobjc-arc

include $(THEOS_MAKE_PATH)/tweak.mk

plist

{ Filter = { Bundles = ( "com.apple.springboard" ); }; }

SpringBoard,是不是大小写的原因

是不是depend了其他未安装的插件

bundleID 大小写?这个是通过cycript 拿到的

cydia substrate 插件 是 0.9.6301 版本 这个会不有影响

tweak.x 文件

#import <UIKit/UIKit.h>
%hook SpringBoard

-(void)applicationDidFinishLaunching:(id)application{
    %orig;
    UIAlertView *alert = [[UIAlertView alloc] initWithTitle:@"提示" message:@"我来了,哈哈哈" delegate:nil cancelButtonTitle:@"不见" otherButtonTitles:@"好的", nil];
    [alert show];
}

%end

/Library/MobileSubstrate/DynamicLibraries/ 目录下没有看到添加 我插件的 .dylib

那就是没安装上呗

/Library/MobileSubstrate/DynamicLibraries/ 有什么原因会导致插件安装不到这个路径下?

.dylib 被安装到了device文件夹下手动移动到
/Library/MobileSubstrate/DynamicLibraries/
就可以了。为什么会这个样子。。

请问一下 我的情况是插件已经被安装到/Library/MobileSubstrate/DynamicLibraries/目录下,也无法hook?

越狱插件安装问题

1、brew install dpkg

2、修改/opt/theos/makefiles/package/deb.mk文件内容

$(ECHO_NOTHING)COPYFILE_DISABLE=1 $(FAKEROOT) -r $(_THEOS_PLATFORM_DPKG_DEB) -Z$(_THEOS_PLATFORM_DPKG_DEB_COMPRESSION) -z$(THEOS_PLATFORM_DEB_COMPRESSION_LEVEL) -b “$(THEOS_STAGING_DIR)” “$(_THEOS_DEB_PACKAGE_FILENAME)”$(ECHO_END)

上面这一句修改为下面这一句代码就可以搞定

$(ECHO_NOTHING)COPYFILE_DISABLE=1 $(FAKEROOT) -r dpkg-deb -Zgzip -b “$(THEOS_STAGING_DIR)” “$(_THEOS_DEB_PACKAGE_FILENAME)” $(STDERR_NULL_REDIRECT)$(ECHO_END)

1 Like

按照jniying的方式还是不能解决问题。

修改/opt/theos/makefiles/package/deb.mk文件内容不能解决,请问还有其他方法吗?

control:
Package: com.nadou.theosdemo
Name: theosDemo
Version: 0.0.1
Architecture: iphoneos-arm
Description: An awesome MobileSubstrate tweak!
Maintainer: aaron
Author: aaron
Section: Tweaks
Depends: mobilesubstrate (>= 0.9.5000)

makefile:

TARGET := iphone:clang:latest:7.0
INSTALL_TARGET_PROCESSES = SpringBoard

include $(THEOS)/makefiles/common.mk

TWEAK_NAME = theosDemo
theosDemo_FRAMEWORKS = UIKit
theosDemo_FILES = Tweak.x
theosDemo_CFLAGS = -fobjc-arc
include $(THEOS_MAKE_PATH)/tweak.mk

theosDemo.plist:

{ Filter = { Bundles = ( “com.apple.springboard” ); }; }

Tweak.x:

#import <UIKit/UIKit.h>

%hook SpringBoard
– (void)_menuButtonDown:(id)down
{
UIAlertView *alert = [[UIAlertView alloc]
initWithTitle:@“Hello,lecoding!”
message:nil
delegate:self cancelButtonTitle:@“OK”
otherButtonTitles:nil];
[alert show];
%orig; // call the original _menuButtonDown:
}
%end

解决了 是因为Cydia Substrate 版本过高导致的 目前我的手机是iphone 5s ios9.1,而Cydia Substrate之前是0.9.63,降级成0.9.62就可以了。

思路参考这个贴: Theos tweak dylib 没有注入