Skip to content

mod_stat

Alexey Sintsov edited this page May 4, 2016 · 19 revisions

This module is designed for CAN traffic sniffing and analyses. Module receives CAN frame from PIPE and saves it in the memory

init parameters

uds_shift - optional. default value is 8.

This parameter tells module which offset should be used for UDS response ID. By default response ID on UDS request is +8 to ID of UDS request. For other vendors it can be other value, for example for VW it could be 0x6a.

meta_file - optional. no values by default.

Path to a META file that will be used for this traffic. META file describes already known things in the traffic. File format (and possible features):

{ 'description':{ (1337,'00FF'):'action 1 description', (1337,'0000'):'action 2 description } }

1337 - CAN frame ID '00FF' - regex for CAN frame data

So all frames 1337:3:00FF11 - will be commented as 'action 1 description'

action parameters

None.

user commands

Print current table - p

Print all sniffed frames in short table. Example of output:

BUS     ID   LENGTH MESSAGE          ASCII    DESCR     COUNT
Default 318  3      080009                              6545 
Default 318  3      080018                              7069 
Default 1359 8      0146443435313823 .FD4518# VIN value 141  
Default 1359 8      033034313535000c .04155.. VIN value 124  
Default 1359 8      0000000004000013          VIN value 198  
Default 1359 8      02323232424e323a .222BN2: VIN value 184  
Default 749  1      12                                  59   
Default 749  1      33                                  60   
Default 749  1      25                                  70   

DESCR field will be set only if META data exists for that ID.

Analyses of captured traffic - a,

Analyzing of captured traffic. If no parameters then all analyzing methods will be executed:

FRAG - mod_stat will try to find control/index byte to fragment all chain. By default it could detect situations when same chain of data sending in the loop and first byte is index. Like in the example in print table section. The output will be:

De-Fragmented frames (using loop-based detection):

	ID 1036 and length 28
		Data: 0000000400001346443435313823323232424e323a3034313535000c
		ASCII: .......FD4518#222BN2:222BN2..

ISO - mod_stat will try to find messages that have been sent in ISO-TP (ISO 15765-2) format and print those UDS - mod_stat will try to find UDS services(ISO 14229-1:2013) based on sniffed requests and responses (over ISO-TP)

Enable/Disable Diff mode - F

When DIFF mode is enabled, you collect sniffed frames into different buffer. Then actions 'print diff' and 'print diff (ne ID only)' available. Usecase: https://asintsov.blogspot.de/2016/05/cantoolz-iso-tp-and-diff-updates.html

Print Diff frames - I, 1 parameter(optional): NUM

Available only in Diff mode. Doing comparison of all CAN frames collected in DIFF mode with CAN frames that were collected before DIFF mode was enabled. Then print only CAN frames that were found only during DIFF mode, but not before. This can be used to find "changes" in CAN traffic (data section have been changed). NUM - is filter by count.

Print Diff frames (new ID only) - N, 1 parameter(optional): NUM

Available only in Diff mode. Doing comparison of all CAN frames collected in DIFF mode with CAN frames that were collected before DIFF mode was enabled. Then print only CAN frames with new Arbitration ID (those ID found onl during DIFF mode, but not before). This can be used to find "new devices" in CAN traffic. NUM - is filter by count.

Dump Diff in replay format - Y, 1 parameter: filename Available only in Diff mode. Dump DIFF frames (like I operation) into replay file. Can be replayed with gen_replay

Clean table - c

Free memory and clean all saved frames.

Meta-data: add description for ID - i, 3 parameters: ID, regex, description

Add comment for chosen CAN frame ID as META data

Load meta-data - l, 1 parameter: filename

Load META data from the file

Save meta-data - z, 1 parameter: filename

Save current META data to file

Dump ALL in replay format - r, 1 parameter: filename

Save ALL sniffed CAN frames in replay format. Later you can share this file with colleagues or replay by yourself without car (via gen_replay module)

**Dump STAT in CSV format ** - d, 1 parameter: filename

Save statistics table (like you see when you do 'print table') into CSV file.

Clone this wiki locally