diff --git a/connector.cpp b/connector.cpp index a0446aa..d5b9b06 100644 --- a/connector.cpp +++ b/connector.cpp @@ -17,14 +17,14 @@ fd_set write_fs; int _countFTPDirectories(char *recvBuff){ + if(strcmp(recvBuff, "dummy\r\n") == 0) return 0; int dirCounter = 0; - strcat(recvBuff, "\n"); + if(recvBuff[strlen(recvBuff) - 1] != '\n') strcat(recvBuff, "\n"); char *dirPtr = strstr(recvBuff, "\n"); while(dirPtr != NULL){ ++dirCounter; dirPtr = strstr(dirPtr + 1, "\n"); }; - return dirCounter; }; void BConInc() @@ -918,8 +918,7 @@ lopaStr _FTPBrute(char *ip, int port, PathStr *ps) while (true) { Sleep(100); - if(globalScanFlag == false) break; - ZeroMemory(recvBuff, sizeof(recvBuff)); + ZeroMemory(recvBuff, 1024); x = recvWT(sockFTP, recvBuff, 1024, gTimeOut + 5, &bTO); if(x <= 0) break; if(MapWidgetOpened) stt->doEmitionAddIncData(QString(ip), QString(recvBuff)); @@ -993,6 +992,8 @@ lopaStr _FTPBrute(char *ip, int port, PathStr *ps) break; }; + if(globalScanFlag == false) break; + if((strstr(recvBuff, "530 Sorry") != NULL) || (strstr(recvBuff, "530") != NULL && strstr(recvBuff, "maximum") != NULL) || strstr(recvBuff, "exceeded") != NULL @@ -1519,7 +1520,18 @@ int Connector::_EstablishConnection(char *ip, int port, char *request, conSTR *C if (!iResult) ++offlines; else { - if(send(sock, request, strlen(request), 0) != SOCKET_ERROR) + int sResult = send(sock, request, strlen(request), 0); + while(sResult == SOCKET_ERROR) + { + stt->doEmitionRedFoundData("[_EC]Resending: " + QString(ip) + " - " + QString::number(WSAGetLastError())); + + CSSOCKET(sock); + Sleep(100); + sock = socket( AF_INET, SOCK_STREAM, IPPROTO_TCP ); + connect(sock, (sockaddr*)&sockAddr, sizeof(sockAddr)); + sResult = send(sock, request, strlen(request), 0); + }; + if(sResult != SOCKET_ERROR) { if(MapWidgetOpened) stt->doEmitionAddOutData(QString(ip), QString(request)); Activity += strlen(request); @@ -1555,7 +1567,7 @@ int Connector::_EstablishConnection(char *ip, int port, char *request, conSTR *C else { ++offlines; - stt->doEmitionRedFoundData("Send error " + QString(ip) + " - " + QString::number(WSAGetLastError())); + stt->doEmitionRedFoundData("[_EC]Send error: " + QString(ip) + " - " + QString::number(WSAGetLastError())); }; }; }; diff --git a/externData.h b/externData.h index 8754617..6f080c7 100644 --- a/externData.h +++ b/externData.h @@ -3,7 +3,7 @@ #define SD_BOTH 2 #define PORTSET "80,81,88,8080,8081,60001,60002,8008,8888,554,9000,441,4111,6667,3536,22,21" #define IRC_CHAN "iskopasi_lab03" -#define CSSOCKET(Socket) shutdown(Socket, SD_BOTH); closesocket(Socket); +#define CSSOCKET(Socket) shutdown(Socket, SD_BOTH); closesocket(Socket); Socket = -1; extern QJsonArray *jsonArr; diff --git a/finder.cpp b/finder.cpp index cab18bf..da809d0 100644 --- a/finder.cpp +++ b/finder.cpp @@ -244,11 +244,12 @@ int _mainFinderFirst(char *buffcpy, int f, int port, char *ip) if(strstr(buffcpy, "vilar ipcamera")) return 13; if(strstr(buffcpy, "window.location = \"rdr.cgi\"")) return 14; if(strstr(buffcpy, "httpfileserver")) return 15; - if(((strstr(buffcpy, "220") != NULL) && (port == 21)) || - (strstri(buffcpy, "220 diskStation ftp server ready") != NULL) || - (strstri(buffcpy, "220 ftp server ready") != NULL) - || strstr(buffcpy, "500 'get': command not understood") != NULL - ) return 16; // 16 - FTP + if(((strstr(buffcpy, "220") != NULL && port == 21) || + strstr(buffcpy, "220 diskstation ftp server ready") != NULL || + strstr(buffcpy, "220 ftp server ready") != NULL || + strstr(buffcpy, "500 'get': command not understood") != NULL + ) + && strstr(buffcpy, "firewall authentication required") == NULL) return 16; // 16 - FTP if(strstr(buffcpy, "real-time ip camera monitoring system") != NULL || strstr(buffcpy, "server push mode") != NULL ) return 17; //Real-time IP Camera Monitoring System diff --git a/negatives.txt b/negatives.txt index 9e7d544..9776ec0 100644 --- a/negatives.txt +++ b/negatives.txt @@ -1,4 +1,5 @@ yadro.ru +Firewall Authentication required before liveinternet #[Dlink] session_login.php?reload=1