Attend XDA's Second Annual Developer Conference, XDA:DevCon 2014!
5,731,235 Members 51,745 Now Online
XDA Developers Android and Mobile Development Forum

[SCRIPT] Proprietary Lib Cleaner (silence logcat spammers with ease)

Tip us?
 
bsimpson1
Old
(Last edited by bsimpson1; 14th June 2014 at 08:29 PM.)
#11  
Senior Member
Thanks Meter 33
Posts: 183
Join Date: Jun 2013
First of all, thanks a lot for these scripts, and for the tutorial you provided in your other thread on how to patch them manually. The script seemed to work just fine but for some reason the resulting binaries would be a few bytes smaller than the original file and so I'd get an error that would say something about ELF header magic ( can't remember the exact error message) and they could not be executed. I decided to try to create my own script and finally managed to get something working. My original script is run from the phone itself, but I tried to port it to yours as a dbs/patcher script replacement, keeping as much of the original functionality as I could. It seems to work, but could maybe use some polishing. I thought you might be interested in it, as it does not require any installation of extra binaries (it uses grep and dd to perform the functions of sfk). Feel free to use any of it how and where you might see fit. To use it just put it into dbs in place of the original patcher script.

Update: The patcher in patcherv2.zip now correctly restores the file permissions.


As an interesting side note I noticed that with unmodified files, my CPU usage while the phone is otherwise idle and only a single core is active, is reported as 3% with periodic spikes every few seconds of up to 10%. Once the strings are cleaned from the files, the CPU consistently reports usage of 0% or 1%, and the spikes are completely nonexistent.
Attached Files
File Type: zip patcher.zip - [Click for QR Code] (1.4 KB, 3 views)
File Type: zip patcherv2.zip - [Click for QR Code] (1.6 KB, 7 views)
The Following 3 Users Say Thank You to bsimpson1 For This Useful Post: [ Click to Expand ]
 
broodplank1337
Old
(Last edited by broodplank1337; 21st June 2014 at 03:50 AM.)
#12  
broodplank1337's Avatar
Recognized Contributor / Recognized Developer - OP
Thanks Meter 9884
Posts: 4,921
Join Date: Nov 2011
Location: Nijmegen

 
DONATE TO ME
Quote:
Originally Posted by Chahk View Post
Is it possible to run the patches directly on the phone via terminal emulator or adb shell (assuming all prerequisites like adb, drivers, and sfk are installed)?
yes with some modification to the code it can do that. but you will have to convert it to real sh script instead of bash. it's somewhat different.

Quote:
Originally Posted by bsimpson1 View Post
First of all, thanks a lot for these scripts, and for the tutorial you provided in your other thread on how to patch them manually. The script seemed to work just fine but for some reason the resulting binaries would be a few bytes smaller than the original file and so I'd get an error that would say something about ELF header magic ( can't remember the exact error message) and they could not be executed. I decided to try to create my own script and finally managed to get something working. My original script is run from the phone itself, but I tried to port it to yours as a dbs/patcher script replacement, keeping as much of the original functionality as I could. It seems to work, but could maybe use some polishing. I thought you might be interested in it, as it does not require any installation of extra binaries (it uses grep and dd to perform the functions of sfk). Feel free to use any of it how and where you might see fit. To use it just put it into dbs in place of the original patcher script.

Update: The patcher in patcherv2.zip now correctly restores the file permissions.


As an interesting side note I noticed that with unmodified files, my CPU usage while the phone is otherwise idle and only a single core is active, is reported as 3% with periodic spikes every few seconds of up to 10%. Once the strings are cleaned from the files, the CPU consistently reports usage of 0% or 1%, and the spikes are completely nonexistent.
You're welcome. This may be caused because the strings are replaced with "nothing", It might be a good idea for me to count the numbers (in hex) of the string and then replace it all with zero's instead. I think this creates more compatibility, but I'm not 100% sure of that.
Some files indeed get corrupted by hexxing them, (at least when removing strings), maybe putting zero's there would fix it. as I am not advanced in hex at all I honestly don't know before I have tested it.. anyways, the binary templates that are included should not corrupt the files.

I really appreciate you have put this effort in updating the patcher. It really looks awesome, I have not tested it yet, but if it really can replace sfk consistently It will be great. I will take a look at the script and I am certainly interested in it! The script looks pretty advanced to me actually, for example that regex is just badass!
I think I will integrate your patcher and generate an option that lets you choose between your method (local patching, on PC) and my method (remote patching, on phone), that way users could choose what they prefer. Of course I will add your credits to the top because you made it. not me :P

I will look into this very soon, for the meanwhile you could create merge pull requests on the git if you'd like.

And btw I am really glad to hear that removing the strings actually lowered the cpu usage , that's a great thing! and is absolutely the goal of the script next to making it more readable ^^

Thanks a lot for your wisdom and effort on this patcher
Device: Samsung Galaxy S4 (i9505)

Latest Development:
 

Roms:
AOSP v4.4.4 (KTU84P) from source for I9505 (Github)
- Cleanest ROM available for i9505. along with up-to-date stock kernel, also forms a perfect base for ROM developers.

Apps:
Galaxy S4 Glove Mode App (Playstore link)
- Do you want the Glove Mode of the S4 but your ROM doesn't support it? Use this app to enable/disable it easily.

