Webpage file analysis method and device, equipment and storage medium

By initially parsing web page files in the security proxy device and converting the encoding format, the problem of parsing failure caused by not using the preset encoding format is solved, and efficient web page file parsing and business continuity are achieved.

CN118839082AActive Publication Date: 2024-10-25ARRAY NETWORKS BEIJING
View PDF 5 Cites 0 Cited by

Patent Information

Application Number
CN202411320473.X
Authority / Receiving Office
CN · China
Patent Type
Applications(China)
Current Assignee / Owner
Filing Date
2024-09-20
Publication Date
2024-10-25
Estimated Expiration
2044-09-20

AI Technical Summary

Technical Problem

In the existing technology, when the web page file does not adopt the preset encoding format, parsing failure causes the security agent device to be unable to process it normally, hindering client access and causing business discontinuity.

Method used

In the security proxy device, the web page file is received and parsed for the first time. If the parsing fails, it is converted from the original encoding format to the target encoding format, and then parsed. After the parsing is successful, the address information is rewritten to point to the secure access web page. .

Benefits of technology

It improves the efficiency of web page file parsing, avoids business interruption caused by parsing failure, and ensures the continuity and security of client access.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN118839082A_ABST
    Figure CN118839082A_ABST
Patent Text Reader

Abstract

The embodiment of the invention provides a webpage file analysis method and device, equipment and a storage medium, and the method comprises the steps: receiving a webpage file which comprises network resources and address information corresponding to the network resources; carrying out primary analysis processing on the webpage file; if the analysis fails, converting the webpage file from the original coding format into a target coding format, and analyzing the converted webpage file; and rewriting the address information in the analyzed webpage file, so that the rewritten address information points to the security access webpage corresponding to the network resource. By the adoption of the method and device, no matter what type of encoding format is adopted by the webpage file for encoding, primary analysis processing is directly conducted firstly, and if it is found that analysis fails, the webpage file is converted into the target encoding format from the original encoding format. According to the method and the device, the webpage file can be analyzed under the condition that the overall webpage file analysis efficiency is relatively high.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The present invention relates to the field of network security technology, and in particular to a web page file parsing method, device, equipment and storage medium. Background Art

[0002] In the related art, when a client requests a network resource in an internal server of an enterprise, the server will carry the network resource in a web page file and send it to a security proxy device, which will process the web page file and then forward it to the client. This can shield the client from direct access to the server and ensure the security of the server. Before the security proxy device processes the web page file, it first needs to parse the web page file so that the security proxy device can normally process the parsed web page file. During the parsing process, the parsing process can only be performed normally if the web page file is encoded in a preset encoding format. If the web page file is not encoded in a preset encoding format, the parsing will fail, resulting in the security proxy device being unable to process the web page file normally, thereby hindering the client's access and causing business discontinuity. Summary of the invention

[0003] The embodiment of the present invention provides a web page file parsing method, device, equipment and storage medium, which are used to successfully parse the web page file and complete the parsing of the web page file at a higher processing efficiency.

[0004] In a first aspect, an embodiment of the present invention provides a web page file parsing method, which is applied to a security proxy device, and the method includes: Receiving a web page file, wherein the web page file includes a network resource and address information corresponding to the network resource; Performing initial parsing processing on the web page file; If the parsing fails, converting the web page file from the original encoding format to the target encoding format, and parsing the converted web page file; The address information in the parsed web page file is rewritten so that the rewritten address information points to the secure access web page corresponding to the network resource.

[0005] Optionally, after performing the initial parsing process on the webpage file, the method further includes: If the parsing is successful, the address information in the parsed web page file is rewritten so that the rewritten address information points to the secure access web page corresponding to the network resource.

[0006] Optionally, the performing initial parsing processing on the webpage file includes: Determining at least one parsing unit included in the web page file; According to the order of each parsing unit in the web page file, each parsing unit is subjected to a primary parsing process in turn; If the parsing fails, the web page file is converted from the original encoding format to the target encoding format, and the converted web page file is parsed, including: If any parsing unit fails to parse, the parsing unit that failed to parse is converted from the original encoding format to the target encoding format, and the parsing process is performed on the converted parsing unit.

[0007] Optionally, the parsing unit includes the entire web page file, a single character or a single file block.

