CN104462879A - Root-free running control method and device of application program - Google Patents

Root-free running control method and device of application program Download PDF

Info

Publication number
CN104462879A
CN104462879A CN 201410712400 CN201410712400A CN104462879A CN 104462879 A CN104462879 A CN 104462879A CN 201410712400 CN201410712400 CN 201410712400 CN 201410712400 A CN201410712400 A CN 201410712400A CN 104462879 A CN104462879 A CN 104462879A
Authority
CN
Grant status
Application
Patent type
Prior art keywords
application
package
resources
installation package
resource
Prior art date
Application number
CN 201410712400
Other languages
Chinese (zh)
Other versions
CN104462879B (en )
Inventor
杨威
Original Assignee
北京奇虎科技有限公司
Priority date (The priority date is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the date listed.)
Filing date
Publication date

Links

Classifications

    • GPHYSICS
    • G06COMPUTING; CALCULATING; COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F21/00Security arrangements for protecting computers, components thereof, programs or data against unauthorised activity
    • G06F21/50Monitoring users, programs or devices to maintain the integrity of platforms, e.g. of processors, firmware or operating systems
    • G06F21/52Monitoring users, programs or devices to maintain the integrity of platforms, e.g. of processors, firmware or operating systems during program execution, e.g. stack integrity ; Preventing unwanted data erasure; Buffer overflow
    • G06F21/53Monitoring users, programs or devices to maintain the integrity of platforms, e.g. of processors, firmware or operating systems during program execution, e.g. stack integrity ; Preventing unwanted data erasure; Buffer overflow by executing in a restricted environment, e.g. sandbox or secure virtual machine

Abstract

The invention relates to a root-free running control method of an application program. The method comprises the following steps that a host application program calls an installation package in a reflective mode to serve as a host application program accessory resource of the host application program, the installation package and the host application program are different in name, the installation package is loaded, and a target application program is achieved; a monitoring module is called through the host application program, and the activity of the target application program is monitored; when it is monitored that the target application program needs to call unmatched resources, resource quotation of related calling orders is redirected, and correct resources can be provided for running of the target application program. The invention further relates to a root-free running control device of the application program, and the root-free running control device corresponds to the method. The target application program can run in the sandbox running environment, and the safety of the system can be ensured.

Description

应用程序免Root运行控制方法与装置 Free application execution control method and apparatus Root

技术领域 FIELD

[0001] 本发明涉及计算机软件安全技术领域,尤其涉及一种应用程序免Root运行控制方法及相应的装置。 [0001] The present invention relates to the field of computer software security technology, in particular, it relates to an application for Free Root operation control method and a corresponding apparatus.

背景技术 Background technique

[0002] 沙箱是一种按照安全策略限制程序行为的执行环境,目前已经广泛实用于各种操作系统中。 [0002] sandbox is an execution environment in accordance with the security policy restricts program behavior, has been widely applied to a variety of operating systems. 以Android为例,一些应用程序,出于实现应用程序固有功能需要之外的目的, 特别是商业目的,随意申请系统权限,获取用户隐私数据、执行网络访问、保持设备活动、发送短信行为等。 To Android, for example, some applications, implement applications for purposes other than the inherent functional needs, especially for commercial purposes, arbitrary application system privileges, access to user data privacy, performing network access, keeping the device activities, send SMS behavior. 轻则可能导致用户隐私数据泄露,或者占用系统资源,重则可能通过恶意扣费、植入广告、消耗资费、欺诈诱骗等,使用户遭受损失。 At worst can lead to leakage of user privacy data, or system resources, while possibly through malicious deductions, product placement, consumption rates, fraud, deception, etc., allowing users to suffer losses. 因此,通过沙箱技术提供的执行环境,由沙箱对系统的资源、权限进行管理,让应用程序于该沙箱中运行,应用程序的访问先经沙箱按安全策略进行审查,由此,形成一种相对于系统本身的隔离运行效果,可以有效地保护系统的安全。 Therefore, provided by the technology sandbox execution environment, the resources of the system sandbox, permissions management, let the application run in the sandbox, access to the application by the first review by the sandbox security policy, thus, with respect to itself to form a barrier system running effect, can effectively protect the security system. 对于沙箱中所用到的安全策略,适应各种不同的操作系统有不同的细节考虑,这些有关技术实现的基本知识,均已为本领域技术人员所掌握,恕不赘述。 For security policy in the sandbox used to meet a variety of different operating systems have different details to consider, these basics of the technology, have been known to those skilled in the master, will not be repeated here.

[0003] 目前有多种实例来实现沙箱技术。 [0003] There are many examples to implement the sandbox technology. 这些实例中,一方面,沙箱技术为了兼容市面的多种应用,一般仅仅通过限定沙箱的安全策略,控制该应用的可执行资源而实现。 These examples, on the one hand, the sandbox technology to be compatible with a variety of applications available in the market, generally limited only by the sandbox security policy, executable resources to control the application and implementation. 然而,在安全领域,攻防双方的技术水平此消彼长,传统的仅仅通过限制安全策略的沙箱,有时难以确保能够达到所期望的目的,必须借助于更富技术含量的新方案。 However, in the security field, offensive and defensive sides of the shift in the level of technology, by limiting only the traditional sandbox security policy, is sometimes difficult to ensure that achieve the desired purpose, we must resort to new technology solutions richer content. 另一方面,沙箱技术往往涉及系统底层操作,而在诸如以Android为代表的Unix系的操作系统中,本身有着严格的权限管理,这样,便导致在未获得Root授权的前提下,难以应用沙箱技术去构造沙箱。 On the other hand, sandbox techniques often involve underlying operating system, and Android-such as the representative of the Unix-based operating system in itself has a strict rights management, so that they did not get results in the premise Root authorized difficult to apply sandbox technology to construct sandbox. 可以独辟蹊径,去实现免Root环境下的沙箱环境,然而,在这种情况下,往往会引起多方面的一些技术障碍,这些障碍依沙箱的具体实现方式而定。 It can be inventive, to achieve free sandbox environment under the Root environment, however, in this case, tend to cause many technical barriers that depending on the specific implementation of the sandbox may be.

[0004] 目前现有技术中,对于这种免Root沙箱,尽管存在理论可能,未见成熟案例。 [0004] Currently the prior art, for this free Root sandbox, despite the theoretical possibility, and no sophisticated case. 但是,从以上的分析可以看出,要基于免Root环境实现一种更为安全的沙箱技术,需要结合其具体技术原理,来考虑其自身的具体构造以及在必要时考虑对相关应用程序的重构,使得重构后的应用程序可以无缝运行于已经基于系统而保持相对独立的沙箱之中,通过该应用程序在沙箱中的运行,实现应有的安全控制效果。 However, it can be seen from the above analysis, to achieve a more secure sandbox technology is based on Root-free environment, requires a combination of specific technical principle, to consider their own specific structure and consideration of relevant applications when necessary reconstruction, so that the application can be reconstructed based on the system has to run seamlessly maintained within relatively independent sandbox, through the application runs in a sandbox, the security control to achieve proper results.

发明内容 SUMMARY

[0005] 本发明的第一目的在于提供一种应用程序免Root运行控制方法,以确保免Root 沙箱环境中已配置的应用程序的安全运行。 [0005] The first object of the present invention is to provide an application program execution control method for Free Root, to ensure safe operation of the application for Free Root sandbox environment configured.

[0006] 本发明的第二目在于提供一种适于构造第一目的所述的方法的应用程序免Root 运行控制装置。 [0006] The second object of the invention to provide a method suitable for constructing the first object of the application program operation control means for Free Root.

[0007] 为实现本发明的目的,本发明采取如下技术方案: [0007] To achieve the object of the present invention, the present invention adopts the following technical solutions:

[0008] 本发明提供的一种应用程序免Root运行控制方法,包括如下步骤: [0008] The present invention provides an application Root-free operation control method, comprising the steps of:

[0009] 反射调用与宿主应用程序具有不同包名的作为该宿主应用程序附带资源的安装包,以加载该安装包所实现的目标应用程序; Examples of the installation package associated resources of a host application [0009] reflection to invoke the host application with a different package name to load the target application suite in the mounting;

[0010] 由宿主应用程序调用监控模块,对目标应用程序的活动进行监控; [0010] The monitoring module invoked by the host application, the activities of the target application to be monitored;

[0011] 当监控到目标应用程序需要调用未匹配的资源时,重定向相关调用指令的资源引用,以为该目标应用程序的运行提供正确资源。 [0011] When the monitoring to the target application needs to call unmatched resources, redirect the call instruction related resource references, that runs the target application to provide the right resources.

[0012] 较佳的,所述宿主应用程序的包名为目标应用程序的包名附加前缀而得。 [0012] Preferably, the package name of the host application package name prefixed with the target application is obtained.

[0013] 较佳的,当目标应用程序进程调用参数涉及其包名时,进行包名转换,将该包名重定向到正确的资源。 [0013] Preferably, when the target application process calls the parameters related to its package name, package name conversion carried out, the package name redirected to the correct resources.

[0014] 较佳的,监控到目标应用程序调用未匹配的所述安装包中的资源时,采用反射调用方式为相应的调用指令重定向到该安装包中的正确资源。 [0014] Preferably, when the installation package to monitor the target application calls a resource not matching, reflective redirected to the correct resource is called the installation package corresponding to the call instruction.

[0015] 具体的,所述宿主应用程序以所述安装包的配置文件向系统注册,注册前将配置文件中涉及的包名修改为宿主应用程序的包名。 [0015] Specifically, the host application to register with the system configuration of the installation package file, the file name of the configuration package involved in the package name modify the host application before registration.

[0016] 进一步,采用反射调用加载目标应用程序时,通过对宿主应用程序的已安装资源的调用而满足目标应用程序的资源访问。 [0016] Further, when employing a reflective call load target application, via a call to the host application installed resource access resource satisfies the target application.

[0017] 较佳的,所述监控模块被注册为服务进程,以钩子函数关联目标应用程序活动进程的调用指令以实现对所述目标应用程序的活动监控。 [0017] Preferably, the monitoring module is registered as a service process to call the target instruction associated with the active application process in order to achieve an activity monitor hook function of the target application.

[0018] 具体的,所述未匹配的资源包括因目标应用程序未安装却被反射调用而导致的被认为错误访问的资源。 [0018] Specifically, the non-matching access resource includes an error due to reflection to invoke the target application was not considered to be a result of mounting resources.

[0019] 较佳的,所述未匹配的资源包括系统资源和该安装包中的资源。 [0019] Preferably, the non-matching system resources include resources and the resources in the installation package.

[0020] 进一步,当监控到目标应用程序进行未经授权的访问时,向相关调用指令返回自定义数据。 [0020] Further, when the target application to monitor unauthorized access to the relevant call instruction to return custom data.

[0021] 根据本发明一实施例所揭示,所述宿主程序的资源文件和/或动态库文件与所述目标应用安装包中的相应文件相同。 [0021] and / or the appropriate file library dynamic application installation package according to the same target resource files embodiment disclosed embodiment of the invention, the host program.

[0022] 本发明提供的一种应用程序免Root运行控制装置,包括: [0022] The present invention provides an application Root-free operation of the control apparatus, comprising:

[0023] 调用单元,用于反射调用与宿主应用程序具有不同包名的作为该宿主应用程序附带资源的安装包,以加载该安装包所实现的目标应用程序; [0023] Calling unit for mounting a package as the host application and associated resources of reflection to invoke the host application with a different package name to load the target application suite in the mounting;

[0024] 监控模块,被配置为由宿主应用程序调用,对目标应用程序的活动进行监控; [0024] Monitoring module configured by the host application calls the activities of the target application to be monitored;

[0025] 处理单元,当监控到目标应用程序需要调用未匹配的资源时,重定向相关调用指令的资源引用,以为该目标应用程序的运行提供正确资源。 [0025] processing unit, while monitoring the target application needs to call unmatched resources, redirect the call instruction related resource references, that runs the target application to provide the right resources.

[0026] 相较于现有技术,本发明至少具有如下优点: [0026] Compared to the prior art, the present invention has at least the following advantages:

[0027] 1、借助目标应用程序安装包自身的内部文件为该安装包加壳,生成加壳安装包,使加壳安装包具有与原安装包具有不同的包名(PackageName),原安装包的对应组件和动作便被加壳安装包进行注册,由此,在宿主应用程序安装运行后,再借助反射调用机制去加载安装包的四大组件时,借助相应函数使宿主应用程序的包名与目标应用程序所调度的包名保持一致,在Android系统中,既能使活动组件和服务组件建立与ActivityManagerService的正常通信,又能使活动组件、服务组件以及广播组件等,顺利被PackageManagerService识别,降低现有技术中有关加壳应用程序运行异常的错误率。 [0027] 1, by the target application's own internal file installation package installer for packers, packers generating installation package, so that the installation package having a shell with a different primary mounting package having the package name (the PackageName), original installation package and the corresponding component when it is subjected to the action register packed installation package, whereby, after running the host application is installed, and then reflected by the invocation mechanism to load the four components of the installation package, the package means that the corresponding function name of the host application the target application package name scheduled consistent in the Android system, both the movable assembly and establishing normal communication with service components ActivityManagerService, but also make the movable unit, and a broadcast service components other components, is successfully identified PackageManagerService, reduce the error rate of the prior art relating to applications running shell abnormalities.

[0028] 2、通过在加壳的宿主应用程序中配置用于反射调用原安装包的加载模块,并且由加载模块建立起原安装包的目标应用程序与沙箱运行环境之间的通信,使得目标应用程序的活动过程可以进一步被沙箱运行环境进行监视,从而对其适用安全策略,以及对其进行资源引用重定向等,确保目标应用程序能被宿主应用程序正常加载并保持正常运行。 [0028] 2, by a host application configured for shell in the original package installed load module call reflector, and the communication between the original target installation package and sandbox application execution environment established by the loading module, such that active process target application sandbox can further be run environmental monitoring, resource and thus applicable security policies, as well as reference to them, redirect, to ensure that the target application is loaded by the host application to work and keep running.

[0029] 3、由于宿主应用程序利用原安装包的Androidmanifest. xml为蓝本,修改包名后,完成了正常的安装注册程序,不必为被反射调用的目标应用程序的各个组件(Activity, Service, Receiver)单独构造主函数入口(ActivityThread. main)和提供LoadedAPK对象,也不必考虑因包名而带来的PackageManagerService校验的程序实现复杂度问题,从而大大提高程序运行效率。 [0029] 3, since the host application using Androidmanifest original installation package. Xml modeled and modified package name, completed the normal installation registration process is not necessary for the various components of the target application is reflected invoked (Activity, Service, Receiver) function separately constructed main entrance (ActivityThread. main) and provide LoadedAPK objects, regardless of the result of the package name brought PackageManagerService verification program implementation complexity issues, thereby greatly improving process efficiency.

[0030] 本发明附加的方面和优点将在下面的描述中部分给出,这些将从下面的描述中变得明显,或通过本发明的实践了解到。 [0030] This additional aspects and advantages of the invention will be set forth in part in the description which follows, the following description will become apparent from, or learned by practice of the present invention.

附图说明 BRIEF DESCRIPTION

[0031] 本发明上述的和/或附加的方面和优点从下面结合附图对实施例的描述中将变得明显和容易理解,其中: [0031] The present invention described above and / or additional aspects and advantages from the following description of embodiments in conjunction with the accompanying drawings of the embodiments will become apparent and more readily appreciated, wherein:

[0032] 图1是本发明的应用程序加壳配置方法的流程原理图; [0032] FIG. 1 is an application of the present invention is a method of arranging the shell flow diagram;

[0033] 图2是本发明的应用程序加壳配置装置的原理图; [0033] FIG 2 is an application of the present invention packers schematic configuration device;

[0034] 图3是本发明的应用程序免Root运行控制方法的流程原理图; [0034] FIG. 3 is an application of the present invention for Free Root operation control method of flow diagram;

[0035] 图4是本发明的应用程序免Root运行控制装置的原理图。 [0035] FIG. 4 is an application of the present invention is a control apparatus for Free Root operation principle of FIG.

具体实施方式 detailed description

[0036] 下面详细描述本发明的实施例,所述实施例的示例在附图中示出,其中自始至终相同或类似的标号表示相同或类似的元件或具有相同或类似功能的元件。 [0036] Example embodiments of the present invention is described in detail below, exemplary embodiments of the embodiment shown in the accompanying drawings, wherein same or similar reference numerals designate the same or similar elements or elements having the same or similar functions. 下面通过参考附图描述的实施例是示例性的,仅用于解释本发明,而不能解释为对本发明的限制。 By following with reference to the embodiments described are exemplary only for explaining the present invention and should not be construed as limiting the present invention.

[0037] 本技术领域技术人员可以理解,除非特意声明,这里使用的单数形式"一"、"一个"、"所述"和"该"也可包括复数形式。 [0037] skilled in the art will be understood that, unless expressly stated, as used herein, the singular forms "a", "an", "the" and "the" include the plural form. 应该进一步理解的是,本发明的说明书中使用的措辞"包括"是指存在所述特征、整数、步骤、操作、元件和/或组件,但是并不排除存在或添加一个或多个其他特征、整数、步骤、操作、元件、组件和/或它们的组。 It should be further understood that the phraseology used in the present specification "comprises" means the presence of stated features, integers, steps, operations, elements, and / or components, but do not preclude the presence or addition of one or more other features, integers, steps, operations, elements, components, and / or groups thereof. 应该理解,当我们称元件被"连接"或"耦接"到另一元件时,它可以直接连接或耦接到其他元件,或者也可以存在中间元件。 It should be understood that when an element is referred to us "connected" or "coupled" to another element, it can be directly connected or coupled to the other element or intervening elements may also be present. 此外,这里使用的"连接"或"耦接"可以包括无线连接或无线耦接。 Further, as used herein, "connected" or "coupled" may include wirelessly connected or wirelessly coupled. 这里使用的措辞"和/或"包括一个或更多个相关联的列出项的全部或任一单元和全部组合。 As used herein, the phrase "and / or" includes any or all of a unit of one or more of the associated listed items associated and all combinations.

[0038] 本技术领域技术人员可以理解,除非另外定义,这里使用的所有术语(包括技术术语和科学术语),具有与本发明所属领域中的普通技术人员的一般理解相同的意义。 [0038] skilled in the art will be understood that, unless otherwise defined, all terms (including technical and scientific terms), and having a general understanding of the art the present invention belongs to one of ordinary skill in the same meaning. 还应该理解的是,诸如通用字典中定义的那些术语,应该被理解为具有与现有技术的上下文中的意义一致的意义,并且除非像这里一样被特定定义,否则不会用理想化或过于正式的含义来解释。 It should also be understood that generic terms, such as those defined in the dictionary, it should be understood as meaning that is consistent with significance in the context of the prior art, and unless, as here defined as being specific, it would not idealized or overly formal sense explanation.

