Commit Graph

482 Commits

Author SHA1 Message Date
Stig Bjørlykke d0b143bbec Remove init to zero for static variables
The C standard requires that objects with static storage duration
is initialized to zero.
2024-04-05 21:38:28 +00:00
Stig Bjørlykke 67d7b1e58c extcap: Fix a strlen check
Change a strlen() check because this can never be less than zero.

This will remove this warning from cppcheck:
warning: Checking if unsigned expression 'strlen(extcap->fifo)' is
less than zero. [unsignedLessThanZero]
2024-04-03 12:43:56 +00:00
Gerald Combs 696baec976 Falcodump: Fix a couple of option names 2024-03-18 18:05:07 -07:00
Gerald Combs 6afdbf2de0 Falcodump: Add options to exclude syscalls
Add options to include or exclude process-generated syscalls and
"switch" calls.
2024-03-19 00:29:34 +00:00
Gerald Combs 0ff53d7a49 Falcodump: Add capture filters
Add support for both capture filter validation and capture time
filtering.
2024-03-15 21:58:33 +00:00
Gerald Combs 87a9a18726 Convert extcap to C99 types
Ping #19116
2024-03-15 15:58:14 +00:00
John Thacker 69797c06a9 androiddump: Unused variable on WIN32
This variable is unused on _WIN32, prevent a warning.
2024-03-15 13:15:02 +00:00
Gerald Combs 8541041922 CMake+wsutil: Split our Wireshark and Logray extcaps
On Windows and Linux, install extcaps into extcap/<program name> in the
run directory. Do the same for the Windows installation path.
2024-03-12 19:51:22 +00:00
Gerald Combs a2d40c7cde Falcodump: Fix compilation 2024-03-10 14:52:45 -07:00
Martin Mathieson 6307233ec9 Fix some cppcheck warnings 2024-03-10 19:23:20 +00:00
Gerald Combs 0228fefb10 falcodump: Add builtin (syscall) capture support 2024-03-07 16:33:00 -08:00
Martin Mathieson e0300eaed8 Fix lots of spellings 2024-02-25 22:46:47 +00:00
Uli Heilmeier 54b52063c5 falcodump: add missing AWS regions 2024-02-23 09:48:43 +00:00
Gerald Combs ab73082708 CMake: Fix our falcodump symlink 2024-01-30 16:54:29 -08:00
Gerald Combs 3588090b2a Falco bridge+falcodump: Various fixes
Fix building with Visual C++ and recent versions of falco-libs.
2024-01-31 00:03:48 +00:00
John Thacker 6d39c511fb extcap: Set matching libssh log level
Instead of always setting the libssh log level to SSH_LOG_INFO
when an extcap has a ws log level of LOG_LEVEL_DEBUG or lower,
set the libssh log level to a corresponding log level
(NOISY/TRACE, DEBUG/DEBUG, INFO/INFO, MESSAGE and above/WARN).

Format the libssh logging messages more similar to our normal
logging messages, with a libssh domain and using the libssh
priority.

Prior to 0.11.0 (that is, this commit:
657d9143d1
) libssh sends some merely informational messages at their WARN
level, so lower that down to INFO, which isn't printed by default
and doesn't get printed in the GUI.

Related to #17888
2024-01-19 20:59:33 +00:00
John Thacker 55214bdacd extcap: Provide a more useful error message when key passphrase is bad
ssh_pki_import_privkey_file can return SSH_OK ("import good, go ahead
and try to connect") or two types of errors, SSH_EOF ("file doesn't exist
or permission denied") or SSH_ERROR (any other error). Unfortunately
ssh_get_error() is called on the session, and doesn't provide anything
when importing the key failed.

When we get one of those two errors, add a log message explaining
what's going on. Unfortunately ssh_get_error() is called on the
session, not a key, and doesn't provide anything more when importing
the key failed, so we'll have to be somewhat generic in our error
mssage. It's a user-correctible error, so it's worth putting in the GUI.

When importing the key succeeded but authentication failed, keep
doing what we've been doing, as other methods might still succeed.

Fix #17888
2024-01-19 15:33:10 -05:00
John Thacker 49ada98a88 Increase libssh minimum version to 0.8.5
libssh 0.8.5 was released in October 2018, all known Linux distributions
that currently compile on the master branch with their default
packages include a more recent version, and we ship the 0.10.x series
for Windows and MacOS. (Among major Linux distributions that compile currently,
Debian Buster has 0.8.7).

It has several API changes to ssh_options_get and ssh_options_set, new features,
and a number of bugs and CVEs fixed. We can remove a workaround for a
missing API call in extcap/ssh-base
2024-01-18 19:08:46 -05:00
Joakim Karlsson 80a3890dab extcap: fix build with older libssh 2024-01-17 16:45:10 +01:00
John Thacker 5c8c379b69 extcap: Add ability to enable SHA-1 algorithms
libssh 0.10.0 removed SHA-1 based keys and algorithms from its
default configuration, though they are still supported. We
ship with 0.10.5 in Windows and macOS now, and many Linux
distributions are on 0.10.x as well.

Add the ability to re-enable SHA-1 RSA keys, MAC, and KEX algorithms
with a preference to ciscodump, sshdump, and wifidump.

This will be a little easier in 0.11.0, where it's possible to
just specify the algorithms you want to add to the default list,
instead of having to specify the entire list.

Fix #19510. Fix #19594
2024-01-15 06:40:08 -05:00
Timo Warns 73e5eeae50 GNSS: add dissectors for further UBX messages 2024-01-12 09:20:13 +00:00
John Thacker be5f98b851 androiddump: Don't hang for 20s on Linux if loopback is down
androiddump uses nonblocking connect on Windows, trying 10 times
with 1ms timeouts in select(). (This is short, but it's generally
trying to connect to the loopback interface.) On UN*X, it uses blocking
sockets, also trying 10 times, with SO_SNDTIMEO set to 2s.

Generally the socket returns nears instaneously, because it's
trying to connect to localhost. If the loopback interface goes
down, however, this results in 20s of timeouts.

Use nonblocking sockets on UN*X as well.

Related to #13104, #15295
2023-12-19 15:41:33 +00:00
João Valverde 0509398c4f wsutil: Consolidate IP address code
Consolidate code to handle IP addresses in inet_addr.[ch].
2023-10-31 10:14:09 +00:00
Florian Bezold 968483728f androiddump: support capture filter 2023-10-17 20:32:11 +00:00
Gerald Combs 33655a9266 Move our Falco plugin directories
Move our Falco plugin directories up one level so that we're outside the
hierarchy scanned by plugins_init. This also makes it more clear that
these are Falco plugins and that they don't conform to our plugin API.
2023-10-11 15:25:40 -07:00
João Valverde 7690b147de ciscodump: Keep strptime() behavior unchanged
Use the system implementation if available, the internal one if not.
2023-09-03 19:36:55 +01:00
João Valverde fe802272a2 Build with NetBSD's strptime()
Replace our strptime code, which is from gnulib,
with the simpler and better NetBSD implementation.

This changes the ws_strptime() stub to unconditionally use
the internal implementation. Previously it would use the
system implementation of available. This is still possible
but is opt-in, i.e., code should add the necessary #ifdefs
and assume responsability for handling non-portable formats
or providing limited functionality on some platforms.

Text import allows the user to specify the strptime()
format freely, so in that case it makes sense to use the
system's implementation, and pass the responsability
for understanding the implementation and the supported
specifiers to the user.

Only fall back to our implementation if the system libc
lacks a strptime().
2023-09-03 18:05:59 +01:00
John Thacker 3c22bc0d0b dpauxmon: Flush after pcap header
Flush after writing the pcap header for the same reasons as
in udpdump (see commit 9ad1ec1651)
2023-08-11 20:05:10 +00:00
John Thacker 9ad1ec1651 extcap: Flush after writing the pcap header
Call fflush in udpdump and ciscodump after writing the pcap header
so that it is actually written out even if no packets have arrived yet.

By doing so, dumpcap no longer blocks in cap_pipe_open_live waiting
for the pcap header from the extcap pipe until the first packet is
captured, but instead goes on to (attempt to) open its output.

This means that if we capture no packets that a capture file with
a header but no packet records will be created (and, if not a temp
file, will have to be cleaned up), but that is consistent with tshark
and Wireshark behavior otherwise.

This means you can no longer do a capture to a FIFO or Named Pipe
in this order:

1) Start dumpcap
2) Create the FIFO or Named Pipe
3) Start the flow of packets to the UDP port

