<div dir="ltr">One last question regarding this topic:<div><br></div><div>In the native Java, "getFlashlightEnabled()" looks like this:</div><div><div>public boolean getFlashlightEnabled() {</div><div> try {</div><div> FileInputStream fis = new FileInputStream(FLASHLIGHT_FILE);</div><div> int result = fis.read();</div><div> fis.close();</div><div> return (result != '0');</div><div> } catch (Exception e) {</div><div> return false;</div><div> }</div><div>}</div></div><div><br></div><div>Now, I know I can get the value of $r3 without a problem, but is there any way for me to get the *java variable name*(fis) and not the jimple name ($r3)? My gut is no, as that is lost by the jimple conversion. I've looked at baf, shimple, and gimple, and they all seem to lose the Java-based variable name in the conversion.</div><div><br></div><div>Thanks,</div><div>Jason</div></div><div class="gmail_extra"><br><div class="gmail_quote">On Wed, Sep 30, 2015 at 9:25 AM, Jason Ott <span dir="ltr"><<a href="mailto:jott002@ucr.edu" target="_blank">jott002@ucr.edu</a>></span> wrote:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><div dir="ltr">You are correct. Thank you. I'm not sure how I missed that; I have the code that outputs that exact information.</div><div class="HOEnZb"><div class="h5"><div class="gmail_extra"><br><div class="gmail_quote">On Wed, Sep 30, 2015 at 1:06 AM, Andrew Santosa <span dir="ltr"><<a href="mailto:santosa_1999@yahoo.com" target="_blank">santosa_1999@yahoo.com</a>></span> wrote:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><div><div style="color:#000;background-color:#fff;font-family:HelveticaNeue,Helvetica Neue,Helvetica,Arial,Lucida Grande,Sans-Serif;font-size:12px"><div dir="ltr">Given invkExpr of type InvokeExprBox is the invocation expression of the special invocation statement,<br></div><div dir="ltr">we can obtain the list of use boxes within the expression in the following way:</div><div dir="ltr"><br></div><div dir="ltr">List<ValueBox> boxesList = invkExpr.getValue().getUseBoxes();</div><div dir="ltr"><br></div><div dir="ltr">One of the boxes in boxesList should be the local that you want.</div><div dir="ltr"><br></div><div dir="ltr">Best,<br></div><div dir="ltr">Andrew<br></div><div><span></span></div> <br><div><br><br></div><div style="display:block"> <div style="font-family:HelveticaNeue,Helvetica Neue,Helvetica,Arial,Lucida Grande,Sans-Serif;font-size:12px"> <div style="font-family:HelveticaNeue,Helvetica Neue,Helvetica,Arial,Lucida Grande,Sans-Serif;font-size:16px"><div><div> <div dir="ltr"> <font face="Arial" size="2"> On Wednesday, 30 September 2015, 10:38, Jason Ott <<a href="mailto:jott002@ucr.edu" target="_blank">jott002@ucr.edu</a>> wrote:<br> </font> </div> <br><br> </div></div><div><div><div><div><div dir="ltr">I have the following Jimple:<div><div><br></div><div> public boolean getFlashlightEnabled()</div><div> {</div><div> com.android.server.lights.LightsService$1 r0;</div><div> int i0;</div><div> java.io.FileInputStream $r1, r3; // I'm interested in this</div><div> java.lang.Exception $r2;</div><div> boolean $z0;</div><div> r0 := @this: com.android.server.lights.LightsService$1;</div><div> label1:</div><div> $r1 = new java.io.FileInputStream;</div><div> specialinvoke $r1.<java.io.FileInputStream: void <init>(java.lang.String)>("/sys/class/leds/spotlight/brightness"); // But my interest in $r1 and r3 are predicated upon this</div><div> r3 = $r1;</div><div> i0 = virtualinvoke r3.<java.io.FileInputStream: int read()>();</div><div> virtualinvoke r3.<java.io.FileInputStream: void close()>();</div><div> if i0 == 48 goto label2;</div><div> $z0 = 1;</div><div> goto label3;</div><div> label2:</div><div> $z0 = 0;</div><div> label3:</div><div> return $z0;</div><div> label4:</div><div> $r2 := @caughtexception;</div><div> return 0;</div><div> catch java.lang.Exception from label1 to label3 with label4;</div><div> }</div></div><div><br></div><div>You can see that I am interested in the variable that, in some way or another, uses the "/sys/class/leds/spotlight/brightness" string. Thus, I am interested in the variable $r1. But I don't know that I'm interested in $r1 until I see that $r1 is using the string that I am interested.</div><div><br></div><div>Now I know that $r1 is a local, more specifically a LinkedRValueBox. I know that the string, "/sys/class/..." is an ImmediateBox, which is leveraged in an InvokeExprBox (specialinvoke $r1...). What I cannot seem to manage to figure out is how to derive the Local $r1 variable from either the InvokeExprBox or the ImmediateBox. Neither of them have any formal link to $r1 (a Local) other than by parsing the string representation of them and then going through the Locals looking for what you want.</div><div><br></div><div>So my question is: Is there a way to get the Local from the InvokeExprBox or the ImmediateBox in this case, or the general case? I can only get ValueBoxes from anything which is of ValueBox, as defined by the ValueBox interface.</div><div><br></div><div>Thanks.</div></div></div><br></div></div>_______________________________________________<br>Soot-list mailing list<br><a href="mailto:Soot-list@CS.McGill.CA" target="_blank">Soot-list@CS.McGill.CA</a><br><a href="https://mailman.cs.mcgill.ca/mailman/listinfo/soot-list" target="_blank">https://mailman.CS.McGill.CA/mailman/listinfo/soot-list</a><br><br><br></div> </div> </div> </div></div></div></blockquote></div><br></div>
</div></div></blockquote></div><br></div>