~ubuntu-branches/ubuntu/precise/ettercap/precise

« back to all changes in this revision

Viewing changes to plugins/H00_lurker/H00_lurker.c

  • Committer: Bazaar Package Importer
  • Author(s): Murat Demirten
  • Date: 2003-06-21 19:57:18 UTC
  • Revision ID: james.westby@ubuntu.com-20030621195718-qqbbfk18e1djchd9
Tags: upstream-0.6.b
ImportĀ upstreamĀ versionĀ 0.6.b

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
1
/*
 
2
    lurker -- ettercap plugin -- try to search for other ettercap
 
3
 
 
4
    Copyright (C) 2001  ALoR <alor@users.sourceforge.net>, NaGA <crwm@freemail.it>
 
5
    
 
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.
 
10
 
 
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.
 
15
 
 
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.
 
19
 
 
20
    $Id: H00_lurker.c,v 1.6 2002/10/01 21:40:52 alor Exp $
 
21
*/
 
22
 
 
23
#include <stdlib.h>
 
24
 
 
25
#ifndef CYGWIN
 
26
#include <unistd.h>
 
27
#endif
 
28
 
 
29
#include "../../src/include/ec_main.h"
 
30
#include "../../src/include/ec_version.h"
 
31
#include "../../src/include/ec_plugins.h"
 
32
#include "../../src/include/ec_inet_structures.h"
 
33
#include "../../src/include/ec_inet.h"
 
34
#include "../../src/include/ec_inet_forge.h"
 
35
 
 
36
// protos....
 
37
 
 
38
int Plugin_Init(void *);
 
39
int Plugin_Fini(void *);
 
40
int lurker(void *buffer);
 
41
 
 
42
// plugin operation
 
43
 
 
44
struct plugin_ops lurker_ops = {
 
45
   ettercap_version: VERSION,
 
46
   plug_info:        "Try to search for other ettercaps",
 
47
   plug_version:     20,
 
48
   plug_type:        PT_HOOK,
 
49
   hook_point:       PCK_RECEIVED_RAW,
 
50
   hook_function:    &lurker,
 
51
};
 
52
 
 
53
//==================================
 
54
 
 
55
int Plugin_Init(void *params)
 
56
{
 
57
   return Plugin_Register(params, &lurker_ops);
 
58
}
 
59
 
 
60
int Plugin_Fini(void *params)
 
61
{
 
62
   return 0;
 
63
}
 
64
 
 
65
// =================================
 
66
 
 
67
int lurker(void *buffer)              // very lame searching...
 
68
{                                     // only for script-kiddes...
 
69
   IP_header  *ip;
 
70
   TCP_header *tcp;
 
71
   ETH_header *eth;
 
72
   char IPS[16];
 
73
   char IPD[16];
 
74
   RAW_PACKET *pck_raw;
 
75
 
 
76
   pck_raw = (RAW_PACKET *)buffer;
 
77
 
 
78
   eth = (ETH_header *) pck_raw->buffer;
 
79
   if ( ntohs(eth->type) == ETH_P_IP )
 
80
   {
 
81
      ip = (IP_header *)(eth+1);
 
82
 
 
83
      strcpy(IPS, inet_ntoa(*(struct in_addr *)&ip->source_ip) );
 
84
      strcpy(IPD, inet_ntoa(*(struct in_addr *)&ip->dest_ip) );
 
85
 
 
86
      if ( ntohs(ip->ident) == 0xe77e )
 
87
      {
 
88
         Plugin_Hook_Output("ettercap traces coming from %s ...\n", IPS );
 
89
      }
 
90
 
 
91
      if ( ntohs(ip->ident) == 0xbadc )
 
92
      {
 
93
         Plugin_Hook_Output("Banshee is killing from %s to %s ...\n", IPS, IPD );
 
94
      }
 
95
 
 
96
      if ( ip->proto == IPPROTO_TCP )
 
97
      {
 
98
 
 
99
         tcp = (TCP_header *) ((int)ip + ip->h_len * 4);
 
100
 
 
101
         switch( ntohl(tcp->seq) )
 
102
         {
 
103
            case 0xe77e:
 
104
               Plugin_Hook_Output("ettercap traces coming from %s ...\n", IPS );
 
105
               break;
 
106
            case 6969:
 
107
               Plugin_Hook_Output("%s is shadowing (scanning) %s ...\n", IPS, IPD );
 
108
               break;
 
109
            case 0xabadc0de:
 
110
               if ( ntohs(ip->ident) == 0xe77e && ntohl(tcp->ack_seq) == 0xabadc0de)
 
111
                  Plugin_Hook_Output("Spectre is flooding the LAN...\n");
 
112
               else
 
113
                  Plugin_Hook_Output("%s is golemizing %s ...\n", IPS, IPD );
 
114
               break;
 
115
         }
 
116
      }
 
117
   }
 
118
 
 
119
   return 0;
 
120
}
 
121
 
 
122
 
 
123
/* EOF */