Commit Graph

424 Commits

Author SHA1 Message Date
Gerald Combs f2caa6a0cc Extcap: Fix falcodump gcc warnings and errors.
Fix warnings and errors reported by gcc 11.3.
2022-12-15 01:46:03 +00:00
Dario Lombardo f2eb97e910 Fix ciscodump CID 2022-12-13 20:05:59 +00:00
j.novak@netsystem.cz 212b196bee ciscodump: Added support for IOS XE 17.x 2022-12-12 19:49:17 +00:00
Gerald Combs 9581085430 Falcodump: Open our fifo directly.
Just open our fifo directly using our sinsp dumper. Add a couple of
missing regions.
2022-12-12 18:36:52 +00:00
j.novak@netsystem.cz 2e22eb8357 ciscodump: Added noisy messages for troubleshooting 2022-12-12 07:50:46 +00:00
Alexis La Goutte 8aa55eb2ba etwudmp: fix typo
parmeters => parameters
2022-11-17 14:53:02 +00:00
Adrian Granados 420ec1511d extcap: fix missing control frames from wifidump capture
Normally, 'control' and 'otherbss' flags are set when
using monitor mode, but certain Wi-Fi drivers (e.g. MT7921)
need to explicitly have these flags set in order to capture
control frames.
2022-10-31 13:20:06 +00:00
Gerald Combs f10538a102 falcodump: Fix our credential and config file parsing. 2022-10-13 16:32:43 +00:00
Gerald Combs 7896f4b292 falcodump: Fixup our default profile and region.
Make sure we fetch AWS_PROFILE if it exists. Don't add AWS_PROFILE or
AWS_REGION if they're already in the profile and region lists. Fix our
default values.
2022-10-11 00:40:54 +00:00
João Valverde 3949d289d1 Add log init message to main() 2022-10-08 15:33:47 +00:00
Uli Heilmeier a471aa7628 sshdump: Add '-f ' for capture filter
Fixes #18420
2022-10-08 12:27:30 +00:00
Gerald Combs a1ec850894 falcodump: Prefill the Cloudtrail profile and region fields.
Make the cloudtrail-aws-profile and cloudtrail-aws-region settings
prefilled selection lists. Make them editable as well.
2022-10-07 17:01:17 +00:00
Gerald Combs ca0843f168 falcodump: Fixup our help output. 2022-10-03 15:09:55 -07:00
Gerald Combs b5b1949c5e falcodump: Updates for libsinsp and the cloudtrail plugin.
The libsinsp plugin API recently changed the way plugins are opened.
Update falcodump to match.

Plugins might return a nested and "$ref"ed config schema. Update our
parsing code to match.
2022-10-03 14:24:24 -07:00
j.novak@netsystem.cz e091e8755a extcap: Fixed end application loop logic 2022-10-03 10:16:57 +00:00
Gerald Combs 28a26096fb falcodump: Add support for selection options.
If a plugin has an "enum" + array in its configuration, convert it to a
selector option.

Start adding plugin sections to the falcodump man page.
2022-09-29 16:44:21 +00:00
Mikael Kanstrup b7066e0819 sshdump: Fix remote-capture-command option
The remote-capture-command option does not work when selecting
remote capture command selection 'other' from the extcap capture
options dialog. Fix strcmp statement to actually check for 'other'.

Fixes: #18381
2022-09-26 20:25:18 +02:00
Alexis La Goutte 2d22f72d4d ciscodump(extcap): Fix DeadStore 2022-09-20 06:27:46 +00:00
Guy Harris e5951765d8 Dissector names are not protocol names.
A given protocol's packet format may depend, for example, on which
lower-level protocol is transporting the protocol in question.  For
example, protocols that run atop both byte-stream protocols such as TCP
and TLS, and packet-oriented protocols such as UDP or DTLS, might begin
the packet with a length when running atop a byte-stream protocol, to
indicate where this packet ends and the next packet begins in the byte
stream, but not do so when running atop a packet-oriented protocol.

