Network protocol detection method and system based on linux system
By creating a directory on the Linux system to store tcpdump tools and pv tools, and writing an executable script library to automate the detection task, the existing network protocol detection methods are solved, and the flexibility and accuracy are improved.
Patent Information
- Application Number
- CN202510301645.7
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2025-03-14
- Publication Date
- 2025-06-06
AI Technical Summary
The existing network protocol detection methods are based on fixed detection conditions and parameters, and cannot provide flexible detection strategies, resulting in the inability to effectively respond to dynamic changes in the network environment.
By creating a directory on the Linux system to store the tcpdump tool and pv tool, and writing an executable script library, we automatically complete the decompression and installation of the tool, configure the detection conditions and set real-time detection parameters.
It improves the flexibility and accuracy of network protocol detection, reduces manual intervention and human errors, realizes automated detection, and can quickly adapt to changes in the network environment.
Smart Images

Figure CN120110969A_ABST
Abstract
Description
Technical Field
[0001] The present invention relates to the technical field of network security, and in particular to a network protocol detection method and system based on a Linux system. Background Art
[0002] Network protocol detection technology is usually used to analyze and monitor network traffic, identify protocol types, detect network failures, and discover potential security threats. Existing network protocol detection methods usually rely on specific tools and manual configuration. In actual applications, due to the complexity and dynamic changes of the network environment, traditional methods often face some technical difficulties. On the one hand, existing technologies usually rely on users to manually install and configure tools. This process is not only time-consuming, but also easily affected by differences in operating system environments and tool versions, resulting in inconsistent tool installation. On the other hand, existing technologies are usually based on fixed detection conditions and parameters, and fail to provide flexible network protocol detection strategies. With the dynamic changes of the network environment, existing methods may not be able to adapt to new detection needs in real time, especially when the network traffic fluctuates greatly, manual configuration adjustments may not be able to respond in time. Summary of the invention
[0003] The present application provides a network protocol detection method and system based on the Linux system, aiming to solve the technical problem that the network protocol detection in the prior art is usually based on fixed detection conditions and parameters, cannot provide flexible network protocol detection strategies, cannot effectively respond to dynamic changes in the network environment, and thus leads to a lack of adaptability in the detection process.
[0004] The first aspect disclosed in the present application provides a network protocol detection method based on a Linux system, the method comprising: creating a directory based on the Linux system, the directory comprising a tcpdump tool compression package and a pv tool compression package; writing an executable script library, the executable script library comprising a first executable script, a second executable script and a third executable script, the first executable script being used to decompress and install the tcpdump tool compression package and the pv tool compression package, the second executable script being used to set preset detection conditions through the tcpdump tool compression package, the third executable script being used to set real-time detection parameters through the tcpdump tool compression package and save them in the directory; connecting a test device to a local area network to run the executable script library, and obtaining a network protocol detection result in the directory.
[0005] The second aspect disclosed in the present application provides a network protocol detection system based on a Linux system, the system being used for the above-mentioned network protocol detection method based on a Linux system, the system comprising: a directory creation module, for creating a directory based on the Linux system, the directory comprising a tcpdump tool compression package and a pv tool compression package; a script library writing module, for writing an executable script library, the executable script library comprising a first executable script, a second executable script and a third executable script, the first executable script being used to decompress and install the tcpdump tool compression package and the pv tool compression package, the second executable script being used to set preset detection conditions through the tcpdump tool compression package, the third executable script being used to set real-time detection parameters through the tcpdump tool compression package and save them in the directory; a script library running module, for connecting a test device to a local area network to run the executable script library, and obtaining a network protocol detection result in the directory.
[0006] One or more technical solutions provided in this application have at least the following beneficial effects:
[0007] By creating a directory based on the Linux system to store the tcpdump tool compression package and the pv tool compression package, the relevant tool files can be centrally managed to ensure the convenience of subsequent installation and use. This process reduces the complexity of the scattered storage of tool files and ensures the accessibility and standardized management of necessary tools; an executable script library with three functions is written, which automatically completes the steps of tool decompression and installation, configuration of network protocol detection conditions, and setting of real-time detection parameters through executable scripts, thereby improving deployment efficiency, reducing the need for manual intervention, and reducing the risk of human error. In particular, the design of the second and third scripts ensures the accuracy and flexibility of network protocol detection through preset conditions and real-time parameter settings, and the scripted approach makes it possible to The implementation of the entire network protocol detection method can be standardized and quickly replicated, suitable for different test scenarios, and can be easily modified and customized; the test equipment is connected to the local area network to run the executable script library. Through the operation of the executable script library, the test equipment can automatically perform network protocol detection tasks and generate real-time detection data. This automated detection mechanism helps to quickly discover anomalies or problems in network traffic, allowing technicians to respond quickly through data feedback, further improving the efficiency and accuracy of network management; the test results are saved in a specified directory, so that the test results have good traceability and analyticity. The storage of network protocol detection results is helpful for later data analysis and comparison, and improves the visualization level and monitoring capabilities of network management.
[0008] The above description is only an overview of the technical solution of the present application. In order to more clearly understand the technical means of the present application, it can be implemented in accordance with the contents of the specification. In order to make the above and other purposes, features and advantages of the present application more obvious and easy to understand, the specific implementation methods of the present application are listed below. BRIEF DESCRIPTION OF THE DRAWINGS
[0009] Figure 1 A flowchart of a network protocol detection method based on a Linux system is provided in an embodiment of the present application.
[0010] Figure 2 A schematic diagram of the structure of a network protocol detection system based on a Linux system is provided in an embodiment of the present application.
[0011] Description of the reference numerals: directory creation module 10 , script library writing module 20 , script library running module 30 . DETAILED DESCRIPTION
[0012] The embodiment of the present application provides a network protocol detection method and system based on the Linux system, which solves the technical problem that the network protocol detection in the prior art is usually based on fixed detection conditions and parameters, cannot provide flexible network protocol detection strategies, and cannot effectively respond to dynamic changes in the network environment, thereby causing the detection process to lack adaptability.
[0013] After introducing the basic principles of the present application, various non-limiting implementation methods of the present application will be specifically introduced below in conjunction with the accompanying drawings of the specification. It should be understood that the specific embodiments described herein are only used to explain the present application and are not used to limit the present application.
[0014] Embodiment 1, as Figure 1 As shown, the embodiment of the present application provides a network protocol detection method based on the Linux system, the method comprising:
[0015] Step S100: creating a directory based on the Linux system, wherein the directory includes a tcpdump tool compression package and a pv tool compression package.
[0016] Create a new directory on the Linux system. The purpose of this directory is to store the subsequent tool compression package files. Creating a directory usually requires specifying a path. Usually, this directory should be in a place that is easy to manage, such as a user directory or a temporary directory. After creating the directory, put the required tool compression package into the directory. Specifically, download or copy the tcpdump tool compression package and the pv tool compression package to the newly created directory. These compression packages contain the tool installation files and necessary dependencies for the purpose of facilitating subsequent installation and use. After putting the compression package in, confirm that the compression package is not damaged and contains complete installation files. Usually, this step ensures that the source of the compression package is reliable to avoid problems in the subsequent installation or use process due to damage or incompleteness of the compression package.
[0017] Step S200: Write an executable script library, the executable script library includes a first executable script, a second executable script and a third executable script, the first executable script is used to decompress and install the tcpdump tool compressed package and the pv tool compressed package, the second executable script is used to set preset detection conditions through the tcpdump tool compressed package, and the third executable script is used to set real-time detection parameters through the tcpdump tool compressed package and save them in the directory.
[0018] Write the first executable script, the main function of which is to decompress and install the tcpdump tool compressed package and the pv tool compressed package. The first executable script first checks whether the tcpdump and pv tools have been installed in the system. If not, the script will automatically decompress and install them. The decompression process usually involves decompressing the compressed package file in .tar.gz or .zip format to the specified directory, and then completing the installation of the tool by executing the installation command. The script needs to include conditional judgment logic to ensure that the decompression and installation operations are performed only when necessary. If the tool has been installed, this process can be skipped.
[0019] Write a second executable script, which is used to set preset conditions for network protocol detection to ensure that network monitoring meets the predetermined detection requirements. The script uses the tcpdump tool to configure the packet capture parameters according to the preset conditions. The preset conditions include specifying network parameters such as network interface, IP address, port number, protocol number, etc. These settings help filter and accurately monitor the required network traffic. The script also needs to set interval time, network rate threshold, and overall traffic threshold, etc., for real-time monitoring and evaluation of network status. These conditions are set through the tcpdump command line parameters or configuration files.
[0020] Write a third executable script. The function of this script is to obtain and display network detection parameters in real time through the tcpdump tool and save them to a directory. This script sets the detection parameters of the network protocol in real time, such as real-time rate, overall traffic, etc., and captures and displays them through the tcpdump tool. The script needs to ensure that the data display of these real-time parameters can intuitively reflect the network status and display them through visual pop-up windows. In addition, the script also needs to save the real-time detection data to a specified directory for subsequent analysis and recording.
[0021] Step S300: Connect the test device to the local area network to run the executable script library, and obtain the network protocol detection result in the directory.
[0022] Connect the test device to the local area network so that network traffic can be captured and monitored. The test device is a computer or network analysis device. The test device is connected to the local area network through a physical or wireless network interface. Usually, the device is connected to the local area network through an Ethernet interface or Wi-Fi. Run the previously written executable script library on the test device, usually in sequence, that is, execute the first script to decompress and install tcpdump and pv tools, execute the second script to set the preset detection conditions, execute the third script to configure the real-time detection parameters and start capturing packets, and display relevant monitoring information in real time.
[0023] After running the script library, the test device monitors the network protocol and finally obtains the network protocol detection results. Specifically, through the tcpdump tool, the test device captures the network traffic, and filters and records it according to the previously set conditions. The detection results include real-time traffic rate, overall traffic data, and whether it meets the set network rate and traffic thresholds. If the detection conditions are met, it will be displayed as passed, otherwise it will be displayed as failed. The script saves these network protocol detection results in the specified directory.
[0024] Furthermore, the first executable script is used to decompress and install the tcpdump tool compressed package and the pv tool compressed package, and the method includes:
[0025] Step S210: Determine whether the tcpdump environment and the pv environment have been installed in the Linux system; Step S220: If the tcpdump environment and the pv environment are not installed in the Linux system, run the first executable script to decompress and install the tcpdump tool compressed package and the pv tool compressed package; Step S230: If the tcpdump environment and the pv environment have been installed in the Linux system, skip the first executable script and run the second executable script and the third executable script.
[0026] Check whether the two tools tcpdump and pv have been installed in the Linux system. Specifically, use the command line to check whether the tools have been installed. You can check whether the command exists. For tcpdump, you can use the command which tcpdump or tcpdump-v to check whether the version information is returned. If the version number or path is returned, it means that it has been installed. For pv, you can also use which pv or pv-V to check whether it has been installed. If tcpdump and pv are both installed, these two commands will return corresponding information; if they are not installed, they will have no output.
[0027] If it is determined that tcpdump or pv is not installed, then it is necessary to use the first executable script to decompress and install these tools. Specifically, the first executable script uses the tar or unzip command to decompress the compressed packages of tcpdump and pv, copy the decompressed files to a suitable directory, such as / usr / local / bin, and ensure that the tools are executable.
[0028] If tcpdump and pv are already installed in the system, there is no need to reinstall them. In this case, skip the first executable script, that is, the decompression and installation process, and directly execute the second and third executable scripts.
[0029] Furthermore, the second executable script is used to set preset detection conditions through the tcpdump tool compression package, wherein the preset detection conditions include the specified filtered network card interface name, IP address, port number, protocol number, interval time, network rate threshold and overall traffic threshold.
[0030] The second executable script is responsible for using the tcpdump tool to set preset detection conditions. By configuring the preset detection conditions, the script can accurately filter and capture specific network traffic for easy monitoring and analysis. The design of preset detection conditions helps improve monitoring efficiency and reduce unnecessary data capture and computing burdens.
[0031] Among them, the script first needs to specify the network card interface name used to capture network traffic. Common interface names include eth0, wlan0, etc., which represent different network interfaces. Choosing a suitable network card interface can ensure that packet capture only occurs on relevant network traffic, avoiding irrelevant traffic from affecting the monitoring results; set the target IP address or IP range to be captured. By limiting the captured IP address, you can ensure that only traffic from a specific device or network segment is analyzed; configure the port number to be monitored. Only capturing traffic on a specific port helps to filter out network data of certain application layer protocols (such as HTTP, FTP, etc.). You can specify a single port number or port range; by specifying the protocol number, the script can filter out specific types of traffic, such as TCP, UDP, ICMP and other protocols. Using the protocol number can effectively limit the scope of packet capture and help capture packets of specific protocol types; configure the time interval for capturing packets. By setting the interval time, the script can periodically capture network traffic within the specified time to adapt to different monitoring needs. The selection of the interval time should be based on actual needs, such as capturing data once per second.
[0032] The network rate threshold refers to the rate threshold of network traffic. Network traffic exceeding this threshold will be given special attention or reported. Setting the network rate threshold helps detect abnormal traffic or excessive network load. Usually, the network rate threshold is measured in bits per second (bps), kilobits per second (kbps), megabits per second (Mbps), etc. The overall traffic threshold refers to the sum of network traffic within a certain period of time. If the network traffic exceeds this threshold, a warning or report is triggered, which can help detect large-scale traffic changes, such as a sudden increase in bandwidth usage.
[0033] Furthermore, the third executable script is used to set the real-time detection parameters through the tcpdump tool compression package and save them in the directory. The real-time detection parameters are displayed in a visual pop-up window through the tcpdump tool compression package, wherein the real-time detection parameters include at least the real-time rate size and the overall traffic size.
[0034] The third executable script sets real-time detection parameters through the tcpdump tool, saves these parameters to a specified directory, and displays real-time monitoring information in a visual pop-up window on the interface. Specifically,
[0035] In the third executable script, tcpdump is used to continuously capture network traffic and calculate real-time detection parameters. The tcpdump tool can provide rich network data capture capabilities, support accurate filtering and real-time analysis, and by setting appropriate command line parameters, tcpdump can obtain the real-time rate size and the overall traffic size. The real-time rate size is calculated by counting the number of data packets or data volume per unit time. The real-time rate size indicates the rate of current network traffic and reflects the speed of network connection; the overall traffic size is calculated by accumulating the size of the data packets captured within a time period. The overall traffic size indicates the total amount of data transmitted over the network within a period of time, reflecting the network traffic usage within a given time period. The setting and capture of real-time detection parameters are intended to continuously monitor the real-time status of network traffic and provide immediate feedback of this information to users so that they can respond in a timely manner.
[0036] The third executable script displays real-time detection parameters, including real-time rate and overall traffic size, through a visual pop-up window, so that users can intuitively see the current network status. The implementation of a visual pop-up window usually relies on a graphical user interface tool. On a Linux system, you can use zenity, kdialog or other lightweight graphical user interface tools to create a simple pop-up window. These tools can display real-time data in a graphical interface. For example, the script can update the pop-up window content once a second to display the current real-time rate and overall traffic. This pop-up window is usually floating, can display updated values in real time, and can be automatically closed or disappear. This method can help users quickly capture network problems and facilitate further diagnosis or adjustments.
[0037] Further, obtaining the network protocol detection result under the directory, the method includes:
[0038] Step S310: Determine whether the real-time rate size in the protection file of the directory is within the network rate threshold set by the preset detection condition; Step S320: If it is within the network rate threshold set by the preset detection condition, make the network protocol detection result pass; Step S330: If it is not within the network rate threshold set by the preset detection condition, make the network protocol detection result fail.
[0039] Check whether the real-time rate in the protection file under the specified directory meets the preset network rate threshold. The protection file is used to store real-time monitoring data and is generated by a third executable script during the real-time monitoring process. It contains the real-time rate size. The script reads the real-time rate size in the protection file and then compares the real-time rate size with the preset network rate threshold.
[0040] If the real-time rate in the protection file meets the set threshold conditions, for example, the rate is less than or equal to 100Mbps, the network status is considered normal. In this case, the detection result is set to pass, indicating that the network traffic is within an acceptable range and meets the set expected conditions, without abnormal or excessive traffic fluctuations.
[0041] If the real-time rate in the protection file exceeds the preset threshold condition, for example, the rate exceeds 100Mbps, it means that the network traffic exceeds the normal range and further diagnosis and processing may be required. In this case, the network protocol detection result is marked as failed, indicating that abnormal traffic is detected and further measures need to be taken, such as checking network health, traffic optimization, equipment troubleshooting, etc.
[0042] Furthermore, obtaining the network protocol detection result under the directory, the method also includes:
[0043] Step S340: Determine whether the total traffic size in the protection files of the directory is within the total traffic threshold set by the preset detection condition; Step S350: If it is within the total traffic threshold set by the preset detection condition, make the network protocol detection result pass; Step S360: If it is not within the total traffic threshold set by the preset detection condition, make the network protocol detection result fail.
[0044] Check whether the total flow size in the protection file meets the preset total flow threshold. The protection file records the total flow size detected in real time. The script reads the total flow size in the protection file and then compares it with the preset total flow threshold.
[0045] If the overall traffic meets the preset threshold conditions, for example, the overall traffic does not exceed 1GB, the current network traffic load is considered healthy and the network protocol detection result should be passed, indicating that the network traffic is within the expected range and meets normal traffic conditions.
[0046] If the overall traffic exceeds the preset threshold, for example, the overall traffic exceeds 1GB, it means that the network may be under excessive traffic load, which may cause network congestion, performance degradation, or abnormal traffic. In this case, the network protocol detection result is marked as failed, indicating that abnormal traffic has been detected and further action is needed, such as investigating the source of the traffic, analyzing potential security issues, optimizing bandwidth, etc.
[0047] Furthermore, when the network protocol detection result is passed, the record result is displayed in green; when the network protocol detection result is failed, the record result is displayed in red.
[0048] When the network protocol detection result is passed, that is, the network traffic is within the preset rate or traffic threshold, the result is recorded and displayed in green. In implementation, green can be used to indicate success or health status, such as highlighting this status in the console, report file, log file, GUI interface or pop-up window.
[0049] When the network protocol test result is failed, that is, the network traffic does not meet the preset rate or traffic threshold conditions, the result needs to be recorded and displayed in red. Red is usually used to indicate warnings, errors or problems, which means that the network traffic is abnormal and needs to be checked and processed. Displaying the failed test results in red helps administrators or users notice possible network problems. Red can be used to highlight the status in logs, report files or GUI interfaces.
[0050] Furthermore, the test device is connected to a local area network to run the executable script library, and the method includes:
[0051] Step S300-1: Generate a flow rate sample signal for network protocol detection; Step S300-2: The test device sends a signal according to the flow rate sample signal, and obtains real-time detection parameters displayed in a visual pop-up window under the directory.
[0052] The purpose of generating a traffic rate sample signal is to create a test traffic with a specific rate and characteristics to simulate actual network traffic. These signals can help test and verify the performance of the network protocol detection system and ensure that the system can correctly capture and analyze traffic. Specifically, define the traffic rate samples required for the test. These samples can simulate normal traffic, peak traffic, or abnormal traffic (such as bandwidth bursts). For example, different rates can be selected for testing, such as 10Mbps, 50Mbps, 100Mbps, etc.; control the traffic size, protocol type, sending frequency, data packet size, etc. through the configuration tool to ensure that the generated sample signal meets the needs of network protocol detection.
[0053] Connect the test device to the target network and configure it to receive and analyze the generated traffic sample signal. You can run tcpdump to capture traffic, or control the sending of traffic through a script. Through the traffic generation tool, run the defined third executable script on the test device according to the preset traffic rate sample signal, and start real-time monitoring and capturing network traffic through the tcpdump tool. The tcpdump tool will capture the packets passing through the network interface and analyze the real-time network rate, traffic size and other parameters. The captured real-time detection data will be displayed to the user through a visual pop-up window, showing information such as "Current rate: 50Mbps", "Total traffic: 200MB", etc. The pop-up window will be updated regularly to show the latest traffic rate and total traffic to ensure that users can view the network status in real time.
[0054] In summary, the network protocol detection method based on the Linux system provided by the embodiment of the present application has the following technical effects:
[0055] By creating a directory based on the Linux system to store the tcpdump tool compression package and the pv tool compression package, the relevant tool files can be centrally managed to ensure the convenience of subsequent installation and use. This process reduces the complexity of the scattered storage of tool files and ensures the accessibility and standardized management of necessary tools; an executable script library with three functions is written, which automatically completes the steps of tool decompression and installation, configuration of network protocol detection conditions, and setting of real-time detection parameters through executable scripts, thereby improving deployment efficiency, reducing the need for manual intervention, and reducing the risk of human error. In particular, the design of the second and third scripts ensures the accuracy and flexibility of network protocol detection through preset conditions and real-time parameter settings, and the scripted approach makes it possible to The implementation of the entire network protocol detection method can be standardized and quickly replicated, suitable for different test scenarios, and can be easily modified and customized; the test equipment is connected to the local area network to run the executable script library. Through the operation of the executable script library, the test equipment can automatically perform network protocol detection tasks and generate real-time detection data. This automated detection mechanism helps to quickly discover anomalies or problems in network traffic, allowing technicians to respond quickly through data feedback, further improving the efficiency and accuracy of network management; the test results are saved in a specified directory, so that the test results have good traceability and analyticity. The storage of network protocol detection results is helpful for later data analysis and comparison, and improves the visualization level and monitoring capabilities of network management.
[0056] Embodiment 2 is based on the same inventive concept as the network protocol detection method based on Linux system in the above embodiment. Figure 2 As shown, the embodiment of the present application provides a network protocol detection system based on the Linux system, and the system includes:
[0057] The directory creation module 10 is used to create a directory based on the Linux system, wherein the directory includes a tcpdump tool compression package and a pv tool compression package.
[0058] The script library writing module 20 is used to write an executable script library, and the executable script library includes a first executable script, a second executable script and a third executable script. The first executable script is used to decompress and install the tcpdump tool compression package and the pv tool compression package, the second executable script is used to set preset detection conditions through the tcpdump tool compression package, and the third executable script is used to set real-time detection parameters through the tcpdump tool compression package and save them in the directory.
[0059] The script library running module 30 is used to connect the test device to the local area network to run the executable script library and obtain the network protocol detection result in the directory.
[0060] Furthermore, the script library writing module 20 includes:
[0061] The environment judgment unit is used to judge whether the tcpdump environment and the pv environment have been installed in the Linux system.
[0062] The tool compression package running unit is used to run the first executable script to decompress and install the tcpdump tool compression package and the pv tool compression package if the tcpdump environment and the pv environment are not installed in the Linux system.
[0063] The first executable script skipping unit is used to skip the first executable script and run the second executable script and the third executable script if the tcpdump environment and the pv environment have been installed in the Linux system.
[0064] Furthermore, the second executable script is used to set preset detection conditions through the tcpdump tool compression package, wherein the preset detection conditions include the specified filtered network card interface name, IP address, port number, protocol number, interval time, network rate threshold and overall traffic threshold.
[0065] Furthermore, the third executable script is used to set the real-time detection parameters through the tcpdump tool compression package and save them in the directory. The real-time detection parameters are displayed in a visual pop-up window through the tcpdump tool compression package, wherein the real-time detection parameters include at least the real-time rate size and the overall traffic size.
[0066] Furthermore, the script library running module 30 includes:
[0067] The real-time rate size determination unit is used to determine whether the real-time rate size in the protection file of the directory is within the network rate threshold set by the preset detection condition.
[0068] The first judgment unit is used to determine that the network protocol detection result is passed if the network rate threshold set by the preset detection condition is met.
[0069] The second judgment unit is used to determine that the network protocol detection result is failed if the network rate threshold set by the preset detection condition is not met.
[0070] Furthermore, the script library running module 30 includes:
[0071] The overall flow size determination unit is used to determine whether the overall flow size in the protection files of the directory is within the overall flow threshold set by the preset detection condition.
[0072] The third judgment unit is used to determine that the network protocol detection result is passed if the overall flow threshold set by the preset detection condition is met.
[0073] The fourth judgment unit is used to determine that the network protocol detection result is failed if the overall flow threshold set by the preset detection condition is not met.
[0074] Furthermore, the script library running module 30 includes:
[0075] The first display unit is used to display the record result in green when the network protocol detection result is passed.
[0076] The second display unit is used to display the record result in red when the network protocol detection result is failed.
[0077] Furthermore, the script library running module 30 includes:
[0078] The sample signal generating unit is used to generate a flow rate sample signal for network protocol detection.
[0079] A signal sending unit is used to send a signal according to the flow rate sample signal on the test device, and obtain real-time detection parameters displayed in a visual pop-up window under the directory.
[0080] Through the above detailed description of a network protocol detection method based on a Linux system, those skilled in the art can clearly understand a network protocol detection system based on a Linux system in this 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.
[0081] The above description of the disclosed embodiments enables those skilled in the art to implement or use the present application. Various modifications to these embodiments will be apparent to those skilled in the art, and the general principles defined herein may be implemented in other embodiments without departing from the spirit or scope of the present application. Therefore, the present application will not be limited to the embodiments shown herein, but will conform to the widest scope consistent with the principles and novel features disclosed herein.
Claims
1. A network protocol detection method based on Linux system, characterized in that: The method comprises: Create a directory based on the Linux system, the directory includes a tcpdump tool compression package and a pv tool compression package; Writing an executable script library, the executable script library includes a first executable script, a second executable script and a third executable script, the first executable script is used to decompress and install the tcpdump tool compression package and the pv tool compression package, the second executable script is used to set a preset detection condition through the tcpdump tool compression package, and the third executable script is used to set a real-time detection parameter through the tcpdump tool compression package and save it in the directory; Connect the test device to the local area network, run the executable script library, and obtain the network protocol detection result in the directory.
2. A network protocol detection method based on a Linux system as claimed in claim 1, characterized in that: The first executable script is used to decompress and install the tcpdump tool compressed package and the pv tool compressed package, and the method includes: Determine whether the tcpdump environment and the pv environment have been installed in the Linux system; If the tcpdump environment and the pv environment are not installed in the Linux system, run the first executable script to decompress and install the tcpdump tool compressed package and the pv tool compressed package; If the tcpdump environment and the pv environment have been installed in the Linux system, the first executable script is skipped and the second executable script and the third executable script are run.
3. A network protocol detection method based on a Linux system as claimed in claim 1, characterized in that: The second executable script is used to set preset detection conditions through the tcpdump tool compression package, wherein the preset detection conditions include the specified filtered network card interface name, IP address, port number, protocol number, interval time, network rate threshold and overall traffic threshold.
4. A network protocol detection method based on a Linux system as claimed in claim 1, characterized in that: The third executable script is used to set the real-time detection parameters through the tcpdump tool compression package and save them in the directory. The real-time detection parameters are displayed in a visual pop-up window through the tcpdump tool compression package, wherein the real-time detection parameters at least include the real-time rate size and the overall traffic size.
5. A network protocol detection method based on a Linux system as claimed in claim 1, characterized in that: Obtaining the network protocol detection result in the directory, the method includes: Determine whether the real-time rate size in the protection file of the directory is within the network rate threshold set by the preset detection condition; If the network rate is within the network rate threshold set by the preset detection condition, the network protocol detection result is passed; If the network rate threshold is not reached according to the preset detection condition, the network protocol detection result is deemed as failed.
6. A network protocol detection method based on a Linux system as claimed in claim 1, characterized in that: Obtaining the network protocol detection result in the directory, the method further includes: Determine whether the total flow size in the protection files of the directory is within the total flow threshold set by the preset detection condition; If the overall flow rate threshold set by the preset detection condition is reached, the network protocol detection result is considered passed; If the overall flow rate threshold set by the preset detection condition is not reached, the network protocol detection result is set as failure.
7. A network protocol detection method based on a Linux system as claimed in any one of claims 5 or 6, characterized in that: When the network protocol test result is passed, the record result is displayed in green; When the network protocol detection result is failed, the record result is displayed in red.
8. A network protocol detection method based on a Linux system as claimed in claim 1, characterized in that: Connecting the test device to the local area network to run the executable script library, the method comprising: generating a flow rate sample signal for network protocol detection; The test device sends a signal according to the flow rate sample signal, and obtains real-time detection parameters displayed in a visual pop-up window under the directory.
9. A network protocol detection system based on Linux system, characterized in that: A network protocol detection method based on a Linux system is used to implement any one of claims 1 to 8, the system comprising: A directory creation module is used to create a directory based on the Linux system, wherein the directory includes a tcpdump tool compression package and a pv tool compression package; A script library writing module, used for writing an executable script library, wherein the executable script library includes a first executable script, a second executable script and a third executable script, wherein the first executable script is used for decompressing and installing the tcpdump tool compression package and the pv tool compression package, the second executable script is used for setting preset detection conditions through the tcpdump tool compression package, and the third executable script is used for setting real-time detection parameters through the tcpdump tool compression package and saving them in the directory; The script library running module is used to connect the test device to the local area network to run the executable script library and obtain the network protocol detection result in the directory.
Citation Information
Patent Citations
All-in-one machine software application system batch detection method and system based on flow playback
CN117009217A