mirror of
https://github.com/NohamR/Tweaks.git
synced 2026-08-26 18:29:46 +00:00
Compare commits
5 Commits
ec1b0a17f0
...
79f9e5cf0c
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
79f9e5cf0c | ||
|
|
4d51a6eccf | ||
|
|
58dd5db8fd | ||
|
|
4e040791c1 | ||
|
|
965bfcdeff |
3
CloudQuit/.gitignore
vendored
Normal file
3
CloudQuit/.gitignore
vendored
Normal file
@@ -0,0 +1,3 @@
|
|||||||
|
.theos/
|
||||||
|
packages/
|
||||||
|
.DS_Store
|
||||||
7
CloudQuit/CloudQuit.plist
Normal file
7
CloudQuit/CloudQuit.plist
Normal file
@@ -0,0 +1,7 @@
|
|||||||
|
{
|
||||||
|
Filter = {
|
||||||
|
Bundles = (
|
||||||
|
"com.example.cloudquit",
|
||||||
|
);
|
||||||
|
};
|
||||||
|
}
|
||||||
13
CloudQuit/Makefile
Normal file
13
CloudQuit/Makefile
Normal file
@@ -0,0 +1,13 @@
|
|||||||
|
TARGET = iphone:latest:14.0
|
||||||
|
INSTALL_TARGET_PROCESSES = com.example.cloudquit
|
||||||
|
ARCHS = arm64
|
||||||
|
|
||||||
|
include $(THEOS)/makefiles/common.mk
|
||||||
|
|
||||||
|
TWEAK_NAME = CloudQuit
|
||||||
|
|
||||||
|
CloudQuit_FILES = Tweak.x
|
||||||
|
CloudQuit_CFLAGS = -fobjc-arc
|
||||||
|
CloudQuit_FRAMEWORKS = Foundation
|
||||||
|
|
||||||
|
include $(THEOS_MAKE_PATH)/tweak.mk
|
||||||
12
CloudQuit/Tweak.x
Normal file
12
CloudQuit/Tweak.x
Normal file
@@ -0,0 +1,12 @@
|
|||||||
|
#import <substrate.h>
|
||||||
|
#import <Foundation/Foundation.h>
|
||||||
|
|
||||||
|
// iOS 16+ Crash Fix
|
||||||
|
%hook CKContainer
|
||||||
|
+ (id)defaultContainer {
|
||||||
|
return nil;
|
||||||
|
}
|
||||||
|
+ (id)containerWithIdentifier:(id) arg1 {
|
||||||
|
return nil;
|
||||||
|
}
|
||||||
|
%end
|
||||||
9
CloudQuit/control
Normal file
9
CloudQuit/control
Normal file
@@ -0,0 +1,9 @@
|
|||||||
|
Package: xyz.nohamr.cloudquit
|
||||||
|
Name: CloudQuit
|
||||||
|
Version: 1.0.0
|
||||||
|
Architecture: iphoneos-arm
|
||||||
|
Description: Fixes iOS 16+ CloudKit crashes by returning nil from CKContainer methods.
|
||||||
|
Maintainer: NohamR
|
||||||
|
Author: NohamR
|
||||||
|
Section: Tweaks
|
||||||
|
Depends: mobilesubstrate (>= 0.9.5000)
|
||||||
3
HatchDragons/.gitignore
vendored
Normal file
3
HatchDragons/.gitignore
vendored
Normal file
@@ -0,0 +1,3 @@
|
|||||||
|
.theos/
|
||||||
|
packages/
|
||||||
|
.DS_Store
|
||||||
7
HatchDragons/HatchDragons.plist
Normal file
7
HatchDragons/HatchDragons.plist
Normal file
@@ -0,0 +1,7 @@
|
|||||||
|
{
|
||||||
|
Filter = {
|
||||||
|
Bundles = (
|
||||||
|
"com.runawayplay.dragons",
|
||||||
|
);
|
||||||
|
};
|
||||||
|
}
|
||||||
13
HatchDragons/Makefile
Normal file
13
HatchDragons/Makefile
Normal file
@@ -0,0 +1,13 @@
|
|||||||
|
TARGET = iphone:latest:14.0
|
||||||
|
INSTALL_TARGET_PROCESSES = com.runawayplay.dragons
|
||||||
|
ARCHS = arm64 arm64e
|
||||||
|
|
||||||
|
include $(THEOS)/makefiles/common.mk
|
||||||
|
|
||||||
|
TWEAK_NAME = HatchDragons
|
||||||
|
|
||||||
|
HatchDragons_FILES = Tweak.x
|
||||||
|
HatchDragons_CFLAGS = -fobjc-arc
|
||||||
|
HatchDragons_FRAMEWORKS = Foundation
|
||||||
|
|
||||||
|
include $(THEOS_MAKE_PATH)/tweak.mk
|
||||||
156
HatchDragons/Tweak.x
Normal file
156
HatchDragons/Tweak.x
Normal file
@@ -0,0 +1,156 @@
|
|||||||
|
// log stream --predicate 'process == "HatchDragons" AND eventMessage contains "HGH" ' --level default --style compact
|
||||||
|
|
||||||
|
#import <substrate.h>
|
||||||
|
#import <Foundation/Foundation.h>
|
||||||
|
#import <mach-o/dyld.h>
|
||||||
|
|
||||||
|
#define LOG(fmt, ...) NSLog(@"[HGH] " fmt, ##__VA_ARGS__)
|
||||||
|
|
||||||
|
#pragma mark - IL2CPP String Layout
|
||||||
|
|
||||||
|
#define IL2CPP_STRING_LENGTH_OFFSET 0x10
|
||||||
|
#define IL2CPP_STRING_CHARS_OFFSET 0x14
|
||||||
|
#define IL2CPP_DICT_ENTRIES_OFFSET 0x18
|
||||||
|
#define IL2CPP_DICT_COUNT_OFFSET 0x20
|
||||||
|
#define IL2CPP_ARRAY_CAPACITY_OFFSET 0x18
|
||||||
|
#define IL2CPP_ARRAY_DATA_OFFSET 0x20
|
||||||
|
#define IL2CPP_DICT_ENTRY_SIZE 24
|
||||||
|
#define IL2CPP_STRING_MAX_LENGTH (1 << 16)
|
||||||
|
|
||||||
|
#pragma mark - Helpers
|
||||||
|
|
||||||
|
static uintptr_t getImageBase(void) {
|
||||||
|
uint32_t count = _dyld_image_count();
|
||||||
|
for (uint32_t i = 0; i < count; i++) {
|
||||||
|
const char *name = _dyld_get_image_name(i);
|
||||||
|
if (name && strstr(name, "UnityFramework")) {
|
||||||
|
return (uintptr_t)_dyld_get_image_header(i);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
static int requestCount = 0;
|
||||||
|
|
||||||
|
static NSString *timestampString(void) {
|
||||||
|
static NSDateFormatter *fmt;
|
||||||
|
static dispatch_once_t onceToken;
|
||||||
|
dispatch_once(&onceToken, ^{
|
||||||
|
fmt = [[NSDateFormatter alloc] init];
|
||||||
|
fmt.dateFormat = @"HH:mm:ss.SSS";
|
||||||
|
});
|
||||||
|
return [fmt stringFromDate:[NSDate date]];
|
||||||
|
}
|
||||||
|
|
||||||
|
static NSString *il2cppString(void *str) {
|
||||||
|
if (!str) return nil;
|
||||||
|
uint32_t len = *(uint32_t *)((char *)str + IL2CPP_STRING_LENGTH_OFFSET);
|
||||||
|
if (len == 0 || len > IL2CPP_STRING_MAX_LENGTH) return @"(empty?)";
|
||||||
|
NSString *s = [[NSString alloc] initWithBytes:((char *)str + IL2CPP_STRING_CHARS_OFFSET)
|
||||||
|
length:len * 2
|
||||||
|
encoding:NSUTF16LittleEndianStringEncoding];
|
||||||
|
return s ?: @"(unparseable)";
|
||||||
|
}
|
||||||
|
|
||||||
|
static NSString *il2cppHeaders(void *dict) {
|
||||||
|
if (!dict) return @"(nil)";
|
||||||
|
|
||||||
|
void *entriesArr = *(void **)((char *)dict + IL2CPP_DICT_ENTRIES_OFFSET);
|
||||||
|
if (!entriesArr) return @"(empty)";
|
||||||
|
|
||||||
|
uint64_t cap = *(uint64_t *)((char *)entriesArr + IL2CPP_ARRAY_CAPACITY_OFFSET);
|
||||||
|
if (cap == 0) return @"(empty)";
|
||||||
|
|
||||||
|
NSMutableString *out = [NSMutableString string];
|
||||||
|
uint32_t used = 0;
|
||||||
|
char *data = (char *)entriesArr + IL2CPP_ARRAY_DATA_OFFSET;
|
||||||
|
|
||||||
|
for (uint64_t i = 0; i < cap; i++) {
|
||||||
|
char *e = data + i * IL2CPP_DICT_ENTRY_SIZE;
|
||||||
|
int32_t hashCode = *(int32_t *)e;
|
||||||
|
void *key = *(void **)(e + 8);
|
||||||
|
void *value = *(void **)(e + 16);
|
||||||
|
|
||||||
|
if (hashCode < 0 || !key) continue;
|
||||||
|
[out appendFormat:@"\n %@: %@", il2cppString(key),
|
||||||
|
value ? il2cppString(value) : @"(null)"];
|
||||||
|
used++;
|
||||||
|
}
|
||||||
|
|
||||||
|
return used ? out : @"(empty)";
|
||||||
|
}
|
||||||
|
|
||||||
|
static void logRequest(NSString *method, void *self, NSString *body) {
|
||||||
|
requestCount++;
|
||||||
|
NSString *uri = il2cppString(*(void **)((char *)self + 0x10));
|
||||||
|
NSString *platform = il2cppString(*(void **)((char *)self + 0x20));
|
||||||
|
void *hdrs = *(void **)((char *)self + 0x18);
|
||||||
|
|
||||||
|
NSMutableString *msg = [NSMutableString stringWithFormat:
|
||||||
|
@"[%@] ▶ %@ #%d self=%p\n URI: %@\n Headers:%@\n Platform: %@",
|
||||||
|
timestampString(), method, requestCount, self, uri, il2cppHeaders(hdrs), platform];
|
||||||
|
|
||||||
|
if (body) {
|
||||||
|
[msg appendFormat:@"\n Body: %@", body];
|
||||||
|
}
|
||||||
|
|
||||||
|
LOG(@"%@", msg);
|
||||||
|
}
|
||||||
|
|
||||||
|
#pragma mark - CI.HttpClient.RequestHandler Hooks
|
||||||
|
|
||||||
|
static void (*orig_performGet)(void *, void *);
|
||||||
|
static void (*orig_postJson)(void *, void *, void *);
|
||||||
|
|
||||||
|
static void hooked_performGet(void *self, void *handler) {
|
||||||
|
logRequest(@"CI.GET", self, nil);
|
||||||
|
orig_performGet(self, handler);
|
||||||
|
}
|
||||||
|
|
||||||
|
static void hooked_postJson(void *self, void *payload, void *handler) {
|
||||||
|
logRequest(@"CI.POST", self, payload ? il2cppString(payload) : nil);
|
||||||
|
orig_postJson(self, payload, handler);
|
||||||
|
}
|
||||||
|
|
||||||
|
#pragma mark - PlayerInventory Currency Hooks
|
||||||
|
|
||||||
|
static void (*orig_modifyHC)(void *, long, void *, int);
|
||||||
|
static void (*orig_modifySC)(void *, long, void *);
|
||||||
|
|
||||||
|
static void hooked_modifyHC(void *self, long amount, void *info, int quantity) {
|
||||||
|
if (amount < 0) {
|
||||||
|
LOG(@"ModifyHC %ld → %ld (negated)", amount, -amount);
|
||||||
|
amount = -amount;
|
||||||
|
}
|
||||||
|
orig_modifyHC(self, amount, info, quantity);
|
||||||
|
}
|
||||||
|
|
||||||
|
static void hooked_modifySC(void *self, long amount, void *info) {
|
||||||
|
if (amount < 0) {
|
||||||
|
LOG(@"ModifySC %ld → %ld (negated)", amount, -amount);
|
||||||
|
amount = -amount;
|
||||||
|
}
|
||||||
|
orig_modifySC(self, amount, info);
|
||||||
|
}
|
||||||
|
|
||||||
|
#pragma mark - Hook Installation
|
||||||
|
|
||||||
|
#define HOOK(base, rva, hook, orig) \
|
||||||
|
MSHookFunction((void *)((base) + (rva)), (void *)(hook), (void **)&(orig))
|
||||||
|
|
||||||
|
%ctor {
|
||||||
|
uintptr_t base = getImageBase();
|
||||||
|
if (!base) {
|
||||||
|
LOG(@"UnityFramework not found, aborting");
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
LOG(@"UnityFramework base = 0x%lx", (unsigned long)base);
|
||||||
|
|
||||||
|
HOOK(base, 0x58FE798, hooked_performGet, orig_performGet);
|
||||||
|
HOOK(base, 0x58FED8C, hooked_postJson, orig_postJson);
|
||||||
|
HOOK(base, 0x57DC6EC, hooked_modifyHC, orig_modifyHC);
|
||||||
|
HOOK(base, 0x57E4978, hooked_modifySC, orig_modifySC);
|
||||||
|
|
||||||
|
LOG(@"All hooks installed");
|
||||||
|
}
|
||||||
9
HatchDragons/control
Normal file
9
HatchDragons/control
Normal file
@@ -0,0 +1,9 @@
|
|||||||
|
Package: xyz.nohamr.hatchdragons
|
||||||
|
Name: HatchDragons
|
||||||
|
Version: 1.0.0
|
||||||
|
Architecture: iphoneos-arm
|
||||||
|
Description: Logs CI.HttpClient requests (PerformGet/PostJson) from the HatchDragons Unity (il2cpp) game to the console.
|
||||||
|
Maintainer: NohamR
|
||||||
|
Author: NohamR
|
||||||
|
Section: Tweaks
|
||||||
|
Depends: mobilesubstrate (>= 0.9.5000)
|
||||||
22
HatchDragons/index.md
Normal file
22
HatchDragons/index.md
Normal file
@@ -0,0 +1,22 @@
|
|||||||
|
# HatchDragons
|
||||||
|
|
||||||
|
Logs HTTP requests and negates currency deductions in HatchDragons so spending hard/soft currency instead adds it to the player's balance.
|
||||||
|
|
||||||
|
- **App**: [HatchDragons](https://apps.apple.com/us/app/hatch-dragons/id6746389113)
|
||||||
|
- **Latest version**: 1.2.1
|
||||||
|
- **Tested on**: iOS 18.3
|
||||||
|
|
||||||
|
## Build
|
||||||
|
|
||||||
|
```sh
|
||||||
|
make clean && make package THEOS_PACKAGE_SCHEME=rootless DEBUG=0
|
||||||
|
```
|
||||||
|
|
||||||
|
## Inject
|
||||||
|
|
||||||
|
```sh
|
||||||
|
cyan -i com.runawayplay.dragons_1.2.1.ipa \
|
||||||
|
-o com.runawayplay.dragons_1.2.1_patched.ipa \
|
||||||
|
-f xyz.nohamr.hatchdragons_1.0.0_iphoneos-arm.deb \
|
||||||
|
-u
|
||||||
|
```
|
||||||
3
NetworkLogger/.gitignore
vendored
Normal file
3
NetworkLogger/.gitignore
vendored
Normal file
@@ -0,0 +1,3 @@
|
|||||||
|
.theos/
|
||||||
|
packages/
|
||||||
|
.DS_Store
|
||||||
13
NetworkLogger/Makefile
Normal file
13
NetworkLogger/Makefile
Normal file
@@ -0,0 +1,13 @@
|
|||||||
|
TARGET = iphone:latest:14.0
|
||||||
|
INSTALL_TARGET_PROCESSES = *
|
||||||
|
ARCHS = arm64 arm64e
|
||||||
|
|
||||||
|
include $(THEOS)/makefiles/common.mk
|
||||||
|
|
||||||
|
TWEAK_NAME = NetworkLogger
|
||||||
|
|
||||||
|
NetworkLogger_FILES = Tweak.x
|
||||||
|
NetworkLogger_CFLAGS = -fobjc-arc
|
||||||
|
NetworkLogger_FRAMEWORKS = Foundation
|
||||||
|
|
||||||
|
include $(THEOS_MAKE_PATH)/tweak.mk
|
||||||
2
NetworkLogger/NetworkLogger.plist
Normal file
2
NetworkLogger/NetworkLogger.plist
Normal file
@@ -0,0 +1,2 @@
|
|||||||
|
{
|
||||||
|
}
|
||||||
156
NetworkLogger/Tweak.x
Normal file
156
NetworkLogger/Tweak.x
Normal file
@@ -0,0 +1,156 @@
|
|||||||
|
#import <substrate.h>
|
||||||
|
#import <Foundation/Foundation.h>
|
||||||
|
|
||||||
|
#define LOG(fmt, ...) NSLog(@"[NetworkLogger] " fmt, ##__VA_ARGS__)
|
||||||
|
#define MAX_BODY_LOG 2048
|
||||||
|
|
||||||
|
#pragma mark - Helpers
|
||||||
|
|
||||||
|
static int requestCount = 0;
|
||||||
|
|
||||||
|
static NSString *timestamp(void) {
|
||||||
|
static NSDateFormatter *fmt;
|
||||||
|
static dispatch_once_t once;
|
||||||
|
dispatch_once(&once, ^{
|
||||||
|
fmt = [NSDateFormatter new];
|
||||||
|
fmt.dateFormat = @"HH:mm:ss.SSS";
|
||||||
|
});
|
||||||
|
return [fmt stringFromDate:[NSDate date]];
|
||||||
|
}
|
||||||
|
|
||||||
|
static NSString *method(NSURLRequest *req) {
|
||||||
|
return req.HTTPMethod.length ? req.HTTPMethod : @"GET";
|
||||||
|
}
|
||||||
|
|
||||||
|
static NSString *url(NSURLRequest *req) {
|
||||||
|
return req.URL.absoluteString;
|
||||||
|
}
|
||||||
|
|
||||||
|
static NSString *formatHeaders(NSDictionary *hdrs) {
|
||||||
|
if (!hdrs.count) return @"(none)";
|
||||||
|
NSMutableString *s = [NSMutableString string];
|
||||||
|
[hdrs enumerateKeysAndObjectsUsingBlock:^(NSString *k, NSString *v, BOOL *_) {
|
||||||
|
[s appendFormat:@"\n %@: %@", k, v];
|
||||||
|
}];
|
||||||
|
return s.copy;
|
||||||
|
}
|
||||||
|
|
||||||
|
static NSString *formatBody(NSData *data) {
|
||||||
|
if (!data.length) return @"(empty)";
|
||||||
|
NSString *str = [[NSString alloc] initWithData:data encoding:NSUTF8StringEncoding];
|
||||||
|
if (str) return str.length > MAX_BODY_LOG ? [str substringToIndex:MAX_BODY_LOG] : str;
|
||||||
|
return [NSString stringWithFormat:@"<binary %lu bytes>", (unsigned long)data.length];
|
||||||
|
}
|
||||||
|
|
||||||
|
static NSString *formatResponse(NSHTTPURLResponse *resp, NSData *body) {
|
||||||
|
NSMutableString *s = [NSMutableString stringWithFormat:@"HTTP %ld", (long)resp.statusCode];
|
||||||
|
[resp.allHeaderFields enumerateKeysAndObjectsUsingBlock:^(NSString *k, NSString *v, BOOL *_) {
|
||||||
|
[s appendFormat:@"\n %@: %@", k, v];
|
||||||
|
}];
|
||||||
|
if (body) [s appendFormat:@"\n Body: %@", formatBody(body)];
|
||||||
|
return s.copy;
|
||||||
|
}
|
||||||
|
|
||||||
|
static void logDataResponse(int num, NSURLRequest *req, NSData *data, NSURLResponse *resp, NSError *err) {
|
||||||
|
if (err) {
|
||||||
|
LOG(@"[%@] ◀ #%d %@ %@\n Error: %@", timestamp(), num, method(req), url(req), err.localizedDescription);
|
||||||
|
} else if ([resp isKindOfClass:[NSHTTPURLResponse class]]) {
|
||||||
|
LOG(@"[%@] ◀ #%d %@ %@\n%@", timestamp(), num, method(req), url(req), formatResponse((NSHTTPURLResponse *)resp, data));
|
||||||
|
} else {
|
||||||
|
LOG(@"[%@] ◀ #%d %@ %@\n (non-HTTP)", timestamp(), num, method(req), url(req));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
#define LOG_REQUEST(req, extra) \
|
||||||
|
LOG(@"[%@] ▶ #%d %@ %@\n Headers:%@%@", timestamp(), ++requestCount, method(req), url(req), formatHeaders(req.allHTTPHeaderFields), extra)
|
||||||
|
|
||||||
|
#define WRAP_DATA_HANDLER(orig, self, _cmd, req, handler, ...) \
|
||||||
|
void (^wrapped)(NSData *, NSURLResponse *, NSError *) = ^(NSData *d, NSURLResponse *r, NSError *e) { \
|
||||||
|
logDataResponse(requestCount, req, d, r, e); \
|
||||||
|
if (handler) handler(d, r, e); \
|
||||||
|
}; \
|
||||||
|
return orig(self, _cmd, req, ##__VA_ARGS__, wrapped)
|
||||||
|
|
||||||
|
#pragma mark - NSURLSession Hooks
|
||||||
|
|
||||||
|
static NSURLSessionDataTask *(*orig_dataTaskReq)(NSURLSession *, SEL, NSURLRequest *, void (^)(NSData *, NSURLResponse *, NSError *));
|
||||||
|
|
||||||
|
static NSURLSessionDataTask *hooked_dataTaskReq(NSURLSession *self, SEL _cmd, NSURLRequest *req, void (^handler)(NSData *, NSURLResponse *, NSError *)) {
|
||||||
|
NSString *bodyLog = req.HTTPBody ? [NSString stringWithFormat:@"\n Body: %@", formatBody(req.HTTPBody)] : @"";
|
||||||
|
LOG_REQUEST(req, bodyLog);
|
||||||
|
WRAP_DATA_HANDLER(orig_dataTaskReq, self, _cmd, req, handler);
|
||||||
|
}
|
||||||
|
|
||||||
|
static NSURLSessionDataTask *(*orig_dataTaskURL)(NSURLSession *, SEL, NSURL *, void (^)(NSData *, NSURLResponse *, NSError *));
|
||||||
|
|
||||||
|
static NSURLSessionDataTask *hooked_dataTaskURL(NSURLSession *self, SEL _cmd, NSURL *u, void (^handler)(NSData *, NSURLResponse *, NSError *)) {
|
||||||
|
return hooked_dataTaskReq(self, _cmd, [NSURLRequest requestWithURL:u], handler);
|
||||||
|
}
|
||||||
|
|
||||||
|
static NSURLSessionUploadTask *(*orig_uploadTask)(NSURLSession *, SEL, NSURLRequest *, NSData *, void (^)(NSData *, NSURLResponse *, NSError *));
|
||||||
|
|
||||||
|
static NSURLSessionUploadTask *hooked_uploadTask(NSURLSession *self, SEL _cmd, NSURLRequest *req, NSData *body, void (^handler)(NSData *, NSURLResponse *, NSError *)) {
|
||||||
|
LOG_REQUEST(req, [NSString stringWithFormat:@"\n Body: %@", formatBody(body)]);
|
||||||
|
WRAP_DATA_HANDLER(orig_uploadTask, self, _cmd, req, handler, body);
|
||||||
|
}
|
||||||
|
|
||||||
|
static NSURLSessionDownloadTask *(*orig_downloadTask)(NSURLSession *, SEL, NSURLRequest *, void (^)(NSURL *, NSURLResponse *, NSError *));
|
||||||
|
|
||||||
|
static NSURLSessionDownloadTask *hooked_downloadTask(NSURLSession *self, SEL _cmd, NSURLRequest *req, void (^handler)(NSURL *, NSURLResponse *, NSError *)) {
|
||||||
|
LOG_REQUEST(req, @"");
|
||||||
|
int num = requestCount;
|
||||||
|
void (^wrapped)(NSURL *, NSURLResponse *, NSError *) = ^(NSURL *loc, NSURLResponse *resp, NSError *err) {
|
||||||
|
if (err) {
|
||||||
|
LOG(@"[%@] ◀ #%d %@ %@\n Error: %@", timestamp(), num, method(req), url(req), err.localizedDescription);
|
||||||
|
} else if ([resp isKindOfClass:[NSHTTPURLResponse class]]) {
|
||||||
|
LOG(@"[%@] ◀ #%d %@ %@\n (saved to %@)\n%@", timestamp(), num, method(req), url(req), loc.path, formatResponse((NSHTTPURLResponse *)resp, nil));
|
||||||
|
}
|
||||||
|
if (handler) handler(loc, resp, err);
|
||||||
|
};
|
||||||
|
return orig_downloadTask(self, _cmd, req, wrapped);
|
||||||
|
}
|
||||||
|
|
||||||
|
static void (*orig_resume)(NSURLSessionTask *, SEL);
|
||||||
|
|
||||||
|
static void hooked_resume(NSURLSessionTask *self, SEL _cmd) {
|
||||||
|
LOG(@"[%@] ▶ RESUME %@ %@", timestamp(), method(self.currentRequest), url(self.currentRequest));
|
||||||
|
orig_resume(self, _cmd);
|
||||||
|
}
|
||||||
|
|
||||||
|
#pragma mark - NSURLConnection (Legacy)
|
||||||
|
|
||||||
|
static void (*orig_asyncSend)(NSURLConnection *, SEL, NSURLRequest *, NSOperationQueue *, void (^)(NSURLResponse *, NSData *, NSError *));
|
||||||
|
|
||||||
|
static void hooked_asyncSend(NSURLConnection *self, SEL _cmd, NSURLRequest *req, NSOperationQueue *queue, void (^handler)(NSURLResponse *, NSData *, NSError *)) {
|
||||||
|
LOG_REQUEST(req, @" (legacy)");
|
||||||
|
void (^wrapped)(NSURLResponse *, NSData *, NSError *) = ^(NSURLResponse *r, NSData *d, NSError *e) {
|
||||||
|
logDataResponse(requestCount, req, d, r, e);
|
||||||
|
if (handler) handler(r, d, e);
|
||||||
|
};
|
||||||
|
orig_asyncSend(self, _cmd, req, queue, wrapped);
|
||||||
|
}
|
||||||
|
|
||||||
|
#pragma mark - Constructor
|
||||||
|
|
||||||
|
#define HOOK_MSG(cls, sel, hook, orig) \
|
||||||
|
MSHookMessageEx(cls, @selector(sel), (IMP)hook, (IMP *)&orig)
|
||||||
|
|
||||||
|
%ctor {
|
||||||
|
LOG(@"=== tweak loaded ===");
|
||||||
|
|
||||||
|
Class session = NSClassFromString(@"NSURLSession");
|
||||||
|
if (session) {
|
||||||
|
HOOK_MSG(session, dataTaskWithRequest:completionHandler:, hooked_dataTaskReq, orig_dataTaskReq);
|
||||||
|
HOOK_MSG(session, dataTaskWithURL:completionHandler:, hooked_dataTaskURL, orig_dataTaskURL);
|
||||||
|
HOOK_MSG(session, uploadTaskWithRequest:fromData:completionHandler:, hooked_uploadTask, orig_uploadTask);
|
||||||
|
HOOK_MSG(session, downloadTaskWithRequest:completionHandler:, hooked_downloadTask, orig_downloadTask);
|
||||||
|
}
|
||||||
|
|
||||||
|
Class task = NSClassFromString(@"__NSCFLocalDataTask") ?: NSClassFromString(@"NSURLSessionDataTask");
|
||||||
|
if (task) HOOK_MSG(task, resume, hooked_resume, orig_resume);
|
||||||
|
|
||||||
|
Class conn = NSClassFromString(@"NSURLConnection");
|
||||||
|
if (conn) HOOK_MSG(conn, sendAsynchronousRequest:queue:completionHandler:, hooked_asyncSend, orig_asyncSend);
|
||||||
|
|
||||||
|
LOG(@"=== all hooks installed ===");
|
||||||
|
}
|
||||||
9
NetworkLogger/control
Normal file
9
NetworkLogger/control
Normal file
@@ -0,0 +1,9 @@
|
|||||||
|
Package: xyz.noham.networklogger
|
||||||
|
Name: NetworkLogger
|
||||||
|
Version: 1.0.0
|
||||||
|
Architecture: iphoneos-arm
|
||||||
|
Description: Logs every network request and response to the console via os_log.
|
||||||
|
Maintainer: NohamR
|
||||||
|
Author: NohamR
|
||||||
|
Section: Tweaks
|
||||||
|
Depends: mobilesubstrate (>= 0.9.5000)
|
||||||
44
NetworkLogger/index.md
Normal file
44
NetworkLogger/index.md
Normal file
@@ -0,0 +1,44 @@
|
|||||||
|
# NetworkLogger
|
||||||
|
|
||||||
|
Logs every network request and response to the console via `os_log`. Useful for debugging API calls, reverse-engineering endpoints, and understanding how an app communicates with its backend.
|
||||||
|
|
||||||
|
## What it hooks
|
||||||
|
|
||||||
|
- `NSURLSession` task creation (`dataTaskWithRequest:`, `dataTaskWithURL:`, `uploadTaskWithRequest:fromData:`, `downloadTaskWithRequest:`)
|
||||||
|
- `NSURLSessionTask resume`
|
||||||
|
- `NSURLConnection sendAsynchronousRequest:queue:completionHandler:` (legacy)
|
||||||
|
|
||||||
|
## Output format
|
||||||
|
|
||||||
|
```
|
||||||
|
[NetworkLogger] ▶ REQUEST GET https://platform.runawayplay.com/dragons/api/mailbox
|
||||||
|
Headers:
|
||||||
|
Authorization: Bearer <token>
|
||||||
|
X-Client-Platform: ios
|
||||||
|
Body: (none)
|
||||||
|
[NetworkLogger] ◀ RESPONSE GET https://platform.runawayplay.com/dragons/api/mailbox
|
||||||
|
HTTP 200
|
||||||
|
Content-Type: application/json
|
||||||
|
...
|
||||||
|
Body: {"mailItems": [...]}
|
||||||
|
```
|
||||||
|
|
||||||
|
## Build
|
||||||
|
|
||||||
|
```sh
|
||||||
|
make clean && make package THEOS_PACKAGE_SCHEME=rootless
|
||||||
|
```
|
||||||
|
|
||||||
|
## Inject
|
||||||
|
|
||||||
|
```sh
|
||||||
|
cyan -i <input.ipa> -o <output_patched.ipa> -f <tweak.deb> -u
|
||||||
|
```
|
||||||
|
|
||||||
|
## Viewing logs
|
||||||
|
|
||||||
|
```sh
|
||||||
|
log stream --predicate 'eventMessage contains "NetworkLogger"' --level debug
|
||||||
|
```
|
||||||
|
|
||||||
|
Or view in Console.app filtering for `NetworkLogger`.
|
||||||
@@ -19,6 +19,7 @@ iOS tweaks built with [Theos](https://theos.dev), injected into IPAs via [cyan](
|
|||||||
| [VolkswagenJB](VolkswagenJB/index.md) | Volkswagen 2.72.0 | iOS 16.7.15 |
|
| [VolkswagenJB](VolkswagenJB/index.md) | Volkswagen 2.72.0 | iOS 16.7.15 |
|
||||||
| [GPXViewer2](GPXViewer2) | GPXViewer 2 | iOS 14+ |
|
| [GPXViewer2](GPXViewer2) | GPXViewer 2 | iOS 14+ |
|
||||||
| [RMHook](RMHook/index.md) | reMarkable | iOS |
|
| [RMHook](RMHook/index.md) | reMarkable | iOS |
|
||||||
|
| [HatchDragons](HatchDragons/index.md) | HatchDragons 1.2.1 | iOS 18+ |
|
||||||
|
|
||||||
## Build
|
## Build
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user