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
19 #include <epan/packet_info.h>
20 #include <epan/dissectors/packet-smb-sidsnooping.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
;
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
);
46 smbsids_draw(void *pss _U_
)
49 printf("===================================================================\n");
50 printf("SMB SID List:\n");
51 g_hash_table_foreach(sid_name_table
, enum_sids
, NULL
);
52 printf("===================================================================\n");
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");
71 error_string
= register_tap_listener("smb", NULL
, NULL
, 0, NULL
, smbsids_packet
, smbsids_draw
, NULL
);
73 cmdarg_err("Couldn't register smb,sids tap: %s",
75 g_string_free(error_string
, TRUE
);
80 static stat_tap_ui smbsids_ui
= {
81 REGISTER_STAT_GROUP_GENERIC
,
90 register_tap_listener_smbsids(void)
92 register_stat_tap_ui(&smbsids_ui
, NULL
);
96 * Editor modelines - https://www.wireshark.org/tools/modelines.html
101 * indent-tabs-mode: t
104 * vi: set shiftwidth=8 tabstop=8 noexpandtab:
105 * :indentSize=8:tabSize=8:noTabs=false: