2000-08-20 19:40:47 +00:00
|
|
|
/* packet-msproxy.c
|
2000-04-20 02:18:53 +00:00
|
|
|
* Routines for Microsoft Proxy packet dissection
|
|
|
|
* Copyright 2000, Jeffrey C. Foster <jfoste@woodward.com>
|
|
|
|
*
|
2001-03-22 06:55:58 +00:00
|
|
|
* $Id: packet-msproxy.c,v 1.17 2001/03/22 06:55:58 guy Exp $
|
2000-04-20 02:18:53 +00:00
|
|
|
*
|
|
|
|
* Ethereal - Network traffic analyzer
|
|
|
|
* By Gerald Combs <gerald@zing.org>
|
|
|
|
* Copyright 1998 Gerald Combs
|
|
|
|
*
|
|
|
|
*
|
|
|
|
* This program is free software; you can redistribute it and/or
|
|
|
|
* modify it under the terms of the GNU General Public License
|
|
|
|
* as published by the Free Software Foundation; either version 2
|
|
|
|
* of the License, or (at your option) any later version.
|
|
|
|
*
|
|
|
|
* This program is distributed in the hope that it will be useful,
|
|
|
|
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
|
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
|
|
* GNU General Public License for more details.
|
|
|
|
*
|
|
|
|
* You should have received a copy of the GNU General Public License
|
|
|
|
* along with this program; if not, write to the Free Software
|
|
|
|
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
|
|
|
|
*
|
|
|
|
*
|
|
|
|
* This was derived from the dante socks implimentation source code.
|
|
|
|
* Most of the information came from common.h and msproxy_clientprotocol.c
|
|
|
|
*
|
2000-05-31 16:49:42 +00:00
|
|
|
* See http://www.inet.no/dante for more information
|
2000-04-20 02:18:53 +00:00
|
|
|
*
|
|
|
|
*/
|
|
|
|
|
|
|
|
/************************************************************************
|
|
|
|
* *
|
|
|
|
* Notes: These are possible command values. User input is welcome *
|
|
|
|
* *
|
|
|
|
* Command = 0x040a - Remote host closed connection (maybe ?? ) *
|
|
|
|
* Command = 0x0411 - Remote host closed connection *
|
|
|
|
* Command = 0x0413 - Local host closed connection or SYN worked *
|
|
|
|
* *
|
|
|
|
************************************************************************/
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
#ifdef HAVE_CONFIG_H
|
|
|
|
# include "config.h"
|
|
|
|
#endif
|
|
|
|
|
|
|
|
#ifdef HAVE_SYS_TYPES_H
|
|
|
|
# include <sys/types.h>
|
|
|
|
#endif
|
|
|
|
|
|
|
|
#ifdef HAVE_NETINET_IN_H
|
|
|
|
# include <netinet/in.h>
|
|
|
|
#endif
|
|
|
|
|
|
|
|
#include <stdio.h>
|
|
|
|
#include <string.h>
|
|
|
|
#include <glib.h>
|
2000-08-11 13:37:21 +00:00
|
|
|
|
|
|
|
#ifdef NEED_SNPRINTF_H
|
|
|
|
# include "snprintf.h"
|
|
|
|
#endif
|
|
|
|
|
2000-04-20 02:18:53 +00:00
|
|
|
#include "packet.h"
|
|
|
|
#include "resolv.h"
|
|
|
|
#include "globals.h"
|
|
|
|
#include "alignment.h"
|
|
|
|
#include "conversation.h"
|
|
|
|
|
|
|
|
#include "packet-tcp.h"
|
|
|
|
#include "packet-udp.h"
|
|
|
|
|
2000-08-06 10:04:15 +00:00
|
|
|
#define CHECK_PACKET_LENGTH(X) if (!BYTES_ARE_IN_FRAME(offset, X)){ \
|
2000-05-11 08:18:09 +00:00
|
|
|
proto_tree_add_text(tree, NullTVB, offset, 0, "****FRAME TOO SHORT***"); return;}
|
2000-04-20 02:18:53 +00:00
|
|
|
|
|
|
|
extern void udp_hash_add(guint16 proto,
|
|
|
|
void (*dissect)(const u_char *, int, frame_data *, proto_tree *));
|
|
|
|
|
|
|
|
|
|
|
|
static int proto_msproxy = -1;
|
|
|
|
|
|
|
|
static int ett_msproxy = -1;
|
|
|
|
static int ett_msproxy_name = -1;
|
|
|
|
|
|
|
|
static int hf_msproxy_cmd = -1;
|
|
|
|
static int hf_msproxy_clntport = -1;
|
|
|
|
|
|
|
|
static int hf_msproxy_dstaddr = -1;
|
|
|
|
|
|
|
|
static int hf_msproxy_srcport = -1;
|
|
|
|
static int hf_msproxy_dstport = -1;
|
|
|
|
static int hf_msproxy_serverport = -1;
|
|
|
|
static int hf_msproxy_serveraddr = -1;
|
|
|
|
static int hf_msproxy_bindport = -1;
|
|
|
|
static int hf_msproxy_bindaddr = -1;
|
|
|
|
static int hf_msproxy_boundport = -1;
|
|
|
|
static int hf_msproxy_bind_id = -1;
|
|
|
|
static int hf_msproxy_resolvaddr = -1;
|
|
|
|
|
|
|
|
static int hf_msproxy_server_int_addr = -1;
|
|
|
|
static int hf_msproxy_server_int_port = -1;
|
|
|
|
static int hf_msproxy_server_ext_addr = -1;
|
|
|
|
static int hf_msproxy_server_ext_port = -1;
|
|
|
|
|
|
|
|
|
|
|
|
#define UDP_PORT_MSPROXY 1745
|
|
|
|
|
|
|
|
#define N_MSPROXY_HELLO 0x05 /* packet 1 from client */
|
|
|
|
#define N_MSPROXY_ACK 0x10 /* packet 1 from server */
|
|
|
|
#define N_MSPROXY_USERINFO_ACK 0x04 /* packet 2 from server */
|
|
|
|
#define N_MSPROXY_AUTH 0x47 /* packet 3 from client */
|
|
|
|
#define N_MSPROXY_RESOLVE 0x07 /* Resolve request */
|
|
|
|
|
|
|
|
|
|
|
|
/*$$$ 0x0500 was dante value, I see 0x05ff and 0x0500 */
|
|
|
|
|
|
|
|
#define MSPROXY_HELLO 0x0500
|
|
|
|
#define MSPROXY_HELLO_2 0x05ff
|
|
|
|
|
|
|
|
#define MSPROXY_HELLO_ACK 0x1000
|
|
|
|
|
|
|
|
#define MSPROXY_USERINFO 0x1000
|
|
|
|
#define MSPROXY_USERINFO_ACK 0x0400
|
|
|
|
|
|
|
|
#define MSPROXY_AUTH 0x4700
|
|
|
|
#define MSPROXY_AUTH_1_ACK 0x4714
|
|
|
|
#define MSPROXY_AUTH_2 0x4701
|
|
|
|
#define MSPROXY_AUTH_2_ACK 0x4715
|
|
|
|
#define MSPROXY_AUTH_2_ACK2 0x4716
|
|
|
|
|
|
|
|
#define MSPROXY_RESOLVE 0x070d
|
|
|
|
#define MSPROXY_RESOLVE_ACK 0x070f
|
|
|
|
|
|
|
|
#define MSPROXY_BIND 0x0704
|
|
|
|
#define MSPROXY_BIND_ACK 0x0706
|
|
|
|
|
|
|
|
#define MSPROXY_TCP_BIND 0x0707
|
|
|
|
#define MSPROXY_TCP_BIND_ACK 0x0708
|
|
|
|
|
|
|
|
#define MSPROXY_LISTEN 0x0406
|
|
|
|
|
|
|
|
#define MSPROXY_BINDINFO 0x0709
|
|
|
|
|
|
|
|
#define MSPROXY_BINDINFO_ACK 0x070a
|
|
|
|
|
|
|
|
#define MSPROXY_CONNECT 0x071e
|
|
|
|
#define MSPROXY_CONNECT_ACK 0x0703
|
|
|
|
|
|
|
|
#define MSPROXY_UDPASSOCIATE 0x0705
|
|
|
|
#define MSPROXY_UDPASSOCIATE_ACK 0x0706
|
|
|
|
|
|
|
|
#define MSPROXY_UDP_BIND_REQ 0x070b
|
|
|
|
|
|
|
|
#define MSPROXY_CONNECTED 0x042c
|
|
|
|
#define MSPROXY_SESSIONEND 0x251e
|
|
|
|
|
|
|
|
#define MSPROXY_BIND_AUTHFAILED 0x0804
|
|
|
|
#define MSPROXY_CONNECT_AUTHFAILED 0x081e
|
|
|
|
#define MSPROXY_CONNREFUSED 0x4 /* low 12 bits seem to vary. */
|
|
|
|
|
|
|
|
#define FROM_SERVER 1 /* direction of packet data for get_msproxy_cmd_name */
|
|
|
|
#define FROM_CLIENT 0
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
/*$$$ should this be the same as redirect_entry_t ?? */
|
|
|
|
/* then the add_conversation could just copy the structure */
|
|
|
|
/* using the same allocation (instance for you object guys) */
|
|
|
|
/* wouldn't work because there may be multiple child conversations */
|
|
|
|
/* from the same MSProxy conversation */
|
|
|
|
|
|
|
|
typedef struct {
|
|
|
|
guint32 dst_addr;
|
|
|
|
guint32 clnt_port;
|
|
|
|
guint32 dst_port;
|
|
|
|
guint32 server_int_port;
|
|
|
|
int proto;
|
|
|
|
}hash_entry_t;
|
|
|
|
|
|
|
|
|
|
|
|
/************** conversation hash stuff ***************/
|
|
|
|
|
|
|
|
#define hash_init_count 20
|
|
|
|
#define hash_val_length (sizeof(hash_entry_t))
|
|
|
|
|
|
|
|
static GMemChunk *vals = NULL;
|
|
|
|
|
|
|
|
typedef struct {
|
|
|
|
guint32 remote_addr;
|
|
|
|
guint32 clnt_port;
|
|
|
|
guint32 server_int_port;
|
|
|
|
guint32 remote_port;
|
|
|
|
int proto;
|
|
|
|
}redirect_entry_t;
|
|
|
|
|
|
|
|
|
|
|
|
/************** negotiated conversation hash stuff ***************/
|
|
|
|
|
|
|
|
#define redirect_init_count 20
|
|
|
|
#define redirect_val_length (sizeof(redirect_entry_t))
|
|
|
|
|
|
|
|
static GMemChunk *redirect_vals = NULL;
|
|
|
|
|
|
|
|
|
|
|
|
static guint32 last_row= 0; /* used to see if packet is new */
|
|
|
|
|
|
|
|
static void msproxy_sub_dissector( const u_char *pd, int offset, frame_data *fd,
|
|
|
|
proto_tree *tree) {
|
|
|
|
|
|
|
|
/* Conversation dissector called from TCP or UDP dissector. Decode and */
|
|
|
|
/* display the socks header, the pass the rest of the data to the tcp */
|
|
|
|
/* or udp port decode routine to handle the payload. */
|
|
|
|
|
|
|
|
guint32 *ptr;
|
|
|
|
redirect_entry_t *redirect_info;
|
|
|
|
conversation_t *conversation;
|
|
|
|
proto_tree *msp_tree;
|
|
|
|
proto_item *ti;
|
Tvbuffify the IP, ICMP, TCP, UDP, OSI CLNP, OSI COTP, OSI CLTP, and OSI
ESIS dissectors.
Register the IP dissector and have dissectors that call it directly
(rather than through a port table) call it through a handle.
Add a routine "tvb_set_reported_length()" which a dissector can use if
it was handed a tvbuff that contains more data than is actually in its
part of the packet - for example, handing a padded Ethernet frame to IP;
the routine sets the reported length of the tvbuff (and also adjusts the
actual length, as appropriate). Then use it in IP.
Given that, "ethertype()" can determine how much of the Ethernet frame
was actually part of an IP datagram (and can do the same for other
protocols under Ethernet that use "tvb_set_reported_length()"; have it
return the actual length, and have "dissect_eth()" and "dissect_vlan()"
use that to mark trailer data in Ethernet II frames as well as in 802.3
frames.
svn path=/trunk/; revision=2658
2000-11-18 10:38:33 +00:00
|
|
|
tvbuff_t *tvb;
|
2000-04-20 02:18:53 +00:00
|
|
|
|
|
|
|
conversation = find_conversation( &pi.src, &pi.dst, pi.ptype,
|
2000-10-21 05:52:28 +00:00
|
|
|
pi.srcport, pi.destport, 0);
|
2000-04-20 02:18:53 +00:00
|
|
|
|
|
|
|
g_assert( conversation); /* should always find a conversation */
|
|
|
|
|
|
|
|
redirect_info = (redirect_entry_t*)conversation->data;
|
|
|
|
|
|
|
|
if (check_col(fd, COL_PROTOCOL))
|
2000-11-19 08:54:37 +00:00
|
|
|
col_set_str(fd, COL_PROTOCOL, "MS Proxy");
|
2000-04-20 02:18:53 +00:00
|
|
|
|
|
|
|
if (check_col(fd, COL_INFO))
|
|
|
|
col_add_fstr(fd, COL_INFO, "%s",
|
|
|
|
(( redirect_info->proto == PT_TCP) ? "TCP stream" :
|
|
|
|
"UDP packets"));
|
|
|
|
|
|
|
|
if ( tree) {
|
2000-05-11 08:18:09 +00:00
|
|
|
ti = proto_tree_add_item( tree, proto_msproxy, NullTVB, offset, 0,
|
2000-05-31 05:09:07 +00:00
|
|
|
FALSE );
|
2000-04-20 02:18:53 +00:00
|
|
|
|
|
|
|
msp_tree = proto_item_add_subtree(ti, ett_msproxy);
|
|
|
|
|
2000-05-31 05:09:07 +00:00
|
|
|
proto_tree_add_uint( msp_tree, hf_msproxy_dstport, NullTVB,
|
2000-04-20 02:18:53 +00:00
|
|
|
offset, 0, redirect_info->remote_port);
|
|
|
|
|
2000-05-31 05:09:07 +00:00
|
|
|
proto_tree_add_ipv4( msp_tree, hf_msproxy_dstaddr, NullTVB, offset, 0,
|
2000-04-20 02:18:53 +00:00
|
|
|
redirect_info->remote_addr);
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
/* set pi src/dst port and call the udp sub-dissector lookup */
|
|
|
|
|
|
|
|
if ( pi.srcport == redirect_info->clnt_port)
|
|
|
|
ptr = &pi.destport;
|
|
|
|
else
|
|
|
|
ptr = &pi.srcport;
|
|
|
|
|
|
|
|
*ptr = redirect_info->remote_port;
|
|
|
|
|
Tvbuffify the IP, ICMP, TCP, UDP, OSI CLNP, OSI COTP, OSI CLTP, and OSI
ESIS dissectors.
Register the IP dissector and have dissectors that call it directly
(rather than through a port table) call it through a handle.
Add a routine "tvb_set_reported_length()" which a dissector can use if
it was handed a tvbuff that contains more data than is actually in its
part of the packet - for example, handing a padded Ethernet frame to IP;
the routine sets the reported length of the tvbuff (and also adjusts the
actual length, as appropriate). Then use it in IP.
Given that, "ethertype()" can determine how much of the Ethernet frame
was actually part of an IP datagram (and can do the same for other
protocols under Ethernet that use "tvb_set_reported_length()"; have it
return the actual length, and have "dissect_eth()" and "dissect_vlan()"
use that to mark trailer data in Ethernet II frames as well as in 802.3
frames.
svn path=/trunk/; revision=2658
2000-11-18 10:38:33 +00:00
|
|
|
tvb = tvb_create_from_top(0);
|
2000-04-20 02:18:53 +00:00
|
|
|
if ( redirect_info->proto == PT_TCP)
|
Tvbuffify the IP, ICMP, TCP, UDP, OSI CLNP, OSI COTP, OSI CLTP, and OSI
ESIS dissectors.
Register the IP dissector and have dissectors that call it directly
(rather than through a port table) call it through a handle.
Add a routine "tvb_set_reported_length()" which a dissector can use if
it was handed a tvbuff that contains more data than is actually in its
part of the packet - for example, handing a padded Ethernet frame to IP;
the routine sets the reported length of the tvbuff (and also adjusts the
actual length, as appropriate). Then use it in IP.
Given that, "ethertype()" can determine how much of the Ethernet frame
was actually part of an IP datagram (and can do the same for other
protocols under Ethernet that use "tvb_set_reported_length()"; have it
return the actual length, and have "dissect_eth()" and "dissect_vlan()"
use that to mark trailer data in Ethernet II frames as well as in 802.3
frames.
svn path=/trunk/; revision=2658
2000-11-18 10:38:33 +00:00
|
|
|
decode_tcp_ports( tvb, offset, &pi, tree, pi.srcport, pi.destport);
|
2000-04-20 02:18:53 +00:00
|
|
|
else
|
Tvbuffify the IP, ICMP, TCP, UDP, OSI CLNP, OSI COTP, OSI CLTP, and OSI
ESIS dissectors.
Register the IP dissector and have dissectors that call it directly
(rather than through a port table) call it through a handle.
Add a routine "tvb_set_reported_length()" which a dissector can use if
it was handed a tvbuff that contains more data than is actually in its
part of the packet - for example, handing a padded Ethernet frame to IP;
the routine sets the reported length of the tvbuff (and also adjusts the
actual length, as appropriate). Then use it in IP.
Given that, "ethertype()" can determine how much of the Ethernet frame
was actually part of an IP datagram (and can do the same for other
protocols under Ethernet that use "tvb_set_reported_length()"; have it
return the actual length, and have "dissect_eth()" and "dissect_vlan()"
use that to mark trailer data in Ethernet II frames as well as in 802.3
frames.
svn path=/trunk/; revision=2658
2000-11-18 10:38:33 +00:00
|
|
|
decode_udp_ports( tvb, offset, &pi, tree, pi.srcport, pi.destport);
|
2000-04-20 02:18:53 +00:00
|
|
|
|
|
|
|
*ptr = redirect_info->server_int_port;
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
static void add_msproxy_conversation( hash_entry_t *hash_info){
|
|
|
|
|
|
|
|
/* check to see if a conversation already exists, if it does assume */
|
|
|
|
/* it's our conversation and quit. Otherwise create a new conversation. */
|
|
|
|
/* Load the conversation dissector to our dissector and load the */
|
|
|
|
/* conversation data structure with the info needed to call the TCP or */
|
|
|
|
/* UDP port decoder. */
|
|
|
|
|
Allow either old-style (pre-tvbuff) or new-style (tvbuffified)
dissectors to be registered as dissectors for particular ports,
registered as heuristic dissectors, and registered as dissectors for
conversations, and have routines to be used both by old-style and
new-style dissectors to call registered dissectors.
Have the code that calls those dissectors translate the arguments as
necessary. (For conversation dissectors, replace
"find_conversation_dissector()", which just returns a pointer to the
dissector, with "old_try_conversation_dissector()" and
"try_conversation_dissector()", which actually call the dissector, so
that there's a single place at which we can do that translation. Also
make "dissector_lookup()" static and, instead of calling it and, if it
returns a non-null pointer, calling that dissector, just use
"old_dissector_try_port()" or "dissector_try_port()", for the same
reason.)
This allows some dissectors that took old-style arguments and
immediately translated them to new-style arguments to just take
new-style arguments; make them do so. It also allows some new-style
dissectors not to have to translate arguments before calling routines to
look up and call dissectors; make them not do so.
Get rid of checks for too-short frames in new-style dissectors - the
tvbuff code does those checks for you.
Give the routines to register old-style dissectors, and to call
dissectors from old-style dissectors, names beginning with "old_", with
the routines for new-style dissectors not having the "old_". Update the
dissectors that use those routines appropriately.
Rename "dissect_data()" to "old_dissect_data()", and
"dissect_data_tvb()" to "dissect_data()".
svn path=/trunk/; revision=2218
2000-08-07 03:21:25 +00:00
|
|
|
/* NOTE: Currently this assume that the conversation will be created */
|
2000-04-20 02:18:53 +00:00
|
|
|
/* during a packet from the server. If that changes, the pi.src */
|
|
|
|
/* and pi.dst will not be correct and this routine will have to */
|
|
|
|
/* change. */
|
|
|
|
|
|
|
|
redirect_entry_t *new_conv_info;
|
|
|
|
|
|
|
|
conversation_t *conversation = find_conversation( &pi.src, &pi.dst,
|
|
|
|
hash_info->proto, hash_info->server_int_port,
|
2000-10-21 05:52:28 +00:00
|
|
|
hash_info->clnt_port, 0);
|
2000-04-20 02:18:53 +00:00
|
|
|
|
|
|
|
if ( conversation)
|
|
|
|
return;
|
|
|
|
|
|
|
|
new_conv_info = g_mem_chunk_alloc(redirect_vals);
|
|
|
|
conversation = conversation_new( &pi.src, &pi.dst, hash_info->proto,
|
2000-10-21 05:52:28 +00:00
|
|
|
hash_info->server_int_port, hash_info->clnt_port,
|
|
|
|
new_conv_info, 0);
|
2000-04-20 02:18:53 +00:00
|
|
|
|
|
|
|
g_assert( new_conv_info);
|
|
|
|
g_assert( conversation);
|
|
|
|
|
|
|
|
new_conv_info->remote_addr = hash_info->dst_addr;
|
|
|
|
new_conv_info->clnt_port = hash_info->clnt_port;
|
|
|
|
new_conv_info->remote_port = hash_info->dst_port;
|
|
|
|
new_conv_info->server_int_port = hash_info->server_int_port;
|
|
|
|
new_conv_info->proto = hash_info->proto;
|
|
|
|
|
2000-08-21 18:36:35 +00:00
|
|
|
old_conversation_set_dissector(conversation, msproxy_sub_dissector);
|
2000-04-20 02:18:53 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
static int display_application_name(const u_char *pd, int offset,
|
|
|
|
frame_data *fd, proto_tree *tree) {
|
|
|
|
|
|
|
|
/* display the application name in the proto tree. */
|
|
|
|
|
|
|
|
/* NOTE: this routine assumes that the tree pointer is valid (not NULL) */
|
|
|
|
|
2001-03-22 06:55:58 +00:00
|
|
|
char temp[255+1];
|
2000-04-20 02:18:53 +00:00
|
|
|
|
2000-08-06 10:04:15 +00:00
|
|
|
if (!IS_DATA_IN_FRAME(offset)){
|
2000-05-11 08:18:09 +00:00
|
|
|
proto_tree_add_text(tree, NullTVB, offset, 0, "****FRAME TOO SHORT***");
|
2000-04-20 02:18:53 +00:00
|
|
|
return 0;
|
|
|
|
}
|
|
|
|
|
|
|
|
strncpy( temp, &pd[ offset], MIN( 255, END_OF_FRAME));
|
|
|
|
temp[ MIN( 255, END_OF_FRAME)] = 0;
|
2000-05-11 08:18:09 +00:00
|
|
|
proto_tree_add_text( tree, NullTVB, offset, strlen(temp), "Application: %s", temp);
|
2000-04-20 02:18:53 +00:00
|
|
|
|
|
|
|
return strlen(temp);
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
static char *get_msproxy_cmd_name( int cmd, int direction) {
|
|
|
|
|
|
|
|
/* return the command name string for cmd */
|
|
|
|
|
|
|
|
switch (cmd){
|
|
|
|
case MSPROXY_HELLO_2:
|
|
|
|
case MSPROXY_HELLO: return "Hello";
|
|
|
|
|
|
|
|
/* MSPROXY_HELLO_ACK & MSPROXY_USERINFO have the same value (0x1000). */
|
|
|
|
/* So use the direction flag to determine which to use. */
|
|
|
|
|
|
|
|
case MSPROXY_USERINFO:
|
|
|
|
if ( direction == FROM_SERVER)
|
|
|
|
return "Hello Acknowledge";
|
|
|
|
else
|
|
|
|
return "User Info";
|
|
|
|
case MSPROXY_USERINFO_ACK: return "User Info Acknowledge";
|
|
|
|
case MSPROXY_AUTH: return "Authentication";
|
|
|
|
case MSPROXY_AUTH_1_ACK: return "Authentication Acknowledge";
|
|
|
|
case MSPROXY_AUTH_2: return "Authentication 2";
|
|
|
|
case MSPROXY_AUTH_2_ACK: return "Authentication 2 Acknowledge";
|
|
|
|
case MSPROXY_RESOLVE: return "Resolve";
|
|
|
|
case MSPROXY_RESOLVE_ACK: return "Resolve Acknowledge";
|
|
|
|
case MSPROXY_BIND: return "Bind";
|
|
|
|
case MSPROXY_TCP_BIND: return "TCP Bind";
|
|
|
|
case MSPROXY_TCP_BIND_ACK: return "TCP Bind Acknowledge";
|
|
|
|
case MSPROXY_LISTEN: return "Listen";
|
|
|
|
case MSPROXY_BINDINFO: return "Bind Info";
|
|
|
|
case MSPROXY_BINDINFO_ACK: return "Bind Info Acknowledge";
|
|
|
|
case MSPROXY_CONNECT: return "Connect";
|
|
|
|
case MSPROXY_CONNECT_ACK: return "Connect Acknowledge";
|
|
|
|
case MSPROXY_UDPASSOCIATE: return "UDP Associate";
|
|
|
|
case MSPROXY_UDP_BIND_REQ: return "UDP Bind";
|
|
|
|
case MSPROXY_UDPASSOCIATE_ACK: return "Bind or Associate Acknowledge";
|
|
|
|
case MSPROXY_CONNECTED: return "Connected";
|
|
|
|
case MSPROXY_SESSIONEND: return "Session End";
|
|
|
|
|
|
|
|
default: return "Unknown";
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
static void dissect_user_info_2(const u_char *pd, int offset, frame_data *fd, proto_tree *tree) {
|
|
|
|
|
|
|
|
/* decode the user, application, computer name */
|
|
|
|
|
|
|
|
|
2001-03-22 06:55:58 +00:00
|
|
|
char str[ 255+1];
|
2000-04-20 02:18:53 +00:00
|
|
|
|
|
|
|
if ( tree) {
|
2001-03-22 06:55:58 +00:00
|
|
|
CHECK_PACKET_LENGTH(1);
|
2000-04-20 02:18:53 +00:00
|
|
|
strncpy( str, &pd[ offset], MIN( 255, END_OF_FRAME));
|
|
|
|
str[ MIN( 255, END_OF_FRAME)] = 0;
|
|
|
|
|
2000-05-11 08:18:09 +00:00
|
|
|
proto_tree_add_text( tree, NullTVB, offset, strlen( str) + 1,
|
2000-04-20 02:18:53 +00:00
|
|
|
"User name: %s", str);
|
|
|
|
offset += strlen( str) + 2;
|
|
|
|
|
2001-03-22 06:55:58 +00:00
|
|
|
CHECK_PACKET_LENGTH(1);
|
2000-04-20 02:18:53 +00:00
|
|
|
strncpy( str, &pd[ offset], MIN( 255, END_OF_FRAME));
|
|
|
|
str[ MIN( 255, END_OF_FRAME)] = 0;
|
|
|
|
|
2000-05-11 08:18:09 +00:00
|
|
|
proto_tree_add_text( tree, NullTVB, offset, strlen( str) + 1,
|
2000-04-20 02:18:53 +00:00
|
|
|
"Application name: %s", str);
|
|
|
|
offset += strlen( str) + 1;
|
|
|
|
|
2001-03-22 06:55:58 +00:00
|
|
|
CHECK_PACKET_LENGTH(1);
|
2000-04-20 02:18:53 +00:00
|
|
|
strncpy( str, &pd[ offset], MIN( 255, END_OF_FRAME));
|
|
|
|
str[ MIN( 255, END_OF_FRAME)] = 0;
|
|
|
|
|
2000-05-11 08:18:09 +00:00
|
|
|
proto_tree_add_text( tree, NullTVB, offset, strlen( str) + 1,
|
2000-04-20 02:18:53 +00:00
|
|
|
"Client computer name: %s", str);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
static void dissect_msproxy_request_1(const u_char *pd, int offset, frame_data *fd, proto_tree *tree) {
|
|
|
|
|
|
|
|
/* decode the request _1 structure */
|
|
|
|
|
|
|
|
|
|
|
|
offset += 180;
|
|
|
|
|
|
|
|
dissect_user_info_2( pd, 262, fd, tree);
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
static void dissect_bind(const u_char *pd, int offset, frame_data *fd,
|
|
|
|
proto_tree *tree, hash_entry_t *conv_info) {
|
|
|
|
|
|
|
|
/* decode the bind request */
|
|
|
|
|
|
|
|
offset += 18;
|
|
|
|
|
|
|
|
CHECK_PACKET_LENGTH( 4);
|
|
|
|
if ( tree)
|
2000-05-31 05:09:07 +00:00
|
|
|
proto_tree_add_ipv4( tree, hf_msproxy_bindaddr, NullTVB, offset, 4,
|
2000-04-20 02:18:53 +00:00
|
|
|
GWORD( pd, offset));
|
|
|
|
offset += 4;
|
|
|
|
|
|
|
|
CHECK_PACKET_LENGTH( 2);
|
|
|
|
if ( tree)
|
2000-05-31 05:09:07 +00:00
|
|
|
proto_tree_add_uint( tree, hf_msproxy_bindport, NullTVB, offset, 2,
|
2000-04-20 02:18:53 +00:00
|
|
|
pntohs( &pd[ offset]));
|
|
|
|
offset += 6;
|
|
|
|
|
|
|
|
CHECK_PACKET_LENGTH( 2);
|
|
|
|
if ( tree)
|
2000-05-31 05:09:07 +00:00
|
|
|
proto_tree_add_uint( tree, hf_msproxy_clntport, NullTVB, offset, 2,
|
2000-04-20 02:18:53 +00:00
|
|
|
pntohs( &pd[ offset]));
|
|
|
|
offset += 2;
|
|
|
|
|
|
|
|
conv_info->clnt_port = pntohs( &pd[ offset]);
|
|
|
|
offset += 6;
|
|
|
|
|
|
|
|
if ( tree){
|
|
|
|
CHECK_PACKET_LENGTH( 2);
|
2000-05-31 05:09:07 +00:00
|
|
|
proto_tree_add_uint( tree, hf_msproxy_boundport, NullTVB, offset, 2,
|
2000-04-20 02:18:53 +00:00
|
|
|
pntohs( &pd[ offset]));
|
|
|
|
|
|
|
|
offset += 82;
|
|
|
|
display_application_name( pd, offset, fd, tree);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
static void dissect_auth(const u_char *pd, int offset,
|
|
|
|
frame_data *fd, proto_tree *tree) {
|
|
|
|
|
|
|
|
/* decode the authorization request */
|
|
|
|
|
2001-03-22 06:55:58 +00:00
|
|
|
char temp[255+1];
|
2000-04-20 02:18:53 +00:00
|
|
|
|
|
|
|
if ( tree) {
|
|
|
|
offset += 134;
|
|
|
|
|
2001-03-22 06:55:58 +00:00
|
|
|
CHECK_PACKET_LENGTH(7);
|
2000-04-20 02:18:53 +00:00
|
|
|
strncpy( temp, &pd[ offset], 7);
|
|
|
|
temp[ 7] = 0;
|
2000-05-11 08:18:09 +00:00
|
|
|
proto_tree_add_text( tree, NullTVB, offset, 7, "NTLMSSP signature: %s",
|
2000-04-20 02:18:53 +00:00
|
|
|
temp);
|
|
|
|
offset += 7;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
static void dissect_tcp_bind(const u_char *pd, int offset,
|
|
|
|
frame_data *fd, proto_tree *tree, hash_entry_t *conv_info) {
|
|
|
|
|
|
|
|
/* decode the bind packet. Set the protocol type in the conversation */
|
|
|
|
/* information so the bind_info can use it to create the payload */
|
|
|
|
/* dissector. */
|
|
|
|
|
|
|
|
|
|
|
|
conv_info->proto = PT_TCP;
|
|
|
|
|
|
|
|
if ( tree) {
|
|
|
|
offset += 6;
|
|
|
|
|
|
|
|
CHECK_PACKET_LENGTH( 4);
|
2000-05-31 05:09:07 +00:00
|
|
|
proto_tree_add_uint( tree, hf_msproxy_bind_id, NullTVB, offset, 4, pntohl( &pd[ offset]));
|
2000-04-20 02:18:53 +00:00
|
|
|
offset += 16;
|
|
|
|
|
|
|
|
CHECK_PACKET_LENGTH( 2);
|
2000-05-31 05:09:07 +00:00
|
|
|
proto_tree_add_uint( tree, hf_msproxy_boundport, NullTVB, offset, 2,
|
2000-04-20 02:18:53 +00:00
|
|
|
pntohs( &pd[ offset]));
|
|
|
|
|
|
|
|
offset += 96;
|
|
|
|
display_application_name( pd, offset, fd, tree);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
static void dissect_request_connect(const u_char *pd, int offset, frame_data *fd,
|
|
|
|
proto_tree *tree, hash_entry_t *conv_info) {
|
|
|
|
|
|
|
|
/* decode the connect request, display */
|
|
|
|
|
|
|
|
conv_info->proto = PT_TCP;
|
|
|
|
|
|
|
|
offset += 20;
|
|
|
|
|
|
|
|
CHECK_PACKET_LENGTH( 2);
|
|
|
|
if ( tree)
|
2000-05-31 05:09:07 +00:00
|
|
|
proto_tree_add_uint( tree, hf_msproxy_dstport, NullTVB, offset, 2,
|
2000-04-20 02:18:53 +00:00
|
|
|
pntohs( &pd[ offset]));
|
|
|
|
|
|
|
|
conv_info->dst_port = pntohs( &pd[ offset]);
|
|
|
|
offset += 2;
|
|
|
|
|
|
|
|
CHECK_PACKET_LENGTH( 4);
|
|
|
|
if ( tree)
|
2000-05-31 05:09:07 +00:00
|
|
|
proto_tree_add_ipv4( tree, hf_msproxy_dstaddr, NullTVB, offset, 4,
|
2000-04-20 02:18:53 +00:00
|
|
|
GWORD( pd, offset));
|
|
|
|
|
|
|
|
memcpy( &conv_info->dst_addr, &pd[ offset], sizeof( guint32));
|
|
|
|
|
|
|
|
offset += 12;
|
|
|
|
|
|
|
|
CHECK_PACKET_LENGTH( 2);
|
|
|
|
conv_info->clnt_port = pntohs( &pd[ offset]);
|
|
|
|
|
|
|
|
if ( tree){
|
2000-05-31 05:09:07 +00:00
|
|
|
proto_tree_add_uint( tree, hf_msproxy_clntport, NullTVB, offset, 2,
|
2000-04-20 02:18:53 +00:00
|
|
|
pntohs( &pd[ offset]));
|
|
|
|
|
|
|
|
offset += 84;
|
|
|
|
|
|
|
|
display_application_name( pd, offset, fd, tree);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
static void dissect_bind_info_ack(const u_char *pd, int offset, frame_data *fd,
|
|
|
|
proto_tree *tree, hash_entry_t *conv_info) {
|
|
|
|
|
|
|
|
/* decode the client bind info ack */
|
|
|
|
|
|
|
|
|
|
|
|
if ( tree){
|
|
|
|
offset += 6;
|
|
|
|
|
|
|
|
CHECK_PACKET_LENGTH( 4);
|
2000-05-31 05:09:07 +00:00
|
|
|
proto_tree_add_uint( tree, hf_msproxy_bind_id, NullTVB, offset, 4, pntohl( &pd[ offset]));
|
2000-04-20 02:18:53 +00:00
|
|
|
offset += 14;
|
|
|
|
|
|
|
|
CHECK_PACKET_LENGTH( 2);
|
2000-05-31 05:09:07 +00:00
|
|
|
proto_tree_add_uint( tree, hf_msproxy_dstport, NullTVB, offset, 2,
|
2000-04-20 02:18:53 +00:00
|
|
|
pntohs( &pd[ offset]));
|
|
|
|
offset += 2;
|
|
|
|
|
|
|
|
CHECK_PACKET_LENGTH( 4);
|
2000-05-31 05:09:07 +00:00
|
|
|
proto_tree_add_ipv4( tree, hf_msproxy_dstaddr, NullTVB, offset, 4,
|
2000-04-20 02:18:53 +00:00
|
|
|
GWORD( pd, offset));
|
|
|
|
offset += 12;
|
|
|
|
|
|
|
|
CHECK_PACKET_LENGTH( 2);
|
2000-05-31 05:09:07 +00:00
|
|
|
proto_tree_add_uint( tree, hf_msproxy_server_int_port, NullTVB, offset,
|
2000-04-20 02:18:53 +00:00
|
|
|
2, pntohs( &pd[ offset]));
|
|
|
|
offset += 4;
|
|
|
|
|
|
|
|
CHECK_PACKET_LENGTH( 2);
|
2000-05-31 05:09:07 +00:00
|
|
|
proto_tree_add_uint( tree, hf_msproxy_server_ext_port, NullTVB, offset,
|
2000-04-20 02:18:53 +00:00
|
|
|
2, pntohs( &pd[ offset]));
|
|
|
|
offset += 2;
|
|
|
|
|
|
|
|
CHECK_PACKET_LENGTH( 4);
|
2000-05-31 05:09:07 +00:00
|
|
|
proto_tree_add_ipv4( tree, hf_msproxy_server_ext_addr, NullTVB, offset,
|
2000-04-20 02:18:53 +00:00
|
|
|
4, GWORD( pd, offset));
|
|
|
|
|
|
|
|
offset += 78;
|
|
|
|
display_application_name( pd, offset, fd, tree);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
static void dissect_request_resolve(const u_char *pd, int offset,
|
|
|
|
frame_data *fd, proto_tree *tree) {
|
|
|
|
|
|
|
|
/* dissect the request resolve structure */
|
|
|
|
/* display a string with a length, characters encoding */
|
|
|
|
/* they are displayed under a tree with the name in Label variable */
|
|
|
|
/* return the length of the string and the length byte */
|
|
|
|
|
|
|
|
proto_tree *name_tree;
|
|
|
|
proto_item *ti;
|
|
|
|
|
2001-03-22 06:55:58 +00:00
|
|
|
char temp[ 255+1];
|
2000-04-20 02:18:53 +00:00
|
|
|
int length = GBYTE( pd, offset);
|
|
|
|
|
|
|
|
if ( tree){
|
2001-03-22 06:55:58 +00:00
|
|
|
CHECK_PACKET_LENGTH(length);
|
2000-04-20 02:18:53 +00:00
|
|
|
strncpy( temp, &pd[ offset + 18], length);
|
|
|
|
temp[ length ] = 0;
|
|
|
|
|
2000-05-11 08:18:09 +00:00
|
|
|
ti = proto_tree_add_text(tree, NullTVB, offset, length + 1,
|
2000-04-20 02:18:53 +00:00
|
|
|
"Host Name: %s", temp);
|
|
|
|
|
|
|
|
name_tree = proto_item_add_subtree(ti, ett_msproxy_name);
|
|
|
|
|
2000-05-11 08:18:09 +00:00
|
|
|
proto_tree_add_text( name_tree, NullTVB, offset, 1, "Length: %d", length);
|
2000-04-20 02:18:53 +00:00
|
|
|
|
|
|
|
++offset;
|
|
|
|
offset += 17;
|
|
|
|
|
2000-05-11 08:18:09 +00:00
|
|
|
proto_tree_add_text( name_tree, NullTVB, offset, length, "String: %s",
|
2000-04-20 02:18:53 +00:00
|
|
|
temp);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
static void dissect_udp_bind(const u_char *pd, int offset,
|
|
|
|
frame_data *fd, proto_tree *tree, hash_entry_t *conv_info) {
|
|
|
|
|
|
|
|
/* Dissect the udp bind request. Load the protocol id (PT_UDP) and the */
|
|
|
|
/* remote address so bind_info can use it to create conversation */
|
|
|
|
/* dissector. */
|
|
|
|
|
|
|
|
conv_info->proto = PT_UDP;
|
|
|
|
|
|
|
|
|
|
|
|
offset += 8;
|
|
|
|
|
|
|
|
CHECK_PACKET_LENGTH( 4);
|
|
|
|
if ( tree)
|
2000-05-31 05:09:07 +00:00
|
|
|
proto_tree_add_uint( tree, hf_msproxy_bind_id, NullTVB, offset, 4, pntohl( &pd[ offset]));
|
2000-04-20 02:18:53 +00:00
|
|
|
offset += 12;
|
|
|
|
|
|
|
|
|
|
|
|
CHECK_PACKET_LENGTH( 2);
|
|
|
|
if ( tree)
|
2000-05-31 05:09:07 +00:00
|
|
|
proto_tree_add_uint( tree, hf_msproxy_dstport, NullTVB, offset, 2,
|
2000-04-20 02:18:53 +00:00
|
|
|
pntohs( &pd[ offset]));
|
|
|
|
offset += 2;
|
|
|
|
|
|
|
|
CHECK_PACKET_LENGTH( 4);
|
|
|
|
if ( tree)
|
2000-05-31 05:09:07 +00:00
|
|
|
proto_tree_add_ipv4( tree, hf_msproxy_dstaddr, NullTVB, offset, 4,
|
2000-04-20 02:18:53 +00:00
|
|
|
GWORD( pd, offset));
|
|
|
|
|
|
|
|
offset += 96;
|
|
|
|
|
|
|
|
if ( tree)
|
|
|
|
display_application_name( pd, offset, fd, tree);
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
static void dissect_udp_assoc(const u_char *pd, int offset,
|
|
|
|
frame_data *fd, proto_tree *tree, hash_entry_t *conv_info) {
|
|
|
|
|
|
|
|
/* dissect the udp associate request. And load client port into */
|
|
|
|
/* conversation data structure for later. */
|
|
|
|
|
|
|
|
|
|
|
|
offset += 28;
|
|
|
|
|
|
|
|
CHECK_PACKET_LENGTH( 2);
|
|
|
|
if ( tree)
|
2000-05-31 05:09:07 +00:00
|
|
|
proto_tree_add_uint( tree, hf_msproxy_clntport, NullTVB, offset, 2,
|
2000-04-20 02:18:53 +00:00
|
|
|
pntohs( &pd[ offset]));
|
|
|
|
|
|
|
|
conv_info->clnt_port = pntohs( &pd[ offset]);
|
|
|
|
|
|
|
|
offset += 90;
|
|
|
|
|
|
|
|
if ( tree)
|
|
|
|
display_application_name( pd, offset, fd, tree);
|
|
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
static void dissect_msproxy_request(const u_char *pd, int offset, frame_data *fd,
|
|
|
|
proto_tree *tree, hash_entry_t *conv_info) {
|
|
|
|
|
|
|
|
int cmd;
|
2001-03-22 06:55:58 +00:00
|
|
|
char temp[ 255+1];
|
2000-04-20 02:18:53 +00:00
|
|
|
|
|
|
|
if ( tree) {
|
|
|
|
CHECK_PACKET_LENGTH( 4);
|
2000-05-11 08:18:09 +00:00
|
|
|
proto_tree_add_text( tree, NullTVB, offset, 4, "Client id: 0x%0x",
|
2000-04-20 02:18:53 +00:00
|
|
|
GWORD( pd, offset));
|
|
|
|
offset += 4;
|
|
|
|
|
|
|
|
CHECK_PACKET_LENGTH( 4);
|
2000-05-11 08:18:09 +00:00
|
|
|
proto_tree_add_text( tree, NullTVB, offset, 4, "Version: 0x%04x",
|
2000-04-20 02:18:53 +00:00
|
|
|
GWORD( pd, offset));
|
|
|
|
offset += 4;
|
|
|
|
|
|
|
|
CHECK_PACKET_LENGTH( 4);
|
2000-05-11 08:18:09 +00:00
|
|
|
proto_tree_add_text( tree, NullTVB, offset, 4, "Server id: 0x%0x",
|
2000-04-20 02:18:53 +00:00
|
|
|
GWORD( pd, offset));
|
|
|
|
offset += 4;
|
|
|
|
|
|
|
|
CHECK_PACKET_LENGTH( 2);
|
2000-05-11 08:18:09 +00:00
|
|
|
proto_tree_add_text( tree, NullTVB, offset, 1, "Server ack: %u",
|
2000-04-20 02:18:53 +00:00
|
|
|
GBYTE( pd, offset));
|
|
|
|
offset += 4;
|
|
|
|
|
|
|
|
CHECK_PACKET_LENGTH( 1);
|
2000-05-11 08:18:09 +00:00
|
|
|
proto_tree_add_text( tree, NullTVB, offset, 1, "Sequence Number: %u",
|
2000-04-20 02:18:53 +00:00
|
|
|
GBYTE( pd, offset));
|
|
|
|
offset += 8;
|
|
|
|
|
|
|
|
CHECK_PACKET_LENGTH( 4);
|
|
|
|
strncpy( temp, &pd[ offset], 4);
|
|
|
|
temp[ 4] = 0;
|
2000-05-11 08:18:09 +00:00
|
|
|
proto_tree_add_text( tree, NullTVB, offset, 4, "RWSP signature: %s", temp);
|
2000-04-20 02:18:53 +00:00
|
|
|
offset += 12;
|
|
|
|
}
|
|
|
|
else /* no tree */
|
|
|
|
offset += 36;
|
|
|
|
|
|
|
|
CHECK_PACKET_LENGTH( 1);
|
|
|
|
cmd = pntohs( &pd[offset]);
|
|
|
|
|
|
|
|
if ( tree)
|
2000-05-11 08:18:09 +00:00
|
|
|
proto_tree_add_uint_format( tree, hf_msproxy_cmd, NullTVB, offset, 2,
|
2000-04-20 02:18:53 +00:00
|
|
|
cmd, "Command: 0x%02x (%s)", cmd,
|
|
|
|
get_msproxy_cmd_name( cmd, FROM_CLIENT));
|
|
|
|
|
|
|
|
offset += 2;
|
|
|
|
|
|
|
|
switch (cmd){
|
|
|
|
case MSPROXY_AUTH:
|
|
|
|
dissect_auth( pd, offset, fd, tree);
|
|
|
|
break;
|
|
|
|
|
|
|
|
case MSPROXY_BIND:
|
|
|
|
dissect_bind( pd, offset, fd, tree, conv_info);
|
|
|
|
|
|
|
|
break;
|
|
|
|
case MSPROXY_UDP_BIND_REQ:
|
|
|
|
dissect_udp_bind( pd, offset, fd, tree, conv_info);
|
|
|
|
break;
|
|
|
|
|
|
|
|
case MSPROXY_AUTH_2: /*$$ this is probably wrong place for this */
|
|
|
|
case MSPROXY_TCP_BIND:
|
|
|
|
dissect_tcp_bind( pd, offset, fd, tree, conv_info);
|
|
|
|
break;
|
|
|
|
|
|
|
|
case MSPROXY_RESOLVE:
|
|
|
|
dissect_request_resolve( pd, offset, fd, tree);
|
|
|
|
break;
|
|
|
|
|
|
|
|
case MSPROXY_CONNECT:
|
|
|
|
case MSPROXY_LISTEN:
|
|
|
|
dissect_request_connect( pd, offset, fd, tree,
|
|
|
|
conv_info);
|
|
|
|
break;
|
|
|
|
|
|
|
|
case MSPROXY_BINDINFO_ACK:
|
|
|
|
dissect_bind_info_ack( pd, offset, fd, tree, conv_info);
|
|
|
|
break;
|
|
|
|
|
|
|
|
case MSPROXY_HELLO:
|
|
|
|
case MSPROXY_HELLO_2:
|
|
|
|
dissect_msproxy_request_1( pd, offset, fd, tree);
|
|
|
|
break;
|
|
|
|
|
|
|
|
case MSPROXY_UDPASSOCIATE:
|
|
|
|
dissect_udp_assoc( pd, offset, fd, tree, conv_info);
|
|
|
|
break;
|
|
|
|
default:
|
|
|
|
if ( tree)
|
2000-05-11 08:18:09 +00:00
|
|
|
proto_tree_add_text( tree, NullTVB, offset, 0,
|
2000-04-20 02:18:53 +00:00
|
|
|
"Unhandled request command (report this, please)");
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
static void dissect_hello_ack(const u_char *pd, int offset, frame_data *fd,
|
|
|
|
proto_tree *tree, hash_entry_t *conv_info) {
|
|
|
|
|
|
|
|
/* decode the hello acknowledge packet */
|
|
|
|
|
|
|
|
offset += 60;
|
|
|
|
|
|
|
|
if ( tree) {
|
|
|
|
CHECK_PACKET_LENGTH( 2);
|
2000-05-31 05:09:07 +00:00
|
|
|
proto_tree_add_uint( tree, hf_msproxy_serverport, NullTVB, offset, 2,
|
2000-04-20 02:18:53 +00:00
|
|
|
pntohs( &pd[ offset]));
|
|
|
|
offset += 2;
|
|
|
|
|
|
|
|
CHECK_PACKET_LENGTH( 4);
|
2000-05-31 05:09:07 +00:00
|
|
|
proto_tree_add_ipv4( tree, hf_msproxy_serveraddr, NullTVB, offset, 4,
|
2000-04-20 02:18:53 +00:00
|
|
|
GWORD( pd, offset));
|
|
|
|
offset += 4;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
static void dissect_user_info_ack(const u_char *pd, int offset,
|
|
|
|
frame_data *fd, proto_tree *tree) {
|
|
|
|
|
|
|
|
/* decode the response _2 structure */
|
|
|
|
|
|
|
|
offset += 18;
|
|
|
|
|
|
|
|
offset += 2;
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
static void dissect_udpassociate_ack( const u_char *pd, int offset,
|
|
|
|
frame_data *fd, proto_tree *tree) {
|
|
|
|
|
|
|
|
|
|
|
|
offset += 6;
|
|
|
|
|
|
|
|
if ( tree) {
|
|
|
|
CHECK_PACKET_LENGTH( 4);
|
2000-05-31 05:09:07 +00:00
|
|
|
proto_tree_add_uint( tree, hf_msproxy_bind_id, NullTVB, offset, 4, pntohl( &pd[ offset]));
|
2000-04-20 02:18:53 +00:00
|
|
|
offset += 14;
|
|
|
|
|
|
|
|
CHECK_PACKET_LENGTH( 2);
|
2000-05-31 05:09:07 +00:00
|
|
|
proto_tree_add_uint( tree, hf_msproxy_server_ext_port, NullTVB, offset, 2, pntohs( &pd[ offset]));
|
2000-04-20 02:18:53 +00:00
|
|
|
offset += 2;
|
|
|
|
|
|
|
|
CHECK_PACKET_LENGTH( 4);
|
2000-05-31 05:09:07 +00:00
|
|
|
proto_tree_add_ipv4( tree, hf_msproxy_server_ext_addr, NullTVB, offset, 4, GWORD( pd, offset));
|
2000-04-20 02:18:53 +00:00
|
|
|
|
|
|
|
offset += 96;
|
|
|
|
display_application_name( pd, offset, fd, tree);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
static void dissect_auth_1_ack(const u_char *pd, int offset, frame_data *fd, proto_tree *tree) {
|
|
|
|
|
|
|
|
|
2001-03-22 06:55:58 +00:00
|
|
|
char temp[ 255+1];
|
2000-04-20 02:18:53 +00:00
|
|
|
|
|
|
|
offset += 134;
|
|
|
|
if ( tree) {
|
|
|
|
|
|
|
|
CHECK_PACKET_LENGTH( 7);
|
|
|
|
strncpy( temp, &pd[ offset], 7);
|
|
|
|
temp[ 7] = 0;
|
2000-05-11 08:18:09 +00:00
|
|
|
proto_tree_add_text( tree, NullTVB, offset, 7, "NTLMSSP signature: %s", temp);
|
2000-04-20 02:18:53 +00:00
|
|
|
offset += 48;
|
|
|
|
|
|
|
|
strncpy( temp, &pd[ offset], MIN( 255, END_OF_FRAME));
|
|
|
|
temp[ MIN( 255, END_OF_FRAME)] = 0;
|
2000-05-11 08:18:09 +00:00
|
|
|
proto_tree_add_text( tree, NullTVB, offset, 255, "NT domain: %s", temp);
|
2000-04-20 02:18:53 +00:00
|
|
|
offset += 7;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
static void dissect_msproxy_response_4( const u_char *pd, int offset,
|
|
|
|
frame_data *fd, proto_tree *tree) {
|
|
|
|
|
|
|
|
/* decode the response _4 structure */
|
|
|
|
|
|
|
|
offset += 134;
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
static void dissect_connect_ack( const u_char *pd, int offset, frame_data *fd,
|
|
|
|
proto_tree *tree, hash_entry_t *conv_info) {
|
|
|
|
|
|
|
|
/* decode the connect ack packet */
|
|
|
|
offset += 20;
|
|
|
|
|
|
|
|
CHECK_PACKET_LENGTH( 2);
|
|
|
|
|
|
|
|
if ( tree)
|
2000-05-31 05:09:07 +00:00
|
|
|
proto_tree_add_uint( tree, hf_msproxy_server_int_port, NullTVB, offset, 2, pntohs( &pd[ offset]));
|
2000-04-20 02:18:53 +00:00
|
|
|
|
|
|
|
|
|
|
|
conv_info->proto = PT_TCP;
|
|
|
|
conv_info->server_int_port = pntohs( &pd[ offset]);
|
|
|
|
offset += 2;
|
|
|
|
|
|
|
|
if ( tree){
|
|
|
|
CHECK_PACKET_LENGTH( 2);
|
2000-05-31 05:09:07 +00:00
|
|
|
proto_tree_add_ipv4( tree, hf_msproxy_server_int_addr, NullTVB, offset, 2, GWORD( pd, offset));
|
2000-04-20 02:18:53 +00:00
|
|
|
offset += 14;
|
|
|
|
|
|
|
|
CHECK_PACKET_LENGTH( 2);
|
2000-05-31 05:09:07 +00:00
|
|
|
proto_tree_add_uint( tree, hf_msproxy_server_ext_port, NullTVB, offset, 2, pntohs( &pd[ offset]));
|
2000-04-20 02:18:53 +00:00
|
|
|
offset += 2;
|
|
|
|
|
|
|
|
CHECK_PACKET_LENGTH( 4);
|
2000-05-31 05:09:07 +00:00
|
|
|
proto_tree_add_ipv4( tree, hf_msproxy_server_ext_addr, NullTVB, offset, 4, GWORD( pd, offset));
|
2000-04-20 02:18:53 +00:00
|
|
|
offset += 80;
|
|
|
|
|
|
|
|
display_application_name( pd, offset, fd, tree);
|
|
|
|
}
|
|
|
|
|
|
|
|
add_msproxy_conversation( conv_info);
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
static void dissect_tcp_bind_ack( const u_char *pd, int offset, frame_data *fd,
|
|
|
|
proto_tree *tree) {
|
|
|
|
|
|
|
|
/* decode the tcp bind */
|
|
|
|
|
|
|
|
if ( tree) {
|
|
|
|
offset += 6;
|
|
|
|
|
|
|
|
CHECK_PACKET_LENGTH( 4);
|
2000-05-31 05:09:07 +00:00
|
|
|
proto_tree_add_uint( tree, hf_msproxy_bind_id, NullTVB, offset, 4, pntohl( &pd[ offset]));
|
2000-04-20 02:18:53 +00:00
|
|
|
offset += 16;
|
|
|
|
|
|
|
|
CHECK_PACKET_LENGTH( 2);
|
2000-05-31 05:09:07 +00:00
|
|
|
proto_tree_add_uint( tree, hf_msproxy_server_int_port, NullTVB, offset,
|
2000-04-20 02:18:53 +00:00
|
|
|
2, pntohs( &pd[ offset]));
|
|
|
|
offset += 6;
|
|
|
|
|
|
|
|
CHECK_PACKET_LENGTH( 2);
|
2000-05-31 05:09:07 +00:00
|
|
|
proto_tree_add_uint( tree, hf_msproxy_server_ext_port, NullTVB, offset,
|
2000-04-20 02:18:53 +00:00
|
|
|
2, pntohs( &pd[ offset]));
|
|
|
|
offset += 2;
|
|
|
|
|
|
|
|
CHECK_PACKET_LENGTH( 4);
|
2000-05-31 05:09:07 +00:00
|
|
|
proto_tree_add_ipv4( tree, hf_msproxy_server_ext_addr, NullTVB, offset,
|
2000-04-20 02:18:53 +00:00
|
|
|
4, GWORD( pd, offset));
|
|
|
|
|
|
|
|
offset += 88;
|
|
|
|
|
|
|
|
display_application_name( pd, offset, fd, tree);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
static void dissect_bind_info( const u_char *pd, int offset, frame_data *fd,
|
|
|
|
proto_tree *tree, hash_entry_t *conv_info) {
|
|
|
|
|
|
|
|
/* decode the Bind info response from server */
|
|
|
|
|
|
|
|
offset += 6;
|
|
|
|
|
|
|
|
CHECK_PACKET_LENGTH( 4);
|
|
|
|
if ( tree)
|
2000-05-31 05:09:07 +00:00
|
|
|
proto_tree_add_uint( tree, hf_msproxy_bind_id, NullTVB, offset, 4, pntohl( &pd[ offset]));
|
2000-04-20 02:18:53 +00:00
|
|
|
offset += 14;
|
|
|
|
|
|
|
|
|
|
|
|
CHECK_PACKET_LENGTH( 2);
|
|
|
|
if ( tree)
|
2000-05-31 05:09:07 +00:00
|
|
|
proto_tree_add_uint( tree, hf_msproxy_dstport, NullTVB, offset, 2,
|
2000-04-20 02:18:53 +00:00
|
|
|
pntohs( &pd[ offset]));
|
|
|
|
conv_info->dst_port = pntohs( &pd[ offset]);
|
|
|
|
offset += 2;
|
|
|
|
|
|
|
|
CHECK_PACKET_LENGTH( 4);
|
|
|
|
if ( tree)
|
2000-05-31 05:09:07 +00:00
|
|
|
proto_tree_add_ipv4( tree, hf_msproxy_dstaddr, NullTVB, offset, 4,
|
2000-04-20 02:18:53 +00:00
|
|
|
GWORD( pd, offset));
|
|
|
|
|
|
|
|
memcpy( &conv_info->dst_addr, &pd[ offset], sizeof( guint32));
|
|
|
|
|
|
|
|
offset += 12;
|
|
|
|
|
|
|
|
CHECK_PACKET_LENGTH( 2);
|
|
|
|
if ( tree)
|
2000-05-31 05:09:07 +00:00
|
|
|
proto_tree_add_uint( tree, hf_msproxy_server_int_port, NullTVB, offset,
|
2000-04-20 02:18:53 +00:00
|
|
|
2, pntohs( &pd[ offset]));
|
|
|
|
conv_info->server_int_port = pntohs( &pd[ offset]);
|
|
|
|
offset += 4;
|
|
|
|
|
|
|
|
if ( tree) {
|
|
|
|
|
|
|
|
CHECK_PACKET_LENGTH( 2);
|
2000-05-31 05:09:07 +00:00
|
|
|
proto_tree_add_uint( tree, hf_msproxy_server_ext_port, NullTVB, offset,
|
2000-04-20 02:18:53 +00:00
|
|
|
2, pntohs( &pd[ offset]));
|
|
|
|
offset += 2;
|
|
|
|
|
|
|
|
CHECK_PACKET_LENGTH( 4);
|
2000-05-31 05:09:07 +00:00
|
|
|
proto_tree_add_ipv4( tree, hf_msproxy_server_ext_addr, NullTVB, offset,
|
2000-04-20 02:18:53 +00:00
|
|
|
4, GWORD( pd, offset));
|
|
|
|
|
|
|
|
offset += 78;
|
|
|
|
display_application_name( pd, offset, fd, tree);
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
add_msproxy_conversation( conv_info);
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
static void dissect_resolve(const u_char *pd, int offset, frame_data *fd,
|
|
|
|
proto_tree *tree) {
|
|
|
|
|
|
|
|
/* dissect the response resolve structure */
|
|
|
|
/* display a string with a length, characters encoding */
|
|
|
|
/* they are displayed under a tree with the name in Label variable */
|
|
|
|
/* return the length of the string and the length byte */
|
|
|
|
|
|
|
|
if ( tree) {
|
2001-03-22 06:55:58 +00:00
|
|
|
int addr_offset;
|
2000-04-20 02:18:53 +00:00
|
|
|
|
2001-03-22 06:55:58 +00:00
|
|
|
CHECK_PACKET_LENGTH(1);
|
|
|
|
addr_offset = GBYTE( pd, offset);
|
2000-04-20 02:18:53 +00:00
|
|
|
|
2000-05-11 08:18:09 +00:00
|
|
|
proto_tree_add_text( tree, NullTVB, offset, 1, "Address offset: %d",
|
2000-04-20 02:18:53 +00:00
|
|
|
addr_offset);
|
|
|
|
|
|
|
|
++offset;
|
|
|
|
|
|
|
|
offset += 13;
|
|
|
|
|
|
|
|
offset += addr_offset;
|
|
|
|
|
|
|
|
CHECK_PACKET_LENGTH( 4);
|
2000-05-31 05:09:07 +00:00
|
|
|
proto_tree_add_ipv4( tree, hf_msproxy_resolvaddr, NullTVB, offset, 4,
|
2000-04-20 02:18:53 +00:00
|
|
|
GWORD( pd, offset));
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
static void dissect_msproxy_response(const u_char *pd, int offset, frame_data *fd, proto_tree *tree, hash_entry_t *conv_info) {
|
|
|
|
|
2001-03-22 06:55:58 +00:00
|
|
|
char temp[ 255+1];
|
2000-04-20 02:18:53 +00:00
|
|
|
int cmd;
|
|
|
|
|
|
|
|
|
|
|
|
if ( tree) {
|
|
|
|
CHECK_PACKET_LENGTH( 4);
|
2000-05-11 08:18:09 +00:00
|
|
|
proto_tree_add_text( tree, NullTVB, offset, 4, "Client id: 0x%0x",
|
2000-04-20 02:18:53 +00:00
|
|
|
GWORD( pd, offset));
|
|
|
|
offset += 4;
|
|
|
|
|
|
|
|
CHECK_PACKET_LENGTH( 4);
|
2000-05-11 08:18:09 +00:00
|
|
|
proto_tree_add_text( tree, NullTVB, offset, 4, "Version: 0x%04x",
|
2000-04-20 02:18:53 +00:00
|
|
|
GWORD( pd, offset));
|
|
|
|
offset += 4;
|
|
|
|
|
|
|
|
CHECK_PACKET_LENGTH( 4);
|
2000-05-11 08:18:09 +00:00
|
|
|
proto_tree_add_text( tree, NullTVB, offset, 4, "Server id: 0x%04x",
|
2000-04-20 02:18:53 +00:00
|
|
|
GWORD( pd, offset));
|
|
|
|
offset += 4;
|
|
|
|
|
|
|
|
CHECK_PACKET_LENGTH( 1);
|
2000-05-11 08:18:09 +00:00
|
|
|
proto_tree_add_text( tree, NullTVB, offset, 1, "Client ack: 0x%02x",
|
2000-04-20 02:18:53 +00:00
|
|
|
GBYTE( pd, offset));
|
|
|
|
|
|
|
|
offset += 4;
|
|
|
|
|
|
|
|
CHECK_PACKET_LENGTH( 1);
|
2000-05-11 08:18:09 +00:00
|
|
|
proto_tree_add_text( tree, NullTVB, offset, 1, "Sequence Number: 0x%02x",
|
2000-04-20 02:18:53 +00:00
|
|
|
GBYTE( pd, offset));
|
|
|
|
|
|
|
|
offset += 8;
|
|
|
|
|
|
|
|
CHECK_PACKET_LENGTH( 4);
|
|
|
|
strncpy( temp, &pd[ offset], 4);
|
|
|
|
temp[ 4] = 0;
|
2000-05-11 08:18:09 +00:00
|
|
|
proto_tree_add_text( tree, NullTVB, offset, 4, "RWSP signature: %s", temp);
|
2000-04-20 02:18:53 +00:00
|
|
|
|
|
|
|
offset += 12;
|
|
|
|
}
|
|
|
|
else
|
|
|
|
offset += 36;
|
|
|
|
|
|
|
|
CHECK_PACKET_LENGTH( 2);
|
|
|
|
cmd = pntohs( &pd[offset]);
|
|
|
|
|
|
|
|
if ( tree)
|
2000-05-11 08:18:09 +00:00
|
|
|
proto_tree_add_uint_format( tree, hf_msproxy_cmd, NullTVB, offset, 2,
|
2000-04-20 02:18:53 +00:00
|
|
|
cmd, "Command: 0x%02x (%s)", cmd,
|
|
|
|
get_msproxy_cmd_name( cmd, FROM_SERVER));
|
|
|
|
offset += 2;
|
|
|
|
|
|
|
|
switch (cmd) {
|
|
|
|
case MSPROXY_HELLO_ACK:
|
|
|
|
dissect_hello_ack( pd, offset, fd, tree, conv_info);
|
|
|
|
break;
|
|
|
|
|
|
|
|
case MSPROXY_USERINFO_ACK:
|
|
|
|
dissect_user_info_ack( pd, offset, fd, tree);
|
|
|
|
break;
|
|
|
|
|
|
|
|
case MSPROXY_AUTH_1_ACK:
|
|
|
|
dissect_auth_1_ack( pd, offset, fd, tree);
|
|
|
|
break;
|
|
|
|
|
|
|
|
/* this also handle the MSPROXY_BIND_ACK ??? check this */
|
|
|
|
|
|
|
|
case MSPROXY_UDPASSOCIATE_ACK:
|
|
|
|
dissect_udpassociate_ack( pd, offset, fd, tree);
|
|
|
|
break;
|
|
|
|
|
|
|
|
case MSPROXY_AUTH_2_ACK:
|
|
|
|
case MSPROXY_AUTH_2_ACK2:
|
|
|
|
dissect_msproxy_response_4( pd, offset, fd, tree);
|
|
|
|
break;
|
|
|
|
|
|
|
|
case MSPROXY_TCP_BIND_ACK:
|
|
|
|
dissect_tcp_bind_ack( pd, offset, fd, tree);
|
|
|
|
break;
|
|
|
|
|
|
|
|
case MSPROXY_CONNECT_ACK:
|
|
|
|
dissect_connect_ack( pd, offset, fd, tree, conv_info);
|
|
|
|
break;
|
|
|
|
|
|
|
|
case MSPROXY_BINDINFO:
|
|
|
|
dissect_bind_info( pd, offset, fd, tree, conv_info);
|
|
|
|
break;
|
|
|
|
|
|
|
|
case MSPROXY_RESOLVE_ACK:
|
|
|
|
dissect_resolve( pd, offset, fd, tree);
|
|
|
|
break;
|
|
|
|
|
|
|
|
case MSPROXY_CONNECT_AUTHFAILED:
|
|
|
|
case MSPROXY_BIND_AUTHFAILED:
|
2000-05-11 08:18:09 +00:00
|
|
|
proto_tree_add_text( tree, NullTVB, offset, 0, "No know information (help wanted)");
|
2000-04-20 02:18:53 +00:00
|
|
|
break;
|
|
|
|
|
|
|
|
default:
|
|
|
|
|
|
|
|
if (tree &&
|
|
|
|
(((cmd >> 8) == MSPROXY_CONNREFUSED) ||
|
|
|
|
((cmd >> 12) == MSPROXY_CONNREFUSED)))
|
2000-05-11 08:18:09 +00:00
|
|
|
proto_tree_add_text( tree, NullTVB, offset, 0,
|
2000-04-20 02:18:53 +00:00
|
|
|
"No know information (help wanted)");
|
|
|
|
|
|
|
|
else if ( tree)
|
2000-05-11 08:18:09 +00:00
|
|
|
proto_tree_add_text( tree, NullTVB, offset, 0,
|
2000-04-20 02:18:53 +00:00
|
|
|
"Unhandled response command (report this, please)");
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
static void dissect_msproxy(const u_char *pd, int offset, frame_data *fd, proto_tree *tree) {
|
|
|
|
|
|
|
|
|
|
|
|
proto_tree *msproxy_tree = NULL;
|
|
|
|
proto_item *ti;
|
|
|
|
unsigned int cmd;
|
|
|
|
|
|
|
|
|
|
|
|
hash_entry_t *hash_info;
|
|
|
|
conversation_t *conversation;
|
|
|
|
|
Add the "Edit:Protocols..." feature which currently only implements
the following:
It is now possible to enable/disable a particular protocol decoding
(i.e. the protocol dissector is void or not). When a protocol
is disabled, it is displayed as Data and of course, all linked
sub-protocols are disabled as well.
Disabling a protocol could be interesting:
- in case of buggy dissectors
- in case of wrong heuristics
- for performance reasons
- to decode the data as another protocol (TODO)
Currently (if I am not wrong), all dissectors but NFS can be disabled
(and dissectors that do not register protocols :-)
I do not like the way the RPC sub-dissectors are disabled (in the
sub-dissectors) since this could be done in the RPC dissector itself,
knowing the sub-protocol hfinfo entry (this is why, I've not modified
the NFS one yet).
Two functions are added in proto.c :
gboolean proto_is_protocol_enabled(int n);
void proto_set_decoding(int n, gboolean enabled);
and two MACROs which can be used in dissectors:
OLD_CHECK_DISPLAY_AS_DATA(index, pd, offset, fd, tree)
CHECK_DISPLAY_AS_DATA(index, tvb, pinfo, tree)
See also the XXX in proto_dlg.c and proto.c around the new functions.
svn path=/trunk/; revision=2267
2000-08-13 14:09:15 +00:00
|
|
|
OLD_CHECK_DISPLAY_AS_DATA(proto_msproxy, pd, offset, fd, tree);
|
2000-04-20 02:18:53 +00:00
|
|
|
|
|
|
|
conversation = find_conversation( &pi.src, &pi.dst, pi.ptype,
|
2000-10-21 05:52:28 +00:00
|
|
|
pi.srcport, pi.destport, 0);
|
2000-04-20 02:18:53 +00:00
|
|
|
|
|
|
|
if ( conversation) /* conversation found */
|
|
|
|
hash_info = conversation->data;
|
|
|
|
|
|
|
|
/* new conversation create local data structure */
|
|
|
|
else {
|
|
|
|
hash_info = g_mem_chunk_alloc(vals);
|
|
|
|
|
|
|
|
conversation_new( &pi.src, &pi.dst, pi.ptype,
|
2000-10-21 05:52:28 +00:00
|
|
|
pi.srcport, pi.destport, hash_info, 0);
|
2000-04-20 02:18:53 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
if (check_col(fd, COL_PROTOCOL))
|
2000-11-19 08:54:37 +00:00
|
|
|
col_set_str(fd, COL_PROTOCOL, "MSproxy");
|
2000-04-20 02:18:53 +00:00
|
|
|
|
|
|
|
|
|
|
|
/* display packet info */
|
|
|
|
if (check_col(fd, COL_INFO)){
|
|
|
|
|
|
|
|
cmd = pntohs( &pd[offset + 36]);
|
|
|
|
|
|
|
|
if ( pi.srcport == UDP_PORT_MSPROXY)
|
|
|
|
col_add_fstr( fd, COL_INFO, "Server message: %s",
|
|
|
|
get_msproxy_cmd_name( cmd, FROM_SERVER));
|
|
|
|
else
|
|
|
|
col_add_fstr(fd, COL_INFO, "Client message: %s",
|
|
|
|
get_msproxy_cmd_name( cmd, FROM_CLIENT));
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
if (tree) { /* if proto tree, decode data */
|
2000-05-11 08:18:09 +00:00
|
|
|
ti = proto_tree_add_item( tree, proto_msproxy, NullTVB, offset,
|
2000-05-31 05:09:07 +00:00
|
|
|
END_OF_FRAME, FALSE );
|
2000-04-20 02:18:53 +00:00
|
|
|
|
|
|
|
msproxy_tree = proto_item_add_subtree(ti, ett_msproxy);
|
|
|
|
}
|
|
|
|
|
|
|
|
if ( pi.srcport == UDP_PORT_MSPROXY)
|
|
|
|
dissect_msproxy_response( pd, offset, fd, msproxy_tree, hash_info);
|
|
|
|
else
|
|
|
|
dissect_msproxy_request( pd, offset, fd, msproxy_tree, hash_info);
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
static void msproxy_reinit( void){
|
|
|
|
|
|
|
|
/* Do the cleanup work when a new pass through the packet list is */
|
|
|
|
/* performed. Reset the highest row seen counter and re-initialize the */
|
|
|
|
/* conversation memory chunks. */
|
|
|
|
|
|
|
|
last_row = 0;
|
|
|
|
|
|
|
|
if (vals)
|
|
|
|
g_mem_chunk_destroy(vals);
|
|
|
|
|
|
|
|
vals = g_mem_chunk_new("msproxy_vals", hash_val_length,
|
|
|
|
hash_init_count * hash_val_length,
|
|
|
|
G_ALLOC_AND_FREE);
|
|
|
|
|
|
|
|
if (redirect_vals)
|
|
|
|
g_mem_chunk_destroy(redirect_vals);
|
|
|
|
|
|
|
|
redirect_vals = g_mem_chunk_new("msproxy_redirect_vals", redirect_val_length,
|
|
|
|
redirect_init_count * redirect_val_length,
|
|
|
|
G_ALLOC_AND_FREE);
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
void
|
|
|
|
proto_register_msproxy( void){
|
|
|
|
|
|
|
|
/* Prep the msproxy protocol, for now, just register it */
|
|
|
|
|
|
|
|
static gint *ett[] = {
|
|
|
|
&ett_msproxy,
|
|
|
|
&ett_msproxy_name
|
|
|
|
};
|
|
|
|
static hf_register_info hf[] = {
|
|
|
|
|
|
|
|
{ &hf_msproxy_cmd,
|
|
|
|
{ "Command", "msproxy.command", FT_UINT16, BASE_DEC,
|
|
|
|
NULL, 0x0, ""
|
|
|
|
}
|
|
|
|
},
|
|
|
|
|
|
|
|
{ &hf_msproxy_dstaddr,
|
|
|
|
{ "Destination Address", "msproxy.dstaddr", FT_IPv4, BASE_NONE, NULL,
|
|
|
|
0x0, ""
|
|
|
|
}
|
|
|
|
},
|
|
|
|
|
|
|
|
{ &hf_msproxy_srcport,
|
|
|
|
{ "Source Port", "msproxy.srcport", FT_UINT16,
|
|
|
|
BASE_DEC, NULL, 0x0, ""
|
|
|
|
}
|
|
|
|
},
|
|
|
|
{ &hf_msproxy_dstport,
|
|
|
|
{ "Destination Port", "msproxy.dstport", FT_UINT16,
|
|
|
|
BASE_DEC, NULL, 0x0, ""
|
|
|
|
}
|
|
|
|
},
|
|
|
|
{ &hf_msproxy_clntport,
|
|
|
|
{ "Client Port", "msproxy.clntport", FT_UINT16,
|
|
|
|
BASE_DEC, NULL, 0x0, ""
|
|
|
|
}
|
|
|
|
},
|
|
|
|
{ &hf_msproxy_server_ext_addr,
|
|
|
|
{ "Server External Address", "msproxy.server_ext_addr", FT_IPv4, BASE_NONE, NULL,
|
|
|
|
0x0, ""
|
|
|
|
}
|
|
|
|
},
|
|
|
|
|
|
|
|
{ &hf_msproxy_server_ext_port,
|
|
|
|
{ "Server External Port", "msproxy.server_ext_port", FT_UINT16,
|
|
|
|
BASE_DEC, NULL, 0x0, ""
|
|
|
|
}
|
|
|
|
},
|
|
|
|
|
|
|
|
{ &hf_msproxy_server_int_addr,
|
|
|
|
{ "Server Internal Address", "msproxy.server_int_addr", FT_IPv4, BASE_NONE, NULL,
|
|
|
|
0x0, ""
|
|
|
|
}
|
|
|
|
},
|
|
|
|
|
|
|
|
{ &hf_msproxy_server_int_port,
|
|
|
|
{ "Server Internal Port", "msproxy.server_int_port", FT_UINT16,
|
|
|
|
BASE_DEC, NULL, 0x0, ""
|
|
|
|
}
|
|
|
|
},
|
|
|
|
{ &hf_msproxy_serverport,
|
|
|
|
{ "Server Port", "msproxy.serverport", FT_UINT16,
|
|
|
|
BASE_DEC, NULL, 0x0, ""
|
|
|
|
}
|
|
|
|
},
|
|
|
|
{ &hf_msproxy_bindport,
|
|
|
|
{ "Bind Port", "msproxy.bindport", FT_UINT16,
|
|
|
|
BASE_DEC, NULL, 0x0, ""
|
|
|
|
}
|
|
|
|
},
|
|
|
|
{ &hf_msproxy_boundport,
|
|
|
|
{ "Bound Port", "msproxy.boundport", FT_UINT16,
|
|
|
|
BASE_DEC, NULL, 0x0, ""
|
|
|
|
}
|
|
|
|
},
|
|
|
|
{ &hf_msproxy_serveraddr,
|
|
|
|
{ "Server Address", "msproxy.serveraddr", FT_IPv4, BASE_NONE, NULL,
|
|
|
|
0x0, ""
|
|
|
|
}
|
|
|
|
},
|
|
|
|
{ &hf_msproxy_bindaddr,
|
|
|
|
{ "Destination", "msproxy.bindaddr", FT_IPv4, BASE_NONE, NULL,
|
|
|
|
0x0, ""
|
|
|
|
}
|
|
|
|
},
|
|
|
|
{ &hf_msproxy_bind_id,
|
|
|
|
{ "Bound Port Id", "msproxy.bindid", FT_UINT32,
|
|
|
|
BASE_HEX, NULL, 0x0, ""
|
|
|
|
}
|
|
|
|
},
|
|
|
|
{ &hf_msproxy_resolvaddr,
|
|
|
|
{ "Address", "msproxy.resolvaddr", FT_IPv4, BASE_NONE, NULL,
|
|
|
|
0x0, ""
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
};
|
|
|
|
|
2001-01-03 06:56:03 +00:00
|
|
|
proto_msproxy = proto_register_protocol( "MS Proxy Protocol",
|
|
|
|
"MS Proxy", "msproxy");
|
2000-04-20 02:18:53 +00:00
|
|
|
|
|
|
|
proto_register_field_array(proto_msproxy, hf, array_length(hf));
|
|
|
|
proto_register_subtree_array(ett, array_length(ett));
|
|
|
|
|
|
|
|
register_init_routine( &msproxy_reinit); /* register re-init routine */
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
void
|
|
|
|
proto_reg_handoff_msproxy(void) {
|
|
|
|
|
|
|
|
/* dissector install routine */
|
|
|
|
|
2001-01-09 06:32:10 +00:00
|
|
|
old_dissector_add("udp.port", UDP_PORT_MSPROXY, dissect_msproxy,
|
|
|
|
proto_msproxy);
|
2000-04-20 02:18:53 +00:00
|
|
|
}
|