[Soot-list] Use Soot to parse annotations stored in bytecodes

Billy Mosse billy.mosse at gmail.com
Wed Apr 18 16:00:08 EDT 2018


Hello Xinxin and Bernhard, how are you? It is not working for me; I have 
included the calls:


sootOpt.set_xml_attributes(true);
sootOpt.print_tags_in_output();

before calling soot, but when I try getting the tags of a method they don't 
appear. Does anyone of you have a minimal working example by any chance?
Thanks!
Billy

El miércoles, 5 de octubre de 2016, 22:30:06 (UTC-3), Xinxin Jin escribió:
>
> Thank you very much, Bernhard ! It works !
>
> On Wed, Oct 5, 2016 at 10:48 AM, Bernhard Berger <ber... at tzi.de 
> <javascript:>> wrote:
>
>> Hi Xinxin,
>>
>> as far as I remember Jimple has no equivalent of annotations. They can be 
>> stored using the -xml-attributes or the -print-tags command line 
>> parameters. Within Soot you have to query the tags [1] to find the 
>> annotations you are interested in.
>>
>> Regards, Bernhard
>>
>> [1] https://ssebuild.cased.de/nightly/soot/javadoc/soot/tagkit/Host.html 
>> <https://www.google.com/url?q=https%3A%2F%2Fssebuild.cased.de%2Fnightly%2Fsoot%2Fjavadoc%2Fsoot%2Ftagkit%2FHost.html&sa=D&sntz=1&usg=AFQjCNGUld03hFxh2cqa4pQ45L4bhMnrGw>
>>
>> Am 05.10.2016 um 18:22 schrieb Xinxin Jin <xinxi... at gmail.com 
>> <javascript:>>:
>>
>> Hi !
>>
>> I need to parse the java annotation from Android application and generate 
>> bytecode according to the parsed annotation.
>>
>> In the android source code, the annotation is defined like this. RetentionPolicy.RUNTIME 
>> means the annotation will be preserved in bytecode. 
>>
>>
>>
>>
>> *@Retention(RetentionPolicy.RUNTIME)public @interface MyAnnotation {}*
>>
>> Then I use Soot to transform the android APK to Jimple using this 
>> command: 
>> *java -classpath ${JAVA_CLASSPATH} soot.Main -android-jars 
>> $ANDROID_JARS_PATH -allow-phantom-refs -src-prec apk -ire -f J MyTest.apk*
>>
>> I checked the generated Jimple files, but found no code annotated with @
>> *MyAnnotation*
>>
>> Can anyone tell me if Soot can't read the annotation in the bytecode or I 
>> applied incorrect command?
>>
>> Thank you very much !!!
>>
>> ​​
>>
>> -- 
>> Xinxin
>>
>>
>> _______________________________________________
>> Soot-list mailing list
>> Soot... at CS.McGill.CA <javascript:>
>> https://mailman.CS.McGill.CA/mailman/listinfo/soot-list
>>
>>
>>
>
>
> -- 
> Xinxin
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://mailman.CS.McGill.CA/pipermail/soot-list/attachments/20180418/e2cfee14/attachment.html>


More information about the Soot-list mailing list