[Soot-list] Instrumentation of a class

Eric Bodden eric.bodden at ec-spride.de
Sat Jul 7 09:19:35 EDT 2012


Ken, in your last email you wrote that you are calling
Scene.getMainClass(). Why?

Instead you could use Scene.v().getSootClass("android.app.Activity")
and then add the field to the resulting class. Would that not do the
trick?

Eric

On 6 July 2012 16:35, Ken Dinsmore <kdinsmore at hotmail.com> wrote:
> On Android, the app must extend android.app.Activity. This is the type of
> class that I am targeting for this instrumentation package.
> Perhaps I am misunderstanding something, but If I create a new class (that
> is not an Android Activity class) how will the application run on the
> Android device?
>
> -----Original Message-----
> From: eric.bodden at gmail.com [mailto:eric.bodden at gmail.com] On Behalf Of Eric
> Bodden
> Sent: Friday, July 06, 2012 9:14 AM
> To: Ken Dinsmore
> Cc: Soot list
> Subject: Re: [Soot-list] Instrumentation of a class
>
> Hi Ken.
>
> As far as I can see, you could add those fields to just any class,
> couldn't you? So why not just generate a new, fresh SootClass, and add
> the fields to that class instead of trying to use some "main" class
> that does not exist? Could that work for you?
>
> Eric
>
> On 6 July 2012 16:08, Ken Dinsmore <kdinsmore at hotmail.com> wrote:
>> I have an Android service connection class "PMConnect" with methods
>> Connect() and Disconnect(), and I want to add calls to these methods to
> the
>> class to be instrumented. When I call Connect, it makes a connection to
> the
>> service, the service does some work based on the calling class, and
>> continues to work until the calling class disconnects. The Java for this
> is
>> very simple and would look something like this:
>>
>> //At the class level
>> PMConnect mConnector;
>>
>> //In the OnStart() method
>> mConnector = new PMConnect();
>> mConnector.Connect();
>>
>> //In the OnStop() method
>> mConnector.DisConnect();
>>
>> The issue that I am working on right now is that Android Activities (my
>> target class) do not have a main() method so when I call
>> SootField arg = new SootField("mConnector",RefType.v("PMConnect"),
>> Modifier.STATIC);
>> Scene.v().getMainClass().addField(arg);
>> I get the exception "There is no main class set!".
>>
>> I would imagine that when I figure that out, there will be a number of
> other
>> issues that I will run into.
>>
>> I am currently studying the "Adding Profiling Instructions to Applications
>> with Soot" paper by Qian and Lam. I think this paper covers most of what I
>> am looking for, but I wanted to see if there was something else that you
>> might recommend.
>>
>> Ken Dinsmore
>>
>>
>>
>> -----Original Message-----
>> From: eric.bodden at gmail.com [mailto:eric.bodden at gmail.com] On Behalf Of
> Eric
>> Bodden
>> Sent: Friday, July 06, 2012 2:27 AM
>> To: Ken Dinsmore
>> Cc: Soot List
>> Subject: Re: [Soot-list] Instrumentation of a class
>>
>> Ken can you be more specific about what your problem actually is? Also
>> what do you mean by an "attribute"?
>>
>> Eric
>>
>> On 6 July 2012 01:19, Ken Dinsmore <kdinsmore at hotmail.com> wrote:
>>> I have a naïve question about instrumenting a class. All I want to do is
>> add
>>> a class level attribute, then in two of the existing methods in the class
>> to
>>> be instrumented, call a couple of methods of the new class level
> attribute
>>> that I added. That should not be very difficult, but I’m have trouble
>>> getting it to actually work. I’ve been looking at “using Soot to
>> Instrument
>>> a Class File” and “Creating a Class From Scratch with Soot”. Based on
>> those
>>> examples (and a few others) I am using a BodyTransformer and adding it to
>>> the JTP pack.
>>>
>>>
>>>
>>> Is there a different tutorial or example that I should be looking at?
>>>
>>>
>>>
>>> Ken Dinsmore
>>>
>>>
>>>
>>>
>>>
>>>
>>>
>>>
>>> _______________________________________________
>>> Soot-list mailing list
>>> Soot-list at sable.mcgill.ca
>>> http://mailman.cs.mcgill.ca/mailman/listinfo/soot-list
>>>
>>
>>
>>
>> --
>> Eric Bodden, Ph.D., http://bodden.de/
>> Head of Secure Software Engineering Group at EC SPRIDE
>> Principal Investigator in Secure Services at CASED
>> Tel: +49 6151 16-75422    Fax: +49 6151 16-72051
>> Room 3.2.14, Mornewegstr. 30, 64293 Darmstadt
>>
>
>
>
> --
> Eric Bodden, Ph.D., http://bodden.de/
> Head of Secure Software Engineering Group at EC SPRIDE
> Principal Investigator in Secure Services at CASED
> Tel: +49 6151 16-75422    Fax: +49 6151 16-72051
> Room 3.2.14, Mornewegstr. 30, 64293 Darmstadt
>



-- 
Eric Bodden, Ph.D., http://bodden.de/
Head of Secure Software Engineering Group at EC SPRIDE
Principal Investigator in Secure Services at CASED
Tel: +49 6151 16-75422    Fax: +49 6151 16-72051
Room 3.2.14, Mornewegstr. 30, 64293 Darmstadt


More information about the Soot-list mailing list