Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix for incorrectly labelled disclosure packets #6

Merged
merged 7 commits into from
May 6, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion Installer/InstallerScript.iss
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
// DO NOT CHANGE VERSION HERE! Run update_version.bat
#define AppVer "1.2.0"
#define AppVer "1.3.0"
#define AppId "dsV2Gshark"

[Setup]
Expand Down
2 changes: 1 addition & 1 deletion OSSAcknowledgements.txt
Original file line number Diff line number Diff line change
Expand Up @@ -141,7 +141,7 @@ cbExiGen

The license text of the 'Apache License Version 2.0' can be found in APPENDIX A.

Wireshark 4.2.3
Wireshark 4.2.4
Copyright:
Copyright 1998-2024 Gerald Combs <[email protected]> and contributors
Repository: https://gitlab.com/wireshark/wireshark
Expand Down
6 changes: 4 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,7 @@ The plugin processes a TLS master secret disclosure packet after handshake to de
The disclosure message is a UDP packet within the source port range 49152-65535 (see Wireshark protocol settings) containing the ASCII string `CLIENT_RANDOM <32-byte client random> <48-byte master secret>` as payload data. This disclosure message has to be sent from one of the communication partners in a testing environment.
For TLS 1.3 decryption you have to provide different secrets: `CLIENT_HANDSHAKE_TRAFFIC_SECRET`, `SERVER_HANDSHAKE_TRAFFIC_SECRET`, `EXPORTER_SECRET`, `CLIENT_TRAFFIC_SECRET_<number>`, `SERVER_TRAFFIC_SECRET_<number>`. You can send one UDP packet for each secret or combine the secrets in one UDP packet (separated by line breaks).


### Wireshark I/O Graph
This optional feature updates the Wireshark I/O Graph preferences to display a V2G session. The graph can be accessed via 'Statistics' -> 'I/O Graphs' (shortcut: Alt + S + I).
The graph displays the data in 1 second intervals. This can be changed using the drop down menu at the bottom.
Expand All @@ -57,10 +58,11 @@ Click on a packet in the graph to inspect it in the Wireshark main window. Press

## Limitations
- ISO 15118-20 is not fully supported yet
- some BPT messages are not fully decoded
- please let us know if you encounter incorrectly decoded packets
- Linux
- no installer
- filter buttons and color filters must be added manually
- I/O graph must be configured manually

