Git Product home page Git Product logo

needle's Introduction

Hi there, I'm Souradip πŸ‘‹

I'm a British Physician-Scientist in-training. 🩺πŸ§ͺ

  • I've been writing code since 2006. πŸ’»

  • Especially interested in applying deep learning to medicine and I've contributed to tensorflow. 🧠

  • I was Co-President of St Catharine's College MCR (the society for graduate students) and I published parts of our online infrastructure including... πŸŽ“

    • The formal hall booking system
    • Projects to improve transparency for social good, e.g. the accommodation database to easily compare college rents with the private market, and used to negotiate rent arrangements on behalf of all of the graduate students.
  • Extensive experience in building tech for social activism, and I build the tech stack of a widening access to medicine charity. πŸ—£

  • I also post fun projects, e.g. πŸŽ‰

βœ‰ Reach out by email/twitter if you want to chat 😊

needle's People

Contributors

ale5000-git avatar conorohiggins avatar michitux avatar souramoo avatar vermut avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

needle's Issues

Does this still work?

I intend to use this with LineageOS, so did anyone use it with LoS13 yet?

Thanks,
Dia

Unable to patch on LG Nexus 5X - Android 6.0.1

Hello,
I have an error when patching my phone, the framework it pulls does not appear to contain the correct files.

  • Phone: I have an LG Nexus 5X and am using the latest stable version (20160505-0315.v10.2-OFFICIAL) of Dirty Unicorns, a ROM based on AOSP 6.0.1
  • Computer: I am running Archlinux, with the latest android sdk installed from the official google website.

When running the script, I have the following output:

12:28 $ python3 patch.py 
 *** Selected device 0218fade53830a84
 *** Device detected! proceeding...
 *** Working dir: /tmp/tmpiw3k7r9z
 *** Rooting adbd...
adbd is already running as root
remount succeeded
 *** Pulling framework from device...
7 KB/s (309 bytes in 0.042s)
 *** Disassembling framework...
I: Using Apktool 2.0.2 on framework.jar
I: Copying assets and libs...
I: Copying unknown files...
I: Copying original files...
 *** Done. Now this won't hurt a bit...
Traceback (most recent call last):
  File "patch.py", line 47, in <module>
    f = open(to_patch, "r")
FileNotFoundError: [Errno 2] No such file or directory: 'framework.jar.out/smali/android/content/pm/PackageParser.smali'

And the temporary directory structure is the following:

12:37 $ tree /tmp/tmpiw3k7r9z/
/tmp/tmpiw3k7r9z/
β”œβ”€β”€ framework.jar
└── framework.jar.out
    β”œβ”€β”€ apktool.yml
    └── original
        └── META-INF
            └── MANIFEST.MF

3 directories, 3 files

Please ask if you need any further information.
Thank you.

libgcc_s.so.1

 *** Selected device LGD855c1b53fb0
 *** Device detected! proceeding...
 *** Working dir: /tmp/tmp8v4q8xtz
 *** Rooting adbd...
adbd is already running as root
remount succeeded
 *** Pulling framework from device...
4036 KB/s (5532425 bytes in 1.338s)
 *** Disassembling framework...
I: Using Apktool 2.0.2 on framework.jar
I: Baksmaling classes.dex...
I: Baksmaling classes2.dex...
I: Copying assets and libs...
I: Copying unknown files...
I: Copying original files...
 *** Done. Now this won't hurt a bit...
 *** Injection successful. Reassembling smali...
I: Using Apktool 2.0.2
I: Checking whether sources has changed...
I: Smaling smali folder into classes.dex...
I: Checking whether sources has changed...
I: Smaling smali_classes2 folder into classes2.dex...
W: Could not find resources
I: Building apk file...
/tmp/brut_util_Jar_2568922176232786379.tmp: error while loading shared libraries: libgcc_s.so.1: cannot open shared object file: No such file or directory
Exception in thread "main" brut.androlib.AndrolibException: brut.common.BrutException: could not exec command: [/tmp/brut_util_Jar_2568922176232786379.tmp, p, -F, /tmp/tmp8v4q8xtz/framework.jar.out/dist/framework.jar, -0, arsc, /tmp/tmp8v4q8xtz/framework.jar.out/build/apk]
    at brut.androlib.res.AndrolibResources.aaptPackage(AndrolibResources.java:425)
    at brut.androlib.Androlib.buildApk(Androlib.java:667)
    at brut.androlib.Androlib.build(Androlib.java:296)
    at brut.androlib.Androlib.build(Androlib.java:261)
    at brut.apktool.Main.cmdBuild(Main.java:225)
    at brut.apktool.Main.main(Main.java:84)