[0008] Optionally, if the parsing fails, converting the webpage file from an original encoding format to a target encoding format includes: Determine the type of parsing failure; If the parsing failure type is an encoding format error, the web page file is converted from the original encoding format to the target encoding format.

[0009] Optionally, the target encoding format includes a wide-byte encoding format and / or a specific character encoding format, and the specific character encoding format includes a utf-8 character encoding format and / or a GBK character encoding format.

[0010] Optionally, the parsing process is performed by a parser, and the converting of the web page file from an original encoding format to a target encoding format includes: Determine an encoding format supported by the parser among the wide byte encoding format and the specific character encoding format as a target encoding format; The web page file is converted from the original encoding format to the target encoding format through the parser.

[0011] In a second aspect, an embodiment of the present invention provides a web page file parsing device, which is arranged in a security proxy device, and the device includes: A receiving module, used for receiving a web page file, wherein the web page file includes a network resource and address information corresponding to the network resource; A parsing module, used for performing a primary parsing process on the web page file; A conversion module, used for converting the web page file from an original encoding format to a target encoding format if the parsing fails, and performing parsing processing on the converted web page file; The rewriting module is used to rewrite the address information in the parsed web page file so that the rewritten address information points to the secure access web page corresponding to the network resource.

[0012] Optionally, the rewriting module is further used to: If the parsing is successful, the address information in the parsed web page file is rewritten so that the rewritten address information points to the secure access web page corresponding to the network resource.

[0013] Optionally, the parsing module is used to determine at least one parsing unit included in the web page file; and perform initial parsing processing on each parsing unit in sequence according to the order of each parsing unit in the web page file; The conversion module is used for converting the failed parsing unit from the original encoding format to the target encoding format if any parsing unit fails to parse, and performing parsing processing on the converted parsing unit.

[0014] Optionally, the parsing unit includes the entire web page file, a single character or a single file block.

[0015] Optionally, the conversion module is used to: Determine the type of parsing failure; If the parsing failure type is an encoding format error, the web page file is converted from the original encoding format to the target encoding format.

[0016] Optionally, the target encoding format includes a wide-byte encoding format and / or a specific character encoding format, and the specific character encoding format includes a utf-8 character encoding format and / or a GBK character encoding format.

[0017] Optionally, the parsing process is performed by a parser, and the conversion module is used to: Determine an encoding format supported by the parser among the wide byte encoding format and the specific character encoding format as a target encoding format; The web page file is converted from the original encoding format to the target encoding format through the parser.

[0018] In a third aspect, an embodiment of the present invention provides a security proxy device, which includes a processor and a memory, wherein the memory stores executable code, and when the executable code is executed by the processor, the processor can at least implement the web page file parsing method in the first aspect.

[0019] In a fourth aspect, an embodiment of the present invention provides a non-temporary machine-readable storage medium having executable code stored thereon. When the executable code is executed by a processor of a security proxy device, the processor can at least implement the web page file parsing method in the first aspect.

[0020] By adopting the present invention, no matter what type of encoding format is used to encode the web page file, the initial parsing process is directly performed first. If the parsing fails, the web page file is converted from the original encoding format to the target encoding format. The additional computing overhead caused by the initial parsing process resulting in the parsing failure is much smaller than the overall computing overhead generated by traversing all the characters in a large number of web page files one by one. By adopting the present invention, the parsing of web page files can be achieved with an overall higher parsing efficiency of web page files. By adopting the present invention, it is ensured that the security proxy device can perform related processing on the web page files normally in the future, avoid hindering the access of the client, and ensure the continuity of the business. BRIEF DESCRIPTION OF THE DRAWINGS

[0021] In order to more clearly illustrate the technical solutions in the embodiments of the present invention, the following briefly introduces the drawings required for use in the description of the embodiments. Obviously, the drawings described below are some embodiments of the present invention. For ordinary technicians in this field, other drawings can be obtained based on these drawings without creative work.

[0022] Figure 1 A schematic diagram of a network architecture provided by an embodiment of the present invention; Figure 2 A schematic diagram of a flow chart of a web page file parsing method provided by an embodiment of the present invention; Figure 3 A schematic diagram of the structure of a web page file parsing device provided by an embodiment of the present invention; Figure 4 A schematic diagram of the structure of a security proxy device provided by an embodiment of the present invention. DETAILED DESCRIPTION

