From 892be9c934376156af0dc89542cdadfedc2d7c24 Mon Sep 17 00:00:00 2001 From: cora48 Date: Thu, 2 Apr 2015 15:33:49 +0300 Subject: [PATCH] Brute-disabling option added --- BasicAuth.cpp | 16 +++++++++++----- FTPAuth.cpp | 15 ++++++++++----- SSHAuth.cpp | 23 ++++++++++++++--------- WebformWorker.h | 11 ++++++----- connector_old.cpp | 21 +++++++++++++-------- nesca_startModule.cpp | 2 +- 6 files changed, 55 insertions(+), 33 deletions(-) diff --git a/BasicAuth.cpp b/BasicAuth.cpp index 324db34..ff5ae80 100644 --- a/BasicAuth.cpp +++ b/BasicAuth.cpp @@ -68,11 +68,17 @@ lopaStr BA::BABrute(const char *ip, const int port) { } lopaStr BA::BALobby(const char *ip, const int port) { - while(BrutingThrds >= gMaxBrutingThreads) Sleep(1000); + if(gMaxBrutingThreads > 0) { - BruteUtils::BConInc(); - const lopaStr &lps = BABrute(ip, port); - BruteUtils::BConDec(); + while(BrutingThrds >= gMaxBrutingThreads) Sleep(1000); - return lps; + BruteUtils::BConInc(); + const lopaStr &lps = BABrute(ip, port); + BruteUtils::BConDec(); + + return lps; + } else { + lopaStr lps; + return lps; + } } diff --git a/FTPAuth.cpp b/FTPAuth.cpp index 4a7299d..745db33 100644 --- a/FTPAuth.cpp +++ b/FTPAuth.cpp @@ -65,11 +65,16 @@ lopaStr FTPA::FTPBrute(const char *ip, const int port, PathStr *ps) { } lopaStr FTPA::FTPLobby(const char *ip, const int port, PathStr *ps) { - while(BrutingThrds >= gMaxBrutingThreads) Sleep(1000); + if(gMaxBrutingThreads > 0) { + while(BrutingThrds >= gMaxBrutingThreads) Sleep(1000); - BruteUtils::BConInc(); - const lopaStr &lps = FTPBrute(ip, port, ps); - BruteUtils::BConDec(); + BruteUtils::BConInc(); + const lopaStr &lps = FTPBrute(ip, port, ps); + BruteUtils::BConDec(); - return lps; + return lps; + } else { + lopaStr lps; + return lps; + } } diff --git a/SSHAuth.cpp b/SSHAuth.cpp index cb73e13..c01051d 100644 --- a/SSHAuth.cpp +++ b/SSHAuth.cpp @@ -171,13 +171,18 @@ QString strIP; QString strPort; int SSHAuth::SSHLobby(const char *ip, int port, std::string *buffer) { - const char &banner = _get_ssh_banner(ip, port); - if(strlen(&banner) > 0) - { - BruteUtils::BConInc(); - int res = SSHBrute(ip, port, buffer, &banner); - BruteUtils::BConDec(); - return res; - }; - return -1; + if(gMaxBrutingThreads > 0) { + + while(BrutingThrds >= gMaxBrutingThreads) Sleep(1000); + + const char &banner = _get_ssh_banner(ip, port); + if(strlen(&banner) > 0) + { + BruteUtils::BConInc(); + int res = SSHBrute(ip, port, buffer, &banner); + BruteUtils::BConDec(); + return res; + }; + return -1; + } else return -1; } diff --git a/WebformWorker.h b/WebformWorker.h index 3b7157f..6e2fdde 100644 --- a/WebformWorker.h +++ b/WebformWorker.h @@ -21,12 +21,13 @@ private: public: WFClass(){ + if(gMaxBrutingThreads > 0) { + while(BrutingThrds >= gMaxBrutingThreads) Sleep(700); - while(BrutingThrds >= gMaxBrutingThreads) Sleep(700); - - ++WF; - BConInc(); - passCounter = 1; + ++WF; + BConInc(); + passCounter = 1; + } } ~WFClass(){ diff --git a/connector_old.cpp b/connector_old.cpp index ca8b708..1d83626 100644 --- a/connector_old.cpp +++ b/connector_old.cpp @@ -256,8 +256,8 @@ lopaStr _IPCameraBrute(const char *ip, int port, char *SPEC) if(res == 1) { - strcpy(lps.login, loginLst[i]); - strcpy(lps.pass, passLst[j]); + strcpy(lps.login, login); + strcpy(lps.pass, pass); return lps; } else if(res == -1) @@ -275,11 +275,16 @@ lopaStr _IPCameraBrute(const char *ip, int port, char *SPEC) lopaStr _IPCameraBLobby(const char *ip, int port, char *SPEC) { - while(BrutingThrds >= gMaxBrutingThreads) Sleep(1000); + if(gMaxBrutingThreads > 0) { + while(BrutingThrds >= gMaxBrutingThreads) Sleep(1000); - BruteUtils::BConInc(); - lopaStr res = _IPCameraBrute(ip, port, SPEC); - BruteUtils::BConDec(); - - return res; + BruteUtils::BConInc(); + lopaStr lps = _IPCameraBrute(ip, port, SPEC); + BruteUtils::BConDec(); + + return lps; + } else { + lopaStr lps; + return lps; + } } diff --git a/nesca_startModule.cpp b/nesca_startModule.cpp index 5811326..a172b64 100644 --- a/nesca_startModule.cpp +++ b/nesca_startModule.cpp @@ -28,7 +28,7 @@ int ipsstart[4], ipsend[4], overallPorts, flCounter, octet[4]; int BA = 0; int gPingTimeout = 1; -int gMaxBrutingThreads = 200; +int gMaxBrutingThreads = 50; unsigned int Activity = 0; unsigned char **ipsstartfl = NULL, **ipsendfl = NULL, **starterIP = NULL;