diff --git a/.gitignore b/.gitignore index 2c059a0..c0b608a 100644 --- a/.gitignore +++ b/.gitignore @@ -67,3 +67,6 @@ fastlane/report.xml fastlane/Preview.html fastlane/screenshots fastlane/test_output + +theos/.theos +theos/packages diff --git a/theos/Makefile b/theos/Makefile new file mode 100644 index 0000000..391a4ab --- /dev/null +++ b/theos/Makefile @@ -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" diff --git a/theos/README.md b/theos/README.md new file mode 100644 index 0000000..a3bbfd0 --- /dev/null +++ b/theos/README.md @@ -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) diff --git a/theos/Tweak.xm b/theos/Tweak.xm new file mode 100644 index 0000000..a0a9042 --- /dev/null +++ b/theos/Tweak.xm @@ -0,0 +1,32 @@ +#import +#import + +%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]; + } + } +} diff --git a/theos/assets/ProxyMan.png b/theos/assets/ProxyMan.png new file mode 100644 index 0000000..5b9d007 Binary files /dev/null and b/theos/assets/ProxyMan.png differ diff --git a/theos/assets/settings1.png b/theos/assets/settings1.png new file mode 100644 index 0000000..6aef86c Binary files /dev/null and b/theos/assets/settings1.png differ diff --git a/theos/assets/settings2.png b/theos/assets/settings2.png new file mode 100644 index 0000000..fd8c5ad Binary files /dev/null and b/theos/assets/settings2.png differ diff --git a/theos/atlantis.plist b/theos/atlantis.plist new file mode 100644 index 0000000..2423656 --- /dev/null +++ b/theos/atlantis.plist @@ -0,0 +1,7 @@ +{ + Filter = { + Bundles = ( + "com.apple.UIKit" + ); + }; +} diff --git a/theos/layout/DEBIAN/control b/theos/layout/DEBIAN/control new file mode 100644 index 0000000..ddf84e5 --- /dev/null +++ b/theos/layout/DEBIAN/control @@ -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 diff --git a/theos/layout/Library/PreferenceLoader/Preferences/atlantis_prefs.json b/theos/layout/Library/PreferenceLoader/Preferences/atlantis_prefs.json new file mode 100644 index 0000000..0d4301d --- /dev/null +++ b/theos/layout/Library/PreferenceLoader/Preferences/atlantis_prefs.json @@ -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" +} diff --git a/theos/layout/Library/PreferenceLoader/Preferences/atlantis_prefs.plist b/theos/layout/Library/PreferenceLoader/Preferences/atlantis_prefs.plist new file mode 100644 index 0000000..2039048 --- /dev/null +++ b/theos/layout/Library/PreferenceLoader/Preferences/atlantis_prefs.plist @@ -0,0 +1,103 @@ + + + + + entry + + cell + PSLinkCell + icon + + label + Atlantis + + items + + + cell + PSGroupCell + footerText + Intercepting Http(s) Traffics by ProxyMan + label + + + + cell + PSSwitchCell + default + + defaults + proxyman.atlantis.settings + key + shouldEnableHost + label + Enable ProxyMan Host + + + cell + PSEditTextCell + default + + defaults + proxyman.atlantis.settings + key + host + keyboard + + label + Host(IP): + noAutoCorrect + + + + 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 + +