Closed chen-ran-mo closed 2 months ago
can you run sharkd from command line? Search for sharkd.exe in your install folder.
(once found please post the output of
sharkd --version
Your work is exciting. I'd like to try your plugin.But I got the same tip.(Assertion Failed: argument is undefined or null)
sharkd --version
).
sharkd.exe --version
Sharkd (Wireshark) 4.0.6 (v4.0.6-0-gac2f5a01286a).
Copyright 1998-2023 Gerald Combs gerald@wireshark.org and contributors. Licensed under the terms of the GNU General Public License (version 2 or later). This is free software; see the file named COPYING in the distribution. There is NO WARRANTY; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
Compiled (64-bit) using Microsoft Visual Studio 2022 (VC++ 14.32, build 31332), with GLib 2.72.3, with PCRE2, with zlib 1.2.12, with Lua 5.2.4, with GnuTLS 3.6.3 and PKCS #11 support, with Gcrypt 1.10.1, with Kerberos (MIT), with MaxMind, with nghttp2 1.46.0, with brotli, with LZ4, with Zstandard, with Snappy, with libxml2 2.9.14, with libsmi 0.4.8, with binary plugins.
Running on 64-bit Windows 10 (22H2), build 19045, with Intel(R) Core(TM) i7-10510U CPU @ 1.80GHz (with SSE4.2), with 16206 MB of physical memory, with GLib 2.72.3, with PCRE2 10.40 2022-04-14, with c-ares 1.18.1, with GnuTLS 3.6.3, with Gcrypt 1.10.1, with nghttp2 1.46.0, with brotli 1.0.9, with LZ4 1.9.3, with Zstandard 1.5.2, with LC_TYPE=C, binary plugins supported.
sharkd.exe -
Looks fine.
@actanta which version of the extension are you using?
Attempt to modify the src code,windows11, Sharkd (Wireshark) 4.2.6 (v4.2.6-0-g2acd1a854bab). 1. this._proc = spawn(sharkdPath, spawnArgs); 2.
Then the plugin works
hmm. interesting. So you did 3 changes: a) removing the stdio:['pipe', 'pipe', 'pipe']] from spawn options b) removing shell:true c) setting loadReq['prevFrame'] to 1 instead of false
Can you tell whether really all 3 are necessary? So if you e.g. add a) does it still work? (then same for b) and c))
According to node.js spec e.g. a) should anyhow be the default value (so removing it should be fine per se but it should help to fix the issue ;-) https://nodejs.org/docs/latest-v20.x/api/child_process.html#optionsstdio
For c) this is interesting as well. The wireshark wiki doesn't help a lot: https://wiki.wireshark.org/sharkd-JSON-RPC-Request-Syntax#frame Checking the wireshark/sharkd source from 4.0. branch "prev_frame" is defined as: https://gitlab.com/wireshark/wireshark/-/blame/release-4.0/sharkd_session.c#L396
{"frame", "prev_frame", 2, JSMN_PRIMITIVE, SHARKD_JSON_BOOLEAN, OPTIONAL},
Can you try whether c) still works if you change it to true instead of 1? (this would at least fit to the SHARKD_JSON_BOOLEAN definition.)
Ah. now I understand: you do use wireshark 4.2 (not 4.0..). There is was actually changed: https://gitlab.com/wireshark/wireshark/-/blob/release-4.2/sharkd_session.c#L406
{"frame", "prev_frame", 2, JSMN_PRIMITIVE, SHARKD_JSON_UINTEGER, SHARKD_OPTIONAL},
// commented as * (o) prev_frame - previously displayed frame number
So yes, c) seems needed to wireshark 4.2 (need to check when the version was added and change semantics depending on the version). Will do this as a PR.
Would still be nice if a) and b) are really necessary to fix your issue.
@hababy see above. could you check my questions? thx!
@mbehr1 b) save shell:true a) No abnormalities,You're right
@hababy I fixed this in v2.1.1. Can you check? Works for me on mac with wireshark v4.0.10, v4.2.7 and v4.4.0.
@hababy I fixed this in v2.1.1. Can you check? Works for me on mac with wireshark v4.0.10, v4.2.7 and v4.4.0.
Sharkd (Wireshark) 4.4.0 (v4.4.0-0-g009a163470b5) Windows11, Unable to work in v2.1.1 or V2.2.0;
When I block 'shell: true', it can work
ok. will take a look at the shell:true today
@hababy can you help me with debugging. I cannot reproduce it (but I admit I have no win11 machine... only win10). Could you change that line:
console.log(`SharkdProcess(${this.id}) closed with: ${code}`);
to output additionally
data='${this._notReadyErrData}, partResp='${this._partialResponse?.toString()}'
thx!
and can you print your %COMSPEC%
env variable?
I can reproduce it on a freshly installed win11 arm in a vm on a mac :-)
If wireshark/sharkd is installed in a path with a ' ' (space) then it does not work. E.g. using as sharkd full path (on a german language win11)
c:\Programme\Wireshark\sharkd.exe
works but
c:\Program Files\Wireshark\sharkd.exe
does not work. I'll try to find a fix for that.
Found a way which seems best fitting to the nodes child_process.spawn api: spawn expects the command as first argument (and somewhat not the command with full path). So I'll split the fullPath to the dir/base and use the dir as options.cwd and the base as command.
%COMSPEC%
C:\Windows\system32\cmd.exe
I can reproduce it on a freshly installed win11 arm in a vm on a mac :-)
If wireshark/sharkd is installed in a path with a ' ' (space) then it does not work. E.g. using as sharkd full path (on a german language win11)
c:\Programme\Wireshark\sharkd.exe
works but
c:\Program Files\Wireshark\sharkd.exe
does not work. I'll try to find a fix for that.
That's true,I can use it normally when using “D:\Wireshark\sharkd.exe” instead of “D:\Program Files\Wireshark\sharkd.exe”
mklink /D "D:\Wireshark" "D:\Program Files\Wireshark\",
@hababy does version 2.2.1 fixes the issue?
version 2.2.1 fixes the issue @mbehr1 ![Uploading image.png…]()
I installed the wirehark in C:\Wireshark\wireshark. But it till has the problem: Assertion Failed: argument is undefined or null. I don't know how to do it.