12. Tweak練習(xí)

1.定位目標文件

  • ps方法
  ps -e | grep WeChat
  • find方法

    find -name sshd
    
  • 固定目錄中查找

    AppStore App全部位于“/var/mobile/Containers/Bundle/Application/”下,
    系統(tǒng)App全部位于“/Applications/”下
    
    daemon的配置文件均位于
    “/System/Library/LaunchDaemons/”
    “/Library/LaunchDaemons”
    “/Library/LaunchAgents/”
    
    是一個plist格式的文件。其中的“ProgramArguments”字段,即是daemon可執(zhí)行文件的絕對路徑
      luz-iphone:/Library/LaunchDaemons root# cat com.openssh.sshd.plist 
    <?xml version="1.0" encoding="UTF-8"?>
    <!DOCTYPE plist PUBLIC "-//Apple Computer//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
    <plist version="1.0">
    
    <dict>
        <key>Label</key>
        <string>com.openssh.sshd</string>
    
        <key>Program</key>
        <string>/usr/libexec/sshd-keygen-wrapper</string>
    
        <key>ProgramArguments</key>
        <array>
            <string>/usr/sbin/sshd</string>
            <string>-i</string>
        </array>
    
        <key>SessionCreate</key>
        <true/>
    
        <key>Sockets</key>
        <dict>
            <key>Listeners</key>
            <dict>
                <key>SockServiceName</key>
                <string>ssh</string>
            </dict>
        </dict>
    
        <key>StandardErrorPath</key>
        <string>/dev/null</string>
    
        <key>inetdCompatibility</key>
        <dict>
            <key>Wait</key>
            <false/>
        </dict>
    </dict>
    
    </plist>
    

2.獲取頭文件信息和bundleid

  • 砸殼
  • 通過class-dump獲取頭文件
  • 獲取bundleid
    codesign -dvvv WeChat
    

3.分析頭文件編寫tweak代碼

  • Makefile文件

    THEOS_DEVICE_IP = 192.168.1.113
    DEBUG = 1
    ARCHS = armv7 arm64 
    TARGET = iphone:latest:8.0  
    include $(THEOS)/makefiles/common.mk
    
    TWEAK_NAME = WeChatReProject
    WeChatReProject_FILES = Tweak.xm
    WeChatReProject_FRAMEWORKS = UIKit 
    include $(THEOS_MAKE_PATH)/tweak.mk
    
    after-install::
        install.exec "killall -9 WeChat"
    
    clean::
        rm -rf ./packages/* 
    
  • control文件

    Package: com.iosre.wechatreproject
    Name: WeChatReProject
    Depends: mobilesubstrate
    Version: 0.0.1
    Architecture: iphoneos-arm
    Description: WeChat Tweak
    Maintainer: luz
    Author: luz
    Section: Tweaks
    Homepage: https://www.baidu.com
    
  • plist文件

{ Filter = { Bundles = ( "com.tencent.xin" ); }; }
  • tweak.xm文件
    #import<UIKit/UIKit.h>
    #import <CoreLocation/CoreLocation.h>
    #import <CoreLocation/CLLocation.h>
    
    @interface SeePeopleNearByLogicController
    - (void)onRetrieveLocationOK:(id)arg1;
    @end
    
    %hook SeePeopleNearByLogicController
    - (void)onRetrieveLocationOK:(id)arg1
    {
        CLLocation *location = [[CLLocation alloc] initWithLatitude:31.154352 longitude:121.42562];
        %orig(location);
    
        UIAlertView *alertView = [[UIAlertView alloc] 
        initWithTitle:[@"onRetrieveLocationOK" 
        stringByAppendingString:[[NSString alloc] 
        initWithFormat:@"location is %@", location]] 
        message:nil 
        delegate:self 
        cancelButtonTitle:@"ok" 
        otherButtonTitles:nil];
    
        [alertView show];
    }
    %end
    
最后編輯于
?著作權(quán)歸作者所有,轉(zhuǎn)載或內(nèi)容合作請聯(lián)系作者
【社區(qū)內(nèi)容提示】社區(qū)部分內(nèi)容疑似由AI輔助生成,瀏覽時請結(jié)合常識與多方信息審慎甄別。
平臺聲明:文章內(nèi)容(如有圖片或視頻亦包括在內(nèi))由作者上傳并發(fā)布,文章內(nèi)容僅代表作者本人觀點,簡書系信息發(fā)布平臺,僅提供信息存儲服務(wù)。

相關(guān)閱讀更多精彩內(nèi)容

  • 8.第一個逆向程序 創(chuàng)建tweak工程? iOS /opt/theos/bin/nic.pl NIC 2.0 -...
    Flonger閱讀 3,110評論 0 1
  • Tweak練習(xí) 1.定位目標文件 ps方法 find方法find -name sshd 固定目錄中查找AppSto...
    handsome5閱讀 283評論 1 0
  • iOS 越獄的Tweak開發(fā) 原文鏈接在我的博客 https://yohunl.com/ios-yue-yu-de...
    yohunl閱讀 17,187評論 20 34
  • 簡介 在移動互聯(lián)網(wǎng)時代,移動app能解決用戶的很多生活瑣事,比如 周邊:找餐館、找KTV、找電影院等等 導(dǎo)航:根據(jù)...
    JonesCxy閱讀 1,537評論 1 1
  • 如果說我是一片葉子
    DidoZhang閱讀 203評論 0 0

友情鏈接更多精彩內(nèi)容