This commit is contained in:
cora48 2015-03-13 17:27:21 +03:00
parent 633a081c28
commit a527c6d43c
9 changed files with 116 additions and 50 deletions

25
BasicAuth.cpp Normal file
View File

@ -0,0 +1,25 @@
#include <BasicAuth.h>
lopaStr BA::_BABrute(char *cookie,
char *ip,
int port,
char *pathT,
char *method)
{
}
lopaStr BA::_BALobby(char *cookie,
char *ip,
int port,
char *path,
char *method)
{
while(BrutingThrds >= gMaxBrutingThreads) Sleep(700);
BruteUtils::BConInc();
lopaStr res = _BABrute(cookie, ip, port, path, method);
BruteUtils::BConDec();
return res;
}

22
BasicAuth.h Normal file
View File

@ -0,0 +1,22 @@
#ifndef BASICAUTH_H
#define BASICAUTH_H
#include <BruteUtils.h>
#include <mainResources.h>
class BA : BruteUtils{
private:
lopaStr _BABrute(char *cookie,
char *ip,
int port,
char *pathT,
char *method);
lopaStr _BALobby(char *cookie,
char *ip,
int port,
char *path,
char *method);
};
#endif // BASICAUTH_H

35
BruteUtils.cpp Normal file
View File

@ -0,0 +1,35 @@
#include <BruteUtils.h>
#include "STh.h"
#include "externData.h"
void BruteUtils::BConInc()
{
#if defined(WIN32) || defined(_WIN32) || defined(__WIN32) && !defined(__CYGWIN__)
__asm
{
lock inc BrutingThrds;
};
#else
asm("lock incl BrutingThrds");
#endif
stt->doEmitionChangeBA(QString::number(BrutingThrds));
}
void BruteUtils::BConDec()
{
if(BrutingThrds > 0)
{
#if defined(WIN32) || defined(_WIN32) || defined(__WIN32) && !defined(__CYGWIN__)
__asm
{
lock dec BrutingThrds;
};
#else
asm("lock decl BrutingThrds");
#endif
}
stt->doEmitionChangeBA(QString::number(BrutingThrds));
}

11
BruteUtils.h Normal file
View File

@ -0,0 +1,11 @@
#ifndef BRUTEUTILS_H
#define BRUTEUTILS_H
class BruteUtils {
public:
static void BConInc();
static void BConDec();
};
#endif // BRUTEUTILS_H

View File

@ -173,7 +173,7 @@ int _EstablishSSHConnection(char *host, int port, std::string *buffer, const cha
char pass[32] = {0}; char pass[32] = {0};
char temp[64] = {0}; char temp[64] = {0};
isActive = 1; isActive = 1;
BConInc(); BruteUtils::BConInc();
int sz = 0; int sz = 0;
char *ptr1 = 0; char *ptr1 = 0;
int res = -1; int res = -1;
@ -192,19 +192,19 @@ int _EstablishSSHConnection(char *host, int port, std::string *buffer, const cha
if(res == 0) if(res == 0)
{ {
if(i == 0) return -2; //Failhit if(i == 0) return -2; //Failhit
BConDec(); BruteUtils::BConDec();
isActive = 0; isActive = 0;
return 1; return 1;
} }
else if(res == -2) else if(res == -2)
{ {
BConDec(); BruteUtils::BConDec();
isActive = 0; isActive = 0;
return -2; return -2;
}; };
Sleep(500); Sleep(500);
}; };
BConDec(); BruteUtils::BConDec();
isActive = 0; isActive = 0;
return -1; return -1;
} }

View File

@ -2,8 +2,9 @@
#define CONNECTOR_H #define CONNECTOR_H
#include <externData.h> #include <externData.h>
#include <STh.h>
#include <Utils.h> #include <Utils.h>
#include <BruteUtils.h>
#include "STh.h"
#if defined(WIN32) || defined(_WIN32) || defined(__WIN32) && !defined(__CYGWIN__) #if defined(WIN32) || defined(_WIN32) || defined(__WIN32) && !defined(__CYGWIN__)
#include <iphlpapi.h> #include <iphlpapi.h>

View File

