Skip to content

Commit

Permalink
Merge pull request #248 from HenryHoggard/feature/244_platform-archit…
Browse files Browse the repository at this point in the history
…ecture

[Feature] Architecture and Platform API
  • Loading branch information
HenryHoggard authored Jan 23, 2017
2 parents 0a0c109 + f2417a0 commit fd2262f
Show file tree
Hide file tree
Showing 3 changed files with 36 additions and 3 deletions.
1 change: 1 addition & 0 deletions src/drozer/modules/common/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@
from drozer.modules.common.loader import ClassLoader
from drozer.modules.common.package_manager import PackageManager
from drozer.modules.common import path_completion
from drozer.modules.common.platform import Platform
from drozer.modules.common.provider import Provider
from drozer.modules.common.shell import Shell
from drozer.modules.common.shell_code import ShellCode
Expand Down
31 changes: 31 additions & 0 deletions src/drozer/modules/common/platform.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,31 @@



class Platform(object):
"""
Methods for identifying platform information
"""

def getArchitecture(self):
"""
Get device architecture
"""

return self.klass('java.lang.System').getProperty("os.arch").upper()

def isPIE(self):
"""
Is PIE enforced on the device
"""

if self.klass("android.os.Build$VERSION").SDK_INT >= 21:
return True
else:
return False

def getBuildVersion(self):
"""
Get Android Device Version
"""

return self.klass("android.os.Build$VERSION").SDK_INT
7 changes: 4 additions & 3 deletions src/drozer/modules/tools/setup/busybox.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
from drozer.modules import common, Module

class BusyBox(Module, common.BusyBox, common.Shell):
class BusyBox(Module, common.BusyBox, common.Shell, common.Platform):

name = "Install Busybox."
description = """Installs Busybox on the Agent.
Expand All @@ -25,9 +25,9 @@ def execute(self, arguments):
# if "Y" not in response.upper():
# return

if self.klass("android.os.Build$VERSION").SDK_INT >= 21:
if self.isPIE():
if self.installBusyBox(True):
self.stdout.write("BusyBox installed " + + self.busyboxPath() + "\n")
self.stdout.write("BusyBox installed " + self.busyboxPath() + "\n")
else:
self.stdout.write("BusyBox installation failed.\n")
else:
Expand All @@ -36,3 +36,4 @@ def execute(self, arguments):
else:
self.stdout.write("BusyBox installation failed.\n")


0 comments on commit fd2262f

Please sign in to comment.