[0023] In order to make the purpose, technical solution and advantages of the embodiments of the present invention clearer, the technical solution in the embodiments of the present invention will be clearly and completely described below in conjunction with the drawings in the embodiments of the present invention. Obviously, the described embodiments are part of the embodiments of the present invention, not all of the embodiments. Based on the embodiments of the present invention, all other embodiments obtained by ordinary technicians in this field without creative work are within the scope of protection of the present invention.

[0024] The terms used in the embodiments of the present invention are only for the purpose of describing specific embodiments, and are not intended to limit the present invention. The singular forms "a", "said" and "the" used in the embodiments of the present invention and the appended claims are also intended to include plural forms, unless the context clearly indicates other meanings, and "multiple" generally includes at least two.

[0025] As used herein, the words "if" and "if" may be interpreted as "at the time of" or "when" or "in response to determining" or "in response to detecting", depending on the context. Similarly, the phrases "if it is determined" or "if (stated condition or event) is detected" may be interpreted as "when it is determined" or "in response to determining" or "when detecting (stated condition or event)" or "in response to detecting (stated condition or event)", depending on the context.

[0026] In addition, the step sequence in the following method embodiments is only an example and not a strict limitation.

[0027] Definition of terms: Character: In computer and telecommunication technology, a character is a unit of glyph, glyph-like unit or basic information of a symbol. In simple terms, a character is a general term for various words and symbols. A character can be a Chinese character, an English letter, an Arabic numeral, a punctuation mark, a graphic symbol or a control symbol, etc.

[0028] Character set: A character set refers to a collection of multiple characters. Different character sets contain different numbers of characters, different characters, and different character encoding methods. For example, GB2312 is the simplified Chinese character set of China's national standard; GB2312 includes simplified Chinese characters (6763) and general symbols, serial numbers, numbers, Latin letters, Japanese kana, etc., a total of 7445 graphic characters; the ASCII character set only contains 128 characters, and the main characters included in the ASCII character set are English letters, Arabic letters, and some simple control characters. In addition to the above examples, other commonly used character sets include GBK character set, GB18030 character set, Big5 character set, Unicode character set, etc.

[0029] Character encoding: Character encoding refers to a mapping rule, according to which a character can be mapped into other forms of data for storage and transmission in a computer. For example, the ASCII character encoding stipulates that the 7 low bits of a single byte are used to encode all characters. Under this encoding rule, the code for the letter A is 65 (ASCII code), which is 0x41 in a single byte, so when it is written to a storage device, it is 01000001 in binary. Each character set has its own character encoding rules. Commonly used character set encoding rules include UTF-8 encoding, GBK encoding, Big5 encoding, etc.

[0030] Wide characters: ASCII characters, such as English, can be represented by only 1 byte, but non-ASCII characters, such as Chinese characters, often require at least 2 bytes to store. Characters that can be stored in a single byte are called narrow characters, and characters that require at least 2 bytes to store are called wide characters.

[0031] Wide byte: A wide byte refers to a storage method. Generally, narrow characters are stored in one byte, while wide characters are stored in two or more bytes. This storage method causes some characters in strings such as "No. 1" and "Server A" to be stored in one byte and some in two bytes, thus introducing wide bytes. In wide bytes, both wide and narrow characters are stored using 2 (4 in some cases, depending on the specific implementation) bytes.

[0032] To facilitate understanding of the specific implementation process of the technical solution in this embodiment, the related technologies are described below: The network resources within an enterprise need to be protected. To achieve this goal, a security proxy device is often used. For example, an SSL VPN device is a type of security proxy device. As Figure 1 shown, a security proxy device can be set between the enterprise's internal local area network and the external wide area network. When a client requests network resources from an enterprise internal server, instead of directly accessing the enterprise internal server, the client accesses the enterprise internal server through the security proxy device in a secure access manner. The response result (web page file) of the enterprise internal server also needs to be returned to the client through the security proxy device, thus avoiding the client directly accessing the enterprise internal server and providing a certain degree of protection for the network resources stored in the enterprise internal server.

[0033] Among them, the above-mentioned secure access method can, for example, let the security proxy device rewrite the specific content of the original internal web page file using standard rewrite rules. Specifically, special attention needs to be paid to rewriting the address information (such as URL links) corresponding to the network resources in the original internal web page file, so that the rewritten address information points to the secure access web page that the client needs to access. This secure access method can be implemented only through a browser without the need to install an additional VPN client, so such a secure access method is convenient to apply and has universality.

