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

Support of personal lua plugin directory #9

Merged
merged 5 commits into from
May 17, 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
10 changes: 5 additions & 5 deletions .github/workflows/build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -33,13 +33,13 @@ jobs:
cp ./V2G_Libraries/V2GDecoder/bin/* ./artifact_dir/
mkdir artifact_dir/plugins
cp ./Wireshark/plugins/* ./artifact_dir/plugins/
echo "dSPACE V2Gshark Wireshark Plugin" > ./artifact_dir/README
echo "Please copy these files to your Wireshark installation." >> ./artifact_dir/README
cp ./LICENSE ./artifact_dir/dsV2Gshark_LICENSE.txt
cp ./README.md ./artifact_dir/dsV2Gshark_README.txt

- name: Upload Win64 Files
uses: actions/upload-artifact@v4
with:
name: dsV2Gshark_Files_Win_x64
name: dsV2Gshark_Files_Win_x86_64
path: artifact_dir/*

build-linux:
Expand All @@ -60,8 +60,8 @@ jobs:
cp ./V2G_Libraries/V2GDecoder/bin/* ./artifact_dir/
mkdir artifact_dir/plugins
cp ./Wireshark/plugins/* ./artifact_dir/plugins/
echo "dSPACE V2Gshark Wireshark Plugin" > ./artifact_dir/README
echo "Please copy these files to your Wireshark installation." >> ./artifact_dir/README
cp ./LICENSE ./artifact_dir/dsV2Gshark_LICENSE.txt
cp ./README.md ./artifact_dir/dsV2Gshark_README.txt

- name: Upload Linux Files
uses: actions/upload-artifact@v4
Expand Down
715 changes: 358 additions & 357 deletions Installer/InstallerScript.iss

Large diffs are not rendered by default.

4 changes: 2 additions & 2 deletions OSSAcknowledgements.txt
Original file line number Diff line number Diff line change
Expand Up @@ -141,15 +141,15 @@ cbExiGen

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

Wireshark 4.2.4
Wireshark 4.2.5
Copyright:
Copyright 1998-2024 Gerald Combs <[email protected]> and contributors
Repository: https://gitlab.com/wireshark/wireshark
License: GNU GENERAL PUBLIC LICENSE v2.0

The license text of the 'GNU GENERAL PUBLIC LICENSE v2.0' can be found in APPENDIX A.

GnuTLS 3.8.3
GnuTLS 3.8.4
URL: https://www.gnutls.org/
License: GnuTLS License

Expand Down
7 changes: 4 additions & 3 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -48,6 +48,7 @@ Click on a packet in the graph to inspect it in the Wireshark main window. Press

## Installation notes
- The installer can be downloaded from [GitHub Releases](https://github.com/dspace-group/dsV2Gshark/releases/latest)
- To use the plugin without installer, download the zipped files from [GitHub Releases](https://github.com/dspace-group/dsV2Gshark/releases/latest) and copy its content manually into your Wireshark installation or into your personal plugin directory (Windows: %appdata%/wireshark/, Linux: ~/.local/lib/wireshark/). The filter buttons, color filter and I/O Graph configuration must be added manually in this case.
- When updating Wireshark, please reinstall the plugin to avoid any warnings
- Not compatible with other V2G dissector plugins. Please uninstall these plugins before installing dsV2Gshark.
- Not compatible with 32 bit versions of Wireshark.
Expand All @@ -60,8 +61,8 @@ Click on a packet in the graph to inspect it in the Wireshark main window. Press
- ISO 15118-20 is not fully supported yet
- please let us know if you encounter incorrectly decoded packets
- Linux
- no installer
- filter buttons and color filters must be added manually
- No installer, see [Installation Notes](#installation-notes). Make sure you have read permissions for all files.
- Filter buttons and color filters must be added manually
- I/O graph must be configured manually

## Support
Expand All @@ -71,7 +72,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.4
- This plugin was built and tested with Wireshark 4.2.5
- 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,3,0,0
#define VER_FILEVERSION_STR "1.3.0.0\0"
#define VER_FILEVERSION 1,3,1,0
#define VER_FILEVERSION_STR "1.3.1.0\0"
#define VER_COMPANYNAME_STR "dSPACE GmbH"
#define VER_PRODUCTNAME_STR "V2gCertificateInfos"
#define VER_PRODUCTVERSION 1,3,0,0
#define VER_PRODUCTVERSION_STR "1.3.0.0\0"
#define VER_PRODUCTVERSION 1,3,1,0
#define VER_PRODUCTVERSION_STR "1.3.1.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,3,0,0
#define VER_FILEVERSION_STR "1.3.0.0\0"
#define VER_FILEVERSION 1,3,1,0
#define VER_FILEVERSION_STR "1.3.1.0\0"
#define VER_COMPANYNAME_STR "dSPACE GmbH"
#define VER_PRODUCTNAME_STR "V2gDecoder"
#define VER_PRODUCTVERSION 1,3,0,0
#define VER_PRODUCTVERSION_STR "1.3.0.0\0"
#define VER_PRODUCTVERSION 1,3,1,0
#define VER_PRODUCTVERSION_STR "1.3.1.0\0"

VS_VERSION_INFO VERSIONINFO
FILEVERSION VER_FILEVERSION
Expand Down
52 changes: 25 additions & 27 deletions Wireshark/plugins/v2gmsg.lua
Original file line number Diff line number Diff line change
Expand Up @@ -10,11 +10,34 @@
--
-- See license file (dsV2Gshark_LICENSE.txt)
--
DS_V2GSHARK_VERSION = "1.3.0" -- DO NOT CHANGE

-- do OS specific stuff, required to properly load v2g libs
local plugins_path -- path to the plugins directory of this script
local lib_pattern
if package.config:sub(1, 1) == "\\" then
-- WINDOWS
plugins_path = debug.getinfo(1, "S").source:sub(2):match("(.*[/\\])") or "./"
lib_pattern = "?.dll"
else
-- UNIX
plugins_path = debug.getinfo(1, "S").source:sub(2):match("(.*/)") or "./"
lib_pattern = "?.so"
end
local wireshark_path = plugins_path .. "../"
if not string.find(plugins_path, package.path) then
-- extend path (where to load .lua files)
package.path = package.path .. ";" .. plugins_path .. "?.lua"
end
if not string.find(wireshark_path, package.cpath) then
TGruett marked this conversation as resolved.
Show resolved Hide resolved
-- extend cpath (where to load .so files)
package.cpath = package.cpath .. ";" .. wireshark_path .. lib_pattern .. ";" .. plugins_path .. lib_pattern
end

local v2gshared = require("v2gshared")

p_v2gmsg = Proto("v2gmsg", "V2G Message")
local p_v2gmsg_info = {
version = DS_V2GSHARK_VERSION,
version = v2gshared.DS_V2GSHARK_VERSION,
author = "dSPACE GmbH",
description = "Dissector for V2G Messages (DIN 70121, ISO15118-2, ISO15118-20)"
}
Expand All @@ -25,27 +48,6 @@ local v2g_decoder = require("v2gLuaDecoder")
v2g_decoder.initValidator()
local cert_info_extractor = require("v2gX509CertInfos")

-- Settings
p_v2gmsg.prefs["infotext"] = Pref.statictext("dSPACE V2Gshark Wireshark Plugin")
p_v2gmsg.prefs["additionalinfo"] = Pref.statictext("powered by chargebyte cbExiGen")
p_v2gmsg.prefs["additionalinfo2"] = Pref.statictext("")
p_v2gmsg.prefs["portrange_tlssecret"] =
Pref.range(
"TLS secret UDP port(s)",
"49152-65535",
"UDP source ports of TLS secret disclosure packets.\n\nDefault: '49152-65535'",
65535
)
p_v2gmsg.prefs["portrange_v2g"] =
Pref.range(
"V2G message TCP port(s)",
"49152-65535",
"TCP source ports of V2G request and response messages.\n\nDefault: '49152-65535'",
65535
)
p_v2gmsg.prefs["additionalinfo3"] = Pref.statictext("")
p_v2gmsg.prefs["versioninfo"] = Pref.statictext("Version " .. DS_V2GSHARK_VERSION)

-- Buffer for all decoded messages. Maps packetID -> xml string (or nil)
local xml_buffer = {}

Expand Down Expand Up @@ -128,10 +130,6 @@ function p_v2gmsg.init()
decoded_with_auto_schema_detection = {}
decoded_with_schema_namespace = {}
decoded_error_code = {}

-- register v2g ports
DissectorTable.get("tls.port"):add(p_v2gmsg.prefs["portrange_v2g"], p_v2gtp)
DissectorTable.get("tcp.port"):add(p_v2gmsg.prefs["portrange_v2g"], p_v2gtp)
end

local function decode_v2g_message(schema, exi_string, packet_number)
Expand Down
3 changes: 2 additions & 1 deletion Wireshark/plugins/v2gsdp.lua
Original file line number Diff line number Diff line change
Expand Up @@ -4,11 +4,12 @@
--
-- See license file (dsV2Gshark_LICENSE.txt)
--
local v2gshared = require("v2gshared")

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,
version = v2gshared.DS_V2GSHARK_VERSION,
author = "dSPACE GmbH"
}
set_plugin_info(p_v2gsdp_info)
Expand Down
10 changes: 10 additions & 0 deletions Wireshark/plugins/v2gshared.lua
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
--
-- Copyright 2024, dSPACE GmbH. All rights reserved.
--
-- See license file (dsV2Gshark_LICENSE.txt)
--
local v2gshared = {}

v2gshared.DS_V2GSHARK_VERSION = "1.3.1" -- DO NOT CHANGE

return v2gshared
19 changes: 17 additions & 2 deletions Wireshark/plugins/v2gtlssecret.lua
Original file line number Diff line number Diff line change
Expand Up @@ -5,14 +5,29 @@
--
-- See license file (dsV2Gshark_LICENSE.txt)
--
local v2gshared = require("v2gshared")

p_v2gtlssecret = Proto("v2gtlssecret", "V2G TLS secret")
local p_v2gtlssecret_info = {
version = DS_V2GSHARK_VERSION,
version = v2gshared.DS_V2GSHARK_VERSION,
author = "dSPACE GmbH"
}
set_plugin_info(p_v2gtlssecret_info)

-- Settings
p_v2gtlssecret.prefs["infotext"] = Pref.statictext("dSPACE V2Gshark Wireshark Plugin")
p_v2gtlssecret.prefs["additionalinfo"] = Pref.statictext("powered by chargebyte cbExiGen")
p_v2gtlssecret.prefs["additionalinfo2"] = Pref.statictext("")
p_v2gtlssecret.prefs["portrange_tlssecret"] =
Pref.range(
"TLS secret UDP port(s)",
"49152-65535",
"UDP source ports of TLS secret disclosure packets.\n\nDefault: '49152-65535'",
65535
)
p_v2gtlssecret.prefs["additionalinfo3"] = Pref.statictext("")
p_v2gtlssecret.prefs["versioninfo"] = Pref.statictext("Version " .. v2gshared.DS_V2GSHARK_VERSION)

local min_wireshark_version = "3.5.0"

