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;
|
unit: count &log &optional;
|
||||||
## The name of the function message that was sent.
|
## The name of the function message that was sent.
|
||||||
func: string &log &optional;
|
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.
|
## The exception if the response was a failure.
|
||||||
exception: string &log &optional;
|
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$tid = headers$tid;
|
||||||
c$modbus$unit = headers$uid;
|
c$modbus$unit = headers$uid;
|
||||||
c$modbus$func = function_codes[headers$function_code];
|
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
|
event modbus_message(c: connection, headers: ModbusHeaders, is_orig: bool) &priority=-5
|
||||||
|
|
|
@ -5,21 +5,21 @@
|
||||||
#unset_field -
|
#unset_field -
|
||||||
#path modbus
|
#path modbus
|
||||||
#open XXXX-XX-XX-XX-XX-XX
|
#open XXXX-XX-XX-XX-XX-XX
|
||||||
#fields ts uid id.orig_h id.orig_p id.resp_h id.resp_p tid unit func exception
|
#fields ts uid id.orig_h id.orig_p id.resp_h id.resp_p tid unit func pdu_type exception
|
||||||
#types time string addr port addr port count count string string
|
#types time string addr port addr port count count string string string
|
||||||
XXXXXXXXXX.XXXXXX CHhAvVGS1DHFjwGM9 192.168.66.235 2582 166.161.16.230 502 0 1 unknown-156 -
|
XXXXXXXXXX.XXXXXX CHhAvVGS1DHFjwGM9 192.168.66.235 2582 166.161.16.230 502 0 1 unknown-156 RESP -
|
||||||
XXXXXXXXXX.XXXXXX CHhAvVGS1DHFjwGM9 192.168.66.235 2582 166.161.16.230 502 0 1 unknown-29 -
|
XXXXXXXXXX.XXXXXX CHhAvVGS1DHFjwGM9 192.168.66.235 2582 166.161.16.230 502 0 1 unknown-29 REQ -
|
||||||
XXXXXXXXXX.XXXXXX CHhAvVGS1DHFjwGM9 192.168.66.235 2582 166.161.16.230 502 0 1 unknown-160 -
|
XXXXXXXXXX.XXXXXX CHhAvVGS1DHFjwGM9 192.168.66.235 2582 166.161.16.230 502 0 1 unknown-160 RESP -
|
||||||
XXXXXXXXXX.XXXXXX CHhAvVGS1DHFjwGM9 192.168.66.235 2582 166.161.16.230 502 0 1 unknown-33 -
|
XXXXXXXXXX.XXXXXX CHhAvVGS1DHFjwGM9 192.168.66.235 2582 166.161.16.230 502 0 1 unknown-33 REQ -
|
||||||
XXXXXXXXXX.XXXXXX CHhAvVGS1DHFjwGM9 192.168.66.235 2582 166.161.16.230 502 0 0 WRITE_SINGLE_REGISTER -
|
XXXXXXXXXX.XXXXXX CHhAvVGS1DHFjwGM9 192.168.66.235 2582 166.161.16.230 502 0 0 WRITE_SINGLE_REGISTER REQ -
|
||||||
XXXXXXXXXX.XXXXXX CHhAvVGS1DHFjwGM9 192.168.66.235 2582 166.161.16.230 502 0 1 unknown-162 -
|
XXXXXXXXXX.XXXXXX CHhAvVGS1DHFjwGM9 192.168.66.235 2582 166.161.16.230 502 0 1 unknown-162 RESP -
|
||||||
XXXXXXXXXX.XXXXXX CHhAvVGS1DHFjwGM9 192.168.66.235 2582 166.161.16.230 502 21504 1 unknown-35 -
|
XXXXXXXXXX.XXXXXX CHhAvVGS1DHFjwGM9 192.168.66.235 2582 166.161.16.230 502 21504 1 unknown-35 REQ -
|
||||||
XXXXXXXXXX.XXXXXX CHhAvVGS1DHFjwGM9 192.168.66.235 2582 166.161.16.230 502 0 1 unknown-36 -
|
XXXXXXXXXX.XXXXXX CHhAvVGS1DHFjwGM9 192.168.66.235 2582 166.161.16.230 502 0 1 unknown-36 REQ -
|
||||||
XXXXXXXXXX.XXXXXX CHhAvVGS1DHFjwGM9 192.168.66.235 2582 166.161.16.230 502 0 1 unknown-37 -
|
XXXXXXXXXX.XXXXXX CHhAvVGS1DHFjwGM9 192.168.66.235 2582 166.161.16.230 502 0 1 unknown-37 REQ -
|
||||||
XXXXXXXXXX.XXXXXX CHhAvVGS1DHFjwGM9 192.168.66.235 2582 166.161.16.230 502 0 0 unknown-38 -
|
XXXXXXXXXX.XXXXXX CHhAvVGS1DHFjwGM9 192.168.66.235 2582 166.161.16.230 502 0 0 unknown-38 REQ -
|
||||||
XXXXXXXXXX.XXXXXX CHhAvVGS1DHFjwGM9 192.168.66.235 2582 166.161.16.230 502 0 1 unknown-175 -
|
XXXXXXXXXX.XXXXXX CHhAvVGS1DHFjwGM9 192.168.66.235 2582 166.161.16.230 502 0 1 unknown-175 RESP -
|
||||||
XXXXXXXXXX.XXXXXX CHhAvVGS1DHFjwGM9 192.168.66.235 2582 166.161.16.230 502 0 1 unknown-179 -
|
XXXXXXXXXX.XXXXXX CHhAvVGS1DHFjwGM9 192.168.66.235 2582 166.161.16.230 502 0 1 unknown-179 RESP -
|
||||||
XXXXXXXXXX.XXXXXX CHhAvVGS1DHFjwGM9 192.168.66.235 2582 166.161.16.230 502 12032 0 unknown-0 -
|
XXXXXXXXXX.XXXXXX CHhAvVGS1DHFjwGM9 192.168.66.235 2582 166.161.16.230 502 12032 0 unknown-0 REQ -
|
||||||
XXXXXXXXXX.XXXXXX CHhAvVGS1DHFjwGM9 192.168.66.235 2582 166.161.16.230 502 0 0 unknown-0 -
|
XXXXXXXXXX.XXXXXX CHhAvVGS1DHFjwGM9 192.168.66.235 2582 166.161.16.230 502 0 0 unknown-0 REQ -
|
||||||
XXXXXXXXXX.XXXXXX CHhAvVGS1DHFjwGM9 192.168.66.235 2582 166.161.16.230 502 0 1 unknown-165 -
|
XXXXXXXXXX.XXXXXX CHhAvVGS1DHFjwGM9 192.168.66.235 2582 166.161.16.230 502 0 1 unknown-165 RESP -
|
||||||
#close XXXX-XX-XX-XX-XX-XX
|
#close XXXX-XX-XX-XX-XX-XX
|
||||||
|
|
File diff suppressed because it is too large
Load diff
|
@ -5,11 +5,11 @@
|
||||||
#unset_field -
|
#unset_field -
|
||||||
#path modbus
|
#path modbus
|
||||||
#open XXXX-XX-XX-XX-XX-XX
|
#open XXXX-XX-XX-XX-XX-XX
|
||||||
#fields ts uid id.orig_h id.orig_p id.resp_h id.resp_p tid unit func exception
|
#fields ts uid id.orig_h id.orig_p id.resp_h id.resp_p tid unit func pdu_type exception
|
||||||
#types time string addr port addr port count count string string
|
#types time string addr port addr port count count string string string
|
||||||
XXXXXXXXXX.XXXXXX CHhAvVGS1DHFjwGM9 10.1.1.234 51411 10.10.5.104 502 1119 255 READ_INPUT_REGISTERS -
|
XXXXXXXXXX.XXXXXX CHhAvVGS1DHFjwGM9 10.1.1.234 51411 10.10.5.104 502 1119 255 READ_INPUT_REGISTERS REQ -
|
||||||
XXXXXXXXXX.XXXXXX CHhAvVGS1DHFjwGM9 10.1.1.234 51411 10.10.5.104 502 2606 255 READ_INPUT_REGISTERS -
|
XXXXXXXXXX.XXXXXX CHhAvVGS1DHFjwGM9 10.1.1.234 51411 10.10.5.104 502 2606 255 READ_INPUT_REGISTERS RESP -
|
||||||
XXXXXXXXXX.XXXXXX ClEkJM2Vm5giqnMf4h 10.1.1.234 51411 10.10.5.104 502 6714 255 READ_INPUT_REGISTERS -
|
XXXXXXXXXX.XXXXXX ClEkJM2Vm5giqnMf4h 10.1.1.234 51411 10.10.5.104 502 6714 255 READ_INPUT_REGISTERS RESP -
|
||||||
XXXXXXXXXX.XXXXXX C4J4Th3PJpwUYZZ6gc 10.1.1.234 51411 10.10.5.104 502 12993 255 READ_INPUT_REGISTERS -
|
XXXXXXXXXX.XXXXXX C4J4Th3PJpwUYZZ6gc 10.1.1.234 51411 10.10.5.104 502 12993 255 READ_INPUT_REGISTERS REQ -
|
||||||
XXXXXXXXXX.XXXXXX CtPZjS20MLrsMUOJi2 10.1.1.234 51411 10.10.5.104 502 17667 255 READ_INPUT_REGISTERS -
|
XXXXXXXXXX.XXXXXX CtPZjS20MLrsMUOJi2 10.1.1.234 51411 10.10.5.104 502 17667 255 READ_INPUT_REGISTERS RESP -
|
||||||
#close XXXX-XX-XX-XX-XX-XX
|
#close XXXX-XX-XX-XX-XX-XX
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue