ale5000-git / tingle

Tingle - Android patcher
http://forum.xda-developers.com/showthread.php?t=3438764
GNU General Public License v3.0
160 stars 11 forks source link

Add support for patching Android from inside Android itself #12

Closed ale5000-git closed 6 years ago

ale5000-git commented 7 years ago

Add support for patching Android from inside Android itself.

ale5000-git commented 7 years ago
okias commented 7 years ago

Can we get something to test? ;-)

ale5000-git commented 7 years ago

It is already here.

You need to:

PS: Also mode 1 and 2 will work.

okias commented 7 years ago

Assembling out/classes.dex running for too long :( I gtg, so I'll test next update..

ale5000-git commented 7 years ago

I haven't yet optimized it.

okias commented 7 years ago

DEBUG: Compressing framework.jar Traceback (most recent call last): File "/storage/emulated/0/org.qpython.qpy/projects3/tingle/main.py". line 515, in >module} compress(os.curdir+"/out/", "framework.jar") ... OSError: [Errorno 13] Permission denied

seems like somewhere missing su command

ale5000-git commented 7 years ago

This is strange. The compression happens inside the temp folder provided by QPython, it doesn't need root.

Do you check that the "zip" executable have proper permissions?

okias commented 7 years ago

@ale5000-git yup, you are right :) "root sdcard_rw" instead "root shell" and "-rw-rw----" instead "-rwxr-xr-x".

So howto for dummies:

  1. Install QPython3 on the phone
  2. open F-Droid install "busybox installer", run it and "Install"
  3. PC # adb shell
  4. Phone # su
  5. Phone # mount -o rw,remount,rw /system
  6. Phone # cd /system/xbin
  7. Phone # wget https://storage.googleapis.com/google-code-archive-downloads/v2/code.google.com/zip-for-android/zip.zip
  8. Phone # unzip zip.zip && rmdir zip
  9. Phone # chown root:shell zip
  10. Phone # chmod 755 zip
  11. copy from computer or if you have git in phone, clone in phone
  12. PC # adb push ~/projects/tingle /storage/emulated/0/org.qpython.qpy/project3/tingle/
  13. OR Phone # cd /storage/emulated/0/org.qpython.qpy/project3/
  14. OR Phone # wget https://github.com/ale5000-git/tingle/archive/master.zip
  15. OR Phone # unzip master.zip
  16. Phone # mount -o ro,remount,ro /system
  17. Phone: run QPython3
ale5000-git commented 7 years ago

In the latest version of QPython3 the folder is qpython/projects3/ instead of org.qpython.qpy/projects3/.

gabsoftware commented 7 years ago

How long is it supposed to take on the "DEBUG: Assembling out/classes.dex" step? Waited 20 minutes already, could it possibly stuck? Is there a detailed log available?

ale5000-git commented 7 years ago

@gabsoftware: In this phase it is inside "smali" so the script cannot know what is happening inside but you can see the logcat of the phone.

I'm not sure about this phase alone (that is the one that take longer) but the entire process may take from about 30 minutes to about 3 hours (depends from the phone).

gabsoftware commented 7 years ago

Ended doing it in my computer... Just needed a few seconds to patch. Is that really how powerful are our CPU today compared to ARM processors?

ale5000-git commented 7 years ago

@gabsoftware: The Android part of my script isn't yet optimized but on a phone you have small battery (so if it the CPU would be too fast it would discharge too fast also) and small RAM.

avently commented 7 years ago

@ale5000-git Something wrong here.

/data/user/0/org.qpython.qpy3/files/bin/qpython-android5.sh "/storage/emulated/0/qpython/projects3/tingle-master/.last_tmp.py" && exit rojects3/tingle-master/.last_tmp.py" && exit < MENU

1 - Patch file from a device (adb)
2 - Patch file from the input folder
3 - Patch file directly from the device

3

OS: Linux 3.10.65+ (linux-android) Python: 3.2.2 (32 bit) Mode: 3 Working dir: /storage/emulated/0/qpython/cache/Tingle-lqpr1x Decompressing framework... DEBUG: Decompressing framework.jar Disassembling classes... DEBUG: Disassembling framework/classes.dex Patching... Detected: Android 7.x / 6.0.x (or LOS/CM 13-14) Patching succeeded. Reassembling classes... DEBUG: Assembling out/classes.dex

Exception in thread "main" com.beust.jcommander.MissingCommandException: Expected a command, got -j1 at com.beust.jcommander.JCommander.parseValues(JCommander.java:725) at com.beust.jcommander.JCommander.parse(JCommander.java:304) at com.beust.jcommander.JCommander.parse(JCommander.java:287) at org.jf.smali.Main.main(Main.java:87)

Return code: 1

ERROR CODE: 83

ale5000-git commented 7 years ago

@avently: It should be fixed, please try it and report back.

avently commented 7 years ago

@ale5000-git stuck on Assembling classes. Half of an hour is gone and nothing changed. The last error is gone

ale5000-git commented 7 years ago

@avently: Depending from the phone it may take from 30 minutes to 3 hours. It works but it isn't yet optimized.

avently commented 7 years ago

@ale5000-git apktool, Mt manager do this fast. Maybe a minute or less

ale5000-git commented 7 years ago

On a pc this take about a minute but on a phone it is slower.

Different methods of patching take different times.

Rubylion commented 7 years ago

Hi. I wanted to install tingle, like discribed in this post. But in the tingle-master.zip that I downloaded there's no 3rd option🤔. Could you check that please. Thanx for your work anyways.

ale5000-git commented 7 years ago

@Rubylion: The option 3 appears only when Tingle is executed directly on the phone.

Rubylion commented 7 years ago

Mmhh. That's exactly what I did. I downloaded the master.zip file. Extracted it to the qpython/projects3 folder and executed qpython. Only 2 options available.

ale5000-git commented 7 years ago

@Rubylion

Please tell me exactly: 1) If it is QPython3 or QPython 2) The exact version 3) Also it would be nice if you copy or do a screenshot of the log

Lojaleto commented 6 years ago

Подтверждаю, пункта 2. версия qpython3 - 1.2.0 s70912-002254

ale5000-git commented 6 years ago

@Rubylion @Lojaleto It should be fixed now.

Rubylion commented 6 years ago

Hey. I'm sorry not coming back to you. I was busy and just forgot about it, cause in the meantime I found the Nanomod project, which alsi patches the services.jar. It does a good job and I wonder if you guys could just team up as you're working on the samehow the same thing. Anyways, thank you very much for your effort and hanging on to provide untechnical users like me a live without google, etc. Keep it up.

Lojaleto commented 6 years ago

Не работает

s70920-135256

ale5000-git commented 6 years ago

@Lojaleto: It should be fixed now. Sorry for the time needed to fix it but I don't have too much free time currently.

ale5000-git commented 6 years ago

Since now it adapt dynamically it will found all the needed dependencies in most Android ROMs so it will work out-of-the-box. I'm closing this issue since most things are fixed; it still miss optimizations but they will be done in the future, for now it is fine.

If someone have any problem please open a new issue.