# Info on writing a script



## BMc08GT (Jun 23, 2011)

Im looking into writing a script that will decompile the services.jar, pull out a select few files and recompile it. Is this possible? If so, where do I begin; this will be my first script i have written..

Any help is greatly appreciated.

Thanks
BMc


----------



## TreyM (Jun 9, 2011)

You will most likely need to build smali/baksmali from source for the device from here http://code.google.com/p/smali/source/checkout

You may need to use busybox unzip to extract the jar file then use baksmali to decompile the classes.dex.

You can use sed or awk to edit the smali files, then recompile with smali, pack the new classes.dex overwriting the old one, and repack them into a new jar file (using a zip binary) (I assume it's just a zip renamed?)

You may also need to sign the jar file (which would mean building signapk for the device)

This is all my speculation, but it may point you in a good direction.


----------



## BMc08GT (Jun 23, 2011)

hmm..

i think i was able to writeup a script that simply swaps the upgraded classes.dex with the stock one. Anyone able to take a look to see if this would work(hypothetically)?

Download link----------------> here
INSTRUCTIONS:
1)download the .zip file and extract to the root of the sdcard.
2)inside the folder "unthrottle" that is created, will be a script (.txt) file and a classes.dex file.
3) Using scriptmanager, navigate to this folder and select the .txt. file and run as root
4)If it works it should replace the file that is in the folder and ask you to reboot at the end.
5)Reboot and if all goes well your phone will boot back up uncrippled by VZW.


----------



## BMc08GT (Jun 23, 2011)

it worked lol thanks for the tips.


----------



## BMc08GT (Jun 23, 2011)

Ok so im back for more help....I am now trying to make my script universal as the way I tackled it was a build-dependent script. Is it possible to use smali and baksmali on device via a script? i try using java -jar ....... but says java not found. ? Is java possible to be ran on device via a script any help is much needed


----------



## BMc08GT (Jun 23, 2011)

can anybody explain how to use busybox unzip -d? is this compatible with a jar file, since it is a zip essentially?


----------



## tommytomatoe (Jul 22, 2011)

I don't know if this is kind of what you looking for...

http://rootzwiki.com/showthread.php?t=3823

But its all there and more. Let me know how you think 

Sent from my PC36100 using Tapatalk


----------



## BMc08GT (Jun 23, 2011)

Thats the general idea but im trying to perform this on device via a script that does it automatically for the users? Is this possible without actually writing an entire app?


----------



## tommytomatoe (Jul 22, 2011)

BMc08GT said:


> Thats the general idea but im trying to perform this on device via a script that does it automatically for the users? Is this possible without actually writing an entire app?


Smali and baksmali uses java libraries and such. Not possible to decompile dex code on phone at this time. Sorry.

Sent from my PC36100 using Tapatalk


----------



## BMc08GT (Jun 23, 2011)

Thanks for the info. I have made a directory that stores some service jar files. Is there anyone for a script or command to check what rom the user is using before making the changes?


----------