[0034] Before rewriting the specific content of the original internal web page file, the original internal web page file needs to be parsed, and then the parsing result can be rewritten. Specifically, the original internal web page file can be parsed through a parser in the browser. However, these parsers often only support web page files encoded in wide byte encoding format, specific character encoding format, etc., and cannot successfully parse web page files encoded in encoding formats not supported by the parser.

[0035] In order to solve the above problem, the related technology often traverses all the contents in the entire web page file. If it is detected that there is any content encoded in an encoding format not supported by the parser in the web page file, the encoding format of the original internal web page file is converted.

[0036] However, in actual applications, the data volume of web page files is large, and some web page files can even reach the MB level. As the times change, the average data volume of web page files will become larger and larger. Traversing general web page files already requires a large computing overhead. If web page files with larger data volumes are traversed, more computing overhead will be consumed, resulting in lower parsing efficiency of web page files.

[0037] In order to solve the above technical problems, this embodiment proposes a web page file parsing method, which can be applied to a security proxy device. Figure 2 As shown, the method comprises the following steps: Step 201, receiving a web page file, wherein the web page file includes network resources and address information corresponding to the network resources.

[0038] Step 202, performing initial parsing processing on the web page file.

[0039] Step 203: if the parsing fails, the web page file is converted from the original encoding format to the target encoding format, and the converted web page file is parsed.

[0040] Step 204, rewrite the address information in the parsed web page file so that the rewritten address information points to the secure access web page corresponding to the network resource.

[0041] First, the security proxy device can receive a web page file sent by an internal server of an enterprise, which is returned by the internal server of the enterprise in response to a request from a client. The web page file contains the network resources that the client requests to access and the address information corresponding to the network resources, wherein the address information can be, for example, a URL link. Specifically, the types of web page files can include, but are not limited to, js, html, etc. If the address information corresponding to the network resource is directly exposed to the client, it may pose a threat to the security of the network resource. Therefore, the security proxy device is required to rewrite the address information corresponding to the network resource and then return it to the client, so that the client can access the secure access web page corresponding to the network resource. In this way, the client can still indirectly access the network resource, but a barrier can be formed to protect the network resource.

[0042] Before rewriting, the original internal web page file needs to be parsed for the first time. It should be noted that in the embodiment of the present invention, the compliance check of the encoding format of the web page file is not performed first, but the initial parsing process is directly performed first regardless of the type of encoding format used to encode the web page file. If the parsing fails, the web page file is converted from the original encoding format to the target encoding format, wherein the target encoding format is the encoding format supported by the parser.

[0043] Among them, optionally, the target encoding format may include but is not limited to a wide-byte encoding format and / or a specific character encoding format, and the specific character encoding format may include but is not limited to a utf-8 character encoding format and a GBK (Chinese Internal Code Specification) character encoding format.

[0044] The applicant's research found that in practice, only a few web page files need to be converted to encoding formats. In fact, the original encoding formats of most web page files are already encoding formats supported by the parser. Therefore, the additional computational overhead caused by the initial parsing process resulting in parsing failure is much smaller than the overall computational overhead generated by traversing a large number of web page files one by one. For example, there may be only 5 out of 100 web page files that are not encoded in the encoding format supported by the parser. The additional computational overhead generated by the initial parsing of these 5 web page files is 5a. If all the contents of the 100 web page files are traversed one by one for detection, the computational overhead required is 100b, and 5a is much smaller than 100b. It can be seen from the above examples that the method provided by the embodiments of the present invention can achieve parsing of web page files with an overall higher parsing efficiency of web page files.

[0045] If the parsing fails, the web page file can be converted from the original encoding format to the target encoding format, and then the converted web page file is parsed again. The initial parsing process and the subsequent parsing process can be the same or different.

[0046] If the parsing is successful, there is no need to perform the parsing process again, and the address information in the parsed web page file can be directly rewritten so that the rewritten address information points to the secure access web page corresponding to the network resource.

[0047] In some optional embodiments, since the reasons for parsing failure may include multiple reasons, not just encoding format errors due to unsupported encoding formats, when parsing failure is found, the type of parsing failure can also be determined optionally; if the type of parsing failure is an encoding format error, the web page file is converted from the original encoding format to the target encoding format.

