From 2b5c7fc0aa78b4632c9595147b07ac4f8309df56 Mon Sep 17 00:00:00 2001 From: cora32 Date: Sun, 22 Mar 2015 03:43:15 +0300 Subject: [PATCH] not-a-single-fcuk-version --- .gitignore | 1 + BasicAuth.cpp | 35 +++- BasicAuth.h | 14 +- BruteUtils.cpp | 4 +- CheckKey_Th.cpp | 4 +- Connector.cpp | 99 ++++++---- Connector.h | 8 +- DrawerTh_ME2Scanner.cpp | 10 +- DrawerTh_ME2Scanner.h | 1 + FTPAuth.cpp | 27 +-- FTPAuth.h | 14 +- Threader.cpp | 13 +- Threader.h | 4 +- Utils.cpp | 2 +- WebformWorker.cpp | 8 +- WebformWorker.h | 14 +- connector_old.cpp | 13 +- finder.cpp | 260 ++++++++++++--------------- login.txt | 7 +- mainResources.h | 124 ++++++------- msgcheckerthread.cpp | 4 +- negatives.txt | 1 - nesca_3.cpp | 41 ++--- nesca_3.h | 4 +- nesca_3.pri | 48 ----- nesca_3.pro | 20 --- nesca_3.rc | Bin 5064 -> 5064 bytes nesca_3.ui | 15 +- nesca_startModule.cpp | 387 +++++++++++++++++++--------------------- pass.txt | 7 +- 30 files changed, 562 insertions(+), 627 deletions(-) delete mode 100644 nesca_3.pri delete mode 100644 nesca_3.pro diff --git a/.gitignore b/.gitignore index 882c851..659b161 100644 --- a/.gitignore +++ b/.gitignore @@ -31,3 +31,4 @@ tags.txt version lisca.cpp main - копия.cpp +result_files-* diff --git a/BasicAuth.cpp b/BasicAuth.cpp index 4e060fa..e41b897 100644 --- a/BasicAuth.cpp +++ b/BasicAuth.cpp @@ -1,13 +1,30 @@ -#include +#include "BasicAuth.h" -bool BA::checkOutput(const string *buffer) { - if(Utils::ci_find_substr(*buffer, "200 ok") != -1 || +bool BA::checkOutput(const string *buffer, const char *ip, const int port) { + if((Utils::ci_find_substr(*buffer, "200 ok") != -1 || Utils::ci_find_substr(*buffer, "http/1.0 200") != -1 || - Utils::ci_find_substr(*buffer, "http/1.1 200") != -1 + Utils::ci_find_substr(*buffer, "http/1.1 200") != -1) + && Utils::ci_find_substr(*buffer, "http/1.1 401 ") == -1 + && Utils::ci_find_substr(*buffer, "http/1.0 401 ") == -1 + && Utils::ci_find_substr(*buffer, "401") == -1 + && Utils::ci_find_substr(*buffer, "Unauthorized") == -1 + && Utils::ci_find_substr(*buffer, "") == -1 + && Utils::ci_find_substr(*buffer, "Неправильны") == -1 ) { - return true; - } + } + else if (Utils::ci_find_substr(*buffer, "503 service unavailable") != -1 + || Utils::ci_find_substr(*buffer, "http/1.1 503") != -1 + || Utils::ci_find_substr(*buffer, "http/1.0 503") != -1 + || Utils::ci_find_substr(*buffer, "400 BAD_REQUEST") != -1 + || Utils::ci_find_substr(*buffer, "400 bad request") != -1 + || Utils::ci_find_substr(*buffer, "403 Forbidden") != -1 + ) + { + stt->doEmition_BARedData("[.] 503/400/403 - Waiting 30sec (" + QString(ip) + ":" + QString::number(port) + ")"); + + Sleep(30000); + } return false; } @@ -28,15 +45,15 @@ lopaStr BA::_BABrute(const char *ip, const int port) { lpString = string(loginLst[i]) + ":" + string(passLst[j]); - Connector::nConnect(ip, port, &buffer, NULL, NULL, &lpString); + if (Connector::nConnect(ip, port, &buffer, NULL, NULL, &lpString) == -2) return lps; - if(checkOutput(&buffer)) { + if(checkOutput(&buffer, ip, port)) { strcpy(lps.login, loginLst[i]); strcpy(lps.pass, passLst[j]); return lps; }; - Sleep(70); + Sleep(100); } } diff --git a/BasicAuth.h b/BasicAuth.h index 56046f0..d08ec61 100644 --- a/BasicAuth.h +++ b/BasicAuth.h @@ -1,15 +1,15 @@ #ifndef BASICAUTH_H #define BASICAUTH_H -#include -#include -#include -#include -#include +#include "Connector.h" +#include "BruteUtils.h" +#include "Utils.h" +#include "externData.h" +#include "mainResources.h" -class BA : BruteUtils{ +class BA { private: - static bool checkOutput(const string *buffer); + static bool checkOutput(const string *buffer, const char *ip, const int port); static lopaStr _BABrute(const char *ip, const int port); public: diff --git a/BruteUtils.cpp b/BruteUtils.cpp index 14144c7..8ad5d20 100644 --- a/BruteUtils.cpp +++ b/BruteUtils.cpp @@ -1,9 +1,10 @@ -#include +#include "BruteUtils.h" #include "STh.h" #include "externData.h" void BruteUtils::BConInc() { + ++BA; #if defined(WIN32) || defined(_WIN32) || defined(__WIN32) && !defined(__CYGWIN__) __asm { @@ -31,5 +32,4 @@ void BruteUtils::BConDec() } stt->doEmitionChangeBA(QString::number(BrutingThrds)); - } diff --git a/CheckKey_Th.cpp b/CheckKey_Th.cpp index 6cfd09b..753ba05 100644 --- a/CheckKey_Th.cpp +++ b/CheckKey_Th.cpp @@ -3,8 +3,8 @@ #include "STh.h" #include "externData.h" #include "externFunctions.h" -#include -#include +#include "Connector.h" +#include "Utils.h" void getSubStrEx(const char *src, char *startStr, char *endStr, char *dest, int szDest) { diff --git a/Connector.cpp b/Connector.cpp index 0e061b5..f81fc7f 100644 --- a/Connector.cpp +++ b/Connector.cpp @@ -1,7 +1,7 @@ -#include +#include "Connector.h" #if defined(WIN32) || defined(_WIN32) || defined(__WIN32) && !defined(__CYGWIN__) -int _pingMyTarget(char *ip) +int _pingMyTarget(const char *ip) { HANDLE hIcmpFile; unsigned long ipaddr = INADDR_NONE; @@ -231,9 +231,9 @@ int my_trace(CURL *handle, curl_infotype type, void *userp) { if (type == CURLINFO_HEADER_OUT) { - Activity += strlen(data); - data[strstr(data, "\r\n\r\n") - data] = '\0'; - stt->doEmitionAddOutData(QString(data)); + data[size] = '\0'; + Activity += strlen(data); + stt->doEmitionAddOutData(QString(data)); } return 0; @@ -284,7 +284,6 @@ int Connector::nConnect(const char* ip, const int port, std::string *buffer, curl_easy_setopt(curl, CURLOPT_TIMEOUT, gTimeOut); if(postData != NULL) { - curl_easy_setopt(curl, CURLOPT_POSTFIELDS, postData); }; @@ -300,29 +299,61 @@ int Connector::nConnect(const char* ip, const int port, std::string *buffer, curl_easy_setopt(curl, CURLOPT_HTTPHEADER, chunk); } - if(lpString != NULL) { - curl_easy_setopt(curl, CURLOPT_HTTPAUTH, (long)CURLAUTH_ANY); - //curl_easy_setopt(curl, CURLOPT_FTPLISTONLY, TRUE); - curl_easy_setopt(curl, CURLOPT_USERPWD, lpString->c_str()); - }; - - //if(curl_easy_perform(curl) == CURLE_OK) { - if(1) { - curl_easy_cleanup(curl); - } else { - curl_easy_cleanup(curl); - return -1; - } - + if (lpString != NULL) { + curl_easy_setopt(curl, CURLOPT_HTTPAUTH, (long)CURLAUTH_ANY); + curl_easy_setopt(curl, CURLOPT_FTPLISTONLY, TRUE); + curl_easy_setopt(curl, CURLOPT_USERPWD, lpString->c_str()); + }; + + int res = curl_easy_perform(curl); + curl_easy_cleanup(curl); + + if (res == CURLE_OK || + (port == 21 && buffer->size() > 0)) { + if (MapWidgetOpened) stt->doEmitionAddIncData(QString(ip), QString(buffer->c_str())); + Activity += buffer->size(); + return buffer->size(); + } else { + if (res != 28 && + res != 7 && + res != 67 && + res != 52 && + res != 55 && + res != 56) { + if (res == 5) { + stt->doEmitionRedFoundData("Couldn't resolve proxy. The given proxy host could not be resolved. "); + return -2; + } + else if (res == 13) { + stt->doEmitionFoundData("Unknown ftp: (" + QString::number(res) + ") " + + QString(ip) + ":" + QString::number(port)); + return -2; + } else if (res == 8) { + stt->doEmitionFoundData("Strange ftp reply: (" + + QString::number(res) + ") " + QString(ip) + + ":" + QString::number(port)); + return -2; + } + else if (res == 6) { + stt->doEmitionFoundData("Couldn't resolve host. (" + + QString::number(res) + ") " + QString(ip) + + ":" + QString::number(port)); + return -2; + } + else stt->doEmitionRedFoundData("CURL error: (" + QString::number(res) + ") " + + QString(ip) + ":" + QString::number(port)); + } + ++offlines; + return -1; + } } else { stt->doEmitionRedFoundData("Curl error."); return -1; - }; + }; - if(MapWidgetOpened) stt->doEmitionAddIncData(QString(ip), QString(buffer->c_str())); - - Activity += buffer->size(); - return buffer->size(); + if (MapWidgetOpened) stt->doEmitionAddIncData(QString(ip), QString(buffer->c_str())); + Activity += buffer->size(); + return buffer->size(); } int Connector::_ConnectToPort(string ip, int port, char *hl) @@ -338,17 +369,17 @@ int Connector::_ConnectToPort(string ip, int port, char *hl) std::string buffer; int size = 0; - if(port == 22) size = _SSHLobby(ip.c_str(), port, &buffer); + if (port == 22) size = _SSHLobby(ip.c_str(), port, &buffer); else size = nConnect(ip.c_str(), port, &buffer); -// if(size > 0) -// { -// ++Alive; -// ++found; -// stt->doEmitionChangeParsed(QString::number(saved) + "/" + QString::number(found)); -// Lexems lx; -// lx._filler(port, buffer.c_str(), ip, size, &lx, hl); -// }; + if(size > 0) + { + ++Alive; + ++found; + stt->doEmitionChangeParsed(QString::number(saved) + "/" + QString::number(found)); + Lexems lx; + lx._filler(port, buffer.c_str(), (char*)ip.c_str(), size, &lx, hl); + }; return 0; } diff --git a/Connector.h b/Connector.h index 1bc0722..132e4cb 100644 --- a/Connector.h +++ b/Connector.h @@ -1,9 +1,9 @@ #ifndef CONNECTOR_H #define CONNECTOR_H -#include -#include -#include +#include "externData.h" +#include "Utils.h" +#include "BruteUtils.h" #include "STh.h" #if defined(WIN32) || defined(_WIN32) || defined(__WIN32) && !defined(__CYGWIN__) @@ -12,7 +12,7 @@ #pragma comment(lib, "iphlpapi.lib") #pragma comment(lib,"curllib.lib") #endif -#include +#include "mainResources.h" class Connector { diff --git a/DrawerTh_ME2Scanner.cpp b/DrawerTh_ME2Scanner.cpp index 22232ce..a6b92cd 100644 --- a/DrawerTh_ME2Scanner.cpp +++ b/DrawerTh_ME2Scanner.cpp @@ -1,10 +1,11 @@ #include "DrawerTh_ME2Scanner.h" #include "STh.h" #include "externData.h" -#include +#include "WebformWorker.h" QList DrawerTh_ME2Scanner::itmList; QVector DrawerTh_ME2Scanner::polyVect; +int DrawerTh_ME2Scanner::vecSize; void DrawerTh_ME2Scanner::doEmitDrawTextPlacers() { @@ -16,9 +17,9 @@ void DrawerTh_ME2Scanner::doEmitionAddPolyLine() emit dtME2->sAddPolyLine(); } -void MakePolygonLine(int gWidth) +int MakePolygonLine(int gWidth) { - DrawerTh_ME2Scanner::polyVect.clear(); + while (!DrawerTh_ME2Scanner::polyVect.empty()) Sleep(100); int x = 0; int tx = 0; int xtx = 0; @@ -127,6 +128,7 @@ void MakePolygonLine(int gWidth) Susp = 0; DrawerTh_ME2Scanner::polyVect.append(QPointF(gWidth, ME2YPOS)); + return DrawerTh_ME2Scanner::polyVect.size(); } void DrawerTh_ME2Scanner::run() @@ -139,7 +141,7 @@ void DrawerTh_ME2Scanner::run() if (widgetIsHidden == false && tray->isVisible() == false) { if (itmList.count() < 39) { - MakePolygonLine(gWidth); + vecSize = MakePolygonLine(gWidth); dtME2->doEmitionAddPolyLine(); } } diff --git a/DrawerTh_ME2Scanner.h b/DrawerTh_ME2Scanner.h index 2631c9d..4fe371b 100644 --- a/DrawerTh_ME2Scanner.h +++ b/DrawerTh_ME2Scanner.h @@ -10,6 +10,7 @@ class DrawerTh_ME2Scanner : public QThread Q_OBJECT public: + static int vecSize; static QList itmList; static QVector polyVect; diff --git a/FTPAuth.cpp b/FTPAuth.cpp index 9e580cc..f1c75f7 100644 --- a/FTPAuth.cpp +++ b/FTPAuth.cpp @@ -1,8 +1,6 @@ #include "FTPAuth.h" bool FTPA::checkOutput(const string *buffer) { - //Login or password incorrect! - if(Utils::ci_find_substr(*buffer, "230") != -1) { return true; @@ -11,7 +9,7 @@ bool FTPA::checkOutput(const string *buffer) { return false; } -lopaStr FTPA::_FTPBrute(const char *ip, const int port, const PathStr *ps) { +lopaStr FTPA::_FTPBrute(const char *ip, const int port, PathStr *ps) { string buffer; string lpString; lopaStr lps; @@ -20,6 +18,7 @@ lopaStr FTPA::_FTPBrute(const char *ip, const int port, const PathStr *ps) { ZeroMemory(lps.other, sizeof(lps.other)); strcpy(lps.login, "UNKNOWN"); + int res = 0; for(int i = 0; i < MaxLogin; ++i) { @@ -32,15 +31,17 @@ lopaStr FTPA::_FTPBrute(const char *ip, const int port, const PathStr *ps) { if(strlen(passLst[j]) <= 1) continue; lpString = string(loginLst[i]) + ":" + string(passLst[j]); - - Connector::nConnect((string("ftp://") + string(ip)).c_str(), port, &buffer, NULL, NULL, &lpString); - - if(checkOutput(&buffer)) { - strcpy(lps.login, loginLst[i]); - strcpy(lps.pass, passLst[j]); - return lps; - }; - + + res = Connector::nConnect((string("ftp://") + string(ip)).c_str(), port, &buffer, NULL, NULL, &lpString); + if (res == -2) return lps; + else if (res != -1) { + if (!globalScanFlag) return lps; + strcpy(lps.login, loginLst[i]); + strcpy(lps.pass, passLst[j]); + ps->directoryCount = std::count(buffer.begin(), buffer.end(), '\n'); + return lps; + }; + Sleep(70); } } @@ -48,7 +49,7 @@ lopaStr FTPA::_FTPBrute(const char *ip, const int port, const PathStr *ps) { return lps; } -lopaStr FTPA::_FTPLobby(const char *ip, const int port, const PathStr *ps) { +lopaStr FTPA::_FTPLobby(const char *ip, const int port, PathStr *ps) { while(BrutingThrds >= gMaxBrutingThreads) Sleep(1000); BruteUtils::BConInc(); diff --git a/FTPAuth.h b/FTPAuth.h index 059a553..f3abe15 100644 --- a/FTPAuth.h +++ b/FTPAuth.h @@ -1,19 +1,19 @@ #ifndef FTPAUTH_H #define FTPAUTH_H -#include -#include -#include -#include -#include +#include "Connector.h" +#include "BruteUtils.h" +#include "Utils.h" +#include "externData.h" +#include "mainResources.h" class FTPA { private: static bool checkOutput(const string *buffer); - static lopaStr _FTPBrute(const char *ip, const int port, const PathStr *ps); + static lopaStr _FTPBrute(const char *ip, const int port, PathStr *ps); public: - static lopaStr _FTPLobby(const char *ip, const int port, const PathStr *ps); + static lopaStr _FTPLobby(const char *ip, const int port, PathStr *ps); }; #endif // FTPAUTH_H diff --git a/Threader.cpp b/Threader.cpp index 34d4672..7817892 100644 --- a/Threader.cpp +++ b/Threader.cpp @@ -1,4 +1,4 @@ -#include +#include "Threader.h" int Threader::threadId = 0; std::mutex Threader::m; @@ -8,22 +8,23 @@ std::queue Threader::ipQueue; void Threader::fireThread(std::string ip, void *func(void)) { - ipQueue.push(ip); + + std::unique_lock lk(m); + ipQueue.push(ip); if(threadId < gThreads) { ++threadId; std::thread workerThread(func); workerThread.detach(); } - std::unique_lock lk(m); ready = true; Threader::cv.notify_one(); Sleep(gThreadDelay); } -//std::queue empty; void Threader::cleanUp() { - //std::swap( ipQueue, empty ); - ipQueue = {}; + std::unique_lock lk(m); + lk.unlock(); + lk.release(); threadId = 0; } diff --git a/Threader.h b/Threader.h index 8770651..3c4ed1c 100644 --- a/Threader.h +++ b/Threader.h @@ -1,8 +1,8 @@ #ifndef THREADER_H #define THREADER_H -#include -#include +#include "mainResources.h" +#include "externData.h" #include #include #include diff --git a/Utils.cpp b/Utils.cpp index 6f89b4c..c26f533 100644 --- a/Utils.cpp +++ b/Utils.cpp @@ -1,4 +1,4 @@ -#include +#include "Utils.h" char *getSystemProxy() { return ""; diff --git a/WebformWorker.cpp b/WebformWorker.cpp index 3460f89..234f5aa 100644 --- a/WebformWorker.cpp +++ b/WebformWorker.cpp @@ -1,4 +1,4 @@ -#include +#include "WebformWorker.h" bool WFClass::active = false; @@ -49,7 +49,7 @@ lopaStr WFClass::parseResponse(const char *ip, else return result; } -lopaStr WFClass::doGetCheck(char *ip, +lopaStr WFClass::doGetCheck(const char *ip, int port, char *actionVal, char *userVal, @@ -92,7 +92,7 @@ lopaStr WFClass::doGetCheck(char *ip, return result; } -lopaStr WFClass::doPostCheck(char *ip, +lopaStr WFClass::doPostCheck(const char *ip, int port, char *actionVal, char *userVal, @@ -137,7 +137,7 @@ lopaStr WFClass::doPostCheck(char *ip, return result; } -lopaStr WFClass::_WFBrute( char *ip, +lopaStr WFClass::_WFBrute( const char *ip, int port, char *methodVal, char *actionVal, diff --git a/WebformWorker.h b/WebformWorker.h index f7deed8..a44f271 100644 --- a/WebformWorker.h +++ b/WebformWorker.h @@ -1,19 +1,19 @@ #ifndef WEBFORMWORKER_H #define WEBFORMWORKER_H -#include +#include "Utils.h" #include "Connector.h" -#include -#include -#include +#include "mainResources.h" +#include "externFunctions.h" +#include "BruteUtils.h" #include "STh.h" class WFClass : BruteUtils { private: static bool active; int passCounter = 1; - lopaStr doGetCheck(char *ip, int port, char *actionVal, char *userVal, char *passVal, char *formVal); - lopaStr doPostCheck(char *ip, int port, char *actionVal, char *userVal, char *passVal, char *formVal); + lopaStr doGetCheck(const char *ip, int port, char *actionVal, char *userVal, char *passVal, char *formVal); + lopaStr doPostCheck(const char *ip, int port, char *actionVal, char *userVal, char *passVal, char *formVal); lopaStr parseResponse(const char *ip, const int port, const std::string *buffer, const char* formVal, const int *iIndex, const int *jIndex); @@ -35,7 +35,7 @@ public: BConDec(); } - lopaStr _WFBrute(char *ip, + lopaStr _WFBrute(const char *ip, int port, char *methodVal, char *actionVal, diff --git a/connector_old.cpp b/connector_old.cpp index 16c8e3d..1da6549 100644 --- a/connector_old.cpp +++ b/connector_old.cpp @@ -5,9 +5,9 @@ #include "mainResources.h" #include "externFunctions.h" #include "externData.h" -#include -#include -#include +#include "openssl/err.h" +#include "Utils.h" +#include "BruteUtils.h" #if defined(WIN32) || defined(_WIN32) || defined(__WIN32) && !defined(__CYGWIN__) #include @@ -334,7 +334,7 @@ char *_makeDigestResponse( return (char*)responseMD5; } -int _webLoginSeq(char *request, char *login, char *pass, char *ip, int port, int passCounter, char *type, std::vector negVector) +int _webLoginSeq(char *request, char *login, char *pass, const char *ip, int port, int passCounter, char *type, std::vector negVector) { char recvBuff[256] = {0}; char recvBuff2[4096] = {0}; @@ -427,7 +427,7 @@ int _webLoginSeq(char *request, char *login, char *pass, char *ip, int port, int return 0; } -lopaStr _IPCameraBrute(char *ip, int port, char *SPEC) +lopaStr _IPCameraBrute(const char *ip, int port, char *SPEC) { lopaStr lps; ZeroMemory(lps.login, sizeof(lps.login)); @@ -486,6 +486,7 @@ lopaStr _IPCameraBrute(char *ip, int port, char *SPEC) negVector.push_back("Имя или пароль неверные!"); negVector.push_back("Возврат"); negVector.push_back("HTTP/1.0 302 Found"); + negVector.push_back("is incorrect"); } else { @@ -726,7 +727,7 @@ lopaStr _IPCameraBrute(char *ip, int port, char *SPEC) return lps; } -lopaStr _IPCameraBLobby(char *ip, int port, char *SPEC) +lopaStr _IPCameraBLobby(const char *ip, int port, char *SPEC) { while(BrutingThrds >= gMaxBrutingThreads) Sleep(1000); diff --git a/finder.cpp b/finder.cpp index b04b21e..79a3af8 100644 --- a/finder.cpp +++ b/finder.cpp @@ -184,7 +184,7 @@ char *GetCodePage(const char *str) }; } -int globalSearchNeg(const char *buffcpy, char *ip, int port) +int globalSearchNeg(const char *buffcpy, const char *ip, int port) { char negWord[256] = {0}; for(int i = 0; i < GlobalNegativeSize; ++i) @@ -245,7 +245,7 @@ int globalSearchPrnt(const char *buffcpy) return 0; } -int sharedDetector(char * ip, int port, const char *buffcpy) { +int sharedDetector(const char * ip, int port, const char *buffcpy) { if(strstr(buffcpy, "401 authorization") != NULL || strstr(buffcpy, "401 unauthorized") != NULL || (strstr(buffcpy, "www-authenticate") != NULL && strstr(buffcpy, "401 ") != NULL ) @@ -322,7 +322,7 @@ int sharedDetector(char * ip, int port, const char *buffcpy) { if((strstr(buffcpy, "camera web server") != NULL || strstr(buffcpy, "webcamxp 5") != NULL || strstr(buffcpy, "ip box camera") != NULL || strstr(buffcpy, "snaff") != NULL || strstr(buffcpy, "hfs /") != NULL || strstr(buffcpy, "httpfileserver") != NULL - || strstr(buffcpy, "network camera") != NULL + || strstr(buffcpy, "network camera") != NULL || strstr(buffcpy, "index of") != NULL || strstr(buffcpy, "$lock extended") != NULL || strstr(buffcpy, "ip camera") != NULL || strstr(buffcpy, "/viewer/video.jpg") != NULL || strstr(buffcpy, "smart ip device") != NULL || strstr(buffcpy, "sanpshot_icon") != NULL || strstr(buffcpy, "snapshot_icon") != NULL @@ -342,7 +342,7 @@ int sharedDetector(char * ip, int port, const char *buffcpy) { } // 500 < 1600 -int _mainFinderFirst(const char *buffcpy, int f, int port, char *ip) +int _mainFinderFirst(const char *buffcpy, int f, int port, const char *ip) { int flag = sharedDetector(ip, port, buffcpy); if(flag != -2) return flag; @@ -353,7 +353,7 @@ int _mainFinderFirst(const char *buffcpy, int f, int port, char *ip) } //> 1600 -int _mainFinderSecond(const char *buffcpy, int port, char *ip) +int _mainFinderSecond(const char *buffcpy, int port, const char *ip) { int flag = sharedDetector(ip, port, buffcpy); if(flag != -2) return flag; @@ -361,7 +361,7 @@ int _mainFinderSecond(const char *buffcpy, int port, char *ip) return 3; //Suspicious } -int ContentFilter(const char *buff, int port, char *ip, char *cp) +int ContentFilter(const char *buff, int port, const char *ip, char *cp) { if(buff != NULL) { @@ -406,7 +406,7 @@ int ContentFilter(const char *buff, int port, char *ip, char *cp) else return -1; } -void fillGlobalLogData(char *ip, char *hostname, char *port, const char *sz, char *title, +void fillGlobalLogData(const char *ip, char *hostname, char *port, const char *sz, char *title, const char *login, const char *pass, char *comment, char *cdpg, char *clss) { if(trackerOK == true) @@ -456,15 +456,15 @@ int __checkFileExistence(int flag) { char fileName[64] = {0}; - if(flag == 666 || flag == 350) strcpy(fileName, "./"RESULT_DIR_NAME"/STRANGE_ERROR.html"); - else if(flag == -22) strcpy(fileName, "./"RESULT_DIR_NAME"/ssh.html"); - else if(flag == 0 || flag == 15 || flag == -10) strcpy(fileName, "./"RESULT_DIR_NAME"/strange.html"); - else if(flag == 3) strcpy(fileName, "./"RESULT_DIR_NAME"/other.html"); - else if(flag == 7) strcpy(fileName, "./"RESULT_DIR_NAME"/low_loads.html"); - else if(flag == 10) strcpy(fileName, "./"RESULT_DIR_NAME"/LoginForms.html"); - else if(flag == 16) strcpy(fileName, "./"RESULT_DIR_NAME"/FTP.html"); + if(flag == 666 || flag == 350) strcpy(fileName, RESULT_DIR_NAME"/STRANGE_ERROR.html"); + else if(flag == -22) strcpy(fileName, RESULT_DIR_NAME"/ssh.html"); + else if(flag == 0 || flag == 15 || flag == -10) strcpy(fileName, RESULT_DIR_NAME"/strange.html"); + else if(flag == 3) strcpy(fileName, RESULT_DIR_NAME"/other.html"); + else if(flag == 7) strcpy(fileName, RESULT_DIR_NAME"/low_loads.html"); + else if(flag == 10) strcpy(fileName, RESULT_DIR_NAME"/LoginForms.html"); + else if(flag == 16) strcpy(fileName, RESULT_DIR_NAME"/FTP.html"); else if(flag >= 17 || flag == 11 || flag == 12 - || flag == 13 || flag == 14 || flag == 1) strcpy(fileName, "./"RESULT_DIR_NAME"/Basicauth.html"); + || flag == 13 || flag == 14 || flag == 1) strcpy(fileName, RESULT_DIR_NAME"/Basicauth.html"); FILE *f = fopen(fileName, "r"); if(f == NULL) return true; @@ -489,43 +489,44 @@ char topBuff[1024] = {"
.strange = 17 || flag == 11 || flag == 12 || flag == 13 || flag == 14 || flag == 1 ) { if(ftsBA) ftsBA = __checkFileExistence(flag); - file = fopen("./"RESULT_DIR_NAME"/Basicauth.html", "a"); + file = fopen(RESULT_DIR_NAME"/Basicauth.html", "a"); } else { @@ -675,27 +676,13 @@ void fputsf(char *text, int flag, char *msg) }; } -void putInFile(int flag, char *ip, char *port, int recd, char *finalstr, char *hl, char *cp) +void putInFile(int flag, const char *ip, char *port, int recd, char *finalstr, char *hl, char *cp) { char log[4096] = {0}, msg[512] = {0}; - if(flag == 0 || flag == 15 || flag == -10) strcpy(msg, "[A]:"); - else if(flag == 3) strcpy(msg, "[S]:"); - else if(flag == 7) strcpy(msg, "[LL]:"); - else if(flag == 2) strcpy(msg, "[P]:"); - else if(flag == 666 || flag == 350) strcpy(msg, "[Strange Error]:"); - else if(flag == 10) strcpy(msg, "[LF]:"); - QTextCodec *codec; - strcat(msg, ""); - strcat(msg, ip); - strcat(msg, ":"); - strcat(msg, port); - strcat(msg, ""); + sprintf(msg, "%s:%s", + ip, port, ip, port); QString resMes(msg); QString strf; @@ -715,7 +702,8 @@ void putInFile(int flag, char *ip, char *port, int recd, char *finalstr, char *h strf = codec->toUnicode(finalstr); } else strf = QString(finalstr); - if(flag != 6 && flag != 5 && flag != 4 && flag != 666 && flag != 350) + + if(flag != 6 && flag != 5 && flag != 4) { strcat(msg, " : "); int sz = strf.size(); @@ -726,31 +714,8 @@ void putInFile(int flag, char *ip, char *port, int recd, char *finalstr, char *h stt->doEmitionFoundData(resMes); - - strcpy(log, ""); - strcat(log, hl); - strcat(log, ""); - int flr = 40 - strlen(hl); - if(flr > 0) - { - while(flr != 0) - { - strcat(log, " "); - --flr; - }; - } - else strcat(log, " "); - strcat(log, ""); - strcat(log, ip); - strcat(log, ":"); - strcat(log, port); - strcat(log, "; Received: "); - strcat(log, std::to_string(recd).c_str()); - strcat(log, ""); + sprintf(log, "%s:%s; Received: %d", + ip, port, ip, port, recd); if(flag == 666 || flag == 350) { @@ -795,7 +760,7 @@ void putInFile(int flag, char *ip, char *port, int recd, char *finalstr, char *h ZeroMemory(msg, strlen(msg)); } -void _specFillerBA(char *hl, char *ip, char *port, char *finalstr, const char *login, const char *pass, int flag) +void _specFillerBA(char *hl, const char *ip, char *port, char *finalstr, const char *login, const char *pass, int flag) { char log[512] = {0}; @@ -814,7 +779,7 @@ void _specFillerBA(char *hl, char *ip, char *port, char *finalstr, const char *l fputsf (log , flag, "Basic Authorization"); } -void _specFillerWF(char *hl, char *ip, char *port, char *finalstr, char *login, char *pass, int flag) +void _specFillerWF(char *hl, const char *ip, char *port, char *finalstr, char *login, char *pass, int flag) { char log[512] = {0}; @@ -1025,7 +990,7 @@ void _getInputVal(std::vector inputVec, char *buff, char *key) }; } -void _specWFBrute(char *ip, int port, char *hl, const char *buff, int flag, char *path, char *comment, char *tclass, char *cp, int recd, char *title) +void _specWFBrute(const char *ip, int port, char *hl, const char *buff, int flag, char *path, char *comment, char *tclass, char *cp, int recd, char *title) { if(strstr(buff, "VER_CODE") != NULL || strstri(buff, "captcha") != NULL) { @@ -1194,7 +1159,7 @@ void _specWFBrute(char *ip, int port, char *hl, const char *buff, int flag, char }; } -void _specWEBIPCAMBrute(char *ip, int port, char *hl, char *finalstr, int flag, char *comment, char *cp, int recd, char *SPEC) +void _specWEBIPCAMBrute(const 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)); @@ -1213,7 +1178,7 @@ void _specWEBIPCAMBrute(char *ip, int port, char *hl, char *finalstr, int flag, }; } -void _specBrute(char *cookie, char *ip, int port, +void _specBrute(char *cookie, const char *ip, int port, char *hl, char *finalstr, int flag, char *path, char *comment, char *cp, int recd) { @@ -1222,10 +1187,7 @@ void _specBrute(char *cookie, char *ip, int port, sprintf(tport, ":%d", port); const lopaStr &lps = BA::_BALobby((string(ip) + string(path)).c_str(), port); - - //if(strcmp(comment, "[DIGEST]") == 0) lps = _BALobby(cookie, ip, port, path, "[DIGEST]"); - //else lps = _BALobby(cookie, ip, port, path, "[NORMAL]"); - + if(strstr(lps.login, "UNKNOWN") == NULL && strlen(lps.other) == 0) { _specFillerBA(hl, ip, tport, finalstr, lps.login, lps.pass, flag); @@ -1352,7 +1314,7 @@ const char *GetTitle(const char* str) return finalstr; } -void _saveSSH(char *ip, int port, int recd, const char *buffcpy) +void _saveSSH(const char *ip, int port, int recd, const char *buffcpy) { if(buffcpy != NULL) { @@ -1442,7 +1404,9 @@ int Lexems::_filler(int p, const char* buffcpy, char* ip, int recd, Lexems *lx, { int rh = _header(ip, p, buffcpy, lx, &ps, &redirStrLst); strcpy(cp, ps.codepage); - if (rh == -1) return -1; + if (rh == -1) { + return -1; + } if(rh <= -2) { flag = ps.flag; @@ -1462,7 +1426,9 @@ int Lexems::_filler(int p, const char* buffcpy, char* ip, int recd, Lexems *lx, sprintf(port, "%d", p); if(strstr(finalstr, ps.headr) == NULL) strcat(finalstr, ps.headr); - if(flag == -1 || flag == 6) return -1; + if (flag == -1 || flag == 6) { + return -1; + } if(flag == 16) { @@ -2558,59 +2524,59 @@ int Lexems::_header(char *ip, int port, const char str[], Lexems *l, PathStr *ps return -2; }; - if(strstri(str, "
headr, " [Login form detected]"); - char *ptr1 = strstri(str, "headr, " [Login form detected]"); + // char *ptr1 = strstri(str, "begin(), redirStrLst->end(), redirStr) == redirStrLst->end()) - { - redirStrLst->push_back(redirStr); - return redirectReconnect(ps->cookie, ip, port, redirStr, l, ps, redirStrLst); - } return -1; - } - return -2; - }; - } - else - { - strcat(ps->headr, " [Form action not found]"); - }; - return 0; - }; + // if (redirStr[0] != '#') { + // if (std::find(redirStrLst->begin(), redirStrLst->end(), redirStr) == redirStrLst->end()) + // { + // redirStrLst->push_back(redirStr); + // return redirectReconnect(ps->cookie, ip, port, redirStr, l, ps, redirStrLst); + // } return -1; + // } + // return -2; + // }; + // } + // else + // { + // strcat(ps->headr, " [Form action not found]"); + // }; + // return 0; + //}; if(strlen(ps->headr) == 0) { @@ -2624,29 +2590,27 @@ int Lexems::_header(char *ip, int port, const char str[], Lexems *l, PathStr *ps strcat(ps->headr, "[No body]"); }; - if(strstr(str, "\r\n\r\n") != NULL) + const char *ptr1 = strstr(str, "\r\n\r\n"); + if( ptr1 != NULL) { - const char *tempStr = strstr(str, "\r\n\r\n"); - if(strlen(tempStr) - 4 >= 250) + if (strlen(ptr1) - 4 >= 15) { - if(strstr(str, "Content-Encoding: gzip") != NULL) - { - strcat(ps->headr, "[GZIP]"); - }; strcat(ps->headr, " [Data: "); - if(strstri(tempStr + 4, "headr, strstri(tempStr, "headr, ptr2 + 5, 64); } - else if(strstri(tempStr + 4, "headr, strstri(tempStr, "") != NULL) - { - strncat(ps->headr, strstri(tempStr, "") + 8, 64); - } - else strncat(ps->headr, tempStr + 4, 64); + else { + ptr2 = strstri(ptr1 + 4, "headr, strstri(ptr1, "headr, ptr1 + 4, 64); + }; + strcat(ps->headr, "]"); } else @@ -2658,7 +2622,7 @@ int Lexems::_header(char *ip, int port, const char str[], Lexems *l, PathStr *ps ++Filt; strcpy(ps->path, "/"); - return 0; + return -1; }; } else diff --git a/login.txt b/login.txt index 25b2450..0bef95e 100644 --- a/login.txt +++ b/login.txt @@ -4,7 +4,6 @@ root 123456 12345 - cisco super meinsm @@ -22,6 +21,8 @@ telecom dreambox master Admin -Root guest -backup \ No newline at end of file +backup +cgadmin +0000 +1111 \ No newline at end of file diff --git a/mainResources.h b/mainResources.h index 1ffa44e..baf7e0b 100644 --- a/mainResources.h +++ b/mainResources.h @@ -1,4 +1,4 @@ -#pragma once +#pragma once #include "base64.h" #include @@ -103,8 +103,8 @@ struct PathStr{ }; struct lopaStr{ - char login[128]; - char pass[32]; + char login[128]; + char pass[32]; char other[128]; }; @@ -115,78 +115,78 @@ struct conSTR{ }; class Lexems +{ +public: + int iterationCount, flag; + + Lexems() { - public: - int iterationCount, flag; + iterationCount = 0; + flag = 0; + } - Lexems() - { - iterationCount = 0; - flag = 0; - } + ~Lexems() + { + iterationCount = 0; + } - ~Lexems() - { - iterationCount = 0; - } - - int _header(char *ip, - int port, - const char str[], - Lexems *l, - PathStr *ps, - std::vector *lst); + int _header(char *ip, + int port, + const char str[], + Lexems *l, + PathStr *ps, + std::vector *lst); - int _filler(int p, - const char *buffcpy, - char* ipi, - int recd, - Lexems *lx, - char *hl); - }; + int _filler(int port, + const char *buffcpy, + char* ip, + int recd, + Lexems *lx, + char *hl); +}; class Connector_old - { - public: - int _Updater(); - -// lopaStr _FTPLobby(char *ip, -// int port, -// PathStr *ps); +{ +public: + int _Updater(); -// lopaStr _BALobby(char *cookie, -// char *ip, -// int port, -// char *path, -// char *method, -// char *data); + // lopaStr _FTPLobby(char *ip, + // int port, + // PathStr *ps); - lopaStr _WFLobby(char *cookie, - char *ip, - int port, - char *methodVal, - char *actionVal, - char *userVal, - char *passVal, - char *formVal); + // lopaStr _BALobby(char *cookie, + // char *ip, + // int port, + // char *path, + // char *method, + // char *data); - lopaStr _IPCameraBLobby(char *ip, - int port, - char *SPEC); + lopaStr _WFLobby(char *cookie, + char *ip, + int port, + char *methodVal, + char *actionVal, + char *userVal, + char *passVal, + char *formVal); - int _SSHLobby(char *ip, - int port, - std::string *buffer); - - void _Connect(void *s); + lopaStr _IPCameraBLobby(char *ip, + int port, + char *SPEC); - int _ConnectToPort(char *ip, - int port, - char *hl); - }; + int _SSHLobby(char *ip, + int port, + std::string *buffer); + + void _Connect(void *s); + + int _ConnectToPort(char *ip, + int port, + char *hl); +}; -extern lopaStr _IPCameraBLobby(char *ip, int port, char *SPEC); +extern lopaStr _IPCameraBLobby(const char *ip, int port, char *SPEC); //extern lopaStr _BALobby(char *cookie, char *ip, int port, char *path, char *method); //extern lopaStr _FTPLobby(char *ip, int port, PathStr *ps); diff --git a/msgcheckerthread.cpp b/msgcheckerthread.cpp index 20edc81..15ae94c 100644 --- a/msgcheckerthread.cpp +++ b/msgcheckerthread.cpp @@ -1,8 +1,8 @@ #include "msgcheckerthread.h" #include "externData.h" #include "mainResources.h" -#include -#include +#include "Utils.h" +#include "Connector.h" void MSGCheckerThread::doEmitionShowNewMsg(QString str) { diff --git a/negatives.txt b/negatives.txt index 1bf1b3d..31f8dad 100644 --- a/negatives.txt +++ b/negatives.txt @@ -292,7 +292,6 @@ domain has been registered domain name registration domain registered domainapps.com -sale domeny domeingeregistreerd down for maint diff --git a/nesca_3.cpp b/nesca_3.cpp index 0b14761..4f9f321 100644 --- a/nesca_3.cpp +++ b/nesca_3.cpp @@ -746,19 +746,20 @@ void nesca_3::slotAddPolyLine() if(ME2ScanFlag) { QPainterPath path; - if (DrawerTh_ME2Scanner::polyVect.size() > 0) + if (DrawerTh_ME2Scanner::vecSize > 0) { path.moveTo(DrawerTh_ME2Scanner::polyVect[0]); - for (int i = 1; i < DrawerTh_ME2Scanner::polyVect.size(); ++i) + for (int i = 1; i < DrawerTh_ME2Scanner::vecSize; ++i) { path.lineTo(DrawerTh_ME2Scanner::polyVect[i]); }; }; - + QGraphicsPathItem* itm = new QGraphicsPathItem(path); itm->setPen(pen2i); sceneGraph->addItem(itm); - DrawerTh_ME2Scanner::itmList.push_front(itm); + DrawerTh_ME2Scanner::itmList.push_front(itm); + DrawerTh_ME2Scanner::polyVect.clear(); int u = 0; double uu = 1.0; @@ -778,7 +779,6 @@ void nesca_3::slotAddPolyLine() delete DrawerTh_ME2Scanner::itmList[38]; DrawerTh_ME2Scanner::itmList.pop_back(); }; - }; } @@ -1484,7 +1484,7 @@ void nesca_3::CheckPersKey() if(!chKTh->isRunning()) { - stt->doEmitionYellowFoundData("[Key check] Starting checker-thread..."); + stt->doEmitionYellowFoundData("[Key check] Starting checker thread..."); chKTh->start(); } else @@ -1500,7 +1500,7 @@ void nesca_3::CheckPersKey(int val = -1) if(!chKTh->isRunning()) { - stt->doEmitionYellowFoundData("[Key check] Starting checker-thread..."); + stt->doEmitionYellowFoundData("[Key check] Starting checker thread..."); chKTh->start(); } else @@ -1875,7 +1875,7 @@ void nesca_3::slotIRCGetTopic(QString str) int c = 1; -void nesca_3::slotSaveImage() +void nesca_3::slotSaveImage(QAction *qwe) { QObject *smB = this->sender(); int ci = ui->tabMainWidget->currentIndex(); @@ -1960,7 +1960,7 @@ void PieStatView::contextMenuEvent(QContextMenuEvent *event) menuPS->addAction("Save image."); menuPS->popup(event->globalPos()); - connect(menuPS, SIGNAL(triggered()), gthis, SLOT(slotSaveImage())); + connect(menuPS, SIGNAL(triggered(QAction *)), gthis, SLOT(slotSaveImage(QAction *))); } QLabel *msgLbl; @@ -3158,9 +3158,9 @@ void RestoreSession() if (strstr(resStr, "[TIMEOUT]:") != NULL) { const QString &tempLex = loadNescaSetup(resStr, "[TIMEOUT]:"); if(tempLex.toInt() > 0) { - ui->iptoLine_value->setText(tempLex); - ui->iptoLine_value_2->setText(tempLex); - ui->iptoLine_value_3->setText(tempLex); + ui->iptoLine_value->setText(tempLex.simplified()); + ui->iptoLine_value_2->setText(tempLex.simplified()); + ui->iptoLine_value_3->setText(tempLex.simplified()); } } setUIText("[MAXBTHR]:", ui->maxBrutingThrBox, resStr); @@ -3236,7 +3236,7 @@ const char *GetVer() char db[32] = {0}; sprintf(db, "%X-%X", dver, tver); - return std::string(db).c_str(); + return db; } void nesca_3::slotShowRedVersion() @@ -3280,9 +3280,8 @@ void _startMsgCheck() ui->ircNickBox->setText("nsa_" + QString::number(qrand() % 8999 + 1000)); - const char *rVer = GetVer(); - QString QVER(rVer); - strcpy(gVER, QVER.toLatin1().data()); + strcpy(gVER, GetVer()); + QString QVER(gVER); ui->logoLabel->setToolTip("v3-" + QVER); ui->logoLabel->setStyleSheet("color:white; border: none;background-color:black;"); ui->newMessageLabel->setStyleSheet("color:rgba(255, 0, 0, 0);background-color: rgba(2, 2, 2, 0);"); @@ -3304,7 +3303,7 @@ void _startMsgCheck() if (WSAStartup(0x0101, &wsda)) { stt->doEmitionRedFoundData("WSAStartup failed."); - stt->doEmitionKillSttThread(); + qApp->quit(); }; #endif @@ -3343,8 +3342,7 @@ void nesca_3::mouseMoveEvent(QMouseEvent * event) void nesca_3::exitButtonClicked() { - globalScanFlag = false; - stt->terminate(); + STTTerminate(); #if defined(WIN32) || defined(_WIN32) || defined(__WIN32) && !defined(__CYGWIN__) WSACleanup(); #endif @@ -3399,12 +3397,10 @@ void nesca_3::STTTerminate() importFileName = ""; startFlag = false; globalScanFlag = false; - - stt->terminate(); + nCleanup(); while(__savingBackUpFile) Sleep(100); - nCleanup(); ui->tabMainWidget->setTabEnabled(0, true); ui->tabMainWidget->setTabEnabled(1, true); ui->tabMainWidget->setTabEnabled(2, true); @@ -3419,6 +3415,7 @@ void nesca_3::STTTerminate() ui->startScanButton_4->setText("Start"); ui->importButton->setText("Import&&Scan"); ui->labelStatus_Value->setText("Idle"); + stt->terminate(); } bool dfLocked = false; diff --git a/nesca_3.h b/nesca_3.h index 81e90a1..7c8a095 100644 --- a/nesca_3.h +++ b/nesca_3.h @@ -21,7 +21,7 @@ #include #include #include -#include +#include "mainResources.h" extern Ui::nesca_3Class *ui; extern bool widgetIsHidden, IRCLogToggled, blinkFlag, disableBlink, debugFileOK, QOSWait, @@ -89,7 +89,7 @@ protected: void slotOutData(QString str); void slotIncData(QString ip, QString str); void slotShowServerMsg(QString str); - void slotSaveImage(); + void slotSaveImage(QAction *qwe); void slotUpdatePie(); void slotClearLogs(); void slotRestartIRC(); diff --git a/nesca_3.pri b/nesca_3.pri deleted file mode 100644 index ae2c3d0..0000000 --- a/nesca_3.pri +++ /dev/null @@ -1,48 +0,0 @@ -# ---------------------------------------------------- -# This file is generated by the Qt Visual Studio Add-in. -# ------------------------------------------------------ - -# This is a reminder that you are using a generated .pro file. -# Remove it when you are finished editing this file. -message("You are running qmake on a generated .pro file. This may not work!") - - -HEADERS += ./base64.h \ - ./resource.h \ - ./nesca_3.h \ - ./ActivityDrawerTh_HorNet.h \ - ./STh.h \ - ./CheckKey_Th.h \ - ./DrawerTh_QoSScanner.h \ - ./CheckProxy_Th.h \ - ./DrawerTh_HorNet.h \ - ./DrawerTh_GridQoSScanner.h \ - ./DrawerTh_VoiceScanner.h \ - ./DrawerTh_ME2Scanner.h \ - ./darkmap.h \ - ./IRCPinger_Th.h \ - ./oIRC_Th.h \ - ./irc_nmblinker.h \ - ./msgpopup.h -SOURCES += ./ActivityDrawerTh_HorNet.cpp \ - ./base64.cpp \ - ./CheckKey_Th.cpp \ - ./CheckProxy_Th.cpp \ - ./connector.cpp \ - ./darkmap.cpp \ - ./DrawerTh_GridQoSScanner.cpp \ - ./DrawerTh_HorNet.cpp \ - ./DrawerTh_ME2Scanner.cpp \ - ./DrawerTh_QoSScanner.cpp \ - ./DrawerTh_VoiceScanner.cpp \ - ./finder.cpp \ - ./IRCPinger_Th.cpp \ - ./irc_nmblinker.cpp \ - ./main.cpp \ - ./msgpopup.cpp \ - ./nesca_3.cpp \ - ./nesca_startModule.cpp \ - ./oIRC_Th.cpp \ - ./STh.cpp -FORMS += ./nesca_3.ui -RESOURCES += nesca_3.qrc diff --git a/nesca_3.pro b/nesca_3.pro deleted file mode 100644 index cc8aa1d..0000000 --- a/nesca_3.pro +++ /dev/null @@ -1,20 +0,0 @@ -# ---------------------------------------------------- -# This file is generated by the Qt Visual Studio Add-in. -# ------------------------------------------------------ - -TEMPLATE = app -TARGET = nesca_3 -DESTDIR = ../Win32/Release -QT += core widgets gui qml -CONFIG += release -DEFINES += QT_DLL QT_WIDGETS_LIB QT_QML_LIB -INCLUDEPATH += ./GeneratedFiles \ - . \ - ../../../../../../../../Qt/Qt5.0.0/5.0.0/msvc2010/bin -DEPENDPATH += . -MOC_DIR += C:/Qt/Qt5.0.0/5.0.0/msvc2010/bin -OBJECTS_DIR += release -UI_DIR += ./GeneratedFiles -RCC_DIR += ./GeneratedFiles -include(nesca_3.pri) -win32:RC_FILE = nesca_3.rc diff --git a/nesca_3.rc b/nesca_3.rc index 88a9d60a069afc0e6e682ee7f2db04ed440c8496..1980d492bf8e5ee70384d543c8e76c91ee0dab46 100644 GIT binary patch delta 122 zcmX@1enNf2I%c^bhEj%NAk1V)WXNMsV9;Pd7TJ7;`4StW(d7ADhKxp=FLFI*0&-UJ l%TIRTSg`oBY(B$$iH*@<@_a5sMuW{4 sxgIkCIV<_)Cp&O*Ot$0W+x&`mA0tp^B|k4C0i!0LVV2tbPT&?30N;)rh5!Hn diff --git a/nesca_3.ui b/nesca_3.ui index 7ad3c2d..01b2eac 100644 --- a/nesca_3.ui +++ b/nesca_3.ui @@ -1749,7 +1749,10 @@ border-radius: 3px; Eurostile - 9 + 8 + 50 + false + false @@ -1780,8 +1783,8 @@ border-radius: 3px; <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0//EN" "http://www.w3.org/TR/REC-html40/strict.dtd"> <html><head><meta name="qrichtext" content="1" /><style type="text/css"> p, li { white-space: pre-wrap; } -</style></head><body style=" font-family:'Eurostile'; font-size:9pt; font-weight:400; font-style:normal;"> -<p style="-qt-paragraph-type:empty; margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px; font-family:'MS Shell Dlg 2'; font-size:8pt;"><br /></p></body></html> +</style></head><body style=" font-family:'Eurostile'; font-size:8pt; font-weight:400; font-style:normal;"> +<p style="-qt-paragraph-type:empty; margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px; font-family:'Verdana'; font-size:6pt;"><br /></p></body></html> 5 @@ -2543,7 +2546,7 @@ p, li { white-space: pre-wrap; } <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0//EN" "http://www.w3.org/TR/REC-html40/strict.dtd"> <html><head><meta name="qrichtext" content="1" /><style type="text/css"> p, li { white-space: pre-wrap; } -</style></head><body style=" font-family:'Eurostile'; font-size:11pt; font-weight:400; font-style:normal;"> +</style></head><body style=" font-family:'Eurostile'; font-size:8.25pt; font-weight:400; font-style:normal;"> <p style="-qt-paragraph-type:empty; margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px; font-size:8pt;"><br /></p></body></html> @@ -3527,7 +3530,7 @@ background-color: #000000; <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0//EN" "http://www.w3.org/TR/REC-html40/strict.dtd"> <html><head><meta name="qrichtext" content="1" /><style type="text/css"> p, li { white-space: pre-wrap; } -</style></head><body style=" font-family:'Eurostile'; font-size:11pt; font-weight:400; font-style:normal;"> +</style></head><body style=" font-family:'Eurostile'; font-size:8.25pt; font-weight:400; font-style:normal;"> <p style="-qt-paragraph-type:empty; margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px; font-size:8pt;"><br /></p></body></html> @@ -3663,7 +3666,7 @@ p, li { white-space: pre-wrap; } <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0//EN" "http://www.w3.org/TR/REC-html40/strict.dtd"> <html><head><meta name="qrichtext" content="1" /><style type="text/css"> p, li { white-space: pre-wrap; } -</style></head><body style=" font-family:'Eurostile'; font-size:11pt; font-weight:400; font-style:normal;"> +</style></head><body style=" font-family:'Eurostile'; font-size:8.25pt; font-weight:400; font-style:normal;"> <p style="-qt-paragraph-type:empty; margin-top:2px; margin-bottom:2px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px; font-size:8pt;"><br /></p></body></html> diff --git a/nesca_startModule.cpp b/nesca_startModule.cpp index 404fd0f..67e82bd 100644 --- a/nesca_startModule.cpp +++ b/nesca_startModule.cpp @@ -220,8 +220,9 @@ void _SaveBackupToFile() { for(int tCounter = gC; tCounter < flCounter; ++tCounter) { - sprintf(ipRange, "%s-%d.%d.%d.%d\n", - currentIP, ipsendfl[tCounter][0], ipsendfl[tCounter][1], ipsendfl[tCounter][2], ipsendfl[tCounter][3]); + sprintf(ipRange, "%d.%d.%d.%d-%d.%d.%d.%d\n", + ipsstartfl[tCounter][0], ipsstartfl[tCounter][1], ipsstartfl[tCounter][2], ipsstartfl[tCounter][3], + ipsendfl[tCounter][0], ipsendfl[tCounter][1], ipsendfl[tCounter][2], ipsendfl[tCounter][3]); fputs(ipRange, savingFile); @@ -775,48 +776,65 @@ unsigned long int numOfIps(int ipsstart[], int ipsend[]) { void _connect() { string ip = ""; - while(globalScanFlag) { - std::unique_lock lk(Threader::m); - Threader::cv.wait(lk, []{return Threader::ready;}); - if(globalScanFlag == false) break; - if(Threader::threadId > gThreads) { - --Threader::threadId; - return; - } + while (globalScanFlag) { + std::unique_lock lk(Threader::m); + Threader::cv.wait(lk, []{return Threader::ready; }); + if (Threader::threadId > gThreads || !globalScanFlag) { + --Threader::threadId; + Threader::ready = false; + lk.unlock(); + return; + } - ip = Threader::ipQueue.front(); + if (!Threader::ipQueue.empty()) { + ip = Threader::ipQueue.front(); + Threader::ipQueue.pop(); + Threader::ready = false; + lk.unlock(); - Threader::ipQueue.pop(); - Threader::ready = false; - lk.unlock(); + if (ip.size() == 0) return; - ConInc(); - for(int i = 0; i <= overallPorts; ++i) - { - if(globalScanFlag == false) break; - if(Connector::_ConnectToPort( ip, portArr[i], "" ) == -2) break; - }; - ConDec(); + ConInc(); + for (int i = 0; i <= overallPorts; ++i) + { + if (globalScanFlag == false) break; + if (Connector::_ConnectToPort(ip, portArr[i], "") == -2) break; + }; + ConDec(); + } } } -void targetAndIPWriter(long long unsigned int target, const char *ip) { +void verboseProgress(long long unsigned int target, const char *ip) { - char targetNPers[32] = {0}; + char targetNPers[128] = {0}; float percent = (gTargetsOverall != 0 ? (100 - target/(double)gTargetsOverall * 100) : 0); stt->doEmitionIPRANGE(QString(ip)); strcpy(currentIP, ip); - sprintf(targetNPers, "%Lu (%.1f%%)", - target, - percent); - stt->doEmitionTargetsLeft(QString(targetNPers)); + //sprintf(targetNPers, "%Lu (%.1f%%)", target, percent); + //stt->doEmitionTargetsLeft(QString(targetNPers)); sprintf(metaTargets, "%Lu", target); sprintf(metaPercent, "%.1f", percent); } +void verboseProgressDNS(long long unsigned int target, const char *ip, const char *TLD) { + + char targetNPers[128] = { 0 }; + float percent = (gTargetsOverall != 0 ? (100 - target / (double)gTargetsOverall * 100) : 0); + + stt->doEmitionIPRANGE(QString(ip) + QString(TLD)); + strcpy(currentIP, ip); + + //sprintf(targetNPers, "%Lu (%.1f%%)", target, percent); + //stt->doEmitionTargetsLeft(QString(targetNPers)); + + sprintf(metaTargets, "%Lu", target); + sprintf(metaPercent, "%.1f", + percent); +} void _passLoginLoader() { MaxLogin = 0; @@ -1010,10 +1028,6 @@ void _passLoginLoader() { stt->doEmitionRedFoundData("No password/login list found"); stt->doEmitionKillSttThread(); }; - - stt->doEmitionYellowFoundData("BA: ~" + QString::number(MaxLogin * MaxPass/gTimeOut/60) - + "; WF: ~" + QString::number(MaxWFLogin * MaxWFPass/gTimeOut/60) - + "; SSH: ~" + QString::number(MaxSSHPass/gTimeOut/60)); } void ReadUTF8(FILE* nFile, char *cp) { @@ -2090,7 +2104,7 @@ int _GetDNSFromMask(char *mask, char *saveMask, char *saveMaskEnder) { if(globalScanFlag == false) return 0; string res = string(mask); - targetAndIPWriter(--gTargets, res.c_str()); + verboseProgressDNS(--gTargets, res.c_str(), top_level_domain); res += string(top_level_domain); ++indexIP; @@ -2099,6 +2113,15 @@ int _GetDNSFromMask(char *mask, char *saveMask, char *saveMaskEnder) { }; } +void runAuxiliaryThreads() { + std::thread saverThread(_saver); + std::thread trackerThread(_tracker); + std::thread timerThread(_timer); + saverThread.detach(); + trackerThread.detach(); + timerThread.detach(); +} + int startScan(char* args) { curl_global_init(CURL_GLOBAL_ALL); SSL_library_init(); @@ -2121,57 +2144,53 @@ int startScan(char* args) { ZeroMemory(octet, sizeof(octet)); ZeroMemory(ipsstart, sizeof(ipsstart)); ZeroMemory(ipsend, sizeof(ipsend)); - + #if defined(WIN32) || defined(_WIN32) || defined(__WIN32) && !defined(__CYGWIN__) - CreateDirectory(L(RESULT_DIR_NAME), NULL); + //std::string OutputFolder = std::string(RESULT_DIR_NAME); + CreateDirectoryA(RESULT_DIR_NAME, NULL); #else - struct stat str = {0}; - if (stat(RESULT_DIR_NAME, &str) == -1) { - mkdir(RESULT_DIR_NAME, 0700); + struct stat str = {0}; + if (stat(RESULT_DIR_NAME, &str) == -1) { + mkdir(RESULT_DIR_NAME, 0700); } #endif int argc = 0; - char *argv[512] = {0}; + char *argv[512] = { 0 }; char *tStr = strtok(args, "|"); - while(tStr != NULL) + while (tStr != NULL) { argv[argc++] = tStr; tStr = strtok(NULL, "|"); }; - + ParseArgs(argc, argv); mode = gMode; int resInit = fInit(gMode, gRange); - if(resInit == -1 ) - { - stt->doEmitionRedFoundData("[Error] fInit failure"); + if (resInit == -1) + { + stt->doEmitionRedFoundData("[Error] fInit failure"); stt->doEmitionKillSttThread(); - + return -1; }; - stt->doEmitionIPRANGE(QString("--")); - stt->doEmitionThreads(QString::number(0) + "/" + QString::number(gThreads)); + stt->doEmitionIPRANGE(QString("--")); + stt->doEmitionThreads(QString::number(0) + "/" + QString::number(gThreads)); - _passLoginLoader(); - _NegativeLoader(); + _passLoginLoader(); + _NegativeLoader(); if (gMode == 0) { - std::thread saverThread(_saver); - std::thread trackerThread(_tracker); - std::thread timerThread(_timer); - saverThread.detach(); - trackerThread.detach(); - timerThread.detach(); + runAuxiliaryThreads(); - unsigned long ip1 = (ipsstart[0] * 16777216) + (ipsstart[1] * 65536) + (ipsstart[2] * 256) + ipsstart[3]; + 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 ipVec; struct in_addr tAddr; @@ -2179,35 +2198,27 @@ int startScan(char* args) { for (unsigned long i = ip1; i <= ip2; ++i) { if (globalScanFlag == false) break; - unsigned long offset = ip2 - i; + unsigned long offset = ip2 - i; - 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 - tAddr.s_addr = ntohl(tAddr.s_addr); - ipVec.push_back(inet_ntoa(tAddr)); -#endif - if(ipVec.size() != 0) strcpy(currentIP, ipVec[0].c_str()); + tAddr.s_addr = ntohl(i); + ipVec.push_back(inet_ntoa(tAddr)); + if (ipVec.size() != 0) strcpy(currentIP, ipVec[0].c_str()); if (ipVec.size() >= (offset < 1000 ? offset : 1000)) { std::random_shuffle(ipVec.begin(), ipVec.end()); while (ipVec.size() != 0) { - while (cons >= gThreads && globalScanFlag) Sleep(500); - if (globalScanFlag == false) goto haters_gonna_hate_IPM; + while (cons >= gThreads && globalScanFlag) Sleep(500); + if (globalScanFlag == false) goto haters_gonna_hate_IPM; - ++indexIP; - std::string res = ipVec[0]; - ipVec.erase(ipVec.begin()); + ++indexIP; + std::string res = ipVec[0]; + ipVec.erase(ipVec.begin()); - targetAndIPWriter(gTargets--, res.c_str()); + verboseProgress(gTargets--, res.c_str()); - Threader::fireThread(res, (void*(*)(void))_connect); + Threader::fireThread(res, (void*(*)(void))_connect); } } } @@ -2217,113 +2228,100 @@ int startScan(char* args) { } case false: { struct in_addr tAddr; - for (unsigned long i = ip1; i <= ip2; ++i) { + for (unsigned long i = ip1; i <= ip2; ++i) { - while (cons >= gThreads && globalScanFlag) Sleep(500); - if (globalScanFlag == false) break; + while (cons >= gThreads && globalScanFlag) Sleep(500); + if (globalScanFlag == false) break; - std::string res = ""; + std::string res = ""; ++indexIP; - 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 - tAddr.s_addr = ntohl(tAddr.s_addr); - res = string(inet_ntoa(tAddr)); -#endif - targetAndIPWriter(gTargets--, res.c_str()); + tAddr.s_addr = ntohl(i); + res = string(inet_ntoa(tAddr)); + verboseProgress(gTargets--, res.c_str()); - Threader::fireThread(res, (void*(*)(void))_connect); + Threader::fireThread(res, (void*(*)(void))_connect); } break; - } + } } } - else if(gMode == 1 ) + else if (gMode == 1) { - std::thread saverThread(_saver); - std::thread trackerThread(_tracker); - std::thread timerThread(_timer); - saverThread.detach(); - trackerThread.detach(); - timerThread.detach(); + runAuxiliaryThreads(); strcpy(top_level_domain, gFirstDom); - char dataEntry[1024] = {0}; - int innerCounter = 0; - int sz = strlen(saveEndIP); + char dataEntry[1024] = { 0 }; + int innerCounter = 0; + int sz = strlen(saveEndIP); - for(int i = 0; i < sz; ++i) - { - if(saveEndIP[i] == '\\') + for (int i = 0; i < sz; ++i) { - if(saveEndIP[i + 1] == 'd') + if (saveEndIP[i] == '\\') { - strcat(dataEntry, "[09]"); - ++i; - innerCounter += 4; - continue; - } - else if(saveEndIP[i + 1] == 'w') - { - strcat(dataEntry, "[0z]"); - ++i; - innerCounter += 4; - continue; - } - else if(saveEndIP[i + 1] == 'l') - { - strcat(dataEntry, "[az]"); - ++i; - innerCounter += 4; - continue; + if (saveEndIP[i + 1] == 'd') + { + strcat(dataEntry, "[09]"); + ++i; + innerCounter += 4; + continue; + } + else if (saveEndIP[i + 1] == 'w') + { + strcat(dataEntry, "[0z]"); + ++i; + innerCounter += 4; + continue; + } + else if (saveEndIP[i + 1] == 'l') + { + strcat(dataEntry, "[az]"); + ++i; + innerCounter += 4; + continue; + } + else + { + QString errStr = "Error at mask (Position:" + QString::number(i + 1); + errStr += ") \""; + errStr += QString(saveEndIP).mid(0, i == 0 ? 0 : i); + errStr += ""; + errStr += QString(saveEndIP).mid(i, i == 0 ? i + 2 : i + 1); + errStr += ""; + errStr += QString(saveEndIP).mid(i + 2, strlen(saveEndIP)); + errStr += "\""; + + stt->doEmitionRedFoundData(errStr); + return -1; + }; } else { - QString errStr = "Error at mask (Position:" + QString::number(i+1); - errStr += ") \""; - errStr += QString(saveEndIP).mid(0, i == 0 ? 0 : i); - errStr += ""; - errStr += QString(saveEndIP).mid(i, i == 0 ? i+2 : i+1); - errStr += ""; - errStr += QString(saveEndIP).mid(i+2, strlen(saveEndIP)); - errStr += "\""; - - stt->doEmitionRedFoundData(errStr); - return -1; + memset(dataEntry + innerCounter++, saveEndIP[i], 1); }; - } - else - { - memset(dataEntry + innerCounter++, saveEndIP[i], 1); }; - }; memset(dataEntry + innerCounter + 1, '\0', 1); - for(int i = 0; i < sz; ++i) + for (int i = 0; i < sz; ++i) { - if(dataEntry[i] == '[') + if (dataEntry[i] == '[') { - for(int j = i + 1; j < i + 3; ++j) + for (int j = i + 1; j < i + 3; ++j) { - if((dataEntry[j] < '0' || dataEntry[j] > '9') + if ((dataEntry[j] < '0' || dataEntry[j] > '9') && (dataEntry[j] < 'a' || dataEntry[j] > 'z') - && dataEntry[j] != '_' + && dataEntry[j] != '_' && dataEntry[j] != '-' ) { - QString errStr = "Error at mask (" + QString::number(j-1); + QString errStr = "Error at mask (" + QString::number(j - 1); errStr += ") \""; - errStr += QString(dataEntry).mid(0, j-1); + errStr += QString(dataEntry).mid(0, j - 1); errStr += ""; - errStr += QString(dataEntry).mid(j-1, j+1); + errStr += QString(dataEntry).mid(j - 1, j + 1); errStr += ""; - errStr += QString(dataEntry).mid(j+1, strlen(dataEntry)); + errStr += QString(dataEntry).mid(j + 1, strlen(dataEntry)); errStr += "\""; stt->doEmitionRedFoundData(errStr); @@ -2332,15 +2330,15 @@ int startScan(char* args) { }; i += 3; } - else if(dataEntry[i] == ']') + else if (dataEntry[i] == ']') { - QString errStr = "Error at mask (" + QString::number(i-1); + QString errStr = "Error at mask (" + QString::number(i - 1); errStr += ") \""; - errStr += QString(dataEntry).mid(0, i-1); + errStr += QString(dataEntry).mid(0, i - 1); errStr += ""; - errStr += QString(dataEntry).mid(i-1, i+1); + errStr += QString(dataEntry).mid(i - 1, i + 1); errStr += ""; - errStr += QString(dataEntry).mid(i+1, strlen(dataEntry)); + errStr += QString(dataEntry).mid(i + 1, strlen(dataEntry)); errStr += "\""; stt->doEmitionRedFoundData(errStr); @@ -2350,19 +2348,19 @@ int startScan(char* args) { unsigned long long dnsCounter = 1; char *dnsPtr1 = strstr(dataEntry, "["); - while(dnsPtr1 != NULL) + while (dnsPtr1 != NULL) { dnsCounter *= _getChunkCount(dnsPtr1); dnsPtr1 = strstr(dnsPtr1 + 1, "["); - }; + }; gTargets = dnsCounter; gTargetsOverall = gTargets; stt->doEmitionYellowFoundData("Starting DNS-scan..."); stt->doEmitionChangeStatus("Scanning..."); - - int y = _GetDNSFromMask(dataEntry, "", dataEntry); - if(y == -1) + + int y = _GetDNSFromMask(dataEntry, "", dataEntry); + if (y == -1) { stt->doEmitionRedFoundData("DNS-Mode error"); }; @@ -2371,23 +2369,18 @@ int startScan(char* args) { { if (flCounter == 0) { - stt->doEmitionRedFoundData("Empty IP list."); - globalScanFlag = false; + stt->doEmitionRedFoundData("Empty IP list."); + globalScanFlag = false; stt->doEmitionKillSttThread(); return -1; }; - std::thread saverThread(_saver); - std::thread trackerThread(_tracker); - std::thread timerThread(_timer); - saverThread.detach(); - trackerThread.detach(); - timerThread.detach(); + runAuxiliaryThreads(); - stt->doEmitionChangeStatus("Scanning..."); + stt->doEmitionChangeStatus("Scanning..."); for (gC = 0; gC < flCounter; ++gC) - { + { strcpy(metaRange, std::to_string(ipsstartfl[gC][0]).c_str()); strcat(metaRange, "."); strcat(metaRange, std::to_string(ipsstartfl[gC][1]).c_str()); @@ -2403,9 +2396,9 @@ int startScan(char* args) { strcat(metaRange, std::to_string(ipsendfl[gC][2]).c_str()); strcat(metaRange, "."); strcat(metaRange, std::to_string(ipsendfl[gC][3]).c_str()); - - unsigned long ip1 = (ipsstartfl[gC][0] * 16777216) + (ipsstartfl[gC][1] * 65536) + (ipsstartfl[gC][2] * 256) + ipsstartfl[gC][3]; - unsigned long ip2 = (ipsendfl[gC][0] * 16777216) + (ipsendfl[gC][1] * 65536) + (ipsendfl[gC][2] * 256) + ipsendfl[gC][3]; + + unsigned long ip1 = (ipsstartfl[gC][0] * 16777216) + (ipsstartfl[gC][1] * 65536) + (ipsstartfl[gC][2] * 256) + ipsstartfl[gC][3]; + unsigned long ip2 = (ipsendfl[gC][0] * 16777216) + (ipsendfl[gC][1] * 65536) + (ipsendfl[gC][2] * 256) + ipsendfl[gC][3]; switch (gShuffle) { case true: { @@ -2415,32 +2408,27 @@ int startScan(char* args) { for (unsigned long i = ip1; i <= ip2; ++i) { if (globalScanFlag == false) break; - unsigned long offset = ip2 - i; + unsigned long offset = ip2 - i; - 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 - tAddr.s_addr = ntohl(tAddr.s_addr); - ipVec.push_back(inet_ntoa(tAddr)); -#endif - if(ipVec.size() != 0) strcpy(currentIP, ipVec[0].c_str()); + tAddr.s_addr = ntohl(i); + ipVec.push_back(inet_ntoa(tAddr)); + if (ipVec.size() != 0) strcpy(currentIP, ipVec[0].c_str()); if (ipVec.size() >= (offset < 1000 ? offset : 1000)) { std::random_shuffle(ipVec.begin(), ipVec.end()); while (ipVec.size() != 0) { - while (cons >= gThreads && globalScanFlag) Sleep(500); - if (globalScanFlag == false) goto haters_gonna_hate_IM; + while (cons >= gThreads && globalScanFlag) Sleep(500); + if (globalScanFlag == false) goto haters_gonna_hate_IM; - ++indexIP; - std::string res = ipVec[0]; + ++indexIP; + std::string res = ipVec[0]; ipVec.erase(ipVec.begin()); - targetAndIPWriter(gTargets--, res.c_str()); + verboseProgress(gTargets--, res.c_str()); - Threader::fireThread(res, (void*(*)(void))_connect); + Threader::fireThread(res, (void*(*)(void))_connect); } } } @@ -2449,26 +2437,20 @@ int startScan(char* args) { } case false: { struct in_addr tAddr; - for (unsigned long i = ip1; i <= ip2; ++i) { + for (unsigned long i = ip1; i <= ip2; ++i) { - while (cons >= gThreads && globalScanFlag) Sleep(500); - if (globalScanFlag == false) break; + while (cons >= gThreads && globalScanFlag) Sleep(500); + if (globalScanFlag == false) break; ++indexIP; - std::string res = ""; - 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 - tAddr.s_addr = ntohl(tAddr.s_addr); - res = string(inet_ntoa(tAddr)); -#endif - targetAndIPWriter(gTargets--, res.c_str()); - Threader::fireThread(res, (void*(*)(void))_connect); + tAddr.s_addr = ntohl(i); + std::string res = string(inet_ntoa(tAddr)); + verboseProgress(gTargets--, res.c_str()); + Threader::fireThread(res, (void*(*)(void))_connect); } - break; - }; + break; + }; } } } @@ -2482,7 +2464,6 @@ int startScan(char* args) { stt->doEmitionYellowFoundData("Stopping threads..."); stt->doEmitionChangeStatus("Stopping..."); - while(cons > 0 || jsonArr->size() > 0) { Sleep(2000); }; diff --git a/pass.txt b/pass.txt index 7d92c21..43c0cee 100644 --- a/pass.txt +++ b/pass.txt @@ -16,6 +16,7 @@ passwd qwerty meinsm monitor +user test sysadm admin123 @@ -24,6 +25,7 @@ Admin 12344321 toor qwerty123 +1q2w3e4r 987654321 system telecom @@ -45,6 +47,7 @@ administrator sys guest backup -Fujiyama fujiyama -super \ No newline at end of file +super +P@ssw0rd +passw0rd \ No newline at end of file