2 * Routines for DCOM OXID Resolver
3 * Copyright 2001, Todd Sabin <tas@webspan.net>
5 * Wireshark - Network traffic analyzer
6 * By Gerald Combs <gerald@wireshark.org>
7 * Copyright 1998 Gerald Combs
9 * SPDX-License-Identifier: GPL-2.0-or-later
12 /* see packet-dcom.c for details about DCOM */
16 #include <epan/packet.h>
17 #include "packet-dcerpc.h"
18 #include "packet-dcom.h"
20 void proto_register_oxid(void);
21 void proto_reg_handoff_oxid(void);
23 static int proto_oxid
;
25 static int hf_oxid_opnum
;
26 static int hf_oxid_setid
;
27 static int hf_oxid_seqnum
;
28 static int hf_oxid_addtoset
;
29 static int hf_oxid_delfromset
;
30 static int hf_oxid_oid
;
31 static int hf_oxid_ping_backoff_factor
;
32 static int hf_oxid_oxid
;
33 static int hf_oxid_requested_protseqs
;
34 static int hf_oxid_protseqs
;
35 static int hf_oxid_bindings
;
36 static int hf_oxid_ipid
;
37 static int hf_oxid_authn_hint
;
39 static int hf_oxid_Unknown1
;
40 static int hf_oxid_Unknown2
;
41 static int hf_oxid_ds_array
;
46 static e_guid_t uuid_oxid
= { 0x99fcfec4, 0x5260, 0x101b, { 0xbb, 0xcb, 0x00, 0xaa, 0x00, 0x21, 0x34, 0x7a } };
47 static uint16_t ver_oxid
;
51 dissect_oxid_simple_ping_rqst(tvbuff_t
*tvb
, int offset
,
52 packet_info
*pinfo
, proto_tree
*tree
, dcerpc_info
*di
, uint8_t *drep
)
54 offset
= dissect_dcom_ID(tvb
, offset
, pinfo
, tree
, di
, drep
,
62 dissect_oxid_simple_ping_resp(tvbuff_t
*tvb
, int offset
,
63 packet_info
*pinfo
, proto_tree
*tree
, dcerpc_info
*di
, uint8_t *drep
)
68 offset
= dissect_dcom_HRESULT(tvb
, offset
, pinfo
, tree
, di
, drep
,
71 col_append_fstr(pinfo
->cinfo
, COL_INFO
, " -> %s",
72 val_to_str(u32HResult
, dcom_hresult_vals
, "Unknown (0x%08x)") );
79 dissect_oxid_server_alive_resp(tvbuff_t
*tvb
, int offset
,
80 packet_info
*pinfo
, proto_tree
*tree
, dcerpc_info
*di
, uint8_t *drep
)
85 offset
= dissect_dcom_HRESULT(tvb
, offset
, pinfo
, tree
, di
, drep
,
88 col_append_fstr(pinfo
->cinfo
, COL_INFO
, " -> %s",
89 val_to_str(u32HResult
, dcom_hresult_vals
, "Unknown (0x%08x)") );
96 dissect_oxid_complex_ping_rqst(tvbuff_t
*tvb
, int offset
,
97 packet_info
*pinfo
, proto_tree
*tree
, dcerpc_info
*di
, uint8_t *drep
)
100 uint16_t u16AddToSet
;
101 uint16_t u16DelFromSet
;
103 uint32_t u32ArraySize
;
105 offset
= dissect_dcom_ID(tvb
, offset
, pinfo
, tree
, di
, drep
,
106 hf_oxid_setid
, NULL
);
108 offset
= dissect_dcom_WORD(tvb
, offset
, pinfo
, tree
, di
, drep
,
109 hf_oxid_seqnum
, &u16SeqNum
);
110 offset
= dissect_dcom_WORD(tvb
, offset
, pinfo
, tree
, di
, drep
,
111 hf_oxid_addtoset
, &u16AddToSet
);
112 offset
= dissect_dcom_WORD(tvb
, offset
, pinfo
, tree
, di
, drep
,
113 hf_oxid_delfromset
, &u16DelFromSet
);
115 col_append_fstr(pinfo
->cinfo
, COL_INFO
, " AddToSet=%u DelFromSet=%u",
116 u16AddToSet
, u16DelFromSet
);
118 offset
= dissect_dcom_dcerpc_pointer(tvb
, offset
, pinfo
, tree
, di
, drep
,
121 offset
= dissect_dcom_dcerpc_array_size(tvb
, offset
, pinfo
, tree
, di
, drep
,
124 while (u16AddToSet
--) {
125 offset
= dissect_dcom_ID(tvb
, offset
, pinfo
, tree
, di
, drep
,
130 offset
= dissect_dcom_dcerpc_pointer(tvb
, offset
, pinfo
, tree
, di
, drep
,
133 offset
= dissect_dcom_dcerpc_array_size(tvb
, offset
, pinfo
, tree
, di
, drep
,
136 while (u16DelFromSet
--) {
137 offset
= dissect_dcom_ID(tvb
, offset
, pinfo
, tree
, di
, drep
,
147 dissect_oxid_complex_ping_resp(tvbuff_t
*tvb
, int offset
,
148 packet_info
*pinfo
, proto_tree
*tree
, dcerpc_info
*di
, uint8_t *drep
)
150 uint16_t u16PingBackoffFactor
;
154 offset
= dissect_dcom_ID(tvb
, offset
, pinfo
, tree
, di
, drep
,
155 hf_oxid_setid
, NULL
);
156 offset
= dissect_dcom_WORD(tvb
, offset
, pinfo
, tree
, di
, drep
,
157 hf_oxid_ping_backoff_factor
, &u16PingBackoffFactor
);
159 offset
= dissect_dcom_HRESULT(tvb
, offset
, pinfo
, tree
, di
, drep
,
162 col_append_fstr(pinfo
->cinfo
, COL_INFO
, " -> %s",
163 val_to_str(u32HResult
, dcom_hresult_vals
, "Unknown (0x%08x)") );
170 dissect_oxid_resolve_oxid2_rqst(tvbuff_t
*tvb
, int offset
,
171 packet_info
*pinfo
, proto_tree
*tree
, dcerpc_info
*di
, uint8_t *drep
)
173 uint16_t u16ProtSeqs
;
174 uint32_t u32ArraySize
;
177 offset
= dissect_dcom_ID(tvb
, offset
, pinfo
, tree
, di
, drep
,
180 offset
= dissect_dcom_WORD(tvb
, offset
, pinfo
, tree
, di
, drep
,
181 hf_oxid_requested_protseqs
, &u16ProtSeqs
);
183 offset
= dissect_dcom_dcerpc_array_size(tvb
, offset
, pinfo
, tree
, di
, drep
,
186 while (u32ArraySize
--) {
187 offset
= dissect_dcom_WORD(tvb
, offset
, pinfo
, tree
, di
, drep
,
188 hf_oxid_protseqs
, &u16ProtSeqs
);
196 dissect_oxid_resolve_oxid2_resp(tvbuff_t
*tvb
, int offset
,
197 packet_info
*pinfo
, proto_tree
*tree
, dcerpc_info
*di
, uint8_t *drep
)
200 uint32_t u32ArraySize
;
202 uint32_t u32AuthnHint
;
203 uint16_t u16VersionMajor
;
204 uint16_t u16VersionMinor
;
208 offset
= dissect_dcom_dcerpc_pointer(tvb
, offset
, pinfo
, tree
, di
, drep
,
211 offset
= dissect_dcom_dcerpc_array_size(tvb
, offset
, pinfo
, tree
, di
, drep
,
214 offset
= dissect_dcom_DUALSTRINGARRAY(tvb
, offset
, pinfo
, tree
, di
, drep
,
215 hf_oxid_bindings
, NULL
);
217 offset
= dissect_dcom_UUID(tvb
, offset
, pinfo
, tree
, di
, drep
,
218 hf_oxid_ipid
, &ipid
);
220 offset
= dissect_dcom_DWORD(tvb
, offset
, pinfo
, tree
, di
, drep
,
221 hf_oxid_authn_hint
, &u32AuthnHint
);
223 offset
= dissect_dcom_COMVERSION(tvb
, offset
, pinfo
, tree
, di
, drep
,
224 &u16VersionMajor
, &u16VersionMinor
);
227 offset
= dissect_dcom_HRESULT(tvb
, offset
, pinfo
, tree
, di
, drep
,
230 col_append_fstr(pinfo
->cinfo
, COL_INFO
, " -> %s",
231 val_to_str(u32HResult
, dcom_hresult_vals
, "Unknown (0x%08x)") );
238 dissect_oxid_server_alive2_resp(tvbuff_t
*tvb
, int offset
, packet_info
*pinfo
,
239 proto_tree
*tree
, dcerpc_info
*di
, uint8_t *drep
) {
240 uint16_t u16VersionMajor
;
241 uint16_t u16VersionMinor
;
243 offset
= dissect_dcom_COMVERSION(tvb
, offset
, pinfo
, tree
, di
, drep
, &u16VersionMajor
, &u16VersionMinor
);
245 /* XXX - understand what those 8 bytes mean! don't skip'em!*/
246 dissect_dcerpc_uint64(tvb
, offset
, pinfo
, tree
, di
, drep
, hf_oxid_Unknown1
, NULL
);
249 offset
= dissect_dcom_DUALSTRINGARRAY(tvb
, offset
, pinfo
, tree
, di
, drep
, hf_oxid_ds_array
, NULL
);
251 /* unknown field 2 */
252 dissect_dcerpc_uint64(tvb
, offset
, pinfo
, tree
, di
, drep
, hf_oxid_Unknown2
, NULL
);
258 /* XXX - some dissectors still need to be done */
259 static const dcerpc_sub_dissector oxid_dissectors
[] = {
260 { 0, "ResolveOxid", NULL
, NULL
},
261 { 1, "SimplePing", dissect_oxid_simple_ping_rqst
, dissect_oxid_simple_ping_resp
},
262 { 2, "ComplexPing", dissect_oxid_complex_ping_rqst
, dissect_oxid_complex_ping_resp
},
263 { 3, "ServerAlive", NULL
/* no input parameters */, dissect_oxid_server_alive_resp
},
264 { 4, "ResolveOxid2", dissect_oxid_resolve_oxid2_rqst
, dissect_oxid_resolve_oxid2_resp
},
265 { 5, "ServerAlive2", NULL
, dissect_oxid_server_alive2_resp
},
266 { 0, NULL
, NULL
, NULL
},
271 proto_register_oxid (void)
273 static hf_register_info hf
[] = {
275 { "Operation", "oxid.opnum", FT_UINT16
, BASE_DEC
, NULL
, 0x0, NULL
, HFILL
}},
278 { "SetId", "oxid.setid", FT_UINT64
, BASE_HEX
, NULL
, 0x0, NULL
, HFILL
}},
280 { "SeqNum", "oxid.seqnum", FT_UINT16
, BASE_DEC
, NULL
, 0x0, NULL
, HFILL
}},
282 { "AddToSet", "oxid.addtoset", FT_UINT16
, BASE_DEC
, NULL
, 0x0, NULL
, HFILL
}},
283 { &hf_oxid_delfromset
,
284 { "DelFromSet", "oxid.delfromset", FT_UINT16
, BASE_DEC
, NULL
, 0x0, NULL
, HFILL
}},
286 { "OID", "oxid.oid", FT_UINT64
, BASE_HEX
, NULL
, 0x0, NULL
, HFILL
}},
287 { &hf_oxid_ping_backoff_factor
,
288 { "PingBackoffFactor", "oxid.ping_backoff_factor", FT_UINT16
, BASE_DEC
, NULL
, 0x0, NULL
, HFILL
}},
290 { "OXID", "oxid.oxid", FT_UINT64
, BASE_HEX
, NULL
, 0x0, NULL
, HFILL
}},
292 { &hf_oxid_requested_protseqs
,
293 { "RequestedProtSeq", "oxid.requested_protseqs", FT_UINT16
, BASE_DEC
, NULL
, 0x0, NULL
, HFILL
}},
295 { "ProtSeq", "oxid.protseqs", FT_UINT16
, BASE_DEC
, VALS(dcom_protseq_vals
), 0x0, NULL
, HFILL
}},
298 { "OxidBindings", "oxid.bindings", FT_NONE
, BASE_NONE
, NULL
, 0x0, NULL
, HFILL
}},
300 { "IPID", "oxid.ipid", FT_GUID
, BASE_NONE
, NULL
, 0x0, NULL
, HFILL
}},
301 { &hf_oxid_authn_hint
,
302 { "AuthnHint", "oxid.authn_hint", FT_UINT32
, BASE_DEC
, NULL
, 0x0, NULL
, HFILL
}},
305 { "Address", "dcom.oxid.address", FT_NONE
, BASE_NONE
, NULL
, 0x0, NULL
, HFILL
}},
307 { "unknown 8 bytes 1", "oxid.unknown1", FT_UINT64
, BASE_HEX
, NULL
, 0x0, NULL
, HFILL
}},
309 { "unknown 8 bytes 2", "oxid.unknown2", FT_UINT64
, BASE_HEX
, NULL
, 0x0, NULL
, HFILL
}}
311 static int *ett
[] = {
314 proto_oxid
= proto_register_protocol ("DCOM OXID Resolver", "IOXIDResolver", "oxid");
315 proto_register_field_array (proto_oxid
, hf
, array_length (hf
));
316 proto_register_subtree_array (ett
, array_length (ett
));
320 proto_reg_handoff_oxid (void)
322 /* Register the protocol as dcerpc */
323 dcerpc_init_uuid (proto_oxid
, ett_oxid
, &uuid_oxid
, ver_oxid
, oxid_dissectors
, hf_oxid_opnum
);
327 * Editor modelines - https://www.wireshark.org/tools/modelines.html
332 * indent-tabs-mode: nil
335 * vi: set shiftwidth=4 tabstop=8 expandtab:
336 * :indentSize=4:tabSize=8:noTabs=true: