saswatanand / ella Goto Github PK
View Code? Open in Web Editor NEWBinary Instrumentation of Android Apps
Binary Instrumentation of Android Apps
I find that the readme file says: "It can also record time-stamped trace of executed methods, values of arguments passed at call-sites, values of formal parameters of methods, etc.", but I don't find how to get it?
Would you please to share the configuration for that? Thank you very much!
Information
Apktool Version (apktool -version) - 2.3.4
Operating System (Mac, Linux, Windows) - Ubuntu 16.04 LTE
APK From? (Playstore, ROM, Other) - Other
Stacktrace/Logcat
[java] Caused by: org.jf.util.ExceptionWithContext: debug info items must have non-decreasing code addresses
[java] at org.jf.dexlib2.writer.DebugWriter.writeLineNumber(DebugWriter.java:111)
[java] at org.jf.dexlib2.writer.pool.ClassPool.writeDebugItem(ClassPool.java:506)
[java] at org.jf.dexlib2.writer.DexWriter.writeDebugItem(DexWriter.java:849)
[java] at org.jf.dexlib2.writer.DexWriter.writeDebugAndCodeItems(DexWriter.java:757)
[java] at org.jf.dexlib2.writer.DexWriter.writeTo(DexWriter.java:214)
[java] at org.jf.dexlib2.writer.DexWriter.writeTo(DexWriter.java:192)
[java] at org.jf.dexlib2.writer.pool.DexPool.writeTo(DexPool.java:90)
[java] at org.jf.dexlib2.DexFileFactory.writeDexFile(DexFileFactory.java:115)
Steps
Issue occurs while trying to write the instrumented[Ella https://github.com/saswatanand/ella ] file into dex again.
$HOME/ella-master/build.xml:49: The following error occurred while executing this line:
$HOME/ella-master/runtime/build.xml:36: Execute failed: java.io.IOException: Cannot run program "dx" (in directory "$HOME/ella-master/runtime"): error=2, No such file or directory
at java.lang.ProcessBuilder.start(ProcessBuilder.java:1048)
at java.lang.Runtime.exec(Runtime.java:620)
at org.apache.tools.ant.taskdefs.launcher.Java13CommandLauncher.exec(Java13CommandLauncher.java:58)
at org.apache.tools.ant.taskdefs.Execute.launch(Execute.java:428)
at org.apache.tools.ant.taskdefs.Execute.spawn(Execute.java:499)
at org.apache.tools.ant.taskdefs.ExecTask.runExecute(ExecTask.java:651)
at org.apache.tools.ant.taskdefs.ExecTask.runExec(ExecTask.java:670)
at org.apache.tools.ant.taskdefs.ExecTask.execute(ExecTask.java:496)
at org.apache.tools.ant.UnknownElement.execute(UnknownElement.java:293)
at sun.reflect.GeneratedMethodAccessor4.invoke(Unknown Source)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
at java.lang.reflect.Method.invoke(Method.java:497)
at org.apache.tools.ant.dispatch.DispatchUtils.execute(DispatchUtils.java:106)
at org.apache.tools.ant.Task.perform(Task.java:348)
at org.apache.tools.ant.Target.execute(Target.java:435)
at org.apache.tools.ant.Target.performTasks(Target.java:456)
at org.apache.tools.ant.Project.executeSortedTargets(Project.java:1405)
at org.apache.tools.ant.helper.SingleCheckExecutor.executeTargets(SingleCheckExecutor.java:38)
at org.apache.tools.ant.Project.executeTargets(Project.java:1260)
at org.apache.tools.ant.taskdefs.Ant.execute(Ant.java:441)
at org.apache.tools.ant.UnknownElement.execute(UnknownElement.java:293)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
at java.lang.reflect.Method.invoke(Method.java:497)
at org.apache.tools.ant.dispatch.DispatchUtils.execute(DispatchUtils.java:106)
at org.apache.tools.ant.Task.perform(Task.java:348)
at org.apache.tools.ant.Target.execute(Target.java:435)
at org.apache.tools.ant.Target.performTasks(Target.java:456)
at org.apache.tools.ant.Project.executeSortedTargets(Project.java:1405)
at org.apache.tools.ant.Project.executeTarget(Project.java:1376)
at org.apache.tools.ant.helper.DefaultExecutor.executeTargets(DefaultExecutor.java:41)
at org.apache.tools.ant.Project.executeTargets(Project.java:1260)
at org.apache.tools.ant.Main.runBuild(Main.java:853)
at org.apache.tools.ant.Main.startAnt(Main.java:235)
at org.apache.tools.ant.launch.Launcher.run(Launcher.java:285)
at org.apache.tools.ant.launch.Launcher.main(Launcher.java:112)
Caused by: java.io.IOException: error=2, No such file or directory
at java.lang.UNIXProcess.forkAndExec(Native Method)
at java.lang.UNIXProcess.(UNIXProcess.java:248)
at java.lang.ProcessImpl.start(ProcessImpl.java:134)
at java.lang.ProcessBuilder.start(ProcessBuilder.java:1029)
... 36 more
Total time: 0 seconds
The ant build command
ant -f frontend/build.xml deploy
returns this error...
ella/frontend/build.xml:73: java.net.MalformedURLException: no protocol:
tomcat/deploy?path=%2Fella&war=%2FUsers%2FAlex%2FDesktop%2FDevelopment%2Fsrc%2Fella%2Fbin%2Fella.war&update=true
I'm running on mac 10.9 and set my tomcat.url=http:///localhost:8080.
I can set up and run tomcat on at this address independently of ella. Do you know what might be causing this error? Thanks!
In server/src/com/apposcopy/ella/server/Server.java
near line 131, findMessageBreak
is only used to find breaks within newly read data. This might not work all the time, consider the example {...}\r\n|||\r\n{...}\r\n\r\n
where |||
indicates the boundary of data read in the first and second time. In this case, findMessageBreak
can only find the second message break, and {...}\r\n\r\n{...}
will be fed to Gson, causing parsing problems.
A quick fix would be:
int prefix = Math.min(3, offset);
int splitByte = findMessageBreak(buf, offset - prefix, read + prefix);
So that findMessageBreak
will be able to also consider at most 3 characters (\r\n\r
) before the newly arrived data, which is enough to cover the problematic situations.
Hope this helps.
When I use the command ella.sh i , I got the following error:
Error: Could not find or load main class Testing.ella.bin.ella.server.jar
What could be the reason?
Is there a away to instrument an apk, run it, collect coverage files and analyze them by some scripts? When many apks need to deal with, it is not good to check every result on a web-server.
Thanks a lot
Hi,
Thank you for contributing this useful tool : )
I tried to instrument several popular apps on Google Play and encountered similar problems:
The command line:
Exception in thread "main" java.lang.Error: Error occurred while instrumenting. exit code is 1
at com.apposcopy.ella.EllaLauncher.instrument(EllaLauncher.java:259)
at com.apposcopy.ella.EllaLauncher.main(EllaLauncher.java:23)
The log.txt file:
Exception in thread "main" java.lang.Error: Error in repackaging the apk.
at com.apposcopy.app.App.updateApk(App.java:208)
at com.apposcopy.ella.Main.main(Main.java:42)
Sample apps for repeating the error(s):
Thanks!
Hi there,
I have tried to built the ella for a few days, however it seems like it is not working. My error is the same as the other issue page:
(#12)
I have tried to build Ella on my Mac and also on a ubuntu server which is running 20.04.
I have installed all the requested environment.
And then I run the ant command on the ella directory, it shows this error message:
ant
Buildfile: /Users/sioyoo/tools/ella/build.xml
create-keystore:
init:
build:
init:
compile:
jar:
init:
[javac] /Users/sioyoo/tools/ella/runtime/build.xml:15: warning: 'includeantruntime' was not set, defaulting to build.sysclasspath=last; set to false for repeatable builds
BUILD FAILED
/Users/sioyoo/tools/ella/build.xml:49: The following error occurred while executing this line:
/Users/sioyoo/tools/ella/runtime/build.xml:21: java.lang.RuntimeException: The executable 'android' is not in the path
at GuessDefaultSettingsTask.findAndroidSDKPath(GuessDefaultSettingsTask.java:46)
at GuessDefaultSettingsTask.execute(GuessDefaultSettingsTask.java:11)
at org.apache.tools.ant.UnknownElement.execute(UnknownElement.java:299)
at java.base/jdk.internal.reflect.DirectMethodHandleAccessor.invoke(DirectMethodHandleAccessor.java:104)
at java.base/java.lang.reflect.Method.invoke(Method.java:577)
at org.apache.tools.ant.dispatch.DispatchUtils.execute(DispatchUtils.java:99)
at org.apache.tools.ant.Task.perform(Task.java:350)
at org.apache.tools.ant.Target.execute(Target.java:449)
at org.apache.tools.ant.Target.performTasks(Target.java:470)
at org.apache.tools.ant.Project.executeSortedTargets(Project.java:1401)
at org.apache.tools.ant.helper.SingleCheckExecutor.executeTargets(SingleCheckExecutor.java:36)
at org.apache.tools.ant.Project.executeTargets(Project.java:1264)
at org.apache.tools.ant.taskdefs.Ant.execute(Ant.java:437)
at org.apache.tools.ant.UnknownElement.execute(UnknownElement.java:299)
at java.base/jdk.internal.reflect.DirectMethodHandleAccessor.invoke(DirectMethodHandleAccessor.java:104)
at java.base/java.lang.reflect.Method.invoke(Method.java:577)
at org.apache.tools.ant.dispatch.DispatchUtils.execute(DispatchUtils.java:99)
at org.apache.tools.ant.Task.perform(Task.java:350)
at org.apache.tools.ant.Target.execute(Target.java:449)
at org.apache.tools.ant.Target.performTasks(Target.java:470)
at org.apache.tools.ant.Project.executeSortedTargets(Project.java:1401)
at org.apache.tools.ant.Project.executeTarget(Project.java:1374)
at org.apache.tools.ant.helper.DefaultExecutor.executeTargets(DefaultExecutor.java:41)
at org.apache.tools.ant.Project.executeTargets(Project.java:1264)
at org.apache.tools.ant.Main.runBuild(Main.java:818)
at org.apache.tools.ant.Main.startAnt(Main.java:223)
at org.apache.tools.ant.launch.Launcher.run(Launcher.java:284)
at org.apache.tools.ant.launch.Launcher.main(Launcher.java:101)
Total time: 0 seconds
However I have set the path for Android.jar and also the android build tool in the ella.settings file
#Copy this file to a file named "ella.settings"
# and change that file if necessary
# set to "true" if the instrumented app will be executed on an emulator *AND*
# the ella server will be run on the host machine of the emulator.
# otherwise set to "false"
ella.use.emulator.host.loopback=true
# if ella.use.emulator.host.loopback is set to "false" *AND*
# ella server will be running on a machine that is different
# from the machine on which instrumentor is run, then set
# the following to the IP address of the machine on which
# the ella server will be run
#ella.server.ip=1.2.3.4
#port number that ella server is listening on
ella.server.port=23745
# directory where ella stores coverage data and other stuff
ella.outdir=ella-out
ella.instrumentor=com.apposcopy.ella.MethodCoverageInstrumentor
#ella.instrumentor=com.apposcopy.ella.CallArgInstrumentor,com.apposcopy.ella.MethodParamInstrumentor
# generate a trace that can be fed to traceview toold
ella.android.debug=false
# file that list names of classes that are excluded from instrumentation
ella.exclude=ella-exclude.txt
# max heap space given to JVM running the instrumentor
ella.instrumentor.max.heapsize=2g
# max heap space given to JVM running the server
ella.server.max.heapsize=2g
# path to "build-tools" inside android SDK
# in default setting, the path is estimated
#ella.android.buildtools.dir=/opt/android-sdk-linux/build-tools/22.0.1/
# android jar to compile (ella runtime library) against
# in default setting, the path is estimated
#ella.android.jar=/opt/android-sdk-linux/platforms/android-19/android.jar
# settings used by jarsigner to sign the instrumented apk
ella.jarsigner.keystore=.android/debug.keystore
ella.jarsigner.storepass=android
ella.jarsigner.keypass=android
ella.jarsigner.alias=androiddebugkey
ella.android.buildtools.dir=~/Library/Android/sdk/build-tools/32.0.0
ella.android.jar=~/Library/Android/sdk/platforms/android-32/android.jar
In the last two lines with the path to these two files.
Could anyone please help me solve this problem?
Hello,
After executing ella.i.sh , I got these errors:
Maria@XXX-PC ~/Desktop/ELLA/NEW/ella-master
$ ella.i.sh com.danielfritzsch.temperatureconverter.apk
Exception in thread "main" java.io.FileNotFoundException: c:\Users\Maria\Desktop
\ELLA\NEW\ella-master\ella.settings (O sistema não pode encontrar o arquivo espe
cificado)
at java.io.FileInputStream.open(Native Method)
at java.io.FileInputStream.(Unknown Source)
at java.io.FileInputStream.(Unknown Source)
at com.apposcopy.ella.Config.load(Config.java:38)
at com.apposcopy.ella.Main.main(Main.java:44)
Would you can help me, please?
Thanks,
Maria
Hello!
./ella.sh i /home/node1/Downloads/Ella\ -\ IC\ Airton/apks/facebook.apk
Unrecognized option: -
Error: Could not create the Java Virtual Machine.
Hi,
When instrumenting the app using "ella.sh i" command, I got an error saying java.io.FileNotFoundException: /home/myname/ella/bin/ella.runtime.dex (No such file or directory). After checking for "ella.runtime.dex" on the respected directory on my PC and on github, I couldnt find the file. An APK was created in the ella-out, although i'm not sure if that was properly instrumented or not.
Can I ignore this error or is there something that I missed?
Thanks
EB
I set exact path of android but still error.
I added the below two lines
ella.android.buildtools.dir=~/Android/Sdk/build-tools/29.0.2/
ella.android.jar=~/Android/Sdk/platforms/android-29/android.jar
Error from command 'ant'
`Buildfile: /home/kjkpoi/ella/build.xml
create-keystore:
init:
build:
init:
compile:
jar:
init:
[javac] /home/kjkpoi/ella/runtime/build.xml:15: warning: 'includeantruntime' was not set, defaulting to build.sysclasspath=last; set to false for repeatable builds
BUILD FAILED
/home/kjkpoi/ella/build.xml:49: The following error occurred while executing this line:
/home/kjkpoi/ella/runtime/build.xml:21: java.lang.RuntimeException: The executable 'android' is not in the path
at GuessDefaultSettingsTask.findAndroidSDKPath(GuessDefaultSettingsTask.java:46)
at GuessDefaultSettingsTask.execute(GuessDefaultSettingsTask.java:11)
at org.apache.tools.ant.UnknownElement.execute(UnknownElement.java:292)
at sun.reflect.GeneratedMethodAccessor4.invoke(Unknown Source)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
at java.lang.reflect.Method.invoke(Method.java:498)
at org.apache.tools.ant.dispatch.DispatchUtils.execute(DispatchUtils.java:99)
at org.apache.tools.ant.Task.perform(Task.java:350)
at org.apache.tools.ant.Target.execute(Target.java:449)
at org.apache.tools.ant.Target.performTasks(Target.java:470)
at org.apache.tools.ant.Project.executeSortedTargets(Project.java:1388)
at org.apache.tools.ant.helper.SingleCheckExecutor.executeTargets(SingleCheckExecutor.java:36)
at org.apache.tools.ant.Project.executeTargets(Project.java:1251)
at org.apache.tools.ant.taskdefs.Ant.execute(Ant.java:437)
at org.apache.tools.ant.UnknownElement.execute(UnknownElement.java:292)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
at java.lang.reflect.Method.invoke(Method.java:498)
at org.apache.tools.ant.dispatch.DispatchUtils.execute(DispatchUtils.java:99)
at org.apache.tools.ant.Task.perform(Task.java:350)
at org.apache.tools.ant.Target.execute(Target.java:449)
at org.apache.tools.ant.Target.performTasks(Target.java:470)
at org.apache.tools.ant.Project.executeSortedTargets(Project.java:1388)
at org.apache.tools.ant.Project.executeTarget(Project.java:1361)
at org.apache.tools.ant.helper.DefaultExecutor.executeTargets(DefaultExecutor.java:41)
at org.apache.tools.ant.Project.executeTargets(Project.java:1251)
at org.apache.tools.ant.Main.runBuild(Main.java:834)
at org.apache.tools.ant.Main.startAnt(Main.java:223)
at org.apache.tools.ant.launch.Launcher.run(Launcher.java:284)
at org.apache.tools.ant.launch.Launcher.main(Launcher.java:101)
`
It seems that current implementation supports instrumenting only one dex in an app.
A declarative, efficient, and flexible JavaScript library for building user interfaces.
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google ❤️ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.