Portal authentication page intelligent detection method and device, equipment and medium
By analyzing the status codes and parsing the HTML of multiple URLs through relay devices, the Portal authentication page address is identified and an entry point is provided in the web management interface. This solves the problems of reliability and compatibility in terminal device detection and ensures that users can reliably access the authentication page.
Patent Information
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2025-12-18
- Publication Date
- 2026-03-10
AI Technical Summary
In existing technologies, terminal devices suffer from insufficient reliability and poor compatibility when probing the Portal authentication page, which prevents users from effectively triggering the authentication process.
By initiating HTTP requests to multiple heterogeneous baseline URLs through relay devices, analyzing response status codes and deeply parsing HTML content, identifying the Portal authentication page address, and providing a clickable authentication entry point in the web management interface of the relay devices.
The reliability and compatibility of the Portal authentication page have been improved, ensuring that users can reliably access the authentication page and avoiding authentication failures caused by differences in terminal device systems.
Smart Images

Figure CN121645233A_ABST
Abstract
Description
TECHNICAL FIELD
[0001] The present application relates to the technical field of Portal authentication, in particular to a Portal authentication page intelligent detection method, device, equipment and medium. BACKGROUND
[0002] With the popularity of public wireless networks, Portal authentication has become a common way for hotels, airports, shopping malls and other public places to provide network access services. Users need to complete the authentication operation in the browser after connecting such WiFi to access the Internet. Currently, the initiation of the authentication process mainly depends on the detection mechanism built-in the user terminal device itself. Usually, after connecting to WiFi, devices such as smartphones will automatically initiate a network connection test request to the specific website preset by the device manufacturer. According to the response content returned by the server, such as a specific success status code or a redirection instruction, the terminal device system will judge whether there is a Portal authentication page in the current network, and decide whether to automatically pop up a browser to guide the user to perform authentication accordingly.
[0003] However, this solution which completely relies on the terminal device itself has inherent limitations. First, the reliability of its detection logic is insufficient. In order to be compatible or for other considerations, some public networks may "release" certain specific detection websites used by some mainstream terminal brands, that is, directly return a success response indicating that the network is smooth, instead of performing redirection to the authentication page. This makes the terminal device misjudge the network status, resulting in the authentication process failing to trigger. Secondly, even if the network side correctly returns the redirection response, there are significant interaction compatibility differences among terminal devices of different brands, different system versions or different browser kernels in the link of parsing the response and automatically popping up the authentication page, which may result in the failure of pop-up window, causing the user to be unable to obtain an effective authentication entry. Although there are currently routers that relay devices that can connect to Portal WiFi, which aim to facilitate multiple devices to share the network, but in the traditional working mode, such relay devices mainly act as data forwarding channels and do not intervene or solve the failure problem of the terminal side detection and interaction link. When the terminal's own detection or pop-up mechanism fails, the user will still face the dilemma of being unable to access the network and having no way to start authentication. SUMMARY
[0004] The embodiments of the present application provide a Portal authentication page intelligent detection method, device, equipment and medium, which aims to solve the technical problem of how to provide a solution deployed on the network access side, which can actively and reliably detect the Portal authentication page and ensure that all user terminals provide stable and effective authentication entry.
[0005] In a first aspect, embodiments of the present application provide a method for intelligently detecting a portal authentication page, comprising: When the relay device is connected to the target WiFi network, sequentially initiating HTTP requests to at least two preset reference probe URLs belonging to different service providers; Analyzing the status code of the HTTP response of the HTTP request to each reference probe URL, if the status code of the HTTP response is a status code indicating redirection, it is determined that there is a portal authentication page, and a jump address is extracted from the header of the HTTP response returning the status code indicating redirection as a portal authentication page address; If the status code of the HTTP response of the HTTP request to any reference probe URL is a success status code, and the content of the HTTP response does not match the preset success identification content, the HTML content of the HTTP response is parsed to find and extract a URL indicated by a jump instruction embedded by an HTML tag or a script language, if the URL is successfully extracted, it is determined that there is a portal authentication page, and the extracted URL is taken as a portal authentication page address; The obtained portal authentication page address is displayed to the user through the web management interface of the relay device.
[0006] Further technical solutions are that the at least two preset reference probe URLs include probe service addresses corresponding to different operating systems or network service ecosystems respectively.
[0007] Further technical solutions are that the status code indicating redirection includes 301, 302, 303, and 307 status codes.
[0008] Further technical solutions are that the parsing of the HTML content of the HTTP response to find and extract a URL indicated by a jump instruction embedded by an HTML tag or a script language includes: Scanning a meta-refresh tag in the HTML content, wherein the http-equiv attribute value of the meta-refresh tag is “refresh”; Parsing the content attribute value of the meta-refresh tag, and extracting a subsequent string prefixed with “url=” or “URL=” from the content attribute value as a jump target address.
[0009] Further technical solutions are that the parsing of the HTML content of the HTTP response to find and extract a URL indicated by a jump instruction embedded by an HTML tag or a script language includes: scanning a script tag and JavaScript code in the script tag in the HTML content; identifying an assignment statement for modifying a browser address in the JavaScript code, wherein the assignment statement comprises an assignment to a window.location.href, window.location.replace, or location.href attribute; extracting a URL string assigned from the assignment statement as a jump target address.
[0010] Further, the method comprises: generating and presenting a prompt information in the Web management interface; embedding the Portal authentication page address in the prompt information to form a clickable hyperlink.
[0011] Further, the preset success identifier content comprises a response body containing a preset specific success text.
[0012] In a second aspect, the embodiments of the present application further provide a Portal authentication page intelligent detection device, which comprises units for executing the above method.
[0013] In a third aspect, the embodiments of the present application further provide a computer device, which comprises a memory and a processor, the memory stores a computer program, and the processor executes the computer program to realize the above method.
[0014] In a fourth aspect, the embodiments of the present application further provide a computer readable storage medium, which stores a computer program, and the computer program is executed by a processor to realize the above method.
[0015] The embodiment of the present application provides a Portal authentication page intelligent detection method, device, equipment and medium. The method is applied to a relay device, and the method comprises the following steps: when the relay device is connected to a target WiFi network, HTTP requests are successively initiated to at least two benchmark detection URLs which are pre-set and belong to different service providers; the status code of the HTTP response of the HTTP request of each benchmark detection URL is analyzed; if the status code of the HTTP response is a status code indicating redirection, it is determined that there is a Portal authentication page, and a jump address is extracted from the header of the HTTP response returning the status code indicating redirection as a Portal authentication page address; if the status code of the HTTP response of the HTTP request of any benchmark detection URL is a successful status code, and the content of the HTTP response does not match the pre-set successful identification content, the HTML content of the HTTP response is parsed to find and extract a URL indicated by a jump instruction embedded by an HTML tag or a script language, if the URL is successfully extracted, it is determined that there is a Portal authentication page, and the extracted URL is taken as the Portal authentication page address; and the obtained Portal authentication page address is displayed to a user through a Web management interface of the relay device. The present application fundamentally solves the reliability and compatibility problems caused by terminal detection by implementing multi-source detection and multi-layer analysis on the relay device side. The method firstly initiates a request to multiple heterogeneous benchmark URLs to reduce the risk of missing a single URL being released; the standard redirection can be directly captured by analyzing the response status code, and the response returning the successful status code but the content is not matched is subjected to HTML deep analysis, so that a non-standard Portal page realizing jump through Meta Refresh or JavaScript is identified, and the detection compatibility is greatly expanded. Finally, the obtained authentication address provides a clickable entry in the unified Web management interface of the relay device, and a deterministic authentication guide path independent of the terminal model and system is created for the user, and the authentication process is ensured to be 100% accessible. BRIEF DESCRIPTION OF DRAWINGS
[0016] In order to more clearly illustrate the technical solutions of the embodiments of the present application, the drawings needed in the embodiment description will be briefly introduced. Obviously, the drawings in the following description are some embodiments of the present application, and other drawings can be obtained by those skilled in the art without creative labor.
[0017] Figure 1 A flowchart of a Portal authentication page intelligent detection method provided by the embodiment of the present application is shown in the figure. Figure 2 A schematic block diagram of a computer device provided by the embodiment of the present application is shown in the figure. DETAILED DESCRIPTION
[0018] The technical solutions in the embodiments of the present application will be clearly and completely described below with reference to the drawings in the embodiments of the present application. Obviously, the described embodiments are some of the embodiments of the present application but not all the embodiments of the present application. Based on the embodiments in the present application, all other embodiments obtained by a person of ordinary skill in the art without creative effort should fall within the scope of the present application.
[0019] It should be understood that the terms "comprise" and "include" as used in the specification and the appended claims indicate the presence of the described features, integers, steps, operations, elements, and / or components but do not preclude the presence or addition of one or more other features, integers, steps, operations, elements, components, and / or groups thereof.
[0020] It should also be understood that the terms used in the present application specification are only for the purpose of describing particular embodiments and are not intended to limit the present application. As used in the present application specification and the appended claims, the singular forms "a", "an" and "the" are intended to include the plural forms unless the context clearly indicates otherwise.
[0021] It should be further understood that the term "and / or" as used in the present application specification and the appended claims means any one or more of the associated listed items, as well as all possible combinations of the items.
[0022] As used in the present application specification and the appended claims, the term "if" can be interpreted as "when" or "upon" or "in response to determining" or "in response to detecting", depending on the context. Similarly, the phrase "if it is determined" or "if [a described condition or event] is detected" can be interpreted as meaning "upon determining" or "in response to determining" or "upon detecting [a described condition or event]" or "in response to detecting [a described condition or event]", depending on the context.
[0023] Referring to Figure 1 The present application embodiment provides a Portal authentication page intelligent detection method, applied to a relay device. By implementing a series of cooperative technical steps on the relay device side, active detection of high compatibility and high reliability of the public network Portal authentication page is realized, and a stable and terminal device-independent authentication guide entry is provided for users, thereby systematically solving the double technical problems of inherent detection reliability and poor interaction compatibility in the prior art, which are dependent on the terminal side. The method comprises the following steps: S1, when the relay device is connected to the target WiFi network, sequentially initiates HTTP requests to at least two preset reference probe URLs belonging to different service providers.
[0024] In specific implementation, when the relay device successfully connects to the target WiFi network, the probe process is started. First, in a predetermined order, HTTP requests are sequentially initiated to at least two preset reference probe URLs. These reference probe URLs belong to different service providers, aiming to obtain network status information from multiple independent sources.
[0025] In the embodiment of the present application, when the relay device is connected to the target WiFi network, HTTP requests are sequentially initiated to at least two reference probe URLs belonging to different service providers. This initial step of multi-source reference probe constitutes the first guarantee to improve the reliability of the probe. The principle is that different service providers usually have their own independent network connectivity detection service endpoints. By sending probe requests to multiple such heterogeneous endpoints, the overall probe failure caused by the target Portal server "passing" only for the probe address of a certain brand or ecosystem is effectively avoided. Even if a certain probe URL is passed and returns a successful response, other probe URLs may still trigger the real redirection behavior of the Portal server, thereby significantly reducing the risk of false negatives due to the failure of a single probe path.
[0026] In some preferred embodiments, the at least two preset reference probe URLs include probe service addresses corresponding to different operating systems or network service ecosystems, respectively.
[0027] In specific implementation, the at least two preset reference probe URLs are specifically configured as standard network connectivity probe service addresses corresponding to different operating systems or network service ecosystems, respectively. For example, one of the reference probe URLs can be a standard probe address widely adopted by Apple's operating system, and the other reference probe URL can be a standard probe address widely adopted by Microsoft's Windows operating system or related services. These addresses are recognized service endpoints for devices in the corresponding ecosystem to determine whether the network is restricted. The relay device is configured with a list of typical probe service addresses from different ecosystems when it is configured. When executing the probe process, requests are sequentially initiated to these addresses in the list. By using these widely representative and well-known probe addresses, it is ensured that the probe request can cover the common detection path in the mainstream network environment.
[0028] S2, analyzing the status code of the HTTP response of the HTTP request of each reference probe URL, if the status code of the HTTP response is a status code indicating redirection, it is determined that there is a Portal authentication page, and the jump address is extracted from the header of the HTTP response returning the status code indicating redirection as the Portal authentication page address.
[0029] In the implementation, the returned HTTP response of each reference probe URL request is analyzed. The first step of the analysis is to check the status code of the HTTP response. If the received HTTP response status code belongs to the status code indicating redirection, such as the status code of the 3xx series, it is determined that there is a Portal authentication page in the current network. Then, the value of the Location field in the header information of the HTTP response returning this redirection status code is extracted, which is the jump address of the Portal authentication page.
[0030] In the embodiment of the application, the priority analysis of the HTTP response status code of each reference probe URL request is performed to quickly and accurately capture the standard Portal redirection signal. If the analysis finds that the HTTP response status code is a clear redirection indicating status code, such as 301 or 302, it is directly determined that there is a Portal authentication page, and the jump address is immediately extracted from the header of the response. This step uses the standard semantics of the HTTP protocol, can efficiently process the Portal server response that follows the conventional redirection specification, is the most direct and low processing overhead path in the detection process, and ensures the detection efficiency under the standard condition.
[0031] In some preferred embodiments, the redirection indicating status code includes 301, 302, 303 and 307 status codes.
[0032] In the implementation of the HTTP protocol, the status code is used to represent the processing result of the server to the request. In the embodiment, it is specifically provided that the redirection indicating status code includes 301, 302, 303 and 307 status codes. In the code implementation of the relay device, a status code judgment condition is set. After receiving the HTTP response to the reference probe URL, the status code value is extracted, and it is checked whether the value is equal to any one of 301, 302, 303 or 307. If matched, the redirection determination process is immediately triggered. For example, the conditional judgment statement is used: if (statusCode == 301 || statusCode == 302 || statusCode == 303 || statusCode == 307) { / / execute redirection processing logic}. This clearly defines the range of status codes that are considered as valid Portal redirection signals, so that the determination logic is clear and unambiguous.
[0033] S3, if the HTTP response of the HTTP request of any reference probe URL is a success status code, and the content of the HTTP response does not match the preset success identification content, parsing the HTML content of the HTTP response to find and extract the URL indicated by the jump instruction embedded by the HTML tag or script language, if the URL is successfully extracted, it is determined that there is a Portal authentication page, and the extracted URL is taken as the Portal authentication page address.
[0034] In a specific implementation, if the HTTP response status code of a certain reference probe URL is a success status code, for example, 200, the content of the HTTP response is further compared with the internally stored preset success identification content. The preset success identification content is, for example, a specific text string. If the response content matches the preset success identification content, it is determined that the network is normal and no authentication is required. If the response content does not match the preset success identification content, it indicates that the response is not a simple success response, and may contain hidden jump information. At this time, the HTML content of the HTTP response is parsed. The purpose of parsing is to find the page jump instruction embedded by the meta-refresh tag or JavaScript script language in the HTML code, and try to extract the target URL indicated by the instruction. If a valid URL is successfully extracted from the HTML content, it is also determined that there is a Portal authentication page, and the extracted URL is taken as the Portal authentication page address.
[0035] In the embodiment of the present application, when the HTTP response status code is a success status code but the response content does not match the preset success identifier content, the method enters a deep analysis phase. The preset success identifier content is usually a specific characteristic text returned by each reference probe URL when the network is truly unblocked. Through content comparison, the real network success response and the response tampered or released by the server can be distinguished. When the content is found to be mismatched, it means that the server may return an HTML page that looks successful but actually contains a jump instruction. At this time, the method actively finds and extracts the URL indicated by the jump instruction embedded in the HTML tag or script language by analyzing the HTML content of the HTTP response. This step is crucial because it can identify and handle a large number of non-standard or in-page jump technology Portal implementations for compatibility considerations. For example, by parsing the content attribute of the meta-refresh tag or scanning the assignment of the location.href attribute in the JavaScript code, the hidden authentication page address can be extracted from a normal page with a status code of 200. This deep analysis capability greatly expands the range of Portal page types that the relay device can identify, overcoming the limitations of relying solely on HTTP status codes for judgment, making the detection scheme have strong compatibility to deal with diversified and non-standard Portal deployment scenarios.
[0036] In some preferred embodiments, the preset success identifier content includes a response body containing a preset specific success text.
[0037] In a specific implementation, the relay device internally stores a success identifier template for comparing response content. The preset success identifier content is specifically defined as an HTTP response body containing a specific success text. For example, for a certain reference probe URL, its expected success response body may contain the text string "Success" or "Microsoft Connect Test". In the judgment process, when an HTTP response with a status code of 200 is received, the entire response body content is extracted, and it is checked whether it contains the preset specific success text in its entirety. This is usually achieved through string searching or matching functions. Only when the response body content contains these preset success texts, the response is considered to be a real success response, indicating that the network is unblocked without Portal. If the status code is 200 but the specific text cannot be found in the response body, it is determined that the content is mismatched, and the subsequent HTML deep analysis process is triggered.
[0038] In some preferred embodiments, the parsing the HTML content of the HTTP response to find and extract the URL indicated by the jump instruction embedded in the HTML tag or script language, comprises: scanning a meta-refresh tag in the HTML content, wherein the http-equiv attribute value of the meta-refresh tag is "refresh"; parsing the content attribute value of the meta-refresh tag, and extracting the subsequent string prefixed with "url=" or "URL=" from the content attribute value as the jump target address.
[0039] In a specific implementation, when the HTML content of the HTTP response needs to be parsed, a scanning process of the meta-refresh tag is first started. An HTML parser is used to traverse the entire HTML document object model to find all meta tags. For each meta tag, it is checked whether the value of its http-equiv attribute is equal to the string refresh. When a meta tag with the http-equiv attribute value of refresh is located, the content attribute value of the tag is read. The content attribute value usually contains a time parameter and a jump address, in the format of "5;url=http: / / example.com / login". Then the content attribute value is parsed to find a segment prefixed with the substring url= or URL=. Once such a prefix is found, all characters after the prefix are extracted until a semicolon or the end of the string is encountered, and the extracted string is identified as the jump target address. For example, the position of "url=" is located by a string processing function, and then the part after it is truncated.
[0040] The embodiment provides a standardized and operable specific solution for parsing the Meta Refresh jump instruction from an HTML response. Meta Refresh is a traditional and common technical means for implementing automatic jump of a web page, and is particularly used in some Portal pages. By accurately scanning the meta tag with a specific attribute (http-equiv="refresh") and parsing the content attribute according to the conventional format ("url="), the method can accurately and reliably peel off the hidden page redirection intention from the seemingly normal successful HTTP 200 response. This effectively solves the detection problem caused by the fact that some Portal servers do not use the standard HTTP redirection status code, but return an HTML page containing a refresh instruction to implement jump, and significantly enhances the compatibility and recognition ability of the relay device to non-standard or old Portal implementation modes.
[0041] In some preferred embodiments, the parsing the HTML content of the HTTP response to find and extract the URL indicated by the jump instruction embedded in the HTML tag or script language includes: scanning script tags in the HTML content and JavaScript code within the tags; identifying assignment statements in the JavaScript code for modifying browser addresses, wherein the assignment statements include assignment to window.location.href, window.location.replace, or location.href attributes; and extracting a URL string assigned in the assignment statements as a jump target address.
[0042] In a specific implementation, the identification of JavaScript jump code is performed synchronously when parsing the HTML content. First, all script tags in the HTML document are scanned. For each script tag that is not externally referenced (i.e., a tag containing inline code), the JavaScript code text within the tag is extracted. Then, the code text is analyzed to identify whether it contains specific assignment statements for modifying browser window addresses. The target objects of these assignment statements usually include window.location.href, window.location.replace, or location.href.
[0043] In the embodiments of the present application, these patterns can be found by simple string matching or regular expressions, such as finding code fragments matching "location.href\s*=\s*[‘\“]". When such an assignment statement is identified, the value assigned in the statement, i.e., the string constant on the right side of the equal sign (usually enclosed in quotation marks), is further extracted. The extracted URL string is identified as the jump target address performed by the script.
[0044] The embodiment provides a specific technical means for identifying a JavaScript jump instruction, and greatly expands the coverage of Portal page detection. Modern web pages use JavaScript to implement dynamic interaction, and many Portal pages also use JavaScript for redirection control. This method is more flexible and common than Meta Refresh. By accurately scanning script tags and locating specific address assignment statements, the method can penetrate the JavaScript code layer and directly capture the final URL intended to jump. This solves the problem that Portal pages use client-side scripts for redirection and cannot be discovered by analyzing the HTTP protocol layer or simple HTML tags. In combination with Meta Refresh analysis, the embodiment enables the relay device to have the ability to handle most non-standard redirection schemes based on HTML / JavaScript technology, thereby achieving higher probability of successful detection of Portal authentication pages.
[0045] S4, the obtained Portal authentication page address is displayed to the user through the Web management interface of the relay device.
[0046] In specific implementation, whether the Portal authentication page address is directly extracted through the redirection status code or indirectly extracted by analyzing the HTML content, once the Portal authentication page address is obtained, the relay device displays the address to the user in the local Web management interface in a proper manner.
[0047] In the embodiment of the application, no matter which path is used to obtain the Portal authentication page address, the address is displayed to the user through the Web management interface of the relay device. This step extends the technical effect from pure "detection" to "guidance", forming a complete solution. The core principle is that the Web management interface of the relay device is a stable, controllable and user terminal device model, operating system and browser application independent interaction platform. By explicitly displaying the authentication address (for example, in the form of a clickable hyperlink) on the interface, the method creates a deterministic and 100% accessible authentication trigger entry for the user. This fundamentally avoids the second problem described in the background art, that is, the failure of the terminal device to automatically pop up the authentication page due to system differences, browser compatibility or manufacturer customization strategies. The user does not need to rely on the unreliable detection and pop-up mechanism of the terminal itself, but only needs to access the fixed management page of the relay device to actively initiate the authentication process, thereby ensuring the success of the authentication guidance link.
[0048] The embodiment effectively improves the compatibility and reliability of the Portal authentication page discovery by performing multi-source detection and multi-layer analysis on the relay device side. First, requests are initiated to multiple reference detection URLs belonging to different service providers, reducing the risk of complete detection failure caused by individual Portal servers releasing a single brand detection address, as servers are unlikely to release all detection requests from different sources. Second, the method not only relies on standard HTTP redirection responses, but also performs deep HTML analysis on responses that return a successful status code but do not match the content, enabling identification of Portal pages that use non-standard redirection methods such as Meta Refresh or JavaScript jump, thereby expanding the scope of the detectable network. Finally, placing the detection and judgment logic on the relay device side for execution eliminates the dependence of the Portal discovery process on the system implementation of the user terminal device, laying the foundation for providing a stable and unified authentication entry for subsequent use and avoiding detection failure caused by terminal system differences or compatibility issues.
[0049] In some preferred embodiments, the obtained Portal authentication page address is displayed to the user through the Web management interface of the relay device, including generating and presenting a prompt information in the Web management interface, and embedding the Portal authentication page address in the prompt information to form a clickable hyperlink.
[0050] In specific implementation, when the relay device obtains a valid Portal authentication page address, its Web management interface module is responsible for performing the display operation. The specific process includes two steps. First, the interface module dynamically generates a text prompt information in a specific area of the Web management interface, such as the relay status page or the function setting page, and presents it to the user. The prompt information is used to inform the user that the current network needs authentication, for example, it is displayed as "Detecting network authentication, please complete login". Second, the interface module integrates the obtained Portal authentication page address with the prompt information. Technically, the address is usually taken as the href attribute value of the hyperlink, and part of the text in the prompt information (such as "click here") is taken as the display text of the hyperlink, so as to render a clickable hyperlink element on the webpage. When the user accesses the management IP address of the relay device through the browser, he can see the prompt and link.
[0051] The embodiment defines a specific interaction scheme for providing a deterministic authentication portal on the relay device side, which is the key to solving the terminal dependency problem. By displaying the Portal address in the form of an explicit prompt and clickable hyperlink in the stable and unified Web management interface of the relay device itself, the method creates a general and reliable authentication trigger point for users that does not depend on the terminal device model, operating system or browser application. Whether the user's mobile phone or computer itself can detect the Portal or automatically pop up a window, the user can actively initiate the authentication process by accessing this fixed management page (usually a local IP address). This completely bypasses all uncertainties caused by terminal-side software compatibility, transfers the starting right and control right of the authentication process from the terminal side where the interruption may occur to the stable and controllable network side device, and ensures the integrity and certainty of the user experience process.
[0052] Further, in the embodiment of the present application, the specific logic for determining that the current network does not exist a Portal authentication page is as follows: after the relay device completes the HTTP request and response analysis of all pre-set reference detection URLs, if none of the determination conditions for the existence of a Portal authentication page is triggered, a final determination is performed. Specifically, the logic requires that all the following conditions be met: first, the HTTP request initiated for each reference detection URL returns an HTTP response status code that is not a status code indicating redirection; second, for the HTTP responses with a status code indicating success, the response contents all match the pre-set success identifier content, indicating that the network connection is smooth and there is no authentication intervention; finally, for the case where the response content does not match the pre-set success identifier content, although the HTML content analysis process is triggered, no URL indicated by any valid jump instruction embedded in the HTML tag or script language is successfully found and extracted in the HTML content after analysis. Only when all the above detection and analysis paths do not find any evidence of the existence of a Portal authentication page, the network detection module finally outputs the determination conclusion, confirming that the current network does not exist a Portal authentication page.
[0053] The embodiment of the present application provides a portal authentication page intelligent detection method, which is applied to a relay device, and the method comprises the following steps: after the relay device is connected to a target WiFi network, HTTP requests are sequentially initiated to at least two benchmark detection URLs which are pre-set and belong to different service providers; the status code of the HTTP response of the HTTP request of each benchmark detection URL is analyzed; if the status code of the HTTP response is a status code indicating redirection, it is determined that there is a portal authentication page, and a jump address is extracted from the header of the HTTP response as a portal authentication page address; if the status code of the HTTP response of the HTTP request of any benchmark detection URL is a successful status code, and the content of the HTTP response does not match the pre-set successful identification content, the HTML content of the HTTP response is parsed to find and extract a URL indicated by a jump instruction embedded by an HTML tag or a script language, if the URL is successfully extracted, it is determined that there is a portal authentication page, and the extracted URL is taken as the portal authentication page address; and the obtained portal authentication page address is displayed to a user through a Web management interface of the relay device. The present application fundamentally solves the reliability and compatibility problems caused by terminal detection by implementing multi-source detection and multi-layer analysis on the relay device side. The method firstly initiates a request to multiple heterogeneous benchmark URLs to reduce the risk of missing a single URL being released; the standard redirection can be directly captured by analyzing the response status code, and the response with a successful status code but inconsistent content is subjected to HTML deep analysis, so that a non-standard portal page which realizes jump through Meta Refresh or JavaScript is identified, and the detection compatibility is greatly expanded. Finally, the obtained authentication address provides a clickable entry in the unified Web management interface of the relay device, and a deterministic authentication guide path independent of the terminal model and system is created for the user, and the 100% accessibility of the authentication process is ensured.
[0054] Corresponding to the portal authentication page intelligent detection method, the present application further provides a portal authentication page intelligent detection device. The portal authentication page intelligent detection device comprises units for executing the portal authentication page intelligent detection method, and the portal authentication page intelligent detection device can be configured in a terminal or a server. Specifically, the portal authentication page intelligent detection device comprises: The initiation unit is configured to initiate HTTP requests to at least two benchmark detection URLs which are pre-set and belong to different service providers in sequence after the relay device is connected to a target WiFi network; The analysis unit is configured to analyze a status code of an HTTP response of an HTTP request of each reference probe URL, and if the status code of the HTTP response is a status code indicating redirection, it is determined that there is a Portal authentication page, and a jump address is extracted from a header of the HTTP response returning the status code indicating redirection as a Portal authentication page address. The parsing unit is configured to, if the status code of the HTTP response of the HTTP request of any reference probe URL is a success status code, and the content of the HTTP response does not match a preset success identification content, parse HTML content of the HTTP response to find and extract a URL indicated by a jump instruction embedded by an HTML tag or a script language, and if the URL is successfully extracted, it is determined that there is a Portal authentication page, and the extracted URL is taken as the Portal authentication page address. The display unit is configured to display the obtained Portal authentication page address to a user through a Web management interface of the relay device.
[0055] In some preferred embodiments, the at least two preset reference probe URLs include probe service addresses corresponding to different operating systems or network service ecosystems respectively.
[0056] In some preferred embodiments, the status code indicating redirection includes 301, 302, 303 and 307 status codes.
[0057] In some preferred embodiments, the parsing of the HTML content of the HTTP response to find and extract the URL indicated by the jump instruction embedded by the HTML tag or the script language includes: scanning a meta-refresh tag in the HTML content, wherein an http-equiv attribute value of the meta-refresh tag is “refresh”; parsing a content attribute value of the meta-refresh tag, and extracting a subsequent string prefixed with “url=” or “URL=” from the content attribute value as a jump target address.
[0058] In some preferred embodiments, the parsing of the HTML content of the HTTP response to find and extract the URL indicated by the jump instruction embedded by the HTML tag or the script language includes: scanning a script tag and JavaScript code in the tag in the HTML content; identifying an assignment statement in the JavaScript code for modifying a browser address, wherein the assignment statement comprises an assignment to a window.location.href, window.location.replace or location.href attribute; extracting a URL string assigned from the assignment statement as a jump target address.
[0059] In some preferred embodiments, the presenting the obtained Portal authentication page address to the user through the web management interface of the relay device comprises: generating and presenting a prompt information in the web management interface; embedding the Portal authentication page address in the prompt information to form a clickable hyperlink.
[0060] In some preferred embodiments, the preset success identification content comprises a response body containing a preset specific success text.
[0061] It should be noted that the specific implementation process of the Portal authentication page intelligent detection device and each unit can be clearly understood by those skilled in the art, which can be referred to the corresponding description in the foregoing method embodiments. For the convenience and brevity of description, it will not be repeated here.
[0062] The Portal authentication page intelligent detection device described above can be implemented in the form of a computer program, which can run on a computer device as shown in the computer device. Figure 2
[0063] Please refer to Figure 2 , Figure 2 is a schematic block diagram of a computer device provided by an embodiment of the present application. The computer device 500 can be a terminal or a server, wherein the server can be a standalone server or a server cluster composed of multiple servers.
[0064] The computer device 500 includes a processor 502, a memory and a network interface 505 connected through a system bus 501, wherein the memory can include a non-volatile storage medium 503 and an internal memory 504.
[0065] The non-volatile storage medium 503 can store an operating system 5031 and a computer program 5032. When the computer program 5032 is executed, it can make the processor 502 execute a Portal authentication page intelligent detection method.
[0066] The processor 502 is configured to provide computing and control capabilities to support the operation of the entire computer device 500.
[0067] The internal memory 504 provides an environment for the running of the computer program 5032 in the non-volatile storage medium 503, which, when executed by the processor 502, can cause the processor 502 to perform a Portal authentication page intelligent detection method.
[0068] The network interface 505 is used for network communication with other devices. Those skilled in the art can understand that the above structure is only a block diagram of part of the structure related to the scheme of the present application, and does not constitute a limitation on the computer device 500 to which the scheme of the present application is applied. The specific computer device 500 can include more or fewer components than those shown in the figure, or combine certain components, or have a different arrangement of components.
[0069] The processor 502 is configured to run the computer program 5032 stored in the memory to implement the following steps: When the relay device is connected to the target WiFi network, sequentially initiate HTTP requests to at least two reference detection URLs belonging to different service providers and pre-set; Analyze the status code of the HTTP response of the HTTP request to each reference detection URL. If the status code of the HTTP response is a status code indicating redirection, it is determined that there is a Portal authentication page, and a jump address is extracted from the header of the HTTP response returning the status code indicating redirection as a Portal authentication page address; If the status code of the HTTP response of the HTTP request to any reference detection URL is a success status code, and the content of the HTTP response does not match the pre-set success identification content, parse the HTML content of the HTTP response to find and extract a URL indicated by a jump instruction embedded by an HTML tag or a script language. If the URL is successfully extracted, it is determined that there is a Portal authentication page, and the extracted URL is taken as a Portal authentication page address; The obtained Portal authentication page address is displayed to the user through the Web management interface of the relay device.
[0070] In some preferred embodiments, the at least two pre-set reference detection URLs include detection service addresses corresponding to different operating systems or network service ecosystems, respectively.
[0071] In some preferred embodiments, the status code indicating redirection includes 301, 302, 303, and 307 status codes.
[0072] In some preferred embodiments, the parsing the HTML content of the HTTP response to find and extract the URL indicated by the jump instruction embedded in the HTML tag or script language comprises: scanning a meta-refresh tag in the HTML content, wherein the http-equiv attribute value of the meta-refresh tag is "refresh"; parsing a content attribute value of the meta-refresh tag, and extracting a subsequent string prefixed with "url=" or "URL=" from the content attribute value as the jump target address.
[0073] In some preferred embodiments, the parsing the HTML content of the HTTP response to find and extract the URL indicated by the jump instruction embedded in the HTML tag or script language comprises: scanning a script tag and JavaScript code in the tag in the HTML content; identifying an assignment statement for modifying a browser address contained in the JavaScript code, wherein the assignment statement comprises an assignment to a window.location.href, window.location.replace, or location.href attribute; extracting a URL string assigned from the assignment statement as the jump target address.
[0074] In some preferred embodiments, the displaying the obtained Portal authentication page address to the user through the Web management interface of the relay device comprises: generating and presenting a prompt information in the Web management interface; embedding the Portal authentication page address in the prompt information to form a clickable hyperlink.
[0075] In some preferred embodiments, the preset success identifier content comprises a response body containing a preset specific success text.
[0076] It should be understood that, in the embodiments of the present application, the processor 502 can be a central processing unit (CPU), and can also be other general-purpose processors, digital signal processors (DSP), application specific integrated circuits (ASIC), field-programmable gate arrays (FPGA) or other programmable logic devices, discrete gates or transistor logic devices, discrete hardware components, etc. The general-purpose processor can be a microprocessor or any conventional processor.
[0077] It can be understood by those skilled in the art that all or part of the processes in the above-mentioned embodiments can be completed by a computer program instructing related hardware. The computer program can be stored in a storage medium, which is a computer-readable storage medium. The computer program is executed by at least one processor in the computer system to implement the process steps of the above-mentioned embodiments.
[0078] Therefore, the present application also provides a storage medium. The storage medium can be a computer-readable storage medium. The storage medium stores a computer program. The computer program is executed by a processor to make the processor perform the following steps: When the relay device is connected to the target WiFi network, HTTP requests are initiated to at least two reference probe URLs belonging to different service providers and preset in sequence; The status code of the HTTP response of the HTTP request to each reference probe URL is analyzed. If the status code of the HTTP response is a status code indicating redirection, it is determined that there is a Portal authentication page, and a jump address is extracted from the header of the HTTP response returning the status code indicating redirection as a Portal authentication page address; If the status code of the HTTP response of the HTTP request to any reference probe URL is a success status code, and the content of the HTTP response does not match the preset success identification content, the HTML content of the HTTP response is parsed to find and extract a URL indicated by a jump instruction embedded by an HTML tag or a script language. If the URL is successfully extracted, it is determined that there is a Portal authentication page, and the extracted URL is taken as a Portal authentication page address; The obtained Portal authentication page address is displayed to a user through a Web management interface of the relay device.
[0079] In some preferred embodiments, the at least two pre-set reference probe URLs include probe service addresses corresponding to different operating systems or web service ecosystems, respectively.
[0080] In some preferred embodiments, the status code indicating redirection includes 301, 302, 303 and 307 status codes.
[0081] In some preferred embodiments, the parsing the HTML content of the HTTP response to find and extract a URL indicated by a jump instruction embedded in the HTML tag or script language includes: scanning a meta-refresh tag in the HTML content, wherein an http-equiv attribute value of the meta-refresh tag is “refresh”; parsing a content attribute value of the meta-refresh tag, and extracting a subsequent string prefixed with “url=” or “URL=” in the content attribute value as a jump target address.
[0082] In some preferred embodiments, the parsing the HTML content of the HTTP response to find and extract a URL indicated by a jump instruction embedded in the HTML tag or script language includes: scanning a script tag and JavaScript code in the tag in the HTML content; identifying an assignment statement for modifying a browser address in the JavaScript code, wherein the assignment statement includes an assignment to a window.location.href, window.location.replace or location.href attribute; extracting a URL string assigned in the assignment statement as a jump target address.
[0083] In some preferred embodiments, the presenting the obtained Portal authentication page address to the user through the web management interface of the relay device includes: generating and presenting a prompt information in the web management interface; embedding the Portal authentication page address in the prompt information to form a clickable hyperlink.
[0084] In some preferred embodiments, the pre-set success identification content includes a response body including a pre-set specific success text.
[0085] The storage medium is a physical, non-transient storage medium, for example, can be a U disk, a mobile hard disk, a read-only memory (ROM), a magnetic disk or an optical disk, and various physical storage media that can store program codes. The computer-readable storage medium can be non-volatile or volatile.
[0086] Those skilled in the art can realize that the units and algorithm steps of each example described in combination with the embodiments disclosed herein can be realized in electronic hardware, computer software or a combination of both. In order to clearly illustrate the interchangeability of hardware and software, the components and steps of each example have been described in the above description in a general manner. Whether the functions are performed in hardware or software depends on the specific application and design constraints of the technical solution. A person skilled in the art can use different methods to implement the described functions for each specific application, but such implementation should not be considered beyond the scope of the present application.
[0087] In several embodiments provided by the present application, it should be understood that the disclosed devices and methods can be implemented in other ways. For example, the device embodiments described above are only schematic. For example, the division of each unit is only a logical function division, and actual implementation can have another division manner. For example, a plurality of units or components can be combined or integrated into another system, or some features can be ignored or not executed.
[0088] The steps in the method embodiments of the present application can be adjusted, combined and deleted in sequence according to actual needs. The units in the device embodiments of the present application can be combined, divided and deleted according to actual needs. In addition, each functional unit in each embodiment of the present application can be integrated in one processing unit, or each unit can exist physically, or two or more units can be integrated in one unit.
[0089] The integrated unit, if realized in the form of a software functional unit and sold or used as an independent product, can be stored in a storage medium. Based on such understanding, the technical solutions of the present application essentially or the part that contributes to the prior art, or the whole or part of the technical solutions can be embodied in the form of a software product. The computer software product is stored in a storage medium, including a plurality of instructions for causing a computer device (which can be a personal computer, a terminal or a network device, etc.) to execute all or part of the steps of the methods described in each embodiment of the present application.
[0090] In the above embodiments, the description of each embodiment has its own emphasis, and the parts not described in detail in a certain embodiment can be referred to the related description of other embodiments.
[0091] It will be apparent to those skilled in the art that various modifications and variations can be made to the present application without departing from the spirit or scope of the application. Thus, it is intended that the present application cover modifications and variations of this application provided they come within the scope of the appended claims and their equivalents.
[0092] The above description is merely that of the preferred embodiments of the application, but the protection scope of the application is not limited to this. Any modification or replacement within the technical range disclosed by the application can be easily thought of by those skilled in the art, and these modifications or replacements should be covered in the protection scope of the application. Therefore, the protection scope of the application should be subject to the protection scope of the claims.
Claims
1. A Portal authentication page intelligent detection method, characterized in that, The method is applied to a relay device, and comprises the following steps: After the relay device is connected to a target WiFi network, HTTP requests are sequentially initiated to at least two preset reference probe URLs belonging to different service providers; The status code of the HTTP response of the HTTP request to each reference probe URL is analyzed, if the status code of the HTTP response is a status code indicating redirection, it is determined that there is a Portal authentication page, and a jump address is extracted from the header of the HTTP response returning the status code indicating redirection as the Portal authentication page address; If the status code of the HTTP response of the HTTP request to any reference probe URL is a success status code, and the content of the HTTP response does not match the preset success identification content, the HTML content of the HTTP response is parsed to find and extract a URL indicated by a jump instruction embedded by an HTML tag or a script language, if the URL is successfully extracted, it is determined that there is a Portal authentication page, and the extracted URL is taken as the Portal authentication page address; The obtained Portal authentication page address is displayed to a user through a Web management interface of the relay device. 2.The Portal authentication page intelligent detection method according to claim 1, characterized in that, The at least two preset reference probe URLs include probe service addresses corresponding to different operating systems or network service ecosystems respectively. 3.The Portal authentication page intelligent detection method according to claim 1, characterized in that, The status code indicating redirection includes 301, 302, 303 and 307 status codes. 4.The Portal authentication page intelligent detection method according to claim 1, characterized in that, The parsing of the HTML content of the HTTP response to find and extract a URL indicated by a jump instruction embedded by an HTML tag or a script language comprises the following steps: A meta-refresh tag in the HTML content is scanned, wherein an http-equiv attribute value of the meta-refresh tag is "refresh"; A content attribute value of the meta-refresh tag is parsed, and a subsequent string prefixed with "url=" or "URL=" in the content attribute value is extracted as a jump target address.
5. The method of intelligent probing of a portal authentication page of claim 1, wherein, The parsing of the HTML content of the HTTP response to find and extract a URL indicated by a jump instruction embedded by an HTML tag or a script language comprises the following steps: A script tag and JavaScript code in the tag in the HTML content are scanned; An assignment statement in the JavaScript code for modifying a browser address is identified, wherein the assignment statement includes an assignment to a window.location.href, window.location.replace or location.href attribute; A URL string assigned in the assignment statement is extracted as a jump target address.
6. The method of intelligent probing of a portal authentication page of claim 1, wherein, The display of the obtained Portal authentication page address to the user through the Web management interface of the relay device comprises the following steps: A prompt information is generated and presented in the Web management interface; The Portal authentication page address is embedded in the prompt information to form a clickable hyperlink.
7. The method of intelligent probing of a portal authentication page of claim 1, wherein, The preset success identification content includes a response body containing preset specific success text.
8. A Portal authentication page intelligent detection device, characterized in that, The computer device comprises a memory and a processor, the memory stores a computer program, and the processor executes the computer program to implement the method in any one of claims 1-7.
9. A computer device, comprising: The storage medium stores a computer program, and the computer program can implement the method in any one of claims 1-7 when executed by the processor.
10. A computer-readable storage medium, characterized in that,