Dissectors can handle this in various ways:

For example, the dissector could attempt to determine the protocol over
which the packet was transported.

Unfortunately, many of those mechanisms do so by fetching data from the
packet_info structure, and many items in that structure act as global
variables, so that, for example, if there are two two PDUs for protocol
A inside a TCP segment, and the first protocol for PDU A contains a PDU
for protocol B, and protocol B's dissector, or a dissector it calls,
modifies the information in the packet_info structure so that it no
longer indicates that the parent protocol is TCP, the second PDU for
protocol A might not be correctly dissected.

Another such mechanism is to query the previous element in the layers
structure of the packet_info structure, which is a list of protocol IDs.

Unfortunately, that is not a list of earlier protocols in the protocol
stack, it's a list of earlier protocols in the dissection, which means
that, in the above example, when the second PDU for protocol A is
dissected, the list is {...,TCP,A,B,...,A}, which means that the
previous element in the list is not TCP, so, again, the second PDU for
protocol A will not be correctly dissected.

An alternative is to have multiple dissectors for the same protocol,
with the part of the protocol that's independent of the protocol
transporting the PDU being dissected by common code.  Protocol B might
have an "over a byte-stream transport" dissector and an "over a packet
transport" dissector, with the first dissector being registered for use
over TCP and TLS and the other dissector being registered for use over
packet protocols.  This mechanism, unlike the other mechanisms, is not
dependent on information in the packet_info structure that might be
affected by dissectors other than the one for the protocol that
transports protocol B.

Furthermore, in a LINKTYPE_WIRESHARK_UPPER_PDU pcap or pcapng packet for
protocol B, there might not be any information to indicate the protocol
that transports protocol B, so there would have to be separate
dissectors for protocol B, with separate names, so that a tag giving the
protocol name would differ for B-over-byte-stream and B-over-packets.

So:

We rename EXP_PDU_TAG_PROTO_NAME and EXP_PDU_TAG_HEUR_PROTO_NAME to
EXP_PDU_TAG_DISSECTOR_NAME and EXP_PDU_TAG_HEUR_DISSECTOR_NAME, to
emphasize that they are *not* protocol names, they are dissector names
(which has always been the case - if there's a protocol with that name,
but no dissector with that name, Wireshark will not be able to handle
the packet, as it will try to look up a dissector given that name and
fail).

We fix that exported PDU dissector to refer to those tags as dissector
names, not protocol names.

We update documentation to refer to them as DISSECTOR_NAME tags, not
PROTO_NAME tags.  (If there is any documentation for this outside the
Wireshark source, it should be updated as well.)

We add comments for calls to dissector_handle_get_dissector_name() where
the dissector name is shown to the user, to indicate that it might be
that the protocol name should be used.

We update the TLS and DTLS dissectors to show the encapsulated protocol
as the string returned by dissector_handle_get_long_name(); as the
default is "Application Data", it appeaers that a descriptive name,
rather than a short API name, should be used.  (We continue to use the
dissector name in debugging messages, to indicate which dissector was
called.)
2022-09-10 22:37:11 -07:00
Gerald Combs 5243ffa4c2 extcap: Add falcodump.
Add an extcap that fetches a scap from a Falco/libsinsp plugin. Tested
using the cloudtrail plugin.
2022-08-29 15:35:19 -07:00
j.novak@netsystem.cz 90143855af extcap: Signal processing unified for C based extcaps 2022-08-29 19:46:59 +00:00
Joakim Karlsson abe78a4109 sshdump: may be used uninitialized in this function [-Wmaybe-uninitialized] 2022-08-12 18:25:56 +00:00
Jaap Keuter 34ab3f308a sshdump: add option to select dumpcap as remote capture command 2022-08-10 17:26:49 +00:00
Jirka Novak 6d0619cdd0 ciscodump: Added support for IOS XE and ASA
Changes:
- The tool now recognizes which software is running on a device - IOS, IOS XE
  or ASA. Based on it, it uses correct sequence of commands to setup
  capture, read captured packets and clear the capture.
