예제 #1
0
 def parse(self, apk_path):
     _check_env()
     command = [aapt, 'dump', 'badging', apk_path]
     logger.debug(' '.join(command))
     output = subprocess.check_output(command)
     for line in output.split('\n'):
         if line.startswith('application-label:'):
             self.label = line.split(':')[1].strip().replace('\'', '')
         elif line.startswith('package:'):
             match = self.version_regex.search(line)
             if match:
                 self.package = match.group('name')
                 self.version_code = match.group('vcode')
                 self.version_name = match.group('vname')
         elif line.startswith('launchable-activity:'):
             match = self.name_regex.search(line)
             self.activity = match.group('name')
         elif line.startswith('native-code'):
             apk_abis = [entry.strip() for entry in line.split(':')[1].split("'") if entry.strip()]
             mapped_abis = []
             for apk_abi in apk_abis:
                 found = False
                 for abi, architectures in ABI_MAP.iteritems():
                     if apk_abi in architectures:
                         mapped_abis.append(abi)
                         found = True
                         break
                 if not found:
                     mapped_abis.append(apk_abi)
             self.native_code = mapped_abis
         else:
             pass  # not interested
예제 #2
0
 def abi(self):
     value = self.execute('{} uname -m'.format(self.busybox)).strip()
     for abi, architectures in ABI_MAP.iteritems():
         if value in architectures:
             result = abi
             break
     else:
         result = value
     return result
예제 #3
0
파일: target.py 프로젝트: JaviMerino/devlib
 def abi(self):
     value = self.execute("uname -m").strip()
     for abi, architectures in ABI_MAP.iteritems():
         if value in architectures:
             result = abi
             break
     else:
         result = value
     return result
예제 #4
0
 def parse(self, apk_path):
     _check_env()
     command = [aapt, 'dump', 'badging', apk_path]
     logger.debug(' '.join(command))
     try:
         output = subprocess.check_output(command, stderr=subprocess.STDOUT)
     except subprocess.CalledProcessError as e:
         raise HostError(
             'Error parsing APK file {}. `aapt` says:\n{}'.format(
                 apk_path, e.output))
     for line in output.split('\n'):
         if line.startswith('application-label:'):
             self.label = line.split(':')[1].strip().replace('\'', '')
         elif line.startswith('package:'):
             match = self.version_regex.search(line)
             if match:
                 self.package = match.group('name')
                 self.version_code = match.group('vcode')
                 self.version_name = match.group('vname')
         elif line.startswith('launchable-activity:'):
             match = self.name_regex.search(line)
             self.activity = match.group('name')
         elif line.startswith('native-code'):
             apk_abis = [
                 entry.strip() for entry in line.split(':')[1].split("'")
                 if entry.strip()
             ]
             mapped_abis = []
             for apk_abi in apk_abis:
                 found = False
                 for abi, architectures in ABI_MAP.iteritems():
                     if apk_abi in architectures:
                         mapped_abis.append(abi)
                         found = True
                         break
                 if not found:
                     mapped_abis.append(apk_abi)
             self.native_code = mapped_abis
         elif line.startswith('uses-permission:'):
             match = self.permission_regex.search(line)
             if match:
                 self.permissions.append(match.group('permission'))
         else:
             pass  # not interested
예제 #5
0
파일: android.py 프로젝트: bjackman/devlib
 def parse(self, apk_path):
     _check_env()
     command = [aapt, 'dump', 'badging', apk_path]
     logger.debug(' '.join(command))
     try:
         output = subprocess.check_output(command, stderr=subprocess.STDOUT)
     except subprocess.CalledProcessError as e:
         raise HostError('Error parsing APK file {}. `aapt` says:\n{}'
                         .format(apk_path, e.output))
     for line in output.split('\n'):
         if line.startswith('application-label:'):
             self.label = line.split(':')[1].strip().replace('\'', '')
         elif line.startswith('package:'):
             match = self.version_regex.search(line)
             if match:
                 self.package = match.group('name')
                 self.version_code = match.group('vcode')
                 self.version_name = match.group('vname')
         elif line.startswith('launchable-activity:'):
             match = self.name_regex.search(line)
             self.activity = match.group('name')
         elif line.startswith('native-code'):
             apk_abis = [entry.strip() for entry in line.split(':')[1].split("'") if entry.strip()]
             mapped_abis = []
             for apk_abi in apk_abis:
                 found = False
                 for abi, architectures in ABI_MAP.iteritems():
                     if apk_abi in architectures:
                         mapped_abis.append(abi)
                         found = True
                         break
                 if not found:
                     mapped_abis.append(apk_abi)
             self.native_code = mapped_abis
         elif line.startswith('uses-permission:'):
             match = self.permission_regex.search(line)
             if match:
                 self.permissions.append(match.group('permission'))
         else:
             pass  # not interested