[0039] 本技术领域技术人员可以理解,这里所使用的"终端"、"终端设备"既包括无线信号接收器的设备,其仅具备无发射能力的无线信号接收器的设备,又包括接收和发射硬件的设备,其具有能够在双向通信链路上,执行双向通信的接收和发射硬件的设备。 [0039] skilled in the art will understand, "terminal" used herein, "terminal device" includes both a wireless signal receiver apparatus, which includes only a wireless signal receiver apparatus without transmitting capability, but also includes receiving and transmitting a hardware device, which is capable of having a bidirectional communication link, transmitting and receiving hardware performs two-way communication device. 这种设备可以包括:蜂窝或其他通信设备,其具有单线路显示器或多线路显示器或没有多线路显示器的蜂窝或其他通信设备;PCS(Personal Communications Service,个人通信系统),其可以组合语音、数据处理、传真和/或数据通信能力;PDA(Personal Digital Assistant,个人数字助理),其可以包括射频接收器、寻呼机、互联网/内联网访问、网络浏览器、记事本、 日历和/或GPS (Global Positioning System,全球定位系统)接收器;常规膝上型和/或掌上型计算机或其他设备,其具有和/或包括射频接收器的常规膝上型和/或掌上型计算机或其他设备。 Such apparatus may include: a cellular or other communication device, having a single line or multiple line display monitor or without a multi-line display or other cellular communication device; PCS (Personal Communications Service, personal communication system), which can be combined voice, data, processing, facsimile and / or data communications capabilities; PDA (personal digital Assistant, personal digital assistants), which may include network access to a radio frequency receiver, a pager, Internet / web browser, notepad, calendar and / or GPS (Global positioning system, global positioning system) receiver; a conventional laptop and / or palmtop computers or other devices, having and / or radio frequency receiver comprising a conventional laptop and / or palmtop computers or other devices. 这里所使用的"终端"、"终端设备"可以是便携式、可运输、安装在交通工具(航空、海运和/或陆地)中的,或者适合于和/或配置为在本地运行,和/或以分布形式, 运行在地球和/或空间的任何其他位置运行。 As used herein, "terminal", "terminal device" may be portable, transportable, installed in a vehicle (aeronautical, marine and / or land) in, or adapted and / or configured to run locally, and / or run run at any other location the earth and / or space in a distributed fashion. 这里所使用的"终端"、"终端设备"还可以是通信终端、上网终端、音乐/视频播放终端,例如可以是PDA、MID(Mobile Internet Device, 移动互联网设备)和/或具有音乐/视频播放功能的移动电话,也可以是智能电视、机顶盒等设备。 As used herein, "terminal", "mobile terminal" may also be a communication terminal, access terminal, a music / video player terminals, for example, may be a PDA, MID (Mobile Internet Device, mobile Internet devices) and / or with a music / video player enabled mobile phone, it can also be a smart TV, set-top boxes and other equipment.

[0040] 本技术领域技术人员可以理解,这里所使用的服务器、云端、远端网络设备等概念,具有等同效果,其包括但不限于计算机、网络主机、单个网络服务器、多个网络服务器集或多个服务器构成的云。 [0040] skilled in the art can appreciate that the conception server, clouds, remote network device, etc. As used herein, has the equivalent effect, including, but not limited to, a computer, a network host, a single network server or multiple network servers sets multiple servers form a cloud. 在此,云由基于云计算(Cloud Computing)的大量计算机或网络服务器构成,其中,云计算是分布式计算的一种,由一群松散耦合的计算机集组成的一个超级虚拟计算机。 Here, a cloud-based computing cloud (Cloud Computing) is composed of a large number of computer or network server, which is a distributed computing cloud computing, a virtual super computer by a computer set consisting of a group of loosely coupled. 本发明的实施例中,远端网络设备、终端设备与WNS服务器之间可通过任何通信方式实现通信,包括但不限于,基于3GPP、LTE、WIMX的移动通信、基于TCP/IP、UDP协议的计算机网络通信以及基于蓝牙、红外传输标准的近距无线传输方式。 Embodiments of the present invention, the remote network device, the communication may be implemented by any communication between the terminal device and the server WNS, including but not limited to, a mobile communication based on 3GPP, LTE, WIMX based on TCP / IP, UDP protocol and a computer network communications based on Bluetooth short-range wireless transmission, infrared transmission standard.

[0041] 本领域技术人员应当理解,本发明所称的"应用"、"应用程序"、"应用软件"以及类似表述的概念,是业内技术人员所公知的相同概念,是指由一系列计算机指令及相关数据资源有机构造的适于电子运行的计算机软件。 [0041] Those skilled in the art will appreciate that the present invention is called "application", the term "application", "application" and similar expressions, are well known in the industry skilled in the same sense, it means a series of computer an electronic computer adapted to run software instructions and data resources related organic structure. 除非特别指定,这种命名本身不受编程语言种类、级别,也不受其赖以运行的操作系统或平台所限制。 Unless otherwise specified, the name itself, is not the kind of programming language, level, not by their operating system or platform on which to run the limit. 理所当然地,此类概念也不受任何形式的终端所限制。 Of course, such a concept is not limited to any form of the terminal.

[0042] 本发明以下即将描述的一种方法和装置所实施的应用场景,是安装在移动终端上的基于Android操作系统的运行环境。 [0042] A method and apparatus application scenario of the embodiment of the present invention to be described hereinafter, is based on the Android operating system installed on the operating environment of the mobile terminal.

[0043] 为了说明本发明的实施,本发明试图结合计算机程序的静态和动态两个方面进行描述,所谓静态方面,是指程序安装包、文件、数据库等存储于媒介的存储对象;所谓动态方面,是指被调入内存中执行的动态对象,包括但不局限于进程、线程、所用到的数据等。 [0043] To illustrate the embodiments of the present invention, the present invention seeks to bind both static and dynamic aspects of a computer program will be described, so-called static context, refers to the object stored in the installation package, files, databases and the like stored in the medium; so-called dynamic aspects It refers to dynamic objects in memory to be transferred to execution, including, but not limited to processes, threads, and other data used. 鉴于计算机软件技术的这些特点,不应将本发明所述及的各个方法、步骤、子步骤、装置、单元、 模块等,孤立地理解为仅静态或仅动态的方面,本领域技术人员对此应当知晓。 Given these characteristics of the computer software technology, various methods of the present invention should not be and the, steps, sub-steps, means, unit, module, isolation aspects are understood to only static or dynamic, those skilled in this It should be known. 故而,本领域技术人员应当能够依据本发明有关静态的表述而将其对应到动态的进程活动,或者依据本发明有关动态的进程活动对应到其静态的表现形式,建立起静态与动态两方面的必然性关联,以此为基础来理解本发明。 Therefore, should be able to skilled in the art in accordance with the present invention is related to the static representation and its corresponding dynamic process activities, or in accordance with the present invention is related to a dynamic process activities correspond to its static form of expression, to establish both static and dynamic Necessity of association, as a basis for understanding the present invention.

[0044] 本领域技术人员应当知晓,本发明是基于免Root提权而提出的,然而,提权操作只是Android系统所实施的权限管理控制,本发明也当然地适用于已经Root提权的Android操作系统中。 [0044] Those skilled in the art will be aware, the invention is based provide the right Free Root proposed, however, mention the right to operate only rights management control Android system embodiment of the present invention is of course applicable to Android has Root mentioned right operating system.

[0045] 本发明是基于沙箱原理而提出的,故而,本领域技术人员得以结合公知的沙箱实现原理来理解本发明的实施。 [0045] The present invention is based on the principle sandbox proposed, therefore, to those skilled in conjunction with known principles to achieve sandbox understood that embodiments of the present invention. 沙箱的作用是为目标应用程序的提供相对封闭的运行环境, 使应用程序对系统的资源访问,借助沙箱安全策略的应用,而被限制在规定的范围之内。 Sandbox effect is to provide the target application running relatively closed environment, the application resource access to the system, with the application sandbox security policy, and is limited to within a prescribed range. 因而,本发明的实质在于提供一种沙箱实例,从两个方面来实现,第一方面是提供构造目标应用程序的解决方案,第二方面是提供与前者相应的运行控制方案。 Thus, the essence of the invention is to provide a sandbox example, be implemented in two ways, a first aspect of the target application is configured to provide a solution to provide a second aspect of the operation control program corresponding to the former. 这两个方面可以被集成到一个沙箱实现软件中,利用其第一方面的实现对目标应用程序进行加工,进而利用其第二方面的实现,为目标应用程序提供安全的沙箱运行环境。 These two aspects may be integrated into a sandbox implemented in software, the target was processed by application to achieve a first aspect, to achieve further using a second aspect, to provide a safe environment for the sandbox run target application.

[0046] 有鉴于此,本发明的应用程序加壳配置方法,主要体现沙箱实例的第一方面,用于加工适配于相应的沙箱运行环境的目标应用程序,在如图1所示的实例中,该方法包括如下步骤: [0046] In view of this, the application method of the present invention packed configuration, mainly an example of a first aspect of the sandbox, for processing adapted to the respective application sandbox target runtime environment, as shown in FIG. 1 examples, the method comprising the steps of:

[0047] S11、解析所述应用程序原安装包,获得其内部文件。 [0047] S11, parses the original application package to install, which is obtained inside the file.

[0048] 这里所称的应用程序,即前文所称的目标应用程序。 [0048] application referred to here, that is the target application referred to earlier. 由于本发明基于免Root需求而提出,根据Android固有的原理,所述目标应用程序一般为用户自行安装的第三方应用。 Since the present invention is based on the demand for Free Root proposed third-party applications, according to the principles inherent Android, the target application is generally user-installed. [0049] 本发明可以通过接管安装器,来实现对第三方应用的安装控制。 [0049] The present invention can be taken over by the installer, to achieve control of the installation of third party applications. 具体而言,可以由用户通过本发明提供的沙箱应用程序下载并安装该第三方应用而获得所述原安装包,或者,也可由该沙箱应用程序从/data/app中获取相应安装包文件。 Specifically, the sandbox may be downloaded by the user application provided by the present invention is obtained by mounting the third application of the original installation package, or, that can also be obtained from the sandbox application / data / app corresponding installation package file. 对于已装应用,可以本发明处理完毕之后,诱导用户卸载旧应用,安装新应用。 After the application has been installed to be processed according to the present invention, induce the user to uninstall the old application, install new applications.

[0050] 解析应用程序的原安装包的手段,为本领域技术人员所熟知。 Means [0050] Analytical original application installation package, those skilled in the art. 安装包APK文件本质上是利用ZIP压缩技术结合签名技术实现的压缩包,因此,一方面可以通过解压技术释放其内部文件,另一方面还可通过Apktool之类的工具软件获取其内部文件(在这种情况下其代码文件会被反向为.smali文件)。 APK essentially the installation package file is compressed using ZIP compression technologies packet signature technology, and therefore, an aspect which may be released by an internal file decompression techniques, on the other hand may get its internal files Apktool such tool (in In this case it will be reversed as a code file .smali file). 本领域技术人员均能娴熟地利用这些公知技术在一个给定目录中对原安装包进行处理,从而通过内存操作(非文件操作)的方式来获得其中的内部文件。 Those skilled in the art can use these skilful known techniques for processing the original installation package in a given directory, so that by operation of a memory (non-file operation) to obtain a manner wherein the internal file.

[0051] Android安装包的内部文件,参阅下表所示: [0051] Android internal installation package file shown in the table refer to:

[0052] 表IAPK文件内部的文件结构 [0052] The file list structure inside IAPK

[0053] [0053]

Figure CN104462879AD00071

[0054] 本发明通过解析所述目标应用程序的原安装包,可以获得表中所附的目录和文件,在此基础上,参照实现作为宿主应用程序的加壳安装包,详见后一步骤。 [0054] The present invention is by analyzing the original target application installation package can be obtained in the following tables and files in the directory, on this basis, with reference to the installation package to achieve the host application as a shell, a rear see step .

[0055] S12、构造集合所述原安装包与所述内部文件的加壳安装包。 Packers [0055] S12, set the original configuration of the installation package file is installed inside the package.

[0056] 以下先结合表1对本发明构造所述加壳安装包所需的内部文件进行介绍。 [0056] The following Table 1 in conjunction with the first embodiment of the invention the inner shell installation package files required for presentation.

[0057] 表1所列的各种属于安装包的内部文件中,MATA-INF目录是在对其他文件打包后签名而生成的,因此,后续生成加壳安装包时,会有加壳安装包自身的签名而产生相同的目录结构和文件,故而原安装包的相应目录结构和文件不会被置入加壳安装包中。 [0057] The installation package belonging to various internal documents listed in Table 1, MATA-INF directory is packed in the other generated file signature, thus generating a subsequent installation package packers, packers have installation package own the same signature generated directory structure and files, and therefore the corresponding directory structure and files of the original installation package will not be packed into the installation package.

[0058] res\目录及其下包含的资源,是目标应用程序运行过程中需引用的资源,目标应用程序在运行时可以通过ID进行访问。 [0058] res \ directory and its resources under contained in the target application process is to be run in a reference resource, the target application can be accessed by ID at runtime. 因而,可以结合程序实现的难度考虑,而考虑是否将其中的部分资源文件置入后续的加壳安装包中。 Thus, the program can be implemented in conjunction with consideration of the difficulty, which will consider whether the resource file into a subsequent portion packers installation package. 本实施例关注其中的主图标文件例如icon, png文件,该文件即目标应用程序的图标文件,目标应用程序的安装包正常安装时,会在桌面显示该图标文件作为其快捷图标。 The present embodiment wherein the primary concern e.g. icon file icon, png file icon file that is the target application, the target application installation package installed properly, the icon will be displayed on the desktop as a shortcut icon file. 本实施例中,对该图标的图样进行局部修改,例如为其图样右下角附加一锁头样式,使其成为带特定标记的图标,并将修改后的图标文件作为加壳安装包的图标文件,存放于加壳安装包的res\目录下。 Icon file in the present embodiment, the pattern locally modify the icon, for example, an additional pattern for the bottom right pattern lock, making it an icon with a particular tag, and icon file modified installation package as packers , stored in a packed installation package res \ directory. 由此,加壳安装包安装后,用户可以通过其图标认知该程序已被进行沙箱防护。 Thus, packers installation package, the user may perform cognitive the program has been sandboxed by its icon. 当然,也可以考虑将res\目录下的其它资源文件作为构造加壳安装包的内部文件引入,但在后续反射调用该目标应用程序时,需进行资源引用重定向,以便目标应用能够正常引用到正确资源。 Of course, other resources may also be considered in the file res \ directory and file structure incorporated inside shell installation package, but in a subsequent reflection to invoke the target application needs to redirect a reference resource, so that the target can be properly applied to the reference the right resources.

[0059] assets目录用于存放广义的资源文件,例如安装包文件、字体文件等不可压缩的文件,可以通过路径来访问该目录中的资源。 [0059] assets Generalized directory for storing resource files, such as installation package incompressible files, font files may be accessed by the resource directory paths. 本实施例中,不将原安装包的assets\目录的文件引入,是为了减小加壳安装包的体积,在加壳安装包的assets\目录中,存放将被反射调用的目标应用程序的原安装包。 In this embodiment, the installation package file is not the original assets \ directory is introduced, in order to reduce the volume of the installation package packers, packers in the installation package assets \ directory stored target application to be invoked reflected original installation package.

[0060] resources, arse文件主要是建立对安装包所指向的应用程序的索引,在本实施例中也不在加壳安装包中使用原安装包的同名文件。 [0060] resources, arse document was indexed application installation package is pointing, this embodiment does not use the same file name of the original package is installed in the installation package packed in the present embodiment.

[0061] lib\目录下的文件,主要是存放.SO动态库文件,该原安装包的动态库文件是否被一同集合到加壳安装包中,同理,可以结合程序实现复杂度加以考虑,按需选用。 [0061] file in the lib \ directory, mainly to store .SO dynamic library files, dynamic libraries if the original installation package is a set of packers to install the package with the same token, can be combined with program implementation complexity to be considered, selection demand. 本实施例中不考虑将其移置于加壳安装包中。 Move it does not consider the installation package shell is placed in the present embodiment.

[0062] Androidmanifest. xml文件,是安装包中较为重要的全局配置文件,其负责向系统注册Android系统的四大组件,以及向系统申请权限等。 [0062] Androidmanifest. Xml file, the installation package is more important global configuration file, which is responsible for registering the four components of the Android system to system, and application permissions to the system. 在加壳安装包中,将其作为需要加入加壳安装包的重要内部文件进行考虑,但是,作为本发明实现的关键,对该配置文件进行修改。 In packers installation package, which was considered as an important document needs to be added inside the shell installation package, however, the present invention is implemented as a key, the modification of the configuration file. 修改的内容主要是因应加壳安装包的包名不同于目标应用程序的包名,故而,加壳安装包中的Androidmanifest. xml文件以原安装包的同名文件为蓝本,将其中涉及包名的字符串,修改成加壳安装包的包名。 Modify the contents mainly due to the mounting shell package names package differs from the package name of the target application, and therefore, the installation package shell Androidmanifest. Xml file in the same file name as the original installation package modeled involving the package name string name is modified to install the package shell. 具体涉及有关四大组件(Activity, Service, Broacast Receiver, Content Provider)及相关动作(Action)的声明中对包名的引用处。 In particular to about four major components (Activity, Service, Broacast Receiver, Content Provider) and related actions (Action) of the statement referenced in place of the package name. 本发明的推荐实施例中,是在原安装包的包名基础上附加前缀,例如,原安装包的包名是com. apk,则加壳安装包的包名可以是apphost. com. apk。 Recommended embodiment of the present invention, the package name is prefixed with a packet on the basis of the original installation, for example, the name of the original package is an installation package com. Apk, the package name packers installation package may be apphost. Com. Apk. 诚然,本领域技术人员可以灵活改变这一改名规则,只要在程序运行过程中可以构造利用逆向规则将两个包名建立对应进而实现重定向即可。 Indeed, those skilled in the art can flexibly change the rename rules, as long as the program is running may be constructed using inverse correspondence rule two further redirection to the package name. 由此,加壳安装包在系统中安装运行宿主应用程序之后,以Androidmanifest. xml向系统注册各个组件和申请系统权限,以此便建立了各个组件的入口,使经反射调用的目标应用程序的各个组件均可以结合所述逆向规则而被ActivityManagerService调用,而不必为所述各个组件构造ActivityThread和提供相应的LoadedAPK对象,省去运行上下文环境的程序实现环节。 Thus, after the packers installation package to run the host application in the system to Androidmanifest. Xml registered individual components and system permissions apply to the system, this entry will be established for each component in the target application reflected invoked the various components can be combined reverse ActivityManagerService rule is invoked, without having to provide a corresponding object LoadedAPK the various components and configurations ActivityThread omitted operating program implemented link context. 同理,反射调用所导致的PackageManagerService对各大组件是否合法注册进行校验的问题,也将因Androidmanifest. xml的注册结合所述的逆向规则而被克服。 Similarly, PackageManagerService reflective invocation whether caused major problems for assembly legally registered verification, also due AndroidManifest. Xml reverse binding rules of the register to be overcome.

[0063] classes, dex为安装包中的代码文件(二进制代码可执行文件)。 [0063] classes, dex code file for the installation package (executable binary code). 在本发明中,将被预构造的同名文件所替换,但该同名文件与其他文件一起被集合到所述加壳安装包中。 In the present invention, it will be replaced by the pre-configuration files of the same name, but the same file with another file is set to the installation package packed together. 本发明所提供的classes, dex,植入有加载模块stub(),通过该加载模块,可以进一步启动一监控模块,该监控模块用于监控经反射调用的整个目标应用程序的活动过程,因此,监控模块先于所述目标应用程序而加载。 The present invention provides classes, DEX, implanted with the load module Stub (), by which the load module, a monitoring module may further start, the process monitoring module for monitoring the activities of application by the entire reflective target calls and, therefore, prior to the monitoring module and the target application is loaded. 该监控模块便是沙箱运行环境的实现者,负责实现两方面的功能,一方面通过监控目标应用程序对资源的访问,这一资源包括原安装包res\、 assets的资源,也包括涉及包名调用的Intent,还包括系统资源等广义资源。 The monitoring module is achieved by running a sandbox environment, responsible for implementing two functions, on the one hand to monitor the target application access to resources through this resource include the original installation package res \, assets of resources, including those relating to package name calling of Intent, also includes a generalized resource system resources. 通过对资源引用进行重定向,使目标应用程序进程能够实现对正确资源的正常引用。 By redirect reference resource, the target application process to achieve a normal reference to the correct resources. 具体而言,如果相关资源是被反射调用的原安装包的资源,则通过反射调用机制调用该原安装包的资源供引用,实现重定向。 Specifically, if the resources are reflected resources of the original installation package call, the call of the resources of the original installation package by calling mechanism for reflection reference redirection. 如果是系统资源或者指向宿主应用程序的已安装资源,则可允许其默认引用保证其正常引用关系。 If the system resources, or point to the host application is installed resources, allowing it to be referenced to ensure their normal default reference relationship. 如果是I/O操作,也可以藉此进行重定向。 If I / O operation, it may thereby be redirected. 需要注意的是,当这种广义资源引用涉及宿主应用程序与目标应用程序之间的包名差异时,如前所述,应当利用所述的逆向规则来确保目标应用程序所引用的资源正确无误。 Note that, when such a generalized resource references involving package name difference between the host application and the target application, as described above, the rules should be used to ensure that the reverse target resource referenced by the application is correct . 另一方面通过监控目标应用程序对系统资源的访问,例如是否请求发送短信息,来依据安全策略确定是否允许其操作, 当不允许这种实施这种行为是,可以向相关调用指令返回自定义数据,例如返回空值,从而确保能杜绝一些非法操作。 On the other hand by monitoring the target application access to system resources, such as whether a request to send text messages to determine whether to allow its operation, such as the implementation of such behavior is not allowed, can be returned to the relevant custom calling instructions based on security policy data, for example, return a null value, so as to ensure eliminate some illegal operation.