- The tool reads packets on the fly so you don't have to wait till
  --remote-count of packets is reached.
- The tool reads timestamps from capture on the device for IOS and ASA (on
  IOS-XE, there is no timestamp in dump).
- Except Windows platform the tool handles early stop of capture on the device
  and clear of capture buffer on the device (it finish the capture).
- There are special interface names to allow the tool to generate
  specific capture types.
- Data collection and config cleanup is handled in two separated ssh
  sessions.
- Documentation updated.

Closes #17672.
2022-07-22 15:55:28 +00:00
Jirka Novak f2b30e70eb ciscodump: Added support for IOS XE and ASA
Changes:
- The tool now recognizes which software is running on a device - IOS, IOS XE
  or ASA. Based on it, it uses correct sequence of commands to setup
  capture, read captured packets and clear the capture.
- The tool reads packets on the fly so you don't have to wait till
  --remote-count of packets is reached.
- The tool reads timestamps from capture on the device for IOS and ASA (on
  IOS-XE, there is no timestamp in dump).
- Except Windows platform the tool handles early stop of capture on the device
  and clear of capture buffer on the device (it finish the capture).
- There are special interface names to allow the tool to generate
  specific capture types.
- Documentation updated.

Closes #17672.
2022-07-22 15:55:28 +00:00
Jirka Novak 62e81d53ba Removed useless function 2022-07-22 15:55:28 +00:00
Jirka Novak 274f423401 Fixed issue in processing filters for ASA 2022-07-22 15:55:28 +00:00
Jirka Novak 1e53e49a54 ciscodump: Added support for IOS XE and ASA
Changes:
- The tool now recognizes which software is running on a device - IOS, IOS XE
  or ASA. Based on it, it uses correct sequence of commands to setup
  capture, read captured packets and clear the capture.
- The tool reads packets on the fly so you don't have to wait till
  --remote-count of packets is reached.
- The tool reads timestamps from capture on the device for IOS and ASA (on
  IOS-XE, there is no timestamp in dump).
- Except Windows platform the tool handles early stop of capture on the device
  and clear of capture buffer on the device (it finish the capture).
- There are special interface names to allow the tool to generate
  specific capture types.
- Documentation updated.

Closes #17672.
2022-07-22 15:55:28 +00:00
Odysseus Yang 36e834b6b7 ETW: Extract IP packets from Windows event trace
With this change, Wireshark will be enhanced to display IP packets from an event trace logfile
or an event trace live session.
2022-05-05 13:35:47 +00:00
Roland Knall f595f3b6ad sshdump: Update doc for openssh key note
Add a note, that the key value pair format has to be openssh format

Fixes #18063
2022-04-28 19:59:07 +02:00
Gerald Combs 3086774fa6 wsutil: Add configuration namespaces.
Rename init_progfile_dir to configuration_init. Add an argument which
specifies our configuration namespace, which can be "Wireshark"
(default) or "Logwolf".
2022-04-04 09:39:27 -07:00
Gerald Combs 1e39a66746 etwdump: Clarify "ETW".
Not everyone knows what ETW is.
2022-03-21 15:35:48 -07:00
Guy Harris 109b92b5d7 wiretap: have wtap_dump_close() provide a "needs to be reloaded" indication.
This allows the "needs to be reloaded" indication to be set in the close
process, as is the case for ERF; having a routine that returns the value
of that indication is not useful if it gets seet in the close process,
as the handle for the wtap_dumper is no longer valid after
wtap_dump_close() finishes.

We also get rid of wtap_dump_get_needs_reload(), as callers should get
that information via the added argument to wtap_dump_close().

