Disclosure of Invention
The invention provides a method and a device for recording equipment network behaviors, aiming at the technical problem of how to record the equipment network behaviors aiming at various network applications, so that the equipment network behaviors can be quickly backtracked and analyzed.
In order to solve the technical problems, the technical scheme adopted by the invention is as follows:
a device network behavior recording method comprises the following steps:
step 1: acquiring original network data packets of various devices in a service network in real time;
step 2: classifying and identifying original network data packets according to IP protocol family classification to obtain protocol and management data packets and service application data packets;
and step 3: establishing a protocol interaction characteristic index for each protocol and management data packet according to the protocol context relationship, taking each protocol identifier as a data table name, and storing the protocol and management data packet into a data table of the protocol identifier corresponding to the data packet; and establishing a service link characteristic index for each service application data packet according to the service type and the context relationship, taking each service link identifier as a data table name, and storing the service application data packet into a data table of the service link identifier corresponding to the data packet.
Further, the protocol interaction feature index is time, an initiator device MAC address, an initiator device IP address, a feedback device MAC address, and a feedback device IP address.
Further, the protocol identifications are ARP, ICMP, RIP, OSPF, BGP, DHCP, DNS, and SNMP.
Further, the service link characteristic index is time, a service network device MAC address, a service network device IP address, a service network device link port, an internet device IP address, an internet device domain name, a transport protocol, and an external network device service port.
Further, the service link identifier is an intranet device MAC + IP address.
Further, the data table identified by each protocol as a table name and the data table identified by each service link as a table name are both stored in a network behavior database, which is a nosql type database.
The invention also provides a device for recording the network behavior of the equipment, which comprises the following modules:
a network data capturing module: the system is used for capturing original network data packets of various devices in a service network in real time;
a packet classification module: the system is used for classifying and identifying the original network data packet according to IP protocol family classification to obtain a protocol and management data packet and a service application data packet;
protocol and management packet processing module: the system comprises a database, a management data packet and a database, wherein the database is used for storing a protocol context relationship;
a service application data packet processing module: the system is used for establishing a service link characteristic index for each service application data packet according to the service type and the context relationship;
the network behavior data management module: the system is used for establishing a network behavior database, creating a data table with each protocol identifier as a data table name and a data table with each service link identifier as a data table name, storing a protocol and management data packet with the protocol interaction characteristics as an index in the data table with the protocol identifier corresponding to the index as the data table name, and storing a service application data packet with the service link characteristics as the index in the data table with the service link identifier corresponding to the index as the data table name.
The invention also provides a device network behavior backtracking testifying method, which uses the device network behavior recording device and comprises the following steps:
step 1: acquiring a protocol and a management data packet related to each network device from a network behavior database, associating the protocol and the management data packet with a service application data packet of the corresponding network device, and obtaining a network behavior main line of each network device by taking time as a main axis;
step 2: acquiring query conditions of a user, wherein the query conditions are protocols and management data packets corresponding to network equipment, and the query conditions are used for querying the network equipment corresponding to the protocols and the management data packets to be queried from a network behavior database and mapping the network equipment to a network behavior main line of the network equipment;
and step 3: according to the network behavior mainline of the network equipment, the whole process of the external network behavior of the network equipment is traced back, key network events are positioned, the service application data content of the application layer network is extracted, and further the network behavior of the equipment is proved.
The invention also provides a device for backtracking and testifying the network behavior of the equipment, which comprises the following modules:
a network behavior main line construction module: the system comprises a network behavior database, a data processing module and a data processing module, wherein the data processing module is used for acquiring a protocol and a management data packet related to each network device from the network behavior database, associating the protocol and the management data packet with a service application data packet of the network device corresponding to the protocol and the management data packet, and obtaining a network behavior main line of each network device by taking time as a main axis;
the query module: the query condition is a network behavior data packet corresponding to the network equipment, the network equipment corresponding to the network behavior data packet to be queried is obtained by querying from a network behavior database and is mapped to a network behavior main line of the network equipment;
backtracking testimony module: the device is used for backtracking the whole process of the external network behavior of the network device according to the network behavior mainline of the network device inquired by the inquiry module, positioning a key network event, extracting the service application data content of an application layer network, and further proving the network behavior of the device.
By adopting the technical scheme, the invention has the following beneficial effects:
according to the device network behavior recording method and device and the backtracking proof method and device, the network behavior main line of the device is constructed through the classified recording of the network data, so that a clear backtracking mechanism can be established, and further the proof of the key event can be rapidly carried out. The method is different from the traditional network data acquisition and recording method in that the data packets are classified and recorded according to the IP protocol family, so that the fast construction of a behavior main line of the network equipment is realized, and further, the key events can be fast inquired. The traditional network data acquisition and recording method can only realize the query of data packets and cannot provide quick and convenient query support for network behaviors.
Detailed Description
The technical solutions of the present invention will be described clearly and completely with reference to the accompanying drawings, and it should be understood that the described embodiments are some, but not all embodiments of the present invention. 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 invention.
The first embodiment is as follows:
fig. 1 shows a device network behavior recording method according to the present invention, as shown in fig. 1, including the following steps:
step 1: acquiring original network data packets of various devices in a service network in real time;
step 2: classifying and identifying original network data packets according to IP protocol family classification to obtain protocol and management data packets and service application data packets;
and step 3: establishing a protocol interaction characteristic index for each protocol and management data packet according to the protocol context relationship, taking each protocol identifier as a data table name, and storing the protocol and management data packet into a data table of the protocol identifier corresponding to the data packet; and establishing a service link characteristic index for each service application data packet according to the service type and the context relationship, taking each service link identifier as a data table name, and storing the service application data packet into a data table of the service link identifier corresponding to the data packet.
In this embodiment, the protocol interaction feature index is time, an initiator device MAC address, an initiator device IP address, a feedback device MAC address, and a feedback device IP address. The protocol identities are ARP, ICMP, RIP, OSPF, BGP, DHCP, DNS, and SNMP. The service link characteristic index is time, a service network equipment MAC address, a service network equipment IP address, a service network equipment link port, an Internet equipment IP address, an Internet equipment domain name, a transmission protocol (TCP, UDP) and an external network equipment service port, and the service link identifier is an internal network equipment MAC + IP address. Through the classified recording of the network data, as can be seen from the protocol interaction characteristic index and the service link characteristic index, the time, the IP address and the MAC address of the network equipment are related, through the association, and from the data table of the protocol identification and the data table of the service link identification, the protocol, the related data packet and the service application data packet can be subjected to associated mapping, through the recording method, a network behavior main line of each network equipment with the time as a main axis is constructed, and therefore the key event of the network equipment can be rapidly inquired.
In this embodiment, the data table with each protocol identifier as a table name and the data table with each service link identifier as a table name are both stored in a network behavior database, which is a nosql type database.
Example two:
the invention also provides a device for recording the network behavior of the equipment, which uses the method for recording the network behavior of the equipment in the first embodiment and comprises the following modules:
a network data capturing module: the system is used for capturing original network data packets of various devices in a service network in real time;
a packet classification module: the system is used for classifying and identifying the original network data packet according to IP protocol family classification to obtain a protocol and management data packet and a service application data packet;
protocol and management packet processing module: the system comprises a database, a management data packet and a database, wherein the database is used for storing a protocol context relationship;
a service application data packet processing module: the system is used for establishing a service link characteristic index for each service application data packet according to the service type and the context relationship;
the network behavior data management module: the system is used for establishing a network behavior database, creating a data table with each protocol identifier as a data table name and a data table with each service link identifier as a data table name, storing a protocol and management data packet with the protocol interaction characteristics as an index in the data table with the protocol identifier corresponding to the index as the data table name, and storing a service application data packet with the service link characteristics as the index in the data table with the service link identifier corresponding to the index as the data table name.
Because the network data generated by one network device is served for one work in one time period and the network device is served for another work in the next time period, because the network protocol data generated by different works are different, for example, in the interaction process with the external server a, the IP address of the other party in all the network data is the address of the external server a, and when the server B is switched, the IP address is changed to the address of B accordingly, so that the network data can be distinguished. Since these tasks are the behaviors of the network devices, the tasks are arranged in time sequence to form a main line of behavior of the network devices. Therefore, in this embodiment, by constructing the network behavior main line, various operations of the network device can be identified through the recorded network data indexes (the protocol interaction feature index and the service link feature index). Therefore, by using the recording apparatus in this embodiment, the protocol, the associated data packet, and the service application data packet are mapped in an associated manner through the data table of the protocol identifier and the data table of the service link identifier, and a network behavior main line of each network device with time as a main axis is constructed, so that the key event of the network device can be quickly queried.
Example three:
a device network behavior backtracking proof method using the device network behavior recording apparatus in the second embodiment, as shown in fig. 2, includes the following steps:
step 1: and acquiring a protocol and a management data packet related to each network device from the network behavior database, associating the protocol and the management data packet with a service application data packet of the corresponding network device, and obtaining a network behavior main line of each network device by taking time as a main axis. In this embodiment, the network behavior main line is a queue of jobs completed by the network device, and the jobs are distinguished by taking four parameters, i.e., an IP address, a port number, an IP address of an opposite terminal device, and a port number, of the service network device as features and are arranged according to a time sequence.
Step 2: acquiring query conditions of a user, wherein the query conditions are protocols and management data packets corresponding to network equipment, and the query conditions are used for querying the network equipment corresponding to the protocols and the management data packets to be queried from a network behavior database and mapping the network equipment to a network behavior main line of the network equipment;
and step 3: according to the network behavior mainline of the network equipment, the whole process of the external network behavior of the network equipment is traced back, key network events are positioned, the service application data content of the application layer network is extracted, and further the network behavior of the equipment is proved.
In this embodiment, according to the acquired network behavior main line, a work queue completed by the network device within a period of time is obtained, and each work involves three steps of "establishing connection, transmitting data, and disconnecting connection", so that the network behavior can be traced back by constructing the network behavior main line. In addition, the network behavior main line is associated with the management data packet and the service application data packet of the network device corresponding to the management data packet through the protocol, namely, the protocol and the index of the management data packet are associated in the network behavior main line, and the protocol and the management data packet give out all network events in the whole process of the network behavior, so that the key network event can be positioned. Because the index information of the service application data packet is also associated in the network behavior main line, the corresponding service application data content can be extracted.
Example four:
a device network behavior backtracking testifying device uses the device network behavior backtracking testifying method of the third embodiment, and comprises the following modules:
a network behavior main line construction module: the system comprises a network behavior database, a data processing module and a data processing module, wherein the data processing module is used for acquiring a protocol and a management data packet related to each network device from the network behavior database, associating the protocol and the management data packet with a service application data packet of the network device corresponding to the protocol and the management data packet, and obtaining a network behavior main line of each network device by taking time as a main axis;
the query module: the query condition is a network behavior data packet corresponding to the network equipment, the network equipment corresponding to the network behavior data packet to be queried is obtained by querying from a network behavior database and is mapped to a network behavior main line of the network equipment;
backtracking testimony module: the device is used for backtracking the whole process of the external network behavior of the network device according to the network behavior mainline of the network device inquired by the inquiry module, positioning a key network event, extracting the service application data content of an application layer network, and further proving the network behavior of the device.
In this embodiment, since the device network behavior recording apparatus is used, a network behavior main line of a certain network device can be quickly constructed according to the protocols and associated data packets and the service application data packets recorded in the classification, so that when a user queries, the network behavior main line is quickly mapped to the network behavior main line, the whole process of the external network behavior of the network device is traced, and thus the key network event is quickly located.
Finally, it should be noted that: the above embodiments are only used to illustrate the technical solution of the present invention, and not to limit the same; while the invention has been described in detail and with reference to the foregoing embodiments, it will be understood by those skilled in the art that: the technical solutions described in the foregoing embodiments may still be modified, or some or all of the technical features may be equivalently replaced; and the modifications or the substitutions do not make the essence of the corresponding technical solutions depart from the scope of the technical solutions of the embodiments of the present invention.