mirror of
https://github.com/zeek/zeek.git
synced 2025-10-02 14:48:21 +00:00
Add a field to Modbus/TCP log to indicate the Modbus PDU type
Add the `pdu_type` field to Modbus over TCP logs to indicate whether the Modbus message was a request or a response. Due to the client/server nature of Modbus over TCP/IP, all messages from the TCP session originator are requests, while all messages from the TCP session responder are responses. Adding this information to the default log surfaces protocol metadata in a way that doesn't require users to understand the Modbus over TCP protocol.
This commit is contained in:
parent
bab2036aa4
commit
b85801aa7e
4 changed files with 40000 additions and 39995 deletions
|
@ -22,6 +22,8 @@ export {
|
|||
unit: count &log &optional;
|
||||
## The name of the function message that was sent.
|
||||
func: string &log &optional;
|
||||
## Whether this PDU was a response ("RESP") or request ("REQ")
|
||||
pdu_type: string &log &optional;
|
||||
## The exception if the response was a failure.
|
||||
exception: string &log &optional;
|
||||
};
|
||||
|
@ -55,6 +57,9 @@ event modbus_message(c: connection, headers: ModbusHeaders, is_orig: bool) &prio
|
|||
c$modbus$tid = headers$tid;
|
||||
c$modbus$unit = headers$uid;
|
||||
c$modbus$func = function_codes[headers$function_code];
|
||||
## If this message is from the TCP originator, it is a request. Otherwise,
|
||||
## it is a response.
|
||||
c$modbus$pdu_type = is_orig ? "REQ" : "RESP";
|
||||
}
|
||||
|
||||
event modbus_message(c: connection, headers: ModbusHeaders, is_orig: bool) &priority=-5
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue