Skip to content

Commit

Permalink
diff+exported
Browse files Browse the repository at this point in the history
  • Loading branch information
2eldeed committed Mar 15, 2020
1 parent a241ac7 commit 724abb8
Show file tree
Hide file tree
Showing 6 changed files with 35 additions and 13 deletions.
5 changes: 3 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -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 <package> -frida set <ClassName> <MethodName> <NumberOfArgs> <NumberOfArgToModify> <newValue>[-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
Expand Down
2 changes: 1 addition & 1 deletion Tickler.conf
Original file line number Diff line number Diff line change
@@ -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
5 changes: 4 additions & 1 deletion src/main/java/actions/Comparer.java
Original file line number Diff line number Diff line change
Expand Up @@ -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();
Expand Down
17 changes: 10 additions & 7 deletions src/main/java/base/DOMXMLReader.java
Original file line number Diff line number Diff line change
Expand Up @@ -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

Expand All @@ -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;
Expand Down
5 changes: 5 additions & 0 deletions src/main/java/base/FileUtil.java
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down Expand Up @@ -341,6 +342,10 @@ public String prepareTimestampTransfer(){
return timestamp;
}

private void prepareDestination(String dst) {
File destFile = new File(dst);
this.createDirOnHost(dst);
}



Expand Down
14 changes: 12 additions & 2 deletions src/main/java/frida/FridaSetValue.java
Original file line number Diff line number Diff line change
Expand Up @@ -73,15 +73,18 @@ private String prepareCode(ArrayList<String> 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);
Expand Down Expand Up @@ -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;
}

}

0 comments on commit 724abb8

Please sign in to comment.