Ejemplo n.º 1
0
class Method(metaclass=JavaClassDef,
             jvm_name='java/lang/reflect/Method',
             jvm_fields=[
                 JavaFieldDef('slot', 'I', False, ignore=True),
                 JavaFieldDef('declaringClass', 'Ljava/lang/Class;', False),
             ],
             jvm_super=Executable):
    def __init__(self, clazz: JavaClassDef, method: JavaMethodDef):
        super().__init__()
        self._clazz = clazz
        self._method = method
        self.slot = method.jvm_id
        self.declaringClass = self._clazz
        self.accessFlags = method.modifier

    @staticmethod
    @java_method_def(name="getMethodModifiers",
                     signature="(Ljava/lang/Class;I)I",
                     args_list=['jobject', 'jint'],
                     ignore=True)
    def get_method_modifiers(emu, clazz_obj, jvm_method_id):
        clazz = clazz_obj.value
        method = clazz.find_method_by_id(jvm_method_id)

        logger.debug('get_method_modifiers(%s, %s)' %
                     (clazz.jvm_name, method.name))

        if method.modifier is None:
            raise RuntimeError('No modifier was given to class %s method %s' %
                               (clazz.jvm_name, method.name))

        return method.modifier
Ejemplo n.º 2
0
class Constructor(metaclass=JavaClassDef,
                  jvm_name='java/lang/reflect/Constructor',
                  jvm_fields=[
                      JavaFieldDef('slot', 'I', False, ignore=True),
                      JavaFieldDef('declaringClass', 'Ljava/lang/Class;', False)],
                  jvm_super=Executable):

    def __init__(self, clazz: JavaClassDef, method: JavaMethodDef):
        self._clazz = clazz
        self._method = method
        self.slot = method.jvm_id
        self.declaringClass = self._clazz
        self.accessFlags = method.modifier
class PackageInfo(metaclass=JavaClassDef,
                  jvm_name='android/content/pm/PackageInfo',
                  jvm_fields=[
                      JavaFieldDef('applicationInfo',
                                   'Landroid/content/pm/ApplicationInfo;',
                                   False),
                      JavaFieldDef('firstInstallTime', 'J', False),
                      JavaFieldDef('lastUpdateTime', 'J', False)
                  ]):
    def __init__(self, pyPkgName):
        self.applicationInfo = ApplicationInfo(pyPkgName)
        self.firstInstallTime = int(time.time())
        self.lastUpdateTime = self.firstInstallTime
Ejemplo n.º 4
0
class ApplicationInfo(metaclass=JavaClassDef,
                      jvm_name='android/content/pm/ApplicationInfo',
                      jvm_fields=[
                          JavaFieldDef('sourceDir', 'Ljava/lang/String;',
                                       False),
                          JavaFieldDef('dataDir', 'Ljava/lang/String;', False),
                          JavaFieldDef('nativeLibraryDir',
                                       'Ljava/lang/String;', False)
                      ]):
    def __init__(self):
        self.sourceDir = "/data/app/com.myxh.coolshopping/"
        self.dataDir = "/data/data/com.myxh.coolshopping/"
        self.nativeLibraryDir = "/data/data/com.myxh.coolshopping/lib/"
class ApplicationInfo(metaclass=JavaClassDef,
                      jvm_name='android/content/pm/ApplicationInfo',
                      jvm_fields=[
                          JavaFieldDef('sourceDir', 'Ljava/lang/String;',
                                       False),
                          JavaFieldDef('dataDir', 'Ljava/lang/String;', False),
                          JavaFieldDef('nativeLibraryDir',
                                       'Ljava/lang/String;', False),
                          JavaFieldDef('flags', 'I', False),
                      ]):
    def __init__(self, pyPkgName):
        self.sourceDir = String("/data/app/%s/" % pyPkgName)
        self.dataDir = String("/data/data/%s" % pyPkgName)
        self.nativeLibraryDir = String("/data/data/%s" % pyPkgName)
        self.flags = 0x30e8bf46
