mirror of
https://github.com/ChronosX88/nesca.git
synced 2024-11-23 10:42:21 +00:00
Threadpool refactoring.
This commit is contained in:
parent
4f8cb2c53b
commit
e3407a5e11
@ -31,9 +31,10 @@ void ActivityDrawerTh_HorNet::run()
|
|||||||
if (maxAct < Activity) maxAct = Activity;
|
if (maxAct < Activity) maxAct = Activity;
|
||||||
if (maxAct > 1000) nm = maxAct -= 1000;
|
if (maxAct > 1000) nm = maxAct -= 1000;
|
||||||
else if (maxAct > 10) nm = maxAct -= 10;
|
else if (maxAct > 10) nm = maxAct -= 10;
|
||||||
|
|
||||||
makeActLine(((float)Activity / (nm != 0 ? nm : 1)) * 10);
|
makeActLine(((float)Activity / (nm != 0 ? nm : 1)) * 10);
|
||||||
adtHN->doEmitDrawActivityLine(QString::number(Activity) + "b");
|
adtHN->doEmitDrawActivityLine(QString::number(Activity) + "b");
|
||||||
Activity = 0;
|
Activity = 0;
|
||||||
msleep(130);
|
msleep(150);
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
@ -33,10 +33,7 @@ bool BA::checkOutput(const string *buffer, const char *ip, const int port) {
|
|||||||
lopaStr BA::BABrute(const char *ip, const int port) {
|
lopaStr BA::BABrute(const char *ip, const int port) {
|
||||||
string buffer;
|
string buffer;
|
||||||
string lpString;
|
string lpString;
|
||||||
lopaStr lps{"UNKNOWN", "", ""};
|
lopaStr lps = {"UNKNOWN", "", ""};
|
||||||
ZeroMemory(lps.login, sizeof(lps.login));
|
|
||||||
ZeroMemory(lps.pass, sizeof(lps.pass));
|
|
||||||
ZeroMemory(lps.other, sizeof(lps.other));
|
|
||||||
int passCounter = 0;
|
int passCounter = 0;
|
||||||
int res = 0;
|
int res = 0;
|
||||||
|
|
||||||
@ -73,13 +70,16 @@ lopaStr BA::BALobby(const char *ip, const int port) {
|
|||||||
|
|
||||||
while(BrutingThrds >= gMaxBrutingThreads) Sleep(1000);
|
while(BrutingThrds >= gMaxBrutingThreads) Sleep(1000);
|
||||||
|
|
||||||
BruteUtils::BConInc();
|
++baCount;
|
||||||
|
++BrutingThrds;
|
||||||
|
//BruteUtils::BConInc();
|
||||||
const lopaStr &lps = BABrute(ip, port);
|
const lopaStr &lps = BABrute(ip, port);
|
||||||
BruteUtils::BConDec();
|
//BruteUtils::BConDec();
|
||||||
|
--BrutingThrds;
|
||||||
|
|
||||||
return lps;
|
return lps;
|
||||||
} else {
|
} else {
|
||||||
lopaStr lps{"UNKNOWN", "", ""};
|
lopaStr lps = {"UNKNOWN", "", ""};
|
||||||
return lps;
|
return lps;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -4,30 +4,30 @@
|
|||||||
|
|
||||||
void BruteUtils::BConInc()
|
void BruteUtils::BConInc()
|
||||||
{
|
{
|
||||||
++BA;
|
// ++BA;
|
||||||
#if defined(WIN32) || defined(_WIN32) || defined(__WIN32) && !defined(__CYGWIN__)
|
//#if defined(WIN32) || defined(_WIN32) || defined(__WIN32) && !defined(__CYGWIN__)
|
||||||
__asm
|
//__asm
|
||||||
{
|
// {
|
||||||
lock inc BrutingThrds;
|
// lock inc BrutingThrds;
|
||||||
};
|
// };
|
||||||
#else
|
//#else
|
||||||
asm("lock incl BrutingThrds");
|
// asm("lock incl BrutingThrds");
|
||||||
#endif
|
//#endif
|
||||||
stt->doEmitionUpdateArc(gTargets);
|
// stt->doEmitionUpdateArc(gTargets);
|
||||||
}
|
}
|
||||||
|
|
||||||
void BruteUtils::BConDec()
|
void BruteUtils::BConDec()
|
||||||
{
|
{
|
||||||
if(BrutingThrds > 0)
|
// if(BrutingThrds > 0)
|
||||||
{
|
// {
|
||||||
#if defined(WIN32) || defined(_WIN32) || defined(__WIN32) && !defined(__CYGWIN__)
|
//#if defined(WIN32) || defined(_WIN32) || defined(__WIN32) && !defined(__CYGWIN__)
|
||||||
__asm
|
// __asm
|
||||||
{
|
// {
|
||||||
lock dec BrutingThrds;
|
// lock dec BrutingThrds;
|
||||||
};
|
// };
|
||||||
#else
|
//#else
|
||||||
asm("lock decl BrutingThrds");
|
// asm("lock decl BrutingThrds");
|
||||||
#endif
|
//#endif
|
||||||
}
|
// }
|
||||||
stt->doEmitionUpdateArc(gTargets);
|
// stt->doEmitionUpdateArc(gTargets);
|
||||||
}
|
}
|
||||||
|
@ -61,9 +61,9 @@ int MakePolygonLine(int gWidth)
|
|||||||
|
|
||||||
if(xtx > 74 && xtx < 112)
|
if(xtx > 74 && xtx < 112)
|
||||||
{
|
{
|
||||||
qp = QPointF(xtx, state ? qrand() % 3 + ME2YPOS - BA * 2 - fact3 : ME2YPOS);
|
qp = QPointF(xtx, state ? qrand() % 3 + ME2YPOS - baCount * 2 - fact3 : ME2YPOS);
|
||||||
|
|
||||||
if(BA > 0)
|
if (baCount > 0)
|
||||||
{
|
{
|
||||||
if(xtx < 92 ) fact3+=2;
|
if(xtx < 92 ) fact3+=2;
|
||||||
else fact3-=2;
|
else fact3-=2;
|
||||||
@ -120,7 +120,7 @@ int MakePolygonLine(int gWidth)
|
|||||||
|
|
||||||
AnomC1 = 0;
|
AnomC1 = 0;
|
||||||
WF = 0;
|
WF = 0;
|
||||||
BA = 0;
|
baCount = 0;
|
||||||
Filt = 0;
|
Filt = 0;
|
||||||
Overl = 0;
|
Overl = 0;
|
||||||
Lowl = 0;
|
Lowl = 0;
|
||||||
@ -150,7 +150,7 @@ void DrawerTh_ME2Scanner::run()
|
|||||||
msleep(1000);
|
msleep(1000);
|
||||||
AnomC1 = 0;
|
AnomC1 = 0;
|
||||||
WF = 0;
|
WF = 0;
|
||||||
BA = 0;
|
baCount = 0;
|
||||||
Filt = 0;
|
Filt = 0;
|
||||||
Overl = 0;
|
Overl = 0;
|
||||||
Lowl = 0;
|
Lowl = 0;
|
||||||
|
@ -14,7 +14,7 @@ void DrawerTh_QoSScanner::run()
|
|||||||
lstOfLabels.append(WF);
|
lstOfLabels.append(WF);
|
||||||
lstOfLabels.append(Susp);
|
lstOfLabels.append(Susp);
|
||||||
lstOfLabels.append(Lowl);
|
lstOfLabels.append(Lowl);
|
||||||
lstOfLabels.append(BA);
|
lstOfLabels.append(baCount);
|
||||||
lstOfLabels.append(Overl);
|
lstOfLabels.append(Overl);
|
||||||
lstOfLabels.append(ssh);
|
lstOfLabels.append(ssh);
|
||||||
|
|
||||||
@ -29,7 +29,7 @@ void DrawerTh_QoSScanner::run()
|
|||||||
msleep(500);
|
msleep(500);
|
||||||
AnomC1 = 0;
|
AnomC1 = 0;
|
||||||
WF = 0;
|
WF = 0;
|
||||||
BA = 0;
|
baCount = 0;
|
||||||
Filt = 0;
|
Filt = 0;
|
||||||
Overl = 0;
|
Overl = 0;
|
||||||
Lowl = 0;
|
Lowl = 0;
|
||||||
@ -40,7 +40,7 @@ void DrawerTh_QoSScanner::run()
|
|||||||
|
|
||||||
AnomC1 = 0;
|
AnomC1 = 0;
|
||||||
WF = 0;
|
WF = 0;
|
||||||
BA = 0;
|
baCount = 0;
|
||||||
Filt = 0;
|
Filt = 0;
|
||||||
Overl = 0;
|
Overl = 0;
|
||||||
Lowl = 0;
|
Lowl = 0;
|
||||||
|
@ -104,13 +104,13 @@ void DrawerTh_VoiceScanner::run()
|
|||||||
{
|
{
|
||||||
if(widgetIsHidden == false && tray->isVisible() == false)
|
if(widgetIsHidden == false && tray->isVisible() == false)
|
||||||
{
|
{
|
||||||
makeVoiceLine(Alive, AnomC1, WF, Susp, Lowl, BA, Overl, WF, ssh);
|
makeVoiceLine(Alive, AnomC1, WF, Susp, Lowl, baCount, Overl, WF, ssh);
|
||||||
Alive = 0;
|
Alive = 0;
|
||||||
AnomC1 = 0;
|
AnomC1 = 0;
|
||||||
WF = 0;
|
WF = 0;
|
||||||
Filt = 0;
|
Filt = 0;
|
||||||
Lowl = 0;
|
Lowl = 0;
|
||||||
BA = 0;
|
baCount = 0;
|
||||||
Overl = 0;
|
Overl = 0;
|
||||||
Susp = 0;
|
Susp = 0;
|
||||||
ssh = 0;
|
ssh = 0;
|
||||||
@ -126,7 +126,7 @@ void DrawerTh_VoiceScanner::run()
|
|||||||
WF = 0;
|
WF = 0;
|
||||||
Filt = 0;
|
Filt = 0;
|
||||||
Lowl = 0;
|
Lowl = 0;
|
||||||
BA = 0;
|
baCount = 0;
|
||||||
Overl = 0;
|
Overl = 0;
|
||||||
Susp = 0;
|
Susp = 0;
|
||||||
ssh = 0;
|
ssh = 0;
|
||||||
|
12
FTPAuth.cpp
12
FTPAuth.cpp
@ -13,9 +13,8 @@ bool FTPA::checkOutput(const string *buffer) {
|
|||||||
lopaStr FTPA::FTPBrute(const char *ip, const int port, PathStr *ps) {
|
lopaStr FTPA::FTPBrute(const char *ip, const int port, PathStr *ps) {
|
||||||
string buffer;
|
string buffer;
|
||||||
string lpString;
|
string lpString;
|
||||||
lopaStr lps{"UNKNOWN", "", ""};
|
lopaStr lps = {"UNKNOWN", "", ""};
|
||||||
|
|
||||||
strcpy(lps.login, "UNKNOWN");
|
|
||||||
int res = 0;
|
int res = 0;
|
||||||
int passCounter = 0;
|
int passCounter = 0;
|
||||||
|
|
||||||
@ -68,13 +67,16 @@ lopaStr FTPA::FTPLobby(const char *ip, const int port, PathStr *ps) {
|
|||||||
if(gMaxBrutingThreads > 0) {
|
if(gMaxBrutingThreads > 0) {
|
||||||
while(BrutingThrds >= gMaxBrutingThreads) Sleep(1000);
|
while(BrutingThrds >= gMaxBrutingThreads) Sleep(1000);
|
||||||
|
|
||||||
BruteUtils::BConInc();
|
++baCount;
|
||||||
|
//BruteUtils::BConInc();
|
||||||
|
++BrutingThrds;
|
||||||
const lopaStr &lps = FTPBrute(ip, port, ps);
|
const lopaStr &lps = FTPBrute(ip, port, ps);
|
||||||
BruteUtils::BConDec();
|
--BrutingThrds;
|
||||||
|
//BruteUtils::BConDec();
|
||||||
|
|
||||||
return lps;
|
return lps;
|
||||||
} else {
|
} else {
|
||||||
lopaStr lps{"UNKNOWN", "", ""};;
|
lopaStr lps = {"UNKNOWN", "", ""};;
|
||||||
return lps;
|
return lps;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
11
IPCAuth.cpp
11
IPCAuth.cpp
@ -5,7 +5,7 @@
|
|||||||
|
|
||||||
lopaStr IPC::IPCBrute(const char *ip, int port, char *SPEC)
|
lopaStr IPC::IPCBrute(const char *ip, int port, char *SPEC)
|
||||||
{
|
{
|
||||||
lopaStr lps{"UNKNOWN", "", ""};
|
lopaStr lps = {"UNKNOWN", "", ""};
|
||||||
bool result = true;
|
bool result = true;
|
||||||
char login[128] = {0};
|
char login[128] = {0};
|
||||||
char pass[128] = {0};
|
char pass[128] = {0};
|
||||||
@ -177,13 +177,16 @@ lopaStr IPC::IPCLobby(const char *ip, int port, char *SPEC) {
|
|||||||
if(gMaxBrutingThreads > 0) {
|
if(gMaxBrutingThreads > 0) {
|
||||||
while(BrutingThrds >= gMaxBrutingThreads) Sleep(1000);
|
while(BrutingThrds >= gMaxBrutingThreads) Sleep(1000);
|
||||||
|
|
||||||
BruteUtils::BConInc();
|
//BruteUtils::BConInc();
|
||||||
|
++baCount;
|
||||||
|
++BrutingThrds;
|
||||||
lopaStr lps = IPCBrute(ip, port, SPEC);
|
lopaStr lps = IPCBrute(ip, port, SPEC);
|
||||||
BruteUtils::BConDec();
|
--BrutingThrds;
|
||||||
|
//BruteUtils::BConDec();
|
||||||
|
|
||||||
return lps;
|
return lps;
|
||||||
} else {
|
} else {
|
||||||
lopaStr lps{"UNKNOWN", "", ""};
|
lopaStr lps = {"UNKNOWN", "", ""};
|
||||||
return lps;
|
return lps;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -178,9 +178,11 @@ int SSHAuth::SSHLobby(const char *ip, int port, std::string *buffer)
|
|||||||
const char &banner = _get_ssh_banner(ip, port);
|
const char &banner = _get_ssh_banner(ip, port);
|
||||||
if(strlen(&banner) > 0)
|
if(strlen(&banner) > 0)
|
||||||
{
|
{
|
||||||
BruteUtils::BConInc();
|
//BruteUtils::BConInc();
|
||||||
|
++BrutingThrds;
|
||||||
int res = SSHBrute(ip, port, buffer, &banner);
|
int res = SSHBrute(ip, port, buffer, &banner);
|
||||||
BruteUtils::BConDec();
|
--BrutingThrds;
|
||||||
|
//BruteUtils::BConDec();
|
||||||
return res;
|
return res;
|
||||||
};
|
};
|
||||||
return -1;
|
return -1;
|
||||||
|
@ -23,7 +23,9 @@ void Threader::fireThread(std::string ip, void *func(void)) {
|
|||||||
|
|
||||||
void Threader::cleanUp() {
|
void Threader::cleanUp() {
|
||||||
ready = true;
|
ready = true;
|
||||||
cv.notify_one();
|
cv.notify_all();
|
||||||
|
//Wait for threads to exit correctly
|
||||||
|
Sleep(gTimeOut*1000 + 2000);
|
||||||
std::unique_lock<std::mutex> lk(m);
|
std::unique_lock<std::mutex> lk(m);
|
||||||
lk.unlock();
|
lk.unlock();
|
||||||
lk.release();
|
lk.release();
|
||||||
|
@ -158,7 +158,7 @@ lopaStr WFClass::_WFBrute( const char *ip,
|
|||||||
char *passVal,
|
char *passVal,
|
||||||
char *formVal) {
|
char *formVal) {
|
||||||
|
|
||||||
lopaStr lps{"UNKNOWN", "", ""};
|
lopaStr lps = {"UNKNOWN", "", ""};
|
||||||
|
|
||||||
if(strstri(methodVal, "get") != NULL) {
|
if(strstri(methodVal, "get") != NULL) {
|
||||||
lps = doGetCheck(ip, port, actionVal, userVal, passVal, formVal);
|
lps = doGetCheck(ip, port, actionVal, userVal, passVal, formVal);
|
||||||
|
@ -25,13 +25,17 @@ public:
|
|||||||
while(BrutingThrds >= gMaxBrutingThreads) Sleep(700);
|
while(BrutingThrds >= gMaxBrutingThreads) Sleep(700);
|
||||||
|
|
||||||
++WF;
|
++WF;
|
||||||
BConInc();
|
|
||||||
|
++BrutingThrds;
|
||||||
|
//BConInc();
|
||||||
passCounter = 1;
|
passCounter = 1;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
~WFClass(){
|
~WFClass(){
|
||||||
BConDec();
|
//BConDec();
|
||||||
|
|
||||||
|
--BrutingThrds;
|
||||||
}
|
}
|
||||||
|
|
||||||
lopaStr _WFBrute(const char *ip,
|
lopaStr _WFBrute(const char *ip,
|
||||||
|
@ -35,7 +35,7 @@ extern int found, indexIP, gMode,
|
|||||||
gThreadDelay, AnomC1, Filt, Overl, Lowl, Alive, saved,
|
gThreadDelay, AnomC1, Filt, Overl, Lowl, Alive, saved,
|
||||||
Susp,
|
Susp,
|
||||||
WF,
|
WF,
|
||||||
BA,
|
baCount,
|
||||||
offlines, ssh, globalPinger, gPingTimeout, nickFlag, offlineFlag;
|
offlines, ssh, globalPinger, gPingTimeout, nickFlag, offlineFlag;
|
||||||
extern unsigned int Activity;
|
extern unsigned int Activity;
|
||||||
extern char trcSrv[256], trcScr[256], trcProxy[128], trcPersKey[64],
|
extern char trcSrv[256], trcScr[256], trcProxy[128], trcPersKey[64],
|
||||||
|
@ -2,13 +2,7 @@
|
|||||||
#define EF_H
|
#define EF_H
|
||||||
|
|
||||||
extern std::string toLowerStr(const char *str);
|
extern std::string toLowerStr(const char *str);
|
||||||
extern int recvS(int lSock, char *recvBuffT, int len);
|
|
||||||
extern int sendS(int lSock, char *msg, int len, int mode);
|
|
||||||
extern void UserNickInit();
|
|
||||||
extern void GetNicks();
|
|
||||||
extern int startScan(char* argv);
|
extern int startScan(char* argv);
|
||||||
extern void BConInc();
|
|
||||||
extern void BConDec();
|
|
||||||
extern QString GetNSErrorDefinition(const char *str, const char *defin);
|
extern QString GetNSErrorDefinition(const char *str, const char *defin);
|
||||||
extern void _SaveBackupToFile();
|
extern void _SaveBackupToFile();
|
||||||
extern char* strstri(const char *_Str, const char *_SubStr);
|
extern char* strstri(const char *_Str, const char *_SubStr);
|
||||||
@ -17,7 +11,6 @@ extern void getSubStr(char *src, char *startStr, char *endStr, char *dest, int s
|
|||||||
extern void getSubStrEx(char *src, char *startStr, char *endStr, char *dest, int szDest);
|
extern void getSubStrEx(char *src, char *startStr, char *endStr, char *dest, int szDest);
|
||||||
extern void _SaveBackupToFile();
|
extern void _SaveBackupToFile();
|
||||||
extern char *_findFirst(const char *str, char *delim);
|
extern char *_findFirst(const char *str, char *delim);
|
||||||
//extern int nConnect(char *ip, int port, std::string *buffer);
|
|
||||||
|
|
||||||
|
|
||||||
#endif // EF_H
|
#endif // EF_H
|
||||||
|
48
finder.cpp
48
finder.cpp
@ -61,8 +61,30 @@ char *_findLast(char *str, char *delim)
|
|||||||
char *GetCodePage(const char *str)
|
char *GetCodePage(const char *str)
|
||||||
{
|
{
|
||||||
char cdpg[32] = {0};
|
char cdpg[32] = {0};
|
||||||
char *ptr1 = strstri(str, "<meta ");
|
char *ptr1 = strstri(str, "charset=");
|
||||||
|
|
||||||
|
if (ptr1 != NULL)
|
||||||
|
{
|
||||||
|
char *temp3 = _findFirst((char *)(ptr1 + 8), " \"'\n\r");
|
||||||
|
if (temp3 != NULL)
|
||||||
|
{
|
||||||
|
int ln = (int)(temp3 - ptr1 - 8);
|
||||||
|
if (ln > 16)
|
||||||
|
{
|
||||||
|
return "WTF?";
|
||||||
|
};
|
||||||
|
strncpy(cdpg, (char *)(ptr1 + 8), (ln > 32) ? 32 : ln);
|
||||||
|
if (strstri(cdpg, "%s") != NULL) return "UTF-8";
|
||||||
|
return cdpg;
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
stt->doEmitionRedFoundData("[GetCodePage] [" + QString(temp3).mid(0, 16) + "]");
|
||||||
|
return "NULL";
|
||||||
|
};
|
||||||
|
}
|
||||||
|
|
||||||
|
ptr1 = strstri(str, "<meta ");
|
||||||
if(ptr1 != NULL)
|
if(ptr1 != NULL)
|
||||||
{
|
{
|
||||||
char *ptr2 = strstri(ptr1 + 6, "charset=");
|
char *ptr2 = strstri(ptr1 + 6, "charset=");
|
||||||
@ -159,28 +181,6 @@ char *GetCodePage(const char *str)
|
|||||||
};
|
};
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
||||||
ptr1 = strstri(str, "charset=");
|
|
||||||
if(ptr1 != NULL)
|
|
||||||
{
|
|
||||||
char *temp3 = _findFirst((char *)(ptr1 + 8), " \"'\n\r");
|
|
||||||
if(temp3 != NULL)
|
|
||||||
{
|
|
||||||
int ln = (int)(temp3 - ptr1 - 8);
|
|
||||||
if(ln > 16)
|
|
||||||
{
|
|
||||||
return "WTF?";
|
|
||||||
};
|
|
||||||
strncpy(cdpg, (char *)(ptr1 + 8), (ln > 32) ? 32 : ln );
|
|
||||||
if(strstri(cdpg, "%s") != NULL) return "UTF-8";
|
|
||||||
return cdpg;
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
stt->doEmitionRedFoundData("[GetCodePage] [" + QString(temp3).mid(0, 16) + "]");
|
|
||||||
return "NULL";
|
|
||||||
};
|
|
||||||
}
|
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
return "NULL";
|
return "NULL";
|
||||||
@ -1164,7 +1164,7 @@ void _specWFBrute(const char *ip, int port, const char *buff, int flag, char *pa
|
|||||||
|
|
||||||
void _specWEBIPCAMBrute(const char *ip, int port, char *finalstr, int flag, char *comment, char *cp, int size, char *SPEC)
|
void _specWEBIPCAMBrute(const char *ip, int port, char *finalstr, int flag, char *comment, char *cp, int size, char *SPEC)
|
||||||
{
|
{
|
||||||
lopaStr lps{"UNKNOWN", "", ""};
|
lopaStr lps = {"UNKNOWN", "", ""};
|
||||||
ZeroMemory(lps.login, sizeof(lps.login));
|
ZeroMemory(lps.login, sizeof(lps.login));
|
||||||
ZeroMemory(lps.pass, sizeof(lps.pass));
|
ZeroMemory(lps.pass, sizeof(lps.pass));
|
||||||
ZeroMemory(lps.other, sizeof(lps.other));
|
ZeroMemory(lps.other, sizeof(lps.other));
|
||||||
|
@ -1,3 +1,5 @@
|
|||||||
|
бесплатный хост
|
||||||
|
антивирус
|
||||||
403 forbidden
|
403 forbidden
|
||||||
êóïèòü
|
êóïèòü
|
||||||
X-Adblock-Key
|
X-Adblock-Key
|
||||||
|
13
nesca_3.cpp
13
nesca_3.cpp
@ -2813,9 +2813,12 @@ void nesca_3::mouseMoveEvent(QMouseEvent * event)
|
|||||||
void nesca_3::exitButtonClicked()
|
void nesca_3::exitButtonClicked()
|
||||||
{
|
{
|
||||||
STTTerminate();
|
STTTerminate();
|
||||||
|
while (__savingBackUpFile) Sleep(100);
|
||||||
|
//nCleanup();
|
||||||
#if defined(WIN32) || defined(_WIN32) || defined(__WIN32) && !defined(__CYGWIN__)
|
#if defined(WIN32) || defined(_WIN32) || defined(__WIN32) && !defined(__CYGWIN__)
|
||||||
WSACleanup();
|
WSACleanup();
|
||||||
#endif
|
#endif
|
||||||
|
// stt->terminate();
|
||||||
qApp->quit();
|
qApp->quit();
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -2854,25 +2857,21 @@ void nesca_3::ChangePingerOK(bool val)
|
|||||||
|
|
||||||
void nesca_3::STTTerminate()
|
void nesca_3::STTTerminate()
|
||||||
{
|
{
|
||||||
while (__savingBackUpFile) Sleep(100);
|
|
||||||
importFileName = "";
|
|
||||||
startFlag = false;
|
|
||||||
globalScanFlag = false;
|
globalScanFlag = false;
|
||||||
nCleanup();
|
startFlag = false;
|
||||||
|
importFileName = "";
|
||||||
ui->tabMainWidget->setTabEnabled(0, true);
|
ui->tabMainWidget->setTabEnabled(0, true);
|
||||||
ui->tabMainWidget->setTabEnabled(1, true);
|
ui->tabMainWidget->setTabEnabled(1, true);
|
||||||
ui->tabMainWidget->setTabEnabled(2, true);
|
ui->tabMainWidget->setTabEnabled(2, true);
|
||||||
ui->tabMainWidget->setTabEnabled(3, true);
|
ui->tabMainWidget->setTabEnabled(3, true);
|
||||||
stt->doEmitionUpdateArc(0);
|
|
||||||
BrutingThrds = 0;
|
BrutingThrds = 0;
|
||||||
cons = 0;
|
cons = 0;
|
||||||
|
stt->doEmitionUpdateArc(0);
|
||||||
setButtonStyleArea();
|
setButtonStyleArea();
|
||||||
ui->startScanButton_3->setText("Start");
|
ui->startScanButton_3->setText("Start");
|
||||||
ui->startScanButton_4->setText("Start");
|
ui->startScanButton_4->setText("Start");
|
||||||
ui->importButton->setText("Import&&Scan");
|
ui->importButton->setText("Import&&Scan");
|
||||||
ui->labelStatus_Value->setText("Idle");
|
ui->labelStatus_Value->setText("Idle");
|
||||||
stt->terminate();
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void nesca_3::startScanButtonClicked()
|
void nesca_3::startScanButtonClicked()
|
||||||
|
@ -25,7 +25,7 @@ int gMode;
|
|||||||
int MaxPass = 0, MaxLogin = 0, MaxTags = 0, MaxWFLogin = 0, MaxWFPass = 0, MaxSSHPass = 0;
|
int MaxPass = 0, MaxLogin = 0, MaxTags = 0, MaxWFLogin = 0, MaxWFPass = 0, MaxSSHPass = 0;
|
||||||
int ipsstart[4], ipsend[4],
|
int ipsstart[4], ipsend[4],
|
||||||
overallPorts, flCounter, octet[4];
|
overallPorts, flCounter, octet[4];
|
||||||
int BA = 0;
|
int baCount = 0;
|
||||||
int gPingTimeout = 1;
|
int gPingTimeout = 1;
|
||||||
int gMaxBrutingThreads = 50;
|
int gMaxBrutingThreads = 50;
|
||||||
unsigned int Activity = 0;
|
unsigned int Activity = 0;
|
||||||
@ -358,7 +358,7 @@ void _timer() {
|
|||||||
|
|
||||||
void _tracker() {
|
void _tracker() {
|
||||||
while (true) {
|
while (true) {
|
||||||
while (!trackerOK) Sleep(1000);
|
while (globalScanFlag && !trackerOK) Sleep(1000);
|
||||||
|
|
||||||
if (!globalScanFlag && jsonArr->size() == 0) break;
|
if (!globalScanFlag && jsonArr->size() == 0) break;
|
||||||
char rBuffT[250000] = { 0 };
|
char rBuffT[250000] = { 0 };
|
||||||
@ -1592,66 +1592,40 @@ int _getChunkCount(char *data) {
|
|||||||
return secondPos - firstPos + 1;
|
return secondPos - firstPos + 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
void ConInc()
|
|
||||||
{
|
|
||||||
#if defined(WIN32) || defined(_WIN32) || defined(__WIN32) && !defined(__CYGWIN__)
|
|
||||||
__asm
|
|
||||||
{
|
|
||||||
lock inc cons;
|
|
||||||
};
|
|
||||||
#else
|
|
||||||
asm("lock; incl cons");
|
|
||||||
#endif
|
|
||||||
}
|
|
||||||
void ConDec()
|
|
||||||
{
|
|
||||||
if (cons > 0)
|
|
||||||
{
|
|
||||||
#if defined(WIN32) || defined(_WIN32) || defined(__WIN32) && !defined(__CYGWIN__)
|
|
||||||
__asm
|
|
||||||
{
|
|
||||||
lock dec cons;
|
|
||||||
};
|
|
||||||
#else
|
|
||||||
asm("lock; decl cons");
|
|
||||||
#endif
|
|
||||||
|
|
||||||
};
|
|
||||||
stt->doEmitionUpdateArc(gTargets);
|
|
||||||
}
|
|
||||||
|
|
||||||
void _connect() {
|
void _connect() {
|
||||||
|
|
||||||
std::string ip = "";
|
std::string ip = "";
|
||||||
|
std::unique_lock<std::mutex> lk;
|
||||||
while (globalScanFlag) {
|
while (globalScanFlag) {
|
||||||
std::unique_lock<std::mutex> lk(Threader::m);
|
lk = std::unique_lock<std::mutex>(Threader::m);
|
||||||
Threader::cv.wait(lk, []{return Threader::ready; });
|
Threader::cv.wait(lk, []{return Threader::ready; });
|
||||||
|
|
||||||
if (!globalScanFlag || Threader::threadId > gThreads) {
|
if (!globalScanFlag || Threader::threadId > gThreads) {
|
||||||
--Threader::threadId;
|
--Threader::threadId;
|
||||||
Threader::ready = false;
|
|
||||||
lk.unlock();
|
lk.unlock();
|
||||||
Threader::cv.notify_one();
|
Threader::ready = true;
|
||||||
|
Threader::cv.notify_all();
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Threader::ready = false;
|
||||||
|
|
||||||
if (!Threader::ipQueue.empty()) {
|
if (!Threader::ipQueue.empty()) {
|
||||||
ip = Threader::ipQueue.front();
|
ip = Threader::ipQueue.front();
|
||||||
Threader::ipQueue.pop();
|
Threader::ipQueue.pop();
|
||||||
Threader::ready = false;
|
|
||||||
lk.unlock();
|
lk.unlock();
|
||||||
Threader::cv.notify_one();
|
|
||||||
|
|
||||||
++ipCounter;
|
++ipCounter;
|
||||||
ConInc();
|
|
||||||
|
++cons;
|
||||||
for (int i = 0; i <= overallPorts; ++i)
|
for (int i = 0; i <= overallPorts; ++i)
|
||||||
{
|
{
|
||||||
if (!globalScanFlag) break;
|
if (!globalScanFlag) break;
|
||||||
if (Connector::_ConnectToPort((char*)ip.c_str(), portArr[i]) == -2) break;
|
if (Connector::_ConnectToPort((char*)ip.c_str(), portArr[i]) == -2) break;
|
||||||
};
|
};
|
||||||
ConDec();
|
--cons;
|
||||||
}
|
}
|
||||||
|
else lk.unlock();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -1749,7 +1723,7 @@ int startScan(char* args) {
|
|||||||
horLineFlag = false;
|
horLineFlag = false;
|
||||||
flCounter = 0;
|
flCounter = 0;
|
||||||
PieAnomC1 = 0, PieWF = 0, PieBA = 0, PieSusp = 0, PieLowl = 0, PieSSH = 0;
|
PieAnomC1 = 0, PieWF = 0, PieBA = 0, PieSusp = 0, PieLowl = 0, PieSSH = 0;
|
||||||
AnomC1 = 0, BA = 0, Filt = 0, Overl = 0, Lowl = 0, Alive = 0, Activity = 0, saved = 0, Susp = 0, WF = 0, offlines = 0;
|
AnomC1 = 0, baCount = 0, Filt = 0, Overl = 0, Lowl = 0, Alive = 0, Activity = 0, saved = 0, Susp = 0, WF = 0, offlines = 0;
|
||||||
BrutingThrds = 0;
|
BrutingThrds = 0;
|
||||||
found = 0;
|
found = 0;
|
||||||
gTargets = 0;
|
gTargets = 0;
|
||||||
@ -2073,8 +2047,10 @@ int startScan(char* args) {
|
|||||||
stt->doEmitionGreenFoundData("Done. Saved: " + QString::number(saved) + "; Alive: " + QString::number(found) + ".");
|
stt->doEmitionGreenFoundData("Done. Saved: " + QString::number(saved) + "; Alive: " + QString::number(found) + ".");
|
||||||
stt->doEmitionChangeStatus("Idle");
|
stt->doEmitionChangeStatus("Idle");
|
||||||
|
|
||||||
Sleep(1000); //Wait for lock release
|
while (__savingBackUpFile) Sleep(100);
|
||||||
|
nCleanup();
|
||||||
stt->doEmitionKillSttThread();
|
stt->doEmitionKillSttThread();
|
||||||
|
//stt->terminate();
|
||||||
}
|
}
|
||||||
|
|
||||||
void nCleanup(){
|
void nCleanup(){
|
||||||
|
@ -13,7 +13,7 @@ void PieStat::run()
|
|||||||
psTh->doEmitUpdatePie();
|
psTh->doEmitUpdatePie();
|
||||||
AnomC1 = 0;
|
AnomC1 = 0;
|
||||||
WF = 0;
|
WF = 0;
|
||||||
BA = 0;
|
baCount = 0;
|
||||||
Filt = 0;
|
Filt = 0;
|
||||||
Overl = 0;
|
Overl = 0;
|
||||||
Lowl = 0;
|
Lowl = 0;
|
||||||
|
Loading…
Reference in New Issue
Block a user