[0064] 所述监控模块的技术实现,采用Hook技术,利用钩子函数对相关调用指令的入口点进行监视,截获此一调用指令,转向执行相应的钩子函数,由该钩子函数依据沙箱自身逻辑来应答该调用指令,从而达到前述的目的。 [0064] The technology of the monitoring module, using Hook technology, the use of entry points associated hook function call instruction is monitored intercepts a call instruction, executes the corresponding hook function steering by the hook itself logic function based on the sandbox answers the call instruction, so as to achieve the foregoing objects.

[0065] 这里需要补充的是:术语"钩子"涵盖了用于通过拦截在软件组件之间传递的函数调用、消息、或事件来改变或增加操作系统、应用程序、或其他软件组件的行为的技术。 [0065] It should be added that: The term "hook" for covering the function call by intercepting passed between software components, messages, or events to change or increase the operating system, applications, or conduct other software components technology. 而处理这种被拦截的函数调用、事件或消息的代码就被称为钩子hook函数。 And the code to handle this function call intercepted, event or news hook hook function is called. 钩子通常用于各种目标,包括对功能进行调试和对功能进行扩展。 Hooks commonly used for a variety of targets, including debugging functions and to extend the functionality. 其示例可以包括在键盘或鼠标事件传递到应用程序之前拦截它们,或者拦截系统调用(system call)、或者系统函数行为、函数执行结果等,以监视或修改应用程序或其他组件的功能等等。 Examples of which may include a keyboard or mouse event passed before their application to the block, or intercepted system call (system call), or the behavior of the system function, the function execution result, etc., to monitor the application or function, or to modify other components and the like. 本实施例即可采用钩子hook函数接管所述应用程序运行时所需的安装自校验操作。 The present embodiment uses a hook to hook takes over functions required to install self-checking operation of the run-time application.

[0066] 准备好上述的内部文件和原安装包后,本发明进一步将上述选定的内部文件和原安装包进行打包,打包后再行签名,即完成所述加壳安装包的构造,原安装包位于加壳安装包的assets\目录中,成为加壳安装包的附带资源。 [0066] Once you have the internal documents of the original and the installation package, the present invention further said selected document and the original inner packing installation package, and then packaged signature line, i.e. the complete shell construction installation package, the original installation package is located packers installation package assets \ directory, to be included with the installation package of the resource shell. 进一步可通过下一步骤安装该加壳安装包,从而安装宿主应用程序。 The shell is further mounted installation package by a next step, whereby the host application installed.

[0067] 考虑到所生成的加壳安装包的文件将大于原安装包,本发明进而可以对加壳安装包中的代码文件进行压缩,生成压缩文件和用于还原所述压缩文件为代码文件的附加文件,这一压缩过程同理适用于所述原安装包中。 [0067] Taking into account the generated file installation package shell will be greater than the original installation package, the present invention can further compress packers code file installation package, and for generating a compressed file the compressed file is restored code file the attached file, the compression process same applies to the original installation package. 只要后续安装过程中依据逆向算法,利用附加文件对所述压缩文件在内存中进行还原,即可使宿主应用程序和目标应用程序实现正常运行。 As long as subsequent installation based inverse algorithm, using the attached file to restore the compressed file in the memory, to make the host application and the target application for normal operation. 经过压缩的安装包,其增量接近于零甚至小于零,因此效率较高。 Compressed installation package, or even close to zero in increments less than zero, and therefore higher efficiency.

[0068] S13、安装该加壳安装包。 [0068] S13, the packers mounted installation package.

[0069] 如前所述,本发明的实施场景之一,未获Root权限,因此,这种场景中,并不能通过本发明实现静默安装。 [0069] As described above, one embodiment of the present invention scenes, has not been Root privileges, therefore, such a scenario, the present invention can not be achieved by the silent installation. 这种情况下,本发明优先通过调用系统安装器,以启动安装界面, 指导用户完成该加壳安装包的安装。 In this case, the present invention is preferentially by calling the system loader to initiate the installation interface that guides the user through the installation package mounting shell.

[0070] 根据计算机程序的模块化思维,本发明进而可以依据上述应用程序加壳配置方法而提供一种应用程序加壳配置装置,具体请结合图2并参阅如下说明。 [0070] The modular computer program thinking, the present invention may further provide an application apparatus according to the above packers arranged to configure the application shell, as described in conjunction with FIG. 2, and refer to the following instructions.

[0071] 本发明的应用程序加壳配置装置,由获取单元11、构造单元12以及安装单元13构成,各单元实现的功能如下: [0071] Application of the present invention configured packers, 11, 12 and a mounting unit configured unit 13 is configured by the acquisition units each implement the following functions:

[0072] 所述的获取单元11,用于解析所述应用程序原安装包,获得其内部文件。 [0072] The acquisition unit 11, configured to parse the original application package to install, which is obtained inside the file.

[0073] 这里所称的应用程序,即前文所称的目标应用程序。 [0073] application referred to here, that is the target application referred to earlier. 由于本发明基于免Root需求而提出,根据Android固有的原理,所述目标应用程序一般为用户自行安装的第三方应用。 Since the present invention is based on the demand for Free Root proposed third-party applications, according to the principles inherent Android, the target application is generally user-installed.

[0074] 本发明可以通过接管安装器,来实现对第三方应用的安装控制。 [0074] The present invention can be taken over by the installer, to achieve control of the installation of third party applications. 具体而言,可以由用户通过本发明提供的沙箱应用程序下载并安装该第三方应用而获得所述原安装包,或者,也可由该沙箱应用程序从/data/app中获取相应安装包文件。 Specifically, the sandbox may be downloaded by the user application provided by the present invention is obtained by mounting the third application of the original installation package, or, that can also be obtained from the sandbox application / data / app corresponding installation package file. 对于已装应用,可以本发明处理完毕之后,诱导用户卸载旧应用,安装新应用。 After the application has been installed to be processed according to the present invention, induce the user to uninstall the old application, install new applications.

[0075] 解析应用程序的原安装包的手段,为本领域技术人员所熟知。 Means [0075] Analytical original application installation package, those skilled in the art. 安装包APK文件本质上是利用ZIP压缩技术结合签名技术实现的压缩包,因此,一方面可以通过解压技术释放其内部文件,另一方面还可通过Apktool之类的工具软件获取其内部文件(在这种情况下其代码文件会被反向为.smali文件)。 APK essentially the installation package file is compressed using ZIP compression technologies packet signature technology, and therefore, an aspect which may be released by an internal file decompression techniques, on the other hand may get its internal files Apktool such tool (in In this case it will be reversed as a code file .smali file). 本领域技术人员均能娴熟地利用这些公知技术在一个给定目录中对原安装包进行处理,从而获得其中的内部文件。 Those skilled in the art can use these skilful known techniques for processing the original installation package in a given directory, wherein the internal document to obtain. 需要强调的是,本发明所称获得其内部文件,推荐以公知的内存操作的方式而获得,而非指文件操作。 It is emphasized that, according to the present invention is referred to obtain its internal documents, in a manner known recommended memory operations is obtained, rather than refer to the file operation.

[0076] Android安装包的内部文件,同理参阅表1。 [0076] Android installation package internal documents, see Table 1 Similarly. 本发明通过解析所述目标应用程序的原安装包,可以获得表1中所附的目录和文件,在此基础上,参照实现作为宿主应用程序的加壳安装包,详见构造单元的说明。 The present invention is by analyzing the original target application installation package can be obtained and the file directory table 1 attached, based on this, referring to the installation package to achieve the host application as a shell, detailed description of the construction unit.

[0077] 所述的构造单元12,用于构造集合所述原安装包与所述内部文件的加壳安装包。 The [0077] construction unit 12 for constructing the set of original installation package packed with the internal file installation package.

[0078] 以下先结合表1对本发明构造所述加壳安装包所需的内部文件进行介绍。 [0078] The following Table 1 in conjunction with the first embodiment of the invention the inner shell installation package files required for presentation.

[0079] 表1所列的各种属于安装包的内部文件中,MATA-INF目录是在对其他文件打包后签名而生成的,因此,后续生成加壳安装包时,会有加壳安装包自身的签名而产生相同的目录结构和文件,故而原安装包的相应目录结构和文件不会被置入加壳安装包中。 [0079] The installation package belonging to various internal documents listed in Table 1, MATA-INF directory is packed in the other generated file signature, thus generating a subsequent installation package packers, packers have installation package own the same signature generated directory structure and files, and therefore the corresponding directory structure and files of the original installation package will not be packed into the installation package.

[0080] res\目录及其下包含的资源,是目标应用程序运行过程中需引用的资源,目标应用程序在运行时可以通过ID进行访问。 [0080] res \ directory and its resources under contained in the target application process is to be run in a reference resource, the target application can be accessed by ID at runtime. 因而,可以结合程序实现的难度考虑,而考虑是否将其中的部分资源文件置入后续的加壳安装包中。 Thus, the program can be implemented in conjunction with consideration of the difficulty, which will consider whether the resource file into a subsequent portion packers installation package. 本实施例关注其中的主图标文件例如icon, png文件,该文件即目标应用程序的主图标文件,目标应用程序的安装包正常安装时, 会在桌面显示该图标文件作为其快捷图标。 The present embodiment wherein the primary concern e.g. icon file icon, png file icon file that is the main target applications, the target application installation package installed properly, the icon will be displayed on the desktop as a shortcut icon file. 本实施例中,对该图标的图样进行局部修改,例如为其图样右下角附加一锁头样式,使其成为带特定标记的图标,并将修改后的图标文件作为加壳安装包的图标文件,存放于加壳安装包的res\目录下。 Icon file in the present embodiment, the pattern locally modify the icon, for example, an additional pattern for the bottom right pattern lock, making it an icon with a particular tag, and icon file modified installation package as packers , stored in a packed installation package res \ directory. 由此,加壳安装包安装后, 用户可以通过其图标认知该程序已被进行沙箱防护。 Thus, packers installation package, the user may perform cognitive the program has been sandboxed by its icon. 当然,也可以考虑将res\目录下的其它资源文件作为构造加壳安装包的内部文件引入,但在后续反射调用该目标应用程序时, 需进行资源引用重定向,以便目标应用能够正常引用到正确资源。 Of course, other resources may also be considered in the file res \ directory and file structure incorporated inside shell installation package, but in a subsequent reflection to invoke the target application needs to redirect a reference resource, so that the target can be properly applied to the reference the right resources.

[0081] assets目录用于存放广义的资源文件,例如安装包文件、字体文件等不可压缩的文件,可以通过路径来访问该目录中的资源。 [0081] assets Generalized directory for storing resource files, such as installation package incompressible files, font files may be accessed by the resource directory paths. 本实施例中,不将原安装包的assets\目录的文件引入,是为了减小加壳安装包的体积,在加壳安装包的assets\目录中,存放将被反射调用的目标应用程序的原安装包。 In this embodiment, the installation package file is not the original assets \ directory is introduced, in order to reduce the volume of the installation package packers, packers in the installation package assets \ directory stored target application to be invoked reflected original installation package.

[0082] resources, arse文件主要是建立对安装包所指向的应用程序的索引,在本实施例中也不在加壳安装包中使用原安装包的同名文件。 [0082] resources, arse document was indexed application installation package is pointing, this embodiment does not use the same file name of the original package is installed in the installation package packed in the present embodiment.

[0083] lib\目录下的文件,主要是存放.so动态库文件,该原安装包的动态库文件是否被一同集合到加壳安装包中,同理,可以结合程序实现复杂度加以考虑,按需选用。 [0083] file in the lib \ directory, mainly to store .so dynamic library files, dynamic libraries if the original installation package is a set of packers to install the package with the same token, can be combined with program implementation complexity to be considered, selection demand. 本实施例中不考虑将其移置于加壳安装包中。 Move it does not consider the installation package shell is placed in the present embodiment.

[0084] Androidmanifest. xml文件,是安装包中较为重要的全局配置文件,其负责向系统注册Android系统的四大组件,以及向系统申请权限等。 [0084] Androidmanifest. Xml file, the installation package is more important global configuration file, which is responsible for registering the four components of the Android system to system, and application permissions to the system. 在加壳安装包中,将其作为需要加入加壳安装包的重要内部文件进行考虑,但是,作为本发明实现的关键,对该配置文件进行修改。 In packers installation package, which was considered as an important document needs to be added inside the shell installation package, however, the present invention is implemented as a key, the modification of the configuration file. 修改的内容主要是因应加壳安装包的包名不同于目标应用程序的包名,故而,加壳安装包中的Androidmanifest. xml文件以原安装包的同名文件为蓝本,将其中涉及包名的字符串,修改成加壳安装包的包名。 Modify the contents mainly due to the mounting shell package names package differs from the package name of the target application, and therefore, the installation package shell Androidmanifest. Xml file in the same file name as the original installation package modeled involving the package name string name is modified to install the package shell. 具体涉及有关四大组件(Activity, Service, Broacast Receiver, Content Provider)及相关动作(Action)的声明中对包名的引用处。 In particular to about four major components (Activity, Service, Broacast Receiver, Content Provider) and related actions (Action) of the statement referenced in place of the package name. 本发明的推荐实施例中,是在原安装包的包名基础上附加前缀,例如,原安装包的包名是com. apk,则加壳安装包的包名可以是apphost. com. apk。 Recommended embodiment of the present invention, the package name is prefixed with a packet on the basis of the original installation, for example, the name of the original package is an installation package com. Apk, the package name packers installation package may be apphost. Com. Apk. 诚然,本领域技术人员可以灵活改变这一改名规则,只要在程序运行过程中可以构造利用逆向规则将两个包名建立对应进而实现重定向即可。 Indeed, those skilled in the art can flexibly change the rename rules, as long as the program is running may be constructed using inverse correspondence rule two further redirection to the package name. 由此,加壳安装包在系统中安装运行宿主应用程序之后,以Androidmanifest. xml向系统注册各个组件和申请系统权限,以此便建立了各个组件的入口,使经反射调用的目标应用程序的各个组件均可以结合所述逆向规则而被ActivityManagerService调用,而不必为所述各个组件构造ActivityThread和提供相应的LoadedApk对象,省去运行上下文环境的程序实现环节。 Thus, after the packers installation package to run the host application in the system to Androidmanifest. Xml registered individual components and system permissions apply to the system, this entry will be established for each component in the target application reflected invoked the various components can be combined reverse ActivityManagerService rule is invoked, without having to provide a corresponding object LoadedApk the various components and configurations ActivityThread omitted operating program implemented link context. 同理,反射调用所导致的PackageManagerService对各大组件进行是否合法注册的校验的问题,也将因Androidmanifest. xml的注册结合所述的逆向规则而被克服。 Similarly, PackageManagerService reflective invocation caused major components to verify whether the question legally registered, also due AndroidManifest. Xml reverse binding rules of the register to be overcome.

[0085] classes, dex为安装包中的代码文件(二进制代码可执行文件)。 [0085] classes, dex code file for the installation package (executable binary code). 在本发明中,将被预构造的同名文件所替换,但该同名文件与其他文件一起被集合到所述加壳安装包中。 In the present invention, it will be replaced by the pre-configuration files of the same name, but the same file with another file is set to the installation package packed together. 本发明所提供的classes, dex,植入有加载模块stub(),通过该加载模块,可以进一步启动一监控模块,该监控模块用于监控经反射调用的整个目标应用程序的活动过程,因此,监控模块先于所述目标应用程序而加载。 The present invention provides classes, DEX, implanted with the load module Stub (), by which the load module, a monitoring module may further start, the process monitoring module for monitoring the activities of application by the entire reflective target calls and, therefore, prior to the monitoring module and the target application is loaded. 该监控模块便是沙箱运行环境的实现者,负责实现两方面的功能,一方面通过监控目标应用程序对资源的访问,这一资源包括原安装包res\、 assets的资源,也包括涉及包名调用的Intent,还包括系统资源等广义资源。 The monitoring module is achieved by running a sandbox environment, responsible for implementing two functions, on the one hand to monitor the target application access to resources through this resource include the original installation package res \, assets of resources, including those relating to package name calling of Intent, also includes a generalized resource system resources. 通过对资源引用进行重定向,使目标应用程序进程能够实现对正确资源的正常引用。 By redirect reference resource, the target application process to achieve a normal reference to the correct resources. 具体而言,如果相关资源是被反射调用的原安装包的资源,则通过反射调用机制调用该原安装包的资源供引用,实现重定向。 Specifically, if the resources are reflected resources of the original installation package call, the call of the resources of the original installation package by calling mechanism for reflection reference redirection. 如果是系统资源或者指向宿主应用程序的已安装资源,则可允许其默认引用保证其正常引用关系。 If the system resources, or point to the host application is installed resources, allowing it to be referenced to ensure their normal default reference relationship. 如果是1/0操作,也可以藉此进行重定向。 If the operation is 1/0, also you can take redirection. 需要注意的是,当这种广义资源引用涉及宿主应用程序与目标应用程序之间的包名差异时,如前所述,应当利用所述的逆向规则来确保目标应用程序所引用的资源正确无误。 Note that, when such a generalized resource references involving package name difference between the host application and the target application, as described above, the rules should be used to ensure that the reverse target resource referenced by the application is correct . 另一方面通过监控目标应用程序对系统资源的访问,例如是否请求发送短信息,来依据安全策略确定是否允许其操作, 当不允许这种实施这种行为是,可以向相关调用指令返回自定义数据,例如返回空值,从而确保能杜绝一些非法操作。 On the other hand by monitoring the target application access to system resources, such as whether a request to send text messages to determine whether to allow its operation, such as the implementation of such behavior is not allowed, can be returned to the relevant custom calling instructions based on security policy data, for example, return a null value, so as to ensure eliminate some illegal operation. 所述监控模块的技术实现,采用Hook技术,利用钩子函数对相关调用指令的入口点进行监视,截获此一调用指令,转向执行相应的钩子函数,由该钩子函数依据沙箱自身逻辑来应答该调用指令,从而达到前述的目的。 The monitoring module technology, using techniques Hook using hook function call instruction related entry point is monitored intercepts a call instruction, executes the corresponding steering hook function, based on the function of the hook itself sandbox answers the logic call instruction, so as to achieve the foregoing objects.