which only worked when not dissecting packets. It was broken if tshark
also needed to dissect packets, but evaded the checks for if we were
writing to a FIFO or Named Pipe resulting in behavior mysterious to
users, such as only writing to one of the Named Pipe readers on Windows
(or failing if there aren't enough instances), or having tshark and
the other pipe reader compete for the pipe input and eventually failing
on UN*X.

Instead, the FIFO or Named Pipe needs to be created before launching
dumpcap, or else an ordinary file will be created (on UN*X), or an
error about not being able to open the output (on Windows, since
Named Pipes have a magic prefix, and you can't create an ordinary
file with a named pipe filename.)

Fix #17900.
2023-08-03 22:03:07 -04:00
Gerald Combs 3c2fa2b61a Falcodump: Partially revert c8accef14c
sinsp::get_plugin_manager is usable again, so switch back to using it.
2023-07-31 14:22:37 -07:00
Gerald Combs c8accef14c Falcodump + Falco bridge: libsinsp API updates
Update to match recent libsinsp 0.11 API changes.
2023-07-04 14:42:29 +00:00
Gerald Combs c068948610 Falcodump: Update our AWS region list 2023-06-28 14:00:57 -07:00
Gerald Combs 347f3ab1a6 Falcodump: Fix our data source settings
Change the data source label to "Log data URL". Fix a tooltip typo.
2023-06-28 11:24:59 -07:00
Guy Harris f8d1525b17 Get rid of unnecessary casts.
snprintf(), sensibly, takes a size_t argument specifying the size of the
buffer. g_snprintf(), bogusly, takes a gulong argument specifying the
size of the buffer, so we had to do casts to avoid narrowing complaints,
but we're just using snprintf() now (as we require C11 or later), and
don't need the casts any more.
2023-06-18 16:07:35 -07:00
Gerald Combs a265aa4bc2 Convert writecap to C99 types
Convert writecap to C99 types. Add maximum and minimum values to
convert-glib-types.py.

Ping #19116
2023-06-16 15:34:44 +00:00
Gerald Combs 978f62a805 Convert our extcaps to C99 types
Convert our extcaps to C99 types. Try to preserve padding in
convert-glib-types.py and add globbing support on Windows.

Ping #19116
2023-06-15 01:14:59 +00:00
John Thacker 1cdebcd80c randpkt: Support different capture formats, default to pcapng
Related to #18009 - Have randpkt default to pcapng, allow selecting
a different capture file format via the common -F option that other
command line tools use, and document it.

For the randpktdump extcap, just use pcapng.

This fixes --all-random, because --all-random requires different
encapsulation per packet. It also fixes the related -r option to
randpkt (though note that picking a file format that doesn't support
ENCAP_PER_PACKET with -r causes problems.)

Document -r in the randpkt man page.

Fix #18944
2023-06-03 13:45:20 -04:00
João Valverde 41b8f07c86 CMake+Windows: Try to fix NSIS installer with Ninja 2023-06-01 19:27:55 +01:00
João Valverde 9f7f472f49 androiddump: Fix warning [-Wdiscarded-qualifier]
wireshark/extcap/androiddump.c:573:48: warning: passing argument 5 of 'select' discards 'const' qualifier from pointer target type [-Wdiscarded-qualifiers]
  573 |             if ((select(0, NULL, &fdset, NULL, &timeout) != 0) && (FD_ISSET(sock, &fdset))) {
      |                                                ^~~~~~~~
2023-05-26 01:16:59 +01:00
Jaap Keuter eea848bf5e sshdump: Trying to get closer to setting intended rem. capture filter
Closes #18874
2023-05-16 09:17:40 +00:00
John Thacker 5f08477bba etwdump: Try to fix the build
At least one version of MSVC seems not to like a trailing
comma at the end of variadic arguments.
2023-04-26 18:45:14 -04:00
Kevin Schoonover bdac10e25e add ProcessorNumber to packet comments 2023-04-26 18:09:27 +00:00
Gerald Combs f01f81b87d falcodump: Catch exceptions when loading plugins
Consolidate some duplicate code.
2023-04-20 23:00:18 +00:00
Jaap Keuter 512a1ca2b3 sshdump: allow dumpcap capture config without remote interface
Closes #18904
2023-03-23 11:25:41 +00:00
Gerald Combs 84d3aefa1b Falcodump: Update to match the current libsinsp/libscap. 2023-03-13 16:06:06 -07:00
Jaap Keuter 455b9a470f sshdump: add capability to use doas on remote host 2023-02-19 13:41:24 +00:00
João Valverde 0cea64a632 Move ui/cmdarg_err.[ch] to wsutil 2023-02-10 20:59:22 +00:00
João Valverde 71cfbd81b3 Remove wspcap.h and use config.h instead
Forcing the use of a dedicated header to replace pcap.h is
unnecessary code and mental overhead in this case. We can
use config.h instead for the same purpose of defining a
macro symbol before including pcap.h.
2023-02-06 15:05:36 +00:00
João Valverde d70e174ca0 Remove wsutil/netlink.h workaround 2023-02-06 15:04:46 +00:00
João Valverde b07ab25a1c CMake: Cleanup unnecessary linking with shared libraries 2023-02-06 15:04:46 +00:00