Randomizer fixes

This commit is contained in:
cora32 2015-08-22 23:55:40 +03:00
parent 72826577b3
commit 726bb1ab7e
4 changed files with 42 additions and 27 deletions

View File

@ -31,6 +31,9 @@ bool gPingNScan = false;
std::atomic<int> cons = 0, BrutingThrds = 0, gThreads; std::atomic<int> cons = 0, BrutingThrds = 0, gThreads;
std::vector<int> MainStarter::portVector; std::vector<int> MainStarter::portVector;
int MainStarter::flCounter = 0; int MainStarter::flCounter = 0;
int MainStarter::gflIndex = 0;
unsigned int **MainStarter::ipsstartfl = NULL;
unsigned int **MainStarter::ipsendfl = NULL;
bool MainStarter::savingBackUpFile = false; bool MainStarter::savingBackUpFile = false;
QJsonArray *jsonArr = new QJsonArray(); QJsonArray *jsonArr = new QJsonArray();
bool horLineFlag = false; bool horLineFlag = false;
@ -368,7 +371,7 @@ void MainStarter::saveBackupToFile()
{ {
if (!saveBackup) return; if (!saveBackup) return;
FILE *savingFile = fopen("tempIPLst.bk", "w"); FILE *savingFile = fopen("tempIPLst.bk", "w");
if (savingFile != NULL) if (NULL != savingFile)
{ {
if (gflIndex < MainStarter::flCounter) { if (gflIndex < MainStarter::flCounter) {
sprintf(ipRange, "%d.%d.%d.%d-%d.%d.%d.%d\n", sprintf(ipRange, "%d.%d.%d.%d-%d.%d.%d.%d\n",
@ -483,15 +486,19 @@ void MainStarter::saveBackupToFile()
} }
bool saverRunning = false; bool saverRunning = false;
void MainStarter::saveBK() {
while (savingBackUpFile) Sleep(400);
savingBackUpFile = true;
saveBackupToFile();
savingBackUpFile = false;
}
void MainStarter::saver() void MainStarter::saver()
{ {
saverRunning = true; saverRunning = true;
Sleep(1000); Sleep(1000);
while (saveBackup && globalScanFlag) while (saveBackup && globalScanFlag)
{ {
savingBackUpFile = true; saveBK();
saveBackupToFile();
savingBackUpFile = false;
Sleep(10000); Sleep(10000);
}; };
saverRunning = false; saverRunning = false;
@ -1365,6 +1372,10 @@ int thread_cleanup(void)
void MainStarter::start(const char* targets, const char* ports) { void MainStarter::start(const char* targets, const char* ports) {
std::srand(std::time(NULL)); std::srand(std::time(NULL));
MainStarter::flCounter = 0;
MainStarter::gflIndex = 0;
MainStarter::ipsstartfl = NULL;
MainStarter::ipsendfl = NULL;
HikVis::hikCounter = 0; HikVis::hikCounter = 0;
HikVis::rviCounter = 0; HikVis::rviCounter = 0;
saveBackup = true; saveBackup = true;
@ -1390,7 +1401,7 @@ void MainStarter::start(const char* targets, const char* ports) {
stt->doEmitionYellowFoundData("Stopping threads..."); stt->doEmitionYellowFoundData("Stopping threads...");
while (cons > 0 || jsonArr->size() > 0) Sleep(2000); while (cons > 0 || jsonArr->size() > 0) Sleep(2000);
saveBackupToFile(); MainStarter::saveBK();
saveBackup = false; saveBackup = false;
thread_cleanup(); thread_cleanup();

View File

@ -10,9 +10,9 @@
class MainStarter { class MainStarter {
private: char dnsTarget[256]; private: char dnsTarget[256];
int ipsstart[4], ipsend[4]; int ipsstart[4], ipsend[4];
unsigned int **ipsstartfl = NULL, **ipsendfl = NULL; static unsigned int **ipsstartfl, **ipsendfl;
unsigned long ip1, ip2; unsigned long ip1, ip2;
int gflIndex = 0; static int gflIndex;
private: private:
void startIPScan(); void startIPScan();
@ -25,6 +25,8 @@ public:
static std::vector<int> portVector; static std::vector<int> portVector;
static int flCounter; static int flCounter;
static bool savingBackUpFile; static bool savingBackUpFile;
void saveBackupToFile();
void saveBK();
public: public:
MainStarter() MainStarter()
@ -113,7 +115,6 @@ public:
void unBlockButtons(); void unBlockButtons();
void runAuxiliaryThreads(); void runAuxiliaryThreads();
void saver(); void saver();
void saveBackupToFile();
int fileLoader(const char *fileName); int fileLoader(const char *fileName);
static void createResultFiles(); static void createResultFiles();
void start(const char* targets, const char* ports); void start(const char* targets, const char* ports);

View File

@ -354,7 +354,9 @@ int sharedDetector(const char * ip, int port, const std::string *buffcpy, const
) return 33; //GEO web ip cam ) return 33; //GEO web ip cam
if(Utils::ustrstr(buffcpy, "hikvision-webs") != -1 if(Utils::ustrstr(buffcpy, "hikvision-webs") != -1
|| (Utils::ustrstr(buffcpy, "hikvision digital") != -1 || (
(Utils::ustrstr(buffcpy, "hikvision digital") != -1
|| Utils::ustrstr(buffcpy, "doc/page/login.asp") != -1)
&& Utils::ustrstr(buffcpy, "dvrdvs-webs") != -1) && Utils::ustrstr(buffcpy, "dvrdvs-webs") != -1)
|| (Utils::ustrstr(buffcpy, "lapassword") != -1 || (Utils::ustrstr(buffcpy, "lapassword") != -1
&& Utils::ustrstr(buffcpy, "lausername") != -1 && Utils::ustrstr(buffcpy, "lausername") != -1

View File

@ -2158,6 +2158,7 @@ QList<QStandardItem *> setRow(QString ip, QString loginPass, QString percentage)
} }
std::atomic<bool> isBAModelLocked = false; std::atomic<bool> isBAModelLocked = false;
int nesca_3::addBARow(QString ip, QString loginPass, QString percentage) { int nesca_3::addBARow(QString ip, QString loginPass, QString percentage) {
if (!globalScanFlag) return -1;
while (isBAModelLocked) Sleep(10); while (isBAModelLocked) Sleep(10);
isBAModelLocked = true; isBAModelLocked = true;
BAModel->appendRow(setRow(ip, loginPass, percentage)); BAModel->appendRow(setRow(ip, loginPass, percentage));