iOS 8 Jailbreak Develepment

Device list:

  1. An iPhone that has been jailbroken
  2. A Macs with an Intel Core


I. Software on your iPhone

  1. Cydia.app
    • APT front-end for iOS device
  2. OpenSSH
    • Secure shell for TheOS
    • Change your iPhone default root/mobile password. link
  3. Perl
    • Perl runtime for TheOS pl script
    • cydia source: http://coolstar.org/publicrepo
  4. TheOS for iOS
    • the package build system
    • cydia source: http://nix.howett.net/theos/

II. Software on your Mac

  1. Xcode 6.1
  2. TheOS for mac
    • path: /opt/theos/
  3. ldid
    • path: /opt/dev/bin/ldid
  4. dpkg-deb
    • path: /opt/dev/bin/dpkg-deb
  5. IOSOpenDev
    • connect Xcode with TheOS
    • path: /opt/iOSOpenDev

1. Install theos

mkdir /opt/theos  
git clone https://github.com/DHowett/theos.git /opt/theos

## copy cydia substrate lib file
scp mobile@iphone.local:/Library/Frameworks/CydiaSubstrate.framework/CydiaSubstrate /opt/theos/lib/libsubstrate.dylib

## copy cydia substrate header file
scp mobile@iphone.local:/Library/Frameworks/CydiaSubstrate.framework/Headers/CydiaSubstrate.h /opt/theos/include/substrate.h

2. Install ldid

mkdir /opt/dev/src  
git clone git://git.saurik.com/ldid.git  
cd ldid  
git submodule update --init  
./make.sh
cp -f ./ldid /opt/dev/bin/ldid  

3. Install dpkg

curl -O http://test.saurik.com/francis/dpkg-deb-fat  
chmod a+x dpkg-deb-fat  
mv dpkg-deb-fat /opt/dev/bin/dpkg-deb  

4. Install iOSOpenDev

wget https://iosopendev.googlecode.com/files/iOSOpenDev-1.6-2.pkg  
open iOSOpenDev-1.6-2.pkg  

5. Update mac ssh client config

## 1. update /etc/hosts
192.168.1.83    iphone.local

## 2. gererate public key for auto ssh login
ssh-keygen -f ~/.ssh/iphone_id_dsa  
#
scp ~/.ssh/iphone_id_dsa.pub mobile@iphone.local:/var/mobile/.ssh/iphone_id_dsa.pub  
ssh mobile@iphone.local  
    > cat ~/.ssh/iphone_id_dsa.pub >> ~/.ssh/authorized_keys
    > rm ~/.ssh/iphone_id_dsa.pub
    > exit

## 3. nano ~/.ssh/config
Host iphone.local  
    HostName iphone.local
    Port 22
    User mobile
    IdentityFile ~/.ssh/iphone_id_dsa

6. Set enviroment

## nano ~/.bash_profile

export iOSOpenDevPath=/opt/iOSOpenDev  
export THEOS="/opt/theos"  
export THEOS_DEVICE_IP=iphone.local  
export THEOS_DEVICE_PORT=22  
export PATH=/opt/dev/bin:$THEOS/bin:$iOSOpenDevPath/bin:$PATH

III. first project

1. new Xcode project

2. edit HelloWorld.xm file

2. check your config

Project / TARGETS / Build Settings / User-Defined:

iOSOpenDevCopyOnBuild  
iOSOpenDevDevice  
iOSOpenDevInstallOnProfiling  
iOSOpenDevPath  
iOSOpenDevRespringOnInstall  
iOSOpenDev  

3. build for profiling

Product -> Build For -> Build For Profiling

4. done


REF:

Theos

Theos: package build system

Not to be confused with a toolchain or SDK, Theos helps create and manage projects. Theos:

  • Creates new empty projects based on templates ( see NIC, below )
  • Handles Makefiles for your build environment
  • Automates packaging ( to .deb ) and installation

nic.pl script ( New Instance Creator )
The New Instance Creator is a script, included with Theos, that creates empty projects for you to use as starting points for your development.
link

logos.pl script
Logos is a component of the Theos development suite that allows method hooking code to be written easily and clearly, using a set of special preprocessor directives.
link

logify .pl script
Logify is a component of the Theos development suite that accepts a class header (.h file) as input and generates a MobileSubstrate extension (.xm file) which hooks all of that class's methods, printing log messages when they are called. This helps a hook developer see when certain methods are invoked during use.
link

IOSOpenDev

IOSOpenDev: iOS open dev tools

iOSOpenDev is an open-source project that sets up the iOS SDK to allow open development in Xcode of jailbreak-type projects not supported nor allowed by default and provides Xcode templates for building common jailbreak-type projects and the various tools needed for such development.
link