[0086] 这里需要补充的是:术语"钩子"涵盖了用于通过拦截在软件组件之间传递的函数调用、消息、或事件来改变或增加操作系统、应用程序、或其他软件组件的行为的技术。 [0086] It should be added that: The term "hook" for covering the function call by intercepting passed between software components, messages, or events to change or increase the operating system, applications, or conduct other software components technology. 而处理这种被拦截的函数调用、事件或消息的代码就被称为钩子hook函数。 And the code to handle this function call intercepted, event or news hook hook function is called. 钩子通常用于各种目标,包括对功能进行调试和对功能进行扩展。 Hooks commonly used for a variety of targets, including debugging functions and to extend the functionality. 其示例可以包括在键盘或鼠标事件传递到应用程序之前拦截它们,或者拦截系统调用(system call)、或者系统函数行为、函数执行结果等,以监视或修改应用程序或其他组件的功能等等。 Examples of which may include a keyboard or mouse event passed before their application to the block, or intercepted system call (system call), or the behavior of the system function, the function execution result, etc., to monitor the application or function, or to modify other components and the like. 本实施例即可采用钩子hook函数接管所述应用程序运行时所需的安装自校验操作。 The present embodiment uses a hook to hook takes over functions required to install self-checking operation of the run-time application.

[0087] 准备好上述的内部文件和原安装包后,本发明进一步将上述选定的内部文件和原安装包进行打包,打包后再行签名,即完成所述加壳安装包的构造,原安装包位于加壳安装包的assets\目录中,成为加壳安装包的附带资源。 [0087] Once you have the internal documents of the original and the installation package, the present invention further said selected document and the original inner packing installation package, and then packaged signature line, i.e. the complete shell construction installation package, the original installation package is located packers installation package assets \ directory, to be included with the installation package of the resource shell. 进一步可通过下一安装单元安装该加壳安装包,从而安装宿主应用程序。 The shell is further mounted installation package installed by the next unit, so that the host application installed.

[0088] 考虑到所生成的加壳安装包的文件将大于原安装包,本发明进而可以对加壳安装包中的代码文件进行压缩,生成压缩文件和用于还原所述压缩文件为代码文件的附加文件,这一压缩过程同理适用于所述原安装包中。 [0088] Taking into account the generated file installation package shell will be greater than the original installation package, the present invention can further compress packers code file installation package, and for generating a compressed file the compressed file is restored code file the attached file, the compression process same applies to the original installation package. 只要后续安装过程中依据逆向算法,利用附加文件对所述压缩文件在内存中进行还原,即可使宿主应用程序和目标应用程序实现正常运行。 As long as subsequent installation based inverse algorithm, using the attached file to restore the compressed file in the memory, to make the host application and the target application for normal operation. 经过压缩的安装包,其增量接近于零甚至小于零,因此效率较高。 Compressed installation package, or even close to zero in increments less than zero, and therefore higher efficiency.

[0089] 所述的安装单元13,用于安装该加壳安装包。 Said mounting unit [0089] 13, for mounting the packer installation package.

[0090] 如前所述,本发明的实施场景之一,未获Root权限,因此,这种场景中,并不能通过本发明实现静默安装。 [0090] As described above, one embodiment of the present invention scenes, has not been Root privileges, therefore, such a scenario, the present invention can not be achieved by the silent installation. 这种情况下,本发明优先通过调用系统安装器,以启动安装界面, 指导用户完成该加壳安装包的安装。 In this case, the present invention is preferentially by calling the system loader to initiate the installation interface that guides the user through the installation package mounting shell.

[0091] 安装该加壳安装包后,其中的Androidmanifest. xml中的文件便完成向系统的注册,宿主应用程序所使用的包名虽与目标应用程序的包名不同,但后续可通过利用所述逆向规则实现的程序克服,故宿主应用程序能够通过ActivityManagerService找到经反射调用而运行的目标应用程序的组件的入口,并且,目标应用程序的组件也能顺利通过系统PackageManagerService的查验,程序实现难度大减,而且应用程序的运行效率也将大大提商。 Although [0091] After installing the installation package shell, wherein the Androidmanifest. Xml file name of the package is completed with the target application to different package name registration system, used by the host application, but subsequent use by the program said backward rules implemented to overcome, so the host application to find the inlet assembly target application by reflection to invoke the program running through ActivityManagerService, and the target application component programs can pass inspection system PackageManagerService, the program implements difficult reduction and operating efficiency of the application will greatly improve the business.

[0092] 为体现本发明沙箱实例的第二方面,本发明进而提供一种应用程序免Root运行控制方法,该方法主要用于体现所述宿主应用程序的运行过程,以及其运行过程中对目标应用程序的加载运行过程。 [0092] The second aspect of the present invention is embodied of sandbox example, the present invention further provides an application for Free Root operation control method is mainly reflected in the operating procedure for the host application, as well as its operation of running the process of loading the target application. 本领域技术人员应当知晓,依据沙箱实现原理,本发明的免Root 运行控制方法用于控制本发明的加壳配置方法所构造的宿主应用程序与目标应用程序的运行,因此,本发明的免Root运行控制方法的具体实现细节中,当然需适应所述宿主应用程序的具体实例做适应性的匹配,因此,上述加壳配置方法所衍生的诸多变化实例,当然地导致该免Root运行控制方法的适应性调整,而这些调整手段也当然地为本领域技术人员所应熟知。 Those skilled in the art should be aware, realized according to the principles of the sandbox, Root-free operation control method of the present invention for controlling the operation of the present invention is constructed in shell configuration method host application and the target application, therefore, the present invention is free Root specific implementation details of the operation control method, of course, shall be adapted to the specific examples of the host application to do adaptive matched, therefore, the above-described shell configuration example derived many changes, of course, result in the operation control method for Free Root the adaptation, these adjusting means can of course be known to those skilled in the art.

[0093] 参阅图3,本发明的应用程序免Root运行控制方法,具体包括如下步骤: [0093] Referring to Figure 3, the application of the present invention for Free Root operation control method includes the following steps:

[0094] S21、反射调用与宿主应用程序具有不同包名的作为宿主应用程序附带资源的安装包,以加载该安装包所实现的目标应用程序。 Installation package associated resources as the host application [0094] S21, the host application invokes the reflector having different package name to load the target application installation package achieved.

[0095] 结合前述关于应用程序加壳配置方法的描述可知,宿主应用程序即指所述加壳安装包安装后的程序,而所述安装包即指存放于加壳安装包的aSSetS\目录下的应用程序原安装包。 [0095] The foregoing description of the combined application of the clear shell configuration, the shell refers to the host application program installed after the package is installed, the installer refers to the shell of the installation package is stored in Assets \ directory the original application installation package. 安装后,宿主应用程序反射调用的目标应用程序的安装包,属于宿主应用程序的附带的已安装资源文件。 After installation, the target application host application calls the reflection of the installation package, belong to the host application's resource file that comes already installed. 反射调用该安装包,即意味着运行所述目标应用程序。 Reflection to invoke the installation package, which means that running the target application.

[0096] 本发明所采用的反射机制可以为Java反射机制,Java反射机制是在运行状态中, 对于任意一个类,都能够知道这个类的所有属性和方法;对于任意一个对象,都能够调用它的任意一个方法;这种动态获取信息以及动态调用对象的方法的功能即为JAVA语言的反射机制。 [0096] reflection mechanism employed in the present invention may be a Java reflection, Java reflection mechanism is in the operating state, for any class, are made known to all properties and methods of this class; for any object, can be invoked the method of any one of; function of this method of obtaining dynamic information and dynamic invocation object is the reflection JAVA language.

[0097] 在本发明推荐的一个实例中,所述宿主应用程序将首先找到其安装后的由其assets携带的安装包APK文件,然后通过一个代理组件(Activity)去执行APK中的Activity,从而实现对目标应用程序的反射调用。 [0097] In a preferred embodiment of the invention, the host application will first find the APK file installation package which carries its assets after installation, and to perform the APK by a proxy component Activity (Activity), whereby call to reflection to achieve the target application. 宿主应用程序实施反射调用首先需要通过类加载器来实现,具体是通过DexClassLoaderO来实现。 The host application calls the first embodiment of the reflector needs to be achieved by the class loader, in particular achieved by DexClassLoaderO. 利用这一类加载器来实现对安装包中的活动组件的调用是本领域技术人员所掌握的手段,恕不赘述。 With this class loader to achieve the call to active components in the installation package of skilled workers whose skills means without repeat. 程序实现时,可通过一个Proxy方法来让宿主应用程序接管目标应用程序的执行,一旦被接管以后,目标应用程序所有的执行均通过proxy实现,且Context也变成了宿主程序的Context。 When the program implemented by a Proxy way to let the host application to take over the execution of the target application, Once was taken over all performance goals are achieved through the application proxy, and Context Context has become the host of the program. 宿主应用程序其实就是个空壳,它只是把原安装包apk加载到自己的内部去执行。 The host application is actually an empty shell, it's just the original installation package apk loaded into its own internal execution. 这种情况下,尽管宿主应用程序已经采用目标应用程序的Androidmanifest. xml向系统注册,由于运行上下文环境context可能不同,仍可能会导致出现资源访问上的困难,有时甚至会发现不能访问安装包中的资源的情况。 In this case, even though the host application has adopted Androidmanifest target application. Xml register with the system, due to the operational context may be different context, it may still lead to difficulties in access to resources appear, sometimes can not find access to the installation package the situation of resources. 而这种困难的程度,取决于前述应用程序加壳配置方法中,被构造到加壳应用程序中的资源的多寡,也关系到包名不同的问题。 The extent of this difficulty, depending on the configuration of the aforementioned application method packers, packers are constructed to the amount of the application of resources, but also to a different package name issue. 不管如何,本领域技术人员可以借助后续揭示的方式加以克服。 No matter how skilled in the art can be overcome by means of follow-up revealed the way.

[0098]目标应用程序的运行将涉及到对资源的引用,这种引用的处理技巧虽为本领域技术人员所知晓,但也较为繁杂,因此本发明将尽量通过示例辅助本领域技术人员快速理解本发明所提供的若干实例。 Run [0098] the target application will involve reference to a resource, the process by this reference technique, although known to the skilled person, but also more complicated, and therefore the present invention by way of example to try to assist those skilled in the art to quickly understand the several examples of the present invention is provided.

[0099] 诚然,如果目标应用程序要访问的资源已经被已安装的宿主应用程序注册到系统中,例如前文所述的主图标文件,则其对资源的引用将非常直接,通过对宿主应用程序的已安装资源的调用即可满足目标应用程序的资源访问。 [0099] Indeed, resources if the target application to be accessed is already registered installed host application to the system, such as previously described main icon file, which is a reference to the resource will be very directly by the host application It calls the installed resources to meet the target application resource access. 除此之外,则需要附加一些额外考虑。 In addition, you need to attach some additional considerations.

[0100] 如果由于构造加壳安装包导致宿主应用程序的Context不能被目标应用程序正常访问,可以考虑改进这一问题,向原安装包借用资源。 [0100] If the installation package due to the construction Packers lead the host application Context can not be normal access to the target application, you can consider to improve this problem, the original installation package borrowed resources. 由于目标应用程序安装包APK没有安装,因此就无法通过宿主应用程序的Context去取得APK中的资源,比如图片、文本等。 Because the target application APK installation package is not installed, and therefore can not pass the host application to get the Context APK resources, such as images, text, and so on. APK在被加载运行时所采用的上下文是宿主应用程序的上下文,用别人的Context是无法得到自己的资源的。 APK context when being loaded run is used in the context of the host application, use someone else's Context is unable to get its own resources. 由此可知,宿主应用程序除了要能加载应用程序中的各组件外,还要为应用程序构造其所需的运行环境。 It can be seen, the host application can load components in addition to the application, but also its configuration is required to run the application environment.

[0101] Android应用程序在运行的过程中,是通过一个称为AssetsManager资源管理器来读取打包在APK文件里面的资源文件的。 [0101] Android application during running, is packaged in APK file to read the resource file which is referred by a resource manager AssetsManager. 应用程序的每一个Activity组件都关联一个ContextImpl对象,这个ContextImpl对象就是用来描述activity组件的运行上下文环境的。 Activity Each component is associated with an application ContextImpl object, and this object is used to describe operating ContextImpl context activity assembly. 调用这个ContextImpl对象的成员函数init来执行初始化Activity组件运行上下文环境的工作,其中就包括创建用来访问应用程序资源的Resources对象和AssetsManager 对象的工作。 It ContextImpl calls this object's member function init to initialize the implementation of Activity component running context, including the work to create objects and Resources AssetsManager object used to access application resources. 其中,Contextlmpl. init函数就定义在文件frameworks/base/core/java/ android/app/ContextImpl. java 中。 Wherein, Contextlmpl. Init function is defined in the file frameworks / base / core / java / android / app / ContextImpl. Java in. Contextlmpl. init 函数中的参数packagelnfo 指向的是一个IoadedApk对象,这个IoadedApk对象描述的是当前正在启动组件所属的Apk。 Contextlmpl. Packagelnfo init function of the parameter points to a IoadedApk objects, the object description IoadedApk is currently starting Apk component belongs. 用来访问应用程序资源的Resources对象是通过调用参数packagelnfo所指向的是一个IoadedApk对象的成员函数getResources来创建的。 Resources object is used to access the application resources by calling the parameters packagelnfo pointed to a member function getResources a IoadedApk object to create. 由此可知,为了创建Resources对象, 以提取或访问应用程序资源,如果出于访问安装包Apk中的资源的需要,本实施例还可以分别为应用中的各组件构建一个IoadedAPK对象。 It can be seen, in order to create objects Resources, to extract the resource or access application can also build a IoadedAPK objects individually for each component if the application for access to the installation package Apk resource needs, the present embodiment.

[0102] 同理,适应具体的加壳安装包的配置,根据需要,可以考虑对资源Resources类的构造函数中的成员变量mResource、mAssets进行修改,以在启动各所述组件时通过所述mResource、mAssets来调取相应的资源。 [0102] Similarly, mounting shell adapt a particular package configuration, if necessary, can be considered a member variable class constructors resource Resources in mResource, mAssets be modified through the mResource when starting each of the components , mAssets to call up the corresponding resources.

[0103] 同理,也可考虑对资源管理器AssetsManager中的AssetsPath函数进行修改, 修改后的所述AssetsPath函数指向所述目标应用程序安装包中的资源文件(通常指assets\),以在启动各所述组件时通过所述AssetsManager调取所述AssetsPath函数来获取所述资源文件中的对应资源。 [0103] Similarly, also consider the resource manager AssetsManager AssetsPath function modification, the modified function AssetsPath directed to the target application resource file installation package (usually Assets \), to start AssetsManager by the retrieval function when the AssetsPath each of the component to obtain a corresponding resource in the resource file.

[0104] 其中,Resources 类的构造函数定义在文件frameworks/base/core/java/ android/content/res/Resources. java 中。 [0104] wherein the definition of Resources class constructor. Java files in the frameworks / base / core / java / android / content / res / Resources. 因为Resources 类的构造函数将参数assets 所指向的一个AssetManager对象保存在成员变量mAssets中,即mAssets = assets,使得Resources类的构造函数可以通过mAssets来访问应用程序的资源。 Resources class because the constructor will AssetManager a pointed object parameters assets stored in the member variable mAssets, i.e. mAssets = assets, such Resources class constructors resource can be accessed by applications mAssets. 因此,本实施例可通过对资源类的构造函数中的成员变量mAssets进行修改,来实现通过mAssets调取应用程序所需的资源。 Accordingly, the present embodiment can member variables constructors resource in mAssets modified by, to achieve the transfer of resources required by the application mAssets. 诚然,上述有关安装包中资源的访问的实现方式也采用反射机制来实现。 Indeed, the implementation of said access resources related installation package also reflective mechanisms.

[0105] 当然,本实施例还可对资源管理器AssetsManager中的AssetsPath函数进行修改,如通过AssetsManager对象的成员函数addAssetsPath来添加指定的应用程序资源文件路径(如:路径为/data/app/com.qihoo. box-1. apk)到AssetsPath 函数中。 [0105] Of course, the present embodiment may further embodiment of the resource manager AssetsManager AssetsPath function modified as to add the specified application resource file path (e.g., through a member function addAssetsPath AssetsManager object: path / data / app / com .qihoo. box-1. apk) to AssetsPath function. 由于addAssetsPath是隐藏API我们无法直接调用,所以只能通过反射机制来实现。 Since addAssetsPath is hidden we can not directly call the API, it can only be achieved through reflection.

[0106] 如前所述,还需要在加载模块中实现类加载器,以加载各所述组件中的相应加载类。 [0106] As described above, also need to implement class loader loading module loads classes corresponding to each of the load components. 可采用如下方式实现:一种方式是将所述应用程序的路径添加到类加载器中的路径列表PathLiSt中,构造根据所述应用程序路径查找加载类的类加载器;另一种方式是对类加载器中的成员变量进行修改,构造首先用super找加载类的类加载器。 Can be achieved as follows: One way is to add the path to the path of the application class loader PathLiSt list, the configuration of the class to find classes loaded in accordance with the application path; another way is member variable class loader to be modified, constructed first find the class loader to load a class with super. 由于利用类加载器动态加载应用程序的技术已为本领域技术人员所熟知,故此处仅给出示例性说明,恕不赘述。 Since the dynamic class loader loads the application techniques known to those skilled in the art, it is merely exemplary illustration given herein without repeated.

[0107] 在程序运行过程中,如前所述,需要考虑所述利用逆向规则来规避宿主应用程序与目标应用程序包名差异的问题。 [0107] In the course of running, as described above, to consider the use of the rules to avoid the problem of reverse host application with the application package name certain differences. 可以将逆向规则实现为一个供调度的函数,结合本发明所述的监控模块所实现的有关资源重定向的方面,对相关可能涉及包名引用的调用指令进行监控,当出现包名引用时,便可调度前述利用逆向规则实现的函数来修改所引用的包名, 从而使两者建立一一对应关系,实现资源的正常引用。 Reverse rules can be implemented as a function for scheduling, resource redirection connection with the aspects relating to the monitoring module of the present invention is implemented, the relevant package name call instruction may involve references to monitor, when there is a reference package name, reverse function can be scheduled using the aforementioned rules implemented to modify the package referenced by name, so that both the establishment of one relationship and achieve normal reference resource. 这里所称的调用的指令,也即监控模块利用钩子函数所挂钩的指令,包括诸如startActivity、startService、loadClass、 sentBroacast、bindServer等。 It referred to herein called instructions, i.e. instructions module using the monitoring function linked to the hook, including such startActivity, startService, loadClass, sentBroacast, bindServer like. 通常这些指令利用意图即Intent进行参数传递,而Intent 中包含对包名的引用,这种情况下,钩子函数即发挥其作用,对包名进行修改,使这些调用指令能够调用到正确的资源。 These instructions are typically intended use Intent i.e., parameter passing, and Intent contains a reference to the package name, in this case, i.e., its role hook function, to modify the package name, so that these instructions can call to invoke the correct resource. 例如,目标应用程序要调用其自身的一个Activity,在Intent中包含活动组件com. apk. activty,通过StartActivity来调用,钩子函数截获这一调用指令,然后利用所述逆向规则所实现的函数,将其包名进行修改,对应到已经注册的活动组件apphost. com. apk. activity,由此便可由宿主应用程序做进一步去反射调用目标应用程序的相应组件。 For example, the target application program to call one of its own Activity, com containing movable assembly in the Intent. Apk. Activty, is called by startActivity, hook function intercepts the call instruction, and then using the inverse function implemented rule, the modify its package names corresponding to the active component apphost registered. com. apk. activity, thus can be made by the host application calls the corresponding components is further reflected to the target application. 诚然,尽管包名不同,宿主应用程序在反射调用时,其进行类加载时,也会遵守同一规则去调用正确的目标应用程序中的资源。 Indeed, despite the different package name, the host application calls upon reflection, when it carried out the class loader will abide by the same rule to call the correct target application resources.

