Skip to content

Commit

Permalink
rename esign
Browse files Browse the repository at this point in the history
  • Loading branch information
hugeBlack committed Nov 23, 2024
1 parent 49b7aec commit f2bcee6
Show file tree
Hide file tree
Showing 24 changed files with 9,603 additions and 0 deletions.
14 changes: 14 additions & 0 deletions ZSign/Makefile
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
TARGET := iphone:clang:latest:7.0
ARCHS := arm64
include $(THEOS)/makefiles/common.mk

LIBRARY_NAME = ZSign

ZSign_FILES = $(shell find . -name '*.cpp') $(shell find . -name '*.mm') zsigner.m
ZSign_CFLAGS = -fobjc-arc -Wno-deprecated -Wno-unused-variable -Wno-unused-but-set-variable -Wno-module-import-in-extern-c
ZSign_CCFLAGS = -std=c++11
ZSign_FRAMEWORKS = OpenSSL
ZSign_INSTALL_PATH = /Applications/LiveContainer.app/Frameworks

include $(THEOS_MAKE_PATH)/library.mk

26 changes: 26 additions & 0 deletions ZSign/Utils.hpp
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
//
// Utils.hpp
// feather
//
// Created by samara on 30.09.2024.
//

#ifndef Utils_hpp
#define Utils_hpp

#include <stdio.h>


#ifdef __cplusplus
extern "C" {
#endif

const char* getDocumentsDirectory();
void writeToNSLog(const char* msg);
void refreshFile(const char* path);

#ifdef __cplusplus
}
#endif

#endif /* zsign_hpp */
38 changes: 38 additions & 0 deletions ZSign/Utils.mm
Original file line number Diff line number Diff line change
@@ -0,0 +1,38 @@
//
// Utils.cpp
// feather
//
// Created by samara on 30.09.2024.
//

#include "Utils.hpp"
#import <Foundation/Foundation.h>

extern "C" {

const char* getDocumentsDirectory() {
NSArray *paths = NSSearchPathForDirectoriesInDomains(NSDocumentDirectory, NSUserDomainMask, YES);
NSString *documentsDirectory = [paths firstObject];
const char *documentsPath = [documentsDirectory UTF8String];
return documentsPath;
}

void writeToNSLog(const char* msg) {
NSLog(@"[LC] singner msg: %s", msg);
}

// copy, remove and rename back the file to prevent crash due to kernel signature cache
// see https://developer.apple.com/documentation/security/updating-mac-software
void refreshFile(const char* path) {
NSString* objcPath = @(path);
if(![NSFileManager.defaultManager fileExistsAtPath:objcPath]) {
return;
}
NSString* newPath = [NSString stringWithFormat:@"%s.tmp", path];
NSError* error;
[NSFileManager.defaultManager copyItemAtPath:objcPath toPath:newPath error:&error];
[NSFileManager.defaultManager removeItemAtPath:objcPath error:&error];
[NSFileManager.defaultManager moveItemAtPath:newPath toPath:objcPath error:&error];
}

}
Loading

0 comments on commit f2bcee6

Please sign in to comment.