[0048] If the type of parsing failure is a non-coding format error, an error log can be generated and output, in which the specific type of parsing failure can be recorded, and the cause of the parsing failure can be analyzed to a certain extent. After outputting the error log, the technician can view the error log, and can locate the content that caused the error based on the description of the parsing failure in the error log, and modify the erroneous content. After modifying the erroneous content, a new version of the web page file can be released or a patch can be issued based on the modified content, so that the new version of the web page file or the web page file with the patch installed will no longer have the above error, and then the subsequent normal process processing can continue, such as parsing the above web page file.

[0049] Optionally, the process of performing the initial parsing process on the web page file can be implemented as follows: determining at least one parsing unit included in the web page file; and performing the initial parsing process on each parsing unit in sequence according to the order of each parsing unit in the web page file. Accordingly, if the parsing fails, the web page file is converted from the original encoding format to the target encoding format, and the process of parsing the converted web page file can be implemented as follows: if any parsing unit fails to parse, the parsing unit that failed to parse is converted from the original encoding format to the target encoding format, and the parsing process is performed on the converted parsing unit.

[0050] In actual applications, the entire web page file can be parsed as a parsing unit, so that the entire web page file can be parsed for the first time at one time. If the web page file does not contain any content that the parser does not support parsing, the initial parsing of the web page file will be successful, otherwise the parsing will fail.

[0051] Alternatively, a single character may be used as a parsing unit, so that all characters contained in the web page file can be determined, and each character can be subjected to a primary parsing process in turn according to the order in which each character is arranged in the web page file. It is understandable that a web page file may be composed of characters in a variety of encoding formats, some of which are supported for parsing by the parser, while others are not supported for parsing by the parser, so each character in the web page file may be subjected to a primary parsing process one by one, and characters encoded in the encoding formats supported by the parser may be successfully parsed, while characters encoded in the encoding formats not supported by the parser may fail to be parsed. If any character fails to be parsed, the character that failed to be parsed may be converted from the original encoding format to the target encoding format, and then the converted character may be parsed again until all characters in the web page file are parsed.

[0052] Alternatively, a single file block can be used as a parsing unit, and each time a file block is obtained, the current file block can be parsed for the first time. It is understandable that different file blocks in a web page file can be composed of characters in a variety of encoding formats, some of which are supported by the parser, while others are not. If all the characters in a file block are composed of characters encoded in an encoding format supported by the parser, the file block can be parsed successfully, otherwise the parsing fails. Therefore, each file block in the web page file can be parsed for the first time one by one. If any file block fails to parse, the file block that failed to parse can be converted from the original encoding format to the target encoding format, and then the converted file block can be parsed again until the parsing of all file blocks in the web page file is completed.

[0053] In some optional embodiments, the initial parsing process and the subsequent parsing processes can be completed by the parser, the encoding format conversion can be completed by the operating logic outside the parser, or the encoding format conversion process can be directly integrated into the parser, and the parser as a whole implements the solution provided by the embodiment of the present invention, which is not limited to this embodiment of the present invention.

[0054] The previous article introduced that the target encoding format can be a wide-byte encoding format and / or a specific character encoding format. Some parsers support the wide-byte encoding format, some parsers support the specific character encoding format, and some parsers support both encoding formats.

[0055] Based on this, optionally, when the parser only supports one encoding format, the process of converting the web page file from the original encoding format to the target encoding format can be implemented as: determining the encoding format supported by the parser among the wide byte encoding format and the specific character encoding format as the target encoding format; through the parser, converting the web page file from the original encoding format to the target encoding format.

[0056] Optionally, when the parser supports at least two encoding formats, since different encoding formats perform differently in applications, for example, some encoding formats have simple and easy-to-implement encoding algorithms, some encoding formats have fast encoding speeds and low error rates, and some encoding formats occupy less memory space, etc., the technician can pre-configure the performance that is prioritized, and determine the corresponding target encoding format based on the configuration results of the technician. For example, if the technician needs a solution that has a simple and easy-to-implement encoding algorithm but does not pay attention to encoding speed, the wide-byte encoding format can be determined as the target encoding format. When encountering a parsing unit that fails to parse, the parsing unit that fails to parse can be converted from the original encoding format to the wide-byte encoding format.

