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 Wireshark-like profiles for column preferences, etc #108

Closed
gcla opened this issue Feb 26, 2021 · 5 comments
Closed

Support Wireshark-like profiles for column preferences, etc #108

gcla opened this issue Feb 26, 2021 · 5 comments
Assignees
Labels

Comments

@gcla
Copy link
Owner

gcla commented Feb 26, 2021

This is a suggestion from termshark user @zoulja.

The priority for the first iteration is columns; after that I will consider other config info, following Wireshark's lead.

@gcla gcla self-assigned this Feb 26, 2021
@gcla gcla added feature request New feature or request v2.3 labels Feb 26, 2021
@gcla gcla added v2.4 and removed v2.3 labels May 6, 2022
gcla added a commit that referenced this issue Jun 12, 2022
This work is driven by this issue:
#108

Here's a description of how everything currently works. Prior to this
change, termshark had one config file (per user), stored in a standard
location. I'll use Linux as an example -
~/.config/termshark/termshark.toml. With this change, there's a new set
of subdirectories, one per profile, containing toml files e.g. after
some profiles have been created, you might have:

~/.config/termshark/profiles/classic/termshark.toml
~/.config/termshark/profiles/extracolumns/termshark.toml
~/.config/termshark/profiles/darker/termshark.toml

These toml files are the same structure as the default termshark.toml.

Termshark starts with the default profile, represented by the default
config file (not in the new profiles/ dir).

There are two new console commands:

(1) :profile -> switch profile to one that exists already

When a non-default profile is chosen, the settings in that profile's
config file take precedence. If a setting is needed and not set
explicitly, termshark falls back to the setting in the default
profile. When a setting is explicitly changed, it is changed in the
newly activated profile.

(2) :new-profile -> create a new profile

The user must choose a name that is not in use (and that can be used as
a directory name). When created, termshark automatically switches to the
new profile. If the profile in use at the time of creation is not the
default, termshark copies the previous profile to the new profile and
proceeds from there. If the profile in use is the default, the new
profile will be empty.

When termshark is using a non-default profile, it is shown on the top
line of the UI.

Termshark can be started with a non-default profile using the new
-C/--profile command-line flag. Note that although I chose this to line
up with Wireshark's invocation, termshark does not use Wireshark
profiles in any way.
@gcla
Copy link
Owner Author

gcla commented Jun 12, 2022

Hi @zoulja - I have pushed up an implementation of profiles support in branch profiles2. If you have time and it's still useful to you, would you mind trying it out? Here's information from the commit:

Prior to this change, termshark had one config file (per user), stored in a standard location. I'll use Linux as an example - ~/.config/termshark/termshark.toml. With this change, there's a new set of subdirectories, one per profile, containing toml files e.g. after some profiles have been created, you might have:

  • ~/.config/termshark/profiles/classic/termshark.toml
  • ~/.config/termshark/profiles/extracolumns/termshark.toml
  • ~/.config/termshark/profiles/darker/termshark.toml

These toml files are the same structure as the default termshark.toml.

Termshark starts with the default profile, represented by the default config file (not in the new profiles/ dir).

There are two new console commands:

(1) :profile -> switch profile to one that exists already

When a non-default profile is chosen, the settings in that profile's config file take precedence. If a setting is needed and not set explicitly, termshark falls back to the setting in the default profile. When a setting is explicitly changed, it is changed in the newly activated profile.

(2) :new-profile -> create a new profile

The user must choose a name that is not in use (and that can be used as a directory name). When created, termshark automatically switches to the new profile. If the profile in use at the time of creation is not the default, termshark copies the previous profile to the new profile and proceeds from there. If the profile in use is the default, the new profile will be empty.

When termshark is using a non-default profile, it is shown on the top line of the UI.

Termshark can be started with a non-default profile using the new -C/--profile command-line flag. Note that although I chose this to line up with Wireshark's invocation, termshark does not use Wireshark profiles in any way.

@gcla
Copy link
Owner Author

gcla commented Jun 13, 2022

@gcla
Copy link
Owner Author

gcla commented Jul 2, 2022

I've made some changes to how this works. Here's info from the main commit:

First, when the create-profile UI is opened, a new section at the bottom of the dialog allows making a connection to a Wireshark profile. If the checkbox is ticked, then the drop down button can be used to choose a Wireshark profile. This is saved in termshark.toml (for the current termshark profile) as main.wireshark-profile (string). The effect is that when tshark is invoked e.g. to load the PSML or PDML for a pcap, the -C flag is provided. One practical effect of this is that the Wireshark packet colors the user may have set up under a specific profile are able to be used in termshark. So, this mechanism allows configuration of termshark profiles via a connection to a Wireshark profile. Note that most Wireshark settings are not adopted in this way; for example, column can be configured in Wireshark, but termshark does this and stores them in the user's current termshark profile. You can change column sets by changing termshark profile, but they are stored by termshark in its config and not consumed from Wireshark's config.

The second change reworks the profile minibuffer commands. Instead of profile and new-profile, there is a multi-level profile command:

  • profile
    • create
    • use
    • delete
    • link
    • unlink

@gcla
Copy link
Owner Author

gcla commented Jul 2, 2022

Here are some screenshots to give you a flavor:

Screenshot-20220702193455-435x324

Screenshot-20220702193522-400x313

Screenshot-20220702193540-507x295

Screenshot-20220702194516-624x403

@gcla
Copy link
Owner Author

gcla commented Jul 15, 2022

Now that v2.4 is out with support for profiles, I'll close this.

@gcla gcla closed this as completed Jul 15, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

1 participant