iOS Reverse Logos syntax

Source: Internet
Author: User

Logos syntax
Http://iphonedevwiki.net/index.php/Logos

    • When creating a new Monkey project, Monkeydev has injected Libsubstrate.dylib library and Revealserver.framework library into it, and Libsubstrate.dylib library can write logos syntax

    • Logos Syntax:

Logos Syntax function Explanation Case
%hook Which class to hook %hook Classname
%end code block end Tag
%group Group %group Groupname
%new Add a new method %new (signature)
%ctor constructor function %ctor {...}
%dtor Destructors %dtor {...}
%log Output printing %log; %log ([(
%orig Keep the original method %orig;%orig (arg1, ...) ;
%c %c ([+/-]class);
1.%hook%end

Specifies the class that needs to be hook, must end with%end.

// hook SpringBoard类里面的_menuButtonDown函数,先打印一句话,再之子那个函数原始的操作%hook SpringBorad- (void)_menuButtonDown:(id)down{    NSLog(@"111111");   %orig; // 调用原始的_menuButtonDown函数}%end
2.%group

This directive is used to group%hook, facilitate code management and conditionally initialize groupings, and must end with%end.
A%group can contain multiple%hook, and all%hook that are not part of a custom group are implicitly categorized into%group_ungrouped.

/*在%group iOS7Hook中钩住iOS7Class的iOS7Method,在%group iOS8Class中钩住iOS8Method函数,然后在%group _ungroup中钩住SpringBoard类的powerDown函数.*/%group iOS7Hook%hook iOS7Class- (id)ios7Method{    id result = %orig;    NSLog(@"这个方法只有iOS7适用");    return result;}%end%end // iOS7Method%group iOS8Hook%hook iOS8Class- (id)ios8Method{    id result = %orig;    NSLog(@"这个方法只有iOS7适用");    return result;}%end%end // iOS8Method%hook SpringBoard- (void)powerDown{     %orig;}%end
3.%new

For use inside%hook, add a new function to an existing class with the same functionality as Class_addmethod.
Note:
The difference between the category of Objective-c and Class_addmethod:
The former is static and the latter is dynamic. Use%new to add, without the need to add a function declaration to the. h file, if you use category, you may encounter such an error.

%hook SpringBoard%new- (void)addNewMethod{    NSLog(@"动态添加一个方法到SpringBoard");}%end
4.%ctor

Tweak the constructor, completes the initialization work; If the definition is not displayed, Theos automatically generates a%ctor and calls%init (_ungrouped) in it. %ctor can generally be used to initialize%group, as well as perform operations such as Mshookfunction, as follows:

#ifndef KCFCoreFoundationVersionNumber_iOS_8_0#define KCFCoreFoundationVersionNumber_iOS_8_0      1140.10#endif%ctor{    %init;    if (KCFCoreFoundationVersionNumber >= KCFCoreFoundationVersionNumber_iOS_7_0 && KCFCoreFoundationVersionNumber > KCFCoreFoundationVersionNumber_iOS_8_0)    %init(iOS7Hook); if (KCFCoreFoundationVersionNumber >= KCFCoreFoundationVersionNumber_iOS_8_0)    %init(iOS8Hook);MSHookFunction((void *)&AudioServicesPlaySystemSound,(void *)&replaced_AudioServerPlaySystemSound,(void **)&orginal_AudioServicesPlaySystemSound);}
5.%dtor

Generate an anonymous deconstructor (of the default priority).

%dtor { … }
6.%log

This directive is used internally in%hook, which writes information such as the class name and parameters of the function to the syslog, which can be%log ([(),.....]) Format to append additional printing information.

%hook SpringBorad- (void)_menuButtonDown:(id)down{    %log((NSString *)@"iosre",(NSString *)@"Debug");    %orig; // 调用原始的_menuButtonDown方法}%end
6.%orig

The directive is used inside%hook to execute the original code of the hook's function, or you can change the parameters of the original function with%orig.

%hook SpringBorad- (void)setCustomSubtitleText:(id)arg1 withColor:   (id)arg2{    %orig(@"change arg2",arg2);// 将arg2的参数修 改为"change arg2"}%end
7.%init

The directive is used to initialize a%group, must be called within%hook or%ctor, or, if with parameters, initializes the specified group, and initializes the _ungrouped if no arguments are taken.
Note: Remember, only call the%init, the corresponding%group can work!

8.%c

The directive is equivalent to Objc_getclass or nsclassfromstring, which dynamically acquires the definition of a class, which is used within%hook or%ctor.

iOS Reverse Logos syntax

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.