HK1244613B - Method and apparatus for detecting wireless network type, and electronic device - Google Patents
Method and apparatus for detecting wireless network type, and electronic device Download PDFInfo
- Publication number
- HK1244613B HK1244613B HK18103911.0A HK18103911A HK1244613B HK 1244613 B HK1244613 B HK 1244613B HK 18103911 A HK18103911 A HK 18103911A HK 1244613 B HK1244613 B HK 1244613B
- Authority
- HK
- Hong Kong
- Prior art keywords
- network address
- webpage
- wireless network
- password
- page data
- Prior art date
Links
Description
技术领域Technical Field
本说明书涉及通信技术领域,尤其涉及无线网络类型的检测方法、装置及电子设备。This specification relates to the field of communication technology, and in particular to a method, device, and electronic device for detecting wireless network types.
背景技术Background Art
随着移动互联网的发展,电子设备通过WiFi接入无线网络变得越来越频繁,但与此同时,WiFi安全问题也越来越突出。电子设备可能会连接不安全的WiFi 热点,从而导致个人信息泄漏、密码泄露或账户被盗等情况。With the development of mobile internet, electronic devices are increasingly accessing wireless networks via Wi-Fi. However, Wi-Fi security issues are becoming increasingly prominent. Electronic devices may connect to unsecured Wi-Fi hotspots, leading to personal information leakage, password disclosure, or account theft.
由于大多数不安全的WiFi热点都不会设置登录密码,目的是为了方便用户连接,使得更多的用户接入不安全的WiFi热点。因此,目前有较多安全工具类的应用程序,会在电子设备连接WiFi后,检测当前WiFi是否需要密码连接,如果是无密码连接,则会阻止接入该WiFi热点,或者给出安全提示。然而,某些无密码的WiFi连接后,还需要用户进行二次登录验证(二次登录验证是指,设备在连接WiFi热点的时候并不需要密码,但是在访问网络的时候会弹出一个登录界面,需要用户输入用户名和密码才能上网)。Since most unsafe WiFi hotspots do not set login passwords, the purpose is to facilitate user connections, which allows more users to access unsafe WiFi hotspots. Therefore, there are currently many security tool applications that will detect whether the current WiFi connection requires a password after the electronic device is connected to WiFi. If it is a password-free connection, it will prevent access to the WiFi hotspot or give a security prompt. However, after connecting to some password-free WiFi, the user still needs to perform a secondary login verification (secondary login verification means that the device does not require a password when connecting to the WiFi hotspot, but a login interface will pop up when accessing the network, requiring the user to enter the username and password before accessing the Internet).
发明内容Summary of the Invention
基于此,本说明书提供了无线网络类型的检测方法、装置及电子设备。Based on this, this specification provides a method, device, and electronic device for detecting wireless network types.
一种无线网络类型的检测方法,包括:A method for detecting a wireless network type, comprising:
确定当前连接的无线网络在连接时是否需要密码;Determine whether the currently connected wireless network requires a password when connecting;
在确定不需要密码后,根据至少一个设定的网络地址,访问所述设定的网络地址;After determining that a password is not required, accessing the set network address according to at least one set network address;
通过判断所述设定的网络地址能否成功访问,确定所述当前连接的无线网络是否需要二次登录验证。By judging whether the set network address can be successfully accessed, it is determined whether the currently connected wireless network requires secondary login verification.
可选的,所述确定当前连接的无线网络在连接时是否需要密码,包括:Optionally, determining whether the currently connected wireless network requires a password when connecting includes:
调用操作系统提供的无线网络密码管理接口,获取调用结果,根据所述调用结果确定当前连接的无线网络在连接时是否需要密码。The wireless network password management interface provided by the operating system is called to obtain a call result, and whether the currently connected wireless network requires a password when connecting is determined based on the call result.
可选的,所述设定的网络地址包括自定义API接口的网络地址,所述API 接口用于在被访问时返回设定标识信息;Optionally, the set network address includes a network address of a custom API interface, and the API interface is used to return set identification information when being accessed;
所述判断所述设定的网络地址能否成功访问,包括:Determining whether the set network address can be successfully accessed includes:
获取访问所述API接口的网络地址后的访问结果,根据所述访问结果中是否包括所述设定标识信息,确定所述API接口的网络地址能否成功访问。An access result after accessing the network address of the API interface is obtained, and whether the network address of the API interface can be successfully accessed is determined based on whether the access result includes the set identification information.
可选的,所述设定的网络地址至少包括有两个不同的网页的网络地址;Optionally, the set network address includes at least two network addresses of different web pages;
所述判断所述设定的网络地址能否成功访问,包括:Determining whether the set network address can be successfully accessed includes:
获取访问每个所述网页的网络地址后返回的网页的页面数据,通过比较各所述网页的页面数据,判断访问每个所述网页后是否都跳转至二次登录验证页面,进而确定各个所述网页的网络地址能否成功访问。Obtain the page data of the web page returned after accessing the network address of each web page, and by comparing the page data of each web page, determine whether each web page is redirected to the secondary login verification page after accessing it, and then determine whether the network address of each web page can be successfully accessed.
可选的,所述网页的页面数据包括有该网页的网络地址;Optionally, the page data of the web page includes the network address of the web page;
所述通过比较各所述网页的页面数据,判断访问每个所述网页后是否都跳转至二次登录验证页面,包括:The step of comparing the page data of each web page to determine whether each web page is redirected to a secondary login verification page after being accessed includes:
更新每个所述网页的页面数据,所述更新包括将每个所述网页的页面数据中包含的网络地址都删除,或者都替换为统一标识数据;Updating the page data of each web page, wherein the updating includes deleting all network addresses contained in the page data of each web page, or replacing them with unified identification data;
比较各个所述网页的更新后的页面数据是否相同,根据比较结果确定访问每个所述网页后是否都跳转至二次登录验证页面。Compare the updated page data of each web page to see if they are the same, and determine whether to jump to the secondary login verification page after accessing each web page based on the comparison result.
一种无线网络类型的检测装置,包括:A wireless network type detection device, comprising:
连接密码确定模块,用于:确定当前连接的无线网络在连接时是否需要密码;The connection password determination module is used to: determine whether the currently connected wireless network requires a password when connecting;
访问模块,用于:在确定不需要密码后,根据至少一个设定的网络地址,访问所述设定的网络地址;An access module, configured to: after determining that a password is not required, access the set network address according to at least one set network address;
登录验证模块,用于:通过判断所述设定的网络地址能否成功访问,确定所述当前连接的无线网络是否需要二次登录验证。The login verification module is used to determine whether the currently connected wireless network requires secondary login verification by judging whether the set network address can be successfully accessed.
可选的,所述连接密码确定模块,还用于:Optionally, the connection password determination module is further configured to:
调用操作系统提供的无线网络密码管理接口,获取调用结果,根据所述调用结果确定当前连接的无线网络在连接时是否需要密码。The wireless network password management interface provided by the operating system is called to obtain a call result, and whether the currently connected wireless network requires a password when connecting is determined based on the call result.
可选的,所述设定的网络地址包括自定义API接口的网络地址,所述API 接口用于在被访问时返回设定标识信息;Optionally, the set network address includes a network address of a custom API interface, and the API interface is used to return set identification information when being accessed;
所述登录验证模块,还用于:The login verification module is further used to:
获取访问所述API接口的网络地址后的访问结果,根据所述访问结果中是否包括所述设定标识信息,确定所述API接口的网络地址能否成功访问。An access result after accessing the network address of the API interface is obtained, and whether the network address of the API interface can be successfully accessed is determined based on whether the access result includes the set identification information.
可选的,所述设定的网络地址至少包括有两个不同的网页的网络地址;Optionally, the set network address includes at least two network addresses of different web pages;
所述登录验证模块,还用于:The login verification module is further used to:
获取访问每个所述网页的网络地址后返回的网页的页面数据,通过比较各所述网页的页面数据,判断访问每个所述网页后是否都跳转至二次登录验证页面,进而确定各个所述网页的网络地址能否成功访问。Obtain the page data of the web page returned after accessing the network address of each web page, and by comparing the page data of each web page, determine whether each web page is redirected to the secondary login verification page after accessing it, and then determine whether the network address of each web page can be successfully accessed.
可选的,所述网页的页面数据包括有该网页的网络地址;Optionally, the page data of the web page includes the network address of the web page;
所述登录验证模块,还用于:The login verification module is further used to:
更新每个所述网页的页面数据,所述更新包括将每个所述网页的页面数据中包含的网络地址都删除,或者都替换为统一标识数据;Updating the page data of each web page, wherein the updating includes deleting all network addresses contained in the page data of each web page, or replacing them with unified identification data;
比较各个所述网页的更新后的页面数据是否相同,根据比较结果确定访问每个所述网页后是否都跳转至二次登录验证页面。Compare the updated page data of each web page to see if they are the same, and determine whether to jump to the secondary login verification page after accessing each web page based on the comparison result.
一种电子设备,包括:An electronic device, comprising:
处理器;processor;
用于存储处理器可执行指令的存储器;a memory for storing processor-executable instructions;
其中,所述处理器被配置为:Wherein, the processor is configured to:
确定当前连接的无线网络在连接时是否需要密码;Determine whether the currently connected wireless network requires a password when connecting;
在确定不需要密码后,根据至少一个设定的网络地址,访问所述设定的网络地址;After determining that a password is not required, accessing the set network address according to at least one set network address;
通过判断所述设定的网络地址能否成功访问,确定所述当前连接的无线网络是否需要二次登录验证。By judging whether the set network address can be successfully accessed, it is determined whether the currently connected wireless network requires secondary login verification.
本说明书的实施例提供的技术方案可以包括以下有益效果:The technical solutions provided by the embodiments of this specification may have the following beneficial effects:
本说明书的无线网络类型的检测方法,在确定当前连接的无线网络在连接时不需要密码后,进一步会访问所设定的网络地址,通过判断设定的网络地址能否成功访问,若能够成功访问,可确定所述当前连接的无线网络为无密码无线网络,若无法成功访问,则确定为需要二次登录验证的无线网络。本说明书实施例能够准确无误地区分出无密码连接无线网络是否需要进行二次登录验证,能够准确地向用户提醒无线网络的安全风险,减小误判率,减少对用户的打扰。The wireless network type detection method disclosed herein, after determining that the currently connected wireless network does not require a password for connection, further accesses the set network address and determines whether the set network address can be successfully accessed. If so, the currently connected wireless network is determined to be a password-free wireless network. If not, the wireless network is determined to require secondary login verification. The embodiments of this disclosure can accurately distinguish whether a password-free wireless network requires secondary login verification, accurately alerting users to wireless network security risks, reducing false positives and minimizing user disruption.
应当理解的是,以上的一般描述和后文的细节描述仅是示例性和解释性的,并不能限制本说明书。It should be understood that the foregoing general description and the following detailed description are exemplary and explanatory only and are not restrictive of the present disclosure.
附图说明BRIEF DESCRIPTION OF THE DRAWINGS
此处的附图被并入说明书中并构成本说明书的一部分,示出了符合本说明书的实施例,并与说明书一起用于解释本申请的原理。The accompanying drawings, which are incorporated in and constitute a part of this specification, illustrate embodiments consistent with the specification and, together with the description, serve to explain the principles of the application.
图1是本说明书根据一示例性实施例示出的一种电子设备通过WiFi连接无线网络的示意图。FIG1 is a schematic diagram showing an electronic device connecting to a wireless network via WiFi according to an exemplary embodiment of this specification.
图2A是本说明书根据一示例性实施例示出的一种无线网络类型的检测方法的流程图。FIG2A is a flowchart of a method for detecting a wireless network type according to an exemplary embodiment of this specification.
图2B是本说明书根据一示例性实施例示出的一种电子设备中无线网络类型的检测方案示意图。FIG2B is a schematic diagram of a solution for detecting a wireless network type in an electronic device according to an exemplary embodiment of this specification.
图2C是本说明书根据一示例性实施例示出的一种无线网络类型的检测方法的流程图。FIG2C is a flowchart of a method for detecting a wireless network type according to an exemplary embodiment of this specification.
图2D是本说明书根据一示例性实施例示出的一种无线网络类型的检测方法的流程图。FIG2D is a flowchart of a method for detecting a wireless network type according to an exemplary embodiment of this specification.
图3是本说明书无线网络类型的检测装置所在电子设备的一种硬件结构图。FIG3 is a hardware structure diagram of an electronic device where the wireless network type detection device of this specification is located.
图4是本说明书根据一示例性实施例示出的一种无线网络类型的检测装置的框图。FIG4 is a block diagram of a device for detecting a wireless network type according to an exemplary embodiment of this specification.
具体实施方式DETAILED DESCRIPTION
这里将详细地对示例性实施例进行说明,其示例表示在附图中。下面的描述涉及附图时,除非另有表示,不同附图中的相同数字表示相同或相似的要素。以下示例性实施例中所描述的实施方式并不代表与本说明书相一致的所有实施方式。相反,它们仅是与如所附权利要求书中所详述的、本说明书的一些方面相一致的装置和方法的例子。Exemplary embodiments will be described in detail herein, with examples illustrated in the accompanying drawings. In the following description, when referring to the drawings, identical numerals in different figures represent identical or similar elements unless otherwise indicated. The embodiments described in the following exemplary embodiments are not intended to represent all embodiments consistent with this specification. Rather, they are merely examples of apparatus and methods consistent with certain aspects of this specification, as detailed in the appended claims.
在本说明书使用的术语是仅仅出于描述特定实施例的目的,而非旨在限制本说明书。在本说明书和所附权利要求书中所使用的单数形式的“一种”、“所述”和“该”也旨在包括多数形式,除非上下文清楚地表示其他含义。还应当理解,本文中使用的术语“和/或”是指并包含一个或多个相关联的列出项目的任何或所有可能组合。The terms used in this specification are for the purpose of describing specific embodiments only and are not intended to limit this specification. As used in this specification and the appended claims, the singular forms "a," "an," "the," and "the" are intended to include the plural forms as well, unless the context clearly indicates otherwise. It should also be understood that the term "and/or" as used herein refers to and encompasses any and all possible combinations of one or more of the associated listed items.
应当理解,尽管在本说明书可能采用术语第一、第二、第三等来描述各种信息,但这些信息不应限于这些术语。这些术语仅用来将同一类型的信息彼此区分开。例如,在不脱离本说明书范围的情况下,第一信息也可以被称为第二信息,类似地,第二信息也可以被称为第一信息。取决于语境,如在此所使用的词语“如果”可以被解释成为“在……时”或“当……时”或“响应于确定”。It should be understood that although the terms first, second, third, etc. may be used in this specification to describe various information, such information should not be limited to these terms. These terms are merely used to distinguish information of the same type from one another. For example, first information may also be referred to as second information, and similarly, second information may also be referred to as first information without departing from the scope of this specification. Depending on the context, the term "if" as used herein may be interpreted as "when," "when," or "in response to determining."
本说明书实施例中,WiFi是一种允许电子设备连接到一个无线局域网 (WLAN,Wireless LAN)的技术,可以将个人电脑、手持设备(如PDA、手机)等终端以无线方式互相连接。In the embodiments of this specification, WiFi is a technology that allows electronic devices to connect to a wireless local area network (WLAN), which can connect terminals such as personal computers and handheld devices (such as PDAs and mobile phones) to each other wirelessly.
WiFi热点是指能够提供共享网络资源,让其它终端(如手机、笔记本电脑) 通过WiFi连接方式进行联网的设备。例如一个无线路由器,在这个无线路由器的电波覆盖的有效范围都可以采用WiFi连接方式进行无线网络互连,这台无线路由器就被称为一个“WiFi热点”。A WiFi hotspot is a device that provides shared network resources, allowing other devices (such as mobile phones and laptops) to connect to the internet via WiFi. For example, a wireless router is considered a "WiFi hotspot" if it allows wireless connections to any device within its radio coverage area.
WiFi二次登录验证:设备在连接WiFi热点的时候并不需要密码,但是在访问网络的时候会弹出一个登录界面,需要用户输入用户名和密码才能上网。这种登录连接方式称之为“WiFi二次登录验证”。WiFi Secondary Login Verification: While a device doesn't require a password to connect to a WiFi hotspot, a login screen will pop up when accessing the network, requiring the user to enter their username and password. This type of login is called "WiFi Secondary Login Verification."
如图1所示,是本说明书根据一示例性实施例示出的一种电子设备通过 WiFi连接无线网络的示意图,电子设备在连接一无线网络热点时不需要密码即可加入该无线网络,但是,该无线网络在访问Internet时需要二次登录验证,需要用户输入账号和密码,因此并不是实际意义上的无密码WiFi。As shown in Figure 1, this specification shows a schematic diagram of an electronic device connecting to a wireless network via WiFi according to an exemplary embodiment. When connecting to a wireless network hotspot, the electronic device can join the wireless network without a password. However, the wireless network requires secondary login verification when accessing the Internet, requiring the user to enter an account and password. Therefore, it is not a password-free WiFi in the true sense.
本说明书实施例的无线网络类型的检测方案,在确定当前连接的无线网络在连接时不需要密码后,进一步可以访问所设定的网络地址,通过判断设定的网络地址能否成功访问,若能够成功访问,可确定所述当前连接的无线网络为无密码无线网络,若无法成功访问,则确定为需要二次登录验证的无线网络。本说明书实施例能够准确无误地区分出无密码连接无线网络是否需要进行二次登录验证,能够准确地向用户提醒无线网络的安全风险,减小误判率,减少对用户的打扰。接下来对本说明书实施例进行详细说明。The wireless network type detection scheme of the embodiment of this specification, after determining that the currently connected wireless network does not require a password when connecting, can further access the set network address. By judging whether the set network address can be successfully accessed, if it can be successfully accessed, it can be determined that the currently connected wireless network is a password-free wireless network. If it cannot be successfully accessed, it is determined to be a wireless network that requires secondary login verification. The embodiment of this specification can accurately distinguish whether a password-free wireless network connection requires secondary login verification, and can accurately remind users of the security risks of the wireless network, reduce the false positive rate, and reduce disturbances to users. The embodiment of this specification is described in detail below.
如图2A所示,图2A是本说明书根据一示例性实施例示出的一种无线网络类型的检测方法的流程图,包括以下步骤202至206:As shown in FIG2A , FIG2A is a flowchart of a method for detecting a wireless network type according to an exemplary embodiment of this specification, including the following steps 202 to 206:
在步骤202中,确定当前连接的无线网络在连接时是否需要密码。In step 202, it is determined whether the currently connected wireless network requires a password when connecting.
在步骤204中,在确定不需要密码后,根据至少一个设定的网络地址,访问所述设定的网络地址。In step 204, after determining that a password is not required, the set network address is accessed according to at least one set network address.
在步骤206中,通过判断所述设定的网络地址能否成功访问,确定所述当前连接的无线网络是否需要二次登录验证。In step 206, it is determined whether the currently connected wireless network requires secondary login verification by judging whether the set network address can be successfully accessed.
本实施例中的方法可应用于配置有无线网络模块的电子设备中,例如可以是应用于安装在电子设备的应用程序,该应用程序能检测电子设备所接入的无线网络的类型,以根据所检测的类型向用户提供针对无线网络的安全风险提示。本实施例的电子设备可以包括智能手机、平板电脑、个人数字助理或多媒体播放器等等,此类电子设备配置有无线网络模块,能够接入无线网络。如图2B所示,是本说明书根据一示例性实施例示出的一种电子设备中无线网络类型的检测方案示意图。The method in this embodiment can be applied to electronic devices equipped with a wireless network module. For example, it can be applied to an application installed on the electronic device, which can detect the type of wireless network the electronic device is connected to and provide a security risk warning for the wireless network to the user based on the detected type. The electronic devices in this embodiment may include smartphones, tablet computers, personal digital assistants, or multimedia players, etc. Such electronic devices are equipped with a wireless network module and can access a wireless network. As shown in Figure 2B, this specification illustrates a schematic diagram of a wireless network type detection scheme in an electronic device according to an exemplary embodiment.
当电子设备在连接路由器、网关设备或其他网络终端提供的无线网络,应用程序可以通过多种方式确定电子设备连接上无线网络,并且是否需要密码接入。例如,在应用程序具备权限的情况下,可以直接与无线网络模块通信、或者是读取无线网络模块提供的接口等方式确定电子设备接入了无线网络WiFi热点,并确定所接入的无线网络WiFi热点在连接时是否需要密码;在其他例子中,应用程序可能具备权限,而电子设备的操作系统提供有接口,可以通过调用接口后的调用结果进行判断。实际应用中,可以根据电子设备所使用的操作系统、应用程序的厂商所能得到的操作系统的权限、以及操作系统所提供的接口等等多种因素而灵活确定。When an electronic device is connected to a wireless network provided by a router, gateway device, or other network terminal, the application can determine in a variety of ways whether the electronic device is connected to the wireless network and whether a password is required for access. For example, if the application has permission, it can directly communicate with the wireless network module or read the interface provided by the wireless network module to determine whether the electronic device is connected to a wireless network WiFi hotspot, and determine whether the connected wireless network WiFi hotspot requires a password when connected. In other examples, the application may have permission, and the operating system of the electronic device provides an interface, and the judgment can be made based on the call result after calling the interface. In actual applications, it can be flexibly determined based on a variety of factors such as the operating system used by the electronic device, the operating system permissions available to the application manufacturer, and the interface provided by the operating system.
在一个可选的实现方式中,所述确定当前连接的无线网络在连接时是否需要密码,可以包括:In an optional implementation, determining whether the currently connected wireless network requires a password when connecting may include:
调用操作系统提供的无线网络密码管理接口,获取调用结果,根据所述调用结果确定当前连接的无线网络在连接时是否需要密码。The wireless network password management interface provided by the operating system is called to obtain a call result, and whether the currently connected wireless network requires a password when connecting is determined based on the call result.
以安卓(Android)操作系统为例,操作系统提供有针对无线网络模块的无线网络密码管理接口,应用程序可调用该接口,通过调用该接口的调用结果,可以确定当前连接的无线网络在连接时是否需要密码。以下示出了一种调用无线网络管理接口的代码:Taking the Android operating system as an example, the operating system provides a wireless network password management interface for the wireless network module. The application can call this interface and determine whether the currently connected wireless network requires a password when connecting based on the call result of this interface. The following shows a code for calling the wireless network management interface:
其中,WiFiManager.getConfiguredNetworks()表示无线网络密码管理接口,该代码的主要逻辑是检测:Among them, WiFiManager.getConfiguredNetworks() represents the wireless network password management interface. The main logic of this code is to detect:
WiFi热点的WiFiConfiguration.allowedKeyManagement是否包含WiFiConfiguration.KeyMgmt.NONE字段。如果包含,则认为不需要密码,否则认为需要密码。在不需要密码连接无线网络时,调用结果中会包含有 KeyMgmt.NONE字段。Checks whether the WiFiConfiguration.allowedKeyManagement of the WiFi hotspot contains the WiFiConfiguration.KeyMgmt.NONE field. If it does, a password is not required; otherwise, a password is required. When a password is not required to connect to a wireless network, the KeyMgmt.NONE field will be included in the call result.
以iOS操作系统为例,iOS操作系统提供了获取WiFi列表的API(接口名称为NEHotspotNetwork),主要步骤有:向Apple申请开发Network Extension 权限、申请包含Network Extension的描述文件、配置Info.plist、配置 entitlements、iOS获取WiFi列表代码实现、获取WiFi列表回调。Taking iOS as an example, the iOS operating system provides an API for obtaining the WiFi list (interface name is NEHotspotNetwork). The main steps are: apply to Apple for permission to develop Network Extension, apply for a description file containing Network Extension, configure Info.plist, configure entitlements, implement iOS code to obtain the WiFi list, and obtain the WiFi list callback.
在调用NEHotspotNetwork后,NEHotspotNetwork返回的信息包括有:After calling NEHotspotNetwork, the information returned by NEHotspotNetwork includes:
SSID:WiFi名称SSID: WiFi name
BSSID:站点的MAC地址BSSID: MAC address of the station
signalStrength:WiFi信号强度,该值在0.0-1.0之间signalStrength: WiFi signal strength, the value is between 0.0-1.0
secure:网络是否安全(不需要密码接入的WiFi,该值为false)secure: Is the network secure? (If a WiFi connection does not require a password, this value is false)
autoJoined:设备是否自动连接该WiFi。autoJoined: Whether the device automatically connects to the WiFi.
justJoined:网络是否刚刚加入justJoined: Whether the network has just been joined
chosenHelper:HotspotHelper是否为网络的所选助手chosenHelper: Whether HotspotHelper is the chosen helper for the network
因此,通过调用结果中的secure,即可确定当前连接的无线网络WiFi热点是否需要密码。Therefore, by calling the secure method in the result, you can determine whether the currently connected wireless network WiFi hotspot requires a password.
然而,无密码接入无线网络时,某些无线网络还需要用户二次登录验证。因此,本实施例通过预先设定一个或多个网络地址,并通过访问设定的网络地址的方式判断是否需要二次登录验证。假设需要二次登录验证,则还需要用户输入账户和密码之后才可访问Internet。若用户未进行二次登录验证,在电子设备在访问Internet后,无法获得需要的网络数据。基于此,本实施例设定有一个或多个网络地址,访问设定的网络地址后,若能成功访问,则表示所接入的无线网络不需要进行二次登录验证,若不能成功访问,则表示所接入的无线网络需要进行二次登录验证。However, when accessing a wireless network without a password, some wireless networks still require the user to log in twice for verification. Therefore, this embodiment pre-sets one or more network addresses, and determines whether a second login verification is required by accessing the set network address. Assuming that a second login verification is required, the user is also required to enter the account and password before accessing the Internet. If the user does not perform a second login verification, the electronic device will not be able to obtain the required network data after accessing the Internet. Based on this, this embodiment sets one or more network addresses. After accessing the set network address, if the access is successful, it means that the wireless network being accessed does not require a second login verification. If the access is not successful, it means that the wireless network being accessed requires a second login verification.
对于如何确定是否成功访问,实际应用中可以有多种方式。例如,对于设定的网络地址,可以预先配置对应的网络地址的网络数据,在访问设定的网络地址后,获取访问结果,根据访问结果与预先配置的网络数据是否相同,进而确定是否能够成功访问。There are many ways to determine whether access is successful in actual applications. For example, for a set network address, network data corresponding to the network address can be pre-configured. After accessing the set network address, the access result is obtained, and whether the access is successful is determined based on whether the access result is consistent with the pre-configured network data.
本实施例中,所述设定的网络地址包括自定义API接口的网络地址,所述API接口用于在被访问时返回设定标识信息。In this embodiment, the set network address includes a network address of a custom API interface, and the API interface is used to return set identification information when being accessed.
所述判断所述设定的网络地址能否成功访问,包括:Determining whether the set network address can be successfully accessed includes:
获取访问所述API接口的网络地址后的访问结果,根据所述访问结果中是否包括所述设定标识信息,确定所述API接口的网络地址能否成功访问。An access result after accessing the network address of the API interface is obtained, and whether the network address of the API interface can be successfully accessed is determined based on whether the access result includes the set identification information.
本实施例中可以预先在服务器开发有API接口,应用程序可以访问API 接口的网络地址,该网络地址可以是指IP地址。若网络能通,则访问API 接口后可以获得该设定标识信息,若网络不通,则无法获得该设定标识信息,从而可以确定所述API接口的网络地址能否成功访问,确定是否需要二次登录验证。In this embodiment, an API interface may be pre-developed on the server, and the application can access the network address of the API interface, which may be an IP address. If the network is accessible, the application can obtain the set identification information after accessing the API interface. If the network is unavailable, the application cannot obtain the set identification information. This allows the application to determine whether the network address of the API interface is successfully accessible and whether secondary login verification is required.
在另一些例子中,还可以不进行预先开发的工作,网络地址可以是公共的网页的网络地址,可以预先分析该网页的页面内容并存储,确定访问该网页后的访问结果是否包括上述预先存储的页面内容,进而确定是否成功访问。然而,网页页面内容可能会动态变化,因此,本实施例可以设定两个以上的网页的网络地址,以提供更为可靠的判断方式,具体的,本说明书提供如下实施例:In other examples, no pre-development work is required. The network address can be the network address of a public web page. The page content of the web page can be pre-analyzed and stored. After accessing the web page, it is determined whether the access result includes the pre-stored page content, and then whether the access is successful. However, the page content of the web page may change dynamically. Therefore, this embodiment can set the network addresses of more than two web pages to provide a more reliable judgment method. Specifically, this specification provides the following examples:
所述设定的网络地址至少包括两个不同的网页的网络地址。The set network address includes at least two network addresses of different web pages.
所述判断所述设定的网络地址能否成功访问,包括:Determining whether the set network address can be successfully accessed includes:
获取访问每个所述网页的网络地址后返回的网页的页面数据,通过比较各所述网页的页面数据,判断访问每个所述网页后是否都跳转至二次登录验证页面,进而确定所述网页的网络地址能否成功访问。Obtain the page data of the web page returned after accessing the network address of each web page, and by comparing the page data of each web page, determine whether each web page is redirected to the secondary login verification page after accessing it, and then determine whether the network address of the web page can be successfully accessed.
其中,上述网页可以选取已有的两个或两个以上的公共网页,并可以选取页面内容较为简单的网页,以减少数据流量消耗。该网络地址可以包括网页的域名地址或者IP地址。假设网络不通,则访问各个网页后,都将跳转至二次登录验证的网页,则返回的都是二次登录验证的网页的页面数据,返回的页面数据基本上都是相同的。若网络能通,则访问两个或两个以上网页后,返回的是各网页的页面数据,各网页的页面数据应该是不同的。因此,本实施例通过比较各所述网页的页面数据,能够判断访问每个所述网页后是否都跳转至二次登录验证页面,进而确定各个所述网页的网络地址能否成功访问。Among them, the above-mentioned web page can select two or more existing public web pages, and can select a web page with simpler page content to reduce data traffic consumption. The network address can include the domain name address or IP address of the web page. Assuming that the network is not connected, after accessing each web page, it will jump to the web page for secondary login verification, and the page data returned will be the page data of the web page for secondary login verification, and the returned page data are basically the same. If the network is connected, after accessing two or more web pages, the page data of each web page will be returned, and the page data of each web page should be different. Therefore, this embodiment can determine whether it jumps to the secondary login verification page after accessing each of the web pages by comparing the page data of the web pages, and then determine whether the network address of each of the web pages can be successfully accessed.
当向一个网络地址发起访问后可获得该网络地址返回的页面数据,该页面数据中包括有该网页的网络地址,假设网络不同,返回的页面数据包括有二次登录验证页面的页面数据,则除了网络地址之外,其他的页面数据都是相同的。基于此,为了提高判断效率和判断准确性,本实施例中,所述通过比较各所述网页的页面数据,判断访问每个所述网页后是否都跳转至二次登录验证页面,包括:When access is initiated to a network address, page data returned from the network address is obtained. The page data includes the network address of the webpage. Assuming that the network is different, the page data returned includes the page data of the secondary login verification page. In addition to the network address, other page data are the same. Based on this, in order to improve the efficiency and accuracy of judgment, in this embodiment, by comparing the page data of each webpage, it is determined whether the visit to each webpage jumps to the secondary login verification page, including:
更新每个所述网页的页面数据,所述更新包括将每个所述网页的页面数据中包含的网络地址都删除,或者都替换为统一标识数据;Updating the page data of each web page, wherein the updating includes deleting all network addresses contained in the page data of each web page, or replacing them with unified identification data;
比较各个所述网页的更新后的页面数据是否相同,根据比较结果确定访问每个所述网页后是否都跳转至二次登录验证页面。Compare the updated page data of each web page to see if they are the same, and determine whether to jump to the secondary login verification page after accessing each web page based on the comparison result.
本实施例中,将页面数据中的网络地址删除掉,或者是都替换为统一标识数据,之后再比较各个所述网页的更新后的页面数据是否相同,因此可以显著提高比较效率和准确性。In this embodiment, the network addresses in the page data are deleted or replaced with unified identification data, and then the updated page data of each web page are compared to see if they are the same, thereby significantly improving comparison efficiency and accuracy.
接下来再通过两个实施例详细说明本说明书。Next, this specification is described in detail through two embodiments.
如图2C所示,是本说明书根据一示例性实施例示出的一种无线网络类型的检测方法的流程图,图2C以安卓操作系统为例,调用操作系统的无线网络密码管理接口,即WiFiManager.getConfiguredNetworks(),根据调用结果中是否包括WiFiConfiguration.KeyMgmt.NONE字段的基础上进行判断,如果不包含该字段则认为需要密码,立即返回判断结果;如果包含该字段,可以进一步判断当前连接的无线网络WiFi热点是否需要二次登录验证。As shown in Figure 2C, this specification shows a flowchart of a method for detecting a wireless network type according to an exemplary embodiment. Figure 2C takes the Android operating system as an example, calls the operating system's wireless network password management interface, namely WiFiManager.getConfiguredNetworks(), and makes a judgment based on whether the call result includes the WiFiConfiguration.KeyMgmt.NONE field. If the field is not included, it is considered that a password is required and the judgment result is returned immediately; if the field is included, it can be further determined whether the currently connected wireless network WiFi hotspot requires secondary login verification.
具体的,可以在自有服务器上开发一个接口API,该接口API的作用是需返回一个简单的Success标志即可。应用程序直接访问该接口API,如果能收到Success标志,则认为当前连接的无线网络WiFi热点可以直接上网,不需要进行二次登录验证;否则认为需要二次登录验证。Specifically, an API can be developed on a private server that simply returns a success flag. The application directly accesses the API. If it receives a success flag, it assumes that the currently connected WiFi hotspot allows direct internet access, eliminating the need for secondary login verification. Otherwise, secondary login verification is required.
如图2D所示,是本说明书根据一示例性实施例示出的另一种无线网络类型的检测方法的流程图,图2D以安卓操作系统为例,调用操作系统的无线网络密码管理接口,即WiFiManager.getConfiguredNetworks(),根据调用结果中是否包括WiFiConfiguration.KeyMgmt.NONE字段的基础上进行判断,如果不包含该字段则认为需要密码,立即返回判断结果;如果包含该字段,可以进一步判断当前连接的无线网络WiFi热点是否需要二次登录验证。As shown in Figure 2D, this is a flowchart of another wireless network type detection method shown in this specification according to an exemplary embodiment. Figure 2D takes the Android operating system as an example, calls the operating system's wireless network password management interface, namely WiFiManager.getConfiguredNetworks(), and makes a judgment based on whether the call result includes the WiFiConfiguration.KeyMgmt.NONE field. If the field is not included, it is considered that a password is required and the judgment result is returned immediately; if the field is included, it can be further determined whether the currently connected wireless network WiFi hotspot requires secondary login verification.
具体的,相对于图2C中在自有服务器上开发API接口,本实施例可以选取两个简单的知名网站地址(网站页面可以尽量简单,以减少数据流量消耗),假设为网站A(网络地址为url_A)和网站B(网络地址为url_B);然后依次访问网站url_A和网站url_B,分别将它们返回的Response数据保存起来,对应记录为response_A和response_B;最后将response_A与 response_B的内容进行比较。Specifically, compared with developing an API interface on a self-owned server in Figure 2C, this embodiment can select two simple well-known website addresses (the website pages can be as simple as possible to reduce data traffic consumption), assuming they are website A (network address is url_A) and website B (network address is url_B); then visit website url_A and website url_B in turn, and save the Response data returned by them respectively, and record them as response_A and response_B respectively; finally, compare the contents of response_A and response_B.
如果当前连接的无线网络WiFi热点需要进行二次登录验证,则访问网站url_A和网站url_B都会跳转到二次登录验证页面,即response_A与 response_B的内容中包括了相同的二次登录验证页面的页面数据;否则 response_A与response_B将代表不同网站的内容,肯定不同;由此可以判断当前WiFi是否需二次登录验证。If the currently connected wireless network WiFi hotspot requires secondary login verification, accessing website url_A and website url_B will both jump to the secondary login verification page, that is, the content of response_A and response_B includes the same page data of the secondary login verification page; otherwise, response_A and response_B will represent the content of different websites and will definitely be different. This can be used to determine whether the current WiFi hotspot requires secondary login verification.
然而,由于response_A与response_B中包括了对应的网络地址,在进行response_A与response_B对比之前,可以先将网络地址替换为统一标识数据。本实施例中都替换为url_B,因此可以执行response_A.replace(“url_A”, “url_B”),即将response_A中的网址用url_B取代,消除网页数据中不同网址的差异性,从而避免误判,提高判断效率和判断准确性。However, since response_A and response_B contain corresponding network addresses, before comparing response_A and response_B, the network addresses can be replaced with unified identification data. In this embodiment, both are replaced with url_B. Therefore, you can execute response_A.replace("url_A", "url_B") to replace the URL in response_A with url_B. This eliminates the differences between different URLs in the web page data, thereby avoiding misjudgments and improving judgment efficiency and accuracy.
与前述无线网络类型的检测方法的实施例相对应,本说明书还提供了无线网络类型的检测装置及其所应用的电子设备的实施例。Corresponding to the aforementioned embodiments of the method for detecting the type of a wireless network, this specification also provides embodiments of an apparatus for detecting the type of a wireless network and an electronic device to which the apparatus is applied.
本说明书无线网络类型的检测装置的实施例可以应用在电子设备上。装置实施例可以通过软件实现,也可以通过硬件或者软硬件结合的方式实现。以软件实现为例,作为一个逻辑意义上的装置,是通过其所在无线网络类型的检测的处理器将非易失性存储器中对应的计算机程序指令读取到内存中运行形成的。从硬件层面而言,如图3所示,为本说明书无线网络类型的检测装置所在电子设备的一种硬件结构图,除了图3所示的处理器310、内存330、网络接口 320、以及非易失性存储器340之外,实施例中装置331所在的电子设备,通常根据该计算机设备的实际功能,还可以包括其他硬件,对此不再赘述。The embodiments of the detection device of the wireless network type in this specification can be applied to electronic devices. The device embodiment can be implemented by software, or by hardware or a combination of software and hardware. Taking software implementation as an example, as a device in a logical sense, it is formed by the processor of the detection of the wireless network type in which it is located reading the corresponding computer program instructions in the non-volatile memory into the memory for execution. From the hardware level, as shown in Figure 3, it is a hardware structure diagram of the electronic device where the detection device of the wireless network type in this specification is located. In addition to the processor 310, memory 330, network interface 320, and non-volatile memory 340 shown in Figure 3, the electronic device where the device 331 in the embodiment is located can also include other hardware according to the actual function of the computer device, which will not be described in detail.
如图4所示,图4是本说明书根据一示例性实施例示出的一种无线网络类型的检测装置的框图,所述装置包括:As shown in FIG4 , FIG4 is a block diagram of a device for detecting a wireless network type according to an exemplary embodiment of this specification, the device including:
连接密码确定模块41,用于:确定当前连接的无线网络在连接时是否需要密码;The connection password determination module 41 is used to determine whether a password is required when connecting to the currently connected wireless network;
访问模块42,用于:在确定不需要密码后,根据至少一个设定的网络地址,访问所述设定的网络地址;An access module 42 is configured to: after determining that a password is not required, access the set network address according to at least one set network address;
登录验证模块43,用于:通过判断所述设定的网络地址能否成功访问,确定所述当前连接的无线网络是否需要二次登录验证。The login verification module 43 is used to determine whether the currently connected wireless network requires secondary login verification by judging whether the set network address can be successfully accessed.
可选的,所述连接密码确定模块,还用于:Optionally, the connection password determination module is further configured to:
调用操作系统提供的无线网络密码管理接口,获取调用结果,根据所述调用结果确定当前连接的无线网络在连接时是否需要密码。The wireless network password management interface provided by the operating system is called to obtain a call result, and whether the currently connected wireless network requires a password when connecting is determined based on the call result.
可选的,所述设定的网络地址包括自定义API接口的网络地址,所述API 接口用于在被访问时返回设定标识信息;Optionally, the set network address includes a network address of a custom API interface, and the API interface is used to return set identification information when being accessed;
所述登录验证模块,还用于:The login verification module is further used to:
获取访问所述API接口的网络地址后的访问结果,根据所述访问结果中是否包括所述设定标识信息,确定所述API接口的网络地址能否成功访问。An access result after accessing the network address of the API interface is obtained, and whether the network address of the API interface can be successfully accessed is determined based on whether the access result includes the set identification information.
可选的,所述设定的网络地址至少包括有两个不同的网页的网络地址;Optionally, the set network address includes at least two network addresses of different web pages;
所述登录验证模块,还用于:The login verification module is further used to:
获取访问每个所述网页的网络地址后返回的网页的页面数据,通过比较各所述网页的页面数据,判断访问每个所述网页后是否都跳转至二次登录验证页面,进而确定各个所述网页的网络地址能否成功访问。Obtain the page data of the web page returned after accessing the network address of each web page, and by comparing the page data of each web page, determine whether each web page is redirected to the secondary login verification page after accessing it, and then determine whether the network address of each web page can be successfully accessed.
可选的,所述网页的页面数据包括有该网页的网络地址;Optionally, the page data of the web page includes the network address of the web page;
所述登录验证模块,还用于:The login verification module is further used to:
更新每个所述网页的页面数据,所述更新包括将每个所述网页的页面数据中包含的网络地址都删除,或者都替换为统一标识数据;Updating the page data of each web page, wherein the updating includes deleting all network addresses contained in the page data of each web page, or replacing them with unified identification data;
比较各个所述网页的更新后的页面数据是否相同,根据比较结果确定访问每个所述网页后是否都跳转至二次登录验证页面。Compare the updated page data of each web page to see if they are the same, and determine whether to jump to the secondary login verification page after accessing each web page based on the comparison result.
一种电子设备,包括:An electronic device, comprising:
处理器;processor;
用于存储处理器可执行指令的存储器;a memory for storing processor-executable instructions;
其中,所述处理器被配置为:Wherein, the processor is configured to:
确定当前连接的无线网络在连接时是否需要密码;Determine whether the currently connected wireless network requires a password when connecting;
在确定不需要密码后,根据至少一个设定的网络地址,访问所述设定的网络地址;After determining that a password is not required, accessing the set network address according to at least one set network address;
通过判断所述设定的网络地址能否成功访问,确定所述当前连接的无线网络是否需要二次登录验证。By judging whether the set network address can be successfully accessed, it is determined whether the currently connected wireless network requires secondary login verification.
上述装置中各个模块的功能和作用的实现过程具体详见上述方法中对应步骤的实现过程,在此不再赘述。The implementation process of the functions and effects of each module in the above-mentioned device is specifically described in the implementation process of the corresponding steps in the above-mentioned method, and will not be repeated here.
对于装置实施例而言,由于其基本对应于方法实施例,所以相关之处参见方法实施例的部分说明即可。以上所描述的装置实施例仅仅是示意性的,其中所述作为分离部件说明的模块可以是或者也可以不是物理上分开的,作为模块显示的部件可以是或者也可以不是物理模块,即可以位于一个地方,或者也可以分布到多个网络模块上。可以根据实际的需要选择其中的部分或者全部模块来实现本说明书方案的目的。本领域普通技术人员在不付出创造性劳动的情况下,即可以理解并实施。For the device embodiments, since they basically correspond to the method embodiments, the relevant parts can be referred to the partial description of the method embodiments. The device embodiments described above are merely illustrative, wherein the modules described as separate components may or may not be physically separated, and the components displayed as modules may or may not be physical modules, that is, they may be located in one place, or they may be distributed on multiple network modules. Some or all of the modules may be selected according to actual needs to achieve the purpose of the scheme of this specification. A person of ordinary skill in the art can understand and implement it without paying any creative work.
上述对本说明书特定实施例进行了描述。其它实施例在所附权利要求书的范围内。在一些情况下,在权利要求书中记载的动作或步骤可以按照不同于实施例中的顺序来执行并且仍然可以实现期望的结果。另外,在附图中描绘的过程不一定要求示出的特定顺序或者连续顺序才能实现期望的结果。在某些实施方式中,多任务处理和并行处理也是可以的或者可能是有利的。The foregoing description of this specification describes specific embodiments. Other embodiments are within the scope of the appended claims. In some cases, the actions or steps recited in the claims can be performed in an order different from that described in the embodiments and still achieve the desired results. Furthermore, the processes depicted in the accompanying drawings do not necessarily require the specific order shown or the sequential order to achieve the desired results. In certain embodiments, multitasking and parallel processing are also possible or may be advantageous.
本领域技术人员在考虑说明书及实践这里申请的发明后,将容易想到本说明书的其它实施方案。本说明书旨在涵盖本说明书的任何变型、用途或者适应性变化,这些变型、用途或者适应性变化遵循本说明书的一般性原理并包括本说明书未申请的本技术领域中的公知常识或惯用技术手段。说明书和实施例仅被视为示例性的,本说明书的真正范围和精神由下面的权利要求指出。Other embodiments of the present invention will readily occur to those skilled in the art upon consideration of the present invention and practice of the invention claimed herein. This specification is intended to cover any variations, uses, or adaptations of the present invention that follow the general principles of this specification and include common knowledge or customary techniques in the art not claimed herein. The description and examples are to be considered as exemplary only, with the true scope and spirit of the present invention being indicated by the following claims.
应当理解的是,本说明书并不局限于上面已经描述并在附图中示出的精确结构,并且可以在不脱离其范围进行各种修改和改变。本说明书的范围仅由所附的权利要求来限制。It should be understood that the present description is not limited to the exact structures described above and shown in the drawings, and that various modifications and changes may be made without departing from the scope thereof. The scope of the present description is limited only by the appended claims.
以上所述仅为本说明书的较佳实施例而已,并不用以限制本说明书,凡在本说明书的精神和原则之内,所做的任何修改、等同替换、改进等,均应包含在本说明书保护的范围之内。The above description is only a preferred embodiment of this specification and is not intended to limit this specification. Any modifications, equivalent replacements, improvements, etc. made within the spirit and principles of this specification should be included in the scope of protection of this specification.
Claims (9)
Priority Applications (1)
| Application Number | Priority Date | Filing Date | Title |
|---|---|---|---|
| HK18103911.0A HK1244613B (en) | 2018-03-21 | Method and apparatus for detecting wireless network type, and electronic device |
Applications Claiming Priority (1)
| Application Number | Priority Date | Filing Date | Title |
|---|---|---|---|
| HK18103911.0A HK1244613B (en) | 2018-03-21 | Method and apparatus for detecting wireless network type, and electronic device |
Publications (2)
| Publication Number | Publication Date |
|---|---|
| HK1244613A1 HK1244613A1 (en) | 2018-08-10 |
| HK1244613B true HK1244613B (en) | 2021-03-05 |
Family
ID=
Similar Documents
| Publication | Publication Date | Title |
|---|---|---|
| TWI698133B (en) | Wireless network type detection method, device and electronic equipment | |
| JP6668544B2 (en) | Portal authentication | |
| US10880173B2 (en) | Automated certification of network functions | |
| US11811625B2 (en) | Method, apparatus, and computer program | |
| RU2622876C2 (en) | Method, device and electronic device for connection control | |
| US8438256B2 (en) | Migrating functionality in virtualized mobile devices | |
| US9185626B1 (en) | Secure peer-to-peer call forking facilitated by trusted 3rd party voice server provisioning | |
| US10311246B1 (en) | System and method for secure USIM wireless network access | |
| WO2016000589A1 (en) | Method, system and apparatus for automatically connecting to wlan | |
| WO2020007158A1 (en) | Network access method and apparatus | |
| US9888290B1 (en) | Service denial notification in secure socket layer (SSL) processing | |
| WO2014040461A1 (en) | Access control method and device | |
| CN106488492A (en) | Method and device for processing abnormality of network communication function | |
| CN106851702A (en) | Method and device for processing abnormality of network communication function | |
| WO2016173349A1 (en) | Network access method and mobile communications terminal | |
| CN107567074A (en) | Method for connecting network, device and terminal | |
| CN106576329B (en) | Context-based resource access mediation | |
| CN104639519B (en) | A verification method and device | |
| WO2016165674A1 (en) | Trusted environment operating method and device for terminal | |
| HK1244613B (en) | Method and apparatus for detecting wireless network type, and electronic device | |
| CN115022217A (en) | Network card detection method and device, electronic equipment and storage medium | |
| CN108684056B (en) | Method for processing abnormal network communication function, modem, mobile terminal and storage medium | |
| HK1244613A1 (en) | Method and apparatus for detecting wireless network type, and electronic device | |
| CN107995063A (en) | A kind of network detecting method, device, terminal and computer-readable recording medium | |
| CN113438613B (en) | Abnormal user payment method, device, system and medium |