Difference between revisions of "Theos on MAC OS"

From Hawk Wiki
Jump to: navigation, search
(Created page with "<pre>export THEOS=/git/theos cd /git git clone https://github.com/DHowett/theos.git sudo $THEOS/bin/bootstrap.sh substrate //There is a bug. Need to copy from iOS device /Libr...")
 
 
(9 intermediate revisions by the same user not shown)
Line 1: Line 1:
<pre>export THEOS=/git/theos
+
==Install theos==
 +
This procedure works on Mac OS Yosemite. <br>
 +
First, set the os path. <br>
 +
<pre>export THEOS=/git/theos</pre>
 +
In mac, you can do "vim ~/.bash_profile" and add "export THEOS=/git/theos" <br>
 +
Download from git, you can choose your own folder
 +
<pre>
 
cd /git
 
cd /git
 
git clone https://github.com/DHowett/theos.git
 
git clone https://github.com/DHowett/theos.git
 +
</pre>
 +
Generate substrate
 +
<pre>
 
sudo $THEOS/bin/bootstrap.sh substrate
 
sudo $THEOS/bin/bootstrap.sh substrate
//There is a bug. Need to copy from iOS device /Library/Frameworks/CydiaSubstrate.framework/CydiaSubstrate to $THEOS/lib/libsubstrate.dylib
+
</pre>
Install dkpg, download from
+
'''There is a bug. Need to copy from iOS device /Library/Frameworks/CydiaSubstrate.framework/CydiaSubstrate to $THEOS/lib/libsubstrate.dylib'''
http://www.macports.org/install.php
+
 
restart terminal after install
+
Install dkpg, download from<br>
 +
http://www.macports.org/install.php<br>
 +
restart terminal after install<br>
 +
<pre>
 
sudo port selfupdate
 
sudo port selfupdate
 
sudo port install dpkg
 
sudo port install dpkg
 +
</pre>
  
Additional templates
+
Additional templates (optional)<br>
https://github.com/DHowett/theos-nic-templates
+
https://github.com/DHowett/theos-nic-templates<br>
copy and paste to $THEOS/templates/iphone
+
copy and paste to $THEOS/templates/iphone<br>
 
+
Now you can create tweaks from templates
 +
<pre>
 
$THEOS/bin/nic.pl
 
$THEOS/bin/nic.pl
 +
</pre>
 +
 +
choose the tweak type.<br>
 +
 +
After edit you tweak<br>
 +
add THEOS_DEVICE_IP = 10.101.66.113 <your device ip> into makefile<br>
 +
also add ARCHS = armv7 arm64 into makefile <br>
 +
 +
<pre>
 +
make package install
 +
// enter your ssh password
 +
</pre>
 +
 +
sample tweak.xm
 +
<pre>
 +
@interface NSString (MD5)
 +
- (id)Md5String;
 +
@end
 +
 +
%hook NSString
 +
// log string before and after md5
 +
- (id)Md5String {
 +
  %log(@"HW: -------------------------Tweak: Md5String-------------------------\n");
 +
  %log(self);
 +
  id ret = %orig;
 +
  %log(ret);
 +
  return ret;
 +
}
 +
%end
 +
</pre>
 +
 +
==How to watch syslog in ios 8==
 +
<pre>
 +
apt-get install socat
 +
socat - UNIX-CONNECT:/var/run/lockdown/syslog.sock
 +
watch
 +
</pre>
 +
 +
==Logify==
 +
<pre>
 +
$THEOS/bin/logify.pl SomeClassHeader.h > tweak.xm
 +
</pre>
 +
see http://iphonedevwiki.net/index.php/Logify <br>
 +
It can automatic generate tweak.xm file to log all functions provided in a header.
 +
 +
==theos installation path==
 +
<pre>/Library/MobileSubstrate/DynamicLibraries/</pre>
 +
==Application Path==
 +
ios 8
 +
<pre>
 +
/var/mobile/Containers/Bundle/Application/
 +
</pre>
 +
ios9
 +
<pre>
 +
/private/var/containers/Bundle/Application/
 +
</pre>
 +
==Application Document Path==
 +
ios8 and ios9
 +
<pre>
 +
/var/mobile/Containers/Data/Application
 
</pre>
 
</pre>

Latest revision as of 06:36, 26 July 2016

Install theos

This procedure works on Mac OS Yosemite.
First, set the os path.

export THEOS=/git/theos

In mac, you can do "vim ~/.bash_profile" and add "export THEOS=/git/theos"
Download from git, you can choose your own folder

cd /git
git clone https://github.com/DHowett/theos.git

Generate substrate

sudo $THEOS/bin/bootstrap.sh substrate

There is a bug. Need to copy from iOS device /Library/Frameworks/CydiaSubstrate.framework/CydiaSubstrate to $THEOS/lib/libsubstrate.dylib

Install dkpg, download from
http://www.macports.org/install.php
restart terminal after install

sudo port selfupdate
sudo port install dpkg

Additional templates (optional)
https://github.com/DHowett/theos-nic-templates
copy and paste to $THEOS/templates/iphone
Now you can create tweaks from templates

$THEOS/bin/nic.pl

choose the tweak type.

After edit you tweak
add THEOS_DEVICE_IP = 10.101.66.113 <your device ip> into makefile
also add ARCHS = armv7 arm64 into makefile

make package install
// enter your ssh password

sample tweak.xm

@interface NSString (MD5)
- (id)Md5String;
@end

%hook NSString
// log string before and after md5
- (id)Md5String {
  %log(@"HW: -------------------------Tweak: Md5String-------------------------\n");
  %log(self);
  id ret = %orig;
  %log(ret);
  return ret;
}
%end

How to watch syslog in ios 8

apt-get install socat
socat - UNIX-CONNECT:/var/run/lockdown/syslog.sock
watch

Logify

$THEOS/bin/logify.pl SomeClassHeader.h > tweak.xm

see http://iphonedevwiki.net/index.php/Logify
It can automatic generate tweak.xm file to log all functions provided in a header.

theos installation path

/Library/MobileSubstrate/DynamicLibraries/

Application Path

ios 8

/var/mobile/Containers/Bundle/Application/

ios9

/private/var/containers/Bundle/Application/

Application Document Path

ios8 and ios9

/var/mobile/Containers/Data/Application