How to create an update.zip file that can copy & rename a file? - Android Software/Hacking General [Developers Only]

Hello!
Here's exactly what I'm looking for - I need an 'update.zip' file that will make the 'system' folder writable and then it would copy this file:
/system/framework/framework-res.apkback
to this folder:
/system/
after that it would rename the 'framework-res.apkback' file in the 'system' folder to:
framework-res.apk
and copy it back to:
/system/framework/
It has to overwrite an existing 'framework-res.apk' in 'system/framework' folder and in the end make the 'system' folder ro.
Note: The permissions can NOT change.
How exactly can this be done please? I have some ideas but I don't want to risk bricking my phone more than it already is.
Any help would be greatly appreciated!

Related

Q: CWM Scripting Help, package_extract_dir

I'm writing a CWM package that overwrites some files in /system/app and /system/framework. But, it seems that overwriting existing files in the those directories isn't working. Do I have to delete the files first in those directories then execute the package_extract_dir() function?

[Q] use 7za.exe to create update.zip

I have created a batch file to edit new roms I download. Basicilly the batch file takes the rom extracts it, then deletes all the apk's etc I dont want and then zips it up again as update.zip.
Once it has done this, it then copies the update.zip to my SD card and then uses the adb commmand to reboot the phone into the recovery menu.
This all works fine. The problem I have is when I go to flash the zip I get error aborted. I found that when it creates the zip file it doesn't add the META-INF folder as uppercase in the update.zip file.
As linux is cse sensitive I think this is my problem. Is there any way to use 7za.exe to add it as upper case into the update.zip and all the other folders as lower case?
The command I use to create the zip is: 7za a -tzip update.zip *
Any ideas on how to zip the file in dos and preserve the uppercase folders?
Fixed it needed to use the -r switch with 7za. Now when I get a new rom I can fully extract it, delete all the files I want zip it transfer it to the phone and reboot the phone!

[Q] Install voice commands (motoblur) to cm9

How to? I make steps
1. Download and unzip above file to your external or internal storage in a temp folder.
2. Copy VSuiteApp.apk file from system/app in unzipped folder to /system/app folder on your device
3. Copy nuance folder from system/etc in unzipped folder to /system/etc folder on your device
4. Copy libvsuite_mot_vs32_cmb103.so file from system/lib in unzipped folder to /system/lib folder on your device
5. Copy nuance folder from system/tts in unzipped folder to /system/tts folder on your device
6. Fix permission on all copied files (individual or in folders copied over) to rw- r-- r--.
7. Reboot, and hopefully it will work.
Click to expand...
Click to collapse
and not run =\
Somebody help.

[GUIDE] How to extract system files from stock firmware

Ok, so I know many users are looking forward to create a custom rom. Where are you gonna get the system files from? Sure you can get it from a CWM backup. You can also extract the system files and the respective kernel from PDA.tar. Sure everyone knows it's in there but very few exactly know how to extract them. The system files are in the file "system.img".
So the 1st step is to open the PDA.tar using 7-zip and extract the system.img to a particular folder.
Download sgs2toext4.jar from attachment. It's a .jar file created by dphrozen to convert .img files to .ext4.img. Place that file anywhere in C:\ and then open the Command Prompt. In the command prompt, set the directory to the folder where sgs2toext4.jar is placed. Then type this command :-
Code:
java -jar sgs2toext4.jar
A window will open which is gonna ask you to drop the .img file in it. Simply drag the system.img to the window and the process of converting it to system.ext4.img will start. After the process is complete, you'll find system.ext4.img file in the same folder where your system.img file was placed.
Now, download Linux Reader. Install and then open it. At top left, go to Drives -> Mount Image. A window will open up. Browse to system.ext4.img and select it.
That's it! Now you can view all the system files. Export all of them to a particular folder. After exporting, you'll see an extension .efs.ntfs at the end of each file. Just delete that extension and you're good to go!

How can I look at the code that is running an app?

I have built a few web sites but now I'm learning how to build apps. Is there a way to look at the code that is running a particular app on my phone so I can get an idea of how it is put together?
Can I open an app from my phone with Android Studio?
Follow the steps given below.
Procedure to open the source code:
Step 1:
Make a new folder and copy over the .apk file that you want to decode.
Now rename the extension of this .apk file to .zip (e.g. rename from filename.apk to filename.zip) and save it. Now you can access the classes.dex files, etc. At this stage you are able to see drawables but not xml and java files, so continue.
Step 2:
Now extract this .zip file in the same folder (or NEW FOLDER).
Download dex2jar and extract it to the same folder (or NEW FOLDER).
Move the classes.dex file into the dex2jar folder.
Now open command prompt and change directory to that folder (or NEW FOLDER). Then write d2j-dex2jar classes.dex (for mac terminal or ubuntu write ./d2j-dex2jar.sh classes.dex) and press enter. You now have the classes.dex.dex2jar file in the same folder.
Download java decompiler, double click on jd-gui, click on open file, and open classes.dex.dex2jar file from that folder: now you get class files.
Save all of these class files (In jd-gui, click File -> Save All Sources) by src name. At this stage you get the java source but the .xml files are still unreadable, so continue.
Step 3:
Now open another new folder
Put in the .apk file which you want to decode
Download the latest version of apktool AND apktool install window (both can be downloaded from the same link) and place them in the same folder
Download framework-res.apk and put it in the same folder (Not all apk file need this file, but it doesn't hurt)
Open a command window
Navigate to the root directory of APKtool and type the following command: apktool if framework-res.apk
apktool d myApp.apk (where myApp.apk denotes the filename that you want to decode)
now you get a file folder in that folder and can easily read the apk's xml files.

Categories

Resources