ec_fingerprint.c
上传用户:nilegod
上传日期:2007-01-08
资源大小:220k
文件大小:13k
- /*
- ettercap -- fingerprinter
- Copyright (C) 2001 ALoR <alor@users.sourceforge.net>, NaGA <crwm@freemail.it>
- 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.
- */
- #include "include/ec_main.h"
- #include <string.h>
- #include <stdio.h>
- #include <stdlib.h>
- #include <errno.h>
- #include <fcntl.h>
- #include <sys/time.h>
- #include <unistd.h>
- #include "include/ec_inet_structures.h"
- #include "include/ec_inet.h"
- #include "include/ec_inet_forge.h"
- #include "include/ec_decodedata.h"
- #include "include/ec_error.h"
- #ifdef DEBUG
- #include "include/ec_debug.h"
- #endif
- #ifdef HAVE_SYS_UTSNAME_H
- #include <sys/utsname.h>
- #endif
- #define NUM_TESTS 7
- #define NUM_CONDS 6
- #define MSS 265
- // global data...
- int IPS, IPD, sock, MTU;
- u_short open_port=0, closed_port=0, PORTS;
- long SYN_SEQ;
- unsigned short IP_ID;
- unsigned char MACS[6];
- unsigned char MACD[6];
- // Static arrays? bleah...
- char packet_stamp[NUM_TESTS][NUM_CONDS][10];
- char test_name[NUM_CONDS][10];
- // protos....
- char * Fingerprint_OS(char *IP);
- char * Fingerprint_MAC(char *MAC);
- //--------------------------
- int Fingerprint_Match(char *mycond, char *fpcond)
- {
- int matched=0; char *single_cond, *deadend=NULL;
- deadend=fpcond+strlen(fpcond);
- if (deadend==fpcond) matched=1;
- while( !matched && (unsigned long)fpcond<(unsigned long)deadend )
- {
- single_cond=(char *)strtok(fpcond,"|");
- if (!strcmp(mycond,single_cond)) matched=1;
- fpcond+=strlen(single_cond)+1;
- }
- return matched;
- }
- void Fingerprint_send_probes()
- {
- char *probe_pck;
- #define TH_BOGUS 64
- #define OPTIONS "