[0108] 以上也顺便揭示了后续即将揭示的监控模块所实现的一方面功能,故而后续有关监控模块的功能实现的介绍将被简化。 [0108] Incidentally, the above is also an aspect of the disclosed features disclosed in the forthcoming subsequent monitoring module implemented, and therefore the subsequent description of implemented functions related to the monitoring module will be simplified.

[0109] S22、由宿主应用程序调用监控模块,对目标应用程序的活动进行监控。 [0109] S22, call monitoring module by the host application, the activities of the target application to be monitored.

[0110] 作为一个沙箱实例,使目标应用程序运行于沙箱运行环境中,通常通过所述加载模块先于所述目标应用程序的反射调用而优先调用一监控模块。 [0110] As a sandbox example, the target application is running in sandbox operating environment, typically by reflecting the load module before invoking the target application calls a monitoring module preferentially. 这一监控模块便是前文所称的监控模块。 The monitoring module is previously called the PCU.

[0111] 如前所述,该监控模块便是沙箱运行环境的核心实现者,负责实现两方面的功能, 一方面如前所述通过监控目标应用程序对资源的访问,对资源引用进行重定向,使目标应用程序进程能够实现对正确资源的正常引用。 [0111] As mentioned above, the monitoring module is the core of the operating environment sandbox realize who is responsible for implementing two functions, one as previously described by monitoring the target application access to resources, resource references re orientation, the target application process to achieve a normal reference to the correct resources. 具体而言,如果相关资源是被反射调用的原安装包的资源,则通过反射调用机制调用该原安装包的资源供引用,实现重定向。 Specifically, if the resources are reflected resources of the original installation package call, the call of the resources of the original installation package by calling mechanism for reflection reference redirection. 如果是系统资源或者指向宿主应用程序的已安装资源,则可允许其默认引用保证其正常引用关系。 If the system resources, or point to the host application is installed resources, allowing it to be referenced to ensure their normal default reference relationship. 如果是I/O操作,也可以藉此进行重定向。 If I / O operation, it may thereby be redirected. 例如,上述有关对目标应用程序的安装包的资源进行的引用,既可以通过对上述的AssetsManager的修改来实现,也可以通过监控具体调用资源的具体调用指令,利用Hook技术来实现。 For example, the resource related to the target application installation package performs the above references, may be achieved by modification of the above-described AssetsManager may also call specific call instruction by monitoring specific resources, be implemented using techniques Hook. 另一方面通过监控目标应用程序对系统资源的访问,例如是否请求发送短信息,来依据安全策略确定是否允许其操作,当不允许这种实施这种行为时,可以向相关调用指令返回自定义数据,例如返回空值,从而确保能杜绝一些非法操作。 On the other hand by monitoring the target application access to system resources, such as whether a request to send text messages to determine whether to allow its operation in accordance with the security policy, when such acts do not allow this, you can return a custom instructions to the relevant call data, for example, return a null value, so as to ensure eliminate some illegal operation. 所述监控模块被注册为服务进程,以钩子函数关联目标应用程序活动进程的调用指令以实现对所述目标应用程序的活动监控。 The monitoring module is registered as a service process, to invoke the command target application active processes associated hook function to enable monitoring of the activities of the target application. 所述监控模块利用钩子函数对相关调用指令的入口点进行监视,截获此一调用指令,转向执行相应的钩子函数,由该钩子函数依据沙箱自身逻辑来应答该调用指令,从而达到前述的目的。 The purpose of using a monitoring module associated hook function entry points monitored call instruction, intercepts a call instruction, executes the corresponding hook function steering by the hook itself logic function based on the sandbox answers the call instruction, so as to achieve the aforementioned . 涉及到监控模块对于监视活动的处理,尤其是安全控制方面,将在后文中给出更为具体的实例进行说明。 Involves monitoring module for monitoring the processing activities, in particular security control, more specific examples will be given be described hereinafter.

[0112] S23、当监控到目标应用程序需要调用未匹配的资源时,重定向相关调用指令的资源引用,以为该目标应用程序的运行提供正确资源。 [0112] S23, when the monitor to the target application needs to call unmatched resources, redirect the call instruction related resource references, that runs the target application to provide the right resources.

[0113] 这里所称的未匹配的资源,参照前述,不应局限理解为构造于宿主应用程序加壳安装包中的res\和assets的资源,应理解为包括这两个目录的资源在内的资源和系统资源,以及目标应用程序原安装包内部的包括res\、3%的8\在内的一切可能被进程调用的资源。 [0113] unmatched resources referred to herein, with reference to the foregoing, it should not be construed as limited to the resource configuration of the host application installation package shell res \ and the assets, resources should be understood to include both directories including resources and system resources, and target applications include the original installation package inside the res \, 3% 8 \ including all resources may be invoked process. 尤其是对于目标应用程序原安装包中的资源,因为原安装包未被安装,当相关调用指令直接对其实施调用时,如果不加反射调用或者Hook处理,通常会被理解为错误访问。 Particularly for certain applications the original installation package resources, because the original installation package is not installed, when the associated call instruction it directly invoked, the call without reflection or Hook processing, as would normally be understood access error.

[0114] 所称重定向相关调用指令的资源引用,主要是指在目标应用程序进程运行过程中实现的重定向,包括在该进程运行过程中可能发生的借助钩子函数利用AssetsManager的成员变量而实现的对原安装包的资源重定向处理,包括在进程运行过程中可能发生的对所述原安装包中的资源的引用的直接给定数值的重定向,包括如前所揭示的涉及包名差异的调度上的重定向等。 [0114] alleged to redirect the call instruction related resource references, mainly refers to redirect the course of the target application processes running to achieve, including members of the variables by means of the use of AssetsManager hook function that may occur during the running process is achieved the redirection processing resources of the original installation of the package, including redirecting the original installation package directly references a resource of a given value that can occur during the process of operation, as previously disclosed comprising a package name relates to the difference redirection on schedule. 如果不加以这种干预,该安装包中的个别资源可能由于未经安装或因包名差异而会被误认为是所述进程的错误访问,包括在进程运行过程中可能发生的对通知栏服务(NotificationManager)和动画函数(OverridePendingTransition)的调用的屏蔽处理(利用钩子函数对其调用指令返回空值即可),以及包括对未经授权(依据沙箱安全策略、规则等)资源的访问的调用指令的重定向处理(可以向其返回诸如空值、虚假数值之类的自定义数据)等。 If not this intervention, the installation package of individual resources may be due to not install the package name or because of differences can be mistaken for an error accessing the process, including the process that may occur during the operation of the notification bar service call access (NotificationManager) and animation functions (OverridePendingTransition) masking process called (using the hook function is called on to command returns an empty value), as well as including unauthorized (based sandbox security policies, rules, etc.) resources redirection processing instructions (such as a null value may be returned to its custom data false value or the like) and the like. 故而,这里所称的"重定向",应为广义的理解,是指依据沙箱实现逻辑而归纳的一切确保进程正常运行的基于钩子函数实现的安全技术手段。 Therefore, here called "redirect" should be construed broadly refers to technology-based security hook function implemented in accordance with all sandboxes implement the logic and induction process to ensure normal operation.

[0115] 可以看出,借助本发明的应用程序免Root运行控制方法,可以通过宿主应用程序正常调用目标应用程序并确保目标应用程序的正常运行。 [0115] As can be seen, by means of the application of the present invention for Free Root operation control method can be called by the target application and the host application properly ensure the normal operation of the target application.

[0116] 相应的,请参阅图4,本发明进一步提供一种装置辅以实现一种应用程序免Root 运行控制装置,其包括调用单元21、监控模块22以及处理单元23。 [0116] Accordingly, please refer to FIG. 4, the present invention further provides an apparatus to realize a combined application Free Root operation control means, which comprises a calling unit 21, a monitoring module 22 and a processing unit 23.

[0117] 所述的调用单元21,用于反射调用与宿主应用程序具有不同包名的作为宿主应用程序附带资源的安装包,以加载该安装包所实现的目标应用程序。 The calling unit [0117] 21, for installation package associated resources as reflecting host application calls to the host application with a different package name to load the target application installation package achieved.

[0118] 结合前述关于应用程序加壳配置方法的描述可知,宿主应用程序即指所述加壳安装包安装后的程序,而所述安装包即指存放于加壳安装包的a SSetS\目录下的应用程序原安装包。 [0118] in conjunction with the description of the application of the clear shell configuration, the shell refers to the host application program installed after the package is installed, the installer refers to the shell of the installation package is stored in a SSetS \ directory application under the original installation package. 安装后,宿主应用程序反射调用的目标应用程序的安装包,属于宿主应用程序的附带的已安装资源文件。 After installation, the target application host application calls the reflection of the installation package, belong to the host application's resource file that comes already installed. 反射调用该安装包,即意味着运行所述目标应用程序。 Reflection to invoke the installation package, which means that running the target application.

[0119] 同理,本发明所采用的反射机制可以为Java反射机制,Java反射机制是在运行状态中,对于任意一个类,都能够知道这个类的所有属性和方法;对于任意一个对象,都能够调用它的任意一个方法;这种动态获取信息以及动态调用对象的方法的功能即为JAVA语言的反射机制。 [0119] Similarly, the reflection mechanism of the present invention may be employed for the Java reflection mechanism, Java reflection mechanism is in the operating state, for any class, are made known to all properties and methods of this class; for any objects, are it can invoke a method of any of; dynamically obtain information and function of such dynamic invocation object is the reflection method JAVA language.

[0120] 在本发明推荐的一个实例中,所述宿主应用程序将首先找到其安装后的由其assets携带的安装包APK文件,然后通过一个代理组件(Activity)去执行APK中的Activity,从而实现对目标应用程序的反射调用。 [0120] In a preferred embodiment of the invention, the host application will first find the APK file installation package which carries its assets after installation, and to perform the APK by a proxy component Activity (Activity), whereby call to reflection to achieve the target application. 宿主应用程序实施反射调用首先需要通过类加载器来实现,具体是通过DexClassLoaderO来实现。 The host application calls the first embodiment of the reflector needs to be achieved by the class loader, in particular achieved by DexClassLoaderO. 利用这一类加载器来实现对活动组件的调用的技术为本领域技术人员所掌握,恕不赘述。 With this class loader to achieve technology called active components of the skilled workers whose skills, not be repeat. 程序实现时,可通过一个Proxy 方法让宿主应用程序接管目标应用程序的执行,一旦被接管以后,目标应用程序所有的执行均通过proxy实现,且Context也变成了宿主程序的Context。 When the program implemented by a Proxy method allows the host application to take over the execution of the target application, Once was taken over all performance goals are achieved through the application proxy, and Context Context has become the host of the program. 宿主应用程序其实就是个空壳,它只是把原安装包apk加载到自己的内部去执行。 The host application is actually an empty shell, it's just the original installation package apk loaded into its own internal execution. 这种情况下,尽管宿主应用程序已经采用目标应用程序的Androidmanifest. xml向系统注册,由于运行上下文环境context 可能不同,仍可能会导致出现资源访问上的困难,有时甚至会发现不能访问安装包中的资源的情况。 In this case, even though the host application has adopted Androidmanifest target application. Xml register with the system, due to the operational context may be different context, it may still lead to difficulties in access to resources appear, sometimes can not find access to the installation package the situation of resources. 而这种困难的程度,取决于前述应用程序加壳配置方法中,被构造到加壳应用程序中的资源的多寡,也关系到包名不同的问题。 The extent of this difficulty, depending on the configuration of the aforementioned application method packers, packers are constructed to the amount of the application of resources, but also to a different package name issue. 不管如何,本领域技术人员可以借助后续揭示的方式加以克服。 No matter how skilled in the art can be overcome by means of follow-up revealed the way.

[0121] 目标应用程序的运行将涉及到对资源的引用,这种引用的处理技巧虽为本领域技术人员所知晓,但也较为繁杂,因此本发明将尽量通过示例辅助本领域技术人员快速理解本发明所提供的若干实例。 Run [0121] the target application will involve reference to a resource, the process by this reference technique, although known to the skilled person, but also more complicated, and therefore the present invention by way of example to try to assist those skilled in the art to quickly understand the several examples of the present invention is provided.

[0122] 诚然,如果目标应用程序要访问的资源已经被已安装的宿主应用程序注册到系统中,例如前文所述的图标,则其对资源的引用将非常直接,通过对宿主应用程序的已安装资源的调用即可满足目标应用程序的资源访问。 [0122] Indeed, resources if the target application to be accessed is already registered installed host application to the system, such as previously described icon, it references to resources will be very direct, by is the host application program installation of call resources to meet the resource access of the target application. 除此之外,则需要附加一些额外考虑。 In addition, you need to attach some additional considerations.

[0123] 如果由于构造加壳安装包导致宿主应用程序的Context不能被目标应用程序正常访问,可以考虑改进这一问题,向原安装包借用资源。 [0123] If the installation package due to the construction Packers lead the host application Context can not be normal access to the target application, you can consider to improve this problem, the original installation package borrowed resources. 由于目标应用程序安装包APK没有安装,因此就无法通过宿主应用程序的Context去取得APK中的资源,比如图片、文本等。 Because the target application APK installation package is not installed, and therefore can not pass the host application to get the Context APK resources, such as images, text, and so on. APK在被加载运行时所采用的上下文是宿主应用程序的上下文,用别人的Context是无法得到自己的资源的。 APK context when being loaded run is used in the context of the host application, use someone else's Context is unable to get its own resources. 由此可知,宿主应用程序除了要能加载应用程序中的各组件外,还要为应用程序构造其所需的运行环境。 It can be seen, the host application can load components in addition to the application, but also its configuration is required to run the application environment.

[0124] Android应用程序在运行的过程中,是通过一个称为AssetsManager资源管理器来读取打包在APK文件里面的资源文件的。 [0124] Android application during running, is packaged in APK file to read the resource file which is referred by a resource manager AssetsManager. 应用程序的每一个Activity组件都关联一个ContextImpl对象,这个ContextImpl对象就是用来描述activity组件的运行上下文环境的。 Activity Each component is associated with an application ContextImpl object, and this object is used to describe operating ContextImpl context activity assembly. 调用这个ContextImpl对象的成员函数init来执行初始化Activity组件运行上下文环境的工作,其中就包括创建用来访问应用程序资源的Resources对象和AssetsManager 对象的工作。 It ContextImpl calls this object's member function init to initialize the implementation of Activity component running context, including the work to create objects and Resources AssetsManager object used to access application resources. 其中,Contextlmpl. init函数就定义在文件frameworks/base/core/java/ android/app/ContextImpl. java 中。 Wherein, Contextlmpl. Init function is defined in the file frameworks / base / core / java / android / app / ContextImpl. Java in. Contextlmpl. init 函数中的参数packagelnfo 指向的是一个IoadedApk对象,这个IoadedApk对象描述的是当前正在启动组件所属的Apk。 Contextlmpl. Packagelnfo init function of the parameter points to a IoadedApk objects, the object description IoadedApk is currently starting Apk component belongs. 用来访问应用程序资源的Resources对象是通过调用参数packagelnfo所指向的是一个IoadedApk对象的成员函数getResources来创建的。 Resources object is used to access the application resources by calling the parameters packagelnfo pointed to a member function getResources a IoadedApk object to create. 由此可知,为了创建Resources对象, 以提取或访问应用程序资源,如果出于访问安装包Apk中的资源的需要,本实施例还可以分别为应用中的各组件构建一个IoadedAPK对象。 It can be seen, in order to create objects Resources, to extract the resource or access application can also build a IoadedAPK objects individually for each component if the application for access to the installation package Apk resource needs, the present embodiment.

[0125] 同理,适应具体的加壳安装包的配置,根据需要,可以考虑对资源Resources类的构造函数中的成员变量mResource、mAssets进行修改,以在启动各所述组件时通过所述mResource、mAssets来调取相应的资源。 [0125] Similarly, mounting shell adapt a particular package configuration, if necessary, can be considered a member variable class constructors resource Resources in mResource, mAssets be modified through the mResource when starting each of the components , mAssets to call up the corresponding resources.

[0126] 同理,也可考虑对资源管理器AssetsManager中的AssetsPath函数进行修改, 修改后的所述AssetsPath函数指向所述目标应用程序安装包中的资源文件(通常指assets\),以在启动各所述组件时通过所述AssetsManager调取所述AssetsPath函数来获取所述资源文件中的对应资源。 [0126] Similarly, also consider the resource manager AssetsManager AssetsPath function modification, the modified function AssetsPath directed to the target application resource file installation package (usually Assets \), to start AssetsManager by the retrieval function when the AssetsPath each of the component to obtain a corresponding resource in the resource file.

[0127] 其中,Resources 类的构造函数定义在文件frameworks/base/core/java/ android/content/res/Resources. java 中。 [0127] wherein the definition of Resources class constructor. Java files in the frameworks / base / core / java / android / content / res / Resources. 因为Resources 类的构造函数将参数assets 所指向的一个AssetManager对象保存在成员变量mAssets中,即mAssets = assets,使得Resources类的构造函数可以通过mAssets来访问应用程序的资源。 Resources class because the constructor will AssetManager a pointed object parameters assets stored in the member variable mAssets, i.e. mAssets = assets, such Resources class constructors resource can be accessed by applications mAssets. 因此,本实施例可通过对资源类的构造函数中的成员变量mAssets进行修改,来实现通过mAssets调取应用程序所需的资源。 Accordingly, the present embodiment can member variables constructors resource in mAssets modified by, to achieve the transfer of resources required by the application mAssets. 诚然,上述有关安装包中资源的访问的实现方式也采用反射机制来实现。 Indeed, the implementation of said access resources related installation package also reflective mechanisms.

[0128] 当然,本实施例还可对资源管理器AssetsManager中的AssetsPath函数进行修改,如通过AssetsManager对象的成员函数addAssetsPath来添加指定的应用程序资源文件路径(如:路径为/data/app/com.qihoo. box-1. apk)到AssetsPath 函数中。 [0128] Of course, the present embodiment may further embodiment of the resource manager AssetsManager AssetsPath function modified as to add the specified application resource file path (e.g., through a member function addAssetsPath AssetsManager object: path / data / app / com .qihoo. box-1. apk) to AssetsPath function. 由于addAssetsPath是隐藏API我们无法直接调用,所以只能通过反射机制来实现。 Since addAssetsPath is hidden we can not directly call the API, it can only be achieved through reflection.

[0129] 如前所述,还需要在加载模块中实现类加载器,以加载各所述组件中的相应加载类。 [0129] As described above, also you need to implement class loader loading module loads classes corresponding to each of the load components. 可采用如下方式实现:一种方式是将所述应用程序的路径添加到类加载器中的路径列表pathList中,构造根据所述应用程序路径查找加载类的类加载器;另一种方式是对类加载器中的成员变量进行修改,构造首先用super找加载类的类加载器。 Can be achieved as follows: One way is to add the path to the path of the application class loader pathList list, the configuration of the class to find classes loaded in accordance with the application path; another way is member variable class loader to be modified, constructed first find the class loader to load a class with super. 由于利用类加载器动态加载应用程序的技术已为本领域技术人员所熟知,故此处仅给出示例性说明,恕不赘述。 Since the dynamic class loader loads the application techniques known to those skilled in the art, it is merely exemplary illustration given herein without repeated.

