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

View File

@ -10,9 +10,9 @@
class MainStarter {
private: char dnsTarget[256];
int ipsstart[4], ipsend[4];
unsigned int **ipsstartfl = NULL, **ipsendfl = NULL;
static unsigned int **ipsstartfl, **ipsendfl;
unsigned long ip1, ip2;
int gflIndex = 0;
static int gflIndex;
private:
void startIPScan();
@ -25,6 +25,8 @@ public:
static std::vector<int> portVector;
static int flCounter;
static bool savingBackUpFile;
void saveBackupToFile();
void saveBK();
public:
MainStarter()
@ -113,7 +115,6 @@ public:
void unBlockButtons();
void runAuxiliaryThreads();
void saver();
void saveBackupToFile();
int fileLoader(const char *fileName);
static void createResultFiles();
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
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, "lapassword") != -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;
int nesca_3::addBARow(QString ip, QString loginPass, QString percentage) {
if (!globalScanFlag) return -1;
while (isBAModelLocked) Sleep(10);
isBAModelLocked = true;
BAModel->appendRow(setRow(ip, loginPass, percentage));