Development of a Simulator for Testing Software Systems Working with a Binary Protocol †
Abstract
:1. Introduction
2. Purpose of the Development
- Availability of the physical system to be serviced. It sends and receives real data to the programming system),
- Development of a simulator (software or hardware) that simulates the physical system. It receives and sends real or test data with which operability is verified. The data can be correct or incorrect according to the communication protocol used to fully test the functionality of the application program.
- Segment Receiver (byte 0)—segment of the recipient—a one-byte field that contains the segment of the device that will receive the data.
- Address Receiver (byte 1)—address of the recipient—a one-byte field that contains the address of the device that will receive the data.
- Segment Sender (byte 2)—address of the sender—a one-byte field that contains the segment of the device that will send the data.
- Address Sender (byte 3)—address of the sender—a one-byte field that contains the address of the device that will send the data.
- Length (byte 4)—length—the length from the next byte to the end of the message is set.
- Command (byte 5)—command—a one-byte field in which a command number is set-
- Parameters—command parameters. These can be from 0 to 249 bytes, which means it can have no parameters, only one parameter, or multiple parameters, with a maximum of 249, since the maximum message length is 256 bytes.
- Checksum—this field is calculated by the sender and the receiver. The calculation is as follows:
- ○
- On the sender’s side—the sum of all bytes from 0 to n−1 bytes is found, and then this difference is subtracted from 255 and the result is recorded in the CRC field.
- ○
- On the recipient’s side—the sum of all bytes from 0 to the n−1st byte is found. The checksum is then added, and if the result is 255, the message is accepted as true.
- A correct message that has all fields and a valid CRC code.
- A bad message that has all fields and the wrong CRC code.
- Short message with missing fields.
- Long message—a message that consists of more fields. In this case, the simulator finds one full message (correct or incorrect) and one more short message:
- ○
- If the extra fields are after the CRC and it is correct, the message is correct; if it is wrong, it is incorrect.
- ○
- If the extra fields are before the CRC, then there is a correct message with the wrong CRC code.
3. Program Simulator
3.1. Overview
- Fields for visualizing received and sent messages.
- A field for manual input/correction of messages.
- An ability to load commands from an external file.
- An ability to automatically format a message, when entering only the fields with the data (this allows for the formation of large messages and automatic calculation of the data length and CRC code).
- Options to configure the COM port according to the requirements of the specific application.
3.2. State Machine of Simulator
4. Experimental Setup
- The developed simulator (Figure 2). The simulator is developed in the Qt programming system using C++ program language. Thus, it can be compiled for different operating systems.
- Developed software process control system (the developed server application for machine liquid dosing system is used for testing). This application sends and receives messages to/from liquid dispensing machines, processes the received messages at the physical and application level, and records the data in a database. From this database, another application designed for end users shows the status of the machines, allows for the operation of the machines, etc.
- A computer on which both applications are installed to perform the test experiments.
- Two USB–RS232 converters, with which COM ports are simulated for RS-232 interface connection. Each of the applications works with a unique COM port because it resides on one physical machine.
- Cable for two-way communication, with DB9 connectors. To perform the tests, it is sufficient to connect only the Tx and Rx signals of the two couplers for two-way communication. When performing the tests, the settings of the COM ports must be the same.
5. Experimental Results
5.1. Sending the Correct Message Machine of the Simulator
5.2. Sending the Message with a Bad CRC Code
5.3. Sending the Short Message
6. Conclusions
Author Contributions
Funding
Institutional Review Board Statement
Informed Consent Statement
Data Availability Statement
Conflicts of Interest
References
- Meng, F.; Liu, Y.; Zhang, C.; Li, T.; Yue, Y. Inferring protocol state machine for binary communication protocol. In Proceedings of the 2014 IEEE Workshop on Advanced Research and Technology in Industry Applications (WARTIA), Ottawa, ON, Canada, 29–30 September 2014; pp. 870–874. [Google Scholar] [CrossRef]
- Yan, X.; Li, Q.; Tao, S. A clustering algorithm for binary protocol data frames based on principal component analysis and density peaks clustering. In Proceedings of the 2017 IEEE 17th International Conference on Communication Technology (ICCT), Chengdu, China, 27–30 October 2017; pp. 1260–1266. [Google Scholar] [CrossRef]
- Wang, Y.; Li, X.; Meng, J.; Zhao, Y.; Zhang, Z.; Guo, L. Biprominer: Automatic Mining of Binary Protocol Features. In Proceedings of the 2011 12th International Conference on Parallel and Distributed Computing, Applications and Technologies, Gwangju, Republic of Korea, 20–22 October 2011; pp. 179–184. [Google Scholar] [CrossRef]
- Wang, Y.P.; Zhang, Z.B.; Yao, D.F. Inferring Protocol State Machine from Network Traces: A Probabilistic Approach. In Applied Cryptography and Network Security; Lopez, J., Tsudik, G., Eds.; Lecture Notes in Computer Science; Springer: Berlin/Heidelberg, Germany, 2011; Volume 6715. [Google Scholar] [CrossRef]
- Senier, A. Tutorial: The End of Binary Protocol Parser Vulnerabilities: Using RecordFlux and SPARK to implement formally-verified binary formats and communication protocols. In Proceedings of the 2023 IEEE Secure Development Conference (SecDev), Atlanta, GA, USA, 18–20 October 2023; pp. 5–6. [Google Scholar] [CrossRef]
- Wen, S.; Feng, C.; Meng, Q.; Zhang, B.; Wu, L.; Tang, C. Multi-packet symbolic execution testing for network protocol binary software. In Proceedings of the 2016 5th International Conference on Computer Science and Network Technology (ICCSNT), Changchun, China, 10–11 December 2016; pp. 624–627. [Google Scholar] [CrossRef]
- Wen, S.; Feng, C.; Meng, Q.; Zhang, B.; Wu, L.; Tang, C. Model-guided symbolic execution testing for network protocol binary software. In Proceeding of the 2016 International Conference on Progress in Informatics and Computing (PIC), Shanghai, China, 23–25 December 2016; pp. 561–565. [Google Scholar] [CrossRef]
- Wen, S.; Feng, C.; Meng, Q.; Zhang, B.; Wu, L.; Tang, C. Analyzing network protocol binary software with joint symbolic execution. In Proceedings of the 2016 3rd International Conference on Systems and Informatics (ICSAI), Shanghai, China, 19–21 November 2016; pp. 738–742. [Google Scholar] [CrossRef]
- Li, M.; Wang, Y.; Xie, P. A binary analysis method for protocol deviation discovery from implementations. In Proceedings of the International Conference on Information Networking 2013 (ICOIN), Bangkok, Thailand, 28–30 January 2013; pp. 670–675. [Google Scholar] [CrossRef]
- Zhan, M.; Li, Y.; Li, B.; Zhang, J.; Li, C.; Wang, W. Toward Automated Field Semantics Inference for Binary Protocol Reverse Engineering. IEEE Trans. Inf. Forensics Secur. 2024, 19, 764–776. [Google Scholar] [CrossRef]
0 | 1 | 2 | 3 | 4 | 5 | 6…n−2 | n−1 |
---|---|---|---|---|---|---|---|
Segment Receiver | Address Receiver | Segment Sender | Address Sender | Length (from 5 to n−1 byte) | Command | Parameters (Optionally) | Check sum |
0 | 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 |
---|---|---|---|---|---|---|---|---|---|---|---|---|
Segment Receiver | Address Receiver | Segment Sender | Address Sender | Length | Command | Flags | Bottles | Info 1 | Info 2 | Check sum |
Disclaimer/Publisher’s Note: The statements, opinions and data contained in all publications are solely those of the individual author(s) and contributor(s) and not of MDPI and/or the editor(s). MDPI and/or the editor(s) disclaim responsibility for any injury to people or property resulting from any ideas, methods, instructions or products referred to in the content. |
© 2024 by the authors. Licensee MDPI, Basel, Switzerland. This article is an open access article distributed under the terms and conditions of the Creative Commons Attribution (CC BY) license (https://creativecommons.org/licenses/by/4.0/).
Share and Cite
Boychev, I.; Spasova, G. Development of a Simulator for Testing Software Systems Working with a Binary Protocol. Eng. Proc. 2024, 70, 36. https://doi.org/10.3390/engproc2024070036
Boychev I, Spasova G. Development of a Simulator for Testing Software Systems Working with a Binary Protocol. Engineering Proceedings. 2024; 70(1):36. https://doi.org/10.3390/engproc2024070036
Chicago/Turabian StyleBoychev, Iliyan, and Gergana Spasova. 2024. "Development of a Simulator for Testing Software Systems Working with a Binary Protocol" Engineering Proceedings 70, no. 1: 36. https://doi.org/10.3390/engproc2024070036