From b70c77ecbda699f004bdf281a4d259721ae6a414 Mon Sep 17 00:00:00 2001 From: cora48 Date: Mon, 23 Mar 2015 12:06:30 +0300 Subject: [PATCH] DNS mode session restoration fix --- externData.h | 2 +- nesca_3.cpp | 10 ++++------ nesca_3.h | 2 +- nesca_startModule.cpp | 45 +++++++++++++++---------------------------- 4 files changed, 21 insertions(+), 38 deletions(-) diff --git a/externData.h b/externData.h index c457dd3..8e1e8ea 100644 --- a/externData.h +++ b/externData.h @@ -43,7 +43,7 @@ extern unsigned int Activity; extern char trcSrv[256], trcScr[256], trcProxy[128], trcPersKey[64], ircServer[32], ircPort[32], ircProxy[64], ircProxyPort[8], ircNick[32], trcPort[32], trcSrvPortLine[32], saveEndIP[128], - gRange[128], gFirstDom[128], gPorts[65536], endIP2[128], + gRange[128], gFirstDom[128], gPorts[65536], gVER[16], gProxyIP[64], gProxyPort[8], currentIP[MAX_ADDR_LEN], diff --git a/nesca_3.cpp b/nesca_3.cpp index c5d4d57..89c3b4f 100644 --- a/nesca_3.cpp +++ b/nesca_3.cpp @@ -2941,7 +2941,6 @@ void nesca_3::ConnectEvrthng() } void _LoadPersInfoToLocalVars(int savedTabIndex) { - ZeroMemory(endIP2, sizeof(endIP2)); ZeroMemory(top_level_domain, sizeof(top_level_domain)); ZeroMemory(gPorts, sizeof(gPorts)); @@ -2957,16 +2956,15 @@ void _LoadPersInfoToLocalVars(int savedTabIndex) { QList splittedTargetLine = targetLine.split("-"); strcpy(currentIP, splittedTargetLine[0].toLocal8Bit().data()); strcpy(finalIP, splittedTargetLine[1].toLocal8Bit().data()); - strcpy(endIP2, ui->ipLine->text().toLocal8Bit().data()); } } else { if(ui->ipLine->text().indexOf("/") < 0) { - strcpy(endIP2, ui->ipLine->text().toLocal8Bit().data()); - strcat(endIP2, "-"); - strcat(endIP2, ui->ipLine->text().toLocal8Bit().data()); + strcpy(currentIP, ui->ipLine->text().toLocal8Bit().data()); + strcat(currentIP, "-"); + strcat(currentIP, ui->ipLine->text().toLocal8Bit().data()); }; }; @@ -2978,7 +2976,7 @@ void _LoadPersInfoToLocalVars(int savedTabIndex) { gMode = 1; gThreads = ui->lineEditThread->text().toInt(); - strcpy(endIP2, ui->lineEditStartIPDNS->text().toLocal8Bit().data()); + strcpy(currentIP, ui->lineEditStartIPDNS->text().toLocal8Bit().data()); strcpy(top_level_domain, ui->lineILVL->text().toLocal8Bit().data()); strncpy(gPorts, ("-p" + ui->lineEditPort->text()).toLocal8Bit().data(), 65536); gPorts[ui->lineEditPort->text().size()] = '\0'; diff --git a/nesca_3.h b/nesca_3.h index 7c8a095..9715826 100644 --- a/nesca_3.h +++ b/nesca_3.h @@ -29,7 +29,7 @@ extern bool widgetIsHidden, IRCLogToggled, blinkFlag, disableBlink, debugFileOK, smBit_8, smBit_7, smBit_6, smBit_5, smBit_4, smBit_3, smBit_2, smBit_1, printDelimiter; extern float QoSStep; extern int MaxDataVal; -extern char endIP2[128], inputStr[256]; +extern char inputStr[256]; extern SOCKET lSock; extern QVector vAlivLst, vAnomLst, vWFLst, vSuspLst, vLowlLst, vBALst, vSSHLst, vOvrlLst, actLst; diff --git a/nesca_startModule.cpp b/nesca_startModule.cpp index a8adf0c..7253897 100644 --- a/nesca_startModule.cpp +++ b/nesca_startModule.cpp @@ -32,7 +32,6 @@ unsigned int Activity = 0; unsigned char **ipsstartfl = NULL, **ipsendfl = NULL, **starterIP = NULL; double ips = 0; char top_level_domain[128] = {0}; -char endIP2[128] = {0}; char **GlobalNegatives = 0; char **loginLst, **passLst; char **wfLoginLst, **wfPassLst; @@ -805,14 +804,10 @@ void _connect() { } } -void verboseProgress(long long unsigned int target, const char *ip) { - +inline void progressOutput(long long unsigned int target) { char targetNPers[128] = {0}; float percent = (gTargetsOverall != 0 ? (100 - target/(double)gTargetsOverall * 100) : 0); - stt->doEmitionIPRANGE(QString(ip)); - strcpy(currentIP, ip); - sprintf(targetNPers, "%Lu (%.1f%%)", target, percent); stt->doEmitionTargetsLeft(QString(targetNPers)); @@ -820,34 +815,26 @@ void verboseProgress(long long unsigned int target, const char *ip) { sprintf(metaPercent, "%.1f", percent); } +void verboseProgress(long long unsigned int target, const char *ip) { + + stt->doEmitionIPRANGE(QString(ip)); + progressOutput(target); +} void verboseProgressDNS(long long unsigned int target, const char *ip, const char *TLD) { - char targetNPers[128] = { 0 }; - float percent = (gTargetsOverall != 0 ? (100 - target / (double)gTargetsOverall * 100) : 0); - - stt->doEmitionIPRANGE(QString(ip) + QString(TLD)); - strcpy(currentIP, ip); - - sprintf(targetNPers, "%Lu (%.1f%%)", target, percent); - stt->doEmitionTargetsLeft(QString(targetNPers)); - - sprintf(metaTargets, "%Lu", target); - sprintf(metaPercent, "%.1f", - percent); + stt->doEmitionIPRANGE(QString(ip) + QString(TLD)); + progressOutput(target); } void _passLoginLoader() { MaxLogin = 0; MaxPass = 0; - FILE *loginList; - FILE *passList; - char buffFG[32] = {0}; int i = 0; - loginList = fopen("login.txt", "r"); - passList = fopen("pass.txt", "r"); + FILE *loginList = fopen("login.txt", "r"); + FILE *passList = fopen("pass.txt", "r"); if(passList != NULL && loginList != NULL) { @@ -1898,7 +1885,6 @@ int ParseArgs(int argc, char *argv[]) { }; strcpy(saveEndIP, gRange); - strcpy(endIP2, gRange); strcpy(finalIP, strstr(gRange, "-") + 1); } else if(gMode == 1) @@ -1906,14 +1892,12 @@ int ParseArgs(int argc, char *argv[]) { if(strstr(argv[2], "/") != NULL) { strcpy(gRange, argv[2]); - strcpy(saveEndIP, argv[2]); - strcpy(endIP2, argv[2]); + strcpy(saveEndIP, argv[2]); } else { strcpy(gRange, argv[2]); - strcpy(saveEndIP, gRange); - strcpy(endIP2, gRange); + strcpy(saveEndIP, gRange); }; }; @@ -2037,8 +2021,9 @@ int _getChunkCount(char *data) { } int _GetDNSFromMask(char *mask, char *saveMask, char *saveMaskEnder) { + if(strstr(mask, "[") != NULL) - { + { char maskEnd[1024] = {0}; char maskRes[1024] = {0}; char *ptr1 = strstr(mask, "["); @@ -2095,7 +2080,7 @@ int _GetDNSFromMask(char *mask, char *saveMask, char *saveMaskEnder) { } else { - strcpy(endIP2, saveMask); + strcpy(currentIP, saveMask); while(cons >= gThreads && globalScanFlag) Sleep(300); if(!globalScanFlag) return 0;