Latest Scraps:
Proprietary Lib Cleaner / Silent proprietary libs / Live Thermal Monitor / GIT Conflict Fixer

Projects in development:
 

broodROM KitKat "Aiming for perfection"
- Custom ROM with really high standards, more info soon

For sources you can visit my Github. Or take a look at all my projects

The Following User Says Thank You to broodplank1337 For This Useful Post: [ Click to Expand ]
 
bsimpson1
Old
#13  
Senior Member
Thanks Meter 33
Posts: 183
Join Date: Jun 2013
Quote:
Originally Posted by broodplank1337 View Post
yes with some modification to the code it can do that. but you will have to convert it to real sh script instead of bash. it's somewhat different.



You're welcome. This may be caused because the strings are replaced with "nothing", It might be a good idea for me to count the numbers (in hex) of the string and then replace it all with zero's instead. I think this creates more compatibility, but I'm not 100% sure of that.
Some files indeed get corrupted by hexxing them, (at least when removing strings), maybe putting zero's there would fix it. as I am not advanced in hex at all I honestly don't know before I have tested it.. anyways, the binary templates that are included should not corrupt the files.

I really appreciate you have put this effort in updating the patcher. It really looks awesome, I have not tested it yet, but if it really can replace sfk consistently It will be great. I will take a look at the script and I am certainly interested in it! The script looks pretty advanced to me actually, for example that regex is just badass!
I think I will integrate your patcher and generate an option that lets you choose between your method (local patching, on PC) and my method (remote patching, on phone), that way users could choose what they prefer. Of course I will add your credits to the top because you made it. not me :P

I will look into this very soon, for the meanwhile you could create merge pull requests on the git if you'd like.

And btw I am really glad to hear that removing the strings actually lowered the cpu usage , that's a great thing! and is absolutely the goal of the script next to making it more readable ^^

Thanks a lot for your wisdom and effort on this patcher
I'm glad to help! I'm not very familiar with binary files myself. I recently noticed that it's possible to simply pass the flag '-o' to the 'strings' command to print the byte offset along with each string! I think that would be a lot more reliable than using grep, not to mention faster. Since that's also how other users will be getting the strings to use for the templates it seems like a very good option also. I'll see if I can come up with a revised version

Unfortunately, the version of strings that's provided by busybox on my phone doesn't have the -o option, but i managed to find a version of the real strings binary with -o support that runs on android, so it could be very possible to eventually make a flashable zip or version that runs on the phone: strings-armeabi.zip (can't seem to remember where i found this)
The Following User Says Thank You to bsimpson1 For This Useful Post: [ Click to Expand ]
 
broodplank1337
Old
#14  
broodplank1337's Avatar
Recognized Contributor / Recognized Developer - OP
Thanks Meter 9884
Posts: 4,921
Join Date: Nov 2011
Location: Nijmegen

 
DONATE TO ME
Quote:
Originally Posted by bsimpson1 View Post
I'm glad to help! I'm not very familiar with binary files myself. I recently noticed that it's possible to simply pass the flag '-o' to the 'strings' command to print the byte offset along with each string! I think that would be a lot more reliable than using grep, not to mention faster. Since that's also how other users will be getting the strings to use for the templates it seems like a very good option also. I'll see if I can come up with a revised version

Unfortunately, the version of strings that's provided by busybox on my phone doesn't have the -o option, but i managed to find a version of the real strings binary with -o support that runs on android, so it could be very possible to eventually make a flashable zip or version that runs on the phone: Attachment 2810739 (can't seem to remember where i found this)
Me neither hehe, I just tested the -o flag and you're right , it works, it returns idd the byte offset. that is nice. and it would be faster for sure, dd'ing some bytes to a certain area has to be faster then grep/replace. But my concern is that maybe the byte offsets are not the same on files, which could easily corrupt the binary if it doesn't match the template. And how do you calculate how many bytes should be flashed to the byte offset? or you just want to jump to the offset and then replace hex? i am not sure which is better honestly. Anyways, I appreciate it that you want to come up with a revised version maybe :P

Oh it didn't? Do you perhaps have an old version of busybox? I have "BusyBox v1.21.1-kk bionic" and for me it works in android (adb shell, with for example "busybox strings -o /system/bin/mpdecision"), so there wouldn't be need for a seperate binary, just an updated busybox.

Anyways, before we could seriously replace the method we need to do a lot of testing ;p
Device: Samsung Galaxy S4 (i9505)

Latest Development:
 

Roms:
AOSP v4.4.4 (KTU84P) from source for I9505 (Github)
- Cleanest ROM available for i9505. along with up-to-date stock kernel, also forms a perfect base for ROM developers.

Apps:
Galaxy S4 Glove Mode App (Playstore link)
- Do you want the Glove Mode of the S4 but your ROM doesn't support it? Use this app to enable/disable it easily.

Latest Scraps:
Proprietary Lib Cleaner / Silent proprietary libs / Live Thermal Monitor / GIT Conflict Fixer

Projects in development:
 

broodROM KitKat "Aiming for perfection"
- Custom ROM with really high standards, more info soon

For sources you can visit my Github. Or take a look at all my projects

Tags
clean, hex, proprietary libs, shell script
Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes