Skip to content

Commit

Permalink
allows build atlantis to a jailbreak tweak
Browse files Browse the repository at this point in the history
Add theos build support, allows intercepting HTTP/HTTPS traffic for any
third party apps under jailbreak environment
  • Loading branch information
qiudaomao committed Apr 15, 2021
1 parent 89702b9 commit 52e967f
Show file tree
Hide file tree
Showing 11 changed files with 264 additions and 0 deletions.
3 changes: 3 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -67,3 +67,6 @@ fastlane/report.xml
fastlane/Preview.html
fastlane/screenshots
fastlane/test_output

theos/.theos
theos/packages
27 changes: 27 additions & 0 deletions theos/Makefile
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
TARGET := iphone:clang:latest:11.0
include $(THEOS)/makefiles/common.mk

TWEAK_NAME = atlantis

atlantis_FILES = Tweak.xm \
../Sources/Atlantis+Manual.swift \
../Sources/DispatchQueue+Once.swift \
../Sources/NetworkInjector.swift \
../Sources/Transporter.swift \
../Sources/Atlantis.swift \
../Sources/Message.swift \
../Sources/PackageIdentifier.swift \
../Sources/Configuration.swift \
../Sources/NetworkInjector+URLConnection.swift \
../Sources/Packages.swift \
../Sources/DataCompression.swift \
../Sources/NetworkInjector+URLSession.swift \
../Sources/Runtime.swift
atlantis_CFLAGS = -fobjc-arc
atlantis_LIBRARIES = applist

include $(THEOS_MAKE_PATH)/tweak.mk

after-install::
# Respring the device
install.exec "killall -9 SpringBoard"
25 changes: 25 additions & 0 deletions theos/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
# Build and Use

```shell
### First install and setup theos
sudo git clone --recursive https://github.com/theos/theos /opt/theos
export THEOS=/opt/theos
export THEOS_DEVICE_IP=YouriPhoneIP

### Build tweak
git clone https://github.com/runatlantis/atlantis
cd atlantis/theos

make -j4
make package

#before install, make sure install applist, preferenceloader from cydia
make install

### Phone will restart SpringBoard, then Open Settings - Atlantis enable/disable app you want
### restart the target app, and you can see network traffics on Proxyman
```

![settings1](assets/settings1.png)
![settings2](assets/settings2.png)
![proxyman](assets/ProxyMan.png)
32 changes: 32 additions & 0 deletions theos/Tweak.xm
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
#import <atlantis-Swift.h>
#import <Foundation/Foundation.h>