[0130] 在程序运行过程中,如前所述,需要考虑所述利用逆向规则来规避宿主应用程序与目标应用程序包名差异的问题。 [0130] In the course of running, as described above, to consider the use of the rules to avoid the problem of reverse host application with the application package name certain differences. 可以将逆向规则实现为一个供调度的函数,结合本发明所述的监控模块所实现的有关资源重定向的方面,对相关可能涉及包名引用的调用指令进行监控,当出现包名引用时,便可调度前述利用逆向规则实现的函数来修改所引用的包名, 从而使两者建立一一对应关系,实现资源的正常引用。 Reverse rules can be implemented as a function for scheduling, resource redirection connection with the aspects relating to the monitoring module of the present invention is implemented, the relevant package name call instruction may involve references to monitor, when there is a reference package name, reverse function can be scheduled using the aforementioned rules implemented to modify the package referenced by name, so that both the establishment of one relationship and achieve normal reference resource. 这里所称的调用的指令,也即监控模块利用钩子函数所挂钩的指令,包括诸如startActivity、startService、loadClass、 sentBroacast、bindServer等。 It referred to herein called instructions, i.e. instructions module using the monitoring function linked to the hook, including such startActivity, startService, loadClass, sentBroacast, bindServer like. 通常这些指令利用意图即Intent进行参数传递,而Intent 中包含对包名的引用,这种情况下,钩子函数即发挥其作用,对包名进行修改,使这些调用指令能够调用到正确的资源。 These instructions are typically intended use Intent i.e., parameter passing, and Intent contains a reference to the package name, in this case, i.e., its role hook function, to modify the package name, so that these instructions can call to invoke the correct resource. 例如,目标应用程序要调用其自身的一个Activity,在Intent中包含活动组件com. apk. activty,通过StartActivity来调用,钩子函数截获这一调用指令,然后利用所述逆向规则所实现的函数,将其包名进行修改,对应到已经注册的活动组件apphost. com. apk. activity,由此便可由宿主应用程序做进一步去反射调用目标应用程序的相应组件。 For example, the target application program to call one of its own Activity, com containing movable assembly in the Intent. Apk. Activty, is called by startActivity, hook function intercepts the call instruction, and then using the inverse function implemented rule, the modify its package names corresponding to the active component apphost registered. com. apk. activity, thus can be made by the host application calls the corresponding components is further reflected to the target application. 诚然,尽管包名不同,宿主应用程序在反射调用时,其进行类加载时,也会遵守同一规则去调用正确的目标应用程序中的资源。 Indeed, despite the different package name, the host application calls upon reflection, when it carried out the class loader will abide by the same rule to call the correct target application resources.

[0131] 以上也顺便揭示了后续即将揭示的监控模块所实现的一方面功能,故而后续有关监控模块的功能实现的介绍将被简化。 [0131] Incidentally, the above is also an aspect of the disclosed features disclosed in the forthcoming subsequent monitoring module implemented, and therefore the subsequent description of PCU functions implemented will be simplified.

[0132] 所述的监控模块22,被配置为由宿主应用程序加载,对目标应用程序的活动进行监控。 The [0132] monitor module 22 configured to be loaded by the host application, the activities of the target application to be monitored.

[0133] 作为一个沙箱实例,使目标应用程序运行于沙箱运行环境中,通常通过所述加载模块先于所述目标应用程序的反射调用而优先调用一监控模块22。 [0133] As a sandbox example, the target application is running in sandbox operating environment, typically by reflecting the load module before invoking the target application calls preferentially a monitoring module 22. 这一监控模块22便是前文所称的监控模块22。 The monitoring module 22 is referred to earlier monitoring module 22.

[0134] 如前所述,该监控模块22便是沙箱运行环境的核心实现者,负责实现两方面的功能,一方面如前所述通过监控目标应用程序对资源的访问,对资源引用进行重定向,使目标应用程序进程能够实现对正确资源的正常引用。 [0134] As mentioned above, the core of the monitoring module 22 is running sandbox environment to realize who is responsible for implementing two functions, one as previously described by monitoring the target application access to resources, resource references in redirect the target application process to achieve a normal reference to the correct resources. 具体而言,如果相关资源是被反射调用的原安装包的资源,则通过反射调用机制调用该原安装包的资源供引用,实现重定向。 Specifically, if the resources are reflected resources of the original installation package call, the call of the resources of the original installation package by calling mechanism for reflection reference redirection. 如果是系统资源或者指向宿主应用程序的已安装资源,则可允许其默认引用保证其正常引用关系。 If the system resources, or point to the host application is installed resources, allowing it to be referenced to ensure their normal default reference relationship. 如果是I/O操作,也可以藉此进行重定向。 If I / O operation, it may thereby be redirected. 例如,上述有关对目标应用程序的安装包的资源进行的引用,既可以通过对上述的AssetsManag er的修改来实现,也可以通过监控具体调用资源的具体调用指令,利用Hook技术来实现。 For example, the resource related to the target application installation package performs the above references, may be achieved by modifications of the above-described AssetsManag er, may be particularly specific call instruction calling resource by monitoring, using Hook technique. 另一方面通过监控目标应用程序对系统资源的访问,例如是否请求发送短信息,来依据安全策略确定是否允许其操作,当不允许这种实施这种行为时,可以向相关调用指令返回自定义数据,例如返回空值,从而确保能杜绝一些非法操作。 On the other hand by monitoring the target application access to system resources, such as whether a request to send text messages to determine whether to allow its operation in accordance with the security policy, when such acts do not allow this, you can return a custom instructions to the relevant call data, for example, return a null value, so as to ensure eliminate some illegal operation. 所述监控模块22被注册为服务进程,以钩子函数关联目标应用程序活动进程的调用指令以实现对所述目标应用程序的活动监控。 The monitoring activity monitoring module 22 is registered as a service process, to invoke the command target application active processes associated hook function to achieve the target application. 所述监控模块22利用钩子函数对相关调用指令的入口点进行监视,截获此一调用指令,转向执行相应的钩子函数,由该钩子函数依据沙箱自身逻辑来应答该调用指令,从而达到前述的目的。 The monitoring module 22 uses entry points associated hook function call instruction is monitored intercepts a call instruction, executes the corresponding hook function steering by the hook itself logic function based on the sandbox answers the call instruction, so as to achieve the aforementioned purpose. 涉及到监控模块22对于监视活动的处理,尤其是安全控制方面,将在后文中给出更为具体的实例进行说明。 22 relates to the process monitoring module for monitoring activities, especially security control, more specific examples will be given be described hereinafter.

[0135] 所述的处理单元23,被配置为当监控到目标应用程序需要调用未匹配的资源时, 重定向相关调用指令的资源引用,以为该目标应用程序的运行提供正确资源。 [0135] The processing unit 23 is configured to monitor when the application needs to call the target resource does not match, the call instruction to redirect relevant resource references, that the target application is run to provide the correct resource.

[0136] 这里所称的未匹配的资源,参照前述,不应局限理解为构造于宿主应用程序加壳安装包中的res\和assets的资源,应理解为包括这两个目录的资源在内的资源和系统资源,以及目标应用程序原安装包内部的包括res\、assets在内的一切可能被进程调用的资源。 [0136] unmatched resources referred to herein, with reference to the foregoing, it should not be construed as limited to the resource configuration of the host application installation package shell res \ and the assets, resources should be understood to include both directories including resources and system resources, and target applications include the original installation package inside the res \, assets, including all the resources that may be invoked process. 尤其是对于目标应用程序原安装包中的资源,因为原安装包未被安装,当相关调用指令直接对其实施调用时,如果不加反射调用或者Hook处理,通常会被理解为是错误访问。 Particularly for certain applications the original installation package resources, because the original installation package is not installed, when the associated call instruction it directly invoked, the call without reflection or Hook processing, typically is understood to be an error access.

[0137] 所称重定向相关调用指令的资源引用,主要是指在目标应用程序进程运行过程中实现的重定向,包括在该进程运行过程中可能发生的借助钩子函数利用AssetsManager的成员变量而实现的对原安装包的资源重定向处理,包括在进程运行过程中可能发生的对所述原安装包中的资源的引用的直接给定数值的重定向,包括如前所揭示的涉及包名差异的调度上的重定向等。 [0137] alleged to redirect the call instruction related resource references, mainly refers to redirect the course of the target application processes running to achieve, including members of the variables by means of the use of AssetsManager hook function that may occur during the running process is achieved the redirection processing resources of the original installation of the package, including redirecting the original installation package directly references a resource of a given value that can occur during the process of operation, as previously disclosed comprising a package name relates to the difference redirection on schedule. 如果不加以这种干预,该安装包中的个别资源可能由于未经安装或因包名差异而会被误认为是所述进程的错误访问,包括在进程运行过程中可能发生的对通知栏服务(NotificationManager)和动画函数(OverridePendingTransition)的调用的屏蔽处理(利用钩子函数对其调用指令返回空值即可),以及包括对未经授权(依据沙箱安全策略、规则等)资源的访问的调用指令的重定向处理(可以向其返回诸如空值、虚假数值之类的自定义数据)等。 If not this intervention, the installation package of individual resources may be due to not install the package name or because of differences can be mistaken for an error accessing the process, including the process that may occur during the operation of the notification bar service call access (NotificationManager) and animation functions (OverridePendingTransition) masking process called (using the hook function is called on to command returns an empty value), as well as including unauthorized (based sandbox security policies, rules, etc.) resources redirection processing instructions (such as a null value may be returned to its custom data false value or the like) and the like. 故而,这里所称的"重定向",应为广义的理解,是指依据沙箱实现逻辑而归纳的一切确保进程正常运行的基于钩子函数实现的安全技术手段。 Therefore, here called "redirect" should be construed broadly refers to technology-based security hook function implemented in accordance with all sandboxes implement the logic and induction process to ensure normal operation.

[0138] 利用本发明的监控模块22,可以实现更为强大的沙箱运行环境的构建。 [0138] With the present invention, the monitoring module 22, constructed sandbox more powerful operating environment can be achieved. 以下结合一具体实例,来进一步补充对本发明中的监控单元的说明。 Below with a specific example to further supplement to the monitoring unit of the present invention.

[0139] 所述监控模块22可以从一后台沙箱HOOK框架中获取对应于特定的事件行为的挂钩插件(钩子函数),利用该挂钩插件挂钩并监控目标应用的特定事件行为从而实现对目标应用程序进程的活动的监控。 [0139] The monitoring module 22 may acquire the behavior corresponding to a particular event plug hook (hook function) from a sandbox HOOK background frame, using the plug-in hook hooks to monitor the behavior of the target application specific events to achieve the target application monitoring the activities of the program process. 所述的后台沙箱HOOK框架,在云端进行集中管理,向各终端进行分发。 The sandbox HOOK background frame, centralized management in the cloud, for distribution to each terminal. 其中,云端主要构造有Java挂钩插件库和Native挂钩插件库。 Among them, the cloud mainly constructed with Java plug-in library hooks and hook Native plug-in library. 监控模块22需要挂钩具体事件行为时,通过远程插件接口向后台沙箱HOOK框架发送请求,获得针对特定事件行为的HOOK函数,即所述的挂钩插件,借此建立对特定事件行为的监控捕获和处理。 When the monitoring module 22 need to hook specific action on the event by sending a request to the remote plug-in interface background sandbox framework HOOK, HOOK function is obtained for a particular event behavior, namely the hook plugin, and to establish a monitoring of the behavior of a particular event capture and deal with.

[0140] 进而,运行中的宿主应用程序将进一步加载所述位于指定目录中的目标应用。 [0140] Furthermore, the host application will run further loading the target application is located in the specified directory. 如前所述,对目标应用程序的调用,是利用公知的Java反射调用机制实现的。 As described above, the call to the target application using Java reflection to invoke the well-known mechanism to achieve. 目标应用程序被加载时,已被监控模块22利用挂钩插件建立了监控,因此,目标应用程序的一切事件行为均在监控模块22的监控范围之内。 When the target application is loaded, the monitoring module 22 has been linked to the use of plug-established control, and therefore, the behavior of all events are in the target application monitoring module within the monitoring range of 22. 目标应用程序的安装包是完整未经修改的,因此,目标应用程序被宿主应用程序加载后,能够完全合法、正常地运行,实现目标应用程序原本能实现的所有功能。 Installation package of the target application is complete, unmodified, and therefore, the target application after the host application is loaded, fully legitimate, normal operation, the realization of all the features of the original target application can be achieved.

[0141] 由于监控模块22与目标应用程序的加载,均为宿主应用程序进程所驱动,同为宿主应用程序进程的一部分,且监控模块22先于目标应用程序加载,因而,运行中的监控模块22即建立了对目标应用程序一切事件行为的监控。 [0141] Since the load of the target application and monitoring module 22, are driven by a host application process, the same part of the host application process, and the monitoring module 22 to load the target application, and therefore, the operation of the monitoring module 22 namely the establishment of a monitoring target application all events behavior. 目标应用程序运行过程中产生的任何事件行为,其事件消息均会被监控模块22捕获并进行相应的处理。 Any event that course of action target application generated by the operation, which will be the message event monitoring module 22 to capture and make the appropriate treatment.

[0142] 目标应用程序产生的特定事件行为被监控模块22捕获,实质上是触发特定事件行为时,所产生的事件消息被监控模块22中相应的挂钩插件(钩子函数)所捕获。 [0142] the behavior of a specific event is generated by the target application monitoring module 22 captures, in essence, an event message is triggered when a particular event behavior, generated by the monitoring module 22 is linked to the corresponding plug (hook function) captured. 捕获该事件消息,即可知晓该事件的意图,继而可以进行后续的处理。 Capture the event message, you can know the intent of the event, which in turn can make subsequent processing.

[0143] 对特定事件行为进行处理由所述处理单元23实施,需要获取事件行为处理策略。 [0143] processing the behavior of a specific event processing unit 23 of the embodiment, the behavior needs to acquire event processing strategies. 在这一子步骤中,可以进一步借助系统服务来实现人机交互功能。 In this sub-step, interactive features can be achieved with the system further service. 为了实现人机交互效果, 本发明预先将一交互模块注册为系统服务,宿主应用程序可以通过其交互接口与该交互模块通信,从而实现宿主应用程序对用户指令或预设指令的获取。 In order to achieve the effect of human-computer interaction, the present invention is previously registered as a system service interaction module, through which the host application can communicate with the interactive interface interaction module, enabling the host application to a user instruction or a predetermined instruction acquisition.

[0144] 如前所述,事件行为策略的获取方式非常灵活多样,通过构造一策略生成装置来执行,以下列举几种为本发明所择一或任意组合使用的策略: [0144] As described above, the event acquisition mode behavior policy is very flexible, is performed by constructing a policy generating means listed below or any combination of a strategy used in the present invention several Optional:

[0145] (1)监控模块22捕获特定事件行为后,通过宿主应用程序内建的交互接口,向所述交互模块发送请求,由交互模块向用户界面弹窗问询用户处理策略,该弹窗界面可以直接告知用户有关事件行为的内容及其风险,由用户选择相应的选项作为处理策略。 After [0145] (1) capture specific event monitoring module 22 acts, via the host application transmits a built-in to the interactive interface module requests interaction from the user interaction module processing policy inquiry user interface pop, pop the the user interface can be directly informed of the content and conduct of the risks associated events, select the appropriate option by the user as a treatment strategy. 用户选择相应选项并确定后,交互模块获得针对该特定事件行为的处理策略,将其反馈给监控模块22,监控模块22即可根据该用户指令所产生的处理策略对目标应用程序的相应事件行为进行下一步的处理。 After the user selects the appropriate option and determine interaction module obtains processing strategy for that particular event behavior will be reported to the monitoring module 22, control module 22 to the corresponding event against the target application processing strategy according to the user instructions generated the next step of the process.

[0146] (2)在某些已被公认为相对低风险的事件行为发生时,例如对联系人的只读操作行为,或者在用户为本发明设置了自行检索针对特定事件行为所应采取的处理策略时,本发明利用一本地策略数据库检索相应的针对特定事件行为的处理策略。 [0146] (2) has been recognized in certain behaviors relatively low risk event occurs, such as read only operation against the contact, or a user of the present invention is provided a self-retrieval for a particular event should take action when processing strategy, the present invention utilizes a local policy database to retrieve the appropriate treatment strategies for specific events behavior. 也就是说,该本地策略数据库中,建立了特定事件行为与相应的处理策略之间的关联,并且存储了多种事件行为与相应的处理策略之间对应关系的记录数据,可以供本发明检索使用。 That is, the local policy database, establishing a link between a particular event and the corresponding behavior processing strategy, recording and storing data corresponding relation between the behavior of the corresponding plurality of event processing strategy, the present invention can be used for retrieval use. 本发明从本地策略数据库中获取相应的处理策略后,方能对相应事件行为做下一步的处理。 After the invention to obtain the corresponding processing strategy from the local policy database, in order to do further processing of the corresponding event action.

[0147] (3)如果用户为本发明设置了远程获取处理策略的选项,或者默认在本地策略数据库检索不到特定事件行为的具体策略时可以远程获取,又或通过前述第(1)种情况进行交互而在规定时限内得不到用户对弹窗的响应,诸如此类的情况,宿主应用程序均可通过其内建的远程策略接口,向预架构的云端发送请求,获得对应于该特定事件行为的相应的处理策略,并用于后续的处理。 [0147] (3) If the user can remotely obtain the present invention set up remote access options for treatment strategies, or specific strategies can not retrieve the default behavior of a particular event in the local policy database, or through another said first (1) Case and not to interact with the user in response to pop within the prescribed time limit, the case such as this, the host application can be accessed through its built-in remote policy interface sends a request to the pre-cloud architecture, obtaining corresponding to the particular event behavior respective processing strategy, and used for subsequent processing.

[0148] 需要指出的是,有关以上三种获取处理策略的方式,可以交叉配合使用,例如,一旦交互模块接收到监控模块22传递的事件消息的特征,即可依照默认设置,参照第(2)种方式先行检索本地策略数据库,获得系统推荐的处理策略(如果不能从本地策略数据库中获得,甚至可以进一步按第(3)种方式从云端策略数据库中获取)。 [0148] It should be noted that the above three relevant Obtaining processing strategy can be used with the cross, for example, upon interaction module receives the event message transmission characteristics of the monitoring module 22, can be at the default setting of reference (2 ) ways to advance local policy database retrieval, access to the system recommended treatment strategy (if you can not get from the local policy database even further by paragraph (3) obtained from the cloud policy database ways). 继而,参照第(1)种方式,在弹窗界面设置系统推荐的处理策略为默认选项。 Then, referring to the first (1) ways, in the pop-system interface settings recommended treatment strategy is the default option. 如果用户未在规定时限内确认该默认选项,则以系统推荐的处理策略为准执行后续指令;如果用户将之改变为新的默认选项, 则向监控模块22返回用户设置的处理策略。 If the user does not confirm that a predetermined default time limit, automatic processing strategy places subject to subsequent instructions executed; if the user changed to a new default option, the process returns to the monitor module 22 the policy set by the user. 可见,人机交互过程是可以更为灵活自由地实现的。 Visible, human-computer interaction is more flexibility and freedom to achieve.

[0149] 所述的本地策略数据库,可以是云端策略数据库的一个复件,因此,本发明中,设置一个更新步骤,用于下载云端策略数据库用于更新本地策略数据库。 [0149] The local policy database, a copy may be Cloud policy database, therefore, the present invention is provided a step of updating, for downloading the cloud policy database for updating the local policy database.

[0150] -般情况下,针对特定事件行为的策略可以设置为"拒绝"、"运行"、"询问"三个常见选项,其表征的具体意向为: [0150] - Under normal circumstances, the policy for a particular event behavior can be set to "reject", "Run", "ask" three common options, specific intent that characterizes as follows:

[0151] 拒绝:针对该特定事件行为,向目标应用程序发送事件行为已经执行完毕的虚假消息,以禁止该事件行为实际发生; [0151] refuse: for this particular event behavior, send event behavior have been implemented false news, to prohibit the conduct of the event actually happened to the target application;

[0152] 运行:针对该特定事件行为不做任何改变,将相应的事件消息直接转送给系统消息机制,允许目标应用程序继续其事件行为; [0152] Run: without any change in behavior for this particular event, the corresponding event message is routed directly to the system message mechanism that allows the target application to continue its events behavior;

