Method, device, equipment and medium for generating device identification based on network card address
By scanning and filtering the network card address of the terminal device, generating a unique device identifier and registering, the problem of missing device identification determination mechanism in the smart education platform is solved, and the uniqueness and adaptability of device identification is achieved.
Patent Information
- Application Number
- CN202411492037.0
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2024-10-24
- Publication Date
- 2025-02-14
- Estimated Expiration
- 2044-10-24
AI Technical Summary
In the smart education platform, terminal devices lack a unified device identification determination mechanism, resulting in the inability to obtain a unique device identification when the network card address changes.
The system scans the built-in network card of the device, reads the network card address list, filters untrusted network card addresses, generates device identification, and registers or adjusts based on whether the device carries the identifier.
It realizes the generation of unique device identifiers when the network card address changes, adapts to the network card address changes of different devices, and ensures the uniqueness and reliability of device identifiers.
Smart Images

Figure CN119011533B_ABST
Abstract
Description
Technical Field
[0001] The present application relates to the field of computer technology, and in particular to a method, apparatus, device and medium for generating a device identifier based on a network card address. Background Art
[0002] In the construction of smart education platforms, various types of terminal devices will be used. When deploying and installing smart education-related software systems on these terminal devices, it is usually required to bind the terminal devices and use them to carry out educational activities. This requires that the above-mentioned terminal devices must be able to provide a unique device identification. In actual situations, there is a large number of manufacturers and different standards, and there is a lack of a unified device identification determination mechanism.
[0003] The prior art uses the network card address as the device identifier directly, but a device generally has multiple built-in network cards, and different devices may have the same network card address, and the network card address may also change. Therefore, a method for generating a unique device identifier that can cope with changes in the network card address is urgently needed. Summary of the invention
[0004] In view of this, the purpose of this application is to provide a method, apparatus, device and medium for generating a device identification based on a network card address, which can obtain a unique device identification, and the device identification of this application can well adapt to the changes in the network card address. The specific scheme is as follows:
[0005] In a first aspect, the present application discloses a method for generating a device identifier based on a network card address, comprising:
[0006] Scan the network card built into the current device through the system, and read the device network card address list corresponding to the network card; wherein the device network card address list includes a wired network card address and a non-wired network card address;
[0007] Filter out untrusted network card addresses that meet a preset untrusted condition in the device network card address list to obtain a filtered device network card address list, and determine whether the current device carries a device identifier;
[0008] If the current device does not carry a device identifier, a device identifier is generated for the current device according to whether the filtered device network card address list is empty and the matching condition between the filtered device network card address list and the system network card address library, and the current device is registered with the system;
[0009] If the current device carries a device identifier, the target network card address of the registered device in the system network card address library is adjusted according to whether the filtered network card address list is empty and the matching condition between the filtered device network card address list and the system network card address library.
[0010] Optionally, generating a device identifier for the current device according to whether the filtered device network card address list is empty and a matching condition between the filtered device network card address list and a system network card address library includes:
[0011] If the filtered device network card address list is empty, a device identification is directly generated for the current device, and the current device is marked as an untrusted device.
[0012] Optionally, generating a device identifier for the current device according to whether the filtered device network card address list is empty and a matching condition between the filtered device network card address list and a system network card address library includes:
[0013] If the filtered device network card address list is not empty, and the wired network card address in the filtered device network card address list is not empty, then each of the wired network card addresses is matched with the target network card address of the registered device in the system network card address library;
[0014] If any wired network card address can match the target network card address of the registered device, the target network card address is the primary network card address of the registered device, and the number of any wired network card addresses is 1, then determine that the device identifier of the current device is the device identifier of the registered device;
[0015] Each of the registered devices includes a primary network card address and a plurality of secondary network card addresses, and the primary network card address and the secondary network card address are obtained based on a preset network card definition rule.
[0016] Optionally, after matching each of the wired network card addresses with the target network card address of the registered device in the system network card address library, the method further includes:
[0017] If there is a wired network card address in the filtered device network card address list that cannot match the target network card address of the registered device, then the first wired network card address is selected from the wired network card addresses that cannot match the target network card address of the registered device, and the first wired network card address is determined as the primary network card address of the current device, and a device identifier is generated for the current device, and then the current device is registered to the system.
[0018] Optionally, adjusting the target network card address of the registered device in the system network card address library according to whether the filtered network card address list is empty and the matching condition between the filtered device network card address list and the system network card address library includes:
[0019] If the filtered device network card address list is not empty, the wired network card address and the non-wired network card address in the filtered device network card address list are matched with the target network card address of the registered device in the system network card address library respectively;
[0020] If the wired network card address or the non-wired network card address in the filtered device network card address list can match the target network card address of the registered device, and the device identifier of the registered device is consistent with the device identifier of the current device, then when the target network card address is not the primary network card address of the registered device, reselect the primary network card address for the registered device;
[0021] Each of the registered devices includes a primary network card address and a plurality of secondary network card addresses, and the primary network card address and the secondary network card address are obtained based on a preset network card definition rule.
[0022] Optionally, after matching the wired network card address and the non-wired network card address in the filtered device network card address list with the target network card address of the registered device in the system network card address library, the method further includes:
[0023] If the wired network card address or the non-wired network card address in the filtered device network card address list can match the target network card address of the registered device, and the device identifier of the registered device is inconsistent with the device identifier of the current device, then when the target network card address is the primary network card address or the secondary network card address, the target network card address is adjusted through different adjustment strategies.
[0024] Optionally, when the target network card address is the primary network card address or the secondary network card address, adjusting the target network card address by using different adjustment strategies includes:
[0025] If the target network card address is the secondary network card address, the target network card address is deleted from the system network card address library, and the target network card address is marked as the untrusted network card address;
[0026] If the target network card address is the primary network card address, the target network card address is deleted from the system network card address library, and the target network card address is marked as the untrusted network card address, and then the primary network card address is reselected for the registered device.
[0027] In a second aspect, the present application discloses a device for generating a device identifier based on a network card address, comprising:
[0028] A network card scanning module, used to scan the network card built into the current device through the system, and read the device network card address list corresponding to the network card; wherein the device network card address list includes a wired network card address and a non-wired network card address;
[0029] A network card filtering module is used to filter out untrusted network card addresses that meet a preset untrusted condition in the device network card address list, obtain a filtered device network card address list, and determine whether the current device carries a device identifier;
[0030] A device identification processing module is used for generating a device identification for the current device if the current device does not carry a device identification, according to whether the filtered device network card address list is empty and the matching situation between the filtered device network card address list and the system network card address library, and registering the current device to the system;
[0031] The device identification processing module is used to adjust the target network card address of the registered device in the system network card address library according to whether the filtered network card address list is empty and the matching situation between the filtered device network card address list and the system network card address library if the current device carries the device identification.
[0032] In a third aspect, the present application discloses an electronic device, comprising:
[0033] Memory, used to store computer programs;
[0034] The processor is used to execute the computer program to implement the aforementioned method of generating a device identification based on a network card address.
[0035] In a fourth aspect, the present application discloses a computer-readable storage medium for storing a computer program; wherein, when the computer program is executed by a processor, the aforementioned method for generating a device identifier based on a network card address is implemented.
[0036] It can be seen that the present application proposes a method for generating a device identification based on a network card address, comprising: scanning the network card built into the current device through the system, and reading the device network card address list corresponding to the network card; wherein the device network card address list includes a wired network card address and a non-wired network card address; filtering out the untrusted network card addresses in the device network card address list that meet the preset untrusted conditions, obtaining a filtered device network card address list, and judging whether the current device carries a device identification; if the current device does not carry a device identification, then generating a device identification for the current device according to whether the filtered device network card address list is empty and the matching situation of the filtered device network card address list with the system network card address library, and registering the current device to the system; if the current device carries a device identification, then adjusting the target network card address of the registered device in the system network card address library according to whether the filtered network card address list is empty and the matching situation of the filtered device network card address list with the system network card address library.
[0037] Beneficial effect: After obtaining the device network card address list of the device, the present application first filters out the untrusted network card addresses in the device network card address list to ensure that the remaining network card addresses are all in a credible state. On this basis, the present application sets different processing logic according to whether the device carries a device identifier. In the case where the device carries a device identifier, the present application generates a device identifier for the current device according to whether the filtered device network card address list is empty and the matching situation between the filtered device network card address list and the system network card address library, and registers the current device to the system. Further, in the case where the device does not carry a device identifier, the present application adjusts the target network card address of the registered device in the system network card address library according to whether the filtered network card address list is empty and the matching situation between the filtered device network card address list and the system network card address library. In summary, it can be seen that the device identifier of the present application is obtained based on the matching situation between the device network card address list and the system network card address library and through a unified device identifier determination mechanism, and the system network card address library of the present application is constantly updated and adjusted. In this way, the device identifier of the present application can adapt well to the changes in the network card address. BRIEF DESCRIPTION OF THE DRAWINGS
[0038] In order to more clearly illustrate the embodiments of the present application or the technical solutions in the prior art, the drawings required for use in the embodiments or the description of the prior art will be briefly introduced below. Obviously, the drawings described below are only embodiments of the present application. For ordinary technicians in this field, other drawings can be obtained based on the provided drawings without paying any creative work.
[0039] Figure 1 A flow chart of a method for generating a device identification based on a network card address disclosed in this application;
[0040] Figure 2 A schematic diagram of the structure of a device for generating a device identifier based on a network card address disclosed in the present application;
[0041] Figure 3 This is a structural diagram of an electronic device disclosed in this application. DETAILED DESCRIPTION
[0042] The following will be combined with the drawings in the embodiments of the present application to clearly and completely describe the technical solutions in the embodiments of the present application. Obviously, the described embodiments are only part of the embodiments of the present application, not all of the embodiments. Based on the embodiments in the present application, all other embodiments obtained by ordinary technicians in this field without creative work are within the scope of protection of this application.
[0043] The prior art uses the network card address as the device identifier directly, but a device generally has multiple built-in network cards, and different devices may have the same network card address, and the network card address may also change. Therefore, a method for generating a unique device identifier that can cope with changes in the network card address is urgently needed.
[0044] To this end, the embodiment of the present application proposes a solution for generating a device identifier based on a network card address, which can obtain a unique device identifier and can well adapt to changes in the network card address.
[0045] The present application embodiment discloses a method for generating a device identifier based on a network card address, see Figure 1 As shown, the method includes:
[0046] Step S11: Scan the network card built into the current device through the system, and read the device network card address list corresponding to the network card; wherein the device network card address list includes a wired network card address and a non-wired network card address.
[0047] In this embodiment, when the software starts running, it will automatically perform initialization loading processing. Specifically, all network cards built into the current device are scanned through the standard API (Application Program Interface) provided by the system, the network cards include wired network cards and non-wired network cards, the non-wired network cards include wireless network cards and virtual network cards, and further, the network card address corresponding to the network card is read to obtain the device network card address list {M1, M2, .., Mn}. It can be understood that the device network card address list includes wired network card addresses and non-wired network card addresses.
[0048] Step S12: filtering out untrusted network card addresses that meet a preset untrusted condition in the device network card address list to obtain a filtered device network card address list, and determining whether the current device carries a device identifier.
[0049] In this embodiment, untrusted network card addresses that meet a preset untrusted condition in the device network card address list are filtered out to obtain a filtered device network card address list, wherein the preset untrusted condition includes duplicate network card addresses, etc. After filtering out the untrusted network card addresses in the device network card address list, it is determined whether the current device carries a device identifier (Serial Number, SN).
[0050] Step S13: If the current device does not carry a device identifier, a device identifier is generated for the current device according to whether the filtered device network card address list is empty and the matching status between the filtered device network card address list and the system network card address library, and the current device is registered with the system.
[0051] The present embodiment will be described in detail below through multiple steps:
[0052] 1-1: If the filtered device network card address list {M1, M2, ...Mn} is empty, directly generate a device identifier for the current device, mark the current device as an untrusted device, and then register the current device to the system, and then execute 3, otherwise execute 1-2.
[0053] 1-2: If the wired network card address in the filtered device network card address list is not empty, execute step 1-3; otherwise, execute step 1-4.
[0054] 1-3: Match the wired network card address with the target network card address of the registered device in the system network card address library. If the target network card address can be matched, execute 1-3-1, otherwise execute 1-3-3.
[0055] 1-3-1: Loop through the wired network card addresses that match the target network card address. If the target network card address is the secondary network card address of a registered device, execute 1-3-1-1. If the target network card address is the primary network card address of a registered device, add it to the temporary list of the primary network card. After the loop ends, if the size of the temporary list of the primary network card is greater than 1, loop through 1-3-1-2, and then execute 1-3-3. If it is equal to 1, execute 1-3-2. If it is equal to 0, execute 1-3-3. It should be noted that each registered device includes a primary network card address and several secondary network card addresses. The primary network card address and the secondary network card address are obtained based on preset network card definition rules. Specifically, the preset network card definition rules include: if the registered device includes a wired network card address and a wireless network card address, the wired network card address is preferentially determined as the primary network card address of the device. If there are multiple wired network card addresses, the first wired network card address is determined as the primary network card address.
[0056] 1-3-1-1: Match hits the secondary network card address processing module:
[0057] Delete the target network card address from the system network card address library.
[0058] Add the target network card address to the untrusted network card address database.
[0059] 1-3-1-2: Matching hits the main network card address processing module:
[0060] Delete the target network card address from the device network card address library;
[0061] Add the target network card address to the untrusted network card address database;
[0062] Reselect the primary network card address for the registered device. If there is one, set the selected network card address as the primary network card address. Otherwise, mark the registered device as an untrusted device.
[0063] 1-3-2: Determine that the device identification number of the matched registered device is the device identification number of the current device, and compare the network card address of the registered device with the filtered device network card address list of the current device. If the network card address of the registered device contains the filtered network card address, delete it from the network card address of the registered device. If the network card address is missing (that is, it exists in the network card address of the registered device, but not in the filtered device network card address list and has not been filtered), delete it from the network card address of the registered device, and then execute 1-3-3.
[0064] 1-3-3: Determine whether the wired network card address that cannot be matched with the target network card address of the registered device still exists in the filtered device network card address list, if so, execute 1-3-4, otherwise execute 1-3-5.
[0065] 1-3-4: Select the first wired network card address from the wired network card addresses that have never been able to match the target network card address of the registered device, and determine the first wired network card address as the primary network card address of the current device, then determine the remaining wired network card addresses as the secondary network card addresses of the current device, generate a device identifier for the current device, and then register the current device to the system.
[0066] 1-3-5: Determine whether the non-wired network card address in the filtered network card address list of the current device is empty. If so, execute 3; otherwise, execute 1-4.
[0067] 1-4: Match the non-wired network card address with the target network card address of the registered device in the system network card address library. If the target network card address can be matched, execute 1-4-1, otherwise execute 1-4-3.
[0068] 1-4-1: Loop the non-wired network card address that matches the target network card address. If the target network card address is the secondary network card address of a registered device, execute 1-4-1-1; if the target network card address is the primary network card address of a registered device, execute 1-4-1-2. After the loop is completed, execute 1-4-2.
[0069] 1-4-1-1: Match hits the secondary network card address processing module:
[0070] Delete the target network card address from the system network card address library.
[0071] Add the target network card address to the untrusted network card address database.
[0072] 1-4-1-2: Matching hits the main network card address processing module:
[0073] Delete the target network card address from the device network card address library;
[0074] Add the target network card address to the untrusted network card address database;
[0075] Reselect the primary network card address for the registered device. If there is one, set the selected network card address as the primary network card address. Otherwise, mark the registered device as an untrusted device.
[0076] 1-4-2: If there are network card addresses of registered devices that are not matched in the non-wired network card addresses, execute 1-4-3; otherwise, execute 1-4-4.
[0077] 1-4-3: If the aforementioned wired network card address has been matched to a registered device, the non-wired network card address is set as the secondary network card address and saved to the system address library. Otherwise, the first non-wired network card address is selected as the primary network card address of the registered device, and a device identification code is generated. The remaining non-wired network card addresses are marked as secondary network card addresses, and then saved to the system address library, and then 3 is executed.
[0078] 1-4-4: If the aforementioned wired network card address does not match a registered device, a device identification code is generated, and the device is marked as an untrusted device, and then step 3 is executed.
[0079] Step S14: If the current device carries a device identifier, the target network card address of the registered device in the system network card address library is adjusted according to whether the filtered network card address list is empty and the matching condition between the filtered device network card address list and the system network card address library.
[0080] The present embodiment will be described in detail below through multiple steps. It should be noted that for ease of understanding, the present embodiment is described in the order of numbers 1-1, 1-2...2-1, 3.
[0081] 2-1: Query all network card addresses of the device in the system according to the device identification number carried, and then compare them with the filtered device network card address list of the current device. If the filtered network card address is found, it will be deleted from the registered device network card address. If a network card address is found to be missing (that is, it exists in the registered device network card address, but not in the filtered device network card address list, and it has not been filtered), it will also be deleted from the registered device network card address.
[0082] 2-2: If the current device is trustworthy and the device network card address list is empty after filtering, mark the current device as an untrustworthy device and execute 3; otherwise, execute 2-3.
[0083] 2-3: If the device network card address list after filtering is not empty, the wired network card address and the non-wired network card address in the device network card address list after filtering are matched with the target network card address of the registered device in the system network card address library respectively; if the wired network card address or the non-wired network card address in the device network card address list after filtering can match the target network card address of the registered device, execute 2-4; otherwise, execute 2-5.
[0084] 2-4: If the device identifier of the registered device is consistent with the device identifier of the current device, execute 2-6; otherwise, execute 2-8.
[0085] 2-5: Reselect the primary network card address for the registered device (preferably the wired network card address), mark other network card addresses as secondary network card addresses, save them to the system network card address library, and then execute 3.
[0086] 2-6: If the matching network card address does not include the primary network card address, the primary network card address is reselected based on the network card addresses of the missed devices and the network card addresses of the hit devices. If the matching network card address includes the primary network card address, the primary network card address is not reselected.
[0087] Mark the network card address of the missed device as a secondary network card address, add or update the device network card address, and if the device is untrusted, update it to a trusted state, and then execute 2-8.
[0088] 2-8: If the wired network card address or the non-wired network card address in the filtered device network card address list can match the target network card address of the registered device, and the device identifier of the registered device is inconsistent with the device identifier of the current device, then when the target network card address is the primary network card address or the secondary network card address, the target network card address is adjusted using different adjustment strategies. Specifically, if the secondary network card address is hit, execute 2-8-1, and if the primary network card address is hit, execute 2-8-2.
[0089] 2-8-1: Hit the secondary network card address processing module
[0090] Delete the target network card address from the system network card address library.
[0091] Add the target network card address to the untrusted network card address database.
[0092] 2-8-2: Hit the main network card address processing module
[0093] Delete the target network card address from the device network card address library;
[0094] Add the target network card address to the untrusted network card address database;
[0095] Reselect the primary network card address for the registered device. If there is one, set the selected network card address as the primary network card address. Otherwise, mark the registered device as an untrusted device.
[0096] 2-9: Reselect the primary network card address for the registered device (preferably the wired network card address), mark other network card addresses as secondary network card addresses, save them to the system network card address library, and then execute 3.
[0097] If the device is in a trusted state and there is no missed network card address of the device, it is marked as an untrusted device and then execution is performed at step 3.
[0098] 3: Return the device identification number, and the client calls the general SDK (Software Development Kit) to save the device identification number locally on the terminal device.
[0099] It can be seen that the present application proposes a method for generating a device identification based on a network card address, comprising: scanning the network card built into the current device through the system, and reading the device network card address list corresponding to the network card; wherein the device network card address list includes a wired network card address and a non-wired network card address; filtering out the untrusted network card addresses in the device network card address list that meet the preset untrusted conditions, obtaining a filtered device network card address list, and judging whether the current device carries a device identification; if the current device does not carry a device identification, then generating a device identification for the current device according to whether the filtered device network card address list is empty and the matching situation of the filtered device network card address list with the system network card address library, and registering the current device to the system; if the current device carries a device identification, then adjusting the target network card address of the registered device in the system network card address library according to whether the filtered network card address list is empty and the matching situation of the filtered device network card address list with the system network card address library.
[0100] Beneficial effect: After obtaining the device network card address list of the device, the present application first filters out the untrusted network card addresses in the device network card address list to ensure that the remaining network card addresses are all in a credible state. On this basis, the present application sets different processing logic according to whether the device carries a device identifier. In the case where the device carries a device identifier, the present application generates a device identifier for the current device according to whether the filtered device network card address list is empty and the matching situation between the filtered device network card address list and the system network card address library, and registers the current device to the system. Further, in the case where the device does not carry a device identifier, the present application adjusts the target network card address of the registered device in the system network card address library according to whether the filtered network card address list is empty and the matching situation between the filtered device network card address list and the system network card address library. In summary, it can be seen that the device identifier of the present application is obtained based on the matching situation between the device network card address list and the system network card address library and through a unified device identifier determination mechanism, and the system network card address library of the present application is constantly updated and adjusted. In this way, the device identifier of the present application can adapt well to the changes in the network card address.
[0101] Correspondingly, the embodiment of the present application also discloses a device for generating a device identifier based on a network card address, see Figure 2 As shown, the device comprises:
[0102] The network card scanning module 11 is used to scan the network card built into the current device through the system, and read the device network card address list corresponding to the network card; wherein the device network card address list includes the wired network card address and the non-wired network card address;
[0103] The network card filtering module 12 is used to filter out the untrusted network card addresses that meet the preset untrusted condition in the device network card address list, obtain the filtered device network card address list, and determine whether the current device carries a device identifier;
[0104] The device identification processing module 13 is used for generating a device identification for the current device according to whether the filtered device network card address list is empty and the matching situation between the filtered device network card address list and the system network card address library, and registering the current device to the system if the current device does not carry the device identification;
[0105] The device identification processing module 14 is used to adjust the target network card address of the registered device in the system network card address library according to whether the filtered network card address list is empty and the matching situation between the filtered device network card address list and the system network card address library if the current device carries the device identification.
[0106] Among them, for more specific working processes of the above-mentioned modules, please refer to the corresponding contents disclosed in the aforementioned embodiments, which will not be repeated here.
[0107] It can be seen that the present application proposes a method for generating a device identification based on a network card address, comprising: scanning the network card built into the current device through the system, and reading the device network card address list corresponding to the network card; wherein the device network card address list includes a wired network card address and a non-wired network card address; filtering out the untrusted network card addresses in the device network card address list that meet the preset untrusted conditions, obtaining a filtered device network card address list, and judging whether the current device carries a device identification; if the current device does not carry a device identification, then generating a device identification for the current device according to whether the filtered device network card address list is empty and the matching situation of the filtered device network card address list with the system network card address library, and registering the current device to the system; if the current device carries a device identification, then adjusting the target network card address of the registered device in the system network card address library according to whether the filtered network card address list is empty and the matching situation of the filtered device network card address list with the system network card address library.
[0108] Beneficial effect: After obtaining the device network card address list of the device, the present application first filters out the untrusted network card addresses in the device network card address list to ensure that the remaining network card addresses are all in a credible state. On this basis, the present application sets different processing logic according to whether the device carries a device identifier. In the case where the device carries a device identifier, the present application generates a device identifier for the current device according to whether the filtered device network card address list is empty and the matching situation between the filtered device network card address list and the system network card address library, and registers the current device to the system. Further, in the case where the device does not carry a device identifier, the present application adjusts the target network card address of the registered device in the system network card address library according to whether the filtered network card address list is empty and the matching situation between the filtered device network card address list and the system network card address library. In summary, it can be seen that the device identifier of the present application is obtained based on the matching situation between the device network card address list and the system network card address library and through a unified device identifier determination mechanism, and the system network card address library of the present application is constantly updated and adjusted. In this way, the device identifier of the present application can adapt well to the changes in the network card address.
[0109] Furthermore, an embodiment of the present application also provides an electronic device. Figure 3 This is a structural diagram of an electronic device 20 according to an exemplary embodiment. The content in the diagram cannot be regarded as any limitation on the scope of use of the present application.
[0110] Figure 3 A schematic diagram of the structure of an electronic device 20 provided in an embodiment of the present application. The electronic device 20 may specifically include: at least one processor 21, at least one memory 22, a display screen 23, an input / output interface 24, a communication interface 25, a power supply 26, and a communication bus 27. The memory 22 is used to store a computer program, which is loaded and executed by the processor 21 to implement the relevant steps in the method for generating a device identification based on a network card address disclosed in any of the aforementioned embodiments. In addition, the electronic device 20 in this embodiment may specifically be an electronic computer.
[0111] In this embodiment, the power supply 26 is used to provide working voltage for each hardware device on the electronic device 20; the communication interface 25 can create a data transmission channel between the electronic device 20 and the external device, and the communication protocol it follows is any communication protocol that can be applied to the technical solution of the present application, and is not specifically limited here; the input and output interface 24 is used to obtain external input data or output data to the outside world, and its specific interface type can be selected according to specific application needs and is not specifically limited here.
[0112] In addition, the memory 22, as a carrier for storing resources, may be a read-only memory, a random access memory, a disk or an optical disk, etc., and the resources stored thereon may include a computer program 221, and the storage method may be temporary storage or permanent storage. In addition to including a computer program that can be used to complete the method for generating a device identifier based on a network card address and executed by the electronic device 20 disclosed in any of the aforementioned embodiments, the computer program 221 may further include a computer program that can be used to complete other specific tasks.
[0113] Furthermore, an embodiment of the present application also discloses a computer-readable storage medium for storing a computer program; wherein, when the computer program is executed by a processor, the aforementioned method for generating a device identifier based on a network card address is implemented.
[0114] For the specific steps of the method, reference may be made to the corresponding contents disclosed in the aforementioned embodiments, which will not be described in detail here.
[0115] The various embodiments in this application are described in a progressive manner, and each embodiment focuses on the differences from other embodiments. The same or similar parts between the various embodiments can be referenced to each other. For the device disclosed in the embodiment, since it corresponds to the method disclosed in the embodiment, the description is relatively simple, and the relevant parts can be referred to the method part description.
[0116] Professionals may further appreciate that the units and algorithm steps of each example described in conjunction with the embodiments disclosed herein can be implemented in electronic hardware, computer software, or a combination of the two. In order to clearly illustrate the interchangeability of hardware and software, the composition and steps of each example have been generally described in the above description according to function. Whether these functions are performed in hardware or software depends on the specific application and design constraints of the technical solution. Professionals and technicians may use different methods to implement the described functions for each specific application, but such implementation should not be considered to be beyond the scope of this application.
[0117] The steps of the method or algorithm described in conjunction with the embodiments disclosed herein may be implemented directly using hardware, a software module executed by a processor, or a combination of the two. The software module may be placed in a random access memory (RAM), a memory, a read-only memory (ROM), an electrically programmable ROM, an electrically erasable programmable ROM, a register, a hard disk, a removable disk, a CD-ROM, or any other form of storage medium known in the art.
[0118] Finally, it should be noted that, in this article, relational terms such as first and second, etc. are only used to distinguish one entity or operation from another entity or operation, and do not necessarily require or imply any such actual relationship or order between these entities or operations. Moreover, the terms "include", "comprise" or any other variants thereof are intended to cover non-exclusive inclusion, so that a process, method, article or device including a series of elements includes not only those elements, but also other elements not explicitly listed, or also includes elements inherent to such process, method, article or device. In the absence of further restrictions, the elements defined by the sentence "comprise a ..." do not exclude the presence of other identical elements in the process, method, article or device including the elements.
[0119] The above is a detailed introduction to the method, apparatus, device, and storage medium for generating a device identifier based on a network card address provided by the present application. Specific examples are used in this article to illustrate the principles and implementation methods of the present application. The description of the above embodiments is only used to help understand the method of the present application and its core idea. At the same time, for general technical personnel in this field, according to the idea of the present application, there will be changes in the specific implementation method and application scope. In summary, the content of this specification should not be understood as a limitation on the present application.
Claims
1. A method for generating a device identifier based on a network card address, characterized in that: include: Scan the network card built into the current device through the system, and read the device network card address list corresponding to the network card; wherein the device network card address list includes a wired network card address and a non-wired network card address; Filter out untrusted network card addresses that meet a preset untrusted condition in the device network card address list to obtain a filtered device network card address list, and determine whether the current device carries a device identifier; If the current device does not carry a device identifier, a device identifier is generated for the current device according to whether the filtered device network card address list is empty and the matching condition between the filtered device network card address list and the system network card address library, and the current device is registered with the system; If the current device carries a device identifier, adjusting the target network card address of the registered device in the system network card address library according to whether the filtered network card address list is empty and the matching condition between the filtered device network card address list and the system network card address library; The step of adjusting the target network card address of the registered device in the system network card address library according to whether the filtered network card address list is empty and the matching condition between the filtered device network card address list and the system network card address library includes: If the filtered device network card address list is not empty, the wired network card address and the non-wired network card address in the filtered device network card address list are matched with the target network card address of the registered device in the system network card address library respectively; If the wired network card address or the non-wired network card address in the filtered device network card address list can match the target network card address of the registered device, and the device identifier of the registered device is consistent with the device identifier of the current device, then when the target network card address is not the primary network card address of the registered device, reselect the primary network card address for the registered device; Each of the registered devices includes a primary network card address and a plurality of secondary network card addresses, and the primary network card address and the secondary network card address are obtained based on a preset network card definition rule.
2. The method for generating a device identifier based on a network card address according to claim 1, characterized in that: The generating a device identifier for the current device according to whether the filtered device network card address list is empty and the matching condition between the filtered device network card address list and the system network card address library includes: If the filtered device network card address list is empty, a device identification is directly generated for the current device, and the current device is marked as an untrusted device.
3. The method for generating a device identifier based on a network card address according to claim 1, characterized in that: The generating a device identifier for the current device according to whether the filtered device network card address list is empty and the matching condition between the filtered device network card address list and the system network card address library includes: If the filtered device network card address list is not empty, and the wired network card address in the filtered device network card address list is not empty, then each of the wired network card addresses is matched with the target network card address of the registered device in the system network card address library; If any wired network card address can match the target network card address of the registered device, the target network card address is the primary network card address of the registered device, and the number of any wired network card addresses is 1, then determine that the device identifier of the current device is the device identifier of the registered device; Each of the registered devices includes a primary network card address and a plurality of secondary network card addresses, and the primary network card address and the secondary network card address are obtained based on a preset network card definition rule.
4. The method for generating a device identifier based on a network card address according to claim 3, characterized in that: After matching each of the wired network card addresses with the target network card address of the registered device in the system network card address library, the method further includes: If there is a wired network card address in the filtered device network card address list that cannot match the target network card address of the registered device, then the first wired network card address is selected from the wired network card addresses that cannot match the target network card address of the registered device, and the first wired network card address is determined as the primary network card address of the current device, and a device identifier is generated for the current device, and then the current device is registered to the system.
5. The method for generating a device identifier based on a network card address according to claim 1, characterized in that: After matching the wired network card address and the non-wired network card address in the filtered device network card address list with the target network card address of the registered device in the system network card address library, the method further includes: If the wired network card address or the non-wired network card address in the filtered device network card address list can match the target network card address of the registered device, and the device identifier of the registered device is inconsistent with the device identifier of the current device, then when the target network card address is the primary network card address or the secondary network card address, the target network card address is adjusted through different adjustment strategies.
6. The method for generating a device identifier based on a network card address according to claim 5, characterized in that: When the target network card address is the primary network card address or the secondary network card address, adjusting the target network card address by using different adjustment strategies includes: If the target network card address is the secondary network card address, the target network card address is deleted from the system network card address library, and the target network card address is marked as the untrusted network card address; If the target network card address is the primary network card address, the target network card address is deleted from the system network card address library, and the target network card address is marked as the untrusted network card address, and then the primary network card address is reselected for the registered device.
7. A device for generating a device identifier based on a network card address, characterized in that: include: A network card scanning module, used to scan the network card built into the current device through the system, and read the device network card address list corresponding to the network card; wherein the device network card address list includes a wired network card address and a non-wired network card address; A network card filtering module is used to filter out untrusted network card addresses that meet a preset untrusted condition in the device network card address list, obtain a filtered device network card address list, and determine whether the current device carries a device identifier; A device identification processing module is used for generating a device identification for the current device if the current device does not carry a device identification, according to whether the filtered device network card address list is empty and the matching situation between the filtered device network card address list and the system network card address library, and registering the current device to the system; A device identification processing module is used to adjust the target network card address of the registered device in the system network card address library according to whether the filtered network card address list is empty and the matching situation between the filtered device network card address list and the system network card address library if the current device carries the device identification; The step of adjusting the target network card address of the registered device in the system network card address library according to whether the filtered network card address list is empty and the matching condition between the filtered device network card address list and the system network card address library includes: If the filtered device network card address list is not empty, the wired network card address and the non-wired network card address in the filtered device network card address list are matched with the target network card address of the registered device in the system network card address library respectively; If the wired network card address or the non-wired network card address in the filtered device network card address list can match the target network card address of the registered device, and the device identifier of the registered device is consistent with the device identifier of the current device, then when the target network card address is not the primary network card address of the registered device, reselect the primary network card address for the registered device; Each of the registered devices includes a primary network card address and a plurality of secondary network card addresses, and the primary network card address and the secondary network card address are obtained based on a preset network card definition rule.
8. An electronic device, characterized in that: include: Memory, used to store computer programs; A processor is used to execute the computer program to implement the method for generating a device identifier based on a network card address as described in any one of claims 1 to 6.
9. A computer-readable storage medium, characterized in that: Used to store a computer program; wherein, when the computer program is executed by a processor, the method for generating a device identifier based on a network card address as described in any one of claims 1 to 6 is implemented.
Citation Information
Patent Citations
Device identification method, device and system
CN108197050A