/*
 * 
 * wingate
 *
 * This plugin was written by Renaud Deraison and is released
 * under the GPL
 *
 */
#include <includes.h> 


#define NAME "wingate"
#define DESC "This plugin notifies the user that wingate is installed on a \
remote machine"
#define COPYRIGHT "no copyright"
#define SUMM "notifies the user whether wingate is running"


PlugExport int plugin_init(struct arglist *desc);
PlugExport int plugin_init(struct arglist *desc)
{
	plug_set_name(desc, NAME);
	plug_set_description(desc, DESC);
	plug_set_summary(desc, SUMM);
	plug_set_copyright(desc, COPYRIGHT);
	plug_set_category(desc, ACT_GATHER_INFO);
	plug_set_family(desc, "Misc.");
	return(0);
}



PlugExport int plugin_run(struct arglist * args);	
PlugExport int plugin_run(struct arglist * args)
{
	int soc;
	char * buf;
	if(host_get_port_state(args, 23))
	{
	int i;
	soc = open_sock_tcp(args, 23);
	buf = emalloc(1024);
	recv(soc, buf, 1024,0);
	for(i=0;i<strlen(buf);i++)buf[i] = tolower(buf[i]);
	if(strstr(buf, "wingate"))
	post_hole(args,23,
	
"Wingate may is installed on the remote machine\n\
Check its configuration, or else anyone may use\n\
this machine to mask its real IP");
	efree(&buf);
	socket_close(soc);
	}
	return(0);
}

