question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

get_details_permissions() working correctly?

See original GitHub issue

Describe what you wanted to do

I’m getting odd results from calling get_details_permissions() as every permission is marked as unknown and ‘normal’

Describe what you expected

a, dx, d = AnalyzeAPK('package.apk')
a.get_details_permissions()

Given this list of permissions found:

['com.android.launcher.permission.INSTALL_SHORTCUT',
 'android.permission.READ_SETTINGS',
 'android.permission.WRITE_SETTINGS',
 'android.permission.ACCESS_NETWORK_STATE',
 'android.permission.WRITE_EXTERNAL_STORAGE',
 'android.permission.INTERNET',
 'android.permission.READ_PHONE_STATE',
 'android.permission.READ_SMS',
 'android.permission.SEND_SMS',
 'android.permission.RECEIVE_SMS',
 'android.permission.READ_CONTACTS']

I would expect to get appropriate levels, for instance READ_SMS should return dangerous

Describe what actually happened

This is the actual result:

{'android.permission.ACCESS_NETWORK_STATE': ['normal',
  'Unknown permission from android reference',
  'Unknown permission from android reference'],
 'android.permission.INTERNET': ['normal',
  'Unknown permission from android reference',
  'Unknown permission from android reference'],
 'android.permission.READ_CONTACTS': ['normal',
  'Unknown permission from android reference',
  'Unknown permission from android reference'],
 'android.permission.READ_PHONE_STATE': ['normal',
  'Unknown permission from android reference',
  'Unknown permission from android reference'],
 'android.permission.READ_SETTINGS': ['normal',
  'Unknown permission from android reference',
  'Unknown permission from android reference'],
 'android.permission.READ_SMS': ['normal',
  'Unknown permission from android reference',
  'Unknown permission from android reference'],
 'android.permission.RECEIVE_SMS': ['normal',
  'Unknown permission from android reference',
  'Unknown permission from android reference'],
 'android.permission.SEND_SMS': ['normal',
  'Unknown permission from android reference',
  'Unknown permission from android reference'],
 'android.permission.WRITE_EXTERNAL_STORAGE': ['normal',
  'Unknown permission from android reference',
  'Unknown permission from android reference'],
 'android.permission.WRITE_SETTINGS': ['normal',
  'Unknown permission from android reference',
  'Unknown permission from android reference'],
 'com.android.launcher.permission.INSTALL_SHORTCUT': ['normal',
  'Unknown permission from android reference',
  'Unknown permission from android reference']}

System Information

  • Androguard Version: 3.3.4 (same happens for 3.2.1)
  • Python Version: 3.7
  • Operating Systems: Mac OS, Linux, Windows

Issue Analytics

  • State:closed
  • Created 5 years ago
  • Comments:7 (4 by maintainers)

github_iconTop GitHub Comments

1reaction
reoxcommented, Feb 12, 2019

there is actually a default API setting. it will change now to this:

$ androguard analyze 0b3b5785f41f80bbb1fa70533cfa9acd24fd9262e9b868bcf1c6790fbf206898                   
Please be patient, this might take a while.                                                                          
Found the provided file is of type 'APK'                                                                             
[WARNING ] androguard.default: API mapping for API level 5 was not found! Returning default, which is API level 16   
[INFO    ] androguard.analysis: End of creating cross references (XREF)                                              
[INFO    ] androguard.analysis: run time: 0min 00s                                                                   
Added file to session: SHA256::0b3b5785f41f80bbb1fa70533cfa9acd24fd9262e9b868bcf1c6790fbf206898                      
Loaded APK file...                                                                                                   
>>> a                                                                                                                
<androguard.core.bytecodes.apk.APK object at 0x0000000005768E10>                                                     
>>> d                                                                                                                
[<androguard.core.bytecodes.dvm.DalvikVMFormat object at 0x00000000101B3E10>]                                        
>>> dx                                                                                                               
<analysis.Analysis VMs: 1, Classes: 99, Strings: 106>                                                                
                                                                                                                     
Androguard version 3.3.4 started                                                                                     
In [1]: a.get_details_permissions()                                                                                  
Out[1]:                                                                                                              
{'android.permission.READ_CONTACTS': ['dangerous',                                                                   
  '@string/permlab_readContacts',                                                                                    
  '@string/permdesc_readContacts'],                                                                                  
 'android.permission.WRITE_EXTERNAL_STORAGE': ['dangerous',                                                          
  '@string/permlab_sdcardWrite',                                                                                     
  '@string/permdesc_sdcardWrite'],                                                                                   
 'android.permission.ACCESS_NETWORK_STATE': ['normal',                                                               
  '@string/permlab_accessNetworkState',                                                                              
  '@string/permdesc_accessNetworkState'],                                                                            
 'android.permission.INTERNET': ['dangerous',                                                                        
  '@string/permlab_createNetworkSockets',                                                                            
  '@string/permdesc_createNetworkSockets'],                                                                          
 'android.permission.READ_SETTINGS': ['normal',                                                                      
  'Unknown permission from android reference',                                                                       
  'Unknown permission from android reference'],                                                                      
 'android.permission.SEND_SMS': ['dangerous',                                                                        
  '@string/permlab_sendSms',                                                                                         
  '@string/permdesc_sendSms'],                                                                                       
 'com.android.launcher.permission.INSTALL_SHORTCUT': ['normal',                                                      
  '@string/permlab_install_shortcut',                                                                                
  '@string/permdesc_install_shortcut'],                                                                              
 'android.permission.RECEIVE_SMS': ['dangerous',                                                                     
  '@string/permlab_receiveSms',                                                                                      
  '@string/permdesc_receiveSms'],                                                                                    
 'android.permission.READ_PHONE_STATE': ['dangerous',                                                                
  '@string/permlab_readPhoneState',                                                                                  
  '@string/permdesc_readPhoneState'],                                                                                
 'android.permission.READ_SMS': ['dangerous',                                                                        
  '@string/permlab_readSms',                                                                                         
  '@string/permdesc_readSms'],                                                                                       
 'android.permission.WRITE_SETTINGS': ['dangerous',                                                                  
  '@string/permlab_writeSettings',                                                                                   
  '@string/permdesc_writeSettings']}           

Let’s see if we can fix #529 as well.

0reactions
RamonBeastcommented, Feb 12, 2019

Yes makes sense, the behavior might be to load the next higher version available or the highest available if the analysed targetSDK is above the highest one available (the 2 apk provided fall one in the first category and the other on the second).

Thanks for your prompt answers

Read more comments on GitHub >

github_iconTop Results From Across the Web

Request app permissions - Android Developers
Overview · Get started · Layouts and binding expressions · Work with observable ... Request app permissions · Explain access to more sensitive...
Read more >
Change app permissions on your Android phone
If you can't find it, tap See all apps. Then, choose your app. Tap Permissions. If you allowed or denied any permissions for...
Read more >
"Access Denied" or other errors when you access or work with ...
Right -click the file or folder, and then click Properties. Click the Security tab. Under Group or user names, click your name to...
Read more >
How to manage Linux permissions for users, groups, and others
How to manage permissions and ownership for users, groups, and all others to resources such as directories and files.
Read more >
Permissions Reference - Graph API - Facebook for Developers
Getting permissions from app users involves the following steps: Choose the permissions that your app needs to function as intended.
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found