2
ettercap -- dissector MSN -- TCP 1863
4
Copyright (C) 2001 ALoR <alor@users.sourceforge.net>, NaGA <crwm@freemail.it>
6
This program is free software; you can redistribute it and/or modify
7
it under the terms of the GNU General Public License as published by
8
the Free Software Foundation; either version 2 of the License, or
9
(at your option) any later version.
11
This program is distributed in the hope that it will be useful,
12
but WITHOUT ANY WARRANTY; without even the implied warranty of
13
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14
GNU General Public License for more details.
16
You should have received a copy of the GNU General Public License
17
along with this program; if not, write to the Free Software
18
Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
20
$Id: ec_dissector_msn.c,v 1.3 2002/04/16 18:35:11 alor Exp $
23
#include "include/ec_main.h"
25
#include "include/ec_dissector.h"
26
#include "include/ec_decodedata.h"
27
#include "include/ec_inet_structures.h"
31
FUNC_DISSECTOR(Dissector_msn);
33
// --------------------
35
FUNC_DISSECTOR(Dissector_msn)
40
u_char collector[MAX_DATA];
43
tcp = (TCP_header *) data;
45
if (data_to_ettercap->datalen == 0) return 0; // no data...
47
payload = (char *)((int)tcp + tcp->doff * 4);
49
memset(collector, 0, MAX_DATA);
50
memcpy(collector, payload, data_to_ettercap->datalen);
52
/* the client send its username (email) */
54
if ( (Dissector_StateMachine_GetStatus(data_to_ettercap, NULL) == 0) && ntohs(tcp->dest) == SERV_PORT) {
57
p = strstr(collector, "MD5 I");
60
DEBUG_MSG("MSN username");
62
p = p + strlen("MD5 I ");
64
snprintf(data_to_ettercap->user, sizeof(data_to_ettercap->user), "%s\n", p);
65
data_to_ettercap->user[sizeof(data_to_ettercap->user)-2] = '\n';
66
data_to_ettercap->user[sizeof(data_to_ettercap->user)-1] = '\0';
68
sprintf(data_to_ettercap->type, "MSN messenger");
70
Dissector_StateMachine_SetStatus(data_to_ettercap, 1, NULL);
74
/* server messages... collect the MD5 challenge */
76
if ( (Dissector_StateMachine_GetStatus(data_to_ettercap, NULL) == 1) && ntohs(tcp->source) == SERV_PORT) {
81
p = strstr(collector, "MD5 S");
84
DEBUG_MSG("MSN challenge");
86
p = p + strlen("MD5 S ");
88
for(i=0; i<strlen(p); i++)
92
snprintf(data_to_ettercap->info, sizeof(data_to_ettercap->info), "Server MD5 challenge : %s\n", p);
93
data_to_ettercap->info[sizeof(data_to_ettercap->info)-2] = '\n';
94
data_to_ettercap->info[sizeof(data_to_ettercap->info)-1] = '\0';
96
Dissector_StateMachine_SetStatus(data_to_ettercap, 2, NULL);
100
/* the client reply with the MD5 password */
102
if ( (Dissector_StateMachine_GetStatus(data_to_ettercap, NULL) == 2) && ntohs(tcp->dest) == SERV_PORT) {
106
p = strstr(collector, "MD5 S");
109
DEBUG_MSG("MSN password");
111
p = p + strlen("MD5 S ");
113
snprintf(data_to_ettercap->pass, sizeof(data_to_ettercap->pass), "%s\n", p);
114
data_to_ettercap->pass[sizeof(data_to_ettercap->pass)-2] = '\n';
115
data_to_ettercap->pass[sizeof(data_to_ettercap->pass)-1] = '\0';
117
Dissector_StateMachine_SetStatus(data_to_ettercap, 0, NULL);
126
// vim:ts=3:expandtab