[0057] By adopting the present invention, no matter what type of encoding format is used to encode the web page file, the initial parsing process is directly performed first. If the parsing fails, the web page file is converted from the original encoding format to the target encoding format. The additional computing overhead caused by the initial parsing process leading to the parsing failure is much smaller than the overall computing overhead caused by traversing all the characters in a large number of web page files one by one. By adopting the present invention, the parsing of web page files can be achieved with an overall higher parsing efficiency of web page files.

[0058] The web page file parsing device of one or more embodiments of the present invention will be described in detail below. Those skilled in the art will appreciate that these web page file parsing devices can be configured using commercially available hardware components through the steps taught in this solution.

[0059] Figure 3 The schematic diagram of the structure of a web page file parsing device provided by an embodiment of the present invention is provided in a security proxy device. Figure 3 As shown, the device comprises: A receiving module 31, configured to receive a web page file, wherein the web page file includes a network resource and address information corresponding to the network resource; The parsing module 32 is used to perform a primary parsing process on the web page file; The conversion module 33 is used to convert the web page file from the original encoding format to the target encoding format if the parsing fails, and perform parsing processing on the converted web page file; The rewriting module 34 is used to rewrite the address information in the parsed web page file so that the rewritten address information points to the secure access web page corresponding to the network resource.

[0060] Optionally, the rewriting module 34 is further configured to: If the parsing is successful, the address information in the parsed web page file is rewritten so that the rewritten address information points to the secure access web page corresponding to the network resource.

[0061] Optionally, the parsing module 32 is used to determine at least one parsing unit included in the web page file; and perform a primary parsing process on each parsing unit in sequence according to the order of each parsing unit in the web page file; The conversion module 33 is used for converting the failed parsing unit from the original encoding format to the target encoding format if any parsing unit fails to be parsed, and performing parsing processing on the converted parsing unit.

[0062] Optionally, the parsing unit includes the entire web page file, a single character or a single file block.

[0063] Optionally, the conversion module 33 is used to: Determine the type of parsing failure; If the parsing failure type is an encoding format error, the web page file is converted from the original encoding format to the target encoding format.

[0064] Optionally, the target encoding format includes a wide-byte encoding format and / or a specific character encoding format, and the specific character encoding format includes a utf-8 character encoding format and / or a GBK character encoding format.

[0065] Optionally, the parsing process is performed by a parser, and the conversion module 33 is used to: Determine an encoding format supported by the parser among the wide byte encoding format and the specific character encoding format as a target encoding format; The web page file is converted from the original encoding format to the target encoding format through the parser.

[0066] Figure 3 The device shown can perform the aforementioned Figure 1 to Figure 2 The web page file parsing method provided in the illustrated embodiment, the detailed execution process and technical effects are described in the aforementioned embodiment and will not be repeated here.

[0067] In one possible design, the above Figure 3 The structure of the web page file parsing device shown can be implemented as a security proxy device, such as Figure 4 As shown, the security proxy device may include: a processor 91 and a memory 92. The memory 92 stores executable code, and when the executable code is executed by the processor 91, the processor 91 can at least implement the above-mentioned Figure 1 to Figure 2 The web page file parsing method provided in the illustrated embodiment.

[0068] Optionally, the security proxy device may further include a communication interface 93 for communicating with other devices.

[0069] In addition, an embodiment of the present invention provides a non-transitory machine-readable storage medium, on which executable code is stored. When the executable code is executed by a processor of a security proxy device, the processor can at least implement the above-mentioned Figure 1 to Figure 2 The web page file parsing method provided in the illustrated embodiment.

[0070] The device embodiments described above are merely illustrative, wherein the units described as separate components may or may not be physically separated. Some or all of the modules may be selected according to actual needs to achieve the purpose of the present embodiment. Those of ordinary skill in the art may understand and implement the present invention without creative effort.

[0071] Through the description of the above embodiments, those skilled in the art can clearly understand that each embodiment can be implemented by adding a necessary general hardware platform, and of course can also be implemented by combining hardware and software. Based on such an understanding, the above technical solution can essentially or in other words be embodied in the form of a computer product, and the present invention can be implemented in the form of a computer program product implemented on one or more computer-usable storage media (including but not limited to disk storage, CD-ROM, optical storage, etc.) containing computer-usable program codes.