Caused by: brut.common.BrutException: could not exec command: [/tmp/brut_util_Jar_2568922176232786379.tmp, p, -F, /tmp/tmp8v4q8xtz/framework.jar.out/dist/framework.jar, -0, arsc, /tmp/tmp8v4q8xtz/framework.jar.out/build/apk]
    at brut.util.OS.exec(OS.java:89)
    at brut.androlib.res.AndrolibResources.aaptPackage(AndrolibResources.java:419)
    ... 5 more
 *** Putting things back like nothing ever happened...
updating: classes.dex (deflated 60%)
 *** Pushing changes to device...
4332 KB/s (5565313 bytes in 1.254s)
 *** All done! :)

CyanogenMod 12.1 on LG G3 D855. What does this mean?

Not working on N9005

When I try to run the script on my Samsung Galaxy Note 3 LTE (9005), I get this error:

$:~$ sudo /home/dave/Desktop/patch.py *** Selected device 9c939e69 *** Device detected! proceeding... *** Working dir: /tmp/tmpwbx50i7e *** Rooting adbd... adbd is already running as root remount succeeded *** Pulling framework from device... 4018 KB/s (5536211 bytes in 1.345s) *** Disassembling framework... Error: Unable to access jarfile /home/dave/apktool.jar *** Done. Now this won't hurt a bit... Traceback (most recent call last): File "/home/dave/Desktop/patch.py", line 47, in <module> f = open(to_patch, "r") FileNotFoundError: [Errno 2] No such file or directory: 'framework.jar.out/smali/android/content/pm/PackageParser.smali'

Unable to patch Android 5.1 (Fairphone 2)

Was working (multiple times) before the bunch of recent updates, πŸ˜•
Seems to be related with the new version/use of Apktool, from my point of view.

Log:

$ ./patch.py 
 *** Selected device xXXXxXxX
 *** Device detected! proceeding...
 *** Working dir: /tmp/tmpfkuhbdx0
 *** Rooting adbd...
adbd is already running as root
remount succeeded
 *** Pulling framework from device...
5857 KB/s (5426893 bytes in 0.904s)
 *** Disassembling framework...
 *** Done. Now this won't hurt a bit...
 *** Injection successful. Reassembling smali...
output:classes.dex

UNEXPECTED TOP-LEVEL EXCEPTION:
org.jf.util.ExceptionWithContext: Unsigned short value out of range: 65536
    at org.jf.dexlib2.writer.DexDataWriter.writeUshort(DexDataWriter.java:116)
    at org.jf.dexlib2.writer.InstructionWriter.write(InstructionWriter.java:315)
    at org.jf.dexlib2.writer.DexWriter.writeCodeItem(DexWriter.java:1025)
    at org.jf.dexlib2.writer.DexWriter.writeDebugAndCodeItems(DexWriter.java:801)
    at org.jf.dexlib2.writer.DexWriter.writeTo(DexWriter.java:250)
    at org.jf.dexlib2.writer.DexWriter.writeTo(DexWriter.java:228)
    at org.jf.smali.main.main(main.java:293)

Traceback (most recent call last):
  File "./patch.py", line 140, in <module>
    subprocess.check_call(["java", "-jar", os.path.join(SCRIPT_DIR, "tools", "smali.jar"), "classes", "-o", "classes.dex"])
  File "/usr/lib/python3.5/subprocess.py", line 581, in check_call
    raise CalledProcessError(retcode, cmd)
subprocess.CalledProcessError: Command '['java', '-jar', '/home/ubuntu-gnome/Documentos/android/Needle/tools/smali.jar', 'classes', '-o', 'classes.dex']' returned non-zero exit status 2

