From 4b965e5976d6c507f1e770b620217a506fbd3c01 Mon Sep 17 00:00:00 2001 From: cora32 Date: Sun, 30 Nov 2014 19:17:35 +0300 Subject: [PATCH] =?UTF-8?q?=D0=A4=D0=B8=D0=BA=D1=81=20=D1=81=D1=87=D0=B5?= =?UTF-8?q?=D1=82=D1=87=D0=B8=D0=BA=D0=B0=20=D0=B4=D0=B8=D1=80=D0=B5=D0=BA?= =?UTF-8?q?=D1=82=D0=BE=D1=80=D0=B8=D0=B9=20=D0=B8=20=D1=82=D0=B5=D1=81?= =?UTF-8?q?=D1=82=D0=BE=D0=B2=D1=8B=D0=B9=20=D1=84=D0=B8=D0=BA=D1=81=20100?= =?UTF-8?q?38?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- connector.cpp | 24 ++++++++++++++++++------ externData.h | 2 +- finder.cpp | 11 ++++++----- negatives.txt | 1 + 4 files changed, 26 insertions(+), 12 deletions(-) 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