LATER... ei_kerberos_kdc_session_key ...
[wireshark-sm.git] / ui / cli / tap-smbsids.c
bloba0ac4d40b50c457bd49455130590bdd47ef0faf4
1 /* tap-smbsids.c
2 * smbstat 2003 Ronnie Sahlberg
4 * Wireshark - Network traffic analyzer
5 * By Gerald Combs <gerald@wireshark.org>
6 * Copyright 1998 Gerald Combs
8 * SPDX-License-Identifier: GPL-2.0-or-later
9 */
11 #include "config.h"
13 #include <stdio.h>
14 #include <stdlib.h>
15 #include <string.h>
17 #include <glib.h>
19 #include <epan/packet_info.h>
20 #include <epan/dissectors/packet-smb-sidsnooping.h>
21 #include <epan/tap.h>
22 #include <epan/stat_tap_ui.h>
23 #include <epan/value_string.h>
24 #include <epan/dissectors/packet-smb.h>
26 #include <wsutil/cmdarg_err.h>
28 void register_tap_listener_smbsids(void);
30 static tap_packet_status
31 smbsids_packet(void *pss _U_, packet_info *pinfo _U_, epan_dissect_t *edt _U_, const void *psi _U_, tap_flags_t flags _U_)
33 return TAP_PACKET_REDRAW;
36 static void
37 enum_sids(void *key, void *value, void *userdata _U_)
39 const char *sid = (const char *)key;
40 const char *name = (const char *)value;
42 printf("%-60s %s\n", sid, name);
45 static void
46 smbsids_draw(void *pss _U_)
48 printf("\n");
49 printf("===================================================================\n");
50 printf("SMB SID List:\n");
51 g_hash_table_foreach(sid_name_table, enum_sids, NULL);
52 printf("===================================================================\n");
56 static void
57 smbsids_init(const char *opt_arg _U_, void *userdata _U_)
59 GString *error_string;
61 if (!sid_name_snooping) {
62 fprintf(stderr, "The -z smb,sids function needs SMB/SID-Snooping to be enabled.\n");
63 fprintf(stderr, "Either enable Edit/Preferences/Protocols/SMB/Snoop SID name mappings in wireshark\n");
64 fprintf(stderr, "or override the preference file by specifying\n");
65 fprintf(stderr, " -o \"smb.sid_name_snooping=true\"\n");
66 fprintf(stderr, "on the tshark command line.\n");
67 exit(1);
71 error_string = register_tap_listener("smb", NULL, NULL, 0, NULL, smbsids_packet, smbsids_draw, NULL);
72 if (error_string) {
73 cmdarg_err("Couldn't register smb,sids tap: %s",
74 error_string->str);
75 g_string_free(error_string, TRUE);
76 exit(1);
80 static stat_tap_ui smbsids_ui = {
81 REGISTER_STAT_GROUP_GENERIC,
82 NULL,
83 "smb,sids",
84 smbsids_init,
86 NULL
89 void
90 register_tap_listener_smbsids(void)
92 register_stat_tap_ui(&smbsids_ui, NULL);
96 * Editor modelines - https://www.wireshark.org/tools/modelines.html
98 * Local variables:
99 * c-basic-offset: 8
100 * tab-width: 8
101 * indent-tabs-mode: t
102 * End:
104 * vi: set shiftwidth=8 tabstop=8 noexpandtab:
105 * :indentSize=8:tabSize=8:noTabs=false: