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 4 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
6 changes: 3 additions & 3 deletions .github/workflows/build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -34,12 +34,12 @@ jobs:
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
echo "Please copy the .so files and the 'plugins' directory into your Wireshark installation or into your personal plugin directory (%appdata%/wireshark)." >> ./artifact_dir/README

- 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 @@ -61,7 +61,7 @@ jobs:
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
echo "Please copy the .so files and the 'plugins' directory into your Wireshark installation or into your personal plugin directory (~/.local/lib/wireshark)." >> ./artifact_dir/README

- 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.

2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -60,7 +60,7 @@ 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
- no installer, please copy the files manually into your Wireshark installation or into your personal plugin directory (~/.local/lib/wireshark)
- filter buttons and color filters must be added manually
- I/O graph must be configured manually

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