@ -2,13 +2,13 @@
#define WEBFORMWORKER_H #define WEBFORMWORKER_H
#include <Utils.h> #include <Utils.h>
#include "STh.h"
#include "Connector.h" #include "Connector.h"
#include <mainResources.h> #include <mainResources.h>
#include <externData.h>
#include <externFunctions.h> #include <externFunctions.h>
#include <BruteUtils.h>
#include "STh.h"
class WFClass { class WFClass : BruteUtils {
private: static bool active; private: static bool active;
int passCounter = 1; int passCounter = 1;

View File

@ -1,5 +1,4 @@
#pragma once #include "STh.h"
#include "STh.h"
#include <libssh/libssh.h> #include <libssh/libssh.h>
#include <sstream> #include <sstream>
#include <openssl/md5.h> #include <openssl/md5.h>
@ -8,6 +7,7 @@
#include "externData.h" #include "externData.h"
#include <openssl/err.h> #include <openssl/err.h>
#include <Utils.h> #include <Utils.h>
#include <BruteUtils.h>
#if defined(WIN32) || defined(_WIN32) || defined(__WIN32) && !defined(__CYGWIN__) #if defined(WIN32) || defined(_WIN32) || defined(__WIN32) && !defined(__CYGWIN__)
#include <iphlpapi.h> #include <iphlpapi.h>
@ -30,38 +30,6 @@ int _countFTPDirectories(char *recvBuff){
return dirCounter; return dirCounter;
} }
void BConInc()
{
#if defined(WIN32) || defined(_WIN32) || defined(__WIN32) && !defined(__CYGWIN__)
__asm
{
lock inc BrutingThrds;
};
#else
asm("lock incl BrutingThrds");
#endif
stt->doEmitionChangeBA(QString::number(BrutingThrds));
}
void BConDec()
{
if(BrutingThrds > 0)
{
#if defined(WIN32) || defined(_WIN32) || defined(__WIN32) && !defined(__CYGWIN__)
__asm
{
lock dec BrutingThrds;
};
#else
asm("lock decl BrutingThrds");
#endif
}
stt->doEmitionChangeBA(QString::number(BrutingThrds));
}
bool debugWriteWait = false; bool debugWriteWait = false;
void _DebugWriteHTMLToFile(char *request, char *buff) void _DebugWriteHTMLToFile(char *request, char *buff)
{ {
@ -904,9 +872,9 @@ lopaStr _BALobby(char *cookie, char *ip, int port, char *path, char *method)
{ {
while(BrutingThrds >= gMaxBrutingThreads) Sleep(700); while(BrutingThrds >= gMaxBrutingThreads) Sleep(700);
BConInc(); BruteUtils::BConInc();
lopaStr res = _BABrute(cookie, ip, port, path, method); lopaStr res = _BABrute(cookie, ip, port, path, method);
BConDec(); BruteUtils::BConDec();
return res; return res;
} }
@ -1338,9 +1306,9 @@ lopaStr _FTPLobby(char *ip, int port, PathStr *ps)
ZeroMemory(lps.pass, sizeof(lps.pass)); ZeroMemory(lps.pass, sizeof(lps.pass));
ZeroMemory(lps.other, sizeof(lps.other)); ZeroMemory(lps.other, sizeof(lps.other));
BConInc(); BruteUtils::BConInc();
lps = _FTPBrute(ip, port, ps); lps = _FTPBrute(ip, port, ps);
BConDec(); BruteUtils::BConDec();
return lps; return lps;
} }
@ -1744,9 +1712,9 @@ lopaStr _IPCameraBLobby(char *ip, int port, char *SPEC)
{ {
while(BrutingThrds >= gMaxBrutingThreads) Sleep(1000); while(BrutingThrds >= gMaxBrutingThreads) Sleep(1000);
BConInc(); BruteUtils::BConInc();
lopaStr res = _IPCameraBrute(ip, port, SPEC); lopaStr res = _IPCameraBrute(ip, port, SPEC);
BConDec(); BruteUtils::BConDec();
return res; return res;
} }

View File

@ -40,7 +40,9 @@ SOURCES +=\
WebformWorker.cpp \ WebformWorker.cpp \
Connector.cpp \ Connector.cpp \
connector_old.cpp \ connector_old.cpp \
Utils.cpp Utils.cpp \
BruteUtils.cpp \
BasicAuth.cpp
HEADERS += ActivityDrawerTh_HorNet.h \ HEADERS += ActivityDrawerTh_HorNet.h \
@ -67,7 +69,9 @@ HEADERS += ActivityDrawerTh_HorNet.h \
vercheckerthread.h \ vercheckerthread.h \
Utils.h \ Utils.h \
WebformWorker.h \ WebformWorker.h \
Connector.h Connector.h \
BasicAuth.h \
BruteUtils.h
FORMS += nesca_3.ui FORMS += nesca_3.ui