Fixes #17989.
2022-03-14 19:12:20 +00:00
Dylan Ulis 2ebf8d4bdd sshdump: fix remote-sudo parameter on restart 2022-03-13 21:39:29 +00:00
Adrian Granados 8622c92a75 extcap: new interface, wifidump, to capture Wi-Fi frames using a remote SSH host 2022-03-09 08:01:39 +00:00
Moshe Kaplan 69d54d6f8e Corrects repeated words throughout the code.
Repeated words were found with:
egrep "(\b[a-zA-Z]+) +\1\b" . -Ir
and then manually reviewed.
Non-displayed strings (e.g., in comments)
were also corrected, to ease future review.
2021-12-22 11:01:11 +00:00
João Valverde 2c44afbba3 Use UINT64_C() with two constants 2021-12-22 01:53:46 +00:00
j.novak@netsystem.cz df537a63fb Extcap logging: Corrected incorrect selector default value syntax 2021-12-21 21:05:22 +00:00
João Valverde 5ce2ae2804 Clean up some printf() format strings 2021-12-21 02:15:46 +00:00
João Valverde 0ccd69e530 Replace g_strdup_printf() with ws_strdup_printf()
Use macros from inttypes.h.
2021-12-19 21:21:58 +00:00
João Valverde fe5248717f Replace g_snprintf() with snprintf()
Use macros from inttypes.h with format strings.
2021-12-19 20:06:13 +00:00
João Valverde cf3cb3a695 wslog: Avoid logging any output to stdout
For historical reasons our logging inherited from GLib the logging of
some levels to stdout. Namely levels "info" and "debug" (to which we
added "noisy").

However this practice is discouraged because it mixes debug output
with application output for CLI tools and breaks many common usage
scenarios, like using tshark in pipes.

This change flips the logic on wslog to make logging to stderr the
default behavior.

Extcap subprocess have a hidden dependency on stdout so add that.

Some GUI users may also have a dependency on stdout. Because
GUI tools are unlikely to depend on stdout for programatic output
add another exception for wireshark GUI, to preserve backward
compatibility.
2021-12-14 12:05:41 +00:00
João Valverde 773420bad9 Fix extcap-base.[ch] indentation
Make header indentation consistent with C source.

Fix EditorConfig settings.
2021-12-11 17:49:40 +00:00
João Valverde 9b0b3c118a extcap: Use standard --log-level and --log-file CLI options
This should allow simultaneous logging to the console and the log
file when running an extcap from the CLI.

One difference is that the extcap error/warning dialogs in the GUI
have extra information in standard wslog format (may or may not
be a good thing).
2021-12-07 23:07:55 +00:00
João Valverde 290234f3f5 Extcap: Improve the log handler logic
If we have a log file write everything to the file, to provide
a complete picture in the log.

Debug information cannot be written to the parent process when
running in child mode.
2021-12-06 18:51:42 +00:00
João Valverde b6130cd970 extcap: Register log handler conditionally
This matches the original implementation and allows displaying
logs to the console, including debug information, when running
an extcap from the CLI for testing and development purposes.

This should make extcap logging bug-for-bug compatible with the
behavior before dc7f0b88bb.
2021-12-06 18:51:42 +00:00
j.novak@netsystem.cz c0b4d285a8 Extcap/ssh-base: Use password authentication before keys 2021-12-06 05:38:49 +00:00
João Valverde cef5e81146 Define more log domains for extcaps 2021-12-05 00:28:26 +00:00
João Valverde e921b804d0 Fix logging with extcaps
Extcaps require a log file when invoked in child mode. It also has
a specific flag to enable debugging, other that the wslog options.

Fix the logging to:
  1. Enable debug log level if --debug is used.
  2. Do not emit messages to the stderr if debug is enabled.

This brings extcap logging to the same feature level it had before
wslog replaced GLib logging.
2021-12-03 12:30:53 +00:00
Moshe Kaplan fd5b5e3149 extcap: Add header files to Doxygen
Add @file markers for extcap
headers so that Doxygen will
generate documentation for them.
2021-11-30 08:29:39 +00:00