<div dir="ltr">Hi everyone,<br><br>I am trying to extract from an Android app's source code a list of permissions which it may request using the requestPermissions() API call, and have run into a couple of issues. Please excuse the slightly longer email. I have tried to break up the issues, but I encountered them in the same situation.<br><br>In my code, I am including Soot as a library rather than running the Jar, and am able to loop through every body of every method of every class of an app, and find InvokeStmt classes which call requestPermissions(). The next step would be to determine which permissions are being given as the arguments of this method. After going through Soot's documentation, I found that I can get the arguments of the call through the Value class (stmt.getInvokeExpr().getArg(n)). However, these Values only seem to contain the names of the variables passed, (e.g. $a1), and no way to actually get their real 'values', (e.g. "android.permission.CAMERA"). Is there some other class/method I am missing which can do this? I realise that one of these variables could have more than value depending on conditional statements which may explain why there doesn't seem to be something like that; but some way to at least see the *possible* values would be nice. For a simplified example, if the app had something like:<br><pre style="background-color:rgb(255,255,255);color:rgb(0,0,0);font-family:"Bitstream Vera Sans Mono";font-size:9pt"><span style="color:rgb(0,0,128);font-weight:bold">public static void </span>example(Activity activity, <span style="color:rgb(0,0,128);font-weight:bold">boolean </span>exampleCondition) {<br>    <span style="color:rgb(0,0,128);font-weight:bold">int </span>requestCode = <span style="color:rgb(0,0,255)">1</span>;<br>    String[] perms = <span style="color:rgb(0,0,128);font-weight:bold">new </span>String[<span style="color:rgb(0,0,255)">2</span>];<br>    perms[<span style="color:rgb(0,0,255)">0</span>] = <span style="color:rgb(0,128,0);font-weight:bold">"android.permission.CAMERA"</span>;<br>    <span style="color:rgb(0,0,128);font-weight:bold">if </span>(exampleCondition) {<br>        perms[<span style="color:rgb(0,0,255)">1</span>] = <span style="color:rgb(0,128,0);font-weight:bold">"android.permission.ACCESS_FINE_LOCATION"</span>;<br>    }<br>    <span style="font-style:italic">requestPermissions</span>(activity, perms, requestCode);<br>}</pre><div>...perhaps there could be some way to show that the list perms may contain some subset of ["android.permission.CAMERA", "android.permission.ACCESS_FINE_LOCATION"]?</div><div><br></div><div>As mentioned, I am looping through every body of every method of every class of an app. I seem to be having another issue here. If I use the debugger to stop at certain parts of execution, I can see where I am in the app's code:</div><div><br></div><div><div><img src="cid:ii_jql3eirf1" alt="image.png" width="543" height="47"><br></div></div><div><div>I thought it might be helpful if I could also look at the code in .jimple files, as I could more easily see the surrounding code. I set the output format flag to jimple, so that I could get all the app's (jimplified) code in one directory. However, some classes (including that in the screenshot above) are missing from this output:</div><div><div><img src="cid:ii_jql3j6162" alt="image.png" width="366" height="113"><br></div></div><div> Any idea why this might be -- that Soot seems to be able to find more classes during execution than it can output? I thought that perhaps the classes were empty, but they have methods with non-empty bodies.<br></div><div><br></div><div>Any help with either of these issues would be greatly appreciated. Thanks in advance<br></div></div></div>