mirror of
https://github.com/zeek/zeek.git
synced 2025-10-02 14:48:21 +00:00
Merge remote-tracking branch 'micrictor/master'
* micrictor/master: Add a field to Modbus/TCP log to indicate the Modbus PDU type Add modbus transaction and unit ids to logs Enable modbus logging for requests
This commit is contained in:
commit
7fe6290974
6 changed files with 40028 additions and 20000 deletions
19
CHANGES
19
CHANGES
|
@ -1,3 +1,22 @@
|
||||||
|
5.1.0-dev.386 | 2022-08-11 11:56:55 -0700
|
||||||
|
|
||||||
|
* Add a field to Modbus/TCP log to indicate the Modbus PDU type (Michael Torres)
|
||||||
|
|
||||||
|
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.
|
||||||
|
|
||||||
|
* Add modbus transaction and unit ids to logs (Michael Torres)
|
||||||
|
|
||||||
|
Add transaction IDs and unit IDs to default modbus over TCP/IP logs.
|
||||||
|
Update the relevant testing baselines to account for the extra fields.
|
||||||
|
|
||||||
|
* Enable modbus logging for requests (Michael Torres)
|
||||||
|
|
||||||
5.1.0-dev.382 | 2022-08-11 10:41:08 -0700
|
5.1.0-dev.382 | 2022-08-11 10:41:08 -0700
|
||||||
|
|
||||||
* UPDATED: improving email address splitting for common comma case (TheAvgJojo)
|
* UPDATED: improving email address splitting for common comma case (TheAvgJojo)
|
||||||
|
|
2
VERSION
2
VERSION
|
@ -1 +1 @@
|
||||||
5.1.0-dev.382
|
5.1.0-dev.386
|
||||||
|
|
|
@ -16,8 +16,14 @@ export {
|
||||||
uid: string &log;
|
uid: string &log;
|
||||||
## Identifier for the connection.
|
## Identifier for the connection.
|
||||||
id: conn_id &log;
|
id: conn_id &log;
|
||||||
|
## Modbus transaction ID
|
||||||
|
tid: count &log &optional;
|
||||||
|
## The terminal unit identifier for the message
|
||||||
|
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;
|
||||||
};
|
};
|
||||||
|
@ -48,14 +54,18 @@ event modbus_message(c: connection, headers: ModbusHeaders, is_orig: bool) &prio
|
||||||
}
|
}
|
||||||
|
|
||||||
c$modbus$ts = network_time();
|
c$modbus$ts = network_time();
|
||||||
|
c$modbus$tid = headers$tid;
|
||||||
|
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
|
||||||
{
|
{
|
||||||
# Only log upon replies.
|
# Don't log now if this is an exception (log in the exception event handler)
|
||||||
# Also, don't log now if this is an exception (log in the exception event handler)
|
if ( headers$function_code <= 0x81 || headers$function_code >= 0x98 )
|
||||||
if ( ! is_orig && ( headers$function_code <= 0x81 || headers$function_code >= 0x98 ) )
|
|
||||||
Log::write(LOG, c$modbus);
|
Log::write(LOG, c$modbus);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -5,12 +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 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 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 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 unknown-160 -
|
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 unknown-162 -
|
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 unknown-175 -
|
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 unknown-179 -
|
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 unknown-165 -
|
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 REQ -
|
||||||
|
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 REQ -
|
||||||
|
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 RESP -
|
||||||
|
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 REQ -
|
||||||
|
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 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,9 +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 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 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 READ_INPUT_REGISTERS -
|
XXXXXXXXXX.XXXXXX CHhAvVGS1DHFjwGM9 10.1.1.234 51411 10.10.5.104 502 1119 255 READ_INPUT_REGISTERS REQ -
|
||||||
XXXXXXXXXX.XXXXXX ClEkJM2Vm5giqnMf4h 10.1.1.234 51411 10.10.5.104 502 READ_INPUT_REGISTERS -
|
XXXXXXXXXX.XXXXXX CHhAvVGS1DHFjwGM9 10.1.1.234 51411 10.10.5.104 502 2606 255 READ_INPUT_REGISTERS RESP -
|
||||||
XXXXXXXXXX.XXXXXX CtPZjS20MLrsMUOJi2 10.1.1.234 51411 10.10.5.104 502 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 REQ -
|
||||||
|
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