[0072] The web page file parsing method provided in the embodiment of the present invention can be executed by a certain program / software, and the program / software can be provided by the network side. The security proxy device mentioned in the above embodiment can download the program / software to a local non-volatile storage medium, and when it needs to execute the above web page file parsing method, the program / software is read into the memory by the CPU, and then the program / software is executed by the CPU to implement the web page file parsing method provided in the above embodiment. The execution process can refer to the above Figure 1 to Figure 2 Instructions in .

[0073] Finally, it should be noted that the above embodiments are only used to illustrate the technical solutions of the present invention, rather than to limit it. Although the present invention has been described in detail with reference to the aforementioned embodiments, those skilled in the art should understand that they can still modify the technical solutions described in the aforementioned embodiments, or make equivalent replacements for some of the technical features therein. However, these modifications or replacements do not deviate the essence of the corresponding technical solutions from the spirit and scope of the technical solutions of the embodiments of the present invention.

Claims

1. A web page file parsing method, characterized in that: Applied to a security proxy device, the method comprises: Receiving a web page file, wherein the web page file includes a network resource and address information corresponding to the network resource; Performing initial parsing processing on the web page file; If the parsing fails, converting the web page file from the original encoding format to the target encoding format, and parsing the converted web page file; The address information in the parsed web page file is rewritten so that the rewritten address information points to the secure access web page corresponding to the network resource.

2. The method according to claim 1, characterized in that After performing the initial parsing process on the webpage file, the method further includes: If the parsing is successful, the address information in the parsed web page file is rewritten so that the rewritten address information points to the secure access web page corresponding to the network resource.

3. The method according to claim 1, characterized in that The performing initial parsing of the web page file includes: Determining at least one parsing unit included in the web page file; According to the order of each parsing unit in the web page file, each parsing unit is subjected to a primary parsing process in turn; If the parsing fails, the web page file is converted from the original encoding format to the target encoding format, and the converted web page file is parsed, including: If any parsing unit fails to parse, the parsing unit that failed to parse is converted from the original encoding format to the target encoding format, and the parsing process is performed on the converted parsing unit.

4. The method according to claim 3, characterized in that The parsing unit includes the entire web page file, a single character or a single file block.

5. The method according to claim 1, characterized in that If the parsing fails, converting the web page file from the original encoding format to the target encoding format includes: Determine the type of parsing failure; If the parsing failure type is an encoding format error, the web page file is converted from the original encoding format to the target encoding format.

6. The method according to claim 1, characterized in that The target encoding format includes a wide-byte encoding format and / or a specific character encoding format, and the specific character encoding format includes a utf-8 character encoding format and / or a GBK character encoding format.

7. The method according to claim 6, characterized in that The parsing process is performed by a parser, and the conversion of the web page file from the original encoding format to the target encoding format includes: Determine an encoding format supported by the parser among the wide byte encoding format and the specific character encoding format as a target encoding format; The web page file is converted from the original encoding format to the target encoding format through the parser.

8. A web page file parsing device, characterized in that: Set up in a security proxy device, the device includes: A receiving module, used for receiving a web page file, wherein the web page file includes a network resource and address information corresponding to the network resource; A parsing module, used for performing a primary parsing process on the web page file; A conversion module, used for converting the web page file from an original encoding format to a target encoding format if the parsing fails, and performing parsing processing on the converted web page file; The rewriting module is used to rewrite the address information in the parsed web page file so that the rewritten address information points to the secure access web page corresponding to the network resource.

9. A security proxy device, characterized in that: include: A memory and a processor; wherein the memory stores executable code, and when the executable code is executed by the processor, the processor executes the web page file parsing method as described in any one of claims 1-7.

10. A non-transitory machine-readable storage medium, characterized in that: The non-transitory machine-readable storage medium stores executable code, and when the executable code is executed by a processor of a security proxy device, the processor is caused to execute the web page file parsing method according to any one of claims 1 to 7.

Citation Information

Patent Citations

  • A network resource mapping method oriented to L1 customer

    CN101267457A

  • Messy code recovery system and method

    CN101551792A

  • Method and device for cross-domain acquisition of network picture resources

    CN110516171A

  • Data acquisition method and device, electronic equipment and storage medium

    CN114428635A

  • System and method for remote network access

    US20060031407A1