[Soot-list] Ask Help for Soot

Linghui Luo linghui.luo at uni-paderborn.de
Wed Mar 14 08:49:57 EDT 2018


Hi Jing,

I don’t know if you used the constructor InfoflowCFG() to get your instance, if it is the case, the ICFG uses JimpleBasedInterproceduralCFG as default and this requires that the call graph must be built at first. You can try to get the call graph by using Scene.v().getCallGraph() and make sure it is created.

Ps. Next time please send soot-related questions to the mailing list such that other people who has the same question can see it too.

Best,
Linghui Luo

_________________________________
M. Sc. Linghui Luo

Wissenschaftliche Mitarbeiterin/Research assistant

Fachgruppe Softwaretechnik
Heinz Nixdorf Institut
Universität Paderborn
Fürstenallee 11
33102 Paderborn

E-Mail: linghui.luo at uni-paderborn.de<mailto:linghui.luo at uni-paderborn.de>
Telefon: +49 5251 606568
Raum: F1.119

_________________________________


Von: 张婧 <m201672947 at hust.edu.cn>
Gesendet: Mittwoch, 14. März 2018 04:59
An: Linghui Luo <linghui.luo at uni-paderborn.de>
Betreff: Re: AW: Ask Help for Soot


Hi Linghui Luo,

Thank you for your reply.

Can I ask you another question?

Demo code :

    function a(){

        ……

        c(b());

    }

    function b(){

    ……

    source point;

   }



   function c(para){



    ……



    sink point;



   }



  function d(){

  a();



  }



I want get all methods that will trigger the source-sink path(function a and d in demo).

I have already get the InfoflowCFG and source-sink path, and I try to use api getCallersOf(SootMethod) to find caller of method, but failed.

Can you give me some suggestions to solve it?

Thank you very much.

Hope to receive your replay soon.



Best regards,

Jing





-----原始邮件-----
发件人:"Linghui Luo" <linghui.luo at uni-paderborn.de<mailto:linghui.luo at uni-paderborn.de>>
发送时间:2018-03-13 16:34:43 (星期二)
收件人: "张婧" <m201672947 at hust.edu.cn<mailto:m201672947 at hust.edu.cn>>
主题: AW: Ask Help for Soot
Hi Jing,

You can call getArgs() method from InvokeExpr to get the arguments passing the constructor.

    Stmt stmt = (Stmt) unit;
    InvokeExpr invokeExpr = stmt.getInvokeExpr();
    if(invokeExpr instanceof SpecialInvokeExpr)//constructor is a specialInvoke
    {
          for (int i = 0; i < invokeExpr.getArgCount(); i++) {
            Value arg=invokeExpr.getArg(i);
            //Here you can find out which variable storing the file name is passed to the constructor, then you can do backward analysis to track the value of this variable or while forward analysis always track the value of String variables.
          }
}
To find out the value assigned to the variable filename you just need to look into the interface AssignStmt, you can get the left and right operand of the assignment by calling get getLeftOp()/getRightOp().
               if(unit instanceof AssignStmt)
               {
                              AssignStmt assignStmt=(AssignStmt)unit;
                              Value leftOp=assignStmt.getLeftOp();
                              ….
}

Best,
Linghui Luo

_________________________________
M. Sc. Linghui Luo

Wissenschaftliche Mitarbeiterin/Research assistant

Fachgruppe Softwaretechnik
Heinz Nixdorf Institut
Universität Paderborn
Fürstenallee 11
33102 Paderborn

E-Mail: linghui.luo at uni-paderborn.de<mailto:linghui.luo at uni-paderborn.de>
Telefon: +49 5251 606568
Raum: F1.119

_________________________________


Von: 张婧 <m201672947 at hust.edu.cn<mailto:m201672947 at hust.edu.cn>>
Gesendet: Dienstag, 13. März 2018 06:39
An: Linghui Luo <linghui.luo at uni-paderborn.de<mailto:linghui.luo at uni-paderborn.de>>
Betreff: Ask Help for Soot


Hi Linghui Luo,



My name is Jing Chang. I have seen your answer about "identify write operation on local".

now I want to get value of filename of write/read operations from code like:



(1) String filename = "**/**/**/**.txt"  ;

BufferedWriter bfw = new BufferedWriter(new FileWriter(filename, true));



(2) filename = Environment.getExternalStorageDirectory().getCanonicalPath() + "/" + filename;

   FileOutputStream output = new FileOutputStream(filename);



(3) String filename = "123"+"**.txt" ;

outputStream = openFileOutput(filename, Context.MODE_APPEND);



Is there any helper methods inside Soot that can help me?



Thank you very much.

Hope to receive your replay soon.



Best regards,

Jing
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://mailman.CS.McGill.CA/pipermail/soot-list/attachments/20180314/4606fe34/attachment-0001.html>


More information about the Soot-list mailing list