## Support
- If you encounter any problems, feel free to open an issue or contact us at [email protected]
Expand All @@ -69,7 +71,7 @@ Click on a packet in the graph to inspect it in the Wireshark main window. Press
## Further notes
- When sniffing V2G communication, lost packets may occur, which cause corrupted TCP/TLS sessions. In that case, it may help to activate the option to ignore Message Authentication Code (MAC) check failures in the Wireshark TLS protocol settings.
This option can be found under Wireshark Preferences - Protocols - TLS
- This plugin was built and tested with Wireshark 4.2.3
- This plugin was built and tested with Wireshark 4.2.4
- The EXI decoding is based on [cbExiGen](https://github.com/EVerest/cbexigen)


Expand Down
8 changes: 4 additions & 4 deletions V2G_Libraries/CertificateInfos/main.rc
Original file line number Diff line number Diff line change
@@ -1,11 +1,11 @@
#include <windows.h>

#define VER_FILEVERSION 1,2,0,0
#define VER_FILEVERSION_STR "1.2.0.0\0"
#define VER_FILEVERSION 1,3,0,0
#define VER_FILEVERSION_STR "1.3.0.0\0"
#define VER_COMPANYNAME_STR "dSPACE GmbH"
#define VER_PRODUCTNAME_STR "V2gCertificateInfos"
#define VER_PRODUCTVERSION 1,2,0,0
#define VER_PRODUCTVERSION_STR "1.2.0.0\0"
#define VER_PRODUCTVERSION 1,3,0,0
#define VER_PRODUCTVERSION_STR "1.3.0.0\0"

VS_VERSION_INFO VERSIONINFO
FILEVERSION VER_FILEVERSION
Expand Down
8 changes: 4 additions & 4 deletions V2G_Libraries/V2GDecoder/main.rc
Original file line number Diff line number Diff line change
@@ -1,11 +1,11 @@
#include <windows.h>

#define VER_FILEVERSION 1,2,0,0
#define VER_FILEVERSION_STR "1.2.0.0\0"
#define VER_FILEVERSION 1,3,0,0
#define VER_FILEVERSION_STR "1.3.0.0\0"
#define VER_COMPANYNAME_STR "dSPACE GmbH"
#define VER_PRODUCTNAME_STR "V2gDecoder"
#define VER_PRODUCTVERSION 1,2,0,0
#define VER_PRODUCTVERSION_STR "1.2.0.0\0"
#define VER_PRODUCTVERSION 1,3,0,0
#define VER_PRODUCTVERSION_STR "1.3.0.0\0"

VS_VERSION_INFO VERSIONINFO
FILEVERSION VER_FILEVERSION
Expand Down
207 changes: 154 additions & 53 deletions Wireshark/plugins/v2gmsg.lua

Large diffs are not rendered by default.

70 changes: 34 additions & 36 deletions Wireshark/plugins/v2gsdp.lua
Original file line number Diff line number Diff line change
Expand Up @@ -5,111 +5,109 @@
-- See license file (dsV2Gshark_LICENSE.txt)
--

p_sdpreq = Proto("v2gsdp-req","V2G SECC Discovery Protocol Request")
p_sdpres = Proto("v2gsdp-res","V2G SECC Discovery Protocol Response")
p_sdpreq = Proto("v2gsdp-req", "V2G SECC Discovery Protocol Request")
p_sdpres = Proto("v2gsdp-res", "V2G SECC Discovery Protocol Response")
local p_v2gsdp_info = {
version = DS_V2GSHARK_VERSION,
author = "dSPACE GmbH",
author = "dSPACE GmbH"
}
set_plugin_info(p_v2gsdp_info)


-- V2G SDP Request
local f_req_sec = ProtoField.uint8("v2gsdp-req.security","Security",base.HEX)
local f_req_tp = ProtoField.uint8("v2gsdp-req.transportprotocol","Transport Protocol",base.HEX)
local f_req_sec = ProtoField.uint8("v2gsdp-req.security", "Security", base.HEX)
local f_req_tp = ProtoField.uint8("v2gsdp-req.transportprotocol", "Transport Protocol", base.HEX)
local f_req_emsp_ids = ProtoField.string("v2gsdp-req.emsp", "EMSP IDs")

local WITH_TLS = 0
local NO_TLS = 16

local sec_types = {
[WITH_TLS] = "Secured with TLS", -- 0x00
[NO_TLS] = "No transport layer security", -- 0x10
[WITH_TLS] = "Secured with TLS", -- 0x00
[NO_TLS] = "No transport layer security" -- 0x10
}

p_sdpreq.fields = {f_req_sec,f_req_tp,f_req_emsp_ids}
p_sdpreq.fields = {f_req_sec, f_req_tp, f_req_emsp_ids}

-- SDP Request dissection function
function p_sdpreq.dissector(buf,pinfo,root)
function p_sdpreq.dissector(buf, pinfo, root)
pinfo.cols.protocol = "V2GMSG (SDP)"

-- create subtree
subtree = root:add(p_sdpreq,buf(0))
subtree = root:add(p_sdpreq, buf(0))

-- add protocol fields to subtree

local emsp = pinfo.private["SDP_ESMP"]
if emsp ~= nil and emsp == true then
-- else: emsp list is empty
-- Note: the SDP_RES_EMSP misses the fields 'Security' and 'Transport Protocol',
-- since EMPS is only useful with PnC (TCP + TLS)
if buf:len() > 0 then
subtree:add(f_req_emsp_ids, buf(0))
subtree:add(f_req_emsp_ids, buf(0))
end
-- else: emsp list is empty
else
-- Security
local sec_num = buf(0,1):uint()
local sec = subtree:add(f_req_sec,buf(0,1))
local sec_num = buf(0, 1):uint()
local sec = subtree:add(f_req_sec, buf(0, 1))
if sec_types[sec_num] ~= nil then
sec:append_text(" (" .. sec_types[sec_num] ..")")
sec:append_text(" (" .. sec_types[sec_num] .. ")")
-- Concatenate the info of v2g
pinfo.cols.info = tostring(pinfo.cols.info) .. ", " .. sec_types[sec_num]
end

-- Transport Protocol
local tp = subtree:add(f_req_tp,buf(1,1))
if buf(1,1):uint() == 0 then
local tp = subtree:add(f_req_tp, buf(1, 1))
if buf(1, 1):uint() == 0 then
tp:append_text(" (TCP)")
end
end
end

-- V2G SDP Response
local f_res_ipv6 = ProtoField.ipv6("v2gsdp-res.ipv6","SECC IP Address")
local f_res_port = ProtoField.uint16("v2gsdp-res.port","SECC Port")
local f_res_sec = ProtoField.uint8("v2gsdp-res.security","Security",base.HEX)
local f_res_tp = ProtoField.uint8("v2gsdp-res.transportprotocol","Transport Protocol",base.HEX)
local f_res_ipv6 = ProtoField.ipv6("v2gsdp-res.ipv6", "SECC IP Address")
local f_res_port = ProtoField.uint16("v2gsdp-res.port", "SECC Port")
local f_res_sec = ProtoField.uint8("v2gsdp-res.security", "Security", base.HEX)
local f_res_tp = ProtoField.uint8("v2gsdp-res.transportprotocol", "Transport Protocol", base.HEX)
local f_res_emsp_ids = ProtoField.string("v2gsdp-res.emsp", "EMSP IDs")

p_sdpres.fields = {f_res_ipv6,f_res_port,f_res_sec,f_res_tp,f_res_emsp_ids}
p_sdpres.fields = {f_res_ipv6, f_res_port, f_res_sec, f_res_tp, f_res_emsp_ids}

-- SDP Response dissection function
function p_sdpres.dissector(buf,pinfo,root)
function p_sdpres.dissector(buf, pinfo, root)
pinfo.cols.protocol = "V2GMSG (SDP)"

-- create subtree
local subtree = root:add(p_sdpres,buf(0))
local subtree = root:add(p_sdpres, buf(0))

-- add protocol fields to subtree
-- SECC IPv6
subtree:add(f_res_ipv6,buf(0,16))
subtree:add(f_res_ipv6, buf(0, 16))
-- SECC Port
subtree:add(f_res_port,buf(16,2))

subtree:add(f_res_port, buf(16, 2))

local emsp = pinfo.private["SDP_ESMP"]
if emsp ~= nil and emsp == true and buf:len() > 18 then
-- Note: the SDP_RES_EMSP misses the fields 'Security' and 'Transport Protocol',
-- since EMPS is only useful with PnC (TCP + TLS)
subtree:add(f_req_emsp_ids, buf(18))
subtree:add(f_req_emsp_ids, buf(18))
else
-- Security
local sec_num = buf(18,1):uint()
local sec = subtree:add(f_res_sec,buf(18,1))
local sec_num = buf(18, 1):uint()
local sec = subtree:add(f_res_sec, buf(18, 1))
if sec_types[sec_num] ~= nil then
sec:append_text(" (" .. sec_types[sec_num] ..")")
sec:append_text(" (" .. sec_types[sec_num] .. ")")
-- Concatenate the info of v2g
pinfo.cols.info = tostring(pinfo.cols.info) .. ", " .. sec_types[sec_num]
end

-- Transport Protocol
local tp = subtree:add(f_res_tp,buf(19,1))
if buf(19,1):uint() == 0 then
local tp = subtree:add(f_res_tp, buf(19, 1))
if buf(19, 1):uint() == 0 then
tp:append_text(" (TCP)")
if sec_num == NO_TLS then
DissectorTable.get("tcp.port"):add(buf(16,2):uint(),Dissector.get("v2gtp"))
DissectorTable.get("tcp.port"):add(buf(16, 2):uint(), Dissector.get("v2gtp"))
elseif sec_num == WITH_TLS then
DissectorTable.get("tls.port"):add(buf(16,2):uint(),Dissector.get("v2gtp"))
DissectorTable.get("tls.port"):add(buf(16, 2):uint(), Dissector.get("v2gtp"))
end
end
end
Expand Down
Loading