diff --git a/FTPAuth.cpp b/FTPAuth.cpp index a479ed3..c049e32 100644 --- a/FTPAuth.cpp +++ b/FTPAuth.cpp @@ -45,11 +45,27 @@ lopaStr FTPA::FTPBrute(const char *ip, const int port, PathStr *ps) { return lps; } else if (res != -1) { - if (!globalScanFlag) return lps; - strcpy(lps.login, login); - strcpy(lps.pass, pass); + if (buffer.find("syslog") != -1 || buffer.find("CFG-PAGE") != -1) { + if (gNegDebugMode) { + stt->doEmitionDebugFoundData("Ignoring " + QString(ip) + " (syslog or CFG-PAGE)"); + } + return lps; + } ps->directoryCount = std::count(buffer.begin(), buffer.end(), '\n'); + if (3 == ps->directoryCount) { + if (-1 != buffer.find("pub") || -1 != buffer.find("incoming")) { + if (gNegDebugMode) { + stt->doEmitionDebugFoundData("Ignoring " + QString(ip) + " (pub or incoming)"); + } + return lps; + } + } + + if (!globalScanFlag) return lps; + strcpy(lps.login, login); + strcpy(lps.pass, pass); + rowIndex = Utils::addBARow(QString(ip), QString(login) + ":" + QString(pass), "OK", rowIndex); return lps; diff --git a/finder.cpp b/finder.cpp index 20661c0..853cdad 100644 --- a/finder.cpp +++ b/finder.cpp @@ -2960,43 +2960,45 @@ void parseFlag(int flag, char* ip, char *ipRaw, int port, std::string *buff, con const lopaStr &lps = FTPA::FTPLobby(ip, port, &ps); - if (strstr(lps.login, "UNKNOWN") == NULL && strlen(lps.other) == 0) - { - ++PieBA; + if (0 != ps.directoryCount) { + if (strstr(lps.login, "UNKNOWN") == NULL && strlen(lps.other) == 0) + { + ++PieBA; - sprintf(log, "[FTP]:%s; Received: %dftp://%s:%s@%s%s (F:%d)", - ip, size, lps.login, lps.pass, ipRaw, lps.login, lps.pass, ipRaw, ps.headr, ps.directoryCount); - sprintf(logEmit, "[FTP]:ftp://%s:%s@%s (F:%d)", - lps.login, lps.pass, ipRaw, lps.login, lps.pass, ipRaw, ps.directoryCount); + sprintf(log, "
%s
Size: %d
ftp://%s:%s@%s%s (F:%d)
", + ip, size, lps.login, lps.pass, ipRaw, lps.login, lps.pass, ipRaw, ps.headr, ps.directoryCount); + sprintf(logEmit, "[FTP]:ftp://%s:%s@%s (F:%d)", + lps.login, lps.pass, ipRaw, lps.login, lps.pass, ipRaw, ps.directoryCount); - fputsf(log, flag); + fputsf(log, flag); - fillGlobalLogData(ip, port, std::to_string(size).c_str(), "[FTP service]", lps.login, lps.pass, "NULL", cp, "FTP"); + fillGlobalLogData(ip, port, std::to_string(size).c_str(), "[FTP service]", lps.login, lps.pass, "NULL", cp, "FTP"); - stt->doEmitionFoundData(QString::fromLocal8Bit(logEmit)); + stt->doEmitionFoundData(QString::fromLocal8Bit(logEmit)); + } + else if (strstr(lps.other, "ROUTER") != NULL) + { + ++PieBA; + + sprintf(log, "
%s:%d
Size: %d
ftp://%s:%s@%s
[ROUTER]%s", + ip, port, size, lps.login, lps.pass, ip, lps.login, lps.pass, ip, ip, ps.headr); + sprintf(logEmit, "[FTP]:ftp://%s:%s@%s [ROUTER]", + lps.login, lps.pass, ip, lps.login, lps.pass, ip, ip); + + fputsf(log, flag); + + fillGlobalLogData(ip, port, std::to_string(size).c_str(), "[FTP service]", lps.login, lps.pass, "Router FTP.", cp, "FTP"); + + stt->doEmitionFoundData(QString::fromLocal8Bit(logEmit)); + } + else if (strstr(lps.login, "Unknown protocol") != NULL) + { + strcat(log, "; [!] USER/PASS commands failed. Dunno what to do."); + fputsf(log, flag); + + stt->doEmitionFoundData(QString::fromLocal8Bit(log)); + }; } - else if (strstr(lps.other, "ROUTER") != NULL) - { - ++PieBA; - - sprintf(log, "[FTP]:%s:%d; Received: %dftp://%s:%s@%s [ROUTER]%s", - ip, port, size, lps.login, lps.pass, ip, lps.login, lps.pass, ip, ip, ps.headr); - sprintf(logEmit, "[FTP]:ftp://%s:%s@%s [ROUTER]", - lps.login, lps.pass, ip, lps.login, lps.pass, ip, ip); - - fputsf(log, flag); - - fillGlobalLogData(ip, port, std::to_string(size).c_str(), "[FTP service]", lps.login, lps.pass, "Router FTP.", cp, "FTP"); - - stt->doEmitionFoundData(QString::fromLocal8Bit(logEmit)); - } - else if (strstr(lps.login, "Unknown protocol") != NULL) - { - strcat(log, "; [!] USER/PASS commands failed. Dunno what to do."); - fputsf(log, flag); - - stt->doEmitionFoundData(QString::fromLocal8Bit(log)); - }; return; } diff --git a/mainResources.h b/mainResources.h index 076a1bc..ec12963 100644 --- a/mainResources.h +++ b/mainResources.h @@ -106,7 +106,9 @@ typedef int BOOL; #define NEGATIVE_FN PWD_LIST_FOLDER "negatives.txt" #define HTTP_FILE_STYLE "