diff --git a/BasicAuth.cpp b/BasicAuth.cpp index da3b95c..ce6bbaf 100644 --- a/BasicAuth.cpp +++ b/BasicAuth.cpp @@ -56,13 +56,17 @@ lopaStr BA::BABrute(const char *ip, const int port) { std::string buff; Connector con; - con.nConnect(ip, port, &buff); + int sz = con.nConnect(ip, port, &buff); //QString ipString = QString(ip).mid(0, QString(ip).indexOf("/", 8)) + ":" + QString::number(port); QString ipString = QString(ip); - if (buff.size() == 0) { - stt->doEmitionFoundData("Empty BA probe - " + - ipString + ""); - return lps; + if (sz == 0) { + //Retry + Sleep(2000); + + if (sz == 0) { + stt->doEmitionFoundData("Empty BA probe - " + ipString + ""); + return lps; + } } int isDig = Utils::isDigest(&buff); if (isDig == -1) { diff --git a/Connector.cpp b/Connector.cpp index 7592d2c..e2a68ea 100644 --- a/Connector.cpp +++ b/Connector.cpp @@ -299,7 +299,7 @@ int Connector::nConnect(const char* ip, const int port, std::string *buffer, int res = pConnect(ip, port, buffer, postData, customHeaders, lpString, digestMode); cutoutComments(buffer); - return buffer->size(); + return res; } bool portCheck(const char * sDVRIP, int wDVRPort) { @@ -387,8 +387,8 @@ bool portCheck(const char * sDVRIP, int wDVRPort) { if (res != CURLE_OK) { if (gNegDebugMode) { - stt->doEmitionDebugFoundData("Port check failed (curl_code: " + QString::number(res) + ") [" + QString(sDVRIP) + ":" + QString::number(wDVRPort) + "]"); + /*stt->doEmitionDebugFoundData("Port check failed (curl_code: " + QString::number(res) + ") [" + QString(sDVRIP) + ":" + QString::number(wDVRPort) + "]");*/ SOCKET eNobuffSocket = socket(AF_INET, SOCK_STREAM, IPPROTO_TCP); shutdown(eNobuffSocket, SD_BOTH); closesocket(eNobuffSocket); @@ -409,11 +409,11 @@ bool portCheck(const char * sDVRIP, int wDVRPort) { } } else { - if (gNegDebugMode) - { - stt->doEmitionDebugFoundData("Port check failed - curl_easy_init() error. [" + QString(sDVRIP) + ":" + QString::number(wDVRPort) + "]"); - } + //if (gNegDebugMode) + //{ + // stt->doEmitionDebugFoundData("Port check failed - curl_easy_init() error. [" + QString(sDVRIP) + ":" + QString::number(wDVRPort) + "]"); + //} return false; } } diff --git a/finder.cpp b/finder.cpp index 5fb1f8d..1fca142 100644 --- a/finder.cpp +++ b/finder.cpp @@ -258,7 +258,7 @@ bool isNegative(const std::string *buff, const char *ip, int port, const char *c QTextCodec *nCodec = QTextCodec::codecForName("Windows-1251"); stt->doEmitionDebugFoundData("[" + QString(ip) + ":" + QString::number(port) + - "" + "]\tNegative hit: Size:" + QString::number(nSz)); + "]\tNegative hit: Size:" + QString::number(nSz)); } return true; } @@ -284,7 +284,7 @@ int globalSearchPrnt(const std::string *buff) if (gNegDebugMode) { - QTextCodec *nCodec = QTextCodec::codecForName("Windows-1251"); + /*QTextCodec *nCodec = QTextCodec::codecForName("Windows-1251");*/ stt->doEmitionDebugFoundData("Printer ignored"); } return -1; @@ -336,6 +336,11 @@ int sharedDetector(const char * ip, int port, const std::string *buffcpy, const } return -1; } + } else { + //stt->doEmitionDebugFoundData("[" + QString(ip) + ":" + QString::number(port) + + // "]\tNegative hit: Size: 0"); + //return -1; } } @@ -531,9 +536,7 @@ int contentFilter(const std::string *buff, int port, const char *ip, const char //return res; if (sz < 180000) { - int result = 1; //Other - default - result = firstStage(buff, port, ip, cp, sz); - return result; + return firstStage(buff, port, ip, cp, sz); } else { return 1; @@ -2766,7 +2769,12 @@ std::string getHeader(const std::string *buffcpy, const int flag) { return "[Mobotic IPCam]"; } else if (STRSTR(buffcpy, "iomega=") != -1) { - return "[IOmega NAS]"; + if (STRSTR(buffcpy, "
")) { + return "[IOmega NAS] (Empty)"; + } + else { + return "[IOmega NAS]"; + } } else { std::string tempBuff = buffcpy->c_str(); @@ -3202,33 +3210,27 @@ void handleRedirects(std::string *buffcpy, char* ip, int port) { counter.iterationCount = 0; jsRedirectHandler(buffcpy, ip, port, &counter); } -int handleFramesets(std::string *buffcpy, char* ip, int port, int flag) { - if (NULL == buffcpy || 0 == buffcpy->size()) { +int handleFramesets(std::string *buffcpyOrig, char* ip, int port, int flag) { + if (NULL == buffcpyOrig || 0 == buffcpyOrig->size()) { return flag; } + std::string buffcpy = *buffcpyOrig; + std::transform(buffcpy.begin(), buffcpy.end(), buffcpy.begin(), ::tolower); + int pos; - if ((pos = STRSTR((const std::string *) buffcpy, "find("find("find(">", framePos); + int framePosEnd = buffcpy.find(">", framePos); - std::string frameString = buffcpy->substr(framePos, framePosEnd - framePos); + std::string frameString = buffcpy.substr(framePos, framePosEnd - framePos); + framePos = buffcpy.find(" 5) { return 0; }; - std::string location = frameString.substr(quotePos1 + 1, quotePos2 - quotePos1 - 1); + if (location.size() == 0) { + continue; + } std::string tIP = std::string(ip) + (location[0] == '/' ? "" : "/") + location; std::string buff; + Sleep(5000); int sz = con.nConnect(tIP.c_str(), port, &buff); + if (-1 == sz) { + continue; + } int flg = contentFilter((const std::string *) &buff, port, ip, "UTF-8", sz); if (flg == -1) { return -1; } - } + else if (flg > 1) { + return flg; + } + //} } } }