CN112965749B - Request path acquisition method, device, computer equipment and storage medium - Google Patents
Request path acquisition method, device, computer equipment and storage medium Download PDFInfo
- Publication number
- CN112965749B CN112965749B CN202110142093.1A CN202110142093A CN112965749B CN 112965749 B CN112965749 B CN 112965749B CN 202110142093 A CN202110142093 A CN 202110142093A CN 112965749 B CN112965749 B CN 112965749B
- Authority
- CN
- China
- Prior art keywords
- request
- annotation
- file
- name
- identified
- Prior art date
- Legal status (The legal status 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 status listed.)
- Active
Links
Classifications
-
- G—PHYSICS
- G06—COMPUTING OR CALCULATING; COUNTING
- G06F—ELECTRIC DIGITAL DATA PROCESSING
- G06F8/00—Arrangements for software engineering
- G06F8/70—Software maintenance or management
- G06F8/75—Structural analysis for program understanding
-
- G—PHYSICS
- G06—COMPUTING OR CALCULATING; COUNTING
- G06F—ELECTRIC DIGITAL DATA PROCESSING
- G06F21/00—Security arrangements for protecting computers, components thereof, programs or data against unauthorised activity
- G06F21/50—Monitoring users, programs or devices to maintain the integrity of platforms, e.g. of processors, firmware or operating systems
- G06F21/57—Certifying or maintaining trusted computer platforms, e.g. secure boots or power-downs, version controls, system software checks, secure updates or assessing vulnerabilities
- G06F21/577—Assessing vulnerabilities and evaluating computer system security
-
- G—PHYSICS
- G06—COMPUTING OR CALCULATING; COUNTING
- G06F—ELECTRIC DIGITAL DATA PROCESSING
- G06F8/00—Arrangements for software engineering
- G06F8/70—Software maintenance or management
- G06F8/74—Reverse engineering; Extracting design information from source code
-
- G—PHYSICS
- G06—COMPUTING OR CALCULATING; COUNTING
- G06F—ELECTRIC DIGITAL DATA PROCESSING
- G06F2221/00—Indexing scheme relating to security arrangements for protecting computers, components thereof, programs or data against unauthorised activity
- G06F2221/03—Indexing scheme relating to G06F21/50, monitoring users, programs or devices to maintain the integrity of platforms
- G06F2221/033—Test or assess software
-
- Y—GENERAL TAGGING OF NEW TECHNOLOGICAL DEVELOPMENTS; GENERAL TAGGING OF CROSS-SECTIONAL TECHNOLOGIES SPANNING OVER SEVERAL SECTIONS OF THE IPC; TECHNICAL SUBJECTS COVERED BY FORMER USPC CROSS-REFERENCE ART COLLECTIONS [XRACs] AND DIGESTS
- Y02—TECHNOLOGIES OR APPLICATIONS FOR MITIGATION OR ADAPTATION AGAINST CLIMATE CHANGE
- Y02D—CLIMATE CHANGE MITIGATION TECHNOLOGIES IN INFORMATION AND COMMUNICATION TECHNOLOGIES [ICT], I.E. INFORMATION AND COMMUNICATION TECHNOLOGIES AIMING AT THE REDUCTION OF THEIR OWN ENERGY USE
- Y02D10/00—Energy efficient computing, e.g. low power processors, power management or thermal management
Landscapes
- Engineering & Computer Science (AREA)
- General Engineering & Computer Science (AREA)
- Software Systems (AREA)
- Theoretical Computer Science (AREA)
- Physics & Mathematics (AREA)
- General Physics & Mathematics (AREA)
- Computer Hardware Design (AREA)
- Computer Security & Cryptography (AREA)
- Computing Systems (AREA)
- Stored Programmes (AREA)
Abstract
Description
技术领域Technical field
本申请涉及java数据审计领域,特别是涉及一种请求路径方法、装置、计算机设备和存储介质。This application relates to the field of Java data auditing, and in particular to a request path method, device, computer equipment and storage medium.
背景技术Background technique
Web应用是互联网应用的重要形式,是金融、运营商、政府部门以及教育部门等社会关键信息系统的门户应用首选。随着各种各样的安全事件以及影响危害巨大的安全漏洞的公布,大家也越来越关注网站应用本身的安全,有越来越多的网站应用安全漏洞检测的需求。Java Web开发从1999年至今已经经历近20年历程,推出了Spring、Struts、Hibernate以及labtis等基于业务或者数据库的框架,里面有很多模具具有防护Java web应用遇到应用层漏洞的功能。但是由于开发人员安全意识的薄弱、开发人员的快速流动以及Java Web框架自身存在的漏洞,经常会由于参数被污染导致SQL注入、命令注入、文件上传或者业务层面逻辑方面的漏洞产生。针对Java Web的静态扫描工具很多,比如商用工具Fortify或者开源工具Findbugs。但是各种工具并不能获得更大的检验覆盖程度。这是由于审计工具一般采用自动化爬虫和人工手动点击,都只能根据交互页面上已有的请求地址进行扫描,而对于底层结构中Java包中隐含的请求地址,则难以获取。Web applications are an important form of Internet applications and are the first choice for portal applications for key social information systems such as finance, operators, government departments, and education departments. With the announcement of various security incidents and security vulnerabilities with huge consequences, everyone is paying more and more attention to the security of website applications themselves, and there is an increasing need for website application security vulnerability detection. Java Web development has gone through nearly 20 years since 1999. Business or database-based frameworks such as Spring, Struts, Hibernate, and labtis have been launched. Many of them have the function of protecting Java web applications from application layer vulnerabilities. However, due to the weak security awareness of developers, the rapid flow of developers, and the vulnerabilities of the Java Web framework itself, vulnerabilities in SQL injection, command injection, file upload, or business-level logic often occur due to parameter contamination. There are many static scanning tools for Java Web, such as the commercial tool Fortify or the open source tool Findbugs. However, various tools cannot achieve greater inspection coverage. This is because audit tools generally use automated crawlers and manual clicks, which can only scan based on the existing request addresses on the interactive page, and it is difficult to obtain the request addresses implicit in the Java package in the underlying structure.
相关技术中通过FileReader读取java文件的源代码,利用正则匹配的方法获取java文件中的指定字符段,进而获取请求路径;然而,由于指定字符段由审计人员指定,字符段的准确性与审计人员的水平相关,因此通过正则匹配的方法来获取请求路径的准确率较低,请求路径会存在误报的情况。In the related technology, the source code of the java file is read through FileReader, and the specified character segment in the java file is obtained using the regular matching method, and then the request path is obtained; however, since the specified character segment is specified by the auditor, the accuracy of the character segment is different from the audit The level of personnel is related, so the accuracy of obtaining the request path through the regular matching method is low, and the request path may have false positives.
目前针对相关技术中获取的请求路径的准确率较低的技术问题,尚未提出有效的解决方案。Currently, no effective solution has been proposed for the technical problem of low accuracy of the request path obtained in related technologies.
发明内容Contents of the invention
本申请实施例提供了一种请求路径获取方法、装置、计算机设备和存储介质,以至少解决相关技术中获取的请求路径的准确率较低的技术问题。Embodiments of the present application provide a request path obtaining method, device, computer equipment, and storage medium to at least solve the technical problem of low accuracy in obtaining request paths in related technologies.
第一方面,本申请实施例提供了一种请求路径获取方法,包括:In the first aspect, embodiments of the present application provide a method for obtaining a request path, including:
获取目标注解名称,所述目标注解名称至少包括控制器类注解名称,所述控制器类注解名称为请求接口类文件的标识;Obtain the target annotation name, the target annotation name at least includes the controller class annotation name, and the controller class annotation name is the identifier of the request interface class file;
获取原始文件并读取所述原始文件中的待识别注解名称;Obtain the original file and read the annotation name to be recognized in the original file;
将所述原始文件中的待识别注解名称与所述目标注解名称进行比对,若所述待识别注解名称与所述目标注解名称中存在至少一个相同注解名称,则将所述原始文件标记为目标文件;Compare the annotation name to be identified in the original file with the target annotation name. If there is at least one identical annotation name in the annotation name to be identified and the target annotation name, mark the original file as Target file;
读取所述目标文件中的注解内容,根据所述注解内容获取请求路径。Read the annotation content in the target file, and obtain the request path based on the annotation content.
在其中一个实施例中,所述获取原始文件包括:获取预设目录结构,所述预设目录结构包括SpringBoot框架的文件目录结构;获取初始文件并读取所述初始文件中的待识别目录结构;将所述待识别目录结构与所述预设目录结构进行比对,若所述待识别目录结构与所述预设目录结构一致,则将所述初始文件作为原始文件。In one embodiment, obtaining the original file includes: obtaining a preset directory structure, which includes the file directory structure of the SpringBoot framework; obtaining an initial file and reading the directory structure to be identified in the initial file. ; Compare the directory structure to be identified with the preset directory structure. If the directory structure to be identified is consistent with the preset directory structure, use the initial file as the original file.
在其中一个实施例中,所述读取所述原始文件中的待识别注解名称包括:基于双亲委派机制,通过类加载器将原始文件中的资源库数据载入虚拟机,使所述虚拟机根据所述资源库数据以及反射机制读取所述原始文件中的源代码文件,得到所述待识别注解名称;接收所述虚拟机发送的所述待识别注解名称。In one embodiment, reading the annotation name to be recognized in the original file includes: based on a parent delegation mechanism, loading the resource library data in the original file into the virtual machine through a class loader, so that the virtual machine Read the source code file in the original file according to the resource library data and the reflection mechanism to obtain the annotation name to be recognized; receive the annotation name to be recognized sent by the virtual machine.
在其中一个实施例中,所述根据所述注解内容获取请求路径之后包括:获取请求方式以及请求参数,所述请求参数包括赋值参数以及非赋值参数,所述赋值参数包括基本类型参数以及确定对象参数;若所述请求参数为非赋值参数,则根据所述请求路径和请求方式生成请求信息并发送。In one embodiment, obtaining the request path according to the annotation content includes: obtaining the request method and request parameters. The request parameters include assignment parameters and non-assignment parameters. The assignment parameters include basic type parameters and determination objects. Parameters; if the request parameter is a non-assigned parameter, the request information is generated and sent according to the request path and request method.
在其中一个实施例中,所述获取请求方式以及请求参数之后还包括:若所述请求参数为赋值参数,则判断所述请求参数是否为基本类型参数;若所述请求参数为基本类型参数,则根据所述注解内容对所述请求参数进行赋值;基于所述请求路径、所述请求方式以及赋值后的所述请求参数,生成请求信息并发送。In one embodiment, after obtaining the request method and the request parameters, the method further includes: if the request parameters are assignment parameters, determining whether the request parameters are basic type parameters; if the request parameters are basic type parameters, Then, the request parameter is assigned a value according to the annotation content; and the request information is generated and sent based on the request path, the request method, and the assigned request parameter.
在其中一个实施例中,所述获取请求方式以及请求参数之后还包括:若所述请求参数为赋值参数,则判断所述请求参数是否为确定对象参数,若所述请求参数为确定对象参数,则将所述确定对象参数解析为基本类型参数;根据所述注解内容对所述基本类型参数进行赋值;基于所述请求路径、所述请求方式以及赋值后的所述基本类型参数,生成请求信息并发送。In one embodiment, after obtaining the request method and request parameters, it also includes: if the request parameter is an assignment parameter, then determining whether the request parameter is a determined object parameter; if the request parameter is a determined object parameter, Then the determined object parameters are parsed into basic type parameters; the basic type parameters are assigned according to the annotation content; and request information is generated based on the request path, the request method and the assigned basic type parameters. and send.
在其中一个实施例中,所述控制器类注解名称至少包括@Controller和@RsetController。In one embodiment, the controller class annotation name includes at least @Controller and @RsetController.
第二方面,本申请实施例提供了一种请求路径获取装置,包括:In the second aspect, embodiments of the present application provide a device for obtaining a request path, including:
目标获取模块:用于获取目标注解名称,所述目标注解名称至少包括控制器类注解名称,所述控制器类注解名称为请求接口类文件的标识;Target acquisition module: used to obtain the target annotation name, the target annotation name at least includes the controller class annotation name, and the controller class annotation name is the identifier of the request interface class file;
注解获取模块:用于获取原始文件并读取所述原始文件中的待识别注解名称;Annotation acquisition module: used to obtain the original file and read the annotation name to be recognized in the original file;
识别模块:用于将所述原始文件中的待识别注解名称与所述目标注解名称进行比对,若所述待识别注解名称与所述目标注解名称中存在至少一个相同注解名称,则将所述原始文件标记为目标文件;Identification module: used to compare the name of the annotation to be identified in the original file with the name of the target annotation. If there is at least one identical annotation name in the name of the annotation to be identified and the name of the target annotation, then all The original file is marked as the target file;
路径获取模块:用于读取所述目标文件中的注解内容,根据所述注解内容获取请求路径。Path acquisition module: used to read the annotation content in the target file and obtain the request path according to the annotation content.
第三方面,本申请实施例提供了一种计算机设备,包括存储器、处理器以及存储在所述存储器上并可在所述处理器上运行的计算机程序,所述处理器执行所述计算机程序时实现如上述第一方面所述的请求路径获取方法。In a third aspect, embodiments of the present application provide a computer device, including a memory, a processor, and a computer program stored on the memory and executable on the processor. When the processor executes the computer program Implement the request path acquisition method as described in the first aspect above.
第四方面,本申请实施例提供了一种计算机可读存储介质,其上存储有计算机程序,该程序被处理器执行时实现如上述第一方面所述的请求路径获取方法。In a fourth aspect, embodiments of the present application provide a computer-readable storage medium on which a computer program is stored. When the program is executed by a processor, the request path acquisition method as described in the first aspect is implemented.
相比于相关技术,本申请实施例提供的请求路径获取方法、装置、计算机设备和存储介质,通过获取目标注解名称,所述目标注解名称至少包括控制器类注解名称,所述控制器类注解名称为请求接口类文件的标识;获取原始文件并读取所述原始文件中的待识别注解名称;将所述原始文件中的待识别注解名称与所述目标注解名称进行比对,若所述待识别注解名称与所述目标注解名称中存在至少一个相同注解名称,则将所述原始文件标记为目标文件;读取所述目标文件中的注解内容,根据所述注解内容获取请求路径。基于原始文件中的注解信息判断文件是否为请求接口类文件,并基于该接口类文件中的注解信息获取请求路径,解决了获取请求路径的准确率较低的问题,实现了准确获取请求路径的技术效果。Compared with related technologies, the request path acquisition method, device, computer device and storage medium provided by the embodiments of the present application obtain the target annotation name, and the target annotation name at least includes the controller class annotation name, and the controller class annotation name The name is the identifier of the request interface class file; obtain the original file and read the annotation name to be recognized in the original file; compare the annotation name to be recognized in the original file with the target annotation name, if If there is at least one identical annotation name between the annotation name to be recognized and the target annotation name, mark the original file as the target file; read the annotation content in the target file, and obtain the request path according to the annotation content. Based on the annotation information in the original file, it is determined whether the file is a request interface class file, and the request path is obtained based on the annotation information in the interface class file, which solves the problem of low accuracy in obtaining the request path and achieves accurate acquisition of the request path. technical effects.
本申请的一个或多个实施例的细节在以下附图和描述中提出,以使本申请的其他特征、目的和优点更加简明易懂。The details of one or more embodiments of the present application are set forth in the following drawings and description to make other features, objects, and advantages of the present application more concise and understandable.
附图说明Description of the drawings
此处所说明的附图用来提供对本申请的进一步理解,构成本申请的一部分,本申请的示意性实施例及其说明用于解释本申请,并不构成对本申请的不当限定。在附图中:The drawings described here are used to provide a further understanding of the present application and constitute a part of the present application. The illustrative embodiments of the present application and their descriptions are used to explain the present application and do not constitute an improper limitation of the present application. In the attached picture:
图1是根据本申请实施例的请求路径获取方法的流程图;Figure 1 is a flow chart of a request path acquisition method according to an embodiment of the present application;
图2是根据本申请另一实施例的请求路径获取方法的流程图;Figure 2 is a flow chart of a request path obtaining method according to another embodiment of the present application;
图3是根据本申请实施例的请求路径获取装置的结构框图;Figure 3 is a structural block diagram of a request path acquisition device according to an embodiment of the present application;
图4是根据本申请实施例的计算机设备的硬件结构示意图。Figure 4 is a schematic diagram of the hardware structure of a computer device according to an embodiment of the present application.
具体实施方式Detailed ways
为了使本申请的目的、技术方案及优点更加清楚明白,以下结合附图及实施例,对本申请进行描述和说明。应当理解,此处所描述的具体实施例仅仅用以解释本申请,并不用于限定本申请。基于本申请提供的实施例,本领域普通技术人员在没有作出创造性劳动的前提下所获得的所有其他实施例,都属于本申请保护的范围。In order to make the purpose, technical solutions and advantages of the present application clearer, the present application will be described and illustrated below in conjunction with the drawings and embodiments. It should be understood that the specific embodiments described here are only used to explain the present application and are not used to limit the present application. Based on the embodiments provided in this application, all other embodiments obtained by those of ordinary skill in the art without any creative work shall fall within the scope of protection of this application.
显而易见地,下面描述中的附图仅仅是本申请的一些示例或实施例,对于本领域的普通技术人员而言,在不付出创造性劳动的前提下,还可以根据这些附图将本申请应用于其他类似情景。此外,还可以理解的是,虽然这种开发过程中所作出的努力可能是复杂并且冗长的,然而对于与本申请公开的内容相关的本领域的普通技术人员而言,在本申请揭露的技术内容的基础上进行的一些设计,制造或者生产等变更只是常规的技术手段,不应当理解为本申请公开的内容不充分。Obviously, the drawings in the following description are only some examples or embodiments of the present application. For those of ordinary skill in the art, without exerting creative efforts, the present application can also be applied according to these drawings. Other similar scenarios. In addition, it will also be appreciated that, although such development efforts may be complex and lengthy, the technology disclosed in this application will be readily apparent to those of ordinary skill in the art relevant to the disclosure of this application. Some design, manufacturing or production changes based on the content are only conventional technical means and should not be understood as insufficient content disclosed in this application.
在本申请中提及“实施例”意味着,结合实施例描述的特定特征、结构或特性可以包含在本申请的至少一个实施例中。在说明书中的各个位置出现该短语并不一定均是指相同的实施例,也不是与其它实施例互斥的独立的或备选的实施例。本领域普通技术人员显式地和隐式地理解的是,本申请所描述的实施例在不冲突的情况下,可以与其它实施例相结合。Reference in this application to "an embodiment" means that a particular feature, structure or characteristic described in connection with the embodiment may be included in at least one embodiment of the application. The appearances of this phrase in various places in the specification are not necessarily all referring to the same embodiment, nor are separate or alternative embodiments mutually exclusive of other embodiments. It is explicitly and implicitly understood by those of ordinary skill in the art that the embodiments described in this application may be combined with other embodiments without conflict.
除非另作定义,本申请所涉及的技术术语或者科学术语应当为本申请所属技术领域内具有一般技能的人士所理解的通常意义。本申请所涉及的“一”、“一个”、“一种”、“该”等类似词语并不表示数量限制,可表示单数或复数。本申请所涉及的术语“包括”、“包含”、“具有”以及它们任何变形,意图在于覆盖不排他的包含;例如包含了一系列步骤或模块(单元)的过程、方法、系统、产品或设备没有限定于已列出的步骤或单元,而是可以还包括没有列出的步骤或单元,或可以还包括对于这些过程、方法、产品或设备固有的其它步骤或单元。本申请所涉及的“连接”、“相连”、“耦接”等类似的词语并非限定于物理的或者机械的连接,而是可以包括电气的连接,不管是直接的还是间接的。本申请所涉及的“多个”是指两个或两个以上。“和/或”描述关联对象的关联关系,表示可以存在三种关系,例如,“A和/或B”可以表示:单独存在A,同时存在A和B,单独存在B这三种情况。字符“/”一般表示前后关联对象是一种“或”的关系。本申请所涉及的术语“第一”、“第二”、“第三”等仅仅是区别类似的对象,不代表针对对象的特定排序。Unless otherwise defined, the technical terms or scientific terms involved in this application shall have the usual meanings understood by those with ordinary skills in the technical field to which this application belongs. "A", "an", "a", "the" and other similar words used in this application do not indicate a quantitative limit and may indicate singular or plural numbers. The terms "include", "comprises", "having" and any variations thereof involved in this application are intended to cover non-exclusive inclusion; for example, a process, method, system, product or product that includes a series of steps or modules (units). The equipment is not limited to the listed steps or units, but may also include steps or units that are not listed, or may further include other steps or units inherent to these processes, methods, products or equipment. Words such as "connected", "connected", "coupled" and the like mentioned in this application are not limited to physical or mechanical connections, but may include electrical connections, whether direct or indirect. The "plurality" mentioned in this application refers to two or more than two. "And/or" describes the relationship between related objects, indicating that three relationships can exist. For example, "A and/or B" can mean: A alone exists, A and B exist simultaneously, and B exists alone. The character "/" generally indicates that the related objects are in an "or" relationship. The terms “first”, “second”, “third”, etc. used in this application are only used to distinguish similar objects and do not represent a specific ordering of the objects.
由于开发人员安全意识的薄弱,开发人员的快速流动以及Java Web框架自身存在的漏洞,经常会由于参数被污染导致各类Web安全漏洞产生。Web应用的安全不可轻视。随着Web应用的组件技术和支撑手段不断丰富变化,互联网安全下的Web应用所暴露出的安全层面的问题也是层见叠出。黑客通过对暴露在公网上或者未经授权可直接连接的内网环境下的Web应用或者服务器进行漏洞攻击,可以获得该Web应用的后台管理员权限或者该Web应用所在的服务器系统权限,一方面可以直接获得该Web应用或者服务器上的敏感文件和敏感数据等信息,另一方面也可以将该服务器作为跳板,对该服务器所在内网网段进行渗透,可以攻击内网网段中其他的服务器或者其他更多的智能设备,获得大量的内网敏感信息,获得服务器权限等。在对Web应用源码进行白盒审计的时候各种审计工具并不能实现较高的代码覆盖率,这是因为许多接口地址不一定会显示在页面上或者直接开放供用户使用,审计工具一般采用自动化爬虫和人工手动点击对交互界面上已有的链接进行扫描,而在进行审计时,要遍历全部请求地址还需要获取许多隐藏的接口地址以及用户无法交互到的接口地址。此外,采用分析工具进行审计,生成的分析结果还可能存在误判或漏判的问题。在另一种解决方案中,安全人员在源代码审计的过程中手工获得所有的请求地址,需要付出很大的人力成本和时间成本,审计效率大为降低。因此,目前亟需一种准确获取请求路径以解决白盒审计中代码覆盖率不足的问题。Due to the weak security awareness of developers, the rapid flow of developers, and the vulnerabilities of the Java Web framework itself, various Web security vulnerabilities often occur due to parameter contamination. The security of web applications cannot be taken lightly. As the component technologies and support methods of Web applications continue to enrich and change, security issues exposed by Web applications under Internet security are also emerging one after another. By conducting vulnerability attacks on web applications or servers exposed on the public network or in an intranet environment that can be directly connected without authorization, hackers can obtain the background administrator permissions of the web application or the system permissions of the server where the web application is located. On the one hand, You can directly obtain information such as sensitive files and sensitive data on the web application or server. On the other hand, you can also use the server as a springboard to penetrate the intranet segment where the server is located and attack other servers in the intranet segment. Or more smart devices, obtain a large amount of sensitive information on the intranet, obtain server permissions, etc. When conducting white-box audits of Web application source code, various audit tools cannot achieve high code coverage. This is because many interface addresses may not be displayed on the page or directly open for users to use. Audit tools generally use automation. Crawlers and manual clicks scan existing links on the interactive interface. When conducting audits, traversing all request addresses requires obtaining many hidden interface addresses and interface addresses that users cannot interact with. In addition, when analysis tools are used for auditing, the analysis results generated may also contain misjudgments or omissions. In another solution, security personnel manually obtain all request addresses during the source code audit process, which requires a lot of labor and time costs, and the audit efficiency is greatly reduced. Therefore, there is an urgent need to accurately obtain the request path to solve the problem of insufficient code coverage in white-box auditing.
本实施例还提供了一种请求路径获取方法。图1是根据本申请实施例的请求路径获取方法的流程图,如图所示,该流程包括如下步骤:This embodiment also provides a method for obtaining a request path. Figure 1 is a flow chart of a method for obtaining a request path according to an embodiment of the present application. As shown in the figure, the process includes the following steps:
步骤S101,获取目标注解名称,所述目标注解名称至少包括控制器类注解名称,所述控制器类注解名称为请求接口类文件的标识。Step S101: Obtain the target annotation name. The target annotation name at least includes the controller class annotation name. The controller class annotation name is the identifier of the requested interface class file.
具体的,目标注解名称为控制器类注解名称,包括但不限于@Controller和@RsetController。存在控制器类注解名称的文件属于请求接口类文件,基于SpringBoot框架的特性,拥有该类注解的文件中会存在请求接口地址,并且能够被程序解析。不包括该类注解的文件则不会存在请求接口地址,也无法被解析。注解也叫元数据,是一种代码级别的说明,与类、接口以及枚举在同一个层次。注解可以设置在包、类、字段、方法、局部变量以及方法参数等的前面,用来对这些元素进行说明和注释。注解的作用包括:编写文档,即通过代码里标识的元数据生成文档;代码分析,即通过代码里标识的元数据对代码进行分析;编译检查,即通过代码里标识的元数据让编译器能够实现基本的编译检查。Specifically, the target annotation name is the controller class annotation name, including but not limited to @Controller and @RsetController. Files with controller class annotation names are request interface class files. Based on the characteristics of the SpringBoot framework, files with this type of annotation will have request interface addresses and can be parsed by the program. Files that do not include this type of annotation will not have a request interface address and cannot be parsed. Annotations, also called metadata, are code-level descriptions at the same level as classes, interfaces, and enumerations. Annotations can be set in front of packages, classes, fields, methods, local variables, method parameters, etc. to explain and annotate these elements. The functions of annotations include: writing documents, that is, generating documents through the metadata identified in the code; code analysis, that is, analyzing the code through the metadata identified in the code; compilation checking, that is, using the metadata identified in the code to enable the compiler to Implement basic compilation checks.
在其中一个实施例中,所述获取原始文件包括:获取预设目录结构,所述预设目录结构包括SpringBoot框架的文件目录结构;获取初始文件并读取所述初始文件中的待识别目录结构;将所述待识别目录结构与所述预设目录结构进行比对,若所述待识别目录结构与所述预设目录结构一致,则将所述初始文件作为原始文件。具体的,通过获取文件格式,读取指定的.jar格式的文件,即Java文件包。该Java文件包即初始文件。读取该Java文件包,识别其文件结构是否符合SpringBoot框架的打包文件结构,若符合,则将该Java文件包作为原始文件。打包文件结构即预设目录。在其中一个实施例,预设目录为:In one embodiment, obtaining the original file includes: obtaining a preset directory structure, which includes the file directory structure of the SpringBoot framework; obtaining an initial file and reading the directory structure to be identified in the initial file. ; Compare the directory structure to be identified with the preset directory structure. If the directory structure to be identified is consistent with the preset directory structure, use the initial file as the original file. Specifically, by obtaining the file format, the specified .jar format file is read, that is, the Java file package. The Java file package is the initial file. Read the Java file package and identify whether its file structure conforms to the packaging file structure of the SpringBoot framework. If so, use the Java file package as the original file. The packaging file structure is the default directory. In one embodiment, the default directory is:
|--BOOT-INF|--BOOT-INF
|--classes|--classes
|--lib|--lib
|--META-INF|--META-INF
步骤S102,获取原始文件并读取所述原始文件中的待识别注解名称。Step S102: Obtain the original file and read the annotation name to be recognized in the original file.
在其中一个实施例中,所述读取所述原始文件中的待识别注解名称包括:基于双亲委派机制,通过类加载器将原始文件中的资源库数据载入虚拟机,使所述虚拟机根据所述资源库数据以及反射机制读取所述原始文件中的源代码文件,得到所述待识别注解名称;接收所述虚拟机发送的所述待识别注解名称。具体的,双亲委派机制属于Java编程语言的底层机制,是指当一个类加载器收到一个类加载请求时,该类加载器首先会把请求委派给父类加载器。每个类加载器都是如此。只有父类加载器在自己的搜索范围内找不到指定类时,子类加载器才会尝试自己去加载。Java反射机制为Java本身的特性。Java的反射机制是指在程序的运行状态中,可以构造任意一个类的对象,可以了解任意一个对象所属的类,可以了解任意一个类的成员变量和方法,可以调用任意一个对象的属性和方法。这种动态获取程序信息以及动态调用对象的功能成为Java语言的反射机制。反射被视为动态语言的关键。反射可通过getAnnotation等函数实现。在读取Java包中的注解名称时,读取Java包的lib目录下的所有jar,通过classloader类加载器载入JVM,即Java虚拟机。jar是指Java文件包中所引用的Java资源库。Java程序在运行时需要获取主要程序代码以及外部引用的Java资源库,主要程序代码即源代码,外部引用的Java资源库在Java软件发布时会以jar包的形式存放在lib目录下。虚拟机通过反射机制读取所有的源代码文件,获取源代码文件中的注解名称。In one embodiment, reading the annotation name to be recognized in the original file includes: based on a parent delegation mechanism, loading the resource library data in the original file into the virtual machine through a class loader, so that the virtual machine Read the source code file in the original file according to the resource library data and the reflection mechanism to obtain the annotation name to be recognized; receive the annotation name to be recognized sent by the virtual machine. Specifically, the parent delegation mechanism belongs to the underlying mechanism of the Java programming language. It means that when a class loader receives a class loading request, the class loader will first delegate the request to the parent class loader. This is true for every class loader. Only when the parent class loader cannot find the specified class within its search range, the child class loader will try to load it by itself. The Java reflection mechanism is a feature of Java itself. Java's reflection mechanism means that in the running state of the program, you can construct objects of any class, you can understand the class to which any object belongs, you can understand the member variables and methods of any class, and you can call the properties and methods of any object. . This function of dynamically obtaining program information and dynamically calling objects has become the reflection mechanism of the Java language. Reflection is seen as the key to dynamic languages. Reflection can be implemented through functions such as getAnnotation. When reading the annotation name in the Java package, read all the jars in the lib directory of the Java package and load the JVM, that is, the Java virtual machine, through the classloader class loader. jar refers to the Java resource library referenced in the Java file package. When a Java program is running, it needs to obtain the main program code and the externally referenced Java resource library. The main program code is the source code. The externally referenced Java resource library will be stored in the lib directory in the form of a jar package when the Java software is released. The virtual machine reads all source code files through the reflection mechanism and obtains the annotation names in the source code files.
步骤S103,将所述原始文件中的待识别注解名称与所述目标注解名称进行比对,若所述待识别注解名称与所述目标注解名称中存在至少一个相同注解名称,则将所述原始文件标记为目标文件。Step S103: Compare the annotation name to be identified in the original file with the target annotation name. If there is at least one identical annotation name in the annotation name to be identified and the target annotation name, then compare the original The file is marked as a target file.
在其中一个实施例中,识别所述源代码文件中是否包括至少一个控制器类注解,若存在,则将源代码文件标记为目标文件。优选的,通过反射机制读取所有源代码文件,将存在控制器类注解名称的文件标记为目标文件。In one embodiment, it is identified whether the source code file includes at least one controller class annotation, and if present, the source code file is marked as a target file. Preferably, all source code files are read through a reflection mechanism, and files with controller class annotation names are marked as target files.
步骤S104,读取所述目标文件中的注解内容,根据所述注解内容获取请求路径。Step S104: Read the annotation content in the target file, and obtain the request path according to the annotation content.
具体的,读取目标文件中的RestMapping、@GetMapping以及@PostMapping等注解内容,根据注解内容获取URL路径。URL即是请求路径,但URL路径中不包括请求参数。URL是统一资源定位符,是互联网上标准资源的地址。而互联网上的每个文件都有唯一的一个URL,其包含的信息指出文件的位置以及浏览器应该怎么处理该文件。基本的URL包含:协议、IP地址、路径以及文件名。Specifically, the annotation content such as RestMapping, @GetMapping, and @PostMapping in the target file is read, and the URL path is obtained based on the annotation content. The URL is the request path, but the URL path does not include request parameters. URL is a Uniform Resource Locator, which is the address of a standard resource on the Internet. Every file on the Internet has a unique URL, which contains information indicating the location of the file and how the browser should handle the file. The basic URL includes: protocol, IP address, path and file name.
所述根据所述注解内容获取请求路径之后包括:获取请求方式以及请求参数,所述请求参数包括赋值参数以及非赋值参数,所述赋值参数包括基本类型参数以及确定对象参数;若所述请求参数为非赋值参数,则根据所述请求路径和请求方式生成请求信息并发送。具体的,还可通过解析目标文件中的Java代码获取请求方式,如post方式和get方式等。此外还可通过解析Java代码中的函数获取请求参数,根据请求参数获取参数类型。若参数类型为HttpServletRequest或HttpServletPesponse,则与之对应的请求参数为非赋值参数,表示该请求无需对请求参数赋值。根据之前获取的请求路径以及请求参数,生成对应的http请求。通过httprequest来发送对应的http请求。After obtaining the request path according to the annotation content, it includes: obtaining the request method and request parameters. The request parameters include assignment parameters and non-assignment parameters. The assignment parameters include basic type parameters and determined object parameters; if the request parameters If it is a non-assignment parameter, the request information will be generated and sent according to the request path and request method. Specifically, the request method, such as post method and get method, can also be obtained by parsing the Java code in the target file. In addition, the request parameters can be obtained by parsing the function in the Java code, and the parameter type can be obtained according to the request parameters. If the parameter type is HttpServletRequest or HttpServletPesponse, the corresponding request parameter is a non-assignment parameter, which means that the request does not need to assign a value to the request parameter. Generate the corresponding http request based on the previously obtained request path and request parameters. Send the corresponding http request through httprequest.
在其中一个实施例中,所述获取请求方式以及请求参数之后还包括:若所述请求参数为赋值参数,则判断所述请求参数是否为基本类型参数;若所述请求参数为基本类型参数,则根据所述注解内容对所述请求参数进行赋值;基于所述请求路径、所述请求方式以及赋值后的所述请求参数,生成请求信息并发送。具体的,若请求参数的参数类型为String、Int、Integeter、long、Long、Date、String[]以及boolean等Java编程中的基本参数类型,则根据注解内容对请求参数进行赋值,根据请求路径、请求方式以及赋值后的请求参数,生成对应的http请求。通过httprequest来发送对应的http请求。例如,在如下程序代码中:In one embodiment, after obtaining the request method and the request parameters, the method further includes: if the request parameters are assignment parameters, determining whether the request parameters are basic type parameters; if the request parameters are basic type parameters, Then, the request parameter is assigned a value according to the annotation content; and the request information is generated and sent based on the request path, the request method, and the assigned request parameter. Specifically, if the parameter type of the request parameter is the basic parameter type in Java programming such as String, Int, Integeter, long, Long, Date, String[], and boolean, the request parameter will be assigned a value according to the annotation content, and the value will be assigned according to the request path, The request method and the assigned request parameters generate the corresponding http request. Send the corresponding http request through httprequest. For example, in the following program code:
在以上代码中,@GetMapping为注解名称,(value=”/{id})为注解内容,其中value为将要对参数id赋予的值。由getCpe(@PathVariable int id,String token)可知,int和String都为基础参数,将value的值赋予id,即完成了对参数id的赋值,例如value=0001,则根据以上程序,赋值之后的结果为参数id=0001。In the above code, @GetMapping is the annotation name, (value="/{id}) is the annotation content, where value is the value to be assigned to the parameter id. As can be seen from getCpe(@PathVariable int id,String token), int and String is a basic parameter. Assigning the value of value to id completes the assignment of parameter id. For example, value=0001, then according to the above procedure, the result after assignment is parameter id=0001.
在其中一个实施例中,所述获取请求方式以及请求参数之后还包括:若所述请求参数为赋值参数,则判断所述请求参数是否为确定对象参数,若所述请求参数为确定对象参数,则将所述确定对象参数解析为基本类型参数;根据所述注解内容对所述基本类型参数进行赋值;基于所述请求路径、所述请求方式以及赋值后的所述基本类型参数,生成请求信息并发送。具体的,若请求参数的参数类型为确定对象参数,则继续对该确定对象参数进行解析,直至所有请求参数的参数类型均为String、Int、Integeter、long、Long、Date、String[]以及boolean等Java编程中的基本参数类型为止。其中,确定对象参数表示该源代码文件中的类继承自Object类。例如:确定对象参数A中包含确定对象参数A1和A2,还包括若干基本类型参数B1、B2…Bn,则继续对A1和A2进行解析,直至所有参数都为基本类型参数,所有参数的参数类型都为基本类型参数为止。In one embodiment, after obtaining the request method and request parameters, it also includes: if the request parameter is an assignment parameter, then determining whether the request parameter is a determined object parameter; if the request parameter is a determined object parameter, Then the determined object parameters are parsed into basic type parameters; the basic type parameters are assigned according to the annotation content; and request information is generated based on the request path, the request method and the assigned basic type parameters. and send. Specifically, if the parameter type of the request parameter is a certain object parameter, continue to parse the certain object parameter until the parameter types of all request parameters are String, Int, Integeter, long, Long, Date, String[] and boolean Until the basic parameter types in Java programming. Among them, determining the object parameter indicates that the class in the source code file inherits from the Object class. For example: the determined object parameter A contains determined object parameters A1 and A2, and also includes several basic type parameters B1, B2...Bn, then continue to parse A1 and A2 until all parameters are basic type parameters, and the parameter types of all parameters All are basic type parameters.
在其中一个实施例中,所述控制器类注解名称至少包括@Controller和@RsetController。In one embodiment, the controller class annotation name includes at least @Controller and @RsetController.
在其中一个实施例中,图2是根据本申请另一实施例的请求路径获取方法的流程图,如图2所示,首先获取原始文件,原始文件为.jar格式的Java文件包。判断原始文件包的文件目录结构是否符合SpringBoot框架的文件目录结构;若符合,则通过classloader载入原始文件中lib目录下的所有jar包,若加载成功,则读取jar包,通过反射机制获取原始文件中的注解信息,将原始文件中所有包括@Controller和@RsetController的源文件标记为路由文件,路由文件即是目标文件。根据注解内容获取路由文件的请求路径。通过读取源文件,获取请求方式和请求参数。对请求参数进行解析,根据请求参数的参数类型确定是否对请求参数赋值。最后根据请求路径、请求方式以及请求参数生成http请求,利用httprequest发送请求。本实施例可以对所有基于SpringBoot框架开发的Web程序进行请求路径遍历,并且在httprequest中还可以配置对应的参数以实现转发和代理的效果。优选的,还可将本实施例的请求获取方法与多种扫描攻击结合,提高安全测试人员的工作效率和代码测试的覆盖率。In one embodiment, Figure 2 is a flow chart of a method for obtaining a request path according to another embodiment of the present application. As shown in Figure 2, the original file is first obtained, and the original file is a Java file package in .jar format. Determine whether the file directory structure of the original file package conforms to the file directory structure of the SpringBoot framework; if it matches, load all the jar packages in the lib directory of the original file through the classloader. If the loading is successful, read the jar package and obtain it through the reflection mechanism. The annotation information in the original file marks all source files including @Controller and @RsetController in the original file as routing files, and the routing file is the target file. Obtain the request path of the routing file based on the annotation content. Obtain the request method and request parameters by reading the source file. Parse the request parameters and determine whether to assign values to the request parameters based on their parameter types. Finally, an http request is generated based on the request path, request method and request parameters, and httprequest is used to send the request. This embodiment can traverse request paths for all Web programs developed based on the SpringBoot framework, and can also configure corresponding parameters in httprequest to achieve forwarding and proxy effects. Preferably, the request acquisition method of this embodiment can also be combined with a variety of scanning attacks to improve the work efficiency of security testers and the coverage of code testing.
通过上述步骤,本申请基于双亲委派机制,载入classloader类加载器来加载jar包中的内容,直接通过Java语言的反射机制获取到类对象并进行进一步的解析,无需再次对源文件进行反编译。并且,通过反射的方式直接获取源文件中的注解信息,通过解析注解内容中的参数来直接获取请求路径,与相关技术中通过正则匹配获取请求路径的方法相比,可以更加准确的获取请求路径。此外,若获取到的请求参数为已知对象,还进一步进行递归解析,最终根据请求路径、请求方式以及请求参数生成带有参数或无参数的http请求直接发送,辅助审计工具进行白盒审计,极大提高了白盒审计的代码覆盖率以及审计效率。Through the above steps, this application loads the classloader class loader to load the contents of the jar package based on the parent delegation mechanism, and directly obtains the class object through the reflection mechanism of the Java language and performs further analysis without the need to decompile the source file again. . Moreover, the annotation information in the source file is directly obtained through reflection, and the request path is directly obtained by parsing the parameters in the annotation content. Compared with the method of obtaining the request path through regular matching in related technologies, the request path can be obtained more accurately. . In addition, if the obtained request parameters are known objects, further recursive analysis is performed, and finally an http request with or without parameters is generated and sent directly based on the request path, request method and request parameters, and the auxiliary audit tool performs white-box auditing. Greatly improves the code coverage and audit efficiency of white-box auditing.
需要说明的是,在上述流程中或者附图的流程图中示出的步骤可以在诸如一组计算机可执行指令的计算机系统中执行,并且,虽然在流程图中示出了逻辑顺序,但是在某些情况下,可以以不同于此处的顺序执行所示出或描述的步骤。It should be noted that the steps shown in the above process or the flow chart of the accompanying drawings can be executed in a computer system such as a set of computer-executable instructions, and although a logical sequence is shown in the flow chart, in the In some cases, the steps shown or described may be performed in a different order than here.
本实施例还提供了一种请求路径获取装置,该装置用于实现上述实施例及优选实施方式,已经进行过说明的不再赘述。如以下所使用的,术语“模块”、“单元”、“子单元”等可以实现预定功能的软件和/或硬件的组合。尽管以下实施例所描述的装置较佳地以软件来实现,但是硬件,或者软件和硬件的组合的实现也是可能并被构想的。This embodiment also provides a request path acquisition device, which is used to implement the above embodiments and preferred implementations. What has been described will not be described again. As used below, the terms "module", "unit", "sub-unit", etc. may be a combination of software and/or hardware that implements a predetermined function. Although the apparatus described in the following embodiments is preferably implemented in software, implementation in hardware, or a combination of software and hardware, is also possible and contemplated.
图3是根据本申请实施例的请求路径获取装置的结构框图,如图3所示,该装置包括:Figure 3 is a structural block diagram of a request path acquisition device according to an embodiment of the present application. As shown in Figure 3, the device includes:
目标获取模块10:用于获取目标注解名称,所述目标注解名称至少包括控制器类注解名称,所述控制器类注解名称为请求接口类文件的标识。Target acquisition module 10: used to acquire the target annotation name, the target annotation name at least includes the controller class annotation name, and the controller class annotation name is the identifier of the requested interface class file.
注解获取模块20:用于获取原始文件并读取所述原始文件中的待识别注解名称。Annotation acquisition module 20: used to obtain the original file and read the name of the annotation to be recognized in the original file.
识别模块30:用于将所述原始文件中的待识别注解名称与所述目标注解名称进行比对,若所述待识别注解名称与所述目标注解名称中存在至少一个相同注解名称,则将所述原始文件标记为目标文件。Identification module 30: used to compare the annotation name to be identified in the original file with the target annotation name. If there is at least one identical annotation name in the annotation name to be identified and the target annotation name, then The original file is marked as the target file.
路径获取模块40:用于读取所述目标文件中的注解内容,根据所述注解内容获取请求路径。Path acquisition module 40: used to read the annotation content in the target file and obtain the request path according to the annotation content.
目标获取模块10,还用于获取预设目录结构,所述预设目录结构包括SpringBoot框架的文件目录结构;获取初始文件并读取所述初始文件中的待识别目录结构;将所述待识别目录结构与所述预设目录结构进行比对,若所述待识别目录结构与所述预设目录结构一致,则将所述初始文件作为原始文件。The target acquisition module 10 is also used to obtain the preset directory structure, which includes the file directory structure of the SpringBoot framework; obtain the initial file and read the directory structure to be identified in the initial file; The directory structure is compared with the preset directory structure. If the directory structure to be identified is consistent with the preset directory structure, the initial file is used as the original file.
注解获取模块20,还用于基于双亲委派机制,通过类加载器将原始文件中的资源库数据载入虚拟机,使所述虚拟机根据所述资源库数据以及反射机制读取所述原始文件中的源代码文件,得到所述待识别注解名称;接收所述虚拟机发送的所述待识别注解名称。The annotation acquisition module 20 is also used to load the resource library data in the original file into the virtual machine through the class loader based on the parent delegation mechanism, so that the virtual machine reads the original file according to the resource library data and the reflection mechanism. source code file in the source code file to obtain the annotation name to be recognized; and receive the annotation name to be recognized sent by the virtual machine.
路径获取模块40,还用于获取请求方式以及请求参数,所述请求参数包括赋值参数以及非赋值参数,所述赋值参数包括基本类型参数以及确定对象参数;若所述请求参数为非赋值参数,则根据所述请求路径和请求方式生成请求信息并发送。The path acquisition module 40 is also used to obtain the request method and request parameters. The request parameters include assignment parameters and non-assignment parameters. The assignment parameters include basic type parameters and determined object parameters; if the request parameters are non-assignment parameters, Then the request information is generated and sent according to the request path and request method.
路径获取模块40,还用于若所述请求参数为赋值参数,则判断所述请求参数是否为基本类型参数;若所述请求参数为基本类型参数,则根据所述注解内容对所述请求参数进行赋值;基于所述请求路径、所述请求方式以及赋值后的所述请求参数,生成请求信息并发送。The path acquisition module 40 is also used to determine whether the request parameter is a basic type parameter if the request parameter is an assignment parameter; if the request parameter is a basic type parameter, to determine whether the request parameter is a basic type parameter according to the annotation content. Perform assignment; generate and send request information based on the request path, the request method, and the assigned request parameters.
路径获取模块40,还用于若所述请求参数为赋值参数,则判断所述请求参数是否为确定对象参数,若所述请求参数为确定对象参数,则将所述确定对象参数解析为基本类型参数;根据所述注解内容对所述基本类型参数进行赋值;基于所述请求路径、所述请求方式以及赋值后的所述基本类型参数,生成请求信息并发送。The path acquisition module 40 is also configured to determine whether the request parameter is a determined object parameter if the request parameter is an assignment parameter, and to parse the determined object parameter into a basic type if the request parameter is a determined object parameter. Parameters; assign values to the basic type parameters according to the annotation content; generate and send request information based on the request path, the request method and the assigned basic type parameters.
目标获取模块10,还用于获取控制器类注解名称,所述控制器类注解名称至少包括@Controller和@RsetController。The target acquisition module 10 is also used to obtain the controller class annotation name, which at least includes @Controller and @RsetController.
需要说明的是,上述各个模块可以是功能模块也可以是程序模块,既可以通过软件来实现,也可以通过硬件来实现。对于通过硬件来实现的模块而言,上述各个模块可以位于同一处理器中;或者上述各个模块还可以按照任意组合的形式分别位于不同的处理器中。It should be noted that each of the above modules can be a functional module or a program module, and can be implemented by software or hardware. For modules implemented by hardware, each of the above-mentioned modules can be located in the same processor; or each of the above-mentioned modules can also be located in different processors in any combination.
另外,结合图1描述的本申请实施例请求路径获取方法可以由计算机设备来实现。图4为根据本申请实施例的计算机设备的硬件结构示意图。In addition, the request path acquisition method described in conjunction with FIG. 1 according to the embodiment of the present application can be implemented by a computer device. Figure 4 is a schematic diagram of the hardware structure of a computer device according to an embodiment of the present application.
计算机设备可以包括处理器51以及存储有计算机程序指令的存储器52。The computer device may include a processor 51 and a memory 52 storing computer program instructions.
具体地,上述处理器51可以包括中央处理器(CPU),或者特定集成电路(Application Specific Integrated Circuit,简称为ASIC),或者可以被配置成实施本申请实施例的一个或多个集成电路。Specifically, the above-mentioned processor 51 may include a central processing unit (CPU), or an Application Specific Integrated Circuit (ASIC for short), or may be configured to implement one or more integrated circuits of embodiments of the present application.
其中,存储器52可以包括用于数据或指令的大容量存储器。举例来说而非限制,存储器52可包括硬盘驱动器(Hard Disk Drive,简称为HDD)、软盘驱动器、固态驱动器(SolidState Drive,简称为SSD)、闪存、光盘、磁光盘、磁带或通用串行总线(Universal SerialBus,简称为USB)驱动器或者两个或更多个以上这些的组合。在合适的情况下,存储器52可包括可移除或不可移除(或固定)的介质。在合适的情况下,存储器52可在数据处理装置的内部或外部。在特定实施例中,存储器52是非易失性(Non-Volatile)存储器。在特定实施例中,存储器52包括只读存储器(Read-Only Memory,简称为ROM)和随机存取存储器(RandomAccess Memory,简称为RAM)。在合适的情况下,该ROM可以是掩模编程的ROM、可编程ROM(Programmable Read-Only Memory,简称为PROM)、可擦除PROM(Erasable ProgrammableRead-Only Memory,简称为EPROM)、电可擦除PROM(Electrically Erasable ProgrammableRead-Only Memory,简称为EEPROM)、电可改写ROM(Electrically Alterable Read-OnlyMemory,简称为EAROM)或闪存(FLASH)或者两个或更多个以上这些的组合。在合适的情况下,该RAM可以是静态随机存取存储器(Static Random-Access Memory,简称为SRAM)或动态随机存取存储器(Dynamic Random Access Memory,简称为DRAM),其中,DRAM可以是快速页模式动态随机存取存储器(Fast Page Mode Dynamic Random Access Memory,简称为FPMDRAM)、扩展数据输出动态随机存取存储器(Extended Date Out Dynamic RandomAccess Memory,简称为EDODRAM)、同步动态随机存取内存(Synchronous Dynamic Random-Access Memory,简称SDRAM)等。Among others, memory 52 may include mass storage for data or instructions. By way of example and not limitation, the memory 52 may include a hard disk drive (HDD for short), a floppy disk drive, a solid state drive (SSD for short), flash memory, an optical disk, a magneto-optical disk, a magnetic tape, or a universal serial bus. (Universal SerialBus, USB for short) drive or a combination of two or more of these. Memory 52 may include removable or non-removable (or fixed) media, where appropriate. Where appropriate, memory 52 may be internal or external to the data processing device. In certain embodiments, memory 52 is Non-Volatile memory. In a specific embodiment, the memory 52 includes read-only memory (Read-Only Memory, ROM for short) and random access memory (RandomAccess Memory, RAM for short). Under appropriate circumstances, the ROM can be a mask-programmed ROM, a programmable ROM (Programmable Read-Only Memory, referred to as PROM), an erasable PROM (Erasable ProgrammableRead-Only Memory, referred to as EPROM), or an electrically erasable ROM. Except for PROM (Electrically Erasable Programmable Read-Only Memory, referred to as EEPROM), electrically rewritable ROM (Electrically Alterable Read-Only Memory, referred to as EAROM) or flash memory (FLASH) or a combination of two or more of these. Under appropriate circumstances, the RAM can be static random access memory (Static Random-Access Memory, referred to as SRAM) or dynamic random access memory (Dynamic Random Access Memory, referred to as DRAM), wherein the DRAM can be a fast page Fast Page Mode Dynamic Random Access Memory (FPMDRAM for short), Extended Date Out Dynamic Random Access Memory (EDODRAM for short), Synchronous Dynamic Random Access Memory (Synchronous Dynamic Random-Access Memory (SDRAM for short), etc.
存储器52可以用来存储或者缓存需要处理和/或通信使用的各种数据文件,以及处理器51所执行的可能的计算机程序指令。The memory 52 may be used to store or cache various data files required for processing and/or communication, as well as possible computer program instructions executed by the processor 51 .
处理器51通过读取并执行存储器52中存储的计算机程序指令,以实现上述实施例中的任意一种请求路径获取方法。The processor 51 reads and executes the computer program instructions stored in the memory 52 to implement any of the request path acquisition methods in the above embodiments.
在其中一些实施例中,计算机设备还可包括通信接口53和总线50。其中,如图4所示,处理器51、存储器52、通信接口53通过总线50连接并完成相互间的通信。In some of these embodiments, the computer device may also include a communication interface 53 and a bus 50 . Among them, as shown in Figure 4, the processor 51, the memory 52, and the communication interface 53 are connected through the bus 50 and complete communication with each other.
通信接口53用于实现本申请实施例中各模块、装置、单元和/或设备之间的通信。通信端口53还可以实现与其他部件例如:外接设备、图像/数据采集设备、数据库、外部存储以及图像/数据处理工作站等之间进行数据通信。The communication interface 53 is used to implement communication between modules, devices, units and/or equipment in the embodiments of the present application. The communication port 53 can also implement data communication with other components such as: external devices, image/data acquisition equipment, databases, external storage, image/data processing workstations, etc.
总线50包括硬件、软件或两者,将计算机设备的部件彼此耦接在一起。总线50包括但不限于以下至少之一:数据总线(Data Bus)、地址总线(Address Bus)、控制总线(Control Bus)、扩展总线(Expansion Bus)、局部总线(Local Bus)。举例来说而非限制,总线50可包括图形加速接口(Accelerated Graphics Port,简称为AGP)或其他图形总线、增强工业标准架构(Extended Industry Standard Architecture,简称为EISA)总线、前端总线(Front Side Bus,简称为FSB)、超传输(Hyper Transport,简称为HT)互连、工业标准架构(Industry Standard Architecture,简称为ISA)总线、无线带宽(InfiniBand)互连、低引脚数(Low Pin Count,简称为LPC)总线、存储器总线、微信道架构(Micro ChannelArchitecture,简称为MCA)总线、外围组件互连(Peripheral Component Interconnect,简称为PCI)总线、PCI-Express(PCI-X)总线、串行高级技术附件(Serial AdvancedTechnology Attachment,简称为SATA)总线、视频电子标准协会局部(Video ElectronicsStandards Association Local Bus,简称为VLB)总线或其他合适的总线或者两个或更多个以上这些的组合。在合适的情况下,总线50可包括一个或多个总线。尽管本申请实施例描述和示出了特定的总线,但本申请考虑任何合适的总线或互连。Bus 50 includes hardware, software, or both, coupling components of the computer equipment to one another. The bus 50 includes, but is not limited to, at least one of the following: Data Bus, Address Bus, Control Bus, Expansion Bus, and Local Bus. By way of example, but not limitation, the bus 50 may include an Accelerated Graphics Port (AGP) or other graphics bus, an Extended Industry Standard Architecture (EISA) bus, or a Front Side Bus. , referred to as FSB), Hyper Transport (HT) interconnect, Industry Standard Architecture (ISA) bus, wireless bandwidth (InfiniBand) interconnect, Low Pin Count, LPC for short) bus, memory bus, Micro Channel Architecture (MCA for short) bus, Peripheral Component Interconnect (PCI for short) bus, PCI-Express (PCI-X) bus, Serial Advanced Technical Attachment (Serial Advanced Technology Attachment, referred to as SATA) bus, Video Electronics Standards Association Local Bus (referred to as VLB) bus or other suitable bus or a combination of two or more of these. Where appropriate, bus 50 may include one or more buses. Although the embodiments of this application describe and illustrate a specific bus, this application contemplates any suitable bus or interconnection.
该计算机设备可以基于获取到的计算机程序指令,执行本申请实施例中的请求路径获取方法,从而实现结合图1描述的请求路径获取方法。The computer device can execute the request path obtaining method in the embodiment of the present application based on the obtained computer program instructions, thereby implementing the request path obtaining method described in conjunction with FIG. 1 .
另外,结合上述实施例中的请求路径获取方法,本申请实施例可提供一种计算机可读存储介质来实现。该计算机可读存储介质上存储有计算机程序指令;该计算机程序指令被处理器执行时实现上述实施例中的任意一种请求路径获取方法。In addition, combined with the request path acquisition method in the above embodiment, the embodiment of the present application can provide a computer-readable storage medium for implementation. Computer program instructions are stored on the computer-readable storage medium; when the computer program instructions are executed by the processor, any one of the request path acquisition methods in the above embodiments is implemented.
以上所述实施例的各技术特征可以进行任意的组合,为使描述简洁,未对上述实施例中的各个技术特征所有可能的组合都进行描述,然而,只要这些技术特征的组合不存在矛盾,都应当认为是本说明书记载的范围。The technical features of the above-described embodiments can be combined in any way. To simplify the description, not all possible combinations of the technical features in the above-described embodiments are described. However, as long as there is no contradiction in the combination of these technical features, All should be considered to be within the scope of this manual.
以上所述实施例仅表达了本申请的几种实施方式,其描述较为具体和详细,但并不能因此而理解为对发明专利范围的限制。应当指出的是,对于本领域的普通技术人员来说,在不脱离本申请构思的前提下,还可以做出若干变形和改进,这些都属于本申请的保护范围。因此,本申请专利的保护范围应以所附权利要求为准。The above-described embodiments only express several implementation modes of the present application, and their descriptions are relatively specific and detailed, but they should not be construed as limiting the scope of the invention patent. It should be noted that, for those of ordinary skill in the art, several modifications and improvements can be made without departing from the concept of the present application, and these all fall within the protection scope of the present application. Therefore, the protection scope of this patent application should be determined by the appended claims.
Claims (8)
Priority Applications (1)
Application Number | Priority Date | Filing Date | Title |
---|---|---|---|
CN202110142093.1A CN112965749B (en) | 2021-02-02 | 2021-02-02 | Request path acquisition method, device, computer equipment and storage medium |
Applications Claiming Priority (1)
Application Number | Priority Date | Filing Date | Title |
---|---|---|---|
CN202110142093.1A CN112965749B (en) | 2021-02-02 | 2021-02-02 | Request path acquisition method, device, computer equipment and storage medium |
Publications (2)
Publication Number | Publication Date |
---|---|
CN112965749A CN112965749A (en) | 2021-06-15 |
CN112965749B true CN112965749B (en) | 2024-03-19 |
Family
ID=76271810
Family Applications (1)
Application Number | Title | Priority Date | Filing Date |
---|---|---|---|
CN202110142093.1A Active CN112965749B (en) | 2021-02-02 | 2021-02-02 | Request path acquisition method, device, computer equipment and storage medium |
Country Status (1)
Country | Link |
---|---|
CN (1) | CN112965749B (en) |
-
2021
- 2021-02-02 CN CN202110142093.1A patent/CN112965749B/en active Active
Also Published As
Publication number | Publication date |
---|---|
CN112965749A (en) | 2021-06-15 |
Similar Documents
Publication | Publication Date | Title |
---|---|---|
TWI603600B (en) | Determine vulnerability using runtime agent and network sniffer | |
CN107657177B (en) | Vulnerability detection method and device | |
US8683596B2 (en) | Detection of DOM-based cross-site scripting vulnerabilities | |
EP1576487B1 (en) | Web server hit multiplier and redirector | |
US20110055813A1 (en) | Black Box Testing Optimization Using Information from White Box Testing | |
CN107092535B (en) | Method and apparatus for data storage of test interface | |
US9575793B1 (en) | Identifying kernel data structures | |
WO2019184664A1 (en) | Method, apparatus, and system for detecting malicious file | |
US10705949B2 (en) | Evaluation of library test suites using mutation testing | |
US10310956B2 (en) | Techniques for web service black box testing | |
CN111767109A (en) | H5 page display method, device and readable storage medium based on terminal application | |
US9026612B2 (en) | Generating a custom parameter rule based on a comparison of a run-time value to a request URL | |
CN113360377B (en) | Test method and device | |
CN113206850A (en) | Malicious sample message information acquisition method, device, equipment and storage medium | |
US20140283080A1 (en) | Identifying stored vulnerabilities in a web service | |
CN104375935A (en) | Method and device for testing SQL injection attack | |
CN112866279B (en) | Webpage security detection method, device, equipment and medium | |
US9064042B2 (en) | Instrumenting computer program code by merging template and target code methods | |
CN113779437B (en) | Privacy detection method and device, and computer storable medium | |
CN112965749B (en) | Request path acquisition method, device, computer equipment and storage medium | |
WO2025081782A1 (en) | Code analysis method and related device | |
CN113760724A (en) | Automatic testing method and device, electronic equipment and computer readable medium | |
CN116781314A (en) | Method, device and storage medium for verifying system access request | |
CN115550018A (en) | Access right authentication method, device, unified authentication system and program product | |
Rodriguez et al. | ROI: a method for identifying organizations receiving personal data |
Legal Events
Date | Code | Title | Description |
---|---|---|---|
PB01 | Publication | ||
PB01 | Publication | ||
SE01 | Entry into force of request for substantive examination | ||
SE01 | Entry into force of request for substantive examination | ||
GR01 | Patent grant | ||
GR01 | Patent grant | ||
EE01 | Entry into force of recordation of patent licensing contract |
Application publication date: 20210615 Assignee: Hangzhou Anheng Information Security Technology Co.,Ltd. Assignor: Dbappsecurity Co.,Ltd. Contract record no.: X2024980043363 Denomination of invention: Request path acquisition method, device, computer equipment, and storage medium Granted publication date: 20240319 License type: Common License Record date: 20241231 |
|
EE01 | Entry into force of recordation of patent licensing contract |