[0153] 询问:独立或依附于前述两个选项任意之一,针对该特定事件行为,标记其状态为未知状态,后续重复发生该行为时,需要再行弹窗询问用户。 [0153] Inquiry: two options of any one of the preceding independent or dependent, for that particular event behavior, state flag which status is unknown, the action is repeated and the subsequent need to ask the user again pop.

[0154] 实际应用中,选项"询问"可被忽略,仅需考虑是否拒绝或允许当前事件行为发生即可。 [0154] In practice, the option "ask" can be ignored only to consider whether to reject or allow the current event behavior can occur.

[0155] 所述的事件行为,多种多样,具体包括如下几大类型: [0155] The behavior of event, variety, includes the following major types:

[0156] (1)终端、联网有关的操作: [0156] (1) terminal, a network-related operations:

[0157] 获取运营商信息:目标应用程序例如通过getSimOperatorNameO函数可以获得移动终端的頂SI,由此可进一步判断运营商的名称,进一步可以向运营商发送约定指令,实现扣费之类的非法目的。 [0157] Gets the operator information: destination application can be obtained, for example, the top of the mobile terminal SI by getSimOperatorNameO function, whereby determination can be further operator name, the agreement may send further instructions to the operator to achieve the purpose of illegal such deductions . 监控平台通过挂钩与此相关的消息,便可以对事件行为的捕获。 Monitoring platform by hooking news related to this, you can capture events behavior.

[0158] 切换APN操作:同理,目标应用程序通过与APN切换有关的函数实现ANP切换控制的操作,也可被监控模块22通过调用相应的挂钩插件进行监控。 [0158] handover operation APN: Similarly, to achieve the target application ANP switching control operation by switching functions associated with APN, the monitoring module 22 may also be monitored by calling the appropriate plug-in hooks.

[0159] 类似的操作,还包括获取手机识别码IME的操作,也与上述同理。 [0159] Similar operations further comprising obtaining an identification code IME phone operation, but also the same reason as described above.

[0160] (2)通知栏广告操作:通知栏广告是最易被恶意程序利用的手段,监控模块22通过调用相应的挂钩插件对notify函数产生的事件消息进行监控,也可对其实施监控。 [0160] (2) the notification bar advertising operations: notification bar ads are most vulnerable to malicious programs take advantage of the means of monitoring module 22 to monitor the event messages generated by calling the function notify the appropriate plug-in hooks, can also monitor its implementation.

[0161] (3)通信操作: [0161] (3) Communication Operation:

[0162] 如电话拔打操作,通过StartActivityO函数可以监控调用系统拨号界面的事件行为,利用相应的挂钩插件可以对拔打电话操作建立事件行为监控。 [0162] such as telephone dial operation, the system can monitor the behavior of calling the event interface by StartActivityO dial function, using the corresponding plug-ins can be linked to create an event monitor behavior dial telephone operation.

[0163] 短信操作,对应于sendTextMessage ()之类的函数,同理,可以借助挂钩插件对这类函数建立事件行为监控。 [0163] SMS operation, corresponding to sendTextMessage () function and the like, the same way, the behavior of such an event can be established by means of the monitoring function plug hooks.

[0164] 联系人操作:一般对应于query ()、insert ()函数,监控模块22利用挂钩插件挂钩此类函数可以实现对此类事件行为的监控捕获。 [0164] Contact operation: generally corresponds to the query (), insert () function, the monitoring module linked to the use of plug-in hook 22 such functions can be implemented to monitor the behavior of such events capture.

[0165] (4)命令操作: [0165] (4) Operation Command:

[0166] 如SU提权操作或执行命令操作,均需用到Execve ()函数,监控模块22通过监控此函数的返回消息,便可实现该类事件行为的监控。 [0166] The SU mention the right operation or execution command operations, required to use execve () function, the monitoring module 22 to monitor the function of the return message, such events can be implemented to monitor behavior.

[0167] (5)界面及访问操作: [0167] (5) and interface access operation:

[0168] 如创造快捷方式的事件行为,则对应于sentBroacastO函数。 [0168] as a shortcut to create an event behavior corresponds to sentBroacastO function. 同理,对于隐藏程序图标的操作,也可对应特定函数监控之。 Similarly, for the hidden icon operation, may also correspond to a specific function of monitoring.

[0169] 如HTTP网络访问操作,贝U对应于sentTo ()、write ()等函数。 [0169] The HTTP web access operation corresponding to the U shell sentTo (), write () function and the like.

[0170] (6)程序操作: [0170] (6) Program Operation:

[0171] 如应用加载操作,指当前目标应用程序加载相关应用的操作,通过对dexClassloaderO、IoadLibraryO等函数进行挂钩监控,可以实现对此类事件行为的捕-M- 犾。 [0171] The use load operation, refers to the current target application loading operation related applications, by dexClassloaderO, IoadLibraryO and other monitoring functions are linked, you can catch -M- l is achieved for such events behavior.

[0172] 又如安装子包,贝Ij对应于installPackage ()函数。 [0172] Another example is the installation subpacket, shellfish Ij corresponding to InstallPackage () function.

[0173] (7)其它危险操作: [0173] (7) other hazardous operations:

[0174] 例如,子进程侵入操作、衍生物操作、激活设备管理器操作等,分别对应于。 [0174] For example, the child process invasive operation, derivatives operation, activate the device manager operation, corresponding to.

[0175] 其中,子进程是指目标应用程序建立的子进程,在目标应用程序创建子进程时,监控模块22将收到相应的消息,而判定其创建子进程的事件行为。 [0175] where the child refers to a child process of the establishment of the target application, when the target application creates child processes, monitoring module 22 will receive a corresponding message, and determine the behavior of their events to create child process. 由此,监控模块22进一步向该子进程以内联钩子的方式在该子进程中植入监控模块22,后续便可继续对该子进程的事件行为进行监控。 Thus, the monitoring module 22 is further linked to the hook way within the sub-process monitoring module implanted in the child process 22, the follow-up to the event can continue to monitor the behavior of the child process. 因而,无论是目标应用程序的自身进程,还是其创建的子进程,它们直接或间接所触发的事件行为,均能被本发明的监控模块22所监控,实现较佳的主动防御效果更佳。 Thus, both the target application process itself, or the child process it creates, which acts directly or indirectly incident triggered, the monitoring module can be monitored 22 of the present invention, the preferred active defense for better effect.

[0176] 而所述衍生物,是指目标应用程序自行创建的文件,或者远程下载的文件,通常是指敏感的衍生物,例如安装包。 [0176] and the derivative, the target refers to the file created by the application itself, or a file downloaded remotely, generally refers sensitive derivatives such as the installation package. 通过挂钩fCloseO函数可以捕获该事件。 This event can be captured by hooking fCloseO function. 需要指出的是, 当监控模块22捕获该事件行为后,可以按照前述的方法,进一步利用远程规则库接口发送请求到云端,由云端利用其黑、白、灰的安全等级行为规则判断该衍生物的安全等级,本发明通过远程规则库接口获得云端判定结果后,进一步弹窗询问用户是否建立对该敏感衍生物的主动防御,由此便可进一步巩固主动防御的效果。 It is noted that, when the event monitoring module 22 captures the behavior, in accordance with the method described above, using a remote rule base further sends a request to the cloud, the derivative is determined by the use of its cloud of black, white, gray level of security rules of behavior after the security level, the present invention is to obtain results through remote cloud judgment rule library interface, further popups asking the user whether to establish active defense of the sensitive derivative, which can further consolidate the effect of active defense.

[0177] 上述的事件行为仅为摘录之用,不能理解为对本发明监控的事件行为的限制。 [0177] The above behavior is only an excerpt of the event, it can not be construed as limiting the present invention to monitor the behavior of the event is.

[0178] 依据上述的处理策略和上述关于事件行为的说明,本发明的主动防御方法便可对各种事件行为进行相应的处理。 [0178] According to the above processing strategy and the above description of the event action, active defense method of the invention can be of various events behavior accordingly. 以下列举几种典型的应用实例: Here are some typical examples of application:

[0179] (1)对目标应用程序的精细拦截的应用: [0179] (1) Fine intercepted target applications Application:

[0180] 部分恶意程序被安装后,在相当长的一段时间内处于正常使用的状态,麻痹用户的安全意识。 [0180] malicious program section after being installed, in a state of normal use for a long period of time, security conscious users paralysis. 但是,运行一段长时间之后,该目标应用程序尝试从后台插入一短信引起用户的关注,达到广告和诈骗的效果。 However, after running for a long time, the target application tries to insert a text draw the user's attention from the background, achieve the effect of advertising and fraud. 对该目标应用程序建立主动防御机制后,本发明如前所述,通过监控模块22中相应的挂钩插件对短信操作函数的监控,一旦目标应用程序产生短信操作的事件行为,便可捕获这一事件行为,继而,监控模块22通过其交互接口通知作为系统服务运行的交互模块,由交互模块向用户界面弹窗示警。 After establishing the active defense mechanisms to the target application, the present invention as described above, by the corresponding hook 22 on the plug monitor SMS function operation monitoring module, once the behavior of the target application generates an event message operations, this can be captured event behavior, in turn, control module 22 runs as a system service interaction module, warning through its interactive interface notified by the interaction module to the user interface pop. 用户点选"拒绝"的处理策略后,被逆反馈给监控模块22,其中相应的挂钩插件便能阻该事件行为的实际发生,达到防范风险的目的。 After a user click on the "refusal" of processing strategies are inverse feedback to the monitoring module 22, in which the plug will be able to hook corresponding resistive behavior of the actual event, the purpose of risk prevention.

[0181] (2)对目标应用程序释放恶意文件的应用。 [0181] (2) the application of the release of malicious files on the target application.

[0182] 目标应用程序为一游戏软件,通过检查更新的方式下载并释放恶意子包,并且调用系统功能安装该子包。 [0182] the target application is a game software, download and release malicious packet through the sub-way to check for updates, and install the system function calls the child package. 本发明对该目标应用程序建立了主动防御的沙箱运行环境之后, 可以监控到其下载完文件而产生的事件行为,据此通过交互模块弹窗告警。 After the invention of the establishment of active defense sandbox environment to run the target application, you can monitor the behavior of their events downloaded files generated by interaction module pursuant to pop alarm. 用户指令拒绝之后,监控模块22中相应的挂钩插件便可直接删除该文件,或者仅仅拒绝该文件的安装行为。 After the user command refused, monitoring module 22 in the corresponding plug-ins can be directly linked to delete the file, or simply refuse to install the behavior of the file.

[0183] 本发明中,对于诸如此类的恶意子包,视为敏感衍生物,对衍生物是否存在恶意的判断,可以通过利用预先确定的安全等级进行远程判断。 [0183] In the present invention, the sub-packet for malicious like, considered sensitive derivatives, to judge whether there is a malicious derivatives, may be determined by using the remote security level determined in advance. 具体而言,当检测到产生衍生物时,将相应的文件或者其签名之类的特征信息通过远程规则库接口发送给云端,并从云端获得其安全等级,如果为黑、灰应用,则在弹窗中建议用户拒绝安装;如果为白应用,则可允许其通行。 Specifically, upon detecting the generation of derivative, the feature information of the corresponding file signatures, or a rule base by remote transmission to the cloud interface, and obtain the security level from the cloud, if the black, gray application, in pop user rejects proposed installation; white if applied, may be allowed to pass. 通过这种方法,便可实现对敏感衍生物的安全防御。 By this method, security protection can be realized sensitive derivatives. 如果云端检测不到该衍生物的相关记录,可以要求本方法为其上传该文件,并由云端标示为未知应用,相应的,以灰应用予以标记,以备后用。 Cloud records not detected if the related derivatives, the present method may be required for uploading the file by the cloud labeled unknown application, appropriate, be marked with gray applications, for later use.

[0184] (3)对子进程侵入的应用。 [0184] (3) a child process invasive applications.

[0185] 被监控的目标应用程序在运行过程中创建子进程,而子进程进一步释放恶意事件行为。 [0185] monitored target application creates child processes during operation, while the child process further release of malicious event behavior. 监控模块22监控到目标应用程序创建子进程时,即获得子进程的入口,然后向该子进程植入本发明的监控模块22,所有HOOK插件(挂钩插件)都会被以内联钩子的方式加载到该子进程中并初始化好实现挂钩,以便建立对该子进程的事件行为的监控。 When the monitoring module 22 monitors to create a child process of the target application, i.e. gain access subprocess, and then implanted to the sub-process monitoring module 22 of the present invention, all plug-HOOK (plug hook) will be loaded hook inline manner to the child process and achieve good link initialization, monitoring the events in order to establish the child's behavior. 由此,可以看出,无论是由目标应用程序进程直接触发的事件行为,还是由目标应用程序进程所创建的子进程所触发的间接事件行为,均能被监控模块22成功监控。 Thus, it can be seen, either indirectly event behavior by the target application process directly triggered events behavior, or the child process by the target application process created triggered, can be successfully monitored 22 monitoring module.

[0186] 由上述的分析可见,本发明的应用程序免Root运行控制方法及其相应的装置所建构的沙箱运行环境,具有高效的可行性。 [0186] seen from the above analysis, the application of the present invention and its operation control method for Free Root sandbox operating environment constructed by the appropriate means, having a high feasibility.

[0187] 为便于本领域技术人员进一步实现本发明,以下进一步揭示云端服务器与终端设备如何相互配合实现安装包安全等级判断的相关内容: [0187] In order to facilitate a further skilled in the art to achieve the present invention, the following further reveal how the cloud server and the terminal equipment with each other to achieve the installation package content security level determination:

[0188] 如前所述,由客户端通过远程规则库接口发送到云端服务器的特征信息,包括: Android安装包的包名,和/或,版本号,和/或,数字签名,和/或,Android组件receiver 的特征,和/或,Android组件service的特征,和/或,Android组件activity的特征,和/或,可执行文件中的指令或字符串,和/或,Android安装包目录下各文件的MD5值(签名)。 [0188] As described above, the remote interface to the rule base of the cloud server by the feature information by the client, comprising: Android package installation package name, and / or, version number, and / or digital signatures, and / or , the receiver of the features of Android components, and / or, wherein the Android service components, and / or activity of Android components, and / or executable instructions or strings, and / or the installation package directory Android MD5 value for each file (signature).

[0189] 实现了本发明的方法或装置的客户端,将指定的特征信息上传到服务器(云端), 在服务器预置的规则库中查找与指定的单个特征信息或其组合相匹配的特征记录;其中, 所述服务器预置的规则库中包含特征记录及特征记录对应的安全级别,每条特征记录中包含单个特征信息或特征信息的组合; [0189] The client implements a method or apparatus according to the present invention, wherein the specified information is uploaded to the server (Drive), to find a single feature record specified feature information matches, or combinations thereof in the preset rules database server ; wherein the server pre-rule base and wherein the recording comprises recording characteristics corresponding to the security level, each record comprising a combination of individual features characteristic information or feature information;

[0190] 服务器端规则库中预置了数千条特征记录,其中,第一条特征记录中列出了某种病毒的Android安装包包名,第二条特征记录中列出了某个正常应用的Android安装包版本号及其数字签名的MD5值,第三条特征记录中列出了某个正常应用的Android安装包包名及其receiver特征,第四条特征记录中列出了某种木马的Android安装包包名、版本号及其ELF文件中的特定字符串,等等。 [0190] Server-side rules library of thousands of pre-recording feature, wherein the first feature record lists names Android bag mounting a virus, wherein the second record lists a normal Android version number of the package and install digitally signed MD5 value of the application, the third feature records listed in the name of Android installation bags and receiver characteristics of a normal application, listed in Article IV features some kind of record Android Trojan installation bags name, version number, and the ELF file specific string, and so on.

[0191] 关于安全等级的标识,即黑,白(安全)或者灰(未知,可疑)三种标识,可以进一步地表示为: [0191] For identity security level, i.e., black and white (safety) or gray (unknown suspect) three identification can be further expressed as:

[0192] 安全:该应用是一个正常的应用,没有任何威胁用户手机安全的行为; [0192] Safety: This application is a normal application, without any threats to the security of the user's mobile phone;

[0193] 危险:该应用存在安全风险,有可能该应用本身就是恶意软件;也有可能该应用本来是正规公司发布的正常软件,但是因为存在安全漏洞,导致用户的隐私、手机安全受到威胁; [0193] dangerous: there is a security risk this application, it is possible that the application itself is malware; it is also possible that the application could have been the regular company released a normal software, but because of a security vulnerability, causing the user's privacy, mobile security threats;

[0194] 谨慎:该应用是一个正常的应用,但是存在一些问题,例如会让用户不小心被扣费,或者有不友好的广告遭到投诉等;当发现这类应用之后,会提示用户谨慎使用并告知该应用可能的行为,但是由用户自行决定是否清除该应用; [0194] caution: This application is a normal application, but there are some problems, for example, will let users accidentally detained fee, or have been unfriendly advertising complaints; when you notice this type of application, the user will be prompted with caution use the application and inform the likely behavior, but the user's discretion whether to remove the application;

[0195] 木马:该应用是病毒、木马或者其他恶意软件,此处为了简单统称为木马,但并不表示该应用仅仅是木马。 [0195] Trojan: This application is a virus, Trojan horse or other malicious software, collectively referred to as Trojan horses here for simplicity, but it does not mean that the application is only Trojan.

[0196] 应当理解,云端与客户端之间的配合,可以由本领域技术人员根据本发明所揭示的内容进一步扩充、变换、增删而改善。 [0196] It should be appreciated that the engagement between the cloud and the client can be further expanded by one skilled in the art based on the contents disclosed in the present invention, conversion, deletions improved. 因而,以上揭示的内容不应理解为实现本发明的方法和装置的限制。 Accordingly, the above disclosure of realization should not be construed as limiting the method and apparatus of the present invention.

[0197] 经过测试,本发明相对于现有技术有了较宽广的应用范围和应用效果,以下略加阐述: [0197] After the test, the prior art with respect to the present invention has broader application scope effects, the following slightly set forth:

[0198] 由于本发明已经将Η00Κ框架做成了服务平台,以挂钩插件的方式为终端配置监控模块22,因此,其加载仅需依赖于相应的配置文件,管理高效且易于实现,对技术人员而言,一些简单的函数调用仅需编写配置文件即可实现挂钩插件的配置,Η00Κ重入、并发性能商。 [0198] Since the present invention has been made to the service platform Η00Κ frame, so as to insert the hook configuration monitoring module terminal 22, and therefore, it is only dependent on the respective load profile, and easy to implement efficient management of the art For some simple function call can be realized only write configuration file to configure the hook plugin, Η00Κ re-entry, concurrent performance business.

[0199] 采用宿主应用程序先后实现对监控模块22和目标应用程序的加载,继而借助监控模块22对目标应用程序的事件行为建立监控,可以实现对Java函数、Native函数的挂钩。 [0199] The host application has achieved load monitoring module 22 and the target application, and then by means of the monitoring module 22 of the target application event monitoring to establish behavior can be achieved hook function for Java, Native function.

[0200] 综上所述,本发明使得目标应用程序能够运行于沙箱运行环境中,并且能确保系统的安全。 [0200] In summary, the present invention makes it possible to run on the target application sandbox operating environment, and ensure the safety of the system.

[0201] 以上所述仅是本发明的部分实施方式,应当指出,对于本技术领域的普通技术人员来说,在不脱离本发明原理的前提下,还可以做出若干改进和润饰,这些改进和润饰也应视为本发明的保护范围。 [0201] The above are only part of the embodiment of the present invention, it should be noted that for those of ordinary skill in the art, in the present invention without departing from the principles of the premise, can make various improvements and modifications, such modifications and modifications should also be regarded as the protection scope of the present invention.