Ejemplo n.º 6
0
class Context(metaclass=JavaClassDef,
              jvm_name='android/content/Context',
              jvm_fields=[
                  JavaFieldDef('WIFI_SERVICE', 'Ljava/lang/String;', True,
                               "wifi")
              ]):
    def __init__(self):
        self.__pkg_mgr = PackageManager()
        self.__resolver = ContentResolver()

    #

    @java_method_def(name='getPackageManager',
                     signature='()Landroid/content/pm/PackageManager;',
                     native=False)
    def getPackageManager(self, emu):
        return self.__pkg_mgr

    #

    @java_method_def(name='getContentResolver',
                     signature='()Landroid/content/ContentResolver;',
                     native=False)
    def getContentResolver(self, emu):
        return self.__resolver

    #

    @java_method_def(name='getSystemService',
                     signature='(Ljava/lang/String;)Ljava/lang/Object;',
                     native=False)
    def getSystemService(self, emu, s1):
        print(s1)
        raise NotImplementedError()
Ejemplo n.º 7
0
class DhcpInfo(metaclass=JavaClassDef,
               jvm_name='android/net/DhcpInfo',
               jvm_fields=[
                   JavaFieldDef('gateway', 'I', False),
               ]):
    def __init__(self):
        self.gateway = 0
Ejemplo n.º 8
0
class Context(metaclass=JavaClassDef,
              jvm_name='android/content/Context',
              jvm_fields=[
                  JavaFieldDef('WIFI_SERVICE', 'Ljava/lang/String;', True,
                               "wifi")
              ]):
    def __init__(self):
        pass

    #

    @java_method_def(name='getPackageManager',
                     signature='()Landroid/content/pm/PackageManager;',
                     native=False)
    def getPackageManager(self, emu):
        pass

    #

    @java_method_def(name='getContentResolver',
                     signature='()Landroid/content/ContentResolver;',
                     native=False)
    def getContentResolver(self, emu):
        pass

    #

    @java_method_def(name='getSystemService',
                     signature='(Ljava/lang/String;)Ljava/lang/Object;',
                     native=False)
    def getSystemService(self, emu, s1):
        pass
Ejemplo n.º 9
0
class Executable(metaclass=JavaClassDef,
                 jvm_name='java/lang/reflect/Executable',
                 jvm_fields=[
                     JavaFieldDef('accessFlags', 'I', False)
                 ]):

    def __init__(self):
        pass
Ejemplo n.º 10
0
class PackageInfo(metaclass=JavaClassDef,
                  jvm_name='android/content/pm/PackageInfo',
                  jvm_fields=[
                      JavaFieldDef('applicationInfo',
                                   'Landroid/content/pm/ApplicationInfo;',
                                   False)
                  ]):
    def __init__(self):
        self.applicationInfo = ApplicationInfo()
Ejemplo n.º 11
0
class Helper(metaclass=JavaClassDef, jvm_name='com/SecShell/SecShell/Helper',
jvm_fields=[
                     JavaFieldDef('PKGNAME', 'Ljava/lang/String;', True, String("com.myxh.coolshopping"))
                 ]):

    def __init__(self):
        pass

    @java_method_def(name='azbycx', signature='(Ljava/lang/String;)Ljava/lang/String;', native=True)
    def azbycx(self, mu):
        pass
Ejemplo n.º 12
0
class WifiConfiguration(metaclass=JavaClassDef,
                        jvm_name='android/net/wifi/WifiConfiguration',
                        jvm_fields=[
                            JavaFieldDef('SSID', 'Ljava/lang/String;', False),
                            JavaFieldDef('hiddenSSID', 'Z', False),
                            JavaFieldDef('BSSID', 'Ljava/lang/String;', False),
                            JavaFieldDef('FQDN', 'Ljava/lang/String;', False),
                            JavaFieldDef('networkId', 'I', False),
                            JavaFieldDef('priority', 'I', False),
                            JavaFieldDef('providerFriendlyName',
                                         'Ljava/lang/String;', False),
                        ]):
    def __init__(self):
        self.SSID = String("")
        self.BSSID = String("")
        self.FQDN = String("")
        self.hiddenSSID = False
        self.networkId = 0
        self.priority = 0
        self.providerFriendlyName = String("hello")