mirror of
https://github.com/ChronosX88/nesca.git
synced 2024-11-23 18:52:19 +00:00
Severe bug: unable to continue import-rescan after stop. Committing fix-class carcass.
This commit is contained in:
parent
546e5af467
commit
efec84a9e7
5
NescaLogicStarter.cpp
Normal file
5
NescaLogicStarter.cpp
Normal file
@ -0,0 +1,5 @@
|
||||
#include "NescaLogicStarter.h"
|
||||
|
||||
int NLC::startScan(const char* args){
|
||||
|
||||
}
|
75
NescaLogicStarter.h
Normal file
75
NescaLogicStarter.h
Normal file
@ -0,0 +1,75 @@
|
||||
#ifndef NESCALOGICSTARTER_H
|
||||
#define NESCALOGICSTARTER_H
|
||||
|
||||
class NLC {
|
||||
public:
|
||||
NLC(){
|
||||
|
||||
}
|
||||
~NLC(){
|
||||
/*FileUpdater::FUClear();
|
||||
Threader::cleanUp();
|
||||
curl_global_cleanup();
|
||||
|
||||
while (__savingBackUpFile) Sleep(100);
|
||||
|
||||
if (loginLst != NULL)
|
||||
{
|
||||
for (int i = 0; i < MaxLogin; ++i) delete[]loginLst[i];
|
||||
delete[]loginLst;
|
||||
loginLst = NULL;
|
||||
};
|
||||
if (passLst != NULL)
|
||||
{
|
||||
for (int i = 0; i < MaxPass; ++i) delete[]passLst[i];
|
||||
delete[]passLst;
|
||||
passLst = NULL;
|
||||
};
|
||||
if (GlobalNegatives != NULL)
|
||||
{
|
||||
for (int i = 0; i < GlobalNegativeSize; ++i) delete[]GlobalNegatives[i];
|
||||
delete[]GlobalNegatives;
|
||||
GlobalNegatives = NULL;
|
||||
};
|
||||
if (wfPassLst != NULL)
|
||||
{
|
||||
for (int i = 0; i < MaxWFPass; ++i) delete[]wfPassLst[i];
|
||||
delete[]wfPassLst;
|
||||
wfPassLst = NULL;
|
||||
};
|
||||
if (wfLoginLst != NULL)
|
||||
{
|
||||
for (int i = 0; i < MaxWFLogin; ++i) delete[]wfLoginLst[i];
|
||||
delete[]wfLoginLst;
|
||||
wfLoginLst = NULL;
|
||||
};
|
||||
if (sshlpLst != NULL)
|
||||
{
|
||||
for (int i = 0; i < MaxSSHPass; ++i) delete[]sshlpLst[i];
|
||||
delete[]sshlpLst;
|
||||
sshlpLst = NULL;
|
||||
};
|
||||
if (ipsstartfl != NULL)
|
||||
{
|
||||
for (int i = 0; i < flCounter; ++i) delete[]ipsstartfl[i];
|
||||
delete[]ipsstartfl;
|
||||
ipsstartfl = NULL;
|
||||
};
|
||||
if (ipsendfl != NULL)
|
||||
{
|
||||
for (int i = 0; i < flCounter; ++i) delete[]ipsendfl[i];
|
||||
delete[]ipsendfl;
|
||||
ipsendfl = NULL;
|
||||
};
|
||||
if (starterIP != NULL)
|
||||
{
|
||||
for (int i = 0; i < flCounter; ++i) delete[]starterIP[i];
|
||||
delete[]starterIP;
|
||||
starterIP = NULL;
|
||||
};*/
|
||||
}
|
||||
int startScan(const char* args);
|
||||
|
||||
};
|
||||
|
||||
#endif // NESCALOGICSTARTER_H
|
14
nesca_3.cpp
14
nesca_3.cpp
@ -1325,7 +1325,6 @@ void nesca_3::importAndScan()
|
||||
if(stopFirst == false)
|
||||
{
|
||||
stopFirst = true;
|
||||
globalScanFlag = false;
|
||||
ui->importButton->setStyleSheet(
|
||||
" QPushButton {"
|
||||
"background-color: qlineargradient(spread:none, x1:1, y1:0, x2:1, y2:1, stop:0.681818 rgba(0, 0, 0, 250), stop:1 rgba(255, 255, 255, 130));"
|
||||
@ -1340,7 +1339,6 @@ void nesca_3::importAndScan()
|
||||
}
|
||||
else
|
||||
{
|
||||
globalScanFlag = false;
|
||||
ui->importButton->setStyleSheet(
|
||||
" QPushButton {"
|
||||
"background-color: qlineargradient(spread:none, x1:1, y1:0, x2:1, y2:1, stop:0.681818 rgba(0, 0, 0, 250), stop:1 rgba(255, 255, 255, 130));"
|
||||
@ -2076,7 +2074,6 @@ void nesca_3::IPScanSeq()
|
||||
|
||||
stt->start();
|
||||
startFlag = true;
|
||||
globalScanFlag = true;
|
||||
ui->startScanButton_3->setText("Stop");
|
||||
ui->startScanButton_3->setStyleSheet(
|
||||
" QPushButton {"
|
||||
@ -2156,7 +2153,6 @@ void nesca_3::DNSScanSeq()
|
||||
|
||||
stt->start();
|
||||
startFlag = true;
|
||||
globalScanFlag = true;
|
||||
ui->startScanButton_4->setText("Stop");
|
||||
ui->startScanButton_4->setStyleSheet(
|
||||
" QPushButton {"
|
||||
@ -2193,10 +2189,9 @@ void nesca_3::ImportScanSeq()
|
||||
ui->tabMainWidget->setTabEnabled(0, false);
|
||||
ui->tabMainWidget->setTabEnabled(1, false);
|
||||
|
||||
saveOptions();
|
||||
_LoadPersInfoToLocalVars(savedTabIndex);
|
||||
strcpy(inputStr, ("DUMMY|-f|" + fileName + "|" + ui->importThreads->text() + "|-p" + ui->importPorts->text().replace(" ", "")).toLocal8Bit().data());
|
||||
|
||||
globalScanFlag = true;
|
||||
stt->start();
|
||||
startFlag = true;
|
||||
stopFirst = false;
|
||||
@ -2814,11 +2809,9 @@ void nesca_3::exitButtonClicked()
|
||||
{
|
||||
STTTerminate();
|
||||
while (__savingBackUpFile) Sleep(100);
|
||||
//nCleanup();
|
||||
#if defined(WIN32) || defined(_WIN32) || defined(__WIN32) && !defined(__CYGWIN__)
|
||||
WSACleanup();
|
||||
#endif
|
||||
// stt->terminate();
|
||||
qApp->quit();
|
||||
}
|
||||
|
||||
@ -2865,12 +2858,11 @@ void nesca_3::STTTerminate()
|
||||
ui->tabMainWidget->setTabEnabled(2, true);
|
||||
ui->tabMainWidget->setTabEnabled(3, true);
|
||||
BrutingThrds = 0;
|
||||
cons = 0;
|
||||
stt->doEmitionUpdateArc(0);
|
||||
setButtonStyleArea();
|
||||
stt->doEmitionUpdateArc(0);
|
||||
ui->startScanButton_3->setText("Start");
|
||||
ui->startScanButton_4->setText("Start");
|
||||
ui->importButton->setText("Import&&Scan");
|
||||
ui->importButton->setText("Import");
|
||||
ui->labelStatus_Value->setText("Idle");
|
||||
}
|
||||
|
||||
|
@ -309,8 +309,10 @@ void _SaveBackupToFile()
|
||||
ZeroMemory(saveBuffer, strlen(saveBuffer));
|
||||
}
|
||||
|
||||
bool saverRunning = false;
|
||||
void _saver()
|
||||
{
|
||||
saverRunning = true;
|
||||
Sleep(1000);
|
||||
while (globalScanFlag)
|
||||
{
|
||||
@ -319,9 +321,12 @@ void _saver()
|
||||
__savingBackUpFile = false;
|
||||
Sleep(10000);
|
||||
};
|
||||
saverRunning = false;
|
||||
}
|
||||
|
||||
bool timerRunning = false;
|
||||
void _timer() {
|
||||
timerRunning = true;
|
||||
char dbuffer[32] = { 0 }, timeLeft[64] = { 0 }, b[32] = { 0 };
|
||||
int ticks = 0;
|
||||
int ovrlIPs = 0;
|
||||
@ -354,9 +359,12 @@ void _timer() {
|
||||
|
||||
Sleep(1000);
|
||||
};
|
||||
timerRunning = false;
|
||||
}
|
||||
|
||||
bool trackerRunning = false;
|
||||
void _tracker() {
|
||||
trackerRunning = true;
|
||||
while (true) {
|
||||
while (globalScanFlag && !trackerOK) Sleep(1000);
|
||||
|
||||
@ -710,6 +718,8 @@ void _tracker() {
|
||||
|
||||
CSSOCKET(sock);
|
||||
}
|
||||
|
||||
trackerRunning = false;
|
||||
}
|
||||
|
||||
unsigned long int numOfIps(int ipsstart[], int ipsend[]) {
|
||||
@ -1623,7 +1633,8 @@ void _connect() {
|
||||
if (!globalScanFlag) break;
|
||||
if (Connector::_ConnectToPort((char*)ip.c_str(), portArr[i]) == -2) break;
|
||||
};
|
||||
if (cons > 0) --cons;
|
||||
//if (cons > 0) --cons;
|
||||
--cons;
|
||||
stt->doEmitionUpdateArc(gThreads);
|
||||
}
|
||||
else lk.unlock();
|
||||
@ -1709,12 +1720,18 @@ void runAuxiliaryThreads() {
|
||||
std::thread lpThread(FileUpdater::updateLists);
|
||||
lpThread.detach();
|
||||
}
|
||||
std::thread trackerThread(_tracker);
|
||||
trackerThread.detach();
|
||||
std::thread timerThread(_timer);
|
||||
timerThread.detach();
|
||||
std::thread saverThread(_saver);
|
||||
saverThread.detach();
|
||||
if (!trackerRunning) {
|
||||
std::thread trackerThread(_tracker);
|
||||
trackerThread.detach();
|
||||
}
|
||||
if (!timerRunning) {
|
||||
std::thread timerThread(_timer);
|
||||
timerThread.detach();
|
||||
}
|
||||
if (!saverRunning) {
|
||||
std::thread saverThread(_saver);
|
||||
saverThread.detach();
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@ -1768,6 +1785,7 @@ int startScan(char* args) {
|
||||
return -1;
|
||||
};
|
||||
|
||||
globalScanFlag = true;
|
||||
runAuxiliaryThreads();
|
||||
|
||||
if (gMode == 0)
|
||||
@ -2048,10 +2066,8 @@ int startScan(char* args) {
|
||||
stt->doEmitionGreenFoundData("Done. Saved: " + QString::number(saved) + "; Alive: " + QString::number(found) + ".");
|
||||
stt->doEmitionChangeStatus("Idle");
|
||||
|
||||
while (__savingBackUpFile) Sleep(100);
|
||||
nCleanup();
|
||||
stt->doEmitionKillSttThread();
|
||||
//stt->terminate();
|
||||
}
|
||||
|
||||
void nCleanup(){
|
||||
@ -2059,6 +2075,8 @@ void nCleanup(){
|
||||
Threader::cleanUp();
|
||||
curl_global_cleanup();
|
||||
|
||||
while (__savingBackUpFile) Sleep(100);
|
||||
|
||||
if (loginLst != NULL)
|
||||
{
|
||||
for (int i = 0; i < MaxLogin; ++i) delete[]loginLst[i];
|
||||
|
Loading…
Reference in New Issue
Block a user