-
Notifications
You must be signed in to change notification settings - Fork 210
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
eugeneyang
authored and
eugeneyang
committed
Oct 6, 2016
1 parent
44cd967
commit 6620a4d
Showing
9 changed files
with
864 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,110 @@ | ||
app2dylib | ||
|
||
|
||
# svn | ||
*.svn* | ||
|
||
# mac | ||
__MACOSX | ||
*.DS_Store* | ||
*._* | ||
*.lock | ||
*.Spotlight-V100 | ||
*.Trashes | ||
*ehthumbs.db | ||
*Thumbs.db | ||
|
||
# Python | ||
*.pyc | ||
__pycache__/ | ||
|
||
|
||
# Vim | ||
*.swp | ||
*.swo | ||
*.swn | ||
|
||
# Xcode | ||
*~.nib | ||
build/ | ||
*.pbxuser | ||
!default.pbxuser | ||
*.mode1v3 | ||
!default.mode1v3 | ||
*.mode2v3 | ||
!default.mode2v3 | ||
*.perspectivev3 | ||
!default.perspectivev3 | ||
xcuserdata | ||
*.xccheckout | ||
*.xcscmblueprint | ||
*.moved-aside | ||
DerivedData | ||
*.hmap | ||
*.ipa | ||
*.xcuserstate | ||
|
||
# generated files | ||
bin/ | ||
gen/ | ||
|
||
# built application files | ||
*.apk | ||
*.ap_ | ||
|
||
# files for the dex VM | ||
*.dex | ||
|
||
# Java class files | ||
*.class | ||
|
||
# Local configuration file (sdk path, etc) | ||
local.properties | ||
|
||
# Eclipse project files | ||
.classpath | ||
.project | ||
.settings/ | ||
|
||
# Proguard folder generated by Eclipse | ||
proguard/ | ||
|
||
# Intellij project files | ||
*.iml | ||
*.ipr | ||
*.iws | ||
.idea/ | ||
|
||
#Pod | ||
Pods/ | ||
!podfile | ||
!podfile.lock | ||
|
||
# Gradle files | ||
.gradle | ||
build/ | ||
|
||
# Ignore Gradle GUI config | ||
gradle-app.setting | ||
|
||
# Avoid ignoring Gradle wrapper jar file (.jar files are usually ignored) | ||
!gradle-wrapper.jar | ||
|
||
#Android studio For eclipse | ||
#build.gradle | ||
#gradle/ | ||
#gradlew | ||
#gradlew.bat | ||
#.gradle/ | ||
# | ||
|
||
|
||
|
||
#tweak | ||
_/ | ||
.theos/ | ||
obj/ | ||
*.deb | ||
|
||
|
||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
[submodule "class-dump"] | ||
path = class-dump | ||
url = https://github.com/0xced/class-dump |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,2 +1,74 @@ | ||
# app2dylib | ||
A reverse engineering tool to convert iOS app to dylib | ||
|
||
|
||
# Usage | ||
|
||
``` | ||
git clone --recursive https://github.com/tobefuturer/app2dylib.git | ||
cd app2dylib && make | ||
./app2dylib | ||
``` | ||
|
||
example : | ||
|
||
``` | ||
./app2dylib /tmp/AlipayWallet -o /tmp/libAlipayApp.dylib | ||
``` | ||
|
||
You can use libAlipayApp.dylib as a normal dynamic library. | ||
|
||
Call OC method or call C function like this: | ||
|
||
``` | ||
#import <UIKit/UIKit.h> | ||
#import <dlfcn.h> | ||
#import <mach/mach.h> | ||
#import <mach-o/loader.h> | ||
#import <mach-o/dyld.h> | ||
int main(int argc, char * argv[]) { | ||
NSString * dylibName = @"libAlipayApp"; | ||
NSString * path = [[NSBundle mainBundle] pathForResource:dylibName ofType:@"dylib"]; | ||
if (dlopen(path.UTF8String, RTLD_NOW) == NULL){ | ||
NSLog(@"dlopen failed ,error %s", dlerror()); | ||
return 0; | ||
}; | ||
uint32_t dylib_count = _dyld_image_count(); | ||
uint64_t slide = 0; | ||
for (int i = 0; i < dylib_count; i ++) { | ||
const char * name = _dyld_get_image_name(i); | ||
if ([[NSString stringWithUTF8String:name] isEqualToString:path]) { | ||
slide = _dyld_get_image_vmaddr_slide(i); | ||
} | ||
} | ||
assert(slide != 0); | ||
Class c = NSClassFromString(@"aluSecurity"); | ||
NSString * plain = @"alipay"; | ||
NSString * pubkey = @"MIGfMA0GCSqGSIb3DQEBAQUAA4GNADCBiQKBgQDZ6i9VNEGEaZaYE7XffA9XRj15cp/ZKhHYY43EEva8LIhCWi29EREaF4JjZVMwFpUAfrL+9gpA7NMQmaMRHbrz1KHe2Ho4HpUhEac8M9zUbNvaDKSlhx0lq/15TQP+57oQbfJ9oKKd+he4Yd6jpBI3UtGmwJyN/T1S0DQ0aXR8OQIDAQAB"; | ||
NSString * cipher = [c performSelector:NSSelectorFromString(@"rsaEncryptText:pubKey:") withObject:plain withObject:pubkey]; | ||
NSLog(@"ciphertext: %@", cipher); | ||
typedef int (*BASE64_ENCODE_FUNC_TYPE) (char * output, int * output_size , char * input, int input_length); | ||
/** get function pointer*/ | ||
BASE64_ENCODE_FUNC_TYPE base64_encode = (BASE64_ENCODE_FUNC_TYPE)(slide + 0xa798e4); | ||
char output[1000] = {0}; | ||
int length = 1000; | ||
char * input = "alipay"; | ||
base64_encode(output, & length, input, (int)strlen(input)); | ||
NSLog(@"base64 length: %d , %s", length, output); | ||
} | ||
``` |
Oops, something went wrong.