<html dir="ltr">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=Windows-1252">
<style>
<!--
@font-face
        {font-family:Calibri}
@font-face
        {font-family:Tahoma}
p.MsoNormal, li.MsoNormal, div.MsoNormal
        {margin:0cm;
        margin-bottom:.0001pt;
        font-size:12.0pt;
        font-family:"Times New Roman","serif"}
a:link, span.MsoHyperlink
        {color:blue;
        text-decoration:underline}
a:visited, span.MsoHyperlinkFollowed
        {color:purple;
        text-decoration:underline}
p.MsoAcetate, li.MsoAcetate, div.MsoAcetate
        {margin:0cm;
        margin-bottom:.0001pt;
        font-size:8.0pt;
        font-family:"Tahoma","sans-serif"}
p.p1, li.p1, div.p1
        {margin-right:0cm;
        margin-left:0cm;
        font-size:12.0pt;
        font-family:"Times New Roman","serif"}
p.p2, li.p2, div.p2
        {margin-right:0cm;
        margin-left:0cm;
        font-size:12.0pt;
        font-family:"Times New Roman","serif"}
span.E-MailFormatvorlage22
        {font-family:"Calibri","sans-serif";
        color:#1F497D}
span.SprechblasentextZchn
        {font-family:"Tahoma","sans-serif"}
.MsoChpDefault
        {font-size:10.0pt}
@page WordSection1
        {margin:70.85pt 70.85pt 2.0cm 70.85pt}
-->
</style><style type="text/css" id="owaParaStyle"></style>
</head>
<body lang="DE" link="blue" vlink="purple" fpstyle="1" ocsi="0">
<div style="direction: ltr;font-family: Tahoma;color: #000000;font-size: 10pt;">Hi Steven,<br>
<div><br>
<div style="font-family:Tahoma; font-size:13px"></div>
</div>
<div>the Proxy class is the standard java.net.Proxy class, which defines a public enum Type.</div>
<div><br>
</div>
<div>I have the Jimple source for an example where I set the Proxy: this is the trace I'm using to try to inject it in a class where a Proxy is not set.</div>
<div>Probably I'm not assigning $r6 in the correct way.</div>
<div><br>
</div>
<div><br>
</div>
<div>Thanks again for your help,</div>
<div>Daniele</div>
<div><br>
</div>
<div>-------</div>
<div>...</div>
<div>
<div> java.lang.String[] $r1;</div>
<div> byte[] $r2;</div>
<div> java.io.IOException $r3;</div>
<div> java.io.FileOutputStream $r4;</div>
<div> java.net.Proxy $r5;</div>
<div> java.net.Proxy$Type $r6;</div>
<div> java.net.InetSocketAddress $r7;</div>
<div> java.net.URLConnection $r8;</div>
<div> java.net.URL $r9;</div>
<div> java.lang.String $r10;</div>
<div> java.net.HttpURLConnection $r11;</div>
<div> java.io.File $r12, $r14;</div>
<div> com.sysmosoft.soottarget.MainActivity $r13;</div>
<div> java.io.InputStream $r15;</div>
<div> int $i0;</div>
<div> boolean $z0;</div>
<div><br>
</div>
<div> $r0 := @this: com.sysmosoft.soottarget.MainActivity$DownloadFileFromURLAsyncTask;</div>
<div><br>
</div>
<div> $r1 := @parameter0: java.lang.String[];</div>
<div><br>
</div>
<div> $r5 = new java.net.Proxy;</div>
<div><br>
</div>
<div> $r6 = <java.net.Proxy$Type: java.net.Proxy$Type HTTP>;</div>
<div><br>
</div>
<div> $r7 = new java.net.InetSocketAddress;</div>
<div><br>
</div>
<div> label01:</div>
<div> specialinvoke $r7.<java.net.InetSocketAddress: void <init>(java.lang.String,int)>("http://proxyclipse.info/", 8080);</div>
<div><br>
</div>
<div> specialinvoke $r5.<java.net.Proxy: void <init>(java.net.Proxy$Type,java.net.SocketAddress)>($r6, $r7);</div>
<div><br>
</div>
<div> label02:</div>
<div> $r9 = new java.net.URL;</div>
<div><br>
</div>
<div> label03:</div>
<div> $r10 = $r1[0];</div>
<div><br>
</div>
<div> specialinvoke $r9.<java.net.URL: void <init>(java.lang.String)>($r10);</div>
<div><br>
</div>
<div> $r8 = virtualinvoke $r9.<java.net.URL: java.net.URLConnection openConnection(java.net.Proxy)>($r5);</div>
<div><br>
</div>
<div> label04:</div>
<div> $r11 = (java.net.HttpURLConnection) $r8;</div>
</div>
<div>...</div>
<div>-------</div>
<div><br>
</div>
<div><br>
</div>
<div><br>
</div>
<div><br>
</div>
<div style="font-family: Times New Roman; color: #000000; font-size: 16px">
<hr tabindex="-1">
<div id="divRpF41860" style="direction: ltr;"><font face="Tahoma" size="2" color="#000000"><b>From:</b> Steven Arzt [Steven.Arzt@cased.de]<br>
<b>Sent:</b> Tuesday, February 03, 2015 9:25 AM<br>
<b>To:</b> Daniele Altomare; 'Bodden, Eric'<br>
<b>Cc:</b> 'soot-list@CS.McGill.CA'<br>
<b>Subject:</b> AW: [Soot-list] Generating code for enumaration<br>
</font><br>
</div>
<div></div>
<div>
<div class="WordSection1">
<p class="MsoNormal"><span style="font-size:11.0pt; font-family:"Calibri","sans-serif"; color:#1F497D">Hi Daniele,</span></p>
<p class="MsoNormal"><span style="font-size:11.0pt; font-family:"Calibri","sans-serif"; color:#1F497D"> </span></p>
<p class="MsoNormal"><span lang="EN-US" style="font-size:11.0pt; font-family:"Calibri","sans-serif"; color:#1F497D">Isn’t there a variable holding the HTTP constant for the enum type? Can you send us the Proxy class as complete Jimple source? My guess is that
there is some field from which you can get the correct values for the enum instances and assign them to your local.</span></p>
<p class="MsoNormal"><span lang="EN-US" style="font-size:11.0pt; font-family:"Calibri","sans-serif"; color:#1F497D"> </span></p>
<p class="MsoNormal"><span lang="EN-US" style="font-size:11.0pt; font-family:"Calibri","sans-serif"; color:#1F497D">Best regards,</span></p>
<p class="MsoNormal"><span lang="EN-US" style="font-size:11.0pt; font-family:"Calibri","sans-serif"; color:#1F497D"> Steven</span></p>
<p class="MsoNormal"><span lang="EN-US" style="font-size:11.0pt; font-family:"Calibri","sans-serif"; color:#1F497D"> </span></p>
<div>
<div style="border:none; border-top:solid #B5C4DF 1.0pt; padding:3.0pt 0cm 0cm 0cm">
<p class="MsoNormal"><b><span style="font-size:10.0pt; font-family:"Tahoma","sans-serif"">Von:</span></b><span style="font-size:10.0pt; font-family:"Tahoma","sans-serif""> soot-list-bounces@CS.McGill.CA [mailto:soot-list-bounces@CS.McGill.CA]
<b>Im Auftrag von </b>Daniele Altomare<br>
<b>Gesendet:</b> Dienstag, 3. Februar 2015 09:21<br>
<b>An:</b> Bodden, Eric<br>
<b>Cc:</b> soot-list@CS.McGill.CA; Steven Arzt<br>
<b>Betreff:</b> Re: [Soot-list] Generating code for enumaration</span></p>
</div>
</div>
<p class="MsoNormal"> </p>
<p class="MsoNormal">Thanks Eric,<br>
<br>
in fact I added -validate to the command and I've got a "<span style="font-family:"Courier New"">no defs for value: proxyType!</span>" error
</p>
<div>
<p class="MsoNormal"> </p>
</div>
<div>
<p class="MsoNormal">To get rid of it, I tried to assign to proxyType a value but I think something is wrong, because I don't think it's the correct value to set a enum value to a Local.</p>
</div>
<div>
<p class="MsoNormal"> </p>
</div>
<div>
<p class="MsoNormal">My code:</p>
</div>
<div>
<p class="p1">SootClass clsProxyType = Scene.v().getSootClass(<span class="s1">"java.net.Proxy$Type"</span>);</p>
<p class="p1">Local proxyType = Jimple.v().newLocal(<span class="s1">"proxyType"</span>, RefType.v(clsProxyType));</p>
<p class="p1">b.getLocals().add(proxyType);</p>
<p class="p1"><span class="s3">probe.add(Jimple.v().newAssignStmt(proxyType, Jimple.v().</span></p>
<p class="p1"><span class="s3">newNewExpr(clsProxyType.getType())))</span>;</p>
<p class="p1"> </p>
<p class="p1"> </p>
<p class="p1">What a correct assignment is represented in Jimple:</p>
<p class="p1">$r6 = <java.net.Proxy$Type: java.net.Proxy$Type HTTP>;</p>
<p class="p1"> </p>
<p class="p1">Basically I just need to pass enum value Proxy.Type.HTTP as a parameter of the Proxy constructor method.</p>
</div>
<div>
<p class="MsoNormal"> </p>
</div>
<div>
<p class="MsoNormal"> </p>
</div>
<div>
<p class="MsoNormal">Thanks,</p>
</div>
<div>
<p class="MsoNormal">Daniele</p>
</div>
<div>
<p class="MsoNormal" style="margin-bottom:12.0pt"><br>
<br>
________________________________________<br>
From: Bodden, Eric [eric.bodden@sit.fraunhofer.de]<br>
Sent: Monday, February 02, 2015 11:09 PM<br>
To: Daniele Altomare<br>
Cc: Steven Arzt; <a href="mailto:soot-list@CS.McGill.CA" target="_blank">soot-list@CS.McGill.CA</a><br>
Subject: Re: [Soot-list] Generating code for enumaration<br>
<br>
Hi Daniele.<br>
<br>
It looks to me like the Jimple code you generate is ill-structured. Try to enable the -validate command line switch in Soot. That might help you pinpoint the problem.<br>
<br>
Cheers,<br>
Eric<br>
<br>
> On 02.02.2015, at 15:37, Daniele Altomare <<a href="mailto:daniele.altomare@sysmosoft.com" target="_blank">daniele.altomare@sysmosoft.com</a>> wrote:<br>
><br>
> Hi Steven,<br>
><br>
> thanks for getting back to me. If I run the transformed executable (APK) I get a java.lang.VerifyError exception and this is the root cause:<br>
><br>
> 02-02 15:49:39.170: W/dalvikvm(19074): VFY: register1 v7 holds uninitialized ref<br>
> 02-02 15:49:39.170: W/dalvikvm(19074): VFY: bad arg 1 (into Ljava/net/Proxy$Type;)<br>
> 02-02 15:49:39.170: W/dalvikvm(19074): VFY: rejecting call to Ljava/net/Proxy;.<init> (Ljava/net/Proxy$Type;Ljava/net/SocketAddress;)V<br>
> 02-02 15:49:39.170: W/dalvikvm(19074): VFY: rejecting opcode 0x70 at 0x0015<br>
> 02-02 15:49:39.170: W/dalvikvm(19074): VFY: rejected<br>
><br>
> Please notice that I'm trying to init a Proxy instance:<br>
> specialinvoke $r5.<java.net.Proxy: void <init>(java.net.Proxy$Type,java.net.SocketAddress)>($r6, $r7);<br>
><br>
><br>
> If I run the driver class on this transformed APK (so I can print the body to check my transformation), I get this error:<br>
> local type not allowed in final code: bottom_type local: $r6<br>
><br>
><br>
> In fact, if I check the body I see "bottom_type $r6;" instead of "java.net.Proxy$Type $r6;" as expected.<br>
><br>
><br>
> Thanks again,<br>
> Daniele<br>
><br>
> From: Steven Arzt [Steven.Arzt@cased.de]<br>
> Sent: Monday, February 02, 2015 5:16 PM<br>
> To: Daniele Altomare; <a href="mailto:soot-list@CS.McGill.CA" target="_blank">soot-list@CS.McGill.CA</a><br>
> Subject: AW: [Soot-list] Generating code for enumaration<br>
><br>
> Hi Daniele,<br>
><br>
> To answer this question, we would need more information. What do you mean by “does not work”? The code you wrote should give you a new local of the correct type – but it’s hard to tell what else may be wrong if one does not know how you use this local and
where the problem shows up.<br>
><br>
> Best regards,<br>
> Steven<br>
><br>
><br>
> M.Sc. M.Sc. Steven Arzt<br>
> Secure Software Engineering Group (SSE)<br>
> European Center for Security and Privacy by Design (EC SPRIDE)<br>
> Rheinstraße 75<br>
> D-64293 Darmstadt<br>
> Phone: +49 61 51 869-336<br>
> Fax: +49 61 51 16-72118<br>
> eMail: <a href="mailto:steven.arzt@ec-spride.de" target="_blank">steven.arzt@ec-spride.de</a><br>
> Web: <a href="http://sse.ec-spride.de" target="_blank">http://sse.ec-spride.de</a><br>
><br>
><br>
><br>
> Von: <a href="mailto:soot-list-bounces@CS.McGill.CA" target="_blank">soot-list-bounces@CS.McGill.CA</a> [<a href="mailto:soot-list-bounces@CS.McGill.CA" target="_blank">mailto:soot-list-bounces@CS.McGill.CA</a>] Im Auftrag von Daniele Altomare<br>
> Gesendet: Montag, 2. Februar 2015 17:14<br>
> An: <a href="mailto:soot-list@CS.McGill.CA" target="_blank">soot-list@CS.McGill.CA</a><br>
> Betreff: [Soot-list] Generating code for enumaration<br>
><br>
> Hi all,<br>
><br>
> I'm getting stuck at generating code for an enum in a BodyTransformer.<br>
><br>
> I have to pass the the proxy type to a method and that's defined by an enum.<br>
> If I run the driver class for a java program where I define the proxy (so I can see the Jimple code) I get this for the method body:<br>
><br>
> $r6 = <java.net.Proxy$Type: java.net.Proxy$Type HTTP>;<br>
><br>
><br>
><br>
> I've tried in this way but it doesn't work:<br>
><br>
> SootClass clsProxyType = Scene.v().getSootClass("java.net.Proxy$Type");<br>
><br>
> Local proxyType = Jimple.v().newLocal("proxyType", RefType.v(clsProxyType));<br>
><br>
> b.getLocals().add(proxyType);<br>
><br>
><br>
><br>
> Can someone help me with this?<br>
><br>
><br>
><br>
> Thanks!<br>
><br>
> Daniele<br>
><br>
><br>
> _______________________________________________<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>
Prof. Eric Bodden, Ph.D., <a href="http://sse.ec-spride.de/" target="_blank">http://sse.ec-spride.de/</a>
<a href="http://bodden.de/" target="_blank">http://bodden.de/</a><br>
Head of Secure Software Engineering at Fraunhofer SIT, TU Darmstadt and EC SPRIDE<br>
Tel: +49 6151 16-75422 Fax: +49 6151 869-127<br>
Room B5.11, Fraunhofer SIT, Rheinstraße 75, 64295 Darmstadt</p>
</div>
</div>
</div>
</div>
</div>
</body>
</html>