CN115002736A - Low-power-consumption Bluetooth test method, device, system, test equipment and storage medium - Google Patents
Low-power-consumption Bluetooth test method, device, system, test equipment and storage medium Download PDFInfo
- Publication number
- CN115002736A CN115002736A CN202210529857.7A CN202210529857A CN115002736A CN 115002736 A CN115002736 A CN 115002736A CN 202210529857 A CN202210529857 A CN 202210529857A CN 115002736 A CN115002736 A CN 115002736A
- Authority
- CN
- China
- Prior art keywords
- feature
- target service
- bluetooth
- target
- test
- Prior art date
- Legal status (The legal status is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the status listed.)
- Pending
Links
- 238000012360 testing method Methods 0.000 title claims abstract description 339
- 238000010998 test method Methods 0.000 title claims abstract description 9
- 230000006854 communication Effects 0.000 claims abstract description 72
- 238000004891 communication Methods 0.000 claims abstract description 72
- 238000000034 method Methods 0.000 claims abstract description 57
- 230000002159 abnormal effect Effects 0.000 claims abstract description 29
- 230000008569 process Effects 0.000 claims abstract description 24
- 238000004590 computer program Methods 0.000 claims description 12
- 238000001514 detection method Methods 0.000 claims description 11
- 238000010586 diagram Methods 0.000 description 9
- 238000013102 re-test Methods 0.000 description 8
- 230000005540 biological transmission Effects 0.000 description 6
- 230000006870 function Effects 0.000 description 6
- 230000009286 beneficial effect Effects 0.000 description 3
- 238000012544 monitoring process Methods 0.000 description 2
- 238000012545 processing Methods 0.000 description 2
- 230000007175 bidirectional communication Effects 0.000 description 1
- 230000002457 bidirectional effect Effects 0.000 description 1
- 230000008859 change Effects 0.000 description 1
- 238000011161 development Methods 0.000 description 1
- 238000005265 energy consumption Methods 0.000 description 1
- 238000005516 engineering process Methods 0.000 description 1
- 230000002349 favourable effect Effects 0.000 description 1
- 230000036244 malformation Effects 0.000 description 1
- 238000005259 measurement Methods 0.000 description 1
- 230000035772 mutation Effects 0.000 description 1
- 230000004044 response Effects 0.000 description 1
- 230000000717 retained effect Effects 0.000 description 1
- 238000011076 safety test Methods 0.000 description 1
- 230000009466 transformation Effects 0.000 description 1
- 230000001131 transforming effect Effects 0.000 description 1
Images
Classifications
-
- H—ELECTRICITY
- H04—ELECTRIC COMMUNICATION TECHNIQUE
- H04W—WIRELESS COMMUNICATION NETWORKS
- H04W4/00—Services specially adapted for wireless communication networks; Facilities therefor
- H04W4/80—Services using short range communication, e.g. near-field communication [NFC], radio-frequency identification [RFID] or low energy communication
-
- H—ELECTRICITY
- H04—ELECTRIC COMMUNICATION TECHNIQUE
- H04W—WIRELESS COMMUNICATION NETWORKS
- H04W12/00—Security arrangements; Authentication; Protecting privacy or anonymity
- H04W12/12—Detection or prevention of fraud
- H04W12/126—Anti-theft arrangements, e.g. protection against subscriber identity module [SIM] cloning
-
- H—ELECTRICITY
- H04—ELECTRIC COMMUNICATION TECHNIQUE
- H04W—WIRELESS COMMUNICATION NETWORKS
- H04W24/00—Supervisory, monitoring or testing arrangements
- H04W24/08—Testing, supervising or monitoring using real traffic
-
- H—ELECTRICITY
- H04—ELECTRIC COMMUNICATION TECHNIQUE
- H04W—WIRELESS COMMUNICATION NETWORKS
- H04W76/00—Connection management
- H04W76/10—Connection setup
- H04W76/14—Direct-mode setup
-
- Y—GENERAL TAGGING OF NEW TECHNOLOGICAL DEVELOPMENTS; GENERAL TAGGING OF CROSS-SECTIONAL TECHNOLOGIES SPANNING OVER SEVERAL SECTIONS OF THE IPC; TECHNICAL SUBJECTS COVERED BY FORMER USPC CROSS-REFERENCE ART COLLECTIONS [XRACs] AND DIGESTS
- Y02—TECHNOLOGIES OR APPLICATIONS FOR MITIGATION OR ADAPTATION AGAINST CLIMATE CHANGE
- Y02D—CLIMATE CHANGE MITIGATION TECHNOLOGIES IN INFORMATION AND COMMUNICATION TECHNOLOGIES [ICT], I.E. INFORMATION AND COMMUNICATION TECHNOLOGIES AIMING AT THE REDUCTION OF THEIR OWN ENERGY USE
- Y02D30/00—Reducing energy consumption in communication networks
- Y02D30/70—Reducing energy consumption in communication networks in wireless communication networks
Landscapes
- Engineering & Computer Science (AREA)
- Computer Networks & Wireless Communication (AREA)
- Signal Processing (AREA)
- Computer Security & Cryptography (AREA)
- Mobile Radio Communication Systems (AREA)
Abstract
The embodiment of the application discloses a low-power-consumption Bluetooth test method, a device, a system and a storage medium, wherein the method is applied to test equipment, and low-power-consumption Bluetooth connection exists between the test equipment and target Bluetooth equipment to be tested; the method comprises the following steps: acquiring feature information of target service features based on the low-power-consumption Bluetooth connection; the target service feature is a service feature included in a GATT service provided by the target bluetooth device; executing a Bluetooth communication task corresponding to the target service feature according to the feature information of the target service feature and first test data corresponding to the target service feature; detecting a connection state of the low-power Bluetooth connection in the execution process of the Bluetooth communication task; and if the connection state is an abnormal state, determining that the target service features have security holes. By implementing the embodiment of the application, the Bluetooth low energy security hole of the electronic equipment can be detected.
Description
Technical Field
The application relates to the technical field of communication, in particular to a low-power-consumption Bluetooth testing method, device, system, testing equipment and storage medium.
Background
Currently, with the development of Bluetooth technology, Bluetooth Low Energy (BLE) connection is in progress. The biggest characteristic of BLE connection compared with traditional Bluetooth is low power consumption, and the BLE connection is mostly applied to scenes which have higher requirements on real-time performance and lower requirements on data transmission rate, such as devices such as a sphygmomanometer, a keyboard and a mouse. Since the BLE connection only transmits a small amount of data when needed, the rest of the time other than data transmission remains off, which greatly reduces its power consumption and also makes it an ideal choice for long connection usage at low data rates. Nowadays, the BLE bluetooth function module is generally built in various electrical appliances or IoT smart devices that are currently used, such as various mobile phones (android, iPhone), smart home devices, medical devices, wearable devices, intelligent buildings, and various products such as automobiles.
However, in practice, it is found that the related test method for the BLE function of the electronic device is often to test the performance or energy consumption of BLE, and the safety of the BLE function is ignored.
Disclosure of Invention
The embodiment of the application discloses a low-power-consumption Bluetooth testing method, a device, a system, testing equipment and a storage medium, which can detect the low-power-consumption Bluetooth security hole of electronic equipment.
The embodiment of the application discloses a low-power-consumption Bluetooth testing method, which is applied to testing equipment, wherein the testing equipment is connected with target Bluetooth equipment to be tested through low-power-consumption Bluetooth; the method comprises the following steps: acquiring feature information of target service features based on the low-power-consumption Bluetooth connection; the target service feature is a service feature included in a GATT service provided by the target bluetooth device; executing a Bluetooth communication task corresponding to the target service feature according to the feature information of the target service feature and first test data corresponding to the target service feature; detecting a connection state of the low-power Bluetooth connection in the execution process of the Bluetooth communication task; and if the connection state is an abnormal state, determining that the target service feature has a security vulnerability.
The embodiment of the application discloses a low-power Bluetooth testing device which is applied to testing equipment, wherein low-power Bluetooth connection exists between the testing equipment and target Bluetooth equipment to be tested; the device comprises: the acquisition module is used for acquiring the characteristic information of the target service characteristic based on the low-power-consumption Bluetooth connection; the target service feature is a service feature included in a GATT service provided by the target bluetooth device; the communication module is used for executing a Bluetooth communication task corresponding to the target service characteristic according to the characteristic information of the target service characteristic and first test data corresponding to the target service characteristic; the detection module is used for detecting the connection state of the low-power-consumption Bluetooth connection in the execution process of the Bluetooth communication task; and the determining module is used for determining that the target service feature has a security vulnerability if the connection state is an abnormal state.
The embodiment of the application discloses test equipment, which comprises a memory and a processor, wherein a computer program is stored in the memory, and when the computer program is executed by the processor, the processor is enabled to realize any one of the low-power Bluetooth test methods disclosed by the embodiment of the application.
The embodiment of the application discloses a computer readable storage medium, wherein a computer program is stored on the computer readable storage medium, and when the computer program is executed by a processor, the computer program realizes any one of the low-power Bluetooth test methods disclosed in the embodiment of the application.
The embodiment of the application discloses bluetooth low energy test system, its characterized in that, the system includes: the test device and the target Bluetooth device to be tested; the test equipment is connected with the target Bluetooth equipment through low-power Bluetooth; the target Bluetooth device is used for providing a GATT service; the test equipment is used for acquiring feature information of target service features based on the low-power-consumption Bluetooth connection; the target service feature is a service feature included by the GATT service; the test equipment is further used for executing a Bluetooth communication task corresponding to the target service feature according to the feature information of the target service feature and first test data corresponding to the target service feature; detecting the connection state of the low-power Bluetooth connection in the execution process of the Bluetooth communication task; and if the connection state is an abnormal state, determining that the target service feature has a security vulnerability.
Compared with the related art, the embodiment of the application has the following beneficial effects:
after the test device establishes BLE connection with the target Bluetooth device, the feature information of the target service feature in the GATT service provided by the target Bluetooth device can be acquired, and the Bluetooth communication task corresponding to the target service feature is executed based on the feature information of the target service feature and the first test data. The test equipment can detect the connection state of the low-power-consumption Bluetooth connection in the execution process of the Bluetooth communication task, and if the connection state is an abnormal state, the target service features are determined to have security holes. Based on this, the test equipment can locate the target service characteristics of security holes possibly existing in the GATT service provided by the target Bluetooth equipment, fills the blank of security detection on the GATT service provided by the low-power Bluetooth equipment, and is beneficial to improving the security of the target Bluetooth equipment.
Drawings
In order to more clearly illustrate the technical solutions in the embodiments of the present application, the drawings needed to be used in the embodiments will be briefly described below, and it is obvious that the drawings in the following description are only some embodiments of the present application, and it is obvious for those skilled in the art to obtain other drawings without creative efforts.
Fig. 1 is a schematic diagram of an application scenario of a bluetooth testing method according to an embodiment;
FIG. 2 is an exemplary diagram of a GATT defined multi-tiered data structure, as disclosed by one embodiment;
FIG. 3 is a flowchart illustrating a method for testing Bluetooth Low energy according to one embodiment;
FIG. 4 is a flowchart illustrating another exemplary embodiment of a method for testing Bluetooth low energy;
FIG. 5 is a schematic structural diagram of a Bluetooth low energy testing apparatus according to an embodiment;
FIG. 6 is a schematic diagram of a testing apparatus according to an embodiment of the disclosure;
fig. 7 is a schematic structural diagram of a bluetooth low energy test system according to an embodiment of the disclosure.
Detailed Description
The technical solutions in the embodiments of the present application will be clearly and completely described below with reference to the drawings in the embodiments of the present application, and it is obvious that the described embodiments are only a part of the embodiments of the present application, and not all of the embodiments. All other embodiments, which can be derived by a person skilled in the art from the embodiments given herein without making any creative effort, shall fall within the protection scope of the present application.
It is to be noted that the terms "comprises" and "comprising" and any variations thereof in the examples and figures of the present application are intended to cover non-exclusive inclusions. For example, a process, method, system, article, or apparatus that comprises a list of steps or elements is not limited to only those steps or elements listed, but may alternatively include other steps or elements not listed, or inherent to such process, method, article, or apparatus.
The embodiment of the application discloses a method, a device, a system, a test device and a storage medium for testing low-power-consumption Bluetooth, which can detect the security hole of low-power-consumption Bluetooth connection. The following are detailed below.
Referring to fig. 1, fig. 1 is a schematic view of an application scenario of a bluetooth testing method according to an embodiment. As shown in fig. 1, may include a test device 110 and a target bluetooth device 120. The test device 110 may be any electronic device with a BLE function, the target bluetooth device 120 may be a bluetooth device to be tested, and may be any electronic device with a BLE function, such as a smart phone, a smart tablet, and a smart watch, which is not limited specifically. Test device 110 may initiate a BLE connection request to bluetooth device 120 based on a Media Access Control Address (MAC) Address of target bluetooth device 120. The target bluetooth device 120 may establish a BLE connection with the test device 110 in response to the connection request.
For example, the test device 110 may include a test host and a bluetooth adapter, and the target bluetooth device 120 may include a smart watch. Executable program codes corresponding to the Bluetooth testing method disclosed by the embodiment of the application can be stored in the testing host, and the testing host can drive the Bluetooth adapter to establish BLE connection with the intelligent watch. After the BLE connection is established, a processor such as a central controller of the test host may call stored executable program code to detect a security breach of the BLE connection.
The BLE connection between the testing device 110 and the target bluetooth device 120 may be based on Generic Attributes (GATTs) communication protocol for data transmission. The security breach of the BLE connection may be caused by an error generated by the target bluetooth device 120 when the GATT communication protocol is locally deployed, and thus, the security breach of the BLE connection may be detected by verifying the GATT service provided by the target bluetooth device 120 in the BLE connection.
The GATT defines a multi-layered data structure upon which communication between the test device 110 and the target bluetooth device 120 may occur. Referring to fig. 2, fig. 2 is a diagram illustrating an exemplary GATT-defined multi-level data structure according to an embodiment. As shown in fig. 2, the GATT definition database (Profile)20 may include a plurality of GATT services (services) 21, each Service 21 may include a plurality of Service features (charcteristic) 210, and each Service feature 210 may include attributes (Properties)210a and values (Value)210 b. Optionally, each service feature 210 may also include one or more descriptors 210 c.
The GATT service 21 may correspond to a table in the database 20, the service characteristics 210 may correspond to specific table entries in the data table, and bidirectional communication in the BLE connection may be implemented by reading and writing data to and from the service characteristics 210. Different service features may be used to initiate different bluetooth communication sessions and may correspond to different bluetooth communication tasks.
Referring to fig. 3, fig. 3 is a flowchart illustrating a method for testing bluetooth low energy according to an embodiment, where the method is applicable to the testing apparatus. As shown in fig. 3, the following steps may be included:
310. and acquiring the characteristic information of the target service characteristic based on the low-power-consumption Bluetooth connection.
After the test device establishes a BLE connection with the target bluetooth device, the test device may traverse the GATT service provided by the target bluetooth device. For any GATT service, the measurement device may parse the GATT service to obtain each service feature included in the GATT service, and parse to obtain feature information of each service feature.
The feature information of each service feature may include at least one or more of the following information: feature identification (UUID), feature Handle (Handle), and read-write status bits for service features. UUID can distinguish different service features; the characteristic handle can be used as an interface of service characteristics and used for receiving and transmitting data; the read-write status bits may be used to indicate the read-write status of the service features, including a writable state and a read-only state.
The target service feature may be a service feature included in a GATT service provided by the target bluetooth device. The target service feature can be any service feature included in the GATT service; or, any one of the service features to be tested that are retained after being screened may be used, which is not limited specifically. After analyzing the feature information of each service feature included in the GATT service, the testing device may further screen each service feature included in the GATT service, and select one or more service features to be tested.
320. And executing the Bluetooth communication task corresponding to the target service characteristic according to the characteristic information of the target service characteristic and the first test data corresponding to the target service characteristic.
The embodiment of the application can carry out safety test on the target service characteristics in a fuzzy test mode. Fuzzing is a method of discovering faults in software by providing unexpected inputs to a program and monitoring for anomalies in the outputs.
The first test data may be an unexpected malformation data, which may be automatically generated by the test equipment or pre-entered into the test equipment by the tester. The first test data corresponding to different service features may be different, and the first test data corresponding to the target service feature may be designed according to a bluetooth communication task corresponding to the target service feature.
In step 320, the test device may transmit the first test data to the target bluetooth device according to the feature information of the target service feature. When the target Bluetooth device receives the first test data, the target Bluetooth device can initiate a Bluetooth communication session with the test device by using the first test data, and the test device and the target Bluetooth device jointly execute a Bluetooth communication task corresponding to the target service characteristic.
Therefore, if the target service feature does not have a security hole, the BLE connection can still maintain a normal and stable connection state in the process that the test device and the target bluetooth device jointly execute the bluetooth communication task corresponding to the target service feature, and the test device and the target bluetooth device can perform normal data transmission. Otherwise, if the target service feature has a security vulnerability, the BLE connection may be in an abnormal state in the process that the testing device and the target bluetooth jointly execute the bluetooth communication task corresponding to the target service feature. The abnormal state may include: BLE connection is disconnected; or the target bluetooth device does not receive data transmitted based on the BLE connection when it times out.
Optionally, the feature information of the target service feature may include a feature handle. The test equipment can call first test data corresponding to the target service feature through the feature handle of the target service feature so as to execute a Bluetooth communication task corresponding to the target service feature and test the target service feature. That is, the test device may initiate a write request to the feature handle of the target service feature and, based on the write request, send first test data to the target bluetooth device based on the BLE connection.
Optionally, if the feature information of the target service feature includes the feature handle and the read-write state bit, the test device may determine whether the read-write state bit of the service feature to be tested is in a writable state before calling the first test data through the feature handle of the target service feature. If the read-write state of the target service feature is a writable state, the test equipment can call the first test data through the feature handle of the target service feature to execute a Bluetooth communication task corresponding to the target service feature and test the target service feature.
330. The connection state of the bluetooth low energy connection is detected during the execution of the bluetooth communication task.
During the execution of the bluetooth communication task, the test device and the target bluetooth device may perform bidirectional data transmission based on the BLE connection. At this time, the test device may monitor the data transmission condition of the BLE connection to detect whether the BLE connection is disconnected; if the BLE connection is disconnected, the connection state of the BLE connection may be determined to be an abnormal state.
And/or after the test equipment sends data to the target Bluetooth equipment based on the BLE connection, monitoring whether the target Bluetooth equipment sends feedback data within a preset time length; if not, the test device may determine that the connection state of the BLE connection is an abnormal state.
In addition, if no one of the above abnormal states occurs in the BLE connection during the execution of the bluetooth communication task, the test device may determine that the BLE connection is in a normal state during the execution of the bluetooth communication task.
340. And if the connection state is an abnormal state, determining that the target service features have security holes.
In some embodiments, if the test device detects that the BLE connection is in the abnormal state, the test device may further record feature information of the service feature to be tested and first test data corresponding to the service feature to be tested, so that in a subsequent debugging stage, dynamic debugging and positioning of the code module causing the security vulnerability are performed by replaying the corresponding first test data to the service feature having the security vulnerability.
In some embodiments, if the BLE connection remains in a normal state during the execution of the bluetooth communication task corresponding to the target service feature, the test device may determine that the test result of the service feature to be tested does not have a security hole.
In other embodiments, if the BLE connection is kept in a normal state during the execution of the bluetooth communication task corresponding to the target service feature, the test device may obtain second test data different from the first test data, and retest the target service feature according to the feature information of the target service feature and the second test data until the connection state of the BLE connection is in an abnormal state.
The second test data may be generated according to the first test data, or may be unrelated to the first test data, which is not limited specifically. The step of the testing device retesting the target service feature according to the feature information of the target service feature and the second test data may refer to the step of testing the target service feature by using the first test data in the foregoing embodiment, and details are not described below.
That is, if the connection state of the BLE connection is maintained in a normal state when the target service characteristic is tested using the first test data, the test device may retest the target service characteristic using other test data different from the first test data.
It should be noted that, if the second test data retests the target service feature, the test device may further obtain other test data different from the second test data, continue to test the target service feature, and continue to cycle until the connection state of the BLE connection is the abnormal state.
As can be seen, in the foregoing embodiment, after the test device establishes BLE connection with the target bluetooth device, the feature information of the target service feature in the GATT service provided by the target bluetooth device may be acquired, and the bluetooth communication task corresponding to the target service feature may be executed based on the feature information of the target service feature and the first test data. The test equipment can detect the connection state of the low-power-consumption Bluetooth connection in the execution process of the Bluetooth communication task, and if the connection state is an abnormal state, the target service feature is determined to have a security vulnerability. Based on the method, the testing equipment can locate the target service features which may have security holes in the GATT service provided by the target Bluetooth equipment, so that the blank of carrying out security detection on the GATT service provided by the low-power Bluetooth equipment is filled, and the security of the target Bluetooth equipment is favorably improved.
In one embodiment, the GATT service provided by the target bluetooth device may include two or more service features. When the GATT service includes a large number of service features, in order to perform comprehensive security detection on the GATT service provided by the target bluetooth device, the test device may generate a test feature list, where the test feature list may include service features to be detected selected from a plurality of service features by one or more test devices. Referring to fig. 4, fig. 4 is a flowchart illustrating another method for testing bluetooth low energy according to an embodiment, where the method is applicable to the testing apparatus. As shown in fig. 4, the following steps may be included:
410. and acquiring the GATT service provided by the target Bluetooth device based on the BLE connection, and analyzing the feature identifier, the feature handle and the read-write state bit of each of at least two service features included in the GATT service.
420. And selecting the service features with the read-write state being the writable state from the at least two service features as service features to be tested, and writing the feature identifiers and the feature handles of the service features to be tested into the test feature list.
The test feature list may include one or more service features to be tested, and is not limited in particular.
430. And according to the feature identification included in the test feature list, selecting the service feature to be tested which is not tested from the test feature list as the target service feature, and acquiring the feature handle of the target service feature.
The feature identifier UUID of the service feature to be tested may be used as an index of the service feature to be tested in the test feature list. The test equipment can judge whether each service characteristic to be tested included in the test characteristic list is tested or not according to the UUID, so that any service characteristic to be tested which is not tested is selected from the UUID as a target service characteristic.
440. Calling first test data corresponding to the target service feature through the feature handle of the target service feature so as to execute a Bluetooth communication task corresponding to the target service feature.
450. Judging whether the connection state of the low-power-consumption Bluetooth connection is an abnormal state or not in the execution process of the Bluetooth communication task; if yes, go to step 460; if not, go to step 470.
In step 450, the exception state may include: BLE connection is disconnected; or the target bluetooth device does not receive data transmitted based on the BLE connection when the target bluetooth device times out.
460. And recording the characteristic information of the target service characteristic and first test data corresponding to the target service characteristic, and ending the process.
In step 460, the feature information of the target service feature recorded by the testing equipment may include the UUID and the feature handle of the target service feature. The tester can replay the recorded first test data to the UUID and the characteristic handle recorded by the test equipment to reproduce the bug.
470. According to the feature identifier of the feature list to be tested, the target service feature is marked as tested in the test feature list, and step 480 is executed.
480. Judging whether each service feature to be tested included in the feature test list is tested or not; if yes, go to step 490; if not, go to step 430.
In step 480, the test equipment may detect whether each service feature to be tested included in the feature test list is marked as tested; if yes, the test equipment finishes traversing the feature test list, and all the service features to be tested included in the feature test list are tested. If at least one service feature to be tested is not marked as tested, the test equipment may continue to perform step 430, select the service feature to be tested that is not marked as tested from the test feature list as a new target service feature, and continue to perform steps 440 to 470 to test the new target service feature.
Moreover, if it is determined in step 480 that all the service features to be tested included in the feature list are tested, it may be stated that the connection state of the BLE connection is maintained in a normal state in the process of executing the bluetooth communication task corresponding to each service feature to be tested. Therefore, step 490 is performed to retest each service feature under test.
In addition, before performing step 490, the test equipment may clear the tested flag of each service feature under test included in the feature test list, so as to perform step 490 to retest each service feature under test.
490. And acquiring third test data corresponding to each service feature to be tested, and testing each service feature to be tested again according to the feature information of each service feature to be tested and the third test data corresponding to each service feature to be tested.
The step of the testing device retesting each service feature to be tested by using each third test data may refer to the step of testing each service feature to be tested by using each first test data, and details are not repeated below.
It should be noted that, if BLE connection is always kept in a normal state after each service feature to be tested is tested by using the third test data corresponding to each service feature to be tested, the test equipment may continue to obtain other test data different from each third test data, continue to test each service feature to be tested by using other test data, and continue to circulate until the connection state of BLE connection is in an abnormal state.
In other possible embodiments, if the test device executes step 480 and determines that each service feature to be tested included in the feature test list is tested, the test device may also end the process and no longer test each service feature to be tested.
It can be seen that, in the foregoing embodiment, if the GATT service provided by the target bluetooth device includes multiple service features, the test device may first filter the multiple service features to generate a feature test list. The one or more service features to be tested included in the feature test list are test targets for which security detection is required. After the feature test list is generated, the test equipment can directly acquire feature information from the feature test list. If the test equipment needs to perform multiple rounds of tests on the service features to be tested, the test equipment does not need to acquire feature information based on BLE connection before each round of test starts, but can directly acquire the feature information from a feature test list, so that the test speed is accelerated. In addition, in the foregoing embodiment, the test device may traverse the service features to be tested included in the feature test list, and comprehensively perform security detection on the GATT service provided by the target bluetooth device until a possible security vulnerability is detected.
In some embodiments, one or more of the first test data, the second test data, the third test data, and the like may be automatically generated by the test equipment.
Optionally, the test device may perform a random variation operation on the sample test data corresponding to the target service characteristic to obtain first test data corresponding to the target service characteristic. The testing device may test a plurality of times for a target service feature included in the GATT service provided by the target bluetooth device. The sample test data may be test data that was used to test the target service feature prior to the present test. The random mutation operation may refer to any data processing operation for transforming data so as to change data before and after transformation, and is not limited specifically.
Alternatively, the target service characteristic may correspond to two or more sample test data. For example, if the test equipment has performed multiple tests on the target service characteristics before the current test, the target service characteristics may correspond to at least two sample test data during the current test because the corresponding test data during each test is different. At this time, the test apparatus may acquire the code coverage of each sample test data. The code coverage of the sample test data may refer to a ratio of the number of codes that the sample test data can trigger to invoke, to the total number of codes corresponding to the GATT service provided by the target bluetooth device. The code coverage of the sample test data may be recorded during the round of testing in which the sample test data was used. For example, the GATT service provided by the target bluetooth device may be implemented by 100 lines of code, and if the test device is capable of triggering the invocation of 40 lines of code in 100 lines of code included in the GATT service when performing a bluetooth communication task by using a certain sample test data, the code coverage of the sample test data may be 40%.
After the test equipment acquires the code coverage rate of each sample test data, target test data can be selected according to the code coverage rate of each sample test data, and random variation operation is performed on the target test data to obtain first test data. For example, the test equipment may optionally take sample test data with the highest code coverage as target test data; or, sample test data with a code coverage rate higher than the probability threshold may be selected as the target test data, which is not limited specifically.
It should be noted that, the above describes a specific embodiment in which the test device automatically generates the test data by taking the first test data as an example, and the second test data and the third test data may also be generated by the above embodiment, which is not described in detail below.
Therefore, in the foregoing embodiment, the test device may automatically generate test data for performing security detection in addition to automatically detecting the security of one or more service features included in the GATT service provided by the target bluetooth device, and the test device may automatically complete the bluetooth low energy test, which is beneficial to improving the test efficiency.
Referring to fig. 5, fig. 5 is a schematic structural diagram of a bluetooth low energy testing apparatus according to an embodiment, where the bluetooth low energy testing apparatus can be applied to a testing device. As shown in fig. 5, the bluetooth low energy testing apparatus 500 may include: an acquisition module 510, a communication module 520, a detection module 530, and a determination module 540.
An obtaining module 510, configured to obtain feature information of a target service feature based on a bluetooth low energy connection; the target service feature is a service feature included in a GATT service provided by the target bluetooth device;
a communication module 520, configured to execute a bluetooth communication task corresponding to the target service feature according to the feature information of the target service feature and the first test data corresponding to the target service feature;
a detecting module 530, configured to detect a connection status of a bluetooth low energy connection during execution of a bluetooth communication task;
and a determining module 540, configured to determine that a security vulnerability exists in the target service feature when the connection state is an abnormal state.
In one embodiment, the bluetooth low energy testing apparatus 500 may further include: and a recording module.
The recording module is used for recording the characteristic information of the target service characteristic and first test data corresponding to the target service characteristic when the connection state is an abnormal state.
In an embodiment, the obtaining module 510 may be further configured to obtain second test data corresponding to the target service feature when the connection state is a normal state; the second test data is different from the first test data.
In an embodiment, the communication module 520 is configured to execute a bluetooth communication task corresponding to the target service feature according to the feature information of the target service feature and the second test data corresponding to the target service feature, so as to retest the target service feature until the connection state of the bluetooth low energy connection is an abnormal state.
The retesting of the target service feature may include that the communication module 520 executes operations corresponding to the two modules through the detection module 530 and the determination module 540 after executing the bluetooth communication task corresponding to the target service feature according to the second test data, so as to determine whether the target service feature has a security vulnerability.
In one embodiment, the characteristic information includes: and (4) carrying out feature handle.
The communication module 520 is further configured to call, through the feature handle of the target service feature, the first test data corresponding to the target service feature to perform a bluetooth communication task corresponding to the target service feature; the first test data corresponds to a target service characteristic.
In one embodiment, the feature information further comprises: and reading and writing status bits.
The communication module 520 may further be configured to call the first test data through the feature handle of the target service feature when the read-write status bit of the service device to be tested is in a writable state, so as to execute a bluetooth communication task corresponding to the target service feature.
In one embodiment, the GATT service provided by the target bluetooth device includes at least two service features.
The obtaining module 510 may further be configured to obtain, based on the bluetooth low energy connection, a GATT service provided by the target bluetooth device; analyzing the feature identifier, the feature handle and the read-write state bit of each of at least two service features included in the GATT service; selecting the service features with the read-write state being the writable state from the at least two service features as service features to be tested, and writing the feature identifiers and the feature handles of the service features to be tested into a test feature list; and according to the feature identifier included in the test feature list, selecting the service feature to be tested which is not tested from the test feature list as the target service feature, and acquiring the feature handle of the target service feature.
In one embodiment, the list of test features includes at least two service features under test. The bluetooth low energy testing apparatus 500 may further include: and a recording module.
And the recording module can be used for marking the target service characteristics as tested in the test characteristic list according to the characteristic identification of the target service characteristics when the connection state is a normal state.
The obtaining module 510 may further be configured to, after the recording module marks the target service feature as tested, select a service feature to be tested that is not tested from the test feature list as a new target service feature, and perform an operation of obtaining a feature handle of the target service feature.
In an embodiment, the obtaining module 510 is further configured to, in the process of executing the bluetooth communication task corresponding to each service feature to be tested included in the test feature list, obtain third test data corresponding to each service feature to be tested if the connection state of the low power consumption bluetooth connection is kept in a normal state; the third test data corresponding to each service feature to be tested is different from the first test data corresponding to the service feature to be tested;
the communication module 520 is configured to retest each service feature to be tested according to the feature information of each service feature to be tested and the third test data corresponding to each service feature to be tested, so as to retest each service feature to be tested until the connection state of the bluetooth low energy connection is an abnormal state.
In one embodiment, the bluetooth low energy testing apparatus 500 may further include: and generating a module.
The generating module may be further configured to perform a random variation operation on sample test data corresponding to the target service feature before the communication module 520 performs the bluetooth communication task corresponding to the target service feature according to the feature information of the target service feature and the first test data corresponding to the target service feature, so as to obtain first test data corresponding to the target service feature; or,
selecting target test data from the at least two sample test data according to the code coverage rates of the at least two sample test data, and performing random variation operation on the target test data to obtain first test data corresponding to the target service characteristics; the target service characteristic corresponds to at least two sample test data.
By implementing the bluetooth low energy testing device disclosed in the embodiment of the application, after the bluetooth low energy testing device establishes BLE connection with the target bluetooth device, the feature information of the target service feature in the GATT service provided by the target bluetooth device can be acquired, and the bluetooth communication task corresponding to the target service feature is executed based on the feature information of the target service feature and the first test data. The low-power-consumption Bluetooth testing device can detect the connection state of the low-power-consumption Bluetooth connection in the execution process of the Bluetooth communication task, and if the connection state is an abnormal state, the target service feature is determined to have a security vulnerability. Based on this, the low-power-consumption Bluetooth testing device can locate the target service characteristics possibly having security holes in the GATT service provided by the target Bluetooth equipment, fills the blank of carrying out security detection on the GATT service provided by the low-power-consumption Bluetooth equipment, and is favorable for improving the security of the target Bluetooth equipment.
Referring to fig. 6, fig. 6 is a schematic structural diagram of a testing apparatus according to an embodiment. As shown in fig. 6. The test apparatus 600 may include:
a memory 610 storing executable program code;
a processor 620 coupled to the memory 610;
the processor 620 calls the executable program code stored in the memory 610 to execute any one of the bluetooth low energy testing methods disclosed in the embodiments of the present application.
It should be noted that the testing device shown in fig. 6 may further include components, which are not shown, such as a power supply, an input key, a camera, a speaker, a screen, an RF circuit, a Wi-Fi module, a bluetooth module, and a sensor, which are not described in detail in this embodiment.
Referring to fig. 7, fig. 7 is a schematic structural diagram of a bluetooth low energy test system according to an embodiment. As shown in fig. 7, the bluetooth low energy test system 700 may include: a test device 710 and a target bluetooth device 720. Where there is a BLE connection between the test device 710 and the target bluetooth device 720.
A target bluetooth device 720 operable to provide GATT services;
the testing device 710 is operable to obtain feature information of a target service feature based on the bluetooth low energy connection; the target service feature is a service feature included by the GATT service;
the testing device 710 is further configured to execute a bluetooth communication task corresponding to the target service feature according to the feature information of the target service feature and the first test data corresponding to the target service feature; detecting the connection state of the low-power Bluetooth connection in the execution process of the Bluetooth communication task; and if the connection state is an abnormal state, determining that the target service features have security vulnerabilities.
In other possible embodiments, the test device 710 and the target bluetooth device 720 may perform operations respectively performed by the test device and the target bluetooth device in any one of the bluetooth low energy test methods disclosed in the foregoing embodiments, and details are not repeated below.
The embodiment of the application discloses a computer-readable storage medium which stores a computer program, wherein the computer program enables a computer to execute any one of the low-power Bluetooth test methods disclosed in the embodiment of the application.
A computer program product is disclosed that includes a non-transitory computer readable storage medium storing a computer program, and the computer program is operable to cause a computer to perform any of the methods for bluetooth low energy testing disclosed in embodiments of the present application.
It should be appreciated that reference throughout this specification to "one embodiment" or "an embodiment" means that a particular feature, structure or characteristic described in connection with the embodiment is included in at least one embodiment of the present application. Thus, the appearances of the phrases "in one embodiment" or "in an embodiment" in various places throughout this specification are not necessarily all referring to the same embodiment. Furthermore, the particular features, structures, or characteristics may be combined in any suitable manner in one or more embodiments. Those skilled in the art should also appreciate that the embodiments described in this specification are all alternative embodiments and that the acts and modules involved are not necessarily required for this application.
In various embodiments of the present application, it should be understood that the sequence numbers of the above-mentioned processes do not imply a necessary order of execution, and the order of execution of each process should be determined by its function and inherent logic, and should not constitute any limitation to the implementation process of the embodiments of the present application.
The units described as separate parts may or may not be physically separate, and parts displayed as units may or may not be physical units, may be located in one place, or may be distributed on a plurality of network units. Some or all of the units can be selected according to actual needs to achieve the purpose of the solution of the embodiment.
In addition, functional units in the embodiments of the present application may be integrated into one processing unit, or each unit may exist alone physically, or two or more units are integrated into one unit. The integrated unit can be realized in a form of hardware, and can also be realized in a form of a software functional unit.
The integrated units, if implemented as software functional units and sold or used as separate products, may be stored in a computer accessible memory. Based on such understanding, the technical solution of the present application, which is a part of or contributes to the prior art in essence, or all or part of the technical solution, may be embodied in the form of a software product, stored in a memory, including several requests for causing a computer device (which may be a personal computer, a server, a network device, or the like, and may specifically be a processor in the computer device) to execute part or all of the steps of the above-described method of the embodiments of the present application.
It will be understood by those skilled in the art that all or part of the steps in the methods of the embodiments described above may be implemented by hardware instructions of a program, and the program may be stored in a computer-readable storage medium, where the storage medium includes Read-Only Memory (ROM), Random Access Memory (RAM), Programmable Read-Only Memory (PROM), Erasable Programmable Read-Only Memory (EPROM), One-time Programmable Read-Only Memory (OTPROM), Electrically Erasable Programmable Read-Only Memory (EEPROM), Compact Disc Read-Only Memory (CD-ROM), or other Memory, such as a magnetic disk, or a combination thereof, A tape memory, or any other medium readable by a computer that can be used to carry or store data.
The method, the apparatus, the system, the testing device and the storage medium for testing bluetooth low energy disclosed in the embodiments of the present application are introduced in detail above, and a specific example is applied in the present application to explain the principle and the implementation of the present application. Meanwhile, for a person skilled in the art, according to the idea of the present application, there may be variations in the specific embodiments and the application scope, and in summary, the content of the present specification should not be construed as a limitation to the present application.
Claims (13)
1. A low-power Bluetooth test method is characterized in that the method is applied to test equipment, and low-power Bluetooth connection exists between the test equipment and target Bluetooth equipment to be tested; the method comprises the following steps:
acquiring feature information of target service features based on the low-power-consumption Bluetooth connection; the target service feature is a service feature included in a GATT service provided by the target bluetooth device;
executing a Bluetooth communication task corresponding to the target service feature according to the feature information of the target service feature and first test data corresponding to the target service feature;
detecting a connection state of the low-power Bluetooth connection in the execution process of the Bluetooth communication task;
and if the connection state is an abnormal state, determining that the target service feature has a security vulnerability.
2. The method of claim 1, further comprising:
and if the connection state is an abnormal state, recording the feature information of the target service feature and the first test data corresponding to the target service feature.
3. The method of claim 1, wherein after detecting the connection status of the bluetooth low energy connection during the performance of the bluetooth communication task, the method further comprises:
if the connection state is a normal state, second test data corresponding to the target service feature is acquired; the second test data is different from the first test data;
and testing the target service characteristics again according to the characteristic information of the target service characteristics and the second test data until the connection state of the low-power-consumption Bluetooth connection is an abnormal state.
4. The method of claim 1, wherein the feature information comprises: a feature handle; the executing the Bluetooth communication task corresponding to the target service feature according to the feature information of the target service feature and the first test data corresponding to the target service feature comprises:
calling first test data corresponding to a target service feature through a feature handle of the target service feature to execute a Bluetooth communication task corresponding to the target service feature; the first test data corresponds to the target service characteristic.
5. The method of claim 4, wherein the feature information further comprises: reading and writing a status bit; the calling of first test data through a feature handle of a target service feature to perform a bluetooth communication task corresponding to the target service feature includes:
and if the read-write state bit of the service equipment to be tested is in a writable state, calling first test data through the feature handle of the target service feature so as to execute a Bluetooth communication task corresponding to the target service feature.
6. The method of claim 4, wherein the GATT service comprises at least two service features; the feature information further includes: a feature identifier and a read-write status bit; and the feature information of the target service feature is acquired based on the low-power-consumption Bluetooth connection, and the feature information comprises:
acquiring a GATT service provided by the target Bluetooth device based on the low-power Bluetooth connection;
analyzing a feature identifier, a feature handle and a read-write state bit of each of at least two service features included in the GATT service;
selecting the service features with the read-write state being the writable state from the at least two service features as service features to be tested, and writing the feature identifiers and the feature handles of the service features to be tested into a test feature list;
and according to the feature identification included in the test feature list, selecting the service features to be tested which are not tested from the test feature list as target service features, and acquiring the feature handle of the target service features.
7. The method of claim 6, wherein the list of test features includes at least two service features under test; and after detecting the connection state of the bluetooth low energy connection during the execution of the bluetooth communication task, the method further comprises:
if the connection state is a normal state, marking the target service characteristic as tested in the test characteristic list according to the characteristic identification of the target service characteristic;
and selecting the service features to be tested which are not tested from the test feature list as new target service features, and executing the step of acquiring the feature handles of the target service features.
8. The method of claim 7, further comprising:
if the connection state of the low-power-consumption Bluetooth connection is kept in a normal state in the process of executing the Bluetooth communication task corresponding to each service feature to be tested in the test feature list, acquiring second test data corresponding to each service feature to be tested; the third test data corresponding to each service feature to be tested is different from the first test data corresponding to the service feature to be tested;
and testing each service characteristic to be tested again according to the characteristic information of each service characteristic to be tested and third test data corresponding to each service characteristic to be tested respectively until the connection state of the low-power Bluetooth connection is an abnormal state.
9. The method according to any one of claims 1-8, wherein before the performing the bluetooth communication task corresponding to the target service feature according to the feature information of the target service feature and the first test data corresponding to the target service feature, the method further comprises:
carrying out random variation operation on sample test data corresponding to the target service characteristic to obtain first test data corresponding to the target service characteristic; or,
selecting target test data from the at least two sample test data according to the code coverage rates of the at least two sample test data, and performing random variation operation on the target test data to obtain first test data corresponding to the target service characteristics; the target service characteristic corresponds to the at least two sample test data.
10. The low-power-consumption Bluetooth testing device is applied to testing equipment, and low-power-consumption Bluetooth connection exists between the testing equipment and target Bluetooth equipment to be tested; the device comprises:
the acquisition module is used for acquiring the characteristic information of the target service characteristic based on the low-power-consumption Bluetooth connection; the target service feature is a service feature included in a GATT service provided by the target bluetooth device;
the communication module is used for executing a Bluetooth communication task corresponding to the target service characteristic according to the characteristic information of the target service characteristic and first test data corresponding to the target service characteristic;
the detection module is used for detecting the connection state of the low-power-consumption Bluetooth connection in the execution process of the Bluetooth communication task;
and the determining module is used for determining that the target service feature has a security vulnerability if the connection state is an abnormal state.
11. A test apparatus comprising a memory and a processor, the memory having stored therein a computer program which, when executed by the processor, causes the processor to carry out the method of any one of claims 1 to 9.
12. A computer-readable storage medium, on which a computer program is stored, which, when being executed by a processor, carries out the method according to any one of claims 1 to 9.
13. A bluetooth low energy test system, the system comprising: the test device and the target Bluetooth device to be tested; the test equipment is connected with the target Bluetooth equipment through low-power Bluetooth;
the target Bluetooth device is used for providing a GATT service;
the test equipment is used for acquiring feature information of target service features based on the low-power-consumption Bluetooth connection; the target service feature is a service feature included by the GATT service;
the test equipment is further used for executing a Bluetooth communication task corresponding to the target service feature according to the feature information of the target service feature and first test data corresponding to the target service feature; detecting the connection state of the low-power Bluetooth connection in the execution process of the Bluetooth communication task; and if the connection state is an abnormal state, determining that the target service features have a security vulnerability.
Priority Applications (1)
Application Number | Priority Date | Filing Date | Title |
---|---|---|---|
CN202210529857.7A CN115002736A (en) | 2022-05-16 | 2022-05-16 | Low-power-consumption Bluetooth test method, device, system, test equipment and storage medium |
Applications Claiming Priority (1)
Application Number | Priority Date | Filing Date | Title |
---|---|---|---|
CN202210529857.7A CN115002736A (en) | 2022-05-16 | 2022-05-16 | Low-power-consumption Bluetooth test method, device, system, test equipment and storage medium |
Publications (1)
Publication Number | Publication Date |
---|---|
CN115002736A true CN115002736A (en) | 2022-09-02 |
Family
ID=83028127
Family Applications (1)
Application Number | Title | Priority Date | Filing Date |
---|---|---|---|
CN202210529857.7A Pending CN115002736A (en) | 2022-05-16 | 2022-05-16 | Low-power-consumption Bluetooth test method, device, system, test equipment and storage medium |
Country Status (1)
Country | Link |
---|---|
CN (1) | CN115002736A (en) |
Cited By (1)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
CN117112396A (en) * | 2023-07-11 | 2023-11-24 | 海光信息技术(苏州)有限公司 | Coverage rate collection method, coverage rate collection component, coverage rate collection system and related equipment |
-
2022
- 2022-05-16 CN CN202210529857.7A patent/CN115002736A/en active Pending
Cited By (1)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
CN117112396A (en) * | 2023-07-11 | 2023-11-24 | 海光信息技术(苏州)有限公司 | Coverage rate collection method, coverage rate collection component, coverage rate collection system and related equipment |
Similar Documents
Publication | Publication Date | Title |
---|---|---|
JP5391075B2 (en) | System capability detection for software defined radio | |
WO2017113527A1 (en) | Method and device for switching virtual sim card, and terminal | |
CN106302025B (en) | Automatic testing method and device for communication protocol | |
CN105320598A (en) | Software testing method and device | |
CN105487966A (en) | Program testing method, device and system | |
US20100049841A1 (en) | Method and system for automatically commissioning network device | |
CN113168435A (en) | Non-contact user authentication method | |
CN112115038A (en) | Application testing method and device and storage medium | |
CN113672441A (en) | Method and device for testing intelligent equipment | |
CN105100852B (en) | Voice remote control method, the apparatus and system of terminal | |
CN106656985B (en) | Backup account login method, device and system | |
CN115002736A (en) | Low-power-consumption Bluetooth test method, device, system, test equipment and storage medium | |
CN106294172B (en) | App self-testing methods based on terminal device and device | |
CN107451046B (en) | Method and terminal for detecting threads | |
CN109428783B (en) | Network equipment testing method and device | |
CN108738059B (en) | WIFI module testing method and device | |
CN104809054A (en) | Method and system for realizing program testing | |
CN111475359A (en) | System testing method, device and storage medium under multi-message interaction scene | |
CN112788640B (en) | Communication equipment testing method and device, storage medium and terminal | |
CN108809964B (en) | Resource access control method and device | |
CN106502887A (en) | A kind of stability test method, test controller and system | |
CN113709650A (en) | Microphone testing method, device and storage medium | |
CN113538725B (en) | Method for testing hardware products and related equipment | |
CN114390574A (en) | Wireless network throughput testing method, device and computer readable storage medium | |
IL200571A (en) | Control of mobile terminals |
Legal Events
Date | Code | Title | Description |
---|---|---|---|
PB01 | Publication | ||
PB01 | Publication | ||
SE01 | Entry into force of request for substantive examination | ||
SE01 | Entry into force of request for substantive examination |