[0202] 简要地,本发明实施例公开了: [0202] Briefly, embodiments of the disclosed embodiment of the present invention:

[0203] A1、一种应用程序免Root运行控制方法,其特征在于,包括如下步骤:反射调用与宿主应用程序具有不同包名的作为该宿主应用程序附带资源的安装包,以加载该安装包所实现的目标应用程序;由宿主应用程序调用监控模块,对目标应用程序的活动进行监控; 当监控到目标应用程序需要调用未匹配的资源时,重定向相关调用指令的资源引用,以为该目标应用程序的运行提供正确资源。 [0203] A1, an application for Free Root operation control method comprising the steps of: a reflective call with the host application as the installation package having a host application associated resources different package name to load the installation package target application implemented; called by the host application monitoring module, the activities of the target application to be monitored; when the monitor to the target application needs to call unmatched resources, redirect the call instruction related resource references, that the target run the application to provide the right resources.

[0204] A2、根据Al所述的应用程序免Root运行控制方法,其特征在于,所述宿主应用程序的包名为目标应用程序的包名附加前缀而得。 [0204] A2, depending on the application of the Al-free Root operation control method, wherein the package name of the host application package name prefixed with the target application is obtained.

[0205] A3、根据Al所述的应用程序免Root运行控制方法,其特征在于,当目标应用程序进程调用参数涉及其包名时,进行包名转换,将该包名重定向到正确的资源。 [0205] A3, depending on the application of the Al-free Root operation control method, wherein, when the target process calls an application parameter which relates to the package name, package name for the conversion, the packet is redirected to the correct resource name .

[0206] A4、根据Al所述的应用程序免Root运行控制方法,其特征在于,监控到目标应用程序调用未匹配的所述安装包中的资源时,采用反射调用方式为相应的调用指令重定向到该安装包中的正确资源。 [0206] A4, depending on the application of the Al-free Root operation control method, wherein, when the installation package to monitor the target application calls a resource not matching, reflective called by a respective call instruction weight directed to the correct resources of the installation package.

[0207] A5、根据Al所述的应用程序免Root运行控制方法,其特征在于,所述宿主应用程序以所述安装包的配置文件向系统注册,注册前将配置文件中涉及的包名修改为宿主应用程序的包名。 [0207] A5, depending on the application of the Al-free Root operation control method, wherein the register to the host application installation package configuration file to the system, prior to the package name registered in the profile relates to modified is the package name of the host application.

[0208] A6、根据Al所述的应用程序免Root运行控制方法,其特征在于,采用反射调用加载目标应用程序时,通过对宿主应用程序的已安装资源的调用而满足目标应用程序的资源访问。 [0208] A6, depending on the application of the Al-free Root operation control method, wherein, when the resource access using reflection to invoke the target application is loaded, via a call to the host application installed resource satisfies the target application .

[0209] A7、根据Al所述的应用程序免Root运行控制方法,其特征在于,所述监控模块被注册为服务进程,以钩子函数关联目标应用程序活动进程的调用指令以实现对所述目标应用程序的活动监控。 [0209] A7, depending on the application of the Al-free Root operation control method, characterized in that the monitoring module is registered as a service process to the target application active call instruction process for the associated hook function to achieve the target activity monitoring applications.

[0210] A8、根据Al所述的应用程序免Root运行控制方法,其特征在于,所述未匹配的资源包括因目标应用程序未安装却被反射调用而导致的被认为错误访问的资源。 [0210] A8, depending on the application of the Al-free Root operation control method, wherein the resource includes a resource not matching error is considered accessed by the target application calls reflection was caused not installed.

[0211] A9、根据Al所述的应用程序免Root运行控制方法,其特征在于,所述未匹配的资源包括系统资源和该安装包中的资源。 [0211] A9, Al depending on the application of the Root-free operation control method, wherein the resources include not match the system resources and the resources in the installation package.

[0212] A10、根据Al所述的应用程序免Root运行控制方法,其特征在于,当监控到目标应用程序进行未经授权的访问时,向相关调用指令返回自定义数据。 [0212] A10, depending on the application of the Al-free Root operation control method, wherein, when the target applications to monitor unauthorized access, return custom data related to the call instruction.

[0213] All、根据Al所述的应用程序免Root运行控制方法,其特征在于,所述宿主程序的资源文件和/或动态库文件与所述目标应用安装包中的相应文件相同。 [0213] All, depending on the application of the Al-free Root operation control method, characterized in that the host program resource files and / or the appropriate file library dynamic application installation package the same target.

[0214] 另外,本发明实施例还公开了: [0214] Further, embodiments of the present invention further discloses:

[0215] B12、一种应用程序免Root运行控制装置,其特征在于,包括:调用单元,用于反射调用与宿主应用程序具有不同包名的作为该宿主应用程序附带资源的安装包,以加载该安装包所实现的目标应用程序;监控模块,被配置为由宿主应用程序调用,对目标应用程序的活动进行监控;处理单元,当监控到目标应用程序需要调用未匹配的资源时,重定向相关调用指令的资源引用,以为该目标应用程序的运行提供正确资源。 [0215] B12, an application for Free Root operation control device, characterized by comprising: a calling unit for mounting a package as the host application and associated resources of reflection to invoke the host application with a different package name to load the target application installation package implemented; monitoring module configured by the host application calls the activities of the target application to be monitored; processing unit, while monitoring the target application needs to call the resource is not matched, the redirection call instruction related resource references, that runs the target application to provide the right resources.

[0216] B13、根据B12所述的应用程序免Root运行控制方法,其特征在于,所述宿主应用程序的包名为目标应用程序的包名附加前缀而得。 [0216] B13, B12, depending on the application of the Root-free operation control method, wherein the package name of the host application package name prefixed with the target application is obtained.

[0217] B14、根据B12所述的应用程序免Root运行控制装置,其特征在于,当当目标应用程序进程调用参数涉及其包名时,进行包名转换,将该包名重定向到正确的资源。 When [0217] B14, B12, depending on the application of the Root-free operation of the control device, characterized in that that, when the target process calls an application parameter which relates to the package name, package name for the conversion, the packet is redirected to the correct resource name .

[0218] B15、根据B12所述的应用程序免Root运行控制装置,其特征在于,当监控到目标应用程序调用未匹配的所述安装包中的资源时,采用反射调用方式为相应的调用指令重定向到该安装包中的正确资源。 [0218] B15, B12, depending on the application of the Root-free operation of the control device, wherein, when the installation package to monitor the target application calls a resource not matching, the corresponding reflective invocation call instruction redirected to the correct resources of the installation package.

[0219] B16、根据B12所述的应用程序免Root运行控制装置,其特征在于,所述宿主应用程序以所述安装包的配置文件向系统注册,注册前将配置文件中涉及的包名修改为宿主应用程序的包名。 [0219] B16, B12, depending on the application of the Root-free operation of the control device, wherein said host application to register the installation package to the system configuration file, the configuration file according to the package name registered before modification is the package name of the host application.

[0220] B17、根据B12所述的应用程序免Root运行控制装置,其特征在于,采用反射调用加载目标应用程序时,通过对宿主应用程序的已安装资源的调用而满足目标应用程序的资源访问。 [0220] B17, B12, depending on the application of the Root-free operation of the control device, wherein, when the resource access using reflection to invoke the target application is loaded, via a call to the host application installed resource satisfies the target application .

[0221] B18、根据B12所述的应用程序免Root运行控制装置,其特征在于,所述监控模块被注册为服务进程,以钩子函数关联目标应用程序活动进程的调用指令以实现对所述目标应用程序的活动监控。 [0221] B18, B12, depending on the application of the Root-free operation of the control device, wherein the monitoring module is registered as a service process to the target application active call instruction process for the associated hook function to achieve the target activity monitoring applications.

[0222] B19、根据B12所述的应用程序免Root运行控制装置,其特征在于,所述未匹配的资源包括因目标应用程序未安装却被反射调用而导致的被认为错误访问的资源。 [0222] B19, B12, depending on the application of the Root-free operation of the control device, wherein said resource comprises a resource does not match the error is considered accessed by the target application calls reflection was caused not installed.

[0223] B20、根据B12所述的应用程序免Root运行控制装置,其特征在于,所述未匹配的资源包括系统资源和该安装包中的资源。 [0223] B20, B12, depending on the application of the Root-free operation of the control device, wherein the resource comprises unmatched system resources, and the resources of the installation package.

[0224] B21、根据B12所述的应用程序免Root运行控制装置,其特征在于,当监控到目标应用程序进行未经授权的访问时,向相关调用指令返回自定义数据。 [0224] B21, B12, depending on the application of the Root-free operation of the control device, wherein, when the target applications to monitor unauthorized access to the relevant call instruction to return custom data.

[0225] B22、根据B12所述的应用程序免Root运行控制装置,其特征在于,所述宿主程序的资源文件和/或动态库文件与所述目标应用安装包中的相应文件相同。 [0225] B22, B12, depending on the application of the Root-free operation of the control device, characterized in that the host program resource files and / or the appropriate file library dynamic application installation package the same target.

Claims (10)

  1. 1. 一种应用程序免Root运行控制方法,其特征在于,包括如下步骤: 反射调用与宿主应用程序具有不同包名的作为该宿主应用程序附带资源的安装包,W 加载该安装包所实现的目标应用程序; 由宿主应用程序调用监控模块,对目标应用程序的活动进行监控; 当监控到目标应用程序需要调用未匹配的资源时,重定向相关调用指令的资源引用, W为该目标应用程序的运行提供正确资源。 An application for Free Root operation control method comprising the steps of: mounting the reflector call packet as the host application associated resources having different package names with the host application, W loading the installation package achieved destination application; invoked by the host application monitoring module, the activities of the target application to be monitored; monitoring when the application needs to call the target resource does not match, the call instruction to redirect relevant resource references, W for the target application the run provided the correct resources.
  2. 2. 根据权利要求1所述的应用程序免Root运行控制方法,其特征在于,所述宿主应用程序的包名为目标应用程序的包名附加前缀而得。 The application according to claim 1 Free Root operation control method, wherein the package name of the host application package name prefixed with the target application is obtained.
  3. 3. 根据权利要求1所述的应用程序免Root运行控制方法,其特征在于,当目标应用程序进程调用参数涉及其包名时,进行包名转换,将该包名重定向到正确的资源。 3. The application according to claim 1 for Free Root operation control method, wherein, when the target process calls an application parameter which relates to the package name, package name for the conversion, the packet is redirected to the correct resource name.
  4. 4. 根据权利要求1所述的应用程序免Root运行控制方法,其特征在于,监控到目标应用程序调用未匹配的所述安装包中的资源时,采用反射调用方式为相应的调用指令重定向到该安装包中的正确资源。 The application according to claim 1 Free Root operation control method, wherein, when the installation package to monitor the target application calls a resource not matching, reflective called by a respective call instruction is redirected the resources to install the correct package.
  5. 5. 根据权利要求1所述的应用程序免Root运行控制方法,其特征在于,所述宿主应用程序W所述安装包的配置文件向系统注册,注册前将配置文件中涉及的包名修改为宿主应用程序的包名。 The application according to claim 1 Free Root operation control method, wherein said host application installation package of the W register with the system configuration file, package names registered before the profile is modified according to package name of the host application.
  6. 6. 根据权利要求1所述的应用程序免Root运行控制方法,其特征在于,采用反射调用加载目标应用程序时,通过对宿主应用程序的已安装资源的调用而满足目标应用程序的资源访问。 6. Application according to claim 1 for Free Root operation control method, characterized in that, when using reflection to invoke load the target application calls to the resource by the host application installed resource satisfies the target application access.
  7. 7. 根据权利要求1所述的应用程序免Root运行控制方法,其特征在于,所述监控模块被注册为服务进程,W钩子函数关联目标应用程序活动进程的调用指令W实现对所述目标应用程序的活动监控。 The application according to claim 1 Free Root operation control method, characterized in that the monitoring module is registered as a service process, the target application active call instruction process associated hook function W W achieved the target application activity monitoring program.
  8. 8. 根据权利要求1所述的应用程序免Root运行控制方法,其特征在于,所述未匹配的资源包括因目标应用程序未安装却被反射调用而导致的被认为错误访问的资源。 8. The application as claimed in claim 1 Free Root operation control method, wherein the resource includes a resource not matching error is considered accessed by the target application calls reflection was caused not installed.
  9. 9. 根据权利要求1所述的应用程序免Root运行控制方法,其特征在于,所述未匹配的资源包括系统资源和该安装包中的资源。 9. The application of claim 1 Free Root operation control method, wherein the non-matching resource including system resources and the resources of the installation package.
  10. 10. -种应用程序免Root运行控制装置,其特征在于,包括: 调用单元,用于反射调用与宿主应用程序具有不同包名的作为该宿主应用程序附带资源的安装包,W加载该安装包所实现的目标应用程序; 监控模块,被配置为由宿主应用程序调用,对目标应用程序的活动进行监控; 处理单元,当监控到目标应用程序需要调用未匹配的资源时,重定向相关调用指令的资源引用,W为该目标应用程序的运行提供正确资源。 10. - Root of apps Free running control apparatus characterized by comprising: a calling unit for mounting a package as the host application and associated resources of reflection to invoke the host application with a different package name, W loading the installation package destination application implemented; monitoring module configured by the host application calls the activities of the target application to be monitored; processing unit, while monitoring the target application needs to call resources not matching the relevant call redirection instruction resource references, run W for the target application to provide the right resources.
CN 201410712400 2014-11-28 2014-11-28 Free application execution control method and apparatus Root CN104462879B (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
CN 201410712400 CN104462879B (en) 2014-11-28 2014-11-28 Free application execution control method and apparatus Root

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
CN 201410712400 CN104462879B (en) 2014-11-28 2014-11-28 Free application execution control method and apparatus Root

Publications (2)

Publication Number Publication Date
CN104462879A true true CN104462879A (en) 2015-03-25
CN104462879B CN104462879B (en) 2018-04-17

Family

ID=52908906

Family Applications (1)

Application Number Title Priority Date Filing Date
CN 201410712400 CN104462879B (en) 2014-11-28 2014-11-28 Free application execution control method and apparatus Root

Country Status (1)

Country Link
CN (1) CN104462879B (en)

Cited By (7)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN105094922A (en) * 2015-08-17 2015-11-25 北京奇虎科技有限公司 Application installation-free operation control method and device
CN105843668A (en) * 2016-03-11 2016-08-10 北京奇虎科技有限公司 Derived process staying-resident method, derived program generating method and corresponding device
CN105893839A (en) * 2016-06-20 2016-08-24 北京奇虎科技有限公司 Agent processing method and device for broadcast of Android application
CN105915546A (en) * 2016-06-16 2016-08-31 北京奇虎科技有限公司 Traffic monitoring method and device of android application
CN106096396A (en) * 2016-06-16 2016-11-09 北京奇虎科技有限公司 Android application information hiding method and device
CN106096395A (en) * 2016-06-16 2016-11-09 北京奇虎科技有限公司 Android application protective treatment method and device
CN106096394A (en) * 2016-06-16 2016-11-09 北京奇虎科技有限公司 Android application advertisement blocking method and device

Citations (6)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN102231117A (en) * 2011-07-08 2011-11-02 盛乐信息技术(上海)有限公司 Software installment method and system for embedded platform
CN102855138A (en) * 2012-07-20 2013-01-02 腾讯科技(深圳)有限公司 Application program interface (API) intercepting method and device and mobile terminal
KR101284676B1 (en) * 2012-02-28 2013-08-23 건국대학교 산학협력단 Cryptography-based copy protection system and method for android apps
CN103324697A (en) * 2013-06-07 2013-09-25 北京掌汇天下科技有限公司 Method for removing copycatting applications in android application search and based on icon contrast
CN104021321A (en) * 2014-06-17 2014-09-03 北京奇虎科技有限公司 Reinforcing protection method and device for software installation package
US8887152B1 (en) * 2011-11-04 2014-11-11 Trend Micro, Inc. Android application virtual environment

Patent Citations (6)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN102231117A (en) * 2011-07-08 2011-11-02 盛乐信息技术(上海)有限公司 Software installment method and system for embedded platform
US8887152B1 (en) * 2011-11-04 2014-11-11 Trend Micro, Inc. Android application virtual environment
KR101284676B1 (en) * 2012-02-28 2013-08-23 건국대학교 산학협력단 Cryptography-based copy protection system and method for android apps
CN102855138A (en) * 2012-07-20 2013-01-02 腾讯科技(深圳)有限公司 Application program interface (API) intercepting method and device and mobile terminal
CN103324697A (en) * 2013-06-07 2013-09-25 北京掌汇天下科技有限公司 Method for removing copycatting applications in android application search and based on icon contrast
CN104021321A (en) * 2014-06-17 2014-09-03 北京奇虎科技有限公司 Reinforcing protection method and device for software installation package

Cited By (7)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN105094922A (en) * 2015-08-17 2015-11-25 北京奇虎科技有限公司 Application installation-free operation control method and device
CN105843668A (en) * 2016-03-11 2016-08-10 北京奇虎科技有限公司 Derived process staying-resident method, derived program generating method and corresponding device
CN105915546A (en) * 2016-06-16 2016-08-31 北京奇虎科技有限公司 Traffic monitoring method and device of android application
CN106096396A (en) * 2016-06-16 2016-11-09 北京奇虎科技有限公司 Android application information hiding method and device
CN106096395A (en) * 2016-06-16 2016-11-09 北京奇虎科技有限公司 Android application protective treatment method and device
CN106096394A (en) * 2016-06-16 2016-11-09 北京奇虎科技有限公司 Android application advertisement blocking method and device
CN105893839A (en) * 2016-06-20 2016-08-24 北京奇虎科技有限公司 Agent processing method and device for broadcast of Android application

Also Published As

Publication number Publication date Type
CN104462879B (en) 2018-04-17 grant

Similar Documents

Publication Publication Date Title
Shabtai et al. Google android: A comprehensive security assessment
Bugiel et al. Xmandroid: A new android evolution to mitigate privilege escalation attacks
Hallaraker et al. Detecting malicious javascript code in mozilla
Luo et al. Attacks on WebView in the Android system
US7743336B2 (en) Widget security
US7861303B2 (en) Malware scanning wireless service agent system and method
US6438600B1 (en) Securely sharing log-in credentials among trusted browser-based applications
US20020120854A1 (en) Systems and methods for preventing unauthorized use of digital content
US20130097660A1 (en) System and method for whitelisting applications in a mobile network environment
US20130091543A1 (en) System and method for creating secure applications
US20020144153A1 (en) Systems and methods for preventing unauthorized use of digital content
US20110246753A1 (en) Use of an application controller to monitor and control software file and application environments
US8769127B2 (en) Cross-domain solution (CDS) collaborate-access-browse (CAB) and assured file transfer (AFT)
US20110247074A1 (en) Metadata-based access, security, and compliance control of software generated files
US20100212010A1 (en) Systems and methods that detect sensitive data leakages from applications
US20130227683A1 (en) Quantifying the risks of applications for mobile devices
Jeon et al. Dr. Android and Mr. Hide: fine-grained permissions in android applications
US20090271844A1 (en) Safe and efficient access control mechanisms for computing environments
Bugiel et al. Practical and lightweight domain isolation on android
US20120117644A1 (en) System and Method for Internet Security
Xu et al. Aurasium: Practical Policy Enforcement for Android Applications.
US20130227636A1 (en) Off-device anti-malware protection for mobile devices
US20130283377A1 (en) Detection and prevention of installation of malicious mobile applications
US7085928B1 (en) System and method for defending against malicious software
US20060090192A1 (en) Method and system for ensuring that computer programs are trustworthy

Legal Events

Date Code Title Description
C06 Publication
GR01