diff --git a/BasicAuth.cpp b/BasicAuth.cpp index 73c84b0..4e060fa 100644 --- a/BasicAuth.cpp +++ b/BasicAuth.cpp @@ -23,7 +23,6 @@ lopaStr BA::_BABrute(const char *ip, const int port) { strcpy(lps.login, "UNKNOWN"); for(int i = 0; i < MaxLogin; ++i) { - if(!globalScanFlag) return lps; for (int j = 0; j < MaxPass; ++j) { if (!globalScanFlag) return lps; @@ -31,7 +30,7 @@ lopaStr BA::_BABrute(const char *ip, const int port) { Connector::nConnect(ip, port, &buffer, NULL, NULL, &lpString); - if(checkOutput(&buffer) != 0) { + if(checkOutput(&buffer)) { strcpy(lps.login, loginLst[i]); strcpy(lps.pass, passLst[j]); return lps; @@ -44,13 +43,12 @@ lopaStr BA::_BABrute(const char *ip, const int port) { return lps; } -lopaStr BA::_BALobby(const char *ip, const int port) -{ - while(BrutingThrds >= gMaxBrutingThreads) Sleep(700); +lopaStr BA::_BALobby(const char *ip, const int port) { + while(BrutingThrds >= gMaxBrutingThreads) Sleep(1000); BruteUtils::BConInc(); - const lopaStr &res = _BABrute(ip, port); + const lopaStr &lps = _BABrute(ip, port); BruteUtils::BConDec(); - return res; + return lps; } diff --git a/Connector.cpp b/Connector.cpp index 58ec71c..a62cd9d 100644 --- a/Connector.cpp +++ b/Connector.cpp @@ -176,6 +176,7 @@ int _EstablishSSHConnection(char *host, int port, std::string *buffer, const cha int sz = 0; char *ptr1 = 0; int res = -1; + for(int i = 0; i < MaxSSHPass; ++i) { if(globalScanFlag == false) break; @@ -188,6 +189,7 @@ int _EstablishSSHConnection(char *host, int port, std::string *buffer, const cha ZeroMemory(login, sizeof(login)); ZeroMemory(pass, sizeof(pass)); ZeroMemory(temp, sizeof(temp)); + if(res == 0) { if(i == 0) return -2; //Failhit @@ -199,6 +201,7 @@ int _EstablishSSHConnection(char *host, int port, std::string *buffer, const cha BruteUtils::BConDec(); return -2; }; + Sleep(500); }; BruteUtils::BConDec(); @@ -227,12 +230,10 @@ int my_trace(CURL *handle, curl_infotype type, char *data, size_t size, void *userp) { - switch (type) { - case CURLINFO_HEADER_OUT: { - data[strstr(data, "\r\n\r\n") - data] = '\0'; - stt->doEmitionAddOutData(QString(data)); - break; - } + if (type == CURLINFO_HEADER_OUT) { + Activity += strlen(data); + data[strstr(data, "\r\n\r\n") - data] = '\0'; + stt->doEmitionAddOutData(QString(data)); } return 0; @@ -251,6 +252,7 @@ int Connector::nConnect(const char *ip, const int port, std::string *buffer, buffer->clear(); CURL *curl = curl_easy_init(); curl_easy_setopt(curl, CURLOPT_NOSIGNAL, 0L); + int res = 0; if (curl) { @@ -299,10 +301,11 @@ int Connector::nConnect(const char *ip, const int port, std::string *buffer, if(lpString != NULL) { curl_easy_setopt(curl, CURLOPT_HTTPAUTH, (long)CURLAUTH_ANY); - curl_easy_setopt(curl, CURLOPT_USERPWD, lpString); - }; + //curl_easy_setopt(curl, CURLOPT_FTPLISTONLY, TRUE); + curl_easy_setopt(curl, CURLOPT_USERPWD, lpString->c_str()); + };// - curl_easy_perform(curl); + if(curl_easy_perform(curl) != CURLE_OK) return -1; curl_easy_cleanup(curl); } else { stt->doEmitionRedFoundData("Curl error."); @@ -310,8 +313,11 @@ int Connector::nConnect(const char *ip, const int port, std::string *buffer, }; if(MapWidgetOpened) stt->doEmitionAddIncData(QString(ip), QString(buffer->c_str())); + + Activity += buffer->size(); return buffer->size(); } + int Connector::_ConnectToPort(char *ip, int port, char *hl) { if(gPingNScan) diff --git a/DrawerTh_ME2Scanner.cpp b/DrawerTh_ME2Scanner.cpp index 8325b01..205e007 100644 --- a/DrawerTh_ME2Scanner.cpp +++ b/DrawerTh_ME2Scanner.cpp @@ -19,12 +19,12 @@ void DrawerTh_ME2Scanner::doEmitionAddPolyLine() void MakePolygonLine(int gWidth) { DrawerTh_ME2Scanner::polyVect.clear(); - int x = 0; - int tx = 0; + int x = 0; + int tx = 0; int xtx = 0; QPointF qp(0, ME2YPOS); DrawerTh_ME2Scanner::polyVect.append(qp); - int fact1 = 0, + int fact1 = 0, fact2 = 0, fact3 = 0, fact4 = 0, @@ -35,86 +35,86 @@ void MakePolygonLine(int gWidth) bool state = stt->isRunning(); for(int i = 1; i < 130; ++i) { - x = qrand() % 4 + 2 + i; - xtx = x + tx; + x = qrand() % 4 + i; + xtx = x + tx; if(xtx > 1 && xtx < 31) { - qp = QPointF(xtx, state ? qrand() % 3 - 3 + ME2YPOS - AnomC1 * 2 - fact1 : ME2YPOS); + qp = QPointF(xtx, state ? qrand() % 3 + ME2YPOS - AnomC1 * 2 - fact1 : ME2YPOS); if(AnomC1 > 0) { - if(xtx < 16 ) fact1+=2; + if(xtx < 16 ) fact1+=2; else fact1-=2; - }; + }; } if(xtx > 34 && xtx < 72) { - qp = QPointF(xtx, state ? qrand() % 3 - 3 + ME2YPOS - WF * 2 - fact2 : ME2YPOS); + qp = QPointF(xtx, state ? qrand() % 3 + ME2YPOS - WF * 2 - fact2 : ME2YPOS); if(WF > 0) { - if(xtx < 52 ) fact2+=2; + if(xtx < 52 ) fact2+=2; else fact2-=2; - }; + }; } if(xtx > 74 && xtx < 112) { - qp = QPointF(xtx, state ? qrand() % 3 - 3 + ME2YPOS - BA * 2 - fact3 : ME2YPOS); + qp = QPointF(xtx, state ? qrand() % 3 + ME2YPOS - BA * 2 - fact3 : ME2YPOS); if(BA > 0) { - if(xtx < 92 ) fact3+=2; + if(xtx < 92 ) fact3+=2; else fact3-=2; - }; + }; } if(xtx > 114 && xtx < 152) { - qp = QPointF(xtx, state ? qrand() % 3 - 3 + ME2YPOS - Susp * 2 - fact4 : ME2YPOS); + qp = QPointF(xtx, state ? qrand() % 3 + ME2YPOS - Susp * 2 - fact4 : ME2YPOS); if(Susp > 0) { - if(xtx < 132 ) fact4+=2; + if(xtx < 132 ) fact4+=2; else fact4-=2; - }; + }; } if(xtx > 154 && xtx < 192) { - qp = QPointF(xtx, state ? qrand() % 3 - 3 + ME2YPOS - Overl * 2 - fact5 : ME2YPOS); + qp = QPointF(xtx, state ? qrand() % 3 + ME2YPOS - Overl * 2 - fact5 : ME2YPOS); if(Overl > 0) { - if(xtx < 172 ) fact5+=2; + if(xtx < 172 ) fact5+=2; else fact5-=2; - }; + }; } - if(xtx > 194 && xtx < 232) + if(xtx > 194 && xtx < 232) { - qp = QPointF(xtx, state ? qrand() % 3 - 3 + ME2YPOS - Lowl * 2 - fact6 : ME2YPOS); + qp = QPointF(xtx, state ? qrand() % 3 + ME2YPOS - Lowl * 2 - fact6 : ME2YPOS); if(Lowl > 0) { - if(xtx < 212 ) fact6+=2; + if(xtx < 212 ) fact6+=2; else fact6-=2; - }; + }; } - if(xtx > 234 && xtx < 269) + if(xtx > 234 && xtx < 269) { - qp = QPointF(xtx, state ? qrand() % 3 - 3 + ME2YPOS - Alive * 2 - fact7 : ME2YPOS); + qp = QPointF(xtx, state ? qrand() % 3 + ME2YPOS - Alive * 2 - fact7 : ME2YPOS); if(Alive > 0) { - if(xtx < 252 ) fact7+=2; - else fact7-=2; - }; + if(xtx < 252 ) fact7+=1; + else fact7-=1; + }; }; - DrawerTh_ME2Scanner::polyVect.append(qp); - tx = x; + DrawerTh_ME2Scanner::polyVect.append(qp); + tx = x; }; AnomC1 = 0; diff --git a/DrawerTh_ME2Scanner.h b/DrawerTh_ME2Scanner.h index a2c3c1f..2631c9d 100644 --- a/DrawerTh_ME2Scanner.h +++ b/DrawerTh_ME2Scanner.h @@ -1,7 +1,7 @@ #ifndef DRAWERTH_ME2SCANNER_H #define DRAWERTH_ME2SCANNER_H -#define ME2YPOS 100 +#define ME2YPOS 97 #define ME2GRADPOS 10 #include "STh.h" diff --git a/FTPAuth.cpp b/FTPAuth.cpp index 401b002..9e580cc 100644 --- a/FTPAuth.cpp +++ b/FTPAuth.cpp @@ -3,10 +3,7 @@ bool FTPA::checkOutput(const string *buffer) { //Login or password incorrect! - if(Utils::ci_find_substr(*buffer, "200 ok") != -1 || - Utils::ci_find_substr(*buffer, "http/1.0 200") != -1 || - Utils::ci_find_substr(*buffer, "http/1.1 200") != -1 - ) { + if(Utils::ci_find_substr(*buffer, "230") != -1) { return true; } @@ -36,9 +33,9 @@ lopaStr FTPA::_FTPBrute(const char *ip, const int port, const PathStr *ps) { lpString = string(loginLst[i]) + ":" + string(passLst[j]); - Connector::nConnect(ip, port, &buffer, NULL, NULL, &lpString); + Connector::nConnect((string("ftp://") + string(ip)).c_str(), port, &buffer, NULL, NULL, &lpString); - if(checkOutput(&buffer) != 0) { + if(checkOutput(&buffer)) { strcpy(lps.login, loginLst[i]); strcpy(lps.pass, passLst[j]); return lps; @@ -51,8 +48,8 @@ lopaStr FTPA::_FTPBrute(const char *ip, const int port, const PathStr *ps) { return lps; } -lopaStr FTPA::_FTPLobby(const char *ip, const int port, const PathStr *ps){ - while(BrutingThrds >= gMaxBrutingThreads) Sleep(700); +lopaStr FTPA::_FTPLobby(const char *ip, const int port, const PathStr *ps) { + while(BrutingThrds >= gMaxBrutingThreads) Sleep(1000); BruteUtils::BConInc(); const lopaStr &lps = _FTPBrute(ip, port, ps); diff --git a/Threader.cpp b/Threader.cpp new file mode 100644 index 0000000..995e338 --- /dev/null +++ b/Threader.cpp @@ -0,0 +1,21 @@ +#include + +std::vector Threader::threadPool; + +void Threader::createThreadPool(int poolSize, void *func, ST *st) { + for(int i = 0; i < poolSize; ++i) { + pthread_t thrc; + pthread_create(&thrc, NULL, (void *(*)(void*))func, st); + + ThreadStruct threadStruct { + &thrc, + false + }; + + threadPool.push_back(threadStruct); + } +} + +void Threader::fireThread(ST *st) { + +} diff --git a/Threader.h b/Threader.h new file mode 100644 index 0000000..55dae0d --- /dev/null +++ b/Threader.h @@ -0,0 +1,21 @@ +#ifndef THREADER_H +#define THREADER_H + +#include + +struct ThreadStruct{ + pthread_t *handler; + bool busy; +}; + +class Threader { +private: + static std::vector threadPool; + +public: + static void createThreadPool(int poolSize, void *func, ST *st); + static void fireThread(ST *st); + static pthread_t getFreeThread(); +}; + +#endif // THREADER_H diff --git a/connector_old.cpp b/connector_old.cpp index ccfb33b..16c8e3d 100644 --- a/connector_old.cpp +++ b/connector_old.cpp @@ -108,29 +108,6 @@ std::string toLowerStr(const char *str) delete []strr; return tstr; } else return ""; - -// if(tsz == 1) -// { -// if(str[0] == 10) return "[No data!]"; -// else return str; -// } -// else if(tsz > 1) -// { -// char * strr = new char[tsz+1]; -// ZeroMemory(strr, tsz); - -// for (int i = 0; i < tsz; i++) -// { -// strr[i] = tl(str[i]); -// }; - -// memset(strr + tsz, '\0', 1); - -// std::string tstr = strr; -// delete []strr; -// return tstr; -// }; -// return ""; } int OpenConnection(SOCKET *sock, const char *hostname, int port) @@ -357,944 +334,6 @@ char *_makeDigestResponse( return (char*)responseMD5; } -//lopaStr _BABrute(char *cookie, char *ip, int port, char *pathT, char *method) -//{ -// if(strcmp(method, "[DIGEST]") != 0 && strcmp(method, "[NORMAL]") != 0) stt->doEmitionRedFoundData("[-] Unknown method IP: " + QString(ip) + ":" + QString::number(port) + + ""); -// lopaStr lps; -// ZeroMemory(lps.login, sizeof(lps.login)); -// ZeroMemory(lps.pass, sizeof(lps.pass)); -// ZeroMemory(lps.other, sizeof(lps.other)); - -// int cookieLen = strlen(cookie); -// char path[512] = {0}; -// strncpy(path, pathT, 512); - -// int bTO; -// bool goon = false; -// char hRqst[REQUEST_MAX_SIZE] = {0}; -// char headerMsg[REQUEST_MAX_SIZE] = { 0 }; -// char hMsgR[512] = {0}; - -// strcpy(hRqst, "GET "); -// strcat(hRqst, path); -// strcat(hRqst, " HTTP/1.1\r\nHost: "); -// strcat(hRqst, ip); - -// if(port != 80){ -// strcat(hRqst, ":"); -// char tbuff[16] = {0}; -// sprintf(tbuff, "%d", port); -// strcat(hRqst, tbuff); -// }; - -// if(cookieLen != 0) -// { -// strcat(hRqst, "\r\nCookie: "); -// strcat(hRqst, cookie); -// }; -// strcat(hRqst, "\r\nUser-Agent: Mozilla/5.0 (X11; U; Linux i686; us; rv:1.9.0.11) Gecko/2009060308 Ubuntu/9.04 (jaunty) Firefox/3.0.11\r\nAccept: text/html, application/xml;q=0.9, application/xhtml+xml, image/png, image/jpeg, image/gif, image/x-xbitmap, */*;q=0.1\r\nAccept-Language: en-US,ru;q=0.9,en;q=0.8\r\nAccept-Charset: iso-8859-1, utf-8, utf-16, *;q=0.1\r\nAccept-Encoding: text, identity, *;q=0\r\nAuthorization: Basic bG9sa2E6bG9sa2F=\r\n\r\n"); - -// sockaddr_in sockAddr; -// if(port == 443) -// { -// ZeroMemory(headerMsg, REQUEST_MAX_SIZE); -// _baSSLWorker(ip, hRqst, headerMsg); -// } - -// else -// { -// SOCKET sock; -// sockAddr.sin_family = AF_INET; -// sockAddr.sin_port = htons(port); -// HOSTENT *host; -//#if defined(WIN32) || defined(_WIN32) || defined(__WIN32) && !defined(__CYGWIN__) -// if(inet_addr(ip) != INADDR_NONE) sockAddr.sin_addr.S_un.S_addr = inet_addr(ip); -// else if(host=gethostbyname (ip)) ((unsigned long*) &sockAddr.sin_addr)[0] = ((unsigned long**)host->h_addr_list)[0][0]; -// else -// { -// isActive = 0; -// strcpy(lps.login, "UNKNOWN"); -// return lps; -// }; -//#else -// if(inet_addr(ip) != INADDR_NONE) sockAddr.sin_addr.s_addr = inet_addr(ip); -// else if(host=gethostbyname (ip)) ((unsigned long*) &sockAddr.sin_addr)[0] = ((unsigned long**)host->h_addr_list)[0][0]; -// else -// { -// isActive = 0; -// strcpy(lps.login, "UNKNOWN"); -// return lps; -// }; -//#endif -// sock = socket( AF_INET, SOCK_STREAM, IPPROTO_TCP ); -// if(sock != INVALID_SOCKET) { - -// if(connect(sock, (sockaddr*)&sockAddr, sizeof(sockAddr)) != SOCKET_ERROR) { - -// if(send(sock, hRqst, strlen(hRqst), 0) != SOCKET_ERROR) { - -// if(MapWidgetOpened) stt->doEmitionAddOutData(QString(hRqst)); -// ZeroMemory(headerMsg, REQUEST_MAX_SIZE); -// int x = 1; -// int xx = 0; - -// while (xx < REQUEST_MAX_SIZE) -// { -// x = recvWT(sock, hMsgR, sizeof(hMsgR), gTimeOut + 5, &bTO); -// if(x <= 0) break; -// strncat(headerMsg, hMsgR, x); -// xx += x; -// ZeroMemory(hMsgR, sizeof(hMsgR)); -// }; - -// if(MapWidgetOpened) stt->doEmitionAddIncData(QString(ip), QString(headerMsg)); -// } else { -// if(gDebugMode) stt->doEmitionDebugFoundData("[BA::Send]: " + QString::number(WSAGetLastError())); -// }; -// } else { -// if(gDebugMode) stt->doEmitionDebugFoundData("[BA::Connect]: " + QString::number(WSAGetLastError())); -// }; -// } else { -// if(gDebugMode) stt->doEmitionDebugFoundData("[BA: Invalid socket]: " + QString::number(WSAGetLastError())); -// }; -// CSSOCKET(sock); -// }; - - - -// if(strlen(headerMsg) == 0) -// { -// isActive = 0; - -// strcpy(lps.login, "UNKNOWN"); -// return lps; -// }; - -// if(strstr(headerMsg, "401 ") == NULL -// && strstr(headerMsg, ".1 401") == NULL -// && strstr(headerMsg, ".0 401") == NULL -// && strstr(headerMsg, "401") == NULL -// && strstr(headerMsg, "Unauthorized") == NULL -// && strstr(headerMsg, "неправильны") == NULL && strstr(headerMsg, "Неправильны") == NULL -// && strstr(headerMsg, "Неправильны") == NULL -// ) -// { -// if(strstri(headerMsg, "400 Bad") != NULL) -// { -// strcpy(lps.other, "[400 Bad Request]"); -// isActive = 0; -// return lps; -// } -// else if(strstri(headerMsg, "404 Not") != NULL -// || strstr(headerMsg, "404 ") != NULL -// || strstr(headerMsg, ".1 404") != NULL -// || strstr(headerMsg, ".0 404") != NULL -// ) -// { -// if(strstr(path, "/axis-cgi/com/ptz.cgi?") != NULL) -// { -// int sz = strlen("/view/viewer_index.shtml"); -// strncpy(path, "/view/viewer_index.shtml", sz); -// memset(path + sz, 0, 1); -// goon = true; -// } -// else -// { -// strcpy(lps.other, QString("[404 Not Found (" + QString(path) + ")]").toLocal8Bit().data()); -// isActive = 0; -// return lps; -// }; -// } -// else if( // -// (strstr(headerMsg, ".1 403") != NULL // -// || strstr(headerMsg, ".0 403") != NULL //Hikkvision2 -// ) // -// && strstr(headerMsg, "badAuthorization") != NULL // -// ) -// { -// goon = true; -// } -// else if(strlen(headerMsg) < 16) -// { -// goon = true; -// stt->doEmitionRedFoundData("Corrupted reply: (" + QString(headerMsg) + ") " + QString(ip) + ":"+ QString::number(port)); -// }; - -// if(goon == false) -// { -// strcpy(lps.login, "NULL"); -// strcpy(lps.pass, "NULL"); -// isActive = 0; -// return lps; -// }; -// }; - - -// isActive = 1; -// char tPass[256] = {0}; -// char curLogin[256] = {0}; -// char curPass[256] = {0}; -// int cCode; -// int dataSz = 0; -// char request[REQUEST_MAX_SIZE] = {0}; -// char recvBuff[4096] = {0}; -// char recvBuff2[512] = {0}; -// char pass[256] = {0}; - -// char localBuff[4096] = {0}; -// strcpy(localBuff, headerMsg); -// int passCounter = 1; -// char attribute[2048] = {0}; -// char nonce[512] = {0}; -// char realm[512] = {0}; -// char opaque[512] = {0}; -// char qop[64] = {0}; -// std::string encoded = ""; - -// for(int i = 0; i < MaxLogin; i++) -// { -// if(globalScanFlag == false) break; -// for (int j = 0; j < MaxPass; j++) -// { -// if (globalScanFlag == false) break; - -// ZeroMemory(request, REQUEST_MAX_SIZE); -// ZeroMemory(curLogin, sizeof(curLogin)); -// ZeroMemory(curPass, sizeof(curPass)); -// strcpy(curLogin, loginLst[i]); -// strcpy(curPass, passLst[j]); - -// if (strcmp(method, "[DIGEST]") == 0 && strstr(localBuff, "nonce=") != NULL) -// { -// ZeroMemory(attribute, sizeof(attribute)); -//// strcpy(attribute, _getAttribute(localBuff, "WWW-Authenticate:")); -// ZeroMemory(nonce, sizeof(nonce)); -// strcpy(nonce, _getAttributeValue(attribute, "nonce=", ip, port)); -// ZeroMemory(realm, sizeof(realm)); -// strcpy(realm, _getAttributeValue(attribute, "realm=", ip, port)); -// ZeroMemory(qop, sizeof(qop)); -// if (strstri(attribute, "qop") != NULL) -// { -// strcpy(qop, _getAttributeValue(attribute, "qop=", ip, port)); -// }; - -// strcpy(request, "GET "); -// strcat(request, path); -// strcat(request, " HTTP/1.1\r\nHost: "); -// strcat(request, ip); -// if (port != 80){ -// strcat(request, ":"); -// char tbuff[16] = { 0 }; -// sprintf(tbuff, "%d", port); -// strcat(request, tbuff); -// }; -// if (cookieLen != 0) -// { -// strcat(request, "\r\nCookie: "); -// strcat(request, cookie); -// }; - -// strcat(request, "\r\nUser-Agent: Mozilla/5.0 (X11; U; Linux i686; us; rv:1.9.0.11) Gecko/2009060308 Ubuntu/9.04 (jaunty) Firefox/3.0.11\r\nAccept: text/html, application/xml;q=0.9, application/xhtml+xml, image/png, image/jpeg, image/gif, image/x-xbitmap, */*;q=0.1\r\nAccept-Language: en-US,ru;q=0.9,en;q=0.8\r\nAccept-Charset: iso-8859-1, utf-8, utf-16, *;q=0.1\r\nAccept-Encoding: text, identity, *;q=0\r\nAuthorization: Digest username=\""); -// strcat(request, curLogin); -// strcat(request, "\", realm=\""); -// strcat(request, realm); -// strcat(request, "\", nonce=\""); -// strcat(request, nonce); -// strcat(request, "\", uri=\""); -// strcat(request, path); -// strcat(request, "\", qop=auth, response=\""); -// strcat(request, _makeDigestResponse(curLogin, realm, curPass, path, nonce, "10000001", "9d531d56796e0dc9", qop)); -// if (strstri(attribute, "opaque") != NULL) -// { -// ZeroMemory(opaque, sizeof(opaque)); -// strcpy(opaque, _getAttributeValue(attribute, "opaque=", ip, port)); -// strcat(request, "\", opaque=\""); -// strcat(request, opaque); -// }; -// strcat(request, "\", nc=10000001, cnonce=\"9d531d56796e0dc9\""); -// strcat(request, "\r\nConnection: close\r\n\r\n"); -// } -// else -// { -// ZeroMemory(tPass, sizeof(tPass)); -// strncpy(tPass, curLogin, strlen(curLogin)); -// strcat(tPass, ":"); -// strncat(tPass, curPass, strlen(curPass)); -// encoded = base64_encode((const unsigned char *)tPass, strlen(tPass)); -// strcpy(request, "GET "); -// strcat(request, path); -// strcat(request, " HTTP/1.1\r\nHost: "); -// strcat(request, ip); -// if (port != 80){ -// strcat(request, ":"); -// char tbuff[16] = { 0 }; -// sprintf(tbuff, "%d", port); -// strcat(request, tbuff); -// }; -// if (cookieLen != 0) -// { -// strcat(request, "\r\nCookie: "); -// strcat(request, cookie); -// }; - -// strcat(request, "\r\nUser-Agent: Mozilla/5.0 (X11; U; Linux i686; us; rv:1.9.0.11) Gecko/2009060308 Ubuntu/9.04 (jaunty) Firefox/3.0.11\r\nAccept: text/html, application/xml;q=0.9, application/xhtml+xml, image/png, image/jpeg, image/gif, image/x-xbitmap, */*;q=0.1\r\nAccept-Language: en-US,ru;q=0.9,en;q=0.8\r\nAccept-Charset: iso-8859-1, utf-8, utf-16, *;q=0.1\r\nAccept-Encoding: text, identity, *;q=0\r\nAuthorization: Basic "); -// strcat(request, encoded.c_str()); -// strcat(request, "\r\nConnection: close\r\n\r\n"); -// }; - -// if (port == 443) -// { -// ZeroMemory(recvBuff, sizeof(recvBuff)); -// if (BALogSwitched) stt->doEmitionBAData("Probing SSL:BA " + QString(ip) + ":" + QString::number(port) + "; login/pass: " + QString(tPass) + ";"); -// _baSSLWorker(ip, request, recvBuff); -// dataSz = strlen(recvBuff); -// } - -// else -// { -// SOCKET sock = socket(AF_INET, SOCK_STREAM, IPPROTO_TCP); -// cCode = connect(sock, (sockaddr*)&sockAddr, sizeof(sockAddr)); - -// if (cCode == SOCKET_ERROR) { - -// int errorCode = WSAGetLastError(); -// if (errorCode == WSAENOTSOCK) { - -// while (errorCode == WSAENOTSOCK) -// { -// if (gDebugMode) stt->doEmitionDebugFoundData("[BA][ENOTSOCK] - [" + QString(ip) + ":" + QString::number(port) + "]"); -// CSSOCKET(sock); -// sock = socket(AF_INET, SOCK_STREAM, IPPROTO_TCP); -// cCode = connect(sock, (sockaddr*)&sockAddr, sizeof(sockAddr)); -// errorCode = WSAGetLastError(); -// }; -// } -// else { - -// CSSOCKET(sock); - -// if (errorCode != WSAETIMEDOUT) -// { -// stt->doEmitionRedFoundData("[BA] Cannot connect to " + QString(ip) + "[" + QString::number(errorCode) + "]"); -// }; - -// isActive = 0; -// strcpy(lps.login, "UNKNOWN"); -// return lps; -// }; -// } -// else { - -// int x = 1; -// Activity += strlen(request); - -// if (send(sock, request, strlen(request), 0) != SOCKET_ERROR) -// { -// if (MapWidgetOpened) stt->doEmitionAddOutData(QString(request)); -// dataSz = 0; -// ZeroMemory(recvBuff2, sizeof(recvBuff2)); -// ZeroMemory(recvBuff, sizeof(recvBuff)); -// while (x > 0 && dataSz < 3384) -// { -// ZeroMemory(recvBuff2, sizeof(recvBuff2)); -// x = recvWT(sock, recvBuff2, sizeof(recvBuff2), gTimeOut + 5, &bTO); - -// dataSz += x; -// Activity += x; -// strncat(recvBuff, recvBuff2, x); -// }; -// if (BALogSwitched) stt->doEmitionBAData("Checked BA: " + QString(ip) + ":" + QString::number(port) + "; login/pass: " + QString(curLogin) + ":" + QString(curPass) + "; - Progress: (" + QString::number((passCounter / (double)(MaxPass*MaxLogin)) * 100).mid(0, 4) + "%)"); -// } -// else -// { -// stt->doEmitionRedFoundData("[BA] Send error! [" + QString(ip) + "]"); - -// CSSOCKET(sock); -// isActive = 0; -// strcpy(lps.login, "UNKNOWN"); -// return lps; -// } -// }; -// CSSOCKET(sock); -// }; - - -// if (MapWidgetOpened) stt->doEmitionAddIncData(QString(ip), QString(recvBuff)); - -// if (dataSz == 0) -// { -// stt->doEmitionBAData("[BA] No reply from: " + QString(ip) + "; Repeating..."); -// --j; -// continue; -// } -// else -// { -// ++passCounter; -// }; - -// if (strcmp(method, "[DIGEST]") == 0) -// { -// ZeroMemory(localBuff, sizeof(localBuff)); -// strcpy(localBuff, recvBuff); -// }; -// if (strstri(recvBuff, "http/1.1 401") != NULL -// || strstri(recvBuff, "http/1.0 401") != NULL -// || (strstri(recvBuff, "200 ok") != NULL -// && strstri(recvBuff, "401") != NULL -// && strstri(recvBuff, "Unauthorized") != NULL) -// ) -// { -// Sleep(200); -// } else -// //if(strstri(recvBuff, "http/1.1 401") == NULL -// // || strstri(recvBuff, "http/1.0 401") == NULL -// // ) -// //{ -// // if ((strstri(recvBuff, "200 ok") != NULL -// // || strstri(recvBuff, "http/1.0 200") != NULL -// // || strstri(recvBuff, "http/1.1 200") != NULL -// // ) -// // && strstr(headerMsg, "неправильны") == NULL -// // && strstr(headerMsg, "Неправильны") == NULL -// // && strstr(headerMsg, "Неправильны") == NULL) -// // { -// // } -// // stt->doEmition_BARedData("[.] 503/400/403 - Waiting 30sec (" + QString(ip) + ":" + QString::number(port) + ")"); -// // Sleep(200); -// // ///dummy/// -// //} -// if(strstri(recvBuff, "503 service unavailable") != NULL -// || strstri(recvBuff, "http/1.1 503") != NULL -// || strstri(recvBuff, "http/1.0 503") != NULL -// || strstr(recvBuff, "400 BAD_REQUEST") != NULL -// || strstri(recvBuff, "400 bad request") != NULL -// || strstr(recvBuff, "403 Forbidden") != NULL -// ) -// { -// stt->doEmition_BARedData("[.] 503/400/403 - Waiting 30sec (" + QString(ip) + ":" + QString::number(port) + ")"); - -// if(j > 0) --j; -// Sleep(30000); -// } -// else if((strstri(recvBuff, "http/1.1 404") != NULL -// || strstri(recvBuff, "http/1.0 404") != NULL -// ) -// && strstri(recvBuff, "Authorization required") == NULL -// ) -// { -// if(HTMLDebugMode) _DebugWriteHTMLToFile(request, recvBuff); - -// if (i > 0 || j > 0) stt->doEmitionYellowFoundData("[?] Unexpected 404. Check " + QString(ip) + ":" + QString::number(port) + " l/p:" + QString(tPass) + " manually. (" + QString(ip) + ":" + QString::number(port) + QString(path) + ")"); -// else stt->doEmitionRedFoundData("[-] 404 - Wrong path detected. (" + QString(ip) + ":" + QString::number(port) + QString(path) + ")"); - -// isActive = 0; -// strcpy(lps.login, "UNKNOWN"); -// return lps; -// } -// else if ((strstri(recvBuff, "200 ok") != NULL -// || strstri(recvBuff, "http/1.0 200") != NULL -// || strstri(recvBuff, "http/1.1 200") != NULL -// ) -// && strstri(recvBuff, "http/1.1 401 ") == NULL -// && strstri(recvBuff, "http/1.0 401 ") == NULL -// && strstri(recvBuff, "401") == NULL -// && strstri(recvBuff, "Unauthorized") == NULL -// && strstri(recvBuff, "неправильны") == NULL -// && strstri(recvBuff, "Неправильны") == NULL -// && dataSz > 13 -// ) -// { -// if(strstri(recvBuff, "access is denied") == NULL -// && strstri(recvBuff, "iisstart") == NULL -// && strstri(recvBuff, "Location:") == NULL -// && strstri(recvBuff, "access forbidden") == NULL -// ) -// { -// ZeroMemory(pass, sizeof(pass)); -// strcpy(pass, ip); -// strcat(pass, " - Password found: "); -// strcat(pass, tPass); -// isActive = 0; -// stt->doEmition_BAGreenData("[+] " + QString(pass)); -// strcpy(lps.login, curLogin); -// strcpy(lps.pass, curPass); -// return lps; -// }; -// } -// else -// { -// if (strstri(recvBuff, "неправильны") == NULL -// && strstri(recvBuff, "Неправильны") == NULL) -// { -// ZeroMemory(pass, sizeof(pass)); -// sprintf(pass, "%s - Password found: %s", ip, tPass); -// char *pt1 = strstr(recvBuff, " "); -// if(pt1 != NULL) -// { -// char *pt2 = strstr(pt1 + 1, " "); -// if(pt2 != NULL) -// { -// int sz = pt2 - pt1 - 1; -// char tempHeaderCode[16] = {0}; -// strncpy(tempHeaderCode, pt1 + 1, sz); - -// if(strcmp(tempHeaderCode, "302") == 0 && strcmp(tempHeaderCode, "200") == 0) stt->doEmitionYellowFoundData("[+] No/unexpected HTTP header detected (" + QString(tempHeaderCode) + ") IP: " + QString(ip) + ":" + QString::number(port) + ""); -// strcpy(lps.login, curLogin); -// strcpy(lps.pass, curPass); -// return lps; -// }; -// }; -// stt->doEmitionYellowFoundData("[+] No/unexpected HTTP header detected (?) IP: " + QString(ip) + ":" + QString::number(port) + ""); -// strcpy(lps.login, curLogin); -// strcpy(lps.pass, curPass); -// isActive = 0; -// return lps; -// } -// else Sleep(200); -// }; - -// if(strstr(recvBuff, "Set-Cookie:") != NULL) -// { -// ZeroMemory(cookie, COOKIE_MAX_SIZE); -//// strncpy(cookie, _getAttribute(recvBuff, "Set-Cookie:"), COOKIE_MAX_SIZE); -// cookieLen = strlen(cookie); -// }; -// }; -// }; - -// isActive = 0; - -// strcpy(lps.login, "UNKNOWN"); -// return lps; -//} - -//lopaStr _BALobby(char *cookie, char *ip, int port, char *path, char *method) -//{ -// while(BrutingThrds >= gMaxBrutingThreads) Sleep(700); - -// BruteUtils::BConInc(); -// lopaStr res = _BABrute(cookie, ip, port, path, method); -// BruteUtils::BConDec(); - -// return res; -//} - -//lopaStr _FTPBrute(char *ip, int port, PathStr *ps) -//{ -// lopaStr lps; -// ZeroMemory(lps.login, sizeof(lps.login)); -// ZeroMemory(lps.pass, sizeof(lps.pass)); -// ZeroMemory(lps.other, sizeof(lps.other)); - -// char recvBuff[1024] = {0}, request[64] = {0}; -// sockaddr_in sockAddr; -// sockAddr.sin_family = AF_INET; -// sockAddr.sin_port = htons(port); -// HOSTENT *host; - -//#if defined(WIN32) || defined(_WIN32) || defined(__WIN32) && !defined(__CYGWIN__) -// if(inet_addr(ip) != INADDR_NONE) sockAddr.sin_addr.S_un.S_addr = inet_addr(ip); -// else if(host=gethostbyname (ip)) ((unsigned long*) &sockAddr.sin_addr)[0] = ((unsigned long**)host->h_addr_list)[0][0]; -// else -// { -// strcpy(lps.login, "UNKNOWN"); -// return lps; -// }; -//#else -// if(inet_addr(ip) != INADDR_NONE) sockAddr.sin_addr.s_addr = inet_addr(ip); -// else if(host=gethostbyname (ip)) ((unsigned long*) &sockAddr.sin_addr)[0] = ((unsigned long**)host->h_addr_list)[0][0]; -// else -// { -// strcpy(lps.login, "UNKNOWN"); -// return lps; -// }; -//#endif - -// bool breakPassLoop = 0; -// int passCounter = 1; -// int bTO; -// int x = 0; -// int connectionResult, closedSocket = 1, loginFailedFlag = 0; - -// SOCKET sockFTP; -// for(int i = 0; i < MaxLogin; ++i) -// { -// if(globalScanFlag == false) break; -// if(strlen(loginLst[i]) <= 1) continue; - -// for(int j = 0; j < MaxPass; ++j) -// { -// if(globalScanFlag == false) break; -// if(strlen(passLst[j]) <= 1) continue; - -// if(closedSocket) -// { -// closedSocket = 0; -// sockFTP = socket( AF_INET, SOCK_STREAM, IPPROTO_TCP ); -// connectionResult = connect(sockFTP, (sockaddr*)&sockAddr, sizeof(sockAddr)); - -// while(WSAGetLastError() == WSAENOTSOCK) -// { -// if(gDebugMode) stt->doEmitionDebugFoundData("[FTP][ENOTSOCK] [" + QString(ip) + ":" + QString::number(port) + "]"); -// CSSOCKET(sockFTP); -// sockFTP = socket( AF_INET, SOCK_STREAM, IPPROTO_TCP ); -// connectionResult = connect(sockFTP, (sockaddr*)&sockAddr, sizeof(sockAddr)); -// }; -// loginFailedFlag = 0; -// }; - -// if(connectionResult != SOCKET_ERROR) -// { -// x = 0; -// while (true) -// { -// Sleep(100); -// ZeroMemory(recvBuff, 1024); -// x = recvWT(sockFTP, recvBuff, 1024, gTimeOut + 5, &bTO); -// if(x <= 0) break; -// if(MapWidgetOpened) stt->doEmitionAddIncData(QString(ip), QString(recvBuff)); - -// Activity += x; -// closedSocket = 0; -// if(strstr(recvBuff, "451 The parameter is incorrect") != NULL) -// { -// CSSOCKET(sockFTP); -// stt->doEmition_BARedData("[*] Unknown protocol (451 Error) - " + QString(ip)); -// strcpy(lps.other, "Unknown protocol (451 Error)"); -// return lps; -// }; - -// if(strstri(recvBuff, "only anonymous") != NULL) -// { -// CSSOCKET(sockFTP); -// stt->doEmition_BAGreenData("[*] Anonymous access detected - " + QString(ip)); - -// strcpy(lps.login, "anonymous"); -// strcpy(lps.pass, "1"); -// return lps; -// }; - -// if(strstr(recvBuff, "550 no connections allowed") != NULL -// || strstr(recvBuff, "550-") != NULL -// ) -// { -// CSSOCKET(sockFTP); - -// stt->doEmition_BARedData("[-] 550 (No connections allowed) - Ban detected. Dropping " + QString(ip)); - -// strcpy(lps.login, "UNKNOWN"); -// return lps; -// }; - -// if(strstr(recvBuff, "no such command")) -// { -// CSSOCKET(sockFTP); - -// stt->doEmition_BARedData("[-] 500 (Sorry, no such command) " + QString(ip)); -// strcpy(lps.other, "[500 Sorry, no such command]"); -// return lps; -// }; - -// if((strstr(recvBuff, "500 ") != NULL -// || strstr(recvBuff, "500-") != NULL -// ) -// && strstri(recvBuff, "500 oops") == NULL -// ) -// { -// j = 0; -// break; -// }; - -// if(strstr(recvBuff, "421 ") != NULL || strstr(recvBuff, "421-") != NULL) -// { -// break; -// }; - -// if(strstri(recvBuff, "530 Sorry, no ANONYMOUS access allowed.") != NULL) -// { -// ++i; -// break; -// }; - -// if(globalScanFlag == false) break; - -// if((strstr(recvBuff, "530 Sorry") != NULL) -// || (strstr(recvBuff, "530") != NULL && strstr(recvBuff, "maximum") != NULL) -// || strstr(recvBuff, "exceeded") != NULL -// || strstr(recvBuff, "421 Too many") != NULL -// || strstr(recvBuff, "from this IP") != NULL -// || strstr(recvBuff, "from your IP") != NULL) -// { -// stt->doEmition_BARedData("[-] FTP: 530 - Ban detected? Waiting 30sec (" + QString(ip) + ")"); -// if(j > 0) --j; -// ZeroMemory(recvBuff, sizeof(recvBuff)); -// Sleep(30000); -// break; -// } -// else if( (strstr(recvBuff, "220 ") != NULL || loginFailedFlag == 1 || strstr(recvBuff, "503") != NULL || strstr(recvBuff, "server ready") != NULL )) -// { -// strcpy(request, "USER "); -// if(strlen(loginLst[i]) != 0) strcat(request, loginLst[i]); -// else -// { -// loginFailedFlag = 1; -// break; -// }; -// strcat(request, "\r\n"); -// if(send(sockFTP, request, strlen(request), 0) != SOCKET_ERROR) -// { -// if(MapWidgetOpened) stt->doEmitionAddOutData(QString(request)); -// Activity += strlen(request); - -// ZeroMemory(request, sizeof(request)); -// } -// else -// { -// stt->doEmitionRedFoundData("[FTP] Send error. " + QString(ip) + ":" + QString::number(port)); -// }; -// } -// else if(strstr(recvBuff, "530") != NULL -// || strstr(recvBuff, "Login incorrect") != NULL -// || strstri(recvBuff, "500 oops") != NULL -// ) -// { -// loginFailedFlag = 1; -// break; -// } -// else if(strstr(recvBuff, "331") != NULL) -// { -// if(strstr(recvBuff, "Non-anonymous sessions must use encryption") != NULL -// || strstr(recvBuff, "Rejected--secure connection required") != NULL -// ) -// { -// stt->doEmition_BARedData("FTP server (" + QString(ip) + ") appears to require SSL for specified user: " + QString(loginLst[i])); -// CSSOCKET(sockFTP); -// strcpy(lps.login, "UNKNOWN"); -// return lps; -// } -// else if(strstri(recvBuff, "permission denied") == NULL) -// { -// strcpy(request, "PASS "); -// if(strlen(passLst[j]) != 0) strcat(request, passLst[j]); -// else -// { -// loginFailedFlag = 1; -// break; -// }; -// strcat(request, "\r\n"); -// if(send(sockFTP, request, strlen(request), 0) != SOCKET_ERROR) -// { -// if(MapWidgetOpened) stt->doEmitionAddOutData(QString(request)); - -// Activity += strlen(request); -// ZeroMemory(request, sizeof(request)); - -// if(BALogSwitched) stt->doEmitionBAData("Probing FTP: " + QString(ip) + ":" + QString::number(port) + "; login/pass: " + QString(loginLst[i]) + ":" + QString(passLst[j]) + "; - Progress: (" + QString::number((passCounter/(double)(MaxPass*MaxLogin)) * 100).mid(0, 4) + "%)"); -// ++passCounter; -// } -// else -// { -// stt->doEmitionRedFoundData("[FTP] Send error. " + QString(ip) + ":" + QString::number(port)); -// }; -// } -// else -// { -// breakPassLoop = 1; -// stt->doEmition_BARedData("Permission denied for login - " + QString(ip) + ":" + QString::number(port) + "; login: " + QString(loginLst[i])); -// break; -// }; -// } -// else if(strstr(recvBuff, "230") != NULL) -// { -// char pass[128] = {0}; - -// strcpy(pass, ip); -// strcat(pass, " - FTP Password found: "); -// strcat(pass, loginLst[i]); -// strcat(pass, ":"); -// strcat(pass, passLst[j]); - -// char recvBuff2[2048] = {0}; -// if(send(sockFTP, "PASV\r\n", 6, 0) != SOCKET_ERROR) -// { -// int x = 1, xx = 0; -// while(x != 0) -// { -// ZeroMemory(recvBuff, sizeof(recvBuff)); -// x = recvWT(sockFTP, recvBuff, sizeof(recvBuff), gTimeOut + 5, &bTO); -// xx += x; -// if(xx < 1536) strncat(recvBuff2, recvBuff, x); -// else break; -// }; - -// if(strstri(recvBuff2, "unknown command") != NULL || strstri(recvBuff2, "invalid command") != NULL) -// { -// stt->doEmitionYellowFoundData("[-] PASV failed. Router detected?"); -// CSSOCKET(sockFTP); -// strcpy(lps.login, loginLst[i]); -// strcpy(lps.pass, passLst[j]); -// strcpy(lps.other, "ROUTER"); -// return lps; -// }; - -// char *ptr0 = strstr(recvBuff2, "227 "); - -// if( ptr0 != NULL ) -// { -// if(strstr(ptr0, "(") != NULL) -// { -// char pasvData[32] = {0}; -// char *ptr1 = strstr(ptr0, "("); -// char *ptr2 = strstr(ptr0, ")"); -// int sz = ptr2 - ptr1 - 1; -// strncpy(pasvData, ptr1 + 1, sz); -// char *ptr3 = strstr(pasvData, ","); -// ptr3 = strstr(ptr3 + 1, ","); -// ptr3 = strstr(ptr3 + 1, ","); -// ptr3 = strstr(ptr3 + 1, ","); - -// if(ptr3 != NULL) -// { -// char *ptrP2 = strstr(ptr3 + 1, ","); -// char p1c[8] = {0}; -// sz = ptrP2 - ptr3 - 1; -// strncpy(p1c, ptr3 + 1, sz); -// int p1 = atoi(p1c); -// int p2 = atoi(ptrP2 + 1); -// port = p1 * 256 + p2; - -// sockAddr.sin_port = htons(port); -// SOCKET newSockFTP = socket( AF_INET, SOCK_STREAM, IPPROTO_TCP ); -// connectionResult = connect(newSockFTP, (sockaddr*)&sockAddr, sizeof(sockAddr)); - -// send(sockFTP, "LIST\r\n", 6, 0); -// ZeroMemory(recvBuff, sizeof(recvBuff)); -// int x = recvWT(newSockFTP, recvBuff, sizeof(recvBuff), gTimeOut + 3, &bTO); -// if(x <= 0 || strstr(recvBuff, "unknown command") != NULL) -// { -// send(sockFTP, "MLSD\r\n", 6, 0); -// ZeroMemory(recvBuff, sizeof(recvBuff)); -// x = recvWT(newSockFTP, recvBuff, sizeof(recvBuff), gTimeOut + 3, &bTO); -// if(x <= 0 || strstr(recvBuff, "unknown command") != NULL) -// { -// stt->doEmition_BAGreenData("[?] " + QString(pass) + " [MLSD&LIST failed or server closed connection.]"); - -// CSSOCKET(sockFTP); -// CSSOCKET(newSockFTP); -// closedSocket = 1; -// strcpy(lps.login, "UNKNOWN"); -// return lps; -// } -// else { -// stt->doEmition_BAGreenData("[+] " + QString(pass) + " [MLSD succeeded]"); -// ps->directoryCount = _countFTPDirectories(recvBuff); -// }; -// } -// else -// { -// stt->doEmition_BAGreenData("[+] " + QString(pass) + " [LIST succeeded]"); -// ps->directoryCount = _countFTPDirectories(recvBuff); -// }; - -// CSSOCKET(newSockFTP); -// } -// else -// { -// stt->doEmitionYellowFoundData("[*] " + QString(ip) + " [PASV failed]"); -// }; -// } -// else -// { -// stt->doEmitionYellowFoundData("[*] " + QString(ip) + " [PASV TO] Failed!"); -// }; -// } -// else -// { -// stt->doEmitionYellowFoundData("[*] " + QString(ip) + " [PASV TO] Failed!"); -// }; - - -// if(xx > 1) -// { -// strcpy(ps->headr, "
 (");
-//								strncat(ps->headr, recvBuff, 256);
-//								strcat(ps->headr, ")
"); -// }; - -// strcpy(lps.login, loginLst[i]); -// strcpy(lps.pass, passLst[j]); - -// CSSOCKET(sockFTP); -// return lps; -// } -// else -// { -// stt->doEmitionRedFoundData("[FTP] Send error. " + QString(ip) + ":" + QString::number(port)); - -// strcpy(lps.login, loginLst[i]); -// strcpy(lps.pass, passLst[j]); - -// CSSOCKET(sockFTP); -// return lps; -// }; -// }; -// }; - -// CSSOCKET(sockFTP); -// closedSocket = 1; -// ZeroMemory(recvBuff, sizeof(recvBuff)); -// } -// else -// { -// int WSAerr; -// if(connectionResult == -1) WSAerr = WSAGetLastError(); -// else WSAerr = WSAETIMEDOUT; - -// if(gThreads > 1 -// && WSAerr != WSAETIMEDOUT/*Timeout*/ -// && WSAerr != WSAENOBUFS/*POOLOVERFLOW*/ -// && WSAerr != WSAECONNREFUSED/*WSAECONNREFUSED*/ -// && WSAerr != WSAECONNRESET/*WSAECONNRESET*/ -// && WSAerr != 0) -// { -// stt->doEmitionRedFoundData("[FTPBrute] Cannot connect to " + QString(ip) + " " + QString(std::to_string(WSAerr).c_str())); -// }; -// CSSOCKET(sockFTP); -// strcpy(lps.login, "UNKNOWN"); -// return lps; -// }; - -// Sleep(100); - -// if(breakPassLoop) -// { -// breakPassLoop = false; -// break; -// }; -// }; -// }; - -// CSSOCKET(sockFTP); -// strcpy(lps.login, "UNKNOWN"); -// return lps; -//} - -//lopaStr _FTPLobby(char *ip, int port, PathStr *ps) -//{ -// while(BrutingThrds >= gMaxBrutingThreads) Sleep(700); - -// lopaStr lps; -// ZeroMemory(lps.login, sizeof(lps.login)); -// ZeroMemory(lps.pass, sizeof(lps.pass)); -// ZeroMemory(lps.other, sizeof(lps.other)); - -// BruteUtils::BConInc(); -// lps = _FTPBrute(ip, port, ps); -// BruteUtils::BConDec(); - -// return lps; -//} - int _webLoginSeq(char *request, char *login, char *pass, char *ip, int port, int passCounter, char *type, std::vector negVector) { char recvBuff[256] = {0}; @@ -1697,48 +736,3 @@ lopaStr _IPCameraBLobby(char *ip, int port, char *SPEC) return res; } - - - - - - - - -//int Connector::_ConnectToPort(char *ip, int port, char *hl) -//{ -// if(gPingNScan) -// { -// if(_pingMyTarget(ip) == 0) -// { -// return -2; -// }; -// }; - -// std::string buffer; -// int size = 0; - -// if(port == 22) size = _SSHLobby(ip, port, &buffer); -// else size = Connector::nConnect(ip, port, &buffer); - -// if(size > 0) -// { -// ++Alive; -// ++found; -// stt->doEmitionChangeParsed(QString::number(saved) + "/" + QString::number(found)); - -// conSTR CSTR; -// CSTR.lowerBuff = new char[size + 1]; -// CSTR.size = size; -// memcpy(CSTR.lowerBuff, buffer.c_str(), size); -// memset(CSTR.lowerBuff + size, '\0', 1); - -// Lexems lx; -// lx._filler(port, (char *)buffer.c_str(), ip, size, &lx, hl); - -// delete []CSTR.lowerBuff; -// CSTR.lowerBuff = NULL; -// }; - -// return 0; -//} diff --git a/finder.cpp b/finder.cpp index ff86826..b04b21e 100644 --- a/finder.cpp +++ b/finder.cpp @@ -456,15 +456,15 @@ int __checkFileExistence(int flag) { char fileName[64] = {0}; - if(flag == 666 || flag == 350) strcpy(fileName, "./result_files/STRANGE_ERROR.html"); - else if(flag == -22) strcpy(fileName, "./result_files/ssh.html"); - else if(flag == 0 || flag == 15 || flag == -10) strcpy(fileName, "./result_files/strange.html"); - else if(flag == 3) strcpy(fileName, "./result_files/other.html"); - else if(flag == 7) strcpy(fileName, "./result_files/low_loads.html"); - else if(flag == 10) strcpy(fileName, "./result_files/LoginForms.html"); - else if(flag == 16) strcpy(fileName, "./result_files/FTP.html"); + if(flag == 666 || flag == 350) strcpy(fileName, "./"RESULT_DIR_NAME"/STRANGE_ERROR.html"); + else if(flag == -22) strcpy(fileName, "./"RESULT_DIR_NAME"/ssh.html"); + else if(flag == 0 || flag == 15 || flag == -10) strcpy(fileName, "./"RESULT_DIR_NAME"/strange.html"); + else if(flag == 3) strcpy(fileName, "./"RESULT_DIR_NAME"/other.html"); + else if(flag == 7) strcpy(fileName, "./"RESULT_DIR_NAME"/low_loads.html"); + else if(flag == 10) strcpy(fileName, "./"RESULT_DIR_NAME"/LoginForms.html"); + else if(flag == 16) strcpy(fileName, "./"RESULT_DIR_NAME"/FTP.html"); else if(flag >= 17 || flag == 11 || flag == 12 - || flag == 13 || flag == 14 || flag == 1) strcpy(fileName, "./result_files/Basicauth.html"); + || flag == 13 || flag == 14 || flag == 1) strcpy(fileName, "./"RESULT_DIR_NAME"/Basicauth.html"); FILE *f = fopen(fileName, "r"); if(f == NULL) return true; @@ -493,39 +493,39 @@ void fputsf(char *text, int flag, char *msg) if(flag == 0 || flag == 15 || flag == -10) { if(ftsAnom) ftsAnom = __checkFileExistence(flag); - file = fopen("./result_files/strange.html", "a"); + file = fopen("./"RESULT_DIR_NAME"/strange.html", "a"); } else if(flag == 3) { if(ftsOther) ftsOther = __checkFileExistence(flag); - file = fopen("./result_files/other.html", "a"); + file = fopen("./"RESULT_DIR_NAME"/other.html", "a"); } else if(flag == -22) { if(ftsSSH) ftsSSH = __checkFileExistence(flag); - file = fopen("./result_files/SSH.html", "a"); + file = fopen("./"RESULT_DIR_NAME"/SSH.html", "a"); } else if(flag == 7) { if(ftsLL) ftsLL = __checkFileExistence(flag); - file = fopen("./result_files/low_loads.html", "a"); + file = fopen("./"RESULT_DIR_NAME"/low_loads.html", "a"); } else if(flag == 10) { if(ftsLF) ftsLF = __checkFileExistence(flag); - file = fopen("./result_files/LoginForms.html", "a"); + file = fopen("./"RESULT_DIR_NAME"/LoginForms.html", "a"); } else if(flag == 16) { if(ftsFTP) ftsFTP = __checkFileExistence(flag); - file = fopen("./result_files/FTP.html", "a"); + file = fopen("./"RESULT_DIR_NAME"/FTP.html", "a"); } else if(flag >= 17 || flag == 11 || flag == 12 || flag == 13 || flag == 14 || flag == 1 ) { if(ftsBA) ftsBA = __checkFileExistence(flag); - file = fopen("./result_files/Basicauth.html", "a"); + file = fopen("./"RESULT_DIR_NAME"/Basicauth.html", "a"); } else { @@ -1718,7 +1718,8 @@ int redirectReconnect(char *cookie, char *ip, int port, char *str, Lexems *ls, P { tempPort = 443; char *ptr1 = strstri(str, "https://"); - char *ptr2 = _findFirst(str + 8, ":/?"); + char *ptr2 = _findFirst(ptr1 + 8, ":/?"); + if(ptr2 != NULL) { int sz = ptr2 - ptr1 - 8; @@ -1829,7 +1830,7 @@ int redirectReconnect(char *cookie, char *ip, int port, char *str, Lexems *ls, P { tempPort = 80; char *ptr1 = strstri(str, "http://"); - char *ptr2 = _findFirst(str + 7, ":/?"); + char *ptr2 = _findFirst(ptr1 + 7, ":/?"); if(ptr2 != NULL) { @@ -2260,6 +2261,73 @@ int Lexems::_header(char *ip, int port, const char str[], Lexems *l, PathStr *ps || strstri(str, "top.htm?") != NULL ) strcat(finalstr, " [?][SecCam detected]"); + if(strstri(str, "http-equiv=\"refresh\"") != NULL + || strstri(str, "http-equiv=refresh") != NULL + || strstri(str, "http-equiv='refresh'") != NULL + ) + { + char *temp = NULL; + char *strTmp = NULL; + + if(strstri(str, "http-equiv=\"refresh\"") != NULL) strTmp = strstri(str, "http-equiv=\"refresh\""); + else if(strstri(str, "http-equiv=refresh") != NULL) strTmp = strstri(str, "http-equiv=refresh"); + else if(strstri(str, "http-equiv='refresh'") != NULL) strTmp = strstri(str, "http-equiv='refresh'"); + + if(strstri(strTmp, "url=") != NULL ) + { + if((int)(strstri(strTmp, "url=") - strTmp) < 100) + { + temp = strstri(strTmp, "url="); + + char *temp2 = NULL, temp3[128] = {0}; + int sz = 0; + + if(temp[4] == '"' || temp[4] == '\'' || temp[4] == ' ' || temp[4] == '\n' || temp[4] == '\r') + { + temp2 = _findFirst(temp + 6, " \n>\"'"); + if(temp2 != NULL) + { + sz = (int)(temp2 - temp) - 5; + strncpy(temp3, (char*)(temp + 5), (sz < 128 ? sz : 127)); + }; + } + else + { + temp2 = _findFirst(temp + 4, " \n>\"'"); + if(temp2 != NULL) + { + sz = (int)(temp2 - temp) - 4; + strncpy(temp3, (char*)(temp + 4), sz < 128 ? sz : 127); + }; + }; + if(strstri(temp3, "http://") == NULL && strstri(temp3, "https://") == NULL) + { + if(temp3[0] != '.') + { + if(temp3[0] != '/') + { + char temp4[128] = {0}; + strcpy(temp4, "/"); + strncat(temp4, temp3, 127); + strncpy(temp3, temp4, 128); + }; + }; + }; + redirectStr = std::string(temp3); + if(std::find(redirStrLst->begin(), redirStrLst->end(), redirectStr) == redirStrLst->end()) + { + redirStrLst->push_back(redirectStr); + return redirectReconnect(ps->cookie, ip, port, temp3, l, ps, redirStrLst); + } return -1; + strcat(ps->headr, " "); + return -2; + }; + strcat(ps->headr, finalstr); + strcat(ps->headr, " "); + return 0; + }; + }; + if(strstri(str, " - + EnvironmentId diff --git a/nesca_3.cpp b/nesca_3.cpp index 248b81d..e3f97b8 100644 --- a/nesca_3.cpp +++ b/nesca_3.cpp @@ -2190,6 +2190,8 @@ void nesca_3::slotShowNicks() QRegExp _rOutProt(" HTTP/1.\\d+"); QRegExp _rOutPath(" /(\\w|\\.|,|/|:|-|_|\\?|!|\\@|#|\\$|%|\\^|&|\\*|\\(|\\)|=|\\+|<|>|;|:|\"|'|~|\\[|\\])* "); QRegExp _rOutHost("Host: ((\\w|\\d|\\.|:|/)*)\\r\\n"); +QRegExp qrp("\\n(.+):"); + void nesca_3::slotOutData(QString str) { if(SendData != NULL) @@ -2203,19 +2205,8 @@ void nesca_3::slotOutData(QString str) str.replace("HTTP ", "HTTP "); str.replace("GET ", "GET "); str.replace("POST ", "POST "); - str.replace("Host: ", "Host: "); - str.replace("Cookie: ", "Cookie: "); - str.replace("Accept-Language:", "Accept-Language:"); - str.replace("Accept-Charset:", "Accept-Charset:"); - str.replace("Accept-Encoding:", "Accept-Encoding:"); - str.replace("Accept:", "Accept:"); - str.replace("User-Agent:", "User-Agent:"); - str.replace("Proxy-Connection:", "Proxy-Connection:"); - str.replace("Connection:", "Connection:"); - str.replace("Content-Length:", "Content-Length:"); - str.replace("Authorization:", "Authorization:"); - str.replace("X-Nescav3:", "X-Nescav3:"); - str.replace("Referer:", "Referer:"); + str.replace(qrp, "
\\1:"); + str.replace(QRegExp("(ftp:.+@)"), "\\1"); _rOutProt.indexIn(str); prot = _rOutProt.cap(0); @@ -3009,13 +3000,12 @@ void nesca_3::saveOptions() _SaveBackupToFile(); } -QString loadNescaSetup(char *resStr, char *option) { +QString loadNescaSetup(const char *resStr, const char *option) { - char *lex = NULL - ; + char *lex = NULL; if(strstr(resStr, option) != NULL) { - lex = strstr(resStr, option) + strlen(option); + lex = (char*)(strstr(resStr, option) + strlen(option)); if(strlen(lex) > 1) { @@ -3026,6 +3016,12 @@ QString loadNescaSetup(char *resStr, char *option) { return ""; } +void setUIText(char *field, QLineEdit *qle, const char *resStr) { + if (strstr(resStr, field) != NULL) { + QString intermediateString = loadNescaSetup(resStr, field).simplified(); + intermediateString.length() > 0 ? qle->setText(intermediateString) : (void)NULL; + } +} void RestoreSession() { FILE *resFile = fopen("restore", "r"); @@ -3039,8 +3035,7 @@ void RestoreSession() while(fgets(resStr, 128, resFile) != NULL) { if(strstr(resStr, "[SESSION]:") != NULL) - { - + { lex = strtok(strstr(resStr, "[SESSION]:") + strlen("[SESSION]:"), " "); gMode = atoi(lex); lex = strtok(NULL, " "); @@ -3140,38 +3135,39 @@ void RestoreSession() }; }; - if (strstr(resStr, "[NDBSERVER]:") != NULL) ui->lineTrackerSrv->setText(loadNescaSetup(resStr, "[NDBSERVER]:").simplified()); - else if (strstr(resStr, "[NDBSCRIPT]:") != NULL) ui->lineTrackerScr->setText(loadNescaSetup(resStr, "[NDBSCRIPT]:").simplified()); - else if (strstr(resStr, "[NDBPORT]:") != NULL) ui->trcSrvPortLine->setText(loadNescaSetup(resStr, "[NDBPORT]:").simplified()); - else if (strstr(resStr, "[PING]:") != NULL) { - lex = strstr(resStr, "[PING]:") + strlen("[PING]:"); + setUIText("[NDBSERVER]:", ui->lineTrackerSrv, resStr); + setUIText("[NDBSCRIPT]:", ui->lineTrackerScr, resStr); + setUIText("[NDBPORT]:", ui->trcSrvPortLine, resStr); + if (strstr(resStr, "[PING]:") != NULL) { + lex = strstr(resStr, "[PING]:") + strlen("[PING]:"); - if (strlen(lex) > 1) - { - lex[strlen(lex) - 1] = '\0'; - ui->pingingOnOff->setChecked(strcmp(lex, "true") == 0 ? true : false); - }; - } - else if (strstr(resStr, "[PING_TO]:") != NULL) ui->PingTO->setText(loadNescaSetup(resStr, "[PING_TO]:").simplified()); - else if (strstr(resStr, "[THREAD_DELAY]:") != NULL) ui->threadDelayBox->setText(loadNescaSetup(resStr, "[THREAD_DELAY]:").simplified()); - else if (strstr(resStr, "[TIMEOUT]:") != NULL) { - const QString &tempLex = loadNescaSetup(resStr, "[TIMEOUT]:"); + if (strlen(lex) > 1) + { + lex[strlen(lex) - 1] = '\0'; + ui->pingingOnOff->setChecked(strcmp(lex, "true") == 0 ? true : false); + }; + } + setUIText("[PING_TO]:", ui->PingTO, resStr); + setUIText("[THREAD_DELAY]:", ui->threadDelayBox, resStr); + if (strstr(resStr, "[TIMEOUT]:") != NULL) { + const QString &tempLex = loadNescaSetup(resStr, "[TIMEOUT]:"); if(tempLex.toInt() > 0) { ui->iptoLine_value->setText(tempLex); ui->iptoLine_value_2->setText(tempLex); ui->iptoLine_value_3->setText(tempLex); } - } - else if (strstr(resStr, "[MAXBTHR]:") != NULL) ui->maxBrutingThrBox->setText(loadNescaSetup(resStr, "[MAXBTHR]:").simplified()); - else if (strstr(resStr, "[PERSKEY]:") != NULL) ui->linePersKey->setText(loadNescaSetup(resStr, "[PERSKEY]:").simplified()); - else if (strstr(resStr, "[IRCSERVER]:") != NULL) ui->ircServerBox->setText(loadNescaSetup(resStr, "[IRCSERVER]:").simplified()); - else if (strstr(resStr, "[IRCPORT]:") != NULL) ui->serverPortBox->setText(loadNescaSetup(resStr, "[IRCPORT]:").simplified()); - else if (strstr(resStr, "[IRCPROXY]:") != NULL) ui->ircProxy->setText(loadNescaSetup(resStr, "[IRCPROXY]:").simplified()); - else if (strstr(resStr, "[IRCPROXYPORT]:") != NULL) ui->ircProxyPort->setText(loadNescaSetup(resStr, "[IRCPROXYPORT]:").simplified()); - else if (strstr(resStr, "[SYSTEMPROXYIP]:") != NULL) ui->systemProxyIP->setText(loadNescaSetup(resStr, "[SYSTEMPROXYIP]:").simplified()); - else if (strstr(resStr, "[SYSTEMPROXYPORT]:") != NULL) ui->systemProxyPort->setText(loadNescaSetup(resStr, "[SYSTEMPROXYPORT]:").simplified()); - else if (strstr(resStr, "[IRCNICK]:") != NULL) ui->ircNickBox->setText(loadNescaSetup(resStr, "[IRCNICK]:").simplified()); - ZeroMemory(resStr, sizeof(resStr)); + } + setUIText("[MAXBTHR]:", ui->maxBrutingThrBox, resStr); + setUIText("[PERSKEY]:", ui->linePersKey, resStr); + setUIText("[IRCSERVER]:", ui->ircServerBox, resStr); + setUIText("[IRCPORT]:", ui->serverPortBox, resStr); + setUIText("[IRCPROXY]:", ui->ircProxy, resStr); + setUIText("[IRCPROXYPORT]:", ui->ircProxyPort, resStr); + setUIText("[SYSTEMPROXYIP]:", ui->systemProxyIP, resStr); + setUIText("[SYSTEMPROXYPORT]:", ui->systemProxyPort, resStr); + setUIText("[IRCNICK]:", ui->ircNickBox, resStr); + + ZeroMemory(resStr, sizeof(resStr)); }; fclose(resFile); @@ -3203,11 +3199,11 @@ const char *GetVer() if(__DATE__[0] == 'J' && __DATE__[1] == 'a') dver += 1; else if(__DATE__[0] == 'F') dver += 2; - else if(__DATE__[0] == 'M' && __DATE__[1] == 'a' && __DATE__[2] == 'r') dver += 3; + else if(__DATE__[0] == 'M' && __DATE__[2] == 'r') dver += 3; else if(__DATE__[0] == 'A' && __DATE__[1] == 'p') dver += 4; - else if(__DATE__[0] == 'M' && __DATE__[1] == 'a' && __DATE__[2] == 'y') dver += 5; - else if(__DATE__[0] == 'J' && __DATE__[1] == 'u' && __DATE__[2] == 'n') dver += 6; - else if(__DATE__[0] == 'J' && __DATE__[1] == 'u' && __DATE__[2] == 'l') dver += 7; + else if(__DATE__[0] == 'M' && __DATE__[2] == 'y') dver += 5; + else if(__DATE__[0] == 'J' && __DATE__[2] == 'n') dver += 6; + else if(__DATE__[0] == 'J' && __DATE__[2] == 'l') dver += 7; else if(__DATE__[0] == 'A' && __DATE__[1] == 'u') dver += 8; else if(__DATE__[0] == 'S') dver += 9; else if(__DATE__[0] == 'O') dver += 10; @@ -3300,16 +3296,15 @@ void _startMsgCheck() #if defined(WIN32) || defined(_WIN32) || defined(__WIN32) && !defined(__CYGWIN__) WSADATA wsda; if (WSAStartup(0x0101, &wsda)) - { - + { stt->doEmitionRedFoundData("WSAStartup failed."); - stt->doEmitionKillSttThread(); - + stt->doEmitionKillSttThread(); }; #endif _startVerCheck(); - _startMsgCheck(); + _startMsgCheck(); + qrp.setMinimal(true); } void nesca_3::playFcknSound() diff --git a/nesca_3.ui b/nesca_3.ui index 4765a44..7ad3c2d 100644 --- a/nesca_3.ui +++ b/nesca_3.ui @@ -1764,9 +1764,15 @@ border-radius: 3px; QFrame::Plain + + QAbstractScrollArea::AdjustIgnored + false + + QTextEdit::NoWrap + true diff --git a/nesca_startModule.cpp b/nesca_startModule.cpp index cecd075..7cbac1f 100644 --- a/nesca_startModule.cpp +++ b/nesca_startModule.cpp @@ -4,10 +4,6 @@ #include "externFunctions.h" #include "Connector.h" -typedef struct { - char argv[MAX_ADDR_LEN]; -} ST; - ST *st = NULL; QJsonArray *jsonArr = new QJsonArray(); @@ -910,29 +906,21 @@ void *_connect(void* ss) void targetAndIPWriter(long long unsigned int target, char *buff) { - char curIPBuff[256] = {0}, targetNPers[32] = {0}, dbuffer[32] = {0}; - strcpy(metaIPDNS, buff); - char b[32] = {0}; - sprintf(b, "%Lu", target); - strcpy(targetNPers, b); - strcpy(metaTargets, targetNPers); - if(gTargetsOverall != 0) sprintf(dbuffer, "%.1f", (100 - target/(double)gTargetsOverall * 100)); - else strcpy(dbuffer, "0"); - strcat(targetNPers, " ("); - strcat(targetNPers, dbuffer); - strcat(targetNPers, "%)"); - strcpy(metaPercent, dbuffer); + char curIPBuff[256] = {0}, targetNPers[32] = {0}; - strcpy(curIPBuff, "--->"); - strcat(curIPBuff, buff); - - - stt->doEmitionIPRANGE(QString(curIPBuff)); - stt->doEmitionTargetsLeft(QString(targetNPers)); - + strcpy(metaIPDNS, buff); + sprintf(targetNPers, "%Lu (%.1f%%)", + target, (gTargetsOverall != 0 ? (100 - target/(double)gTargetsOverall * 100) : 0)); + sprintf(metaTargets, "%Lu", target); + sprintf(metaPercent, "%.1f", + (gTargetsOverall != 0 ? (100 - target/(double)gTargetsOverall * 100) : 0)); + sprintf(curIPBuff, "--->%s", buff); + + stt->doEmitionIPRANGE(QString(curIPBuff)); + stt->doEmitionTargetsLeft(QString(targetNPers)); } -void _passLoginFapper() +void _passLoginLoader() { MaxLogin = 0; MaxPass = 0; @@ -985,10 +973,8 @@ void _passLoginFapper() ZeroMemory(buffFG, sizeof(buffFG)); }; + stt->doEmitionGreenFoundData("Password list loaded (" + QString::number(MaxPass) + " entries)"); - stt->doEmitionGreenFoundData("Password list loaded (" + QString(std::to_string(MaxPass).c_str()) + " entries)"); - - i = 0; while(fgets(buffFG, 32, loginList) != NULL) @@ -999,20 +985,16 @@ void _passLoginFapper() else strncat(loginLst[i++], buffFG, strlen(buffFG)); ZeroMemory(buffFG, sizeof(buffFG)); }; - - stt->doEmitionGreenFoundData("Login list loaded (" + QString(std::to_string(MaxLogin).c_str()) + " entries)"); + stt->doEmitionGreenFoundData("Login list loaded (" + QString::number(MaxLogin) + " entries)"); - fclose(loginList); fclose(passList); } else - { - + { stt->doEmitionRedFoundData("No password/login list found"); - stt->doEmitionKillSttThread(); - + stt->doEmitionKillSttThread(); }; MaxWFLogin = 0; @@ -1066,8 +1048,7 @@ void _passLoginFapper() ZeroMemory(buffFG, sizeof(buffFG)); }; - - stt->doEmitionGreenFoundData("WFPassword list loaded (" + QString(std::to_string(MaxWFPass).c_str()) + " entries)"); + stt->doEmitionGreenFoundData("WFPassword list loaded (" + QString::number(MaxWFPass) + " entries)"); i = 0; @@ -1080,7 +1061,7 @@ void _passLoginFapper() ZeroMemory(buffFG, sizeof(buffFG)); }; - stt->doEmitionGreenFoundData("WFLogin list loaded (" + QString(std::to_string(MaxWFLogin).c_str()) + " entries)"); + stt->doEmitionGreenFoundData("WFLogin list loaded (" + QString::number(MaxWFLogin) + " entries)"); fclose(wfPassList); fclose(wfLoginList); } @@ -1123,7 +1104,7 @@ void _passLoginFapper() ZeroMemory(buffFG, sizeof(buffFG)); }; - stt->doEmitionGreenFoundData("SSH Password list loaded (" + QString(std::to_string(MaxSSHPass).c_str()) + " entries)"); + stt->doEmitionGreenFoundData("SSH Password list loaded (" + QString::number(MaxSSHPass) + " entries)"); fclose(sshlpList); } @@ -1133,9 +1114,9 @@ void _passLoginFapper() stt->doEmitionKillSttThread(); }; - stt->doEmitionYellowFoundData("BA: ~" + QString(std::to_string(MaxLogin * MaxPass/gTimeOut/60).c_str()) - + "; WF: ~" + QString(std::to_string(MaxWFLogin * MaxWFPass/gTimeOut/60).c_str()) - + "; SSH: ~" + QString(std::to_string(MaxSSHPass/gTimeOut/60).c_str())); + stt->doEmitionYellowFoundData("BA: ~" + QString::number(MaxLogin * MaxPass/gTimeOut/60) + + "; WF: ~" + QString::number(MaxWFLogin * MaxWFPass/gTimeOut/60) + + "; SSH: ~" + QString::number(MaxSSHPass/gTimeOut/60)); } void ReadUTF8(FILE* nFile, char *cp) @@ -1292,7 +1273,7 @@ std::string xcode(LPCSTR src, UINT srcCodePage, UINT dstCodePage) #endif return res; } -void _NegativeFapper() +void _NegativeLoader() { FILE *nFile = fopen("negatives.txt", "rb"); @@ -1369,10 +1350,8 @@ void CheckMaskBits(char *res, int index) } else { - - stt->doEmitionRedFoundData("[CheckMaskBits] Cannot parse IP list"); - stt->doEmitionKillSttThread(); - + stt->doEmitionRedFoundData("[CheckMaskBits] Cannot parse IP list"); + stt->doEmitionKillSttThread(); }; } @@ -2275,7 +2254,7 @@ int _GetDNSFromMask(char *mask, char *saveMask, char *saveMaskEnder) if(globalScanFlag) { pthread_t thrc; - pthread_create(&thrc, NULL, (void *(*)(void*))&_connect, st ); + pthread_create(&thrc, NULL, (void *(*)(void*))&_connect, st ); }; #endif Sleep(gThreadDelay); @@ -2307,11 +2286,11 @@ int startScan(char* args) ZeroMemory(ipsend, sizeof(ipsend)); #if defined(WIN32) || defined(_WIN32) || defined(__WIN32) && !defined(__CYGWIN__) - CreateDirectory(L"./result_files", NULL); + CreateDirectory(L(RESULT_DIR_NAME), NULL); #else struct stat str = {0}; - if (stat("./result_files", &str) == -1) { - mkdir("./result_files", 0700); + if (stat(RESULT_DIR_NAME, &str) == -1) { + mkdir(RESULT_DIR_NAME, 0700); } #endif @@ -2329,8 +2308,7 @@ int startScan(char* args) mode = gMode; int resInit = fInit(gMode, gRange); if(resInit == -1 ) - { - + { stt->doEmitionRedFoundData("[Error] fInit failure"); stt->doEmitionKillSttThread(); @@ -2340,8 +2318,8 @@ int startScan(char* args) stt->doEmitionIPRANGE(QString(saveEndIP)); stt->doEmitionThreads(QString::number(0) + "/" + QString::number(gThreads)); - _passLoginFapper(); - _NegativeFapper(); + _passLoginLoader(); + _NegativeLoader(); char res[256] = {0}; if (gMode == 0) @@ -2446,7 +2424,7 @@ stt->doEmitionThreads(QString::number(0) + "/" + QString::number(gThreads)); _beginthread((void(*)(void*))_connect, 0, st); #else pthread_t thrc; - pthread_create(&thrc, NULL, (void *(*)(void*))&_connect, st); + pthread_create(&thrc, NULL, (void *(*)(void*))&_connect, st); #endif Sleep(gThreadDelay); } @@ -2467,10 +2445,10 @@ stt->doEmitionThreads(QString::number(0) + "/" + QString::number(gThreads)); if(trackerOK) { #if defined(WIN32) || defined(_WIN32) || defined(__WIN32) && !defined(__CYGWIN__) - if(trackerOK) _beginthread( (void(*)(void*))_tracker, 0, NULL ); + _beginthread( (void(*)(void*))_tracker, 0, NULL ); #else pthread_t thrt; - if(trackerOK) pthread_create(&thrt, NULL, (void *(*)(void*))&_tracker, NULL); + pthread_create(&thrt, NULL, (void *(*)(void*))&_tracker, NULL); #endif }; @@ -2482,11 +2460,10 @@ stt->doEmitionThreads(QString::number(0) + "/" + QString::number(gThreads)); pthread_create(&thrtt, NULL, (void *(*)(void*))&_timer, NULL); #endif - char dataEntry[1024] = {0}; - int innerCounter = 0; int sz = strlen(saveEndIP); + for(int i = 0; i < sz; ++i) { if(saveEndIP[i] == '\\')