%ctor {
NSLog(@"[atlantis] init...");
NSString *path = @"/var/mobile/Library/Preferences/proxyman.atlantis.settings.plist";
NSString *enableHostKeyPath = @"shouldEnableHost";
NSString *hostKeyPath = @"host";
NSDictionary *prefs = [NSDictionary dictionaryWithContentsOfFile:path];
NSString *bundleIdentifier = [[NSBundle mainBundle] bundleIdentifier];
NSString *keyPath = [NSString stringWithFormat:@"Settings-%@", bundleIdentifier];
BOOL enabled = NO;
if (([[prefs objectForKey:keyPath] boolValue])) {
enabled = YES;
}
NSLog(@"[atlantis] enable for [%@] ? %@", bundleIdentifier, enabled ? @"Y":@"N");
if (enabled) {
BOOL enableHost = NO;
if (([[prefs objectForKey:enableHostKeyPath] boolValue])) {
enableHost = YES;
}
NSString *hostName = [prefs objectForKey:hostKeyPath];
NSLog(@"[atlantis] enable Customized Host? %@", enableHost ? @"Y":@"N");
if (enableHost && hostName != nil) {
NSLog(@"[atlantis] Customized Host %@", hostName);
[Atlantis startWithHostName:hostName];
} else {
NSLog(@"[atlantis] start without Specfic Host");
[Atlantis startWithHostName:nil];
}
}
}
Binary file added theos/assets/ProxyMan.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added theos/assets/settings1.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added theos/assets/settings2.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
7 changes: 7 additions & 0 deletions theos/atlantis.plist
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
{
Filter = {
Bundles = (
"com.apple.UIKit"
);
};
}
9 changes: 9 additions & 0 deletions theos/layout/DEBIAN/control
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
Package: proxyman.atlantis
Name: atlantis
Depends: mobilesubstrate, applist, preferenceloader, ${LIBSWIFT}
Version: 0.0.1
Architecture: iphoneos-arm
Description: http(s) intercepting for proxyman
Maintainer: atlantis
Author: atlantis
Section: Tweaks
Original file line number Diff line number Diff line change
@@ -0,0 +1,58 @@
{
"entry": {
"label": "Atlantis",
"cell": "PSLinkCell",
"icon": ""
},
"items": [
{
"label": "",
"cell": "PSGroupCell",
"footerText": "Intercepting Http(s) Traffics by ProxyMan"
},
{
"cell": "PSSwitchCell",
"label": "Enable ProxyMan Host",
"default": false,
"defaults": "proxyman.atlantis.settings",
"key": "shouldEnableHost"
},
{
"defaults": "proxyman.atlantis.settings",
"cell": "PSEditTextCell",
"label": "Host(IP):",
"key": "host",
"keyboard": "",
"noAutoCorrect": true,
"default": ""
},
{
"ALAllowsSelection": "1",
"ALChangeNotification": "com.rpetrich.applist.sample.notification",
"ALSectionDescriptors": [
{
"cell-class-name": "ALSwitchCell",
"icon-size": "29",
"predicate": "isSystemApplication = FALSE",
"suppress-hidden-apps": "1",
"title": "User Applications"
},
{
"cell-class-name": "ALSwitchCell",
"icon-size": "29",
"predicate": "isSystemApplication = TRUE",
"suppress-hidden-apps": "1",
"title": "System Applications"
}
],
"ALSettingsKeyPrefix": "Settings-",
"ALSettingsPath": "\/var\/mobile\/Library\/Preferences\/proxyman.atlantis.settings.plist",
"bundle": "AppList",
"cell": "PSLinkCell",
"icon": "\/Applications\/Preferences.app\/Settings.png",
"isController": "1",
"label": "Enabled App List"
}
],
"title": "Intercepting Http(s) Traffics by ProxyMan"
}
103 changes: 103 additions & 0 deletions theos/layout/Library/PreferenceLoader/Preferences/atlantis_prefs.plist
Original file line number Diff line number Diff line change
@@ -0,0 +1,103 @@
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
<plist version="1.0">
<dict>
<key>entry</key>
<dict>
<key>cell</key>
<string>PSLinkCell</string>
<key>icon</key>
<string></string>
<key>label</key>
<string>Atlantis</string>
</dict>
<key>items</key>
<array>
<dict>
<key>cell</key>
<string>PSGroupCell</string>
<key>footerText</key>
<string>Intercepting Http(s) Traffics by ProxyMan</string>
<key>label</key>
<string></string>
</dict>
<dict>
<key>cell</key>
<string>PSSwitchCell</string>
<key>default</key>
<false/>
<key>defaults</key>
<string>proxyman.atlantis.settings</string>
<key>key</key>
<string>shouldEnableHost</string>
<key>label</key>
<string>Enable ProxyMan Host</string>
</dict>
<dict>
<key>cell</key>
<string>PSEditTextCell</string>
<key>default</key>
<string></string>
<key>defaults</key>
<string>proxyman.atlantis.settings</string>
<key>key</key>
<string>host</string>
<key>keyboard</key>
<string></string>
<key>label</key>
<string>Host(IP):</string>
<key>noAutoCorrect</key>
<true/>
</dict>
<dict>
<key>ALAllowsSelection</key>
<string>1</string>
<key>ALChangeNotification</key>
<string>com.rpetrich.applist.sample.notification</string>
<key>ALSectionDescriptors</key>
<array>
<dict>
<key>cell-class-name</key>
<string>ALSwitchCell</string>
<key>icon-size</key>
<string>29</string>
<key>predicate</key>
<string>isSystemApplication = FALSE</string>
<key>suppress-hidden-apps</key>
<string>1</string>
<key>title</key>
<string>User Applications</string>
</dict>
<dict>
<key>cell-class-name</key>
<string>ALSwitchCell</string>
<key>icon-size</key>
<string>29</string>
<key>predicate</key>
<string>isSystemApplication = TRUE</string>
<key>suppress-hidden-apps</key>
<string>1</string>
<key>title</key>
<string>System Applications</string>
</dict>
</array>
<key>ALSettingsKeyPrefix</key>
<string>Settings-</string>
<key>ALSettingsPath</key>
<string>/var/mobile/Library/Preferences/proxyman.atlantis.settings.plist</string>
<key>bundle</key>
<string>AppList</string>
<key>cell</key>
<string>PSLinkCell</string>
<key>icon</key>
<string>/Applications/Preferences.app/Settings.png</string>
<key>isController</key>
<string>1</string>
<key>label</key>
<string>Enabled App List</string>
</dict>
</array>
<key>title</key>
<string>Intercepting Http(s) Traffics by ProxyMan</string>
</dict>
</plist>

0 comments on commit 52e967f

Please sign in to comment.