/* ***********************IMPORTANT *********************************************
 *  Copyright (C) 2004-2007 Thierry Lagarde <tlagarde@users.sourceforge.net>
 *  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.
 *
 *
 *                      ********************
 *
 *
 *  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 Library General Public License for more details.
 *
 *
 *                      ********************
 *
 *
 * You are highly encouraged to send your changes to <tlagarde@users.sourceforge.net>
 * for possible incorporation into the main distribution.
 * By sending these changes to <tlagarde@users.sourceforge.net>,
 * it is assumed that you are offering <tlagarde@users.sourceforge.net>
 * the unlimited, non-exclusive right to reuse, modify, and relicense the code.
 *
 *
 *                      ********************
 *
 *  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.
 **************************************************************************************/
#ifdef         __NESSUS_ENABLE
#include <errno.h>
#include "Nessus.h"
#include "Debug.h"
#include "Reseau.h"
#include "Thread.h"
#include "Com/Commun.h"
#include "Com/Initialisation_Com.h"
#include "Macro.h"


void Envoie_Nessus (char *text, SSL * ssl)
{
	ERROR_if (text == NULL);
	ERROR_if (ssl == NULL);

	if (SSL_write (ssl, text, strlen (text)) != strlen (text)) {
		debug_printf (D_ERRO, __FILE__, __PRETTY_FUNCTION__, __LINE__, "SSL_write");
		Stop_Thread (NULL);
	}
}


void Doit_Recevoir_Nessus (char *text, SSL * ssl)
{
	char      buf[100];
	int       Donnee_Lu;
	
	ERROR_if (text == NULL);
	ERROR_if (ssl == NULL);
	Donnee_Lu = SSL_read (ssl, buf, 100);
	buf[Donnee_Lu] = 0;

	if (strcmp (buf, text) != 0) {
		debug_printf (D_ERRO, __FILE__, __PRETTY_FUNCTION__, __LINE__, "[%s]", text);
		Stop_Thread (NULL);
	}
}


