Skip to content

Commit

Permalink
add source code
Browse files Browse the repository at this point in the history
  • Loading branch information
eugeneyang authored and eugeneyang committed Oct 6, 2016
1 parent 44cd967 commit 6620a4d
Show file tree
Hide file tree
Showing 9 changed files with 864 additions and 0 deletions.
110 changes: 110 additions & 0 deletions .gitignore
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



3 changes: 3 additions & 0 deletions .gitmodules
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
72 changes: 72 additions & 0 deletions README.md
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);
}
```
Loading

0 comments on commit 6620a4d

Please sign in to comment.