From 1ca07fe02c59d483db2e8318855d74bbcb1a42fe Mon Sep 17 00:00:00 2001 From: Naville <403799106@qq.com> Date: Tue, 23 Feb 2016 09:50:50 +0000 Subject: [PATCH] More OpenSSL/AES --- .gitignore | 1 + Hooks/SDKHooks/OpenSSLAES.xm | 33 +- Hooks/SDKHooks/OpenSSLUnimplemented/aes.h | 9 - Makefile | 10 +- VERSION | 2 +- .../Preferences/WTFJHPreferences.plist | 438 ------------------ obj | 1 - theos | 1 - 8 files changed, 37 insertions(+), 458 deletions(-) delete mode 100644 layout/Library/PreferenceLoader/Preferences/WTFJHPreferences.plist delete mode 120000 obj delete mode 120000 theos diff --git a/.gitignore b/.gitignore index 092f79b..aaae5f8 100644 --- a/.gitignore +++ b/.gitignore @@ -3,3 +3,4 @@ CompileDefines.xm theos/ .theos/ .DS_Store +*.deb diff --git a/Hooks/SDKHooks/OpenSSLAES.xm b/Hooks/SDKHooks/OpenSSLAES.xm index bac0c55..8a052d0 100644 --- a/Hooks/SDKHooks/OpenSSLAES.xm +++ b/Hooks/SDKHooks/OpenSSLAES.xm @@ -1,4 +1,5 @@ #import "../SharedDefine.pch" +#import "string.h" # define AES_ENCRYPT 1 # define AES_DECRYPT 0 @@ -22,17 +23,43 @@ typedef struct aes_key_st AES_KEY; int (*old_AES_set_encrypt_key)(const unsigned char *userKey, const int bits, AES_KEY *key); +int (*old_AES_set_decrypt_key)(const unsigned char *userKey, const int bits, + AES_KEY *key); +void (*old_AES_ecb_encrypt)(const unsigned char *in, unsigned char *out, + const AES_KEY *key, const int enc); int AES_set_encrypt_key(const unsigned char *userKey, const int bits,AES_KEY *key){ - NSData* Keydata=[NSData dataWithBytes:userKey length:bits]; CallTracer *tracer = [[CallTracer alloc] initWithClass:@"OpenSSL/AES" andMethod:@"AES_set_encrypt_key"]; - [tracer addArgFromPlistObject:Keydata withKey:@"Key"]; - [Keydata release]; + [tracer addArgFromPlistObject:[NSData dataWithBytes:userKey length:bits] withKey:@"Key"]; [traceStorage saveTracedCall: tracer]; [tracer release]; return old_AES_set_encrypt_key(userKey,bits,key);//Call Original +} +int AES_set_decrypt_key(const unsigned char *userKey, const int bits,AES_KEY *key){ + CallTracer *tracer = [[CallTracer alloc] initWithClass:@"OpenSSL/AES" andMethod:@"AES_set_decrypt_key"]; + [tracer addArgFromPlistObject:[NSData dataWithBytes:userKey length:bits] withKey:@"Key"]; + [traceStorage saveTracedCall: tracer]; + [tracer release]; + return old_AES_set_decrypt_key(userKey,bits,key);//Call Original + + +} +void AES_ecb_encrypt(const unsigned char *in, unsigned char *out, + const AES_KEY *key, const int enc){ + CallTracer *tracer = [[CallTracer alloc] initWithClass:@"OpenSSL/AES" andMethod:@"AES_ecb_encrypt"]; + [tracer addArgFromPlistObject:[NSData dataWithBytes:in length:enc] withKey:@"InputData"]; + old_AES_ecb_encrypt(in,out,key,enc);//Call Original + [tracer addArgFromPlistObject:[NSData dataWithBytes:out length:enc] withKey:@"OutputData"]; + [traceStorage saveTracedCall: tracer]; + [tracer release]; + } extern void init_OpenSSLAES_hook() { MSHookFunction(((void*)MSFindSymbol(NULL, "_AES_set_encrypt_key")),(void*)AES_set_encrypt_key, (void**)&old_AES_set_encrypt_key); +MSHookFunction(((void*)MSFindSymbol(NULL, "_AES_set_decrypt_key")),(void*)AES_set_decrypt_key, (void**)&old_AES_set_decrypt_key); +MSHookFunction(((void*)MSFindSymbol(NULL, "_AES_ecb_encrypt")),(void*)AES_ecb_encrypt, (void**)&old_AES_ecb_encrypt); +#ifdef PROTOTYPE + +#endif } diff --git a/Hooks/SDKHooks/OpenSSLUnimplemented/aes.h b/Hooks/SDKHooks/OpenSSLUnimplemented/aes.h index 8c36a4d..c8e2bdb 100644 --- a/Hooks/SDKHooks/OpenSSLUnimplemented/aes.h +++ b/Hooks/SDKHooks/OpenSSLUnimplemented/aes.h @@ -85,19 +85,10 @@ struct aes_key_st { typedef struct aes_key_st AES_KEY; const char *AES_options(void); - -int AES_set_encrypt_key(const unsigned char *userKey, const int bits, - AES_KEY *key); -int AES_set_decrypt_key(const unsigned char *userKey, const int bits, - AES_KEY *key); - void AES_encrypt(const unsigned char *in, unsigned char *out, const AES_KEY *key); void AES_decrypt(const unsigned char *in, unsigned char *out, const AES_KEY *key); - -void AES_ecb_encrypt(const unsigned char *in, unsigned char *out, - const AES_KEY *key, const int enc); void AES_cbc_encrypt(const unsigned char *in, unsigned char *out, size_t length, const AES_KEY *key, unsigned char *ivec, const int enc); diff --git a/Makefile b/Makefile index 0081404..83eddab 100644 --- a/Makefile +++ b/Makefile @@ -1,13 +1,13 @@ -export CFLAGS=-Wp,"-DWTFJHTWEAKNAME=@\"HMD7CP87LA6Q6V2\",-DPROTOTYPE" +export CFLAGS=-Wp,"-DWTFJHTWEAKNAME=@\"D1Z4121CQR03M3R\"" include theos/makefiles/common.mk export ARCHS = armv7 armv7s arm64 export TARGET = iphone:clang:7.0:7.0 -TWEAK_NAME = HMD7CP87LA6Q6V2 -HMD7CP87LA6Q6V2_FILES = Tweak.xm CompileDefines.xm Hooks/APIHooks/CommonCryptor.xm Hooks/APIHooks/CommonDigest.xm Hooks/APIHooks/CommonHMAC.xm Hooks/APIHooks/CommonKeyDerivation.xm Hooks/APIHooks/CoreTelephony.xm Hooks/APIHooks/dlfcn.xm Hooks/APIHooks/Keychain.xm Hooks/APIHooks/libC.xm Hooks/APIHooks/libMobileGestalt.xm Hooks/APIHooks/NSData.xm Hooks/APIHooks/NSFileHandle.xm Hooks/APIHooks/NSFileManager.xm Hooks/APIHooks/NSHTTPCookie.xm Hooks/APIHooks/NSInputStream.xm Hooks/APIHooks/NSKeyedArchiver.xm Hooks/APIHooks/NSKeyedUnarchiver.xm Hooks/APIHooks/NSOutputStream.xm Hooks/APIHooks/NSURLConnection.xm Hooks/APIHooks/NSURLCredential.xm Hooks/APIHooks/NSURLSession.xm Hooks/APIHooks/NSUserDefaults.xm Hooks/APIHooks/NSXMLParser.xm Hooks/APIHooks/Security.xm Hooks/APIHooks/SSLKillSwitch.xm Hooks/APIHooks/UIPasteboard.xm Hooks/SDKHooks/FclBlowfish.xm Hooks/SDKHooks/OpenSSLAES.xm Hooks/SDKHooks/OpenSSLBlowFish.xm Hooks/SDKHooks/OpenSSLMD5.xm Hooks/SDKHooks/OpenSSLSHA1.xm Hooks/SDKHooks/OpenSSLSHA512.xm Hooks/Utils/CallStackInspector.m Hooks/Utils/CallTracer.m Hooks/Utils/DelegateProxies.m Hooks/Utils/NSURLConnectionDelegateProx.m Hooks/Utils/NSURLSessionDelegateProxy.m Hooks/Utils/PlistObjectConverter.m Hooks/Utils/RuntimeUtils.m Hooks/Utils/SQLiteStorage.m Hooks/Utils/Utils.m +TWEAK_NAME = D1Z4121CQR03M3R +D1Z4121CQR03M3R_FILES = Tweak.xm CompileDefines.xm Hooks/APIHooks/CommonCryptor.xm Hooks/APIHooks/CommonDigest.xm Hooks/APIHooks/CommonHMAC.xm Hooks/APIHooks/CommonKeyDerivation.xm Hooks/APIHooks/CoreTelephony.xm Hooks/APIHooks/dlfcn.xm Hooks/APIHooks/Keychain.xm Hooks/APIHooks/libC.xm Hooks/APIHooks/libMobileGestalt.xm Hooks/APIHooks/NSData.xm Hooks/APIHooks/NSFileHandle.xm Hooks/APIHooks/NSFileManager.xm Hooks/APIHooks/NSHTTPCookie.xm Hooks/APIHooks/NSInputStream.xm Hooks/APIHooks/NSKeyedArchiver.xm Hooks/APIHooks/NSKeyedUnarchiver.xm Hooks/APIHooks/NSOutputStream.xm Hooks/APIHooks/NSURLConnection.xm Hooks/APIHooks/NSURLCredential.xm Hooks/APIHooks/NSURLSession.xm Hooks/APIHooks/NSUserDefaults.xm Hooks/APIHooks/NSXMLParser.xm Hooks/APIHooks/Security.xm Hooks/APIHooks/SSLKillSwitch.xm Hooks/APIHooks/UIPasteboard.xm Hooks/SDKHooks/FclBlowfish.xm Hooks/SDKHooks/OpenSSLAES.xm Hooks/SDKHooks/OpenSSLBlowFish.xm Hooks/SDKHooks/OpenSSLMD5.xm Hooks/SDKHooks/OpenSSLSHA1.xm Hooks/SDKHooks/OpenSSLSHA512.xm Hooks/Utils/CallStackInspector.m Hooks/Utils/CallTracer.m Hooks/Utils/DelegateProxies.m Hooks/Utils/NSURLConnectionDelegateProx.m Hooks/Utils/NSURLSessionDelegateProxy.m Hooks/Utils/PlistObjectConverter.m Hooks/Utils/RuntimeUtils.m Hooks/Utils/SQLiteStorage.m Hooks/Utils/Utils.m ADDITIONAL_CCFLAGS = -Qunused-arguments ADDITIONAL_LDFLAGS = -Wl,-segalign,4000,-sectcreate,WTFJH,SIGDB,./SignatureDatabase.plist -HMD7CP87LA6Q6V2_LIBRARIES = sqlite3 substrate -HMD7CP87LA6Q6V2_FRAMEWORKS = Foundation UIKit Security +D1Z4121CQR03M3R_LIBRARIES = sqlite3 substrate +D1Z4121CQR03M3R_FRAMEWORKS = Foundation UIKit Security include $(THEOS_MAKE_PATH)/tweak.mk after-install:: install.exec "killall -9 SpringBoard" \ No newline at end of file diff --git a/VERSION b/VERSION index f8c9d43..06690d5 100644 --- a/VERSION +++ b/VERSION @@ -1 +1 @@ -235 +238 \ No newline at end of file diff --git a/layout/Library/PreferenceLoader/Preferences/WTFJHPreferences.plist b/layout/Library/PreferenceLoader/Preferences/WTFJHPreferences.plist deleted file mode 100644 index 05621cd..0000000 --- a/layout/Library/PreferenceLoader/Preferences/WTFJHPreferences.plist +++ /dev/null @@ -1,438 +0,0 @@ - - - - - entry - - cell - PSLinkCell - icon - WTFJH.png - label - WTFJH - Settings - - items - - - cell - PSGroupCell - isStaticText - - label - Additional - - - cell - PSSwitchCell - default - - defaults - naville.wtfjh - key - LogToTheConsole - label - Log To The Console - - - cell - PSSwitchCell - default - - defaults - naville.wtfjh - key - URLSchemesHooks - label - URL Schemes Hooks - - - cell - PSGroupCell - isStaticText - - label - Modules - - - cell - PSSwitchCell - default - - defaults - naville.wtfjh - key - CommonCryptor - label - CommonCryptor - - - cell - PSSwitchCell - default - - defaults - naville.wtfjh - key - CommonDigest - label - CommonDigest - - - cell - PSSwitchCell - default - - defaults - naville.wtfjh - key - CommonHMAC - label - CommonHMAC - - - cell - PSSwitchCell - default - - defaults - naville.wtfjh - key - CommonKeyDerivation - label - CommonKeyDerivation - - - cell - PSSwitchCell - default - - defaults - naville.wtfjh - key - CoreTelephony - label - CoreTelephony - - - cell - PSSwitchCell - default - - defaults - naville.wtfjh - key - dlfcn - label - dlfcn - - - cell - PSSwitchCell - default - - defaults - naville.wtfjh - key - Keychain - label - Keychain - - - cell - PSSwitchCell - default - - defaults - naville.wtfjh - key - libC - label - libC - - - cell - PSSwitchCell - default - - defaults - naville.wtfjh - key - libMobileGestalt - label - libMobileGestalt - - - cell - PSSwitchCell - default - - defaults - naville.wtfjh - key - NSData - label - NSData - - - cell - PSSwitchCell - default - - defaults - naville.wtfjh - key - NSFileHandle - label - NSFileHandle - - - cell - PSSwitchCell - default - - defaults - naville.wtfjh - key - NSFileManager - label - NSFileManager - - - cell - PSSwitchCell - default - - defaults - naville.wtfjh - key - NSHTTPCookie - label - NSHTTPCookie - - - cell - PSSwitchCell - default - - defaults - naville.wtfjh - key - NSInputStream - label - NSInputStream - - - cell - PSSwitchCell - default - - defaults - naville.wtfjh - key - NSKeyedArchiver - label - NSKeyedArchiver - - - cell - PSSwitchCell - default - - defaults - naville.wtfjh - key - NSKeyedUnarchiver - label - NSKeyedUnarchiver - - - cell - PSSwitchCell - default - - defaults - naville.wtfjh - key - NSOutputStream - label - NSOutputStream - - - cell - PSSwitchCell - default - - defaults - naville.wtfjh - key - NSURLConnection - label - NSURLConnection - - - cell - PSSwitchCell - default - - defaults - naville.wtfjh - key - NSURLCredential - label - NSURLCredential - - - cell - PSSwitchCell - default - - defaults - naville.wtfjh - key - NSURLSession - label - NSURLSession - - - cell - PSSwitchCell - default - - defaults - naville.wtfjh - key - NSUserDefaults - label - NSUserDefaults - - - cell - PSSwitchCell - default - - defaults - naville.wtfjh - key - NSXMLParser - label - NSXMLParser - - - cell - PSSwitchCell - default - - defaults - naville.wtfjh - key - Security - label - Security - - - cell - PSSwitchCell - default - - defaults - naville.wtfjh - key - SSLKillSwitch - label - SSLKillSwitch - - - cell - PSSwitchCell - default - - defaults - naville.wtfjh - key - UIPasteboard - label - UIPasteboard - - - cell - PSSwitchCell - default - - defaults - naville.wtfjh - key - FclBlowfish - label - FclBlowfish - - - cell - PSSwitchCell - default - - defaults - naville.wtfjh - key - OpenSSLAES - label - OpenSSLAES - - - cell - PSSwitchCell - default - - defaults - naville.wtfjh - key - OpenSSLBlowFish - label - OpenSSLBlowFish - - - cell - PSSwitchCell - default - - defaults - naville.wtfjh - key - OpenSSLMD5 - label - OpenSSLMD5 - - - cell - PSSwitchCell - default - - defaults - naville.wtfjh - key - OpenSSLSHA1 - label - OpenSSLSHA1 - - - cell - PSSwitchCell - default - - defaults - naville.wtfjh - key - OpenSSLSHA512 - label - OpenSSLSHA512 - - - cell - PSGroupCell - footerText - https://github.com/Naville/WTFJH - - - title - WTFJH - - diff --git a/obj b/obj deleted file mode 120000 index ab9619e..0000000 --- a/obj +++ /dev/null @@ -1 +0,0 @@ -./.theos/obj \ No newline at end of file diff --git a/theos b/theos deleted file mode 120000 index e30945d..0000000 --- a/theos +++ /dev/null @@ -1 +0,0 @@ -/opt/theos \ No newline at end of file