2
ettercap -- debug module
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_debug.c,v 1.17 2002/07/20 09:41:25 alor Exp $
28
#ifdef HAVE_SYS_UTSNAME_H
29
#include <sys/utsname.h>
48
#define DEBUG_FILE "ettercap_debug.log"
51
#include <ec_version.h>
52
#include <ec_thread.h>
53
#include <ec_debug_info.h>
57
void debug_init(void);
58
void debug_close(void);
61
void DEBUG_MSG(char *message, ...);
63
void debug_msg(char *message, ...);
66
//----------------------------
70
#ifdef HAVE_SYS_UTSNAME_H
74
if ((debug_dev = fopen (DEBUG_FILE, "w")) == NULL) {
75
ERROR_MSG("Couldn't open DEBUG FILE!");
78
fprintf (debug_dev, "\n==============================================================\n\n");
79
fprintf (debug_dev, "Configured with : %s \n\n", configure_line);
80
fprintf (debug_dev, "Detected options : NCURSES %s \n", configure_ncurses);
81
fprintf (debug_dev, " FORM %s \n", configure_form);
82
fprintf (debug_dev, " GTK+ %s \n", configure_gtk);
83
fprintf (debug_dev, " PLUGINS %s \n", configure_plugins);
84
fprintf (debug_dev, " SSH %s \n", configure_ssh);
85
fprintf (debug_dev, " HTTPS %s \n\n", configure_https);
86
fprintf (debug_dev, "Programs path : wget %s \n", WGET_PATH);
87
fprintf (debug_dev, " openssl %s \n", OPENSSL_PATH);
88
fprintf (debug_dev, "\n==============================================================\n");
90
#if DEVEL_RELEASE == 1
91
fprintf (debug_dev, "\n-> %s %s beta %s\n\n", PROGRAM, VERSION, RELEASE_DATE);
93
fprintf (debug_dev, "\n-> %s %s\n\n", PROGRAM, VERSION);
95
#ifdef HAVE_SYS_UTSNAME_H
97
fprintf (debug_dev, "-> running on %s %s %s\n", buf.sysname, buf.release, buf.machine);
99
#if defined (__GLIBC__) && defined (__GLIBC_MINOR__)
100
fprintf (debug_dev, "-> glibc version %d.%d\n", __GLIBC__, __GLIBC_MINOR__);
103
fprintf (debug_dev, "-> packet driver version %s\n", PacketGetVersion());
105
#if defined (__GNUC__) && defined (__GNUC_MINOR__)
106
fprintf (debug_dev, "-> compiled with gcc %d.%d\n", __GNUC__, __GNUC_MINOR__);
110
fprintf (debug_dev, "-> pdcurses %d \n", PDC_BUILD);
112
fprintf (debug_dev, "-> %s\n", curses_version());
115
fprintf (debug_dev, "\n\nDEVICE OPENED FOR %s DEBUGGING\n\n", PROGRAM);
122
void debug_close(void)
124
fprintf (debug_dev, "\n\nDEBUGGING DEVICE FOR %s WAS CLOSED\n\n", ECThread_getname(pthread_self()));
131
void DEBUG_MSG(char *message, ...)
133
void debug_msg(char *message, ...)
137
char debug_message[strlen(message)+2];
139
fprintf (debug_dev, "%-10s\t", ECThread_getname(pthread_self()));
141
strlcpy(debug_message, message, sizeof(debug_message));
142
strlcat(debug_message, "\n", sizeof(debug_message));
144
va_start(ap, message);
145
vfprintf(debug_dev, debug_message, ap);
152
#else /* not defined DEBUG */
156
* damned MACOSX cc compiler !!
157
* it doesn't support our macro DEBUG_MSG(x, args...)
160
void DEBUG_MSG(char *message, ...);
162
void DEBUG_MSG(char *message, ...)
172
// vim:ts=3:expandtab