local f_cr = ProtoField.string("v2gtlssecret.clientrandom", "NSS Key Log", base.ASCII)
Expand Down Expand Up @@ -204,6 +219,6 @@ end -- end function 'p_v2gtlssecret.dissector'
-- initialization routine
function p_v2gtlssecret.init()
-- register tls secret ports
DissectorTable.get("udp.port"):add(p_v2gmsg.prefs["portrange_tlssecret"], p_v2gtlssecret)
DissectorTable.get("udp.port"):add(p_v2gtlssecret.prefs["portrange_tlssecret"], p_v2gtlssecret)
frame_numbers = {}
end
21 changes: 19 additions & 2 deletions Wireshark/plugins/v2gtp.lua
Original file line number Diff line number Diff line change
Expand Up @@ -4,14 +4,29 @@
--
-- See license file (dsV2Gshark_LICENSE.txt)
--
local v2gshared = require("v2gshared")

p_v2gtp = Proto("v2gtp", "V2G Transfer Protocol")
local p_v2gtp_info = {
version = DS_V2GSHARK_VERSION,
version = v2gshared.DS_V2GSHARK_VERSION,
author = "dSPACE GmbH"
}
set_plugin_info(p_v2gtp_info)

-- Settings
p_v2gtp.prefs["infotext"] = Pref.statictext("dSPACE V2Gshark Wireshark Plugin")
p_v2gtp.prefs["additionalinfo"] = Pref.statictext("powered by chargebyte cbExiGen")
p_v2gtp.prefs["additionalinfo2"] = Pref.statictext("")
p_v2gtp.prefs["portrange_v2g"] =
Pref.range(
"V2G message TCP port(s)",
"49152-65535",
"TCP source ports of V2G request and response messages.\n\nDefault: '49152-65535'",
65535
)
p_v2gtp.prefs["additionalinfo3"] = Pref.statictext("")
p_v2gtp.prefs["versioninfo"] = Pref.statictext("Version " .. v2gshared.DS_V2GSHARK_VERSION)

local V2GTP_HDR_LENGTH = 8

local f_pv = ProtoField.uint8("v2gtp.protoversion", "Protocol Version", base.HEX)
Expand Down Expand Up @@ -158,8 +173,10 @@ end

-- initialization routine
function p_v2gtp.init()
-- register protocol
-- register v2g ports
DissectorTable.get("udp.port"):add(15118, p_v2gtp)
DissectorTable.get("tcp.port"):add(15118, p_v2gtp)
DissectorTable.get("tls.port"):add(15118, p_v2gtp)
DissectorTable.get("tls.port"):add(p_v2gtp.prefs["portrange_v2g"], p_v2gtp)
DissectorTable.get("tcp.port"):add(p_v2gtp.prefs["portrange_v2g"], p_v2gtp)
end
8 changes: 4 additions & 4 deletions update_version.bat
Original file line number Diff line number Diff line change
Expand Up @@ -29,15 +29,15 @@ for /F delims^=^ eol^= %%A in ('%SystemRoot%\System32\findstr.exe /N "^" "%FileN
) >>"%TempFile%"
move /y %TempFile% %FileName%

:: update v2gmsg.lua
set "FileName=.\Wireshark\plugins\v2gmsg.lua"
:: update v2gshared.lua
set "FileName=.\Wireshark\plugins\v2gshared.lua"
del "%TempFile%" 2>nul
for /F delims^=^ eol^= %%A in ('%SystemRoot%\System32\findstr.exe /N "^" "%FileName%"') do (
set "Line=%%A"
setlocal EnableDelayedExpansion
if not "!Line:DS_V2GSHARK_VERSION=!" == "!Line!" (
if not "!Line:v2gshared.DS_V2GSHARK_VERSION=!" == "!Line!" (
if not "!Line:DO NOT CHANGE=!" == "!Line!" (
echo DS_V2GSHARK_VERSION = "%newVersion%" -- DO NOT CHANGE
echo v2gshared.DS_V2GSHARK_VERSION = "%newVersion%" -- DO NOT CHANGE
) else echo(!Line:*:=!
) else echo(!Line:*:=!
endlocal
Expand Down