(Note that I've replaced device id with exes: xXXXxXxX)

Host (Ubuntu Gnome):

$ lsb_release -d
Description:    Ubuntu 16.04.1 LTS

$ python --version`
Python 3.5.2

$ java -version
openjdk version "1.8.0_91"
OpenJDK Runtime Environment (build 1.8.0_91-8u91-b14-3ubuntu1~16.04.1-b14)
OpenJDK 64-Bit Server VM (build 25.91-b14, mixed mode)

(Just in case: Fairphone Open OS is based on CodeAurora sources. Sources for the OS are available at http://code.fairphone.com/)

Not working with Windows

Hello,

after doing a clean install of Cyanogenmod 13 on my LG G2 (D802) smartphone, I wanted to patch the framework with needle to enable signature faking.

I used windows for that, installed everything which is needed before (ADB driver, device driver, Java, Python) but can't get this to work.

Could someone please help me out?

C:\Needle-master>patch.py
*** Selected device 064f036f92af0f5c
*** Device detected! proceeding...
*** Working dir: C:\Users\User\AppData\Local\Temp\tmpak9oiocg
*** Rooting adbd...
restarting adbd as root
remount succeeded
*** Pulling framework from device...
3823 KB/s (5963412 bytes in 1.523s)
*** Disassembling framework...
I: Using Apktool 2.0.2 on framework.jar
I: Baksmaling classes.dex...
I: Baksmaling classes2.dex...
I: Copying assets and libs...
I: Copying unknown files...
I: Copying original files...
*** Done. Now this won't hurt a bit...
*** Injection successful. Reassembling smali...
I: Using Apktool 2.0.2
I: Checking whether sources has changed...
I: Smaling smali folder into classes.dex...
I: Checking whether sources has changed...
I: Smaling smali_classes2 folder into classes2.dex...
W: Could not find resources
I: Building apk file...
*** Putting things back like nothing ever happened...
Traceback (most recent call last):
File "C:\Needle-master\patch.py", line 114, in
subprocess.call(["zip", "-r", "../../../framework.jar", "classes.dex"])
File "C:\Users\User\AppData\Local\Programs\Python\Python35\lib\subprocess.py", line 560, in call
with Popen(_popenargs, *_kwargs) as p:
File "C:\Users\User\AppData\Local\Programs\Python\Python35\lib\subprocess.py", line 950, in init
restore_signals, start_new_session)
File "C:\Users\User\AppData\Local\Programs\Python\Python35\lib\subprocess.py", line 1220, in _execute_child
startupinfo)
FileNotFoundError: [WinError 2] The system can't find the mentioned file

C:\Needle-master>

Remount failed and other directory for PackageParser

Hey,
first some questions.
I have a Samsung S5 (G900F) with Phoenix Rom (debloated, deoxed) and I use microG.
A stupid question: what is the benefit of spoofing signature for microg?
I can use unifiedNLP and Blankmarket without correct signature.
Should it be possible with my phone and rom to inject the signature spoofing?
Your script don't run through.
First stop is where it tries to remount system.
Done this by my own in shell. Pulled the framework.jar
But in my case the file "PackageParser.smali" is not in
/framework.jar.out/smali/android/content/pm/
but in
/framework.jar.out/smali_classes2/android/content/pm/
At the end at building the apk I get an exception, but before I adress this I thought I ask if the things I'm doing are senseless.

NameError Error

When I try to install the patch.py patch, I get the following error message: NameError: name 'false' is not defined. Did you mean: 'False'?

I'm using Lineage Mint 21.3 Virginia. The phone is a Motorola Edge original with Lineageos 20 for the OS.

Maybe I just need to go into the code and find all instances of false and capatilize the f?

HowTo cyanogenmod12.1 remount,rw and push

I had to mount -oremount,rw /system before replacing the framework.jar.
Furthermore adb push exited with a "permission denied" so i pushed it do my sdcard and moved the jar manually per terminal+su. Maybe this depends on "allow root for apps & debug" but i did not care to check.

so to replicate:

su
# <allow root>
mount -oremount,rw /system

# after framework.jar is somewhere on the internal storage/sdcard
mv /storage/sdcard0/framework.jar /system/framework/framework.jar
chown root:root /system/framework/framework.jar
chmod 644 /system/framework/framework.jar

Maybe this is helpful for others with Cyanogenmod 12.1

CM13 patching prints error, but patch works.

I: Building apk file...
Exception in thread "main" brut.androlib.AndrolibException: brut.common.BrutException: could not exec command: [/tmp/brut_util_Jar_6695765770529305153.tmp, p, -F, /tmp/user/1000/tmpwbev4mrg/framework.jar.out/dist/framework.jar, -0, arsc, /tmp/user/1000/tmpwbev4mrg/framework.jar.out/build/apk]
at brut.androlib.res.AndrolibResources.aaptPackage(AndrolibResources.java:425)
at brut.androlib.Androlib.buildApk(Androlib.java:667)
at brut.androlib.Androlib.build(Androlib.java:296)
at brut.androlib.Androlib.build(Androlib.java:261)
at brut.apktool.Main.cmdBuild(Main.java:225)
at brut.apktool.Main.main(Main.java:84)
Caused by: brut.common.BrutException: could not exec command: [/tmp/brut_util_Jar_6695765770529305153.tmp, p, -F, /tmp/user/1000/tmpwbev4mrg/framework.jar.out/dist/framework.jar, -0, arsc, /tmp/user/1000/tmpwbev4mrg/framework.jar.out/build/apk]
at brut.util.OS.exec(OS.java:93)
at brut.androlib.res.AndrolibResources.aaptPackage(AndrolibResources.java:419)
... 5 more
Caused by: java.io.IOException: Cannot run program "/tmp/brut_util_Jar_6695765770529305153.tmp": error=2, No such file or directory
at java.lang.ProcessBuilder.start(ProcessBuilder.java:1048)
at java.lang.Runtime.exec(Runtime.java:620)
at java.lang.Runtime.exec(Runtime.java:485)
at brut.util.OS.exec(OS.java:84)
... 6 more
Caused by: java.io.IOException: error=2, No such file or directory
at java.lang.UNIXProcess.forkAndExec(Native Method)
at java.lang.UNIXProcess.(UNIXProcess.java:248)
at java.lang.ProcessImpl.start(ProcessImpl.java:134)
at java.lang.ProcessBuilder.start(ProcessBuilder.java:1029)
... 9 more
*** Putting things back like nothing ever happened...

Regression: java -jar fails

$ ./patch.py
*** Selected device 5693a2e4
*** Device detected! proceeding...
*** Working dir: /tmp/tmpf8dvncua
*** Rooting adbd...
restarting adbd as root
remount succeeded
*** Pulling framework from device...
3624 KB/s (5973800 bytes in 1.609s)
*** Disassembling framework...
I: Using Apktool 2.2.0 on framework.jar
I: Baksmaling classes.dex...
I: Baksmaling classes2.dex...
I: Copying assets and libs...
I: Copying unknown files...
I: Copying original files...
*** Done. Now this won't hurt a bit...
*** Injection successful. Reassembling smali...
I: Using Apktool 2.2.0
I: Checking whether sources has changed...
I: Smaling smali folder into classes.dex...
I: Checking whether sources has changed...
I: Smaling smali_classes2 folder into classes2.dex...
W: Could not find resources
I: Building apk file...
Exception in thread "main" brut.androlib.AndrolibException: brut.common.BrutException: could not exec: [/tmp/brut_util_Jar_2477187644452509808.tmp, p, -F, /tmp/tmpf8dvncua/framework.jar.out/dist/framework.jar, -0, arsc, /tmp/tmpf8dvncua/framework.jar.out/build/apk]
at brut.androlib.res.AndrolibResources.aaptPackage(AndrolibResources.java:439)
at brut.androlib.Androlib.buildApk(Androlib.java:670)
at brut.androlib.Androlib.build(Androlib.java:310)
at brut.androlib.Androlib.build(Androlib.java:263)
at brut.apktool.Main.cmdBuild(Main.java:224)
at brut.apktool.Main.main(Main.java:84)
Caused by: brut.common.BrutException: could not exec: [/tmp/brut_util_Jar_2477187644452509808.tmp, p, -F, /tmp/tmpf8dvncua/framework.jar.out/dist/framework.jar, -0, arsc, /tmp/tmpf8dvncua/framework.jar.out/build/apk]
at brut.util.OS.exec(OS.java:97)
at brut.androlib.res.AndrolibResources.aaptPackage(AndrolibResources.java:433)
... 5 more
Caused by: java.io.IOException: Cannot run program "/tmp/brut_util_Jar_2477187644452509808.tmp": error=2, No such file or directory
at java.lang.ProcessBuilder.start(ProcessBuilder.java:1048)
at brut.util.OS.exec(OS.java:90)
... 6 more
Caused by: java.io.IOException: error=2, No such file or directory
at java.lang.UNIXProcess.forkAndExec(Native Method)
at java.lang.UNIXProcess.(UNIXProcess.java:248)
at java.lang.ProcessImpl.start(ProcessImpl.java:134)
at java.lang.ProcessBuilder.start(ProcessBuilder.java:1029)
... 7 more
Traceback (most recent call last):
File "./patch.py", line 144, in
subprocess.check_call(["java", "-jar", SCRIPT_DIR+"/apktool.jar", "b", "framework.jar.out"])
File "/usr/lib/python3.5/subprocess.py", line 581, in check_call
raise CalledProcessError(retcode, cmd)
subprocess.CalledProcessError: Command '['java', '-jar', '/home/okias/projects/Needle/apktool.jar', 'b', 'framework.jar.out']' returned non-zero exit status 1

RFE: evaluate DexPatcher

hi,

thank you for this work!

suggestion: instead of patching smali which is brittle, use DexPatcher-tool.

DexPatcher is a set of tools (GPLv3) to patch APKs in a more robust and friendly manner, compared to smali patching. DexPatcher works a bit like xposed but off-line: patching is performed ahead of time and produces a patched application.

the DexPatcher framework includes gradle plugins that automate APK patching in Android Studio and lets you modify and add code and resources using the usual AS app developing tools. but the part of the framework that interests you is DexPatcher-tool.

this tool handles the patching of dex code. it process a dex or APK file and a patch file, and produces a patched dex. the applied patch is a dex (or apk) too, and is compiled from java. patches are comfortably authored in java and are more robust than smali diffs. the DexPatcher-tool itself is pure java and can run on PCs and Android.

the recommended flow for your project would be:

  • development:
    • write the patch(es) in java.
    • compile to dex or apk.
    • distribute the dex or apk patch file(s).
  • patch script:
    • pull the APK from the device (or APKs, if several apps need to be patched).
    • invoke DexPatcher-tool to patch the apk with the respective dex or apk patch file, producing a patched dex file.
    • replace the classes.dex file in the APK with the patched dex.
    • push the patched APK (or APKs) back into the device.

you can continue to use apktool to open the APK and replace the dex file (you would need it only for that; use the no-resources and no-smali options), but you can just as well use a zip file processor with the right options to achieve the same result.

the documentation for the framework is found here. to get a feel for how patches are written, please refer to the section "PATCHING JAVA CODE IN JAVA".

workflow for patch development:

  • for your atypical case (users doing the patching), you can consider skipping the gradle tools and going for the (deprecated) command line "workflow automation scripts" (which only run on Linux). this would produce dex patch files that you can distribute with your patcher tool (and your patcher tool can still be cross-platform). the scrips are documented here.
  • but maybe it would be better if you used the full gradle and Android Studio circus. AS integration is a bit harder to set up and has a steeper learning curve but is more powerful; your choice. read the "START HERE !" section of the docs to setup and understand the gradle workflow.

disclosure: i am the author of DexPatcher.

unlike xposed, the DexPatcher workflow modifies the signature of apks. this limits its applicability in the general case. DexPatcher can greatly benefit from signature spoofing and this project. it is a rare occurrence that both our projects can benefit from and depend on each other.

Not working on Android 7.1 (CM 14.1)

Tried to apply latest master to Cyanogenmod 14.1 running on an LG G4. Output:

 *** Selected device LGH81539e3a2ee
 *** Device detected! proceeding...
 *** Working dir: /tmp/tmpJJWFep
 *** Rooting adbd...
remount succeeded
 *** Pulling framework from device...
 *** Disassembling framework...
Exception in thread "main" org.jf.dexlib2.dexbacked.DexBackedDexFile$NotADexFile: Invalid magic value: 64 65 78 0a 30 33 37 00
        at org.jf.dexlib2.dexbacked.DexBackedDexFile.verifyMagicAndByteOrder(DexBackedDexFile.java:151)
        at org.jf.dexlib2.dexbacked.DexBackedDexFile.<init>(DexBackedDexFile.java:70)
        at org.jf.dexlib2.dexbacked.DexBackedDexFile.<init>(DexBackedDexFile.java:96)
        at org.jf.dexlib2.DexFileFactory.loadDexFiles(DexFileFactory.java:109)
        at org.jf.dexlib2.DexFileFactory.loadDexFiles(DexFileFactory.java:81)
        at org.jf.baksmali.main.main(main.java:259)
Traceback (most recent call last):
  File "patch.py", line 67, in <module>
    subprocess.check_call(["java", "-jar", os.path.join(SCRIPT_DIR, "tools", "baksmali.jar"), "framework.jar", "-o", "classes", "-ls"])
  File "/usr/lib/python2.7/subprocess.py", line 541, in check_call
    raise CalledProcessError(retcode, cmd)
subprocess.CalledProcessError: Command '['java', '-jar', '/home/felix/software/Needle/tools/baksmali.jar', 'framework.jar', '-o', 'classes', '-ls']' returned non-zero exit status 1

Happy to help.

Exception in thread: "Invalid magic value"

When running needle on a rooted phone, I get the following exception:

*** Selected device 569e42f8
 *** Device detected! proceeding...
 *** Working dir: /var/folders/x2/3tcjr3p12cj5_y9v2k69smpm0000gn/T/tmpdtp8jbt3
 *** Rooting adbd...
adbd is already running as root
remount succeeded
 *** Pulling framework from device...
 *** Disassembling framework...
Exception in thread "main" org.jf.dexlib2.dexbacked.DexBackedDexFile$NotADexFile: Invalid magic value: 64 65 78 0a 30 33 37 00
	at org.jf.dexlib2.dexbacked.DexBackedDexFile.verifyMagicAndByteOrder(DexBackedDexFile.java:151)
	at org.jf.dexlib2.dexbacked.DexBackedDexFile.<init>(DexBackedDexFile.java:70)
	at org.jf.dexlib2.dexbacked.DexBackedDexFile.<init>(DexBackedDexFile.java:96)
	at org.jf.dexlib2.DexFileFactory.loadDexFiles(DexFileFactory.java:109)
	at org.jf.dexlib2.DexFileFactory.loadDexFiles(DexFileFactory.java:81)
	at org.jf.baksmali.main.main(main.java:259)
Traceback (most recent call last):
  File "patch.py", line 67, in <module>
    subprocess.check_call(["java", "-jar", os.path.join(SCRIPT_DIR, "tools", "baksmali.jar"), "framework.jar", "-o", "classes", "-ls"])
  File "/usr/local/Cellar/python3/3.5.2_3/Frameworks/Python.framework/Versions/3.5/lib/python3.5/subprocess.py", line 581, in check_call
    raise CalledProcessError(retcode, cmd)
subprocess.CalledProcessError: Command '['java', '-jar', '/Users/User/Desktop/Needle-master/tools/baksmali.jar', 'framework.jar', '-o', 'classes', '-ls']' returned non-zero exit status 1

Thanks!

Error when flashing on cm13 at LG H815 (nightly 2016-05-29)

Getting error:

Disassembling framework.jar ...
CANNOT LINK EXECUTABLE: "/system/lib/liblog.so" is 32-bit instead of 64-bit
page record for 0x7fad910010 was not found (block_size=32)
Prozess Updater endete mit FEHLER: 1
Fehler beim Installieren von ZIP.

Provide extra documentation

could you please provide extra documentation in the form of:

  • java source of PackageParser.fillinsig()
  • before and after smalis of PackageParser

otherwise it is much harder to understand whats going on than necessary.

Regression: Pushing changes fails with device not found

After last changes, reverting to 9934300 solve issue.

Something around adb check must broken later workflow...

*** Putting things back like nothing ever happened...
updating: classes.dex (deflated 60%)
*** Pushing changes to device...
error: device '5693a2e4' not found
Traceback (most recent call last):
File "./patch.py", line 138, in
subprocess.check_output(["adb", "-s", chosen_one, "push", "framework.jar", "/system/framework/framework.jar"])
File "/usr/lib/python3.5/subprocess.py", line 626, in check_output
**kwargs).stdout
File "/usr/lib/python3.5/subprocess.py", line 708, in run
output=stdout, stderr=stderr)
subprocess.CalledProcessError: Command '['adb', '-s', '5693a2e4', 'push', 'framework.jar', '/system/framework/framework.jar']' returned non-zero exit status 1

Python script stalls out

;Phone is attached and in debug mode. I run the script, and get this

~$ sudo /home/dave/Downloads/Needle-master/patch.py

Enter id of device to target:

1 - * daemon started successfully *

2 - List of devices attached

3 - 9c928e59

and nothing more. It is stalled there indefinitely.

Does not work with odexed/oat ROMs (Lollipop + Marshmallow)

I've just upgraded my Samsung Galaxy Nexus to official CM 12.1 nightlies. Unfortunately patching fails there, as the framework is odexed, i.e. framework.jar is empty, the code is in /system/framework/arm/boat.oat. smali seems to have support for deodexing ART oat files but only for Marshmellow. There is also another oat2dex.jar which seems to be used by other tools that claim Android 5.0 support. With java -jar oat2dex.jar -a 22 smali ../../Needle/boot.oat I have been able to produce a PackageParser.smali file that could be patched. However I don't know if it is possible to re-assemble to result and if yes, how to do that (or what to do instead). Some of the binaries that use oat2dex.jar appear to be able to do that, but - as far as I can see - most of them are close source and Windows only (and I have only Linux...).

unable to install on Linux (Debian)

I just tried to run patch.py on Debian using "python3 patch.py"

This is what it returns:

*** Device detected! proceeding...
*** Working dir: /tmp/tmpi_qbrdss
*** Rooting adbd...
remount succeeded
*** Pulling framework from device...
220 KB/s (309 bytes in 0.001s)
*** Disassembling framework...
I: Using Apktool 2.0.2 on framework.jar
I: Copying assets and libs...
I: Copying unknown files...
I: Copying original files...
*** Done. Now this won't hurt a bit...
Traceback (most recent call last):
File "patch.py", line 47, in
f = open(to_patch, "r")
FileNotFoundError: [Errno 2] No such file or directory: 'framework.jar.out/smali/android/content/pm/PackageParser.smali'

What am I doing wrong? Am I missing a package perhaps?

Incompatibility with CyanogenMod 13

I tried to run this script with CM13 on my Nexus 5 (2013) and I restarted the phone but I keep having the same invalid signature errors on logcat when opening an app that uses Google services.

Is the script compatible with CM13?

Problem "framework.jar"

Hello,

I can't make it work...I probably miss something obvious but can you help me?
Here's the log

H:\Softs\Huawei Ascend P7\Needle-master\Needle-master>patch.py
*** Selected device 7N2NEF1452015842
*** Device detected! proceeding...
*** Working dir: C:\Users\batto\AppData\Local\Temp\tmp7lp9q7xy
*** Rooting adbd...
adbd is already running as root
remount succeeded
*** Pulling framework from device...
2867 KB/s (38175 bytes in 0.013s)
*** Disassembling framework...
Exception in thread "main" org.jf.util.ExceptionWithContext: framework.jar is not an apk, dex file or odex file.
at org.jf.dexlib2.DexFileFactory.loadDexFiles(DexFileFactory.java:140)
at org.jf.dexlib2.DexFileFactory.loadDexFiles(DexFileFactory.java:81)
at org.jf.baksmali.main.main(main.java:259)

Traceback (most recent call last):
File "H:\Softs\Huawei Ascend P7\Needle-master\Needle-master\patch.py", line 67, in
subprocess.check_call(["java", "-jar", os.path.join(SCRIPT_DIR, "tools", "baksmali.jar"), "framework.jar", "-o", "classes", "-ls"])
File "C:\Users\batto\AppData\Local\Programs\Python\Python35\lib\subprocess.py", line 581, in check_call
raise CalledProcessError(retcode, cmd)
subprocess.CalledProcessError: Command '['java', '-jar', 'H:\Softs\Huawei Ascend P7\Needle-master\Needle-master\tools\baksmali.jar', 'framework.jar', '-o', 'classes', '-ls']'
returned non-zero exit status 1

Probleme with extension ".jar"?
Will provide necessary informations about config if needed.
Thanks in advance

How do I give adb root access?

In the docs this was not very clear to me, as there is no option to do it from Developer Settings. Should it be done from the terminal, the sudo app...? My phone is a 4.4 Kit Kat

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    πŸ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. πŸ“ŠπŸ“ˆπŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❀️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.