void Client_Nessus (struct struct_Demande_Nessus *Demande_Nessus)
{
	char      buf[10000], *pbuf = NULL, *pbuf_Fin = NULL;
	char      Type_message[10], Type[5];
	int       port, i, nb_Morceau_Donnee, Taille_Dernier_Morceau, Taille_Total_Message;
	int       opt, Etat, Num_Plugin;
	int       Donnee_Lu;
	BIO      *io = NULL, *ssl_bio = NULL;
	FILE     *Fichier_Init_Nessus = NULL;
	int       Liste_Plugin[10000], Nb_Plugin, Index_plugin;
	int       Socket;

	static SSL_METHOD *ssl_method = NULL;
	static SSL_CTX *ssl_ctx = NULL;
	SSL      *ssl = NULL;
	int       Index_Chaine;
	gchar    *temp = NULL;
	struct struct_Demarrage_Nessus Message_Demarrage;
	struct struct_Retour_Nessus_Info Message_Info;
	struct struct_Retour_Nessus_Donnee Message_Donnee;
	struct struct_Retour_Nessus_Fin Message_Fin;
	struct Struct_Liste_Equipement *Equipement = NULL;
	unsigned char Adresse_Ip_Resolu[15 + 1];
	gint      ID_Equipement;

	Create_Log(CATEG_NESSUS,NULL,Equipement,TRUE);
	ERROR_if (Demande_Nessus == NULL);

	Recherche_Index_Equipement (Demande_Nessus->ID_Equipement, TRUE, &ID_Equipement);
	if (ID_Equipement == EQUIPEMENT_UNKNOWN) {
		debug_printf (D_WARN_USER, __FILE__, __PRETTY_FUNCTION__, __LINE__, "Nessus (Equipment unknown)");
		Stop_Thread (NULL);
	}
	if (ID_Equipement == EQUIPEMENT_NO_IP) {
		debug_printf (D_WARN_USER, __FILE__, __PRETTY_FUNCTION__, __LINE__, "Nessus (no IP)");
		return;	
	}

	Retour_Pointeur_Equipement (&Equipement,ID_Equipement);
	debug_printf (D_INFO, __FILE__, __PRETTY_FUNCTION__, __LINE__, "");
	
	port = 1241;
	debug_printf (D_INFO, __FILE__, __PRETTY_FUNCTION__, __LINE__, "Client Nessus pour %s", Demande_Nessus->Adresse_Client);

	SSL_library_init ();
	SSL_load_error_strings ();

	if ((ssl_method = TLSv1_client_method ()) == NULL) {
		debug_printf (D_ERRO, __FILE__, __PRETTY_FUNCTION__, __LINE__, "Methode client TLSv1");
		Stop_Thread (NULL);
	}
	if ((ssl_ctx = SSL_CTX_new (ssl_method)) == NULL) {
		debug_printf (D_ERRO, __FILE__, __PRETTY_FUNCTION__, __LINE__, "SSL_CTX_new");
		Stop_Thread (NULL);
	}
	if (SSL_CTX_set_options (ssl_ctx, SSL_OP_ALL) < 0)
		debug_printf (D_ERRO, __FILE__, __PRETTY_FUNCTION__, __LINE__, "SSL_CTX_set_options(SSL_OP_ALL)");

	if ((ssl = SSL_new (ssl_ctx)) == NULL) {
		debug_printf (D_ERRO, __FILE__, __PRETTY_FUNCTION__, __LINE__, "SSL_new");
		SSL_CTX_free (ssl_ctx);
		Stop_Thread (NULL);
	}

	if ((Socket = Creation_Socket_TCP ()) == FALSE) {
		debug_printf (D_ERRO, __FILE__, __PRETTY_FUNCTION__, __LINE__, "Creation Socket");
		EVP_cleanup ();
		SSL_CTX_free (ssl_ctx);
		SSL_free (ssl);
		Stop_Thread (NULL);
	}
	opt = 1;
	setsockopt (Socket, SOL_SOCKET, SO_KEEPALIVE, &opt, sizeof (opt));

	if (resoudre_DNS (Demande_Nessus->Adresse_Serveur,Adresse_Ip_Resolu) == NULL) {
		EVP_cleanup ();
		SSL_CTX_free (ssl_ctx);
		SSL_free (ssl);
		if (close_control (Socket) < 0)
			debug_printf (D_ERRO, __FILE__, __PRETTY_FUNCTION__, __LINE__, "%s\nSocket ouvert[%d]  Thread[%d][%d]\n Nb equipement (%d)", strerror (errno), Nb_Socket_Ouverte, Info_Demarrage.Nb_Thread_Max, Info_Demarrage.Nb_Thread_Max - Valeur_Semaphore (&Semaphore_Thread_Scan), g_list_length (GList_Equipement));
		Stop_Thread (NULL);
	}
	if (connection_Serveur (Adresse_Ip_Resolu, port, Socket) == FALSE) {
		debug_printf (D_WARN_USER, __FILE__, __PRETTY_FUNCTION__, __LINE__, "Nessus :  Connection refused (port 1241)");
		if (close_control (Socket) < 0)
			debug_printf (D_ERRO, __FILE__, __PRETTY_FUNCTION__, __LINE__, "%s\nSocket ouvert[%d]  Thread[%d][%d]\n Nb equipement (%d)", strerror (errno), Nb_Socket_Ouverte, Info_Demarrage.Nb_Thread_Max, Info_Demarrage.Nb_Thread_Max - Valeur_Semaphore (&Semaphore_Thread_Scan), g_list_length (GList_Equipement));
		EVP_cleanup ();
		SSL_CTX_free (ssl_ctx);
		SSL_free (ssl);
		Stop_Thread (NULL);
	}
	debug_printf (D_INFO, __FILE__, __PRETTY_FUNCTION__, __LINE__, "Associe le descripteur de socket au contexte SSL");
	if (!SSL_set_fd (ssl, Socket)) {
		debug_printf (D_ERRO, __FILE__, __PRETTY_FUNCTION__, __LINE__, "SSL_set_fd");
		EVP_cleanup ();
		SSL_CTX_free (ssl_ctx);
		SSL_free (ssl);
		if (close_control (Socket) < 0)
			debug_printf (D_ERRO, __FILE__, __PRETTY_FUNCTION__, __LINE__, "%s\nSocket ouvert[%d]  Thread[%d][%d]\n Nb equipement (%d)", strerror (errno), Nb_Socket_Ouverte, Info_Demarrage.Nb_Thread_Max, Info_Demarrage.Nb_Thread_Max - Valeur_Semaphore (&Semaphore_Thread_Scan), g_list_length (GList_Equipement));
		Stop_Thread (NULL);
	}

	debug_printf (D_INFO, __FILE__, __PRETTY_FUNCTION__, __LINE__, "Etablissement du tunnel SSL");
	if (SSL_connect (ssl) <= 0) {
		debug_printf (D_WARN_USER, __FILE__, __PRETTY_FUNCTION__, __LINE__, "SSL_connect");
		EVP_cleanup ();
		SSL_CTX_free (ssl_ctx);
		SSL_free (ssl);
		if (close_control (Socket) < 0)
			debug_printf (D_ERRO, __FILE__, __PRETTY_FUNCTION__, __LINE__, "%s\nSocket ouvert[%d]  Thread[%d][%d]\n Nb equipement (%d)", strerror (errno), Nb_Socket_Ouverte, Info_Demarrage.Nb_Thread_Max, Info_Demarrage.Nb_Thread_Max - Valeur_Semaphore (&Semaphore_Thread_Scan), g_list_length (GList_Equipement));
		Stop_Thread (NULL);
	}

	Envoie_Nessus ("< NTP/1.2 ><>\n", ssl);
	Doit_Recevoir_Nessus ("< NTP/1.2 >\n", ssl);
	Doit_Recevoir_Nessus ("User : ", ssl);
	temp = g_strdup_printf ("%s\n", Demande_Nessus->Utilisateur_Nessus);
	Envoie_Nessus (temp, ssl);
	MYFREE (temp);
	Doit_Recevoir_Nessus ("Password : ", ssl);
	temp = g_strdup_printf ("%s\n", Demande_Nessus->Password_Nessus);
	Envoie_Nessus (temp, ssl);
	MYFREE (temp);

	Donnee_Lu = SSL_read (ssl, buf, 100);
	buf[Donnee_Lu] = 0;
	if (strcmp (buf, "SERVER <|> PLUGIN_LIST <|>\n") != 0) {
		EVP_cleanup ();
		SSL_CTX_free (ssl_ctx);
		SSL_free (ssl);
		if (close_control (Socket) < 0)
			debug_printf (D_ERRO, __FILE__, __PRETTY_FUNCTION__, __LINE__, "%s\nSocket ouvert[%d]  Thread[%d][%d]\n Nb equipement (%d)", strerror (errno), Nb_Socket_Ouverte, Info_Demarrage.Nb_Thread_Max, Info_Demarrage.Nb_Thread_Max - Valeur_Semaphore (&Semaphore_Thread_Scan), g_list_length (GList_Equipement));
		debug_printf (D_WARN_USER, __FILE__, __PRETTY_FUNCTION__, __LINE__, "Nessus : Login failed");
		Stop_Thread (NULL);
	}

	bzero (&Message_Demarrage, sizeof (struct struct_Demarrage_Nessus));
	Message_Demarrage.ID_Reseau = Info_Demarrage.ID_Reseau;
	memcpy (Message_Demarrage.ID_Equipement, Equipement->ID_Equipement, MAC_ADDR_LEN + IP_ADDR_LEN + 1);
	Communication_Envoie_Donnee (DEMARRAGE_NESSUS, (gpointer *) & Message_Demarrage, sizeof (Message_Demarrage));


	debug_printf (D_INFO, __FILE__, __PRETTY_FUNCTION__, __LINE__, "Reception de la liste de plugins :");
	Etat = 1;
	io = BIO_new (BIO_f_buffer ());
	ssl_bio = BIO_new (BIO_f_ssl ());
	BIO_set_ssl (ssl_bio, ssl, BIO_CLOSE);
	BIO_push (io, ssl_bio);

	Nb_Plugin = 0;
	while (Etat != 6) {
		BIO_gets (io, buf, 10000 - 1);
	

		if ((Etat == 1) && (strcmp (buf, "<|> SERVER\n") == 0)) {
			Etat = 2;
			debug_printf (D_INFO, __FILE__, __PRETTY_FUNCTION__, __LINE__, "OK (%d Plugins)", Nb_Plugin);
		}

		if (Etat == 1) {
			
			if (sscanf (buf, "%d <|>", &Num_Plugin) != 1) {
				debug_printf (D_INFO, __FILE__, __PRETTY_FUNCTION__, __LINE__, "Recuperation Numero du plugin");
				Stop_Thread (NULL);
			}
			pbuf = strstr (buf, "<|>");
			pbuf = pbuf + sizeof ("<|>");
			pbuf = strstr (pbuf, "<|>");
			pbuf = pbuf + sizeof ("<|>");
			pbuf[strstr (pbuf, "<|>") - pbuf] = 0;
			
			if (((strncmp (pbuf, "kill_host", 9) != 0)) && (strncmp (pbuf, "flood", 5) != 0) && (strncmp (pbuf, "denial", 6) != 0) && (strncmp (pbuf, "destructive_attack", 18) != 0) && (strncmp (pbuf, "scanner", 7) != 0)) {
			
				Liste_Plugin[Nb_Plugin] = Num_Plugin;
				Nb_Plugin++;
			}
		}

		if ((Etat == 2) && (strcmp (buf, "SERVER <|> PREFERENCES <|>\n") == 0)) {
			Etat = 3;
			debug_printf (D_INFO, __FILE__, __PRETTY_FUNCTION__, __LINE__, "Reception de la liste de preference : ");
		}

		if ((Etat == 3) && (strcmp (buf, "<|> SERVER\n") == 0)) {
			Etat = 4;
			debug_printf (D_INFO, __FILE__, __PRETTY_FUNCTION__, __LINE__, "OK (preference)\n");
		}

		if ((Etat == 4) && (strcmp (buf, "SERVER <|> RULES <|>\n") == 0)) {
			Etat = 5;
			debug_printf (D_INFO, __FILE__, __PRETTY_FUNCTION__, __LINE__, "Reception de la liste de regles : ");
		}

		if ((Etat == 5) && (strcmp (buf, "<|> SERVER\n") == 0)) {
			Etat = 6;
			debug_printf (D_INFO, __FILE__, __PRETTY_FUNCTION__, __LINE__, "OK (regles)");
		}
	}

	if ((Fichier_Init_Nessus = fopen ("/usr/share/apps/AutoScan/Init1_Nessus.txt", "r")) == NULL) {
		debug_printf (D_WARN_USER, __FILE__, __PRETTY_FUNCTION__, __LINE__, "Error loading file : [Init1_Nessus.txt]\n%s", strerror (errno));
		EVP_cleanup ();
		SSL_CTX_free (ssl_ctx);
		SSL_free (ssl);
		if (close_control (Socket) < 0)
			debug_printf (D_ERRO, __FILE__, __PRETTY_FUNCTION__, __LINE__, "%s\nSocket ouvert[%d]  Thread[%d][%d]\n Nb equipement (%d)", strerror (errno), Nb_Socket_Ouverte, Info_Demarrage.Nb_Thread_Max, Info_Demarrage.Nb_Thread_Max - Valeur_Semaphore (&Semaphore_Thread_Scan), g_list_length (GList_Equipement));
		Stop_Thread (NULL);
	}
	while (fgets (buf, sizeof (buf), Fichier_Init_Nessus))
		Envoie_Nessus (buf, ssl);

	Index_plugin = 0;
	while (Index_plugin < Nb_Plugin) {
		sprintf (buf, "%d;", Liste_Plugin[Index_plugin]);
		Envoie_Nessus (buf, ssl);
		Index_plugin++;
	}
	fclose (Fichier_Init_Nessus);
	Envoie_Nessus ("10335;14272;10180;11840;14274;14259;\n", ssl);

	if ((Fichier_Init_Nessus = fopen ("/usr/share/apps/AutoScan/Init2_Nessus.txt", "r")) == NULL) {
		debug_printf (D_WARN_USER, __FILE__, __PRETTY_FUNCTION__, __LINE__, "Error loading file : [Init2_Nessus.txt]\n%s", strerror (errno));
		EVP_cleanup ();
		SSL_CTX_free (ssl_ctx);
		SSL_free (ssl);
		if (close_control (Socket) < 0)
			debug_printf (D_ERRO, __FILE__, __PRETTY_FUNCTION__, __LINE__, "%s\nSocket ouvert[%d]  Thread[%d][%d]\n Nb equipement (%d)", strerror (errno), Nb_Socket_Ouverte, Info_Demarrage.Nb_Thread_Max, Info_Demarrage.Nb_Thread_Max - Valeur_Semaphore (&Semaphore_Thread_Scan), g_list_length (GList_Equipement));
		Stop_Thread (NULL);
	}
	while (fgets (buf, sizeof (buf), Fichier_Init_Nessus))
		Envoie_Nessus (buf, ssl);
	fclose (Fichier_Init_Nessus);

	Doit_Recevoir_Nessus ("SERVER <|> PREFERENCES_ERRORS <|>\n", ssl);
	Doit_Recevoir_Nessus ("<|> SERVER\n", ssl);
	Envoie_Nessus ("CLIENT <|> RULES <|>\n", ssl);
	Envoie_Nessus ("<|> CLIENT\n", ssl);
	Envoie_Nessus ("CLIENT <|> LONG_ATTACK <|>\n", ssl);
	sprintf (buf, "%d\n", strlen (Demande_Nessus->Adresse_Client));
	Envoie_Nessus (buf, ssl);
	sprintf (buf, "%s\n", Demande_Nessus->Adresse_Client);
	Envoie_Nessus (buf, ssl);
	BIO_gets (io, buf, 10000 - 1);

	while (strcmp (buf, "SERVER <|> BYE <|> BYE <|> SERVER\n") != 0) {
	
	
		if (strncmp (buf, "SERVER <|>", 10) == 0) {
		
		
		
		
		
			pbuf = strstr (buf, "<|>");
			pbuf = pbuf + sizeof ("<|>");
			
			if (sscanf (pbuf, "%s <|>", Type_message) != 1) {
				debug_printf (D_WARN_USER, __FILE__, __PRETTY_FUNCTION__, __LINE__, "Erreur : Recuperation type de message");
				EVP_cleanup ();
				SSL_CTX_free (ssl_ctx);
				SSL_free (ssl);
				if (close_control (Socket) < 0)
					debug_printf (D_ERRO, __FILE__, __PRETTY_FUNCTION__, __LINE__, "%s\nSocket ouvert[%d]  Thread[%d][%d]\n Nb equipement (%d)", strerror (errno), Nb_Socket_Ouverte, Info_Demarrage.Nb_Thread_Max, Info_Demarrage.Nb_Thread_Max - Valeur_Semaphore (&Semaphore_Thread_Scan), g_list_length (GList_Equipement));
				Stop_Thread (NULL);
			}
			if (((strncmp (pbuf, "INFO", 4) == 0)) || (strncmp (pbuf, "NOTE", 4) == 0) || (strncmp (pbuf, "HOLE", 4) == 0)) {
			
				strncpy (Type, pbuf, 4);
				Type[4] = 0;
			
			
				pbuf = strstr (pbuf, "<|>") + sizeof ("<|>");
				pbuf = strstr (pbuf, "<|>") + sizeof ("<|>");
				pbuf_Fin = strstr (pbuf, "<|>") + sizeof ("<|>");

				
				pbuf[strstr (pbuf, "<|>") - pbuf] = 0;
			

				bzero (&Message_Info, sizeof (struct struct_Retour_Nessus_Info));
			
				Message_Info.ID_Reseau = Info_Demarrage.ID_Reseau;
				memcpy (Message_Info.ID_Equipement, Equipement->ID_Equipement, MAC_ADDR_LEN + IP_ADDR_LEN + 1);
				strcpy (Message_Info.Type, Type);
				strcpy (Message_Info.Info, pbuf);
				Communication_Envoie_Donnee (RETOUR_NESSUS_INFO, (gpointer *) & Message_Info, sizeof (Message_Info));

			
				
				pbuf = pbuf_Fin;
				pbuf[strstr (pbuf, "<|>") - pbuf] = 0;
			
				Taille_Total_Message = strlen (pbuf);
				nb_Morceau_Donnee = Taille_Total_Message / 255;
				Taille_Dernier_Morceau = Taille_Total_Message % 255;
			
				Index_Chaine = 0;
				if (nb_Morceau_Donnee == 0) {
				
					bzero (&Message_Donnee, sizeof (struct struct_Retour_Nessus_Donnee));
				
					Message_Donnee.ID_Reseau = Info_Demarrage.ID_Reseau;
					memcpy (Message_Donnee.ID_Equipement, Equipement->ID_Equipement, MAC_ADDR_LEN + IP_ADDR_LEN + 1);
					strcpy (Message_Donnee.Info, pbuf);
					Communication_Envoie_Donnee (RETOUR_NESSUS_DONNEE, (gpointer *) & Message_Donnee, sizeof (Message_Donnee));
				
				}
				else {
				
					/*bzero (&Message_Donnee, sizeof (struct struct_Retour_Nessus_Donnee));    
					 *
					 * Message_Donnee.ID_Reseau = Info_Demarrage.ID_Reseau;
					 * memcpy (Message_Donnee.ID_Equipement, Equipement->ID_Equipement, MAC_ADDR_LEN + IP_ADDR_LEN + 1);
					 * Message_Donnee.Taille_Morceau = Taille_Total_Message;
					 * Message_Donnee.Taille_Total = Taille_Total_Message;
					 * strcpy (Message_Donnee.Info, pbuf);
					 * Communication_Envoie_Donnee (RETOUR_NESSUS_DONNEE, (gpointer *) & Message_Donnee, sizeof (Message_Donnee)); */

				
				
				
				
					for (i = 0; i < (nb_Morceau_Donnee); i++) {
					
						bzero (&Message_Donnee, sizeof (struct struct_Retour_Nessus_Donnee));
					
						Message_Donnee.ID_Reseau = Info_Demarrage.ID_Reseau;
						memcpy (Message_Donnee.ID_Equipement, Equipement->ID_Equipement, MAC_ADDR_LEN + IP_ADDR_LEN + 1);
						strncpy (Message_Donnee.Info, pbuf, 255);
						Communication_Envoie_Donnee (RETOUR_NESSUS_DONNEE, (gpointer *) & Message_Donnee, sizeof (Message_Donnee));
						pbuf = pbuf + 255;
						Index_Chaine = Index_Chaine + 255;
					}
				
					if (Taille_Dernier_Morceau != 0) {
					
						bzero (&Message_Donnee, sizeof (struct struct_Retour_Nessus_Donnee));
					
						Message_Donnee.ID_Reseau = Info_Demarrage.ID_Reseau;
						memcpy (Message_Donnee.ID_Equipement, Equipement->ID_Equipement, MAC_ADDR_LEN + IP_ADDR_LEN + 1);
						strncpy (Message_Donnee.Info, pbuf, Taille_Dernier_Morceau);
						Communication_Envoie_Donnee (RETOUR_NESSUS_DONNEE, (gpointer *) & Message_Donnee, sizeof (Message_Donnee));
					}

				
				}
			}
		}
	
		BIO_gets (io, buf, 10000 - 1);
	
	}

	bzero (&Message_Fin, sizeof (struct struct_Retour_Nessus_Fin));

	Message_Fin.ID_Reseau = Info_Demarrage.ID_Reseau;
	memcpy (Message_Fin.ID_Equipement, Equipement->ID_Equipement, MAC_ADDR_LEN + IP_ADDR_LEN + 1);
	Communication_Envoie_Donnee (RETOUR_NESSUS_FIN, (gpointer *) & Message_Fin, sizeof (Message_Fin));
	EVP_cleanup ();
	SSL_CTX_free (ssl_ctx);
	if (close_control (Socket) < 0)
		debug_printf (D_ERRO, __FILE__, __PRETTY_FUNCTION__, __LINE__, "%s\nSocket ouvert[%d]  Thread[%d][%d]\n Nb equipement (%d)", strerror (errno), Nb_Socket_Ouverte, Info_Demarrage.Nb_Thread_Max, Info_Demarrage.Nb_Thread_Max - Valeur_Semaphore (&Semaphore_Thread_Scan), g_list_length (GList_Equipement));

	Stop_Thread (NULL);
}


void Initialisation_Nessus (gpointer * Donnee)
{
	struct struct_Demande_Nessus *Message = (struct struct_Demande_Nessus *) Donnee;
	gint      ID_Equipement;

	ERROR_if (Donnee == NULL);
	Recherche_Index_Equipement (Message->ID_Equipement, TRUE, &ID_Equipement);
	if (ID_Equipement == EQUIPEMENT_UNKNOWN) {
		debug_printf (D_WARN_USER, __FILE__, __PRETTY_FUNCTION__, __LINE__, "Nessus (Equipment unknown)");
		return;	
	}
	if (ID_Equipement == EQUIPEMENT_NO_IP) {
		debug_printf (D_WARN_USER, __FILE__, __PRETTY_FUNCTION__, __LINE__, "Nessus (no IP)");
		return;	
	}
	demmarrage_Thread (Client_Nessus, Donnee);
}


void Initialisation_Nessus_Variable(void){

}

#endif
