diff --git a/ActivityDrawerTh_HorNet.cpp b/ActivityDrawerTh_HorNet.cpp index eb24e3b..cd7b11e 100644 --- a/ActivityDrawerTh_HorNet.cpp +++ b/ActivityDrawerTh_HorNet.cpp @@ -1,4 +1,5 @@ #include "ActivityDrawerTh_HorNet.h" +#include "externData.h" void ActivityDrawerTh_HorNet::doEmitDrawActivityLine(QString data) { diff --git a/CheckKey_Th.cpp b/CheckKey_Th.cpp index 317bfda..05ff886 100644 --- a/CheckKey_Th.cpp +++ b/CheckKey_Th.cpp @@ -2,6 +2,9 @@ #include "CheckKey_Th.h" #include "CheckProxy_Th.h" #include "STh.h" +#include "externData.h" +#include "externFunctions.h" + int emitIfOK = -1; int KeyCheckerMain() { @@ -204,9 +207,9 @@ int KeyCheckerMain() else if(strstr(msg, "400 Bad Request") != NULL) { #pragma region QTGUI_Area - QString errorDef = GetNSErrorDefinition(msg, "notify"); - if(errorDef == "Invalid access key") stt->doEmitionYellowFoundData("[NS-Track] [Key is unauthorized] A valid key is required."); - else stt->doEmitionYellowFoundData("[NS-Track] -FAIL! [400 Bad Request : " + GetNSErrorDefinition(msg, "notify") + "]"); + QString errorDef = GetNSErrorDefinition(msg, "notify"); + if(errorDef == "Invalid access key") stt->doEmitionYellowFoundData("[NS-Track] [Key is unauthorized] A valid key is required."); + else stt->doEmitionYellowFoundData("[NS-Track] -FAIL! [400 Bad Request : " + GetNSErrorDefinition(msg, "notify") + "]"); #pragma endregion closesocket(sock); return -1; diff --git a/CheckProxy_Th.cpp b/CheckProxy_Th.cpp index 4b86a08..187534c 100644 --- a/CheckProxy_Th.cpp +++ b/CheckProxy_Th.cpp @@ -1,4 +1,5 @@ #include "CheckProxy_Th.h" +#include "externData.h" void CheckProxy_Th::doEmitChangeRedIRCData(QString str) { @@ -23,7 +24,6 @@ void CheckProxy_Th::doEmitChangeRawIRCDataOut(QString str) void CheckProxyLogic() { - destroychPThFlag = false; QString str1 = ui->ircProxyPort->text(); QString str2 = ui->ircProxy->text(); strcpy(ircProxy, str2.toUtf8().data()); diff --git a/DrawerTh_ME2Scanner.cpp b/DrawerTh_ME2Scanner.cpp index 34accd3..405d0c2 100644 --- a/DrawerTh_ME2Scanner.cpp +++ b/DrawerTh_ME2Scanner.cpp @@ -1,5 +1,6 @@ #include "DrawerTh_ME2Scanner.h" #include "STh.h" +#include "externData.h" void DrawerTh_ME2Scanner::doEmitDrawTextPlacers() { diff --git a/DrawerTh_QoSScanner.cpp b/DrawerTh_QoSScanner.cpp index fb8a96c..a67efc4 100644 --- a/DrawerTh_QoSScanner.cpp +++ b/DrawerTh_QoSScanner.cpp @@ -1,6 +1,9 @@ #pragma once #include "DrawerTh_QoSScanner.h" #include "STh.h" +#include "externData.h" + +int tMax; void DrawerTh_QoSScanner::run() { diff --git a/DrawerTh_VoiceScanner.cpp b/DrawerTh_VoiceScanner.cpp index b57869f..dea5945 100644 --- a/DrawerTh_VoiceScanner.cpp +++ b/DrawerTh_VoiceScanner.cpp @@ -1,4 +1,5 @@ #include "DrawerTh_VoiceScanner.h" +#include "externData.h" void DrawerTh_VoiceScanner::doEmitAddLine() { diff --git a/IRCPinger_Th.cpp b/IRCPinger_Th.cpp index 18f9b86..76f6b4a 100644 --- a/IRCPinger_Th.cpp +++ b/IRCPinger_Th.cpp @@ -1,5 +1,6 @@ #pragma once #include "IRCPinger_Th.h" +#include "externData.h" void IRCPinger_Th::doEmitChangeRedIRCData(QString str) { diff --git a/STh.h b/STh.h index 3d1f858..8ed2897 100644 --- a/STh.h +++ b/STh.h @@ -4,6 +4,9 @@ #pragma once #include "nesca_3.h" #include "resource.h" +#include "externFunctions.h" + +extern int tMax; class STh : public QThread { @@ -41,7 +44,6 @@ public: signals: void showRedVersion(); public: signals: void startScanIP(); public: signals: void startScanDNS(); public: signals: void startScanImport(); - public: signals: void signalDataSaved(bool); public: signals: void changeGreenBAData(QString); public: signals: void changeRedBAData(QString); diff --git a/connector.cpp b/connector.cpp index 2509544..ede1506 100644 --- a/connector.cpp +++ b/connector.cpp @@ -3,6 +3,8 @@ #include #include #include +#include "externFunctions.h" +#include "externData.h" #pragma once #if defined(Q_OS_WIN32) @@ -12,7 +14,6 @@ #endif int gMaxBrutingThreads = 200; -volatile bool BConnLocked = false; void BConInc() { __asm @@ -34,7 +35,6 @@ void BConDec() stt->doEmitionChangeBA(QString::number(BrutingThrds)); #pragma endregion }; -bool SSHConnLocked = false; void SSHConInc() { __asm @@ -113,7 +113,7 @@ int recvWT( } return(n) ; /* trouble */ } -string toLowerStr(const char *str) +std::string toLowerStr(const char *str) { int tsz = strlen(str); if(tsz == 1) @@ -133,7 +133,7 @@ string toLowerStr(const char *str) memset(strr + tsz, '\0', 1); - string tstr = strr; + std::string tstr = strr; delete []strr; return tstr; }; @@ -410,7 +410,7 @@ lopaStr _BABrute(char *cookie, char *ip, int port, char *pathT, char *method) else if(host=gethostbyname (ip)) ((unsigned long*) &sockAddr.sin_addr)[0] = ((unsigned long**)host->h_addr_list)[0][0]; else { - OnLiner = 0; + isActive = 0; strcpy(lps.login, "UNKNOWN"); return lps; }; @@ -419,7 +419,7 @@ lopaStr _BABrute(char *cookie, char *ip, int port, char *pathT, char *method) else if(host=gethostbyname (ip)) ((unsigned long*) &sockAddr.sin_addr)[0] = ((unsigned long**)host->h_addr_list)[0][0]; else { - OnLiner = 0; + isActive = 0; strcpy(lps.login, "UNKNOWN"); return lps; }; @@ -445,7 +445,7 @@ lopaStr _BABrute(char *cookie, char *ip, int port, char *pathT, char *method) #pragma endregion if(strlen(headerMsg) == 0) { - OnLiner = 0; + isActive = 0; strcpy(lps.login, "UNKNOWN"); return lps; @@ -463,7 +463,7 @@ lopaStr _BABrute(char *cookie, char *ip, int port, char *pathT, char *method) closesocket(sock); strcpy(lps.other, "[400 Bad Request]"); - OnLiner = 0; + isActive = 0; return lps; } else if(strstri(headerMsg, "404 Not") != NULL @@ -485,7 +485,7 @@ lopaStr _BABrute(char *cookie, char *ip, int port, char *pathT, char *method) closesocket(sock); strcpy(lps.other, QString("[404 Not Found (" + QString(path) + ")]").toLocal8Bit().data()); - OnLiner = 0; + isActive = 0; return lps; }; } @@ -511,7 +511,7 @@ lopaStr _BABrute(char *cookie, char *ip, int port, char *pathT, char *method) strcpy(lps.login, "NULL"); strcpy(lps.pass, "NULL"); - OnLiner = 0; + isActive = 0; return lps; }; }; @@ -520,7 +520,7 @@ lopaStr _BABrute(char *cookie, char *ip, int port, char *pathT, char *method) closesocket(sock); #pragma endregion - OnLiner = 1; + isActive = 1; char tPass[256] = {0}; char curLogin[256] = {0}; char curPass[256] = {0}; @@ -542,7 +542,8 @@ lopaStr _BABrute(char *cookie, char *ip, int port, char *pathT, char *method) char realm[512] = {0}; char opaque[512] = {0}; char qop[64] = {0}; - string encoded = ""; + std::string encoded = ""; + for(int i = 0; i < MaxLogin; i++) { if(globalScanFlag == false) break; @@ -679,7 +680,7 @@ lopaStr _BABrute(char *cookie, char *ip, int port, char *pathT, char *method) shutdown(sock, SD_BOTH); closesocket(sock); - OnLiner = 0; + isActive = 0; strcpy(lps.login, "UNKNOWN"); return lps; } @@ -695,7 +696,7 @@ lopaStr _BABrute(char *cookie, char *ip, int port, char *pathT, char *method) shutdown(sock, SD_BOTH); closesocket(sock); - OnLiner = 0; + isActive = 0; strcpy(lps.login, "UNKNOWN"); return lps; @@ -752,7 +753,7 @@ lopaStr _BABrute(char *cookie, char *ip, int port, char *pathT, char *method) #pragma region QTGUI_Area stt->doEmitionRedFoundData("[-] 404 - Wrong path detected. (" + QString(ip) + ":" + QString::number(port) + QString(path) + ")"); #pragma endregion - OnLiner = 0; + isActive = 0; strcpy(lps.login, "UNKNOWN"); return lps; } @@ -776,7 +777,7 @@ lopaStr _BABrute(char *cookie, char *ip, int port, char *pathT, char *method) strcpy(pass, ip); strcat(pass, " - Password found: "); strcat(pass, tPass); - OnLiner = 0; + isActive = 0; stt->doEmition_BAGreenData("[+] " + QString(pass)); strcpy(lps.login, curLogin); strcpy(lps.pass, curPass); @@ -789,7 +790,7 @@ lopaStr _BABrute(char *cookie, char *ip, int port, char *pathT, char *method) strcpy(pass, ip); strcat(pass, " - Password found: "); strcat(pass, tPass); - OnLiner = 0; + isActive = 0; char *pt1 = strstr(recvBuff, " "); if(pt1 != NULL) { @@ -820,7 +821,7 @@ lopaStr _BABrute(char *cookie, char *ip, int port, char *pathT, char *method) }; }; #pragma endregion - OnLiner = 0; + isActive = 0; strcpy(lps.login, "UNKNOWN"); return lps; @@ -900,7 +901,7 @@ lopaStr _FTPBrute(char *ip, int port, PathStr *ps) loginFailedFlag = 0; }; - OnLiner = 1; + isActive = 1; if(connectionResult != SOCKET_ERROR) { @@ -921,7 +922,7 @@ lopaStr _FTPBrute(char *ip, int port, PathStr *ps) { shutdown(sockFTP, SD_BOTH); closesocket(sockFTP); - OnLiner = 0; + isActive = 0; stt->doEmition_BARedData("[*] Unknown protocol (451 Error) - " + QString(ip)); strcpy(lps.other, "Unknown protocol (451 Error)"); return lps; @@ -931,7 +932,7 @@ lopaStr _FTPBrute(char *ip, int port, PathStr *ps) { shutdown(sockFTP, SD_BOTH); closesocket(sockFTP); - OnLiner = 0; + isActive = 0; #pragma region QTGUI_Area stt->doEmition_BAGreenData("[*] Anonymous access detected - " + QString(ip)); #pragma endregion @@ -947,7 +948,7 @@ lopaStr _FTPBrute(char *ip, int port, PathStr *ps) shutdown(sockFTP, SD_BOTH); closesocket(sockFTP); - OnLiner = 0; + isActive = 0; #pragma region QTGUI_Area stt->doEmition_BARedData("[-] 550 (No connections allowed) - Ban detected. Dropping " + QString(ip)); @@ -962,7 +963,7 @@ lopaStr _FTPBrute(char *ip, int port, PathStr *ps) shutdown(sockFTP, SD_BOTH); closesocket(sockFTP); - OnLiner = 0; + isActive = 0; stt->doEmition_BARedData("[-] 500 (Sorry, no such command) " + QString(ip)); strcpy(lps.other, "[500 Sorry, no such command]"); return lps; @@ -1061,7 +1062,7 @@ lopaStr _FTPBrute(char *ip, int port, PathStr *ps) shutdown(sockFTP, SD_BOTH); closesocket(sockFTP); - OnLiner = 0; + isActive = 0; strcpy(lps.login, "UNKNOWN"); return lps; @@ -1129,7 +1130,7 @@ lopaStr _FTPBrute(char *ip, int port, PathStr *ps) strcpy(lps.login, loginLst[i]); strcpy(lps.pass, passLst[j]); strcpy(lps.other, "ROUTER"); - OnLiner = 0; + isActive = 0; return lps; }; @@ -1180,7 +1181,7 @@ lopaStr _FTPBrute(char *ip, int port, PathStr *ps) shutdown(newSockFTP, SD_BOTH); closesocket(newSockFTP); closedSocket = 1; - OnLiner = 0; + isActive = 0; strcpy(lps.login, "UNKNOWN"); return lps; } @@ -1219,7 +1220,7 @@ lopaStr _FTPBrute(char *ip, int port, PathStr *ps) shutdown(sockFTP, SD_BOTH); closesocket(sockFTP); - OnLiner = 0; + isActive = 0; return lps; } else @@ -1231,7 +1232,7 @@ lopaStr _FTPBrute(char *ip, int port, PathStr *ps) shutdown(sockFTP, SD_BOTH); closesocket(sockFTP); - OnLiner = 0; + isActive = 0; return lps; }; }; @@ -1264,7 +1265,7 @@ lopaStr _FTPBrute(char *ip, int port, PathStr *ps) shutdown(sockFTP, SD_BOTH); closesocket(sockFTP); - OnLiner = 0; + isActive = 0; strcpy(lps.login, "UNKNOWN"); return lps; }; @@ -1279,7 +1280,7 @@ lopaStr _FTPBrute(char *ip, int port, PathStr *ps) }; shutdown(sockFTP, SD_BOTH); closesocket(sockFTP); - OnLiner = 0; + isActive = 0; strcpy(lps.login, "UNKNOWN"); return lps; }; @@ -1665,7 +1666,6 @@ int Connector::_EstablishConnection(char *ip, int port, char *requesth, conSTR * ++offlines; char temp[128] = {0}; int err = iError; - GlobalWSAErr = err; if(err == 10055) { strcpy(temp, "-Connection pool depleted- "); @@ -1818,14 +1818,14 @@ lopaStr _WFBrut(char *cookie, char *ip, int port, char *methodVal, char *actionV if(strstri(CSTR.lowerBuff, "501 not implemented") != NULL) { stt->doEmitionRedFoundData("" + QString(ip) + ":" + QString::number(port) + " - [WF]: 501 Not Implemented."); - OnLiner = 0; + isActive = 0; strcpy(lps.login, "UNKNOWN"); return lps; }; if(strstri(CSTR.lowerBuff, "404 not found") != NULL) { stt->doEmitionRedFoundData("" + QString(ip) + ":" + QString::number(port) + " - [WF]: 404 Not Found."); - OnLiner = 0; + isActive = 0; strcpy(lps.login, "UNKNOWN"); return lps; }; @@ -1857,7 +1857,7 @@ lopaStr _WFBrut(char *cookie, char *ip, int port, char *methodVal, char *actionV { ZeroMemory(request, sizeof(request)); - OnLiner = 0; + isActive = 0; strcpy(lps.login, "UNKNOWN"); return lps; @@ -1870,7 +1870,7 @@ lopaStr _WFBrut(char *cookie, char *ip, int port, char *methodVal, char *actionV strcat(pass, wfLoginLst[i]); strcat(pass, ":"); strcat(pass, wfPassLst[j]); - OnLiner = 0; + isActive = 0; #pragma region QTGUI_Area stt->doEmition_BAGreenData("[+] " + QString(pass)); #pragma endregion @@ -1883,7 +1883,7 @@ lopaStr _WFBrut(char *cookie, char *ip, int port, char *methodVal, char *actionV { ZeroMemory(request, sizeof(request)); - OnLiner = 0; + isActive = 0; strcpy(lps.login, "UNKNOWN"); return lps; @@ -1944,14 +1944,14 @@ lopaStr _WFBrut(char *cookie, char *ip, int port, char *methodVal, char *actionV if(strstri(CSTR.lowerBuff, "501 not implemented") != NULL) { stt->doEmitionRedFoundData("" + QString(ip) + ":" + QString::number(port) + " - [WF]: 501 Not Implemented."); - OnLiner = 0; + isActive = 0; strcpy(lps.login, "UNKNOWN"); return lps; }; if(strstri(CSTR.lowerBuff, "404 not found") != NULL) { stt->doEmitionRedFoundData("" + QString(ip) + ":" + QString::number(port) + " - [WF]: 404 Not Found."); - OnLiner = 0; + isActive = 0; strcpy(lps.login, "UNKNOWN"); return lps; }; @@ -1982,7 +1982,7 @@ lopaStr _WFBrut(char *cookie, char *ip, int port, char *methodVal, char *actionV ZeroMemory(request, sizeof(request)); ZeroMemory(argData, sizeof(argData)); - OnLiner = 0; + isActive = 0; strcpy(lps.login, "UNKNOWN"); return lps; @@ -1995,7 +1995,7 @@ lopaStr _WFBrut(char *cookie, char *ip, int port, char *methodVal, char *actionV strcat(pass, wfLoginLst[i]); strcat(pass, ":"); strcat(pass, wfPassLst[j]); - OnLiner = 0; + isActive = 0; #pragma region QTGUI_Area stt->doEmition_BAGreenData("[+] " + QString(pass)); #pragma endregion @@ -2009,7 +2009,7 @@ lopaStr _WFBrut(char *cookie, char *ip, int port, char *methodVal, char *actionV ZeroMemory(request, sizeof(request)); ZeroMemory(argData, sizeof(argData)); - OnLiner = 0; + isActive = 0; strcpy(lps.login, "UNKNOWN"); return lps; @@ -2029,7 +2029,7 @@ lopaStr _WFBrut(char *cookie, char *ip, int port, char *methodVal, char *actionV ZeroMemory(request, sizeof(request)); ZeroMemory(argData, sizeof(argData)); - OnLiner = 0; + isActive = 0; strcpy(lps.login, "UNKNOWN"); return lps; @@ -2143,7 +2143,7 @@ int _EstablishSSHConnection(char *host, int port, conSTR *CSTR, char *banner) char login[32] = {0}; char pass[32] = {0}; char temp[64] = {0}; - OnLiner = 1; + isActive = 1; SSHConInc(); int sz = 0; char *ptr1 = 0; @@ -2163,19 +2163,19 @@ int _EstablishSSHConnection(char *host, int port, conSTR *CSTR, char *banner) if(res == 0) { SSHConDec(); - OnLiner = 0; + isActive = 0; return 0; } else if(res == -2) { SSHConDec(); - OnLiner = 0; + isActive = 0; return -2; }; Sleep(500); }; SSHConDec(); - OnLiner = 0; + isActive = 0; return -1; }; #pragma endregion @@ -2285,7 +2285,7 @@ lopaStr _IPCameraBrute(char *ip, int port, char *SPEC) char login[128] = {0}; char pass[128] = {0}; char request[1024] = {0}; - OnLiner = 1; + isActive = 1; int passCounter = 1; std::vector negVector; @@ -2320,7 +2320,7 @@ lopaStr _IPCameraBrute(char *ip, int port, char *SPEC) else { stt->doEmitionRedFoundData("[_IPCameraBrute] No \"SPEC\" specified!"); - OnLiner = 0; + isActive = 0; strcpy(lps.login, "UNKNOWN"); return lps; }; @@ -2407,21 +2407,21 @@ lopaStr _IPCameraBrute(char *ip, int port, char *SPEC) if(res == 1) { - OnLiner = 0; + isActive = 0; strcpy(lps.login, loginLst[i]); strcpy(lps.pass, passLst[j]); return lps; } else if(res == -1) { - OnLiner = 0; + isActive = 0; strcpy(lps.login, "UNKNOWN"); return lps; }; ++passCounter; }; }; - OnLiner = 0; + isActive = 0; strcpy(lps.login, "UNKNOWN"); return lps; }; diff --git a/externData.h b/externData.h new file mode 100644 index 0000000..33ebb66 --- /dev/null +++ b/externData.h @@ -0,0 +1,31 @@ +#define RECV_MAX_SIZE 350000 +#define REQUEST_MAX_SIZE 4096 +#define SD_BOTH 2 +#define PORTSET "80,81,88,8080,8081,60001,60002,8008,8888,554,9000,441,4111,6667,3536,22,21" +#define IRC_CHAN "iskopasi_lab03" + +extern QJsonArray *jsonArr; + +extern unsigned long long gTargetsOverall, Activity; +extern char top_level_domain[128]; +extern volatile int BA, cons, BrutingThrds, gThreads; +extern char **loginLst, **passLst, **wfLoginLst, **wfPassLst, **sshlpLst, **GlobalNegatives; +extern bool trackerOK, __savingBackUpFile, globalScanFlag, MapWidgetOpened, + widgetIsHidden, OnlineMsgSentFlag, utfIRCFlag, HTMLDebugMode, gNegDebugMode, + gDebugMode, horLineFlag, gPingNScan; +extern int found, indexIP, gMode, + MaxPass, MaxLogin, MaxWFLogin, MaxWFPass, MaxSSHPass, + GlobalNegativeSize, isActive, gMaxBrutingThreads, + gTimeOut, PieAnomC1, PieSusp, PieBA, PieLowl, PieWF, PieSSH, + gThreadDelay, AnomC1, Filt, Overl, Lowl, Alive, saved, + Susp, WF, offlines, ssh, globalPinger, gPingTimeout, nickFlag, offlineFlag; +extern char trcSrv[256], trcScr[256], trcProxy[128], trcPersKey[32], + ircServer[32], ircPort[32], ircProxy[64], ircProxyPort[8], ircNick[32], + trcPort[32], trcSrvPortLine[32], saveStartIP[128], saveEndIP[128], + gRange[128], gFirstDom[128], gPorts[65536], endIP2[128], + gVER[16]; + +struct pl{ + int loginCounter; + int passCounter; +}; diff --git a/externFunctions.h b/externFunctions.h new file mode 100644 index 0000000..d25f4bf --- /dev/null +++ b/externFunctions.h @@ -0,0 +1,16 @@ +extern std::string toLowerStr(const char *str); +extern int recvS(int lSock, char *recvBuffT, int len, int mode); +extern int sendS(int lSock, char *msg, int len, int mode); +extern std::string xcode(LPCSTR src, UINT srcCodePage, UINT dstCodePage); +extern void UserNickInit(SOCKET lSock); +extern void GetNicks(); +extern int startScan(char* argv); +extern void BConInc(); +extern void BConDec(); +extern QString GetNSErrorDefinition(char *str, char *defin); +extern void _SaveBackupToFile(); +extern char* __cdecl strstri(char *_Str, const char *_SubStr); +extern char* _getAttribute(char *str, char *attrib); +extern char *_findFirstOcc(char *str, char *delim); +extern int _SSHLobby(char *ip, int port, conSTR *CSTR); +extern void nCleanup(); \ No newline at end of file diff --git a/finder.cpp b/finder.cpp index 58a6b33..4db0600 100644 --- a/finder.cpp +++ b/finder.cpp @@ -1,13 +1,15 @@ #pragma once #include "STh.h" #include "resource.h" +#include "externFunctions.h" +#include "externData.h" char* __cdecl strstri(char *_Str, const char *_SubStr) { if(_Str != NULL) { - string _lowStr = toLowerStr(_Str); - string _lowSubStr = toLowerStr(_SubStr); + std::string _lowStr = toLowerStr(_Str); + std::string _lowSubStr = toLowerStr(_SubStr); const char *resChar = strstr(_lowStr.c_str(), _lowSubStr.c_str()); int offset = resChar - _lowStr.c_str(); if(offset < 0) return NULL; @@ -986,9 +988,9 @@ void _getFormVal(char *data, char *result, char *key, char *path = NULL) }; static const std::string arrUser[] = {"user", "usr", "username", "login", "lgn", "account", "acc", "param1", "param3", "id", "A1", "uname", "mail", "name"}; -vector vecUser (arrUser, arrUser + sizeof(arrUser) / sizeof(arrUser[0]) ); +std::vector vecUser (arrUser, arrUser + sizeof(arrUser) / sizeof(arrUser[0]) ); static const std::string arrPass[] = {"pass", "pw", "password", "code", "param2", "param4", "secret", "login_p", "A2", "admin_pw", "pws", "secretkey"}; -vector vecPass (arrPass, arrPass + sizeof(arrPass) / sizeof(arrPass[0]) ); +std::vector vecPass (arrPass, arrPass + sizeof(arrPass) / sizeof(arrPass[0]) ); char *_getAttribute(char *str, char *attrib) { @@ -1062,7 +1064,7 @@ void _specWFBrute(char *ip, int port, char *hl, char *buff, int flag, char *path }; return; }; - OnLiner = 1; + isActive = 1; char b[16] = {0}; char methodVal[128] = {0}; @@ -1220,7 +1222,7 @@ void _specWFBrute(char *ip, int port, char *hl, char *buff, int flag, char *path ///putInFile(flag, ip, tport, recd, title, hl, cp); }; }; - OnLiner = 0; + isActive = 0; }; void _specWEBIPCAMBrute(char *ip, int port, char *hl, char *finalstr, int flag, char *comment, char *tclass, char *cp, int recd, char *SPEC) { @@ -1244,7 +1246,7 @@ void _specWEBIPCAMBrute(char *ip, int port, char *hl, char *finalstr, int flag, }; void _specBrute(char *cookie, char *ip, int port, char *hl, char *finalstr, int flag, char *path, char *comment, char *tclass, char *cp, int recd, char *data) { - OnLiner = 1; + isActive = 1; lopaStr lps; ZeroMemory(lps.login, sizeof(lps.login)); ZeroMemory(lps.pass, sizeof(lps.pass)); @@ -1515,12 +1517,11 @@ int Lexems::_filler(int p, char* buffcpy, char* ip, int recd, Lexems *lx, char * if(strstr(finalstr, ps.headr) == NULL) strcat(finalstr, ps.headr); if(flag == -1 || flag == 6 || strstr(finalstr, "[IGNR_ADDR]") != NULL) return -1; - fillerFlag = 1; #pragma region Fillers if(flag == 16) { Connector con; - OnLiner = 1; + isActive = 1; char log[2048] = {0}; char logEmit[2048] = {0}; @@ -1763,7 +1764,7 @@ int Lexems::_filler(int p, char* buffcpy, char* ip, int recd, Lexems *lx, char * char temp[64] = {0}; char log[512] = {0}; Connector con; - OnLiner = 1; + isActive = 1; ++AnomC1; strcpy(log, "[HFS]:"); @@ -1806,7 +1807,6 @@ int Lexems::_filler(int p, char* buffcpy, char* ip, int recd, Lexems *lx, char * putInFile(flag, ip, port, recd, finalstr, hl, cp); }; #pragma endregion - fillerFlag = 0; return flag; }; diff --git a/msgcheckerthread.cpp b/msgcheckerthread.cpp index fc355a7..7cdd98d 100644 --- a/msgcheckerthread.cpp +++ b/msgcheckerthread.cpp @@ -1,4 +1,5 @@ #include "msgcheckerthread.h" +#include "externData.h" void MSGCheckerThread::doEmitionShowNewMsg(QString str) { diff --git a/nesca_3.cpp b/nesca_3.cpp index 62bb50f..f971418 100644 --- a/nesca_3.cpp +++ b/nesca_3.cpp @@ -27,6 +27,8 @@ #include #include #include "progressbardrawer.h" +#include "externFunctions.h" +#include "externData.h" QDate date = QDate::currentDate(); int ver = 100*(100*(date.year()%100) + date.month()) + date.day(); @@ -100,7 +102,6 @@ bool connectedToIRC = false; bool globalScanFlag; float QoSStep = 1; int MaxDataVal = 1; -int tMax = 0; QGraphicsScene *sceneGrid; QGraphicsScene *sceneGrid2; QGraphicsScene *sceneGraph; @@ -163,7 +164,6 @@ bool BALogSwitched = false; bool widgetIsHidden = false; bool blinkFlag = false; bool printDelimiter = false; -bool destroychPThFlag = false; bool IRCLogToggled = true; int PhraseIndex = 0; QList PhraseLog; @@ -208,7 +208,6 @@ void setSceneArea() ui->pbgv->setScene(pbScene); ui->jobRangeVisual->setScene(jobRangeVisualScene); - ui->graphicLog->setSceneRect(0, 0, ui->graphicLog->width(), ui->graphicLog->height()); ui->graphicLog_2->setSceneRect(0, 0, ui->graphicLog_2->width(), ui->graphicLog_2->height()); ui->graphicDelim->setSceneRect(0, 0, ui->graphicDelim->width(), ui->graphicDelim->height()); @@ -3344,21 +3343,20 @@ void _startMsgCheck() _startVerCheck(); _startMsgCheck(); - //for(int i = 0; i < 480; ++i+=) - float step = 0; - QPen iprvPenRegular(QColor(51, 51, 51, 100)); - QPen iprvPen(QColor(51, 51, 51, 100)); - while(step < 480) - { - jobRangeVisualScene->addLine(step, 0, step, 41, iprvPenRegular); - step += 30; - }; - QPen iprvPenComplete(QColor(51, 51, 51, 100)); - while(step < 480) - { - jobRangeVisualScene->addLine(step, 0, step, 41, iprvPen); - step += 30; - }; + //float step = 0; + //QPen iprvPenRegular(QColor(51, 51, 51, 100)); + //QPen iprvPen(QColor(51, 51, 51, 100)); + //while(step < 480) + //{ + // jobRangeVisualScene->addLine(step, 0, step, 41, iprvPenRegular); + // step += 30; + //}; + //QPen iprvPenComplete(QColor(51, 51, 51, 100)); + //while(step < 480) + //{ + // jobRangeVisualScene->addLine(step, 0, step, 41, iprvPen); + // step += 30; + //}; }; void nesca_3::playFcknSound() { @@ -3511,61 +3509,10 @@ void nesca_3::STTTerminate() globalScanFlag = false; stt->terminate(); + 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 < importFileSize; ++i) delete []ipsstartfl[i]; - delete []ipsstartfl; - ipsstartfl = NULL; - }; - if(ipsendfl != NULL) - { - for(int i = 0; i < importFileSize; ++i) delete []ipsendfl[i]; - delete []ipsendfl; - ipsendfl = NULL; - }; - if(starterIP != NULL) - { - for(int i = 0; i < importFileSize; ++i) delete []starterIP[i]; - delete []starterIP; - starterIP = NULL; - }; + + nCleanup(); ui->tabMainWidget->setTabEnabled(0, true); ui->tabMainWidget->setTabEnabled(1, true); ui->tabMainWidget->setTabEnabled(2, true); @@ -3576,7 +3523,6 @@ void nesca_3::STTTerminate() BrutingThrds = 0; cons = 0; setButtonStyleArea(); - ui->lineEditStartIPDNS->setText(""); ui->startScanButton_3->setText("Start"); ui->startScanButton_4->setText("Start"); ui->importButton->setText("Import&&Scan"); diff --git a/nesca_3.h b/nesca_3.h index 4375fc6..8033f14 100644 --- a/nesca_3.h +++ b/nesca_3.h @@ -21,15 +21,21 @@ #include extern Ui::nesca_3Class *ui; -extern bool widgetIsHidden; -extern bool IRCLogToggled; -extern bool BALogSwitched; -extern void ShowMsgPopup(QString str); -extern bool blinkFlag; -extern bool disableBlink; -extern bool debugFileOK; +extern bool widgetIsHidden, IRCLogToggled, BALogSwitched, blinkFlag, disableBlink, debugFileOK, QOSWait, + connectedToIRC, ME2ScanFlag, QoSScanFlag, VoiceScanFlag, PieStatFlag, proxyEnabledFlag, + 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 SOCKET lSock; + +extern QVector vAlivLst, vAnomLst, vWFLst, vSuspLst, vLowlLst, vBALst, vSSHLst, vOvrlLst, actLst; +extern QVector vect; +extern QList lstOfLabels; extern QSystemTrayIcon *tray; -extern bool QOSWait; + +extern void ShowMsgPopup(QString str); + class nesca_3 : public QMainWindow { Q_OBJECT @@ -144,7 +150,6 @@ protected: private: QPoint dragPosition; }; - class PieStatView : public QGraphicsView { Q_OBJECT @@ -153,7 +158,6 @@ public: public: void contextMenuEvent(QContextMenuEvent *event); }; - class PopupMsgWidget : public QWidget { Q_OBJECT diff --git a/nesca_startModule.cpp b/nesca_startModule.cpp index 4c593be..c68fe48 100644 --- a/nesca_startModule.cpp +++ b/nesca_startModule.cpp @@ -1,33 +1,37 @@ #pragma once #include "STh.h" #include "resource.h" +#include "externData.h" +#include "externFunctions.h" + +typedef struct ST{ + char argv[MAX_ADDR_LEN]; +}sockstruct; + +QJsonArray *jsonArr = new QJsonArray(); bool __savingBackUpFile = false; bool horLineFlag = false; -QJsonArray *jsonArr = new QJsonArray(); static int portArr[65536] = {0}; int gThreadDelay = 10; int gC = 0; int gTimeOut = 3; int PieAnomC1 = 0, PieBA = 0, PieSusp = 0, PieLowl = 0, PieWF = 0, PieSSH = 0; int AnomC1 = 0, Filt = 0, Overl = 0, Lowl = 0, Alive = 0, saved = 0, Susp = 0, WF = 0, offlines = 0, ssh = 0; -int GlobalWSAErr = 0; int GlobalNegativeSize = 0; -int ovrlIPs = 0, ipCounter = 0; +int ipCounter = 0; int mode; -int found = 0, fillerFlag = 0, indexIP = 1; -int gMaxSize = 65536; +int found = 0, indexIP = 1; int gMode; -int OnLiner = 0; +int isActive = 0; int MaxPass = 0, MaxLogin = 0, MaxTags = 0, MaxWFLogin = 0, MaxWFPass = 0, MaxSSHPass = 0; int ipsstart[4], ipsend[4], - startNum, endNum, overallPorts, flCounter, octet[4]; + overallPorts, flCounter, octet[4]; unsigned char **ipsstartfl = NULL, **ipsendfl = NULL, **starterIP = NULL; unsigned int importFileSize = 0; int gPingTimeout = 2000; double ips = 0; char top_level_domain[128] = {0}; -char startM[64] = {0}, endM[64] = {0}; char endIP2[128] = {0}; char **GlobalNegatives = 0; char **loginLst, **passLst; @@ -47,7 +51,6 @@ char metaETA[256] = {0}; char metaOffline[256] = {0}; bool ErrLogFirstTime = true; bool gPingNScan = false; -volatile bool ConnLocked = false; unsigned long long gTargets = 0, gTargetsOverall = 1, targets, Activity = 0; volatile int gThreads; volatile int cons = 0; @@ -381,7 +384,7 @@ void *_timer() { char dbuffer[32] = {0}, timeLeft[64] = {0}, b[32] = {0}; int ticks = 0; - ovrlIPs = 0; + int ovrlIPs = 0; ips = 1; Sleep(50); while(globalScanFlag) @@ -1226,9 +1229,8 @@ void ReadUTF8(FILE* nFile, char *cp) }; } #ifdef WIN32 -string xcode(LPCSTR src, UINT srcCodePage, UINT dstCodePage) +std::string xcode(LPCSTR src, UINT srcCodePage, UINT dstCodePage) { - string res; int wsize = MultiByteToWideChar(srcCodePage, 0, src, -1, 0, 0); LPWSTR wbuf = (LPWSTR)new char[wsize * sizeof(WCHAR)]; MultiByteToWideChar(srcCodePage, 0, src, -1, wbuf, wsize); @@ -1236,6 +1238,8 @@ string xcode(LPCSTR src, UINT srcCodePage, UINT dstCodePage) char * buf = (char *)new char[size]; WideCharToMultiByte(dstCodePage, 0, wbuf, -1, buf, size, 0, 0); delete [] wbuf; + + std::string res; res.append(buf); delete [] buf; return res; @@ -2505,7 +2509,7 @@ stt->doEmitionThreads(QString::number(0) + "/" + QString::number(gThreads)); if(flCounter == 0) { stt->doEmitionRedFoundData("Empty IP list."); - OnLiner = 0; + isActive = 0; globalScanFlag = false; stt->doEmitionKillSttThread(); @@ -2643,8 +2647,18 @@ stt->doEmitionThreads(QString::number(0) + "/" + QString::number(gThreads)); stt->doEmitionChangeStatus("Stopping..."); #pragma endregion - while(cons > 0 || OnLiner == 1 || jsonArr->size() > 0) Sleep(2000); + while(cons > 0 || isActive == 1 || jsonArr->size() > 0) Sleep(2000); + nCleanup(); + #pragma region QTGUI_Area + stt->doEmitionGreenFoundData("Done. Saved: " + QString::number(saved) + "; Alive: " + QString::number(found) + "."); + stt->doEmitionChangeParsed(QString::number(saved) + "/" + QString::number(found)); + stt->doEmitionChangeStatus("Idle"); + stt->doEmitionKillSttThread(); + #pragma endregion +}; + +void nCleanup(){ if(loginLst != NULL) { for(int i = 0; i < MaxLogin; ++i) delete []loginLst[i]; @@ -2703,10 +2717,4 @@ stt->doEmitionThreads(QString::number(0) + "/" + QString::number(gThreads)); delete []starterIP; starterIP = NULL; }; - #pragma region QTGUI_Area - stt->doEmitionGreenFoundData("Done. Saved: " + QString::number(saved) + "; Alive: " + QString::number(found) + "."); - stt->doEmitionChangeParsed(QString::number(saved) + "/" + QString::number(found)); - stt->doEmitionChangeStatus("Idle"); - stt->doEmitionKillSttThread(); - #pragma endregion -}; +} \ No newline at end of file diff --git a/oIRC_Th.cpp b/oIRC_Th.cpp index 8e85ea5..a4204dc 100644 --- a/oIRC_Th.cpp +++ b/oIRC_Th.cpp @@ -1,5 +1,7 @@ #include "oIRC_Th.h" #include +#include "externData.h" +#include "externFunctions.h" int iWantToConnect = false; diff --git a/piestat.cpp b/piestat.cpp index b148717..fe28e77 100644 --- a/piestat.cpp +++ b/piestat.cpp @@ -1,4 +1,5 @@ #include "piestat.h" +#include "externData.h" void PieStat::doEmitUpdatePie() { diff --git a/progressbardrawer.cpp b/progressbardrawer.cpp index 2408499..2496287 100644 --- a/progressbardrawer.cpp +++ b/progressbardrawer.cpp @@ -1,4 +1,6 @@ #include "progressbardrawer.h" +#include "externData.h" + void ProgressbarDrawer::update() { emit pbTh->upd(); diff --git a/resource.h b/resource.h index bfbc8b8..79bd565 100644 --- a/resource.h +++ b/resource.h @@ -1,6 +1,6 @@ -//#if defined(WIN32) -#pragma once +#pragma once #include "base64.h" + #if defined(Q_OS_WIN32) #pragma once #include "iostream" @@ -49,133 +49,8 @@ typedef int BOOL; #define MAX_ADDR_LEN 128 #define TITLE_MAX_SIZE 512 -#define RECV_MAX_SIZE 350000 -#define REQUEST_MAX_SIZE 4096 #define COOKIE_MAX_SIZE 1024 -#define SD_BOTH 2 -#define PORTSET "80,81,88,8080,8081,60001,60002,8008,8888,554,9000,441,4111,6667,3536,22,21" -#define IRC_CHAN "iskopasi_lab03" -using namespace std; - -extern bool gGlobalTrackLocked; - -extern SOCKET lSock; -extern char gVER[16]; -extern QVector vAlivLst; -extern QVector vAnomLst; -extern QVector vWFLst; -extern QVector vSuspLst; -extern QVector vLowlLst; -extern QVector vBALst; -extern QVector vSSHLst; -extern QVector vOvrlLst; -extern QVector vect; -extern bool printDelimiter; -extern QJsonArray *jsonArr; -extern bool gPingNScan; -extern bool smBit_1; -extern bool smBit_2; -extern bool smBit_3; -extern bool smBit_4; -extern bool smBit_5; -extern bool smBit_6; -extern bool smBit_7; -extern bool smBit_8; -extern bool horLineFlag; -extern bool gDebugMode; -extern bool gNegDebugMode; -extern bool HTMLDebugMode; -extern bool utfIRCFlag; -extern QVector actLst; -extern char inputStr[256]; -extern bool proxyEnabledFlag; -extern int nickFlag; -extern int offlineFlag; -extern bool OnlineMsgSentFlag; -extern int globalPinger; -extern int gPingTimeout; -extern bool destroychPThFlag; -extern string toLowerStr(const char *str); -extern QList lstOfLabels; -extern bool ME2ScanFlag, QoSScanFlag, VoiceScanFlag, PieStatFlag; -extern int AnomC1, Filt, Overl, Lowl, Alive, saved, Susp, WF, offlines, ssh; -extern int PieAnomC1, PieSusp, PieBA, PieLowl, PieWF, PieSSH; -extern int gThreadDelay; -extern bool connectedToIRC; -extern bool globalScanFlag; -extern float QoSStep; -extern int MaxDataVal; -extern int tMax; -extern bool widgetIsHidden; -extern bool MapWidgetOpened; -extern int gTimeOut; -extern char endIP2[128]; -extern char metaIPDNS[256]; -extern char metaRange[256]; -extern char metaPercent[256]; -extern char metaIPS[256]; -extern char metaTargets[256]; -extern char metaETA[256]; -extern char metaOffline[256]; -extern int GlobalWSAErr; -extern bool globalScanFlag; -extern bool trackerOK; -extern char trcPort[32]; -extern char trcSrvPortLine[32]; -extern char trcSrv[256]; -extern char trcScr[256]; -extern char trcProxy[128]; -extern char trcPersKey[32]; -extern char ircServer[32]; -extern char ircPort[32]; -extern char ircProxy[64]; -extern char ircProxyPort[8]; -extern char ircNick[32]; -extern int stopGlobalLog; -extern int GlobalNegativeSize; -extern char* thrds, top_level_domain[128]; -extern char startM[64], endM[64]; - -extern char **GlobalNegatives; -extern char **loginLst, **passLst, **wfLoginLst, **wfPassLst, **sshlpLst; -extern int MaxPass, MaxLogin, MaxWFLogin, MaxWFPass, MaxSSHPass; -extern double ips; -extern int ovrlIPs, ipCounter; -extern int mode; -extern unsigned long long gTargets, gTargetsOverall, targets, Activity; -extern volatile int BA; -extern volatile int cons; -extern volatile int BrutingThrds; -extern volatile int gThreads; -extern volatile int threads; -extern int found, fillerFlag, indexIP; -extern int gMaxSize; -extern char saveStartIP[128]; -extern char saveEndIP[128]; -extern int gMode; -extern char gRange[128]; -extern char gFirstDom[128]; -extern char gPorts[65536]; -extern int gMaxBrutingThreads; -extern int OnLiner; -extern bool __savingBackUpFile; -extern unsigned int importFileSize; -extern int ipsstart[4], ipsend[4], - startNum, endNum, overallPorts, flCounter, octet[4]; -//extern unsigned char ipsstartfl[8192][4], ipsendfl[8192][4], starterIP[8192][4]; -extern unsigned char **ipsstartfl, **ipsendfl, **starterIP; - -typedef struct ST{ - char argv[MAX_ADDR_LEN]; -}sockstruct; -struct conSTR{ - char *lowerBuff; - int size; -}; -struct assClSt{ - const char *argv2; -}; struct PathStr{ char codepage[32]; char headr[TITLE_MAX_SIZE]; @@ -185,30 +60,18 @@ struct PathStr{ char ip[MAX_ADDR_LEN]; char cookie[COOKIE_MAX_SIZE]; }; -struct pl{ - int loginCounter; - int passCounter; -}; + struct lopaStr{ char login[128]; char pass[32]; char other[128]; }; -extern int recvS(int lSock, char *recvBuffT, int len, int mode); -extern int sendS(int lSock, char *msg, int len, int mode); -extern std::string xcode(LPCSTR src, UINT srcCodePage, UINT dstCodePage); -extern void UserNickInit(SOCKET lSock); -extern void GetNicks(); -extern int startScan(char* argv); -extern volatile bool BConnLocked; -extern void BConInc(); -extern void BConDec(); -extern QString GetNSErrorDefinition(char *str, char *defin); -extern void _SaveBackupToFile(); -extern char* __cdecl strstri(char *_Str, const char *_SubStr); -extern char* _getAttribute(char *str, char *attrib); -extern char *_findFirstOcc(char *str, char *delim); -extern int _SSHLobby(char *ip, int port, conSTR *CSTR); + +struct conSTR{ + char *lowerBuff; + int size; +}; + class Lexems { public: @@ -229,6 +92,7 @@ class Lexems int globalSearchNeg(const char *buffcpy, char *ip, int port); }; + class Connector { public: @@ -241,7 +105,7 @@ class Connector int _EstablishConnection(char *ip, int port, char *request, conSTR *cstr, int force = 0); int _EstablishSSLConnection(char *ip, int port, char *request, conSTR *cstr); - void _StartRangeFapping(int ipsstart[], int ipsend[], int &cons, char *argv2, ST *st); + //void _StartRangeFapping(int ipsstart[], int ipsend[], int &cons, char *argv2, ST *st); void _Connect(void *s); int _ConnectToPort(char *ip, const char *port, char *hl); }; diff --git a/vercheckerthread.cpp b/vercheckerthread.cpp index 5c6293f..dc4f593 100644 --- a/vercheckerthread.cpp +++ b/vercheckerthread.cpp @@ -1,4 +1,5 @@ #include "vercheckerthread.h" +#include "externData.h" void _checkVer() {