https://github.com/theos/logos
Preprocessor that simplifies Objective-C hooking.
https://github.com/theos/logos
logos theos
Last synced: 10 months ago
JSON representation
Preprocessor that simplifies Objective-C hooking.
- Host: GitHub
- URL: https://github.com/theos/logos
- Owner: theos
- License: other
- Created: 2018-01-28T14:33:07.000Z (over 8 years ago)
- Default Branch: master
- Last Pushed: 2024-08-19T19:44:11.000Z (almost 2 years ago)
- Last Synced: 2025-07-09T13:07:16.749Z (11 months ago)
- Topics: logos, theos
- Language: Perl
- Homepage: https://theos.dev/docs/logos
- Size: 513 KB
- Stars: 217
- Watchers: 8
- Forks: 33
- Open Issues: 21
-
Metadata Files:
- Readme: README.md
- License: LICENSE.md
Awesome Lists containing this project
README
# Logos
Logos is a Perl regex-based preprocessor that simplifies the boilerplate code needed to create hooks for Objective-C methods and C functions with an elegant Objective-C-like syntax. It’s most commonly used along with the [Theos](https://theos.dev/docs/) build system, which was originally developed to create jailbreak tweaks. Logos was once integrated in the same Git repo as Theos, but now has been decoupled from Theos to its own repo.
Logos aims to provide an interface for [Cydia Substrate](http://cydiasubstrate.com/) by default, but can be configured to directly use the Objective-C runtime.
Documentation is available on the [Logos Syntax](https://theos.dev/docs/logos-syntax), [Logify](https://theos.dev/docs/logify.pl), and [File Extensions](https://theos.dev/docs/logos-file-extensions) pages of [theos.dev](https://theos.dev/docs/).
## Example
### Source file: Tweak.x
```logos
%hook NSObject
- (NSString *)description {
return [%orig stringByAppendingString:@" (of doom)"];
}
%new
- (void)helloWorld {
NSLog(@"Awesome!");
}
%end
```
### Logos-processed output: Tweak.x.m
*(Modified for brevity)*
```objc
#include
static NSString *_logos_method$_ungrouped$NSObject$description(NSObject *self, SEL _cmd) {
return [_logos_orig$_ungrouped$NSObject$description(self, _cmd) stringByAppendingString:@" (of doom)"];
}
static void _logos_method$_ungrouped$NSObject$helloWorld(NSObject * self, SEL _cmd) {
NSLog(@"Awesome!");
}
static __attribute__((constructor)) void _logosLocalInit() {
Class _logos_class$_ungrouped$NSObject = objc_getClass("NSObject");
MSHookMessageEx(_logos_class$_ungrouped$NSObject, @selector(description), (IMP)&_logos_method$_ungrouped$NSObject$description, (IMP*)&_logos_orig$_ungrouped$NSObject$description);
class_addMethod(_logos_class$_ungrouped$NSObject, @selector(helloWorld), (IMP)&_logos_method$_ungrouped$NSObject$helloWorld, "v@:");
}
```
## License
Licensed under the GNU General Public License, version 3.0, with an exception that projects created using Logos are not required to use the same license. Refer to [LICENSE.md](LICENSE.md).