diff --git a/.travis.yml b/.travis.yml index 7bad3e3..5a6e789 100644 --- a/.travis.yml +++ b/.travis.yml @@ -7,4 +7,4 @@ before_install: - clear - export THEOS=/opt/theos -script: "sudo python ./CIScripts/get-pip.py && ./Setup.sh && ./CIScripts/InstallTheos.sh &&./build.py DEBUG" \ No newline at end of file +script: "sudo python ./CIScripts/get-pip.py && ./Setup.sh && ./CIScripts/InstallTheos.sh &&./build.py DEBUG && cat STDOUT.log && cat STDERR.log" \ No newline at end of file diff --git a/Hooks/API/Socket.xm b/Hooks/API/Socket.xm index d999127..2bc32d1 100644 --- a/Hooks/API/Socket.xm +++ b/Hooks/API/Socket.xm @@ -8,12 +8,7 @@ int getpeername(int, struct sockaddr * __restrict, socklen_t * __restrict) int getsockname(int, struct sockaddr * __restrict, socklen_t * __restrict) __DARWIN_ALIAS(getsockname); int getsockopt(int, int, int, void * __restrict, socklen_t * __restrict); - ssize_t - recvfrom(int socket, void *restrict buffer, size_t length, int flags, - struct sockaddr *restrict address, socklen_t *restrict address_len); - ssize_t - recvmsg(int socket, struct msghdr *message, int flags); ssize_t @@ -64,6 +59,23 @@ static NSString* get_ip_str(const struct sockaddr *sa) } } +static NSMutableDictionary* GetInfoFormsghdr(struct msghdr* message){ + NSMutableDictionary* RetDict=[NSMutableDictionary dictionary]; + if(message->msg_name!=NULL){ + [RetDict setObject:get_ip_str((const struct sockaddr *)message->msg_name) forKey:@"MessageName"]; + } + NSMutableArray* iovecArray=[[NSMutableArray array] autorelease]; + if(message->msg_iov!=NULL && message->msg_iovlen>0){ + for (int i = 0; i < message->msg_iovlen; i++) { + struct iovec currentIOVEC=message->msg_iov[i]; + [iovecArray addObject:[NSData dataWithBytes:currentIOVEC.iov_base length:currentIOVEC.iov_len]]; + } + } + [RetDict setObject:iovecArray forKey:@"IOVEC"]; + [RetDict setObject:[NSData dataWithBytes:message->msg_control length:message->msg_controllen] forKey:@"Data"]; + [RetDict setObject:[NSNumber numberWithInt:message->msg_flags] forKey:@"flags"]; + return RetDict; +} //Old Pointers int (*old_socket)(int domain, int type, int protocol); @@ -72,7 +84,8 @@ int (*old_bind)(int, struct sockaddr *, socklen_t); int (*old_connect)(int, const struct sockaddr *, socklen_t); int (*old_listen)(int, int); ssize_t (*old_recv)(int socket, void *buffer, size_t length, int flags); - +ssize_t (*old_recvfrom)(int socket, void *buffer, size_t length,int flags,struct sockaddr *address,socklen_t * addresslen); +ssize_t (*old_recvmsg)(int socket, struct msghdr *message, int flags); //New Functions int new_socket(int domain, int type, int protocol){ int descriptor=old_socket(domain,type,protocol); @@ -189,6 +202,48 @@ ssize_t new_recv(int socket, void *buffer, size_t length, int flags){ } return retVal; } +ssize_t new_recvfrom(int socket, void *buffer, size_t length, int flags,struct sockaddr *address, socklen_t *address_len){ + ssize_t retVal=0; + if(WTShouldLog){ + retVal=old_recvfrom(socket,buffer,length,flags,address,address_len); + WTInit(@"Socket",@"recvfrom"); + WTAdd([NSNumber numberWithUnsignedInt:socket],@"SocketFileDescriptor"); + WTAdd([NSData dataWithBytes:buffer length:length],@"Data"); + WTAdd([NSNumber numberWithInt:flags],@"Flags"); + WTAdd(get_ip_str(address),@"Address"); + WTReturn([NSNumber numberWithLong:retVal]); + WTSave; + WTRelease; + + } + else{ + retVal=old_recvfrom(socket,buffer,length,flags,address,address_len); + } + return retVal; + + + +} +ssize_t new_recvmsg(int socket, struct msghdr *message, int flags){ + ssize_t retVal=0; + if(WTShouldLog){ + retVal=old_recvmsg(socket,message,flags); + WTInit(@"Socket",@"recvmsg"); + WTAdd([NSNumber numberWithUnsignedInt:socket],@"SocketFileDescriptor"); + + WTAdd([NSNumber numberWithInt:flags],@"Flags"); + WTAdd(GetInfoFormsghdr(message),@"Address"); + WTReturn([NSNumber numberWithLong:retVal]); + WTSave; + WTRelease; + + } + else{ + retVal=old_recvmsg(socket,message,flags); + } + return retVal; + +} extern void init_Socket_hook() { WTHookFunction((void*)socket,(void*)new_socket, (void**)&old_socket); WTHookFunction((void*)accept,(void*)new_accept, (void**)&old_accept); @@ -196,4 +251,5 @@ extern void init_Socket_hook() { WTHookFunction((void*)connect,(void*)new_connect, (void**)&old_connect); WTHookFunction((void*)listen,(void*)new_listen, (void**)&old_listen); WTHookFunction((void*)recv,(void*)new_recv, (void**)&old_recv); + WTHookFunction((void*)recvfrom,(void*)new_recvfrom, (void**)&old_recvfrom); } diff --git a/Makefile b/Makefile index 933f747..2dade41 100644 --- a/Makefile +++ b/Makefile @@ -1,13 +1,13 @@ -export CFLAGS=-Wp,"-DWTFJHTWEAKNAME=@\"NH919IJFS93JT68\","-DWTFJHHostName=@\"NavRMBP\" +export CFLAGS=-Wp,"-DWTFJHTWEAKNAME=@\"SIY616KCGLYUR1L\","-DWTFJHHostName=@\"NavRMBP\" include $(THEOS)/makefiles/common.mk -TWEAK_NAME = NH919IJFS93JT68 +TWEAK_NAME = SIY616KCGLYUR1L SUBSTRATE ?= yes -NH919IJFS93JT68_FILES = Tweak.xm CompileDefines.xm Hooks/API/AppleAccount.xm Hooks/API/CommonCryptor.xm Hooks/API/CommonDigest.xm Hooks/API/CommonHMAC.xm Hooks/API/CommonKeyDerivation.xm Hooks/API/CoreTelephony.xm Hooks/API/dlfcn.xm Hooks/API/Keychain.xm Hooks/API/libC.xm Hooks/API/libMobileGestalt.xm Hooks/API/LSApplication.xm Hooks/API/MachO.xm Hooks/API/Notification.xm Hooks/API/NSData.xm Hooks/API/NSFileHandle.xm Hooks/API/NSFileManager.xm Hooks/API/NSHTTPCookie.xm Hooks/API/NSInputStream.xm Hooks/API/NSKeyedArchiver.xm Hooks/API/NSKeyedUnarchiver.xm Hooks/API/NSOutputStream.xm Hooks/API/NSProcessInfo.xm Hooks/API/NSURLConnection.xm Hooks/API/NSURLCredential.xm Hooks/API/NSURLSession.xm Hooks/API/NSUserDefaults.xm Hooks/API/NSXMLParser.xm Hooks/API/ObjCRuntime.xm Hooks/API/Security.xm Hooks/API/Socket.xm Hooks/API/SSLKillSwitch.xm Hooks/API/sysctl.xm Hooks/API/UIPasteboard.xm Hooks/SDK/FclBlowfish.xm Hooks/SDK/JSPatch.xm Hooks/SDK/OpenSSLAES.xm Hooks/SDK/OpenSSLBlowFish.xm Hooks/SDK/OpenSSLMD5.xm Hooks/SDK/OpenSSLSHA1.xm Hooks/SDK/OpenSSLSHA512.xm Hooks/SDK/Reveal.xm Hooks/SDK/Wax.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/RemoteLogSender.m Hooks/Utils/RuntimeUtils.m Hooks/Utils/SQLiteStorage.m Hooks/Utils/Utils.m Hooks/ThirdPartyTools/classdumpdyld.xm Hooks/ThirdPartyTools/dumpdecrypted.xm Hooks/ThirdPartyTools/InspectiveC.xm Hooks/Misc/Cycript.xm Hooks/Misc/fishhook.c Hooks/Misc/RemoveASLR.xm Hooks/Misc/SplitMachO.mm Hooks/Misc/WTSubstrate.mm -NH919IJFS93JT68_CCFLAGS = -Qunused-arguments -std=c++11 -NH919IJFS93JT68_LDFLAGS = -Wl,-segalign,4000,-sectcreate,WTFJH,SIGDB,./SignatureDatabase.plist,-sectcreate,WTFJH,classdumpdyld,./classdumpdyld.dylib,-sectcreate,WTFJH,dumpdecrypted,./dumpdecrypted.dylib,-sectcreate,WTFJH,InspectiveC,./InspectiveC.dylib -lz -L. -v -force_load ./ExtraFWs/libcapstone.a -force_load ./ExtraFWs/libLiberation.a -force_load ./ExtraFWs/Reveal.framework/Reveal -force_load ./ExtraFWs/Cycript.framework/Cycript -F./ExtraFWs/ -Wno-unused-function -NH919IJFS93JT68_CFLAGS = -I/Volumes/PAGEZERO/WTFJH/Hooks/ -NH919IJFS93JT68_LIBRARIES = sqlite3 substrate stdc++ c++ -NH919IJFS93JT68_FRAMEWORKS = Foundation UIKit Security JavaScriptCore UIKit CoreGraphics CoreFoundation QuartzCore CFNetwork +SIY616KCGLYUR1L_FILES = Tweak.xm CompileDefines.xm Hooks/API/AppleAccount.xm Hooks/API/CommonCryptor.xm Hooks/API/CommonDigest.xm Hooks/API/CommonHMAC.xm Hooks/API/CommonKeyDerivation.xm Hooks/API/CoreTelephony.xm Hooks/API/dlfcn.xm Hooks/API/Keychain.xm Hooks/API/libC.xm Hooks/API/libMobileGestalt.xm Hooks/API/LSApplication.xm Hooks/API/MachO.xm Hooks/API/Notification.xm Hooks/API/NSData.xm Hooks/API/NSFileHandle.xm Hooks/API/NSFileManager.xm Hooks/API/NSHTTPCookie.xm Hooks/API/NSInputStream.xm Hooks/API/NSKeyedArchiver.xm Hooks/API/NSKeyedUnarchiver.xm Hooks/API/NSOutputStream.xm Hooks/API/NSProcessInfo.xm Hooks/API/NSURLConnection.xm Hooks/API/NSURLCredential.xm Hooks/API/NSURLSession.xm Hooks/API/NSUserDefaults.xm Hooks/API/NSXMLParser.xm Hooks/API/ObjCRuntime.xm Hooks/API/Security.xm Hooks/API/Socket.xm Hooks/API/SSLKillSwitch.xm Hooks/API/sysctl.xm Hooks/API/UIPasteboard.xm Hooks/SDK/FclBlowfish.xm Hooks/SDK/JSPatch.xm Hooks/SDK/OpenSSLAES.xm Hooks/SDK/OpenSSLBlowFish.xm Hooks/SDK/OpenSSLMD5.xm Hooks/SDK/OpenSSLSHA1.xm Hooks/SDK/OpenSSLSHA512.xm Hooks/SDK/Reveal.xm Hooks/SDK/Wax.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/RemoteLogSender.m Hooks/Utils/RuntimeUtils.m Hooks/Utils/SQLiteStorage.m Hooks/Utils/Utils.m Hooks/ThirdPartyTools/classdumpdyld.xm Hooks/ThirdPartyTools/dumpdecrypted.xm Hooks/ThirdPartyTools/InspectiveC.xm Hooks/Misc/Cycript.xm Hooks/Misc/fishhook.c Hooks/Misc/RemoveASLR.xm Hooks/Misc/SplitMachO.mm Hooks/Misc/WTSubstrate.mm +SIY616KCGLYUR1L_CCFLAGS = -Qunused-arguments -std=c++11 +SIY616KCGLYUR1L_LDFLAGS = -Wl,-segalign,4000,-sectcreate,WTFJH,SIGDB,./SignatureDatabase.plist,-sectcreate,WTFJH,classdumpdyld,./classdumpdyld.dylib,-sectcreate,WTFJH,dumpdecrypted,./dumpdecrypted.dylib,-sectcreate,WTFJH,InspectiveC,./InspectiveC.dylib -lz -L. -v -force_load ./ExtraFWs/libcapstone.a -force_load ./ExtraFWs/libLiberation.a -force_load ./ExtraFWs/Reveal.framework/Reveal -force_load ./ExtraFWs/Cycript.framework/Cycript -F./ExtraFWs/ -Wno-unused-function +SIY616KCGLYUR1L_CFLAGS = -I/Volumes/PAGEZERO/WTFJH/Hooks/ +SIY616KCGLYUR1L_LIBRARIES = sqlite3 substrate stdc++ c++ +SIY616KCGLYUR1L_FRAMEWORKS = Foundation UIKit Security JavaScriptCore UIKit CoreGraphics CoreFoundation QuartzCore CFNetwork include $(THEOS_MAKE_PATH)/tweak.mk after-install:: diff --git a/VERSION b/VERSION index 3d41066..be6652a 100644 --- a/VERSION +++ b/VERSION @@ -1 +1 @@ -410 \ No newline at end of file +415 \ No newline at end of file diff --git a/build.py b/build.py index 3e050b5..348f77e 100755 --- a/build.py +++ b/build.py @@ -60,7 +60,8 @@ def Exec(Command): HostName=subprocess.check_output("hostname -s", shell=True).replace("\n","") global AllowedSourceExtension AllowedSourceExtension=[".cpp",".xm",".xmi",".mm",".c",".m",".x",".xi"] - +global theospathmid +theospathmid="//" def isSource(FileName): for End in AllowedSourceExtension: if FileName.upper().endswith(End.upper()): @@ -340,8 +341,10 @@ def ParseArgs(): SkippedList.append(z) if x.upper().startswith("HostName="): HostName=str(x[9:]) - if(DEBUG==False): + if(DEBUG==True): buildCommand="make " + global theospathmid + theospathmid="/debug/" def Obfuscation(): if OBFUSCATION==False: print "No Obfuscation" @@ -364,6 +367,8 @@ def BuildLoader(ModuleName): f.write(Template) f.close() def buildThirdPartyComponents(): + global theospathmid + global buildCommand Exec("find . -type f -name .DS_Store -delete && xattr -cr *") for x in Thirdbuildlistdir("ThirdPartyTools"): os.chdir(InitialCWD)#Make Sure CWD We've changed in buildThirdPartyComponents() is set back @@ -384,7 +389,7 @@ def buildThirdPartyComponents(): SubDirectoryPath="./ThirdPartyTools/"+x origCH=os.getcwd() os.chdir(SubDirectoryPath) - os.system("unlink theos&&rm obj&&rm -rf .theos&&ln -s $THEOS theos&&mkdir .theos && mkdir .theos/obj&&ln -s .theos/obj obj&& make&&"+"mv ./obj/debug/"+x+".dylib ../../") + os.system("unlink theos&&rm obj&&rm -rf .theos&&ln -s $THEOS theos&&mkdir .theos && mkdir .theos/obj&&ln -s .theos/obj obj&&"+buildCommand+"&&"+"mv ./obj/"+theospathmid+x+".dylib ../../") os.chdir(origCH) else: Error=None @@ -392,7 +397,7 @@ def buildThirdPartyComponents(): SubDirectoryPath="./ThirdPartyTools/"+x origCH=os.getcwd() os.chdir(SubDirectoryPath) - Error=subprocess.check_call(["unlink theos&&rm obj&&rm -rf .theos&&ln -s $THEOS theos&&mkdir .theos && mkdir .theos/obj&&ln -s .theos/obj obj&& make &&"+"mv ./obj/debug/"+x+".dylib ../../"], stdout=STDOUT, stderr=STDERR, shell=True) + Error=subprocess.check_call(["unlink theos&&rm obj&&rm -rf .theos&&ln -s $THEOS theos&&mkdir .theos && mkdir .theos/obj&&ln -s .theos/obj obj&& "+buildCommand+"&&"+"mv ./obj/"+theospathmid+x+".dylib ../../"], stdout=STDOUT, stderr=STDERR, shell=True) #sys.exit(0) os.chdir(origCH) except Exception as inst: @@ -461,7 +466,8 @@ def main(): if buildSuccess==True: os.system("mkdir -p ./layout/DEBIAN; cp ./control ./layout/DEBIAN/control") FixControlFile("./layout/DEBIAN/control") - os.system("mkdir -p ./layout/Library/MobileSubstrate/DynamicLibraries; cp ./obj/debug/" + randomTweakName + ".dylib" + " ./layout/Library/MobileSubstrate/DynamicLibraries/") + global theospathmid + os.system("mkdir -p ./layout/Library/MobileSubstrate/DynamicLibraries; cp ./obj" +theospathmid+randomTweakName + ".dylib" + " ./layout/Library/MobileSubstrate/DynamicLibraries/") os.system("cp ./WTFJH.plist" + " ./layout/Library/MobileSubstrate/DynamicLibraries/" + randomTweakName + ".plist") # Cleaning finder caches, thanks to http://stackoverflow.com/questions/2016844/bash-recursively-remove-files os.system("find . -type f -name .DS_Store -delete && xattr -cr *")