From 724abb8829c6fd8cf8a6ca08671b576ab42375e2 Mon Sep 17 00:00:00 2001 From: 2eddeed Date: Mon, 16 Mar 2020 00:20:35 +0100 Subject: [PATCH] diff+exported --- README.md | 5 +++-- Tickler.conf | 2 +- src/main/java/actions/Comparer.java | 5 ++++- src/main/java/base/DOMXMLReader.java | 17 ++++++++++------- src/main/java/base/FileUtil.java | 5 +++++ src/main/java/frida/FridaSetValue.java | 14 ++++++++++++-- 6 files changed, 35 insertions(+), 13 deletions(-) diff --git a/README.md b/README.md index 7e3ec05..dded3a9 100644 --- a/README.md +++ b/README.md @@ -215,8 +215,9 @@ In case of vals and set options, Frida creates/updates a Frida script of that fu ## Modify Arguments or Return Value java -jar AndroTickler.jar -pkg -frida set [-reuse] -Sets the argument number *NumberOfArgToModify* to *newValue* (only primitive datatypes and String). *NumberOfArgToModify* starts with 0: First argument --> arg number 0 -If *NumberOfArgToModify* >= *NumberOfArgs*: sets the return value +Sets the argument number *NumberOfArgToModify* to *newValue* (only primitive datatypes and String). +*NumberOfArgToModify* starts with 0: First argument --> NumberOfArgToModify = 0, ...etc +To modify return value --> set NumberOfArgToModify to *ret* ## Run JS Frida script diff --git a/Tickler.conf b/Tickler.conf index 00c3c8f..e82560c 100644 --- a/Tickler.conf +++ b/Tickler.conf @@ -1,3 +1,3 @@ Tickler_local_directory = Tickler_sdcard_directory = /sdcard/Tickler/ -Frida_server_path = /data/local/tmp/frida-server-10.3.14-android-arm +Frida_server_path = /data/local/tmp/frida-server diff --git a/src/main/java/actions/Comparer.java b/src/main/java/actions/Comparer.java index a5080c5..9c92481 100755 --- a/src/main/java/actions/Comparer.java +++ b/src/main/java/actions/Comparer.java @@ -72,8 +72,11 @@ public void diff(boolean detailed) { this.dataDirOld = this.storageOld+TicklerConst.DATA_DIR_NAME; this.extDirOld = this.storageOld+TicklerConst.EXTERNAL_STORAGE_Dir; + String old_storage=TicklerConst.DIFF_OLD_STORAGE.substring(0, TicklerConst.DIFF_OLD_STORAGE.length()-1); + this.clearDataDirs(); - this.copyz.copyStorage(TicklerConst.DIFF_OLD_STORAGE); +// this.copyz.copyStorage(TicklerConst.DIFF_OLD_STORAGE); + this.copyz.copyStorage(old_storage); System.out.println("\n\n>>>>>>>>>>>>>>>> Go crazy then press Enter to compare data directories....\n"); OtherUtil.pressAnyKeySilent(); diff --git a/src/main/java/base/DOMXMLReader.java b/src/main/java/base/DOMXMLReader.java index 23b9d1c..a229bd1 100644 --- a/src/main/java/base/DOMXMLReader.java +++ b/src/main/java/base/DOMXMLReader.java @@ -189,13 +189,7 @@ private IComponent parseIComponent(Node node,IComponent compy) { compy.setName(element.getAttribute("android:name")); compy.setPermission(element.getAttribute("android:permission")); - if(element.hasAttribute("android:exported") && element.getAttribute("android:exported").toLowerCase().equals("true")) { - compy.setExported(true); - } - else - compy.setExported(false); - - + //Intent Filters @@ -208,6 +202,15 @@ private IComponent parseIComponent(Node node,IComponent compy) { compy.setIntent(intFilList); + //Exported + if((element.hasAttribute("android:exported") && element.getAttribute("android:exported").toLowerCase().equals("true")) || ! intFilList.isEmpty() ) { + compy.setExported(true); + } + else + compy.setExported(false); + + + } return compy; diff --git a/src/main/java/base/FileUtil.java b/src/main/java/base/FileUtil.java index 456c5ac..92e2ea8 100755 --- a/src/main/java/base/FileUtil.java +++ b/src/main/java/base/FileUtil.java @@ -289,6 +289,7 @@ public void copyDirToHost(String src,String dest,boolean silent) { String srcName = this.getFileNameFromPath(src); this.deleteDirFromDevice(TicklerVars.sdCardPath+srcName); this.copyOnDevice(src, TicklerVars.sdCardPath); + this.prepareDestination(dest); this.pullFromSDcard(TicklerVars.sdCardPath+srcName, dest+"/"); File f = new File(TicklerVars.sdCardPath+srcName); //Clean (uncommented) @@ -341,6 +342,10 @@ public String prepareTimestampTransfer(){ return timestamp; } + private void prepareDestination(String dst) { + File destFile = new File(dst); + this.createDirOnHost(dst); + } diff --git a/src/main/java/frida/FridaSetValue.java b/src/main/java/frida/FridaSetValue.java index fa635f9..70210a4 100755 --- a/src/main/java/frida/FridaSetValue.java +++ b/src/main/java/frida/FridaSetValue.java @@ -73,15 +73,18 @@ private String prepareCode(ArrayList args){ tempCode = tempCode.replaceAll("\\$args", methodArguments); - int numberOfTarget = new Integer(args.get(4)); + + + String newValue = this.correctStringsInArgs(args.get(5)); - if (numberOfTarget>=numberOfArgs) { + if (this.isSetReturnValue(args.get(4))) { //Modify return value tempCode = tempCode.replaceAll("\\$returnValue", newValue); tempCode = tempCode.replaceAll("\\$output_line", "console.log(\"Old return value: \"+orig_return.toString()+ \". New return value: \"+"+newValue+");"); } else { + int numberOfTarget = new Integer(args.get(4)); //Modify an argument String newArgs = this.getNewArgs(numberOfArgs,numberOfTarget,newValue); tempCode = tempCode.replaceAll("\\$returnValue", "this."+args.get(2)+newArgs); @@ -130,4 +133,11 @@ private String getNewArgs(int totalNumOfArgs, int argNum, String value){ } + private boolean isSetReturnValue(String arg4) { + if (arg4.equals("ret")) + return true; + + return false; + } + }