[Soot-list] A problem when processing many apks in a loop

潘临杰 pangeneral at foxmail.com
Tue Mar 20 08:10:39 EDT 2018


Hello everyone.

I got an exception while trying to process apks in a loop. The exception is "timer totalTimer has already been started!"


The code is as following:


public void analyzeAllApk(String basePath) {
	File folder = new File(basePath);
	String[] filelist = folder.list();
	for (int i = 0; i < filelist.length; i++) 
		analyzeApk(folder + File.separator + filelist[i]);
}


public void analyzeApk(String filePath){
	Options.v().set_src_prec(Options.src_prec_apk);
	Options.v().set_output_format(Options.output_format_jimple);


	String[] soot_args = new String[4];
	soot_args[0] = "-process-dir";
	soot_args[1] = filePath;
	soot_args[2] = "-android-jars";
	soot_args[3] = "D:\\download\\soot-path\\android-platforms-master\\";
	
	Pack p1 = PackManager.v().getPack("jtp");
	String phaseName="jtp."+filePath;
	Transform t1 = new Transform(phaseName,new BodyTransformer(){
		@Override
		protected void internalTransform(Body b, String phaseName,
			Map<String, String> options) {
		      // TODO Auto-generated method stub
		}
	});
	p1.add(t1);
	soot.Main.main(soot_args);
}



I just want to process all the apks under the basePath. 


I hope someone can help me solve the problem.


Thank you.


Linjie Pan.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://mailman.CS.McGill.CA/pipermail/soot-list/attachments/20180320/06da21df/attachment.html>


More information about the Soot-list mailing list