pkumza / LibRadar

LibRadar - A detecting tool for 3rd-party libraries in Android apps.
Apache License 2.0
262 stars 51 forks source link

How can I use LibRadar to delete the thrid-party librarys in batches? #25

Closed ghost closed 7 years ago

ghost commented 7 years ago

Hello@pkumza I'm trying to delete these libs from my apks, can I use LibRadar to do that?

pkumza commented 7 years ago

I used to support this functionality in version 1. As LibRadar goes to version2, dex analysis is used to replace smali analysis. It becomes harder to implement deletion operation on dex files.

You could export a list of package names of suspicious libraries with LibRadar. Then decompile the apk with Apktool, at last remove the libraries in the list and you will get the core smali code writen by the developer.

On 04/17/2017 15:03, tmliu0606 wrote:

Hello@pkumza I'm trying to delete these libs from my apks, can I use LibRadar to do that?

— You are receiving this because you are subscribed to this thread. Reply to this email directly, view it on GitHub, or mute the thread.

ghost commented 7 years ago

Thanks for your help . I will try the Version 1.

ghost commented 7 years ago

@pkumza I'm using Version 1 and set RM_STATUS to 1, it didn't delete the libs, why is that?

pkumza commented 7 years ago

Try [commit 6b2115] and set RM_STATUS to 2.

pkumza commented 7 years ago

Just change code of main/detect.py(around line 400) to:

if RM_STATUS == 1: 
            cmd = 'rm -rf %s' % apk_path 
            subprocess.call(cmd, shell=True)
elif RM_STATUS == 2: 
            zip_file_name = self.project_path + '/../clean_app/' + os.path.basename(apk_path)[:-3] + 'zip' 
            smali_path = apk_path + '/smali' 
            self.zip_apk(smali_path, zip_file_name) 
            return zip_file_name `

and set RM_STATUS to 2.

ghost commented 7 years ago

Still not working...: self.zip_apk(smali_path, zip_file_name) AttributeError: Detector instance has no attribute 'zip_apk'

pkumza commented 7 years ago

This functionality was implemented in some version but I deleted it after several versions. I delete the libraries detected and then dump smali code into a clean_app folder. Maybe you could find a commit [6b2115] and try this version.


I recommend you get a lib list with LibRadar2 and decompile the apk with Apktool. Then write a automatic script to delete smali files in libraries.

ghost commented 7 years ago

Commit [6b2115] won't work either, I will try writing a script. Thank you very much.