/*
 * 
 * wftp
 *
 * This plugin was written by Renaud Deraison and is released
 * under the GPL
 *
 */
#include <includes.h>
#define NAME "WFTP (Windows FTP server) login check"
#define DESC "This plugin determines whether the remote ftp daemon \
accepts connections with any username/password, (ie : an old version \
of WFTP)"
#define COPYRIGHT "no copyright"
#define SUMM "checks if WFTP accepts bogus logins"





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, "FTP");
	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, 21)<=0)return(0);
	soc = open_sock_tcp(args, 21);
	if(soc<0)return(-1);
	if(!ftp_log_in(soc, "bogusbogus", "bogusbogus"))
	{
	 post_hole(args, 21, 
"The remote ftp server accepts connections with\n\
bogus username/password\n\
Solution : upgrade the remote ftp server");	
       }
        shutdown(soc, 2);
        efree(&buf);
        socket_close(soc);
	return(0);
}

