Partial refactoring of filter and neg-file module.

This commit is contained in:
cora32 2015-04-16 14:51:51 +03:00
parent 2f26648d48
commit ad71357008
33 changed files with 482 additions and 734 deletions

View File

@ -2,24 +2,24 @@
#include "FileUpdater.h" #include "FileUpdater.h"
bool BA::checkOutput(const string *buffer, const char *ip, const int port) { bool BA::checkOutput(const string *buffer, const char *ip, const int port) {
if((Utils::ci_find_substr(*buffer, "200 ok") != -1 || if((Utils::ustrstr(*buffer, "200 ok") != -1 ||
Utils::ci_find_substr(*buffer, "http/1.0 200") != -1 || Utils::ustrstr(*buffer, "http/1.0 200") != -1 ||
Utils::ci_find_substr(*buffer, "http/1.1 200") != -1) Utils::ustrstr(*buffer, "http/1.1 200") != -1)
&& Utils::ci_find_substr(*buffer, "http/1.1 401 ") == -1 && Utils::ustrstr(*buffer, "http/1.1 401 ") == -1
&& Utils::ci_find_substr(*buffer, "http/1.0 401 ") == -1 && Utils::ustrstr(*buffer, "http/1.0 401 ") == -1
&& Utils::ci_find_substr(*buffer, "<statusValue>401</statusValue>") == -1 && Utils::ustrstr(*buffer, "<statusValue>401</statusValue>") == -1
&& Utils::ci_find_substr(*buffer, "<statusString>Unauthorized</statusString>") == -1 && Utils::ustrstr(*buffer, "<statusString>Unauthorized</statusString>") == -1
&& Utils::ci_find_substr(*buffer, "íåïðàâèëüíû") == -1 && Utils::ustrstr(*buffer, "íåïðàâèëüíû") == -1
&& Utils::ci_find_substr(*buffer, "Ð<EFBFBD>еправильнÑ") == -1 && Utils::ustrstr(*buffer, "Ð<EFBFBD>еправильнÑ") == -1
) { ) {
return true; return true;
} }
else if (Utils::ci_find_substr(*buffer, "503 service unavailable") != -1 else if (Utils::ustrstr(*buffer, "503 service unavailable") != -1
|| Utils::ci_find_substr(*buffer, "http/1.1 503") != -1 || Utils::ustrstr(*buffer, "http/1.1 503") != -1
|| Utils::ci_find_substr(*buffer, "http/1.0 503") != -1 || Utils::ustrstr(*buffer, "http/1.0 503") != -1
|| Utils::ci_find_substr(*buffer, "400 BAD_REQUEST") != -1 || Utils::ustrstr(*buffer, "400 BAD_REQUEST") != -1
|| Utils::ci_find_substr(*buffer, "400 bad request") != -1 || Utils::ustrstr(*buffer, "400 bad request") != -1
|| Utils::ci_find_substr(*buffer, "403 Forbidden") != -1 || Utils::ustrstr(*buffer, "403 Forbidden") != -1
) )
{ {
stt->doEmition_BARedData("[.] 503/400/403 - Waiting 30sec (" + QString(ip) + ":" + QString::number(port) + ")"); stt->doEmition_BARedData("[.] 503/400/403 - Waiting 30sec (" + QString(ip) + ":" + QString::number(port) + ")");

View File

@ -65,22 +65,23 @@ int KeyCheckerMain()
Connector::nConnect((url + std::string("/api/checkaccount?key=") + std::string(trcPersKey)).c_str(), Connector::nConnect((url + std::string("/api/checkaccount?key=") + std::string(trcPersKey)).c_str(),
std::stoi(trcSrvPortLine), &buffer, NULL, &headerVector); std::stoi(trcSrvPortLine), &buffer, NULL, &headerVector);
if(Utils::ci_find_substr(buffer, std::string("202 Accepted")) != -1) { if(Utils::ustrstr(buffer, std::string("202 Accepted")) != -1) {
stt->doEmitionGreenFoundData("Key is valid."); stt->doEmitionGreenFoundData("Key is valid.");
if(emitIfOK == 0) stt->doEmitionStartScanIP(); if(emitIfOK == 0) stt->doEmitionStartScanIP();
else if(emitIfOK == 1) stt->doEmitionStartScanDNS(); else if(emitIfOK == 1) stt->doEmitionStartScanDNS();
else if(emitIfOK == 2) stt->doEmitionStartScanImport(); else if(emitIfOK == 2) stt->doEmitionStartScanImport();
return 1; return 1;
} else if(Utils::ci_find_substr(buffer, std::string("400 Bad Request")) != -1) { } else if(Utils::ustrstr(buffer, std::string("400 Bad Request")) != -1) {
QString errorDef = GetNSErrorDefinition(buffer.c_str(), "notify"); QString errorDef = Utils::GetNSErrorDefinition(buffer.c_str(), "notify");
if(errorDef == "Invalid access key") stt->doEmitionYellowFoundData("[NS-Track] Key is unauthorized. A valid key is required."); if(errorDef == "Invalid access key") stt->doEmitionYellowFoundData("[NS-Track] Key is unauthorized. A valid key is required.");
else stt->doEmitionYellowFoundData("[Key check] -FAIL! [400 Bad Request : " + GetNSErrorDefinition(buffer.c_str(), "notify") + "]"); else stt->doEmitionYellowFoundData("[Key check] FAIL! [400 Bad Request : " +
} else if(Utils::ci_find_substr(buffer, std::string("503 Bad Gateway")) != -1) { Utils::GetNSErrorDefinition(buffer.c_str(), "notify") + "]");
} else if(Utils::ustrstr(buffer, std::string("503 Bad Gateway")) != -1) {
stt->doEmitionYellowFoundData("[Key check] 503 Backend not responding!"); stt->doEmitionYellowFoundData("[Key check] 503 Backend not responding!");
} else { } else {
char header[64] = {0}; char header[64] = {0};
getSubStrEx(buffer.c_str(), "http/1.1 ", "\r\n", header, 64); getSubStrEx(buffer.c_str(), "http/1.1 ", "\r\n", header, 64);
stt->doEmitionRedFoundData("[Key check] -FAIL! An error occured. (" + QString::number(WSAGetLastError()) + ") Header: <u>" + QString::fromLocal8Bit(header) + "</u>"); stt->doEmitionRedFoundData("[Key check] FAIL! An error occured. (" + QString::number(WSAGetLastError()) + ") Header: <u>" + QString::fromLocal8Bit(header) + "</u>");
if(gDebugMode) stt->doEmitionDebugFoundData(QString(buffer.c_str())); if(gDebugMode) stt->doEmitionDebugFoundData(QString(buffer.c_str()));
}; };
} else { } else {

View File

@ -237,10 +237,7 @@ int Connector::_ConnectToPort(char* ip, int port)
{ {
if(gPingNScan) if(gPingNScan)
{ {
if(_pingMyTarget(ip) == 0) if(_pingMyTarget(ip) == 0) return -2;
{
return -2;
};
}; };
std::string buffer; std::string buffer;
@ -254,7 +251,13 @@ int Connector::_ConnectToPort(char* ip, int port)
++Alive;//ME2 ++Alive;//ME2
++found;//PieStat ++found;//PieStat
Lexems lx; Lexems lx;
lx._filler(port, buffer.c_str(), ip, size, &lx); lx._filler(port, buffer, ip, size, &lx);
//if (Filter::negativeFilter(&buffer)) {
// if (Filter::resultFilter(&buffer)) {
// saveNode();
// }
//}
} }
else if (size == -2) return -2; else if (size == -2) return -2;
return 0; return 0;

View File

@ -121,7 +121,7 @@ int MakePolygonLine(int gWidth)
AnomC1 = 0; AnomC1 = 0;
WF = 0; WF = 0;
baCount = 0; baCount = 0;
Filt = 0; filtered = 0;
Overl = 0; Overl = 0;
Lowl = 0; Lowl = 0;
Alive = 0; Alive = 0;
@ -151,7 +151,7 @@ void DrawerTh_ME2Scanner::run()
AnomC1 = 0; AnomC1 = 0;
WF = 0; WF = 0;
baCount = 0; baCount = 0;
Filt = 0; filtered = 0;
Overl = 0; Overl = 0;
Lowl = 0; Lowl = 0;
Alive = 0; Alive = 0;

View File

@ -2,6 +2,8 @@
#include "STh.h" #include "STh.h"
#include "externData.h" #include "externData.h"
int DrawerTh_QoSScanner::MaxDataVal = 1;
void DrawerTh_QoSScanner::run() void DrawerTh_QoSScanner::run()
{ {
while(QoSScanFlag) while(QoSScanFlag)
@ -30,7 +32,7 @@ void DrawerTh_QoSScanner::run()
AnomC1 = 0; AnomC1 = 0;
WF = 0; WF = 0;
baCount = 0; baCount = 0;
Filt = 0; filtered = 0;
Overl = 0; Overl = 0;
Lowl = 0; Lowl = 0;
Alive = 0; Alive = 0;
@ -41,7 +43,7 @@ void DrawerTh_QoSScanner::run()
AnomC1 = 0; AnomC1 = 0;
WF = 0; WF = 0;
baCount = 0; baCount = 0;
Filt = 0; filtered = 0;
Overl = 0; Overl = 0;
Lowl = 0; Lowl = 0;
Alive = 0; Alive = 0;

View File

@ -8,6 +8,8 @@ class DrawerTh_QoSScanner : public QThread
{ {
Q_OBJECT Q_OBJECT
public:
static int MaxDataVal;
public: public:
static void doEmitionAddLine(); static void doEmitionAddLine();

View File

@ -108,7 +108,7 @@ void DrawerTh_VoiceScanner::run()
Alive = 0; Alive = 0;
AnomC1 = 0; AnomC1 = 0;
WF = 0; WF = 0;
Filt = 0; filtered = 0;
Lowl = 0; Lowl = 0;
baCount = 0; baCount = 0;
Overl = 0; Overl = 0;
@ -124,7 +124,7 @@ void DrawerTh_VoiceScanner::run()
Alive = 0; Alive = 0;
AnomC1 = 0; AnomC1 = 0;
WF = 0; WF = 0;
Filt = 0; filtered = 0;
Lowl = 0; Lowl = 0;
baCount = 0; baCount = 0;
Overl = 0; Overl = 0;

View File

@ -2,7 +2,7 @@
#include "FileUpdater.h" #include "FileUpdater.h"
bool FTPA::checkOutput(const string *buffer) { bool FTPA::checkOutput(const string *buffer) {
if(Utils::ci_find_substr(*buffer, "230") != -1) { if(Utils::ustrstr(*buffer, "230") != -1) {
return true; return true;
} }

View File

@ -10,135 +10,22 @@ long FileUpdater::oldPassLstSize = 0;
long FileUpdater::oldSSHLstSize = 0; long FileUpdater::oldSSHLstSize = 0;
long FileUpdater::oldWFLoginLstSize = 0; long FileUpdater::oldWFLoginLstSize = 0;
long FileUpdater::oldWFPassLstSize = 0; long FileUpdater::oldWFPassLstSize = 0;
int FileUpdater::gNegativeSize = 0;
std::mutex FileUpdater::filesUpdatingMutex; std::mutex FileUpdater::filesUpdatingMutex;
std::condition_variable FileUpdater::cv; std::condition_variable FileUpdater::cv;
bool FileUpdater::ready = false; bool FileUpdater::ready = false;
std::unique_lock<std::mutex> FileUpdater::lk; std::unique_lock<std::mutex> FileUpdater::lk;
std::vector<std::string> FileUpdater::negativeVector;
void ReadUTF8(FILE* nFile, char *cp) {
char buffFG[256] = {0};
int i = 0;
GlobalNegativeSize = 0;
if(nFile != NULL)
{
while(fgets((char*)buffFG, sizeof(buffFG), nFile) != NULL)
{
if(buffFG[0] != '#' && buffFG[0] != ' ' && buffFG[0] != '\n' && buffFG[0] != '\r' && strcmp(buffFG, "") != 0 &&
((buffFG[0] == '/' && buffFG[1] == '/') == false) && ((buffFG[0] == '\t' && buffFG[1] == '\t' && buffFG[2] == '\t' && (buffFG[3] == 13 || buffFG[3] == 10 || buffFG[3] == '#')) == false)
&& (buffFG[0] == '\t' && buffFG[1] == '\t' && buffFG[2] == '\t' && (buffFG[3] == '/' && buffFG[4] == '/')) == false)
{
++GlobalNegativeSize;
}
ZeroMemory(buffFG, sizeof(buffFG));
};
rewind(nFile);
if(strcmp(cp, "UTF") == 0) fseek(nFile, 3, 0);
GlobalNegatives = new char*[GlobalNegativeSize + 2];
while(fgets(buffFG, sizeof(buffFG), nFile) != NULL)
{
if(buffFG[0] == '#' || buffFG[0] == ' ' || buffFG[0] == '\n' || buffFG[0] == '\r' || strcmp(buffFG, "") == 0 ||
(buffFG[0] == '/' && buffFG[1] == '/'))
{
ZeroMemory(buffFG, sizeof(buffFG));
continue;
};
if(buffFG[0] == '\t' && buffFG[1] == '\t' && buffFG[2] == '\t')
{
char buffFGT[256] = {0};
strcpy(buffFGT, buffFG);
char *ptr1 = strstr(buffFGT, "\t\t\t");
ZeroMemory(buffFG, sizeof(buffFG));
strcpy(buffFG, ptr1 + 3);
};
int bSz = strlen(buffFG);
if((bSz == 2 && buffFG[0] == 13 && buffFG[1] == 10) || (bSz == 1 && (buffFG[0] == 13 || buffFG[0] == 10)))
{
ZeroMemory(buffFG, sizeof(buffFG));
continue;
};
if(buffFG[bSz] == 13 || buffFG[bSz] == 10)
{
buffFG[bSz] = '\0';
};
if(buffFG[bSz - 1] == 13 || buffFG[bSz - 1] == 10)
{
buffFG[bSz - 1] = '\0';
};
if(buffFG[bSz - 2] == 13 || buffFG[bSz - 2] == 10)
{
buffFG[bSz - 2] = '\0';
};
if(strstr((char*)buffFG, "\n") != 0)
{
std::string res = std::string(buffFG);
int sz = res.size();
GlobalNegatives[i] = new char[sz + 1];
ZeroMemory(GlobalNegatives[i], sizeof(*GlobalNegatives[i]));
memcpy(GlobalNegatives[i], toLowerStr(res.c_str()).c_str(), sz - 1);
memset(GlobalNegatives[i] + sz - 1, '\0', 1);
++i;
}
else
{
std::string res = std::string(buffFG);
int sz = res.size();
GlobalNegatives[i] = new char[sz + 1];
ZeroMemory(GlobalNegatives[i], sizeof(*GlobalNegatives[i]));
memcpy(GlobalNegatives[i], toLowerStr(res.c_str()).c_str(), sz);
memset(GlobalNegatives[i] + sz, '\0', 1);
++i;
};
ZeroMemory(buffFG, sizeof(buffFG));
};
if(FileUpdater::oldNegLstSize == 0) stt->doEmitionGreenFoundData("Negative list loaded (" + QString::number(GlobalNegativeSize) + " entries)");
else stt->doEmitionFoundData("<font color=\"Pink\">Negative list updated (" + QString::number(GlobalNegativeSize) + " entries)</font>");
ZeroMemory(buffFG, sizeof(buffFG));
fclose(nFile);
}
else
{
stt->doEmitionRedFoundData("No negative list found");
stt->doEmitionKillSttThread();
};
}
void negativeLoader() { void negativeLoader() {
FILE *nFile = fopen("negatives.txt", "rb, ccs=UTF-8"); std::ifstream file("negatives.txt");
std::string line;
if( nFile != NULL) while (std::getline(file, line)) FileUpdater::negativeVector.push_back(line);
{
unsigned char b[3] = {0};
fread(b,1,2, nFile);
if( b[0] == 0xEF && b[1] == 0xBB)
{
fread(b,1,1,nFile); // 0xBF
ReadUTF8(nFile, "UTF");
}
else
{
rewind(nFile);
ReadUTF8(nFile, "1251");
};
}
} }
void updateNegatives() { void updateNegatives() {
if(GlobalNegatives != NULL) FileUpdater::negativeVector.clear();
{
for(int i = 0; i < GlobalNegativeSize; ++i) delete []GlobalNegatives[i];
delete []GlobalNegatives;
GlobalNegatives = NULL;
};
negativeLoader(); negativeLoader();
} }
void updateLogin() { void updateLogin() {

View File

@ -4,8 +4,7 @@
#include <fstream> #include <fstream>
#include <mutex> #include <mutex>
#include <condition_variable> #include <condition_variable>
#include "externData.h" #include <vector>
#include "externFunctions.h"
class FileUpdater { class FileUpdater {
public: public:
@ -20,6 +19,8 @@ public:
static std::condition_variable cv; static std::condition_variable cv;
static std::mutex filesUpdatingMutex; static std::mutex filesUpdatingMutex;
static std::unique_lock<std::mutex> lk; static std::unique_lock<std::mutex> lk;
static int gNegativeSize;
static std::vector<std::string> negativeVector;
public: public:
static void updateLists(); static void updateLists();

5
Filter.cpp Normal file
View File

@ -0,0 +1,5 @@
#include "Filter.h"
bool Filter::resultFilter() {
return false;
}

9
Filter.h Normal file
View File

@ -0,0 +1,9 @@
#ifndef MAINSTARTER_H
#define MAINSTARTER_H
class Filter {
public:
bool resultFilter();
};
#endif // MAINSTARTER_H

View File

@ -147,7 +147,7 @@ lopaStr IPC::IPCBrute(const char *ip, int port, char *SPEC)
else if (res != -1) { else if (res != -1) {
for (int i = 0; i < negVector.size(); ++i) for (int i = 0; i < negVector.size(); ++i)
{ {
if (Utils::ci_find_substr(buffer, negVector[i]) != -1) if (Utils::ustrstr(buffer, negVector[i]) != -1)
{ {
result = false; result = false;
break; break;

View File

@ -2,9 +2,36 @@
#include "MainStarter.h" #include "MainStarter.h"
#include "Connector.h" #include "Connector.h"
#include <sstream> #include <sstream>
#include "Utils.h"
#include <qjsonobject.h>
#include <qjsonvalue.h>
#include <qjsonarray.h>
#include <qjsondocument.h>
int gTimeOut = 3;
int gPingTimeout = 1;
int gMode;
int PieAnomC1 = 0, PieBA = 0, PieSusp = 0, PieLowl = 0, PieWF = 0, PieSSH = 0;
int AnomC1 = 0, filtered = 0, Overl = 0, Lowl = 0, Alive = 0, saved = 0, Susp = 0, WF = 0, ssh = 0;
int found = 0, indexIP = 0;
int MaxPass = 0, MaxLogin = 0, MaxTags = 0, MaxWFLogin = 0, MaxWFPass = 0, MaxSSHPass = 0;
int baCount = 0;
int gMaxBrutingThreads = 50;
unsigned int Activity = 0;
char **loginLst, **passLst;
char **wfLoginLst, **wfPassLst;
char **sshlpLst;
char gTLD[128] = { 0 };
char gPorts[65536] = { 0 };
char currentIP[MAX_ADDR_LEN] = { 0 };
char finalIP[32] = { 0 };
bool gPingNScan = false;
std::atomic<int> cons = 0, BrutingThrds = 0, gThreads;
std::vector<int> MainStarter::portVector; std::vector<int> MainStarter::portVector;
int MainStarter::flCounter = 0; int MainStarter::flCounter = 0;
bool MainStarter::savingBackUpFile = false;
QJsonArray *jsonArr = new QJsonArray(); QJsonArray *jsonArr = new QJsonArray();
@ -331,7 +358,7 @@ int MainStarter::loadTargets(const char *data) {
ipsendfl[0], ipsendfl[1], ipsendfl[2], ipsendfl[3]); ipsendfl[0], ipsendfl[1], ipsendfl[2], ipsendfl[3]);
} }
if (ip1 > ip2) { if (gMode != 1 && ip1 > ip2) {
stt->doEmitionRedFoundData("Malformed input: check your range"); stt->doEmitionRedFoundData("Malformed input: check your range");
return -1; return -1;
} }
@ -461,7 +488,7 @@ void MainStarter::saveBackupToFile()
strcat(saveBuffer, saveStr); strcat(saveBuffer, saveStr);
ZeroMemory(saveStr, sizeof(saveStr)); ZeroMemory(saveStr, sizeof(saveStr));
sprintf(saveStr, "[THREAD_DELAY]: %d\n", gThreadDelay); sprintf(saveStr, "[THREAD_DELAY]: %d\n", Threader::gThreadDelay);
strcat(saveBuffer, saveStr); strcat(saveBuffer, saveStr);
ZeroMemory(saveStr, sizeof(saveStr)); ZeroMemory(saveStr, sizeof(saveStr));
@ -487,17 +514,20 @@ void MainStarter::saveBackupToFile()
strcat(saveBuffer, saveStr); strcat(saveBuffer, saveStr);
ZeroMemory(saveStr, sizeof(saveStr)); ZeroMemory(saveStr, sizeof(saveStr));
FILE *savingFile = fopen("restore", "w"); std::string finalSaveStr(saveBuffer);
std::ofstream file("restore");
file << finalSaveStr;
ZeroMemory(saveBuffer, strlen(saveBuffer));
/*FILE *savingFile = fopen("restore", "w");
if (savingFile != NULL) if (savingFile != NULL)
{ {
fputs(saveBuffer, savingFile); fputs(saveBuffer, savingFile);
fclose(savingFile); fclose(savingFile);
} }
else stt->doEmitionRedFoundData("[_saver] Cannot open file."); else stt->doEmitionRedFoundData("[_saver] Cannot open file.");*/
ZeroMemory(saveStr, strlen(saveStr));
ZeroMemory(saveBuffer, strlen(saveBuffer));
} }
bool saverRunning = false; bool saverRunning = false;
@ -507,9 +537,9 @@ void MainStarter::saver()
Sleep(1000); Sleep(1000);
while (globalScanFlag) while (globalScanFlag)
{ {
__savingBackUpFile = true; savingBackUpFile = true;
saveBackupToFile(); saveBackupToFile();
__savingBackUpFile = false; savingBackUpFile = false;
Sleep(10000); Sleep(10000);
}; };
saverRunning = false; saverRunning = false;
@ -714,7 +744,7 @@ void _tracker() {
jsonMeta.insert("speed", QJsonValue(QString(metaIPS))); jsonMeta.insert("speed", QJsonValue(QString(metaIPS)));
jsonMeta.insert("eta", QJsonValue(QString(metaETA))); jsonMeta.insert("eta", QJsonValue(QString(metaETA)));
jsonMeta.insert("threads", QJsonValue(QString::number(cons) + "/" + QString::number(gThreads))); jsonMeta.insert("threads", QJsonValue(QString::number(cons) + "/" + QString::number(gThreads)));
jsonMeta.insert("bads", QJsonValue(QString::number(offlines))); jsonMeta.insert("bads", QJsonValue("-1"));
jsonMeta.insert("version", QJsonValue(QString(gVER))); jsonMeta.insert("version", QJsonValue(QString(gVER)));
jsonArr->push_front(QJsonValue(jsonMeta)); jsonArr->push_front(QJsonValue(jsonMeta));
@ -770,7 +800,8 @@ void _tracker() {
CSSOCKET(sock); CSSOCKET(sock);
stt->doEmitionRedFoundData("[NS-Track] -connect() returned " + QString::number(WSAGetLastError()) + "."); stt->doEmitionRedFoundData("[NS-Track] connect() returned " +
QString::number(WSAGetLastError()) + ".");
continue; continue;
}; };
@ -786,7 +817,8 @@ void _tracker() {
{ {
CSSOCKET(sock); CSSOCKET(sock);
stt->doEmitionRedFoundData("[NS-Track] -send() returned " + QString::number(WSAGetLastError()) + "."); stt->doEmitionRedFoundData("[NS-Track] send() returned " +
QString::number(WSAGetLastError()) + ".");
continue; continue;
}; };
@ -814,7 +846,7 @@ void _tracker() {
if (strlen(rBuffT) > 200000) if (strlen(rBuffT) > 200000)
{ {
stt->doEmitionRedFoundData("[NS-Track] (Inner) -Large error received from server (>200000b) " + stt->doEmitionRedFoundData("[NS-Track] (Inner) Large error received from server (>200000b) " +
QString::number(WSAGetLastError()) + "."); QString::number(WSAGetLastError()) + ".");
break; break;
}; };
@ -830,7 +862,7 @@ void _tracker() {
{ {
CSSOCKET(sock); CSSOCKET(sock);
stt->doEmitionRedFoundData("[NS-Track] -recv() returned " + QString::number(WSAGetLastError()) + "."); stt->doEmitionRedFoundData("[NS-Track] recv() returned " + QString::number(WSAGetLastError()) + ".");
continue; continue;
}; };
@ -838,7 +870,7 @@ void _tracker() {
if (strstr(rBuffT, "201 Created") != NULL) if (strstr(rBuffT, "201 Created") != NULL)
{ {
if (gDebugMode) stt->doEmitionYellowFoundData("[NS-Track] -OK. Data saved!"); if (gDebugMode) stt->doEmitionYellowFoundData("[NS-Track] OK. Data saved!");
stt->doEmitionDataSaved(true); stt->doEmitionDataSaved(true);
Sleep(1000); Sleep(1000);
stt->doEmitionDataSaved(false); stt->doEmitionDataSaved(false);
@ -846,15 +878,14 @@ void _tracker() {
} }
else if (strstr(rBuffT, "400 Bad Request") != NULL) else if (strstr(rBuffT, "400 Bad Request") != NULL)
{ {
QString errorDef = Utils::GetNSErrorDefinition(rBuffT, "notify");
QString errorDef = GetNSErrorDefinition(rBuffT, "notify");
if (errorDef == "Invalid access key") stt->doEmitionYellowFoundData("[NS-Track] [Key is unauthorized] A valid key is required."); if (errorDef == "Invalid access key") stt->doEmitionYellowFoundData("[NS-Track] [Key is unauthorized] A valid key is required.");
else stt->doEmitionYellowFoundData("[NS-Track] -FAIL! [400 Bad Request : " + errorDef + "]"); else stt->doEmitionYellowFoundData("[NS-Track] FAIL! [400 Bad Request : " + errorDef + "]");
} }
else else
{ {
stt->doEmitionYellowFoundData("[NS-Track] -FAIL! An error occured [" + QString(msgR) + "]"); stt->doEmitionYellowFoundData("[NS-Track] FAIL! An error occured [" + QString(msgR) + "]");
}; };
ZeroMemory(msgR, sizeof(msgR)); ZeroMemory(msgR, sizeof(msgR));
@ -874,7 +905,7 @@ void _tracker() {
} }
else else
{ {
stt->doEmitionRedFoundData("[NS-Track] -Balancer replied with invalid string."); stt->doEmitionRedFoundData("[NS-Track] Balancer replied with invalid string.");
}; };
CSSOCKET(sock); CSSOCKET(sock);

View File

@ -24,18 +24,15 @@ private:
public: public:
static std::vector<int> portVector; static std::vector<int> portVector;
static int flCounter; static int flCounter;
static bool savingBackUpFile;
public: public:
MainStarter(short mode, MainStarter(const char* targets, const char* ports)
const char* targets,
const char* ports,
const char* tld = nullptr
)
{ {
horLineFlag = false; horLineFlag = false;
PieAnomC1 = 0, PieWF = 0, PieBA = 0, PieSusp = 0, PieLowl = 0, PieSSH = 0; PieAnomC1 = 0, PieWF = 0, PieBA = 0, PieSusp = 0, PieLowl = 0, PieSSH = 0;
AnomC1 = 0, baCount = 0, Filt = 0, Overl = 0, Lowl = 0, Alive = 0, Activity = 0, saved = 0, Susp = 0, AnomC1 = 0, baCount = 0, filtered = 0, Overl = 0, Lowl = 0, Alive = 0, Activity = 0, saved = 0, Susp = 0,
WF = 0, offlines = 0; WF = 0;
BrutingThrds = 0; BrutingThrds = 0;
found = 0; found = 0;
gTargets = 0; gTargets = 0;
@ -68,8 +65,9 @@ public:
Threader::cleanUp(); Threader::cleanUp();
curl_global_cleanup(); curl_global_cleanup();
while (__savingBackUpFile) Sleep(100); while (savingBackUpFile) Sleep(100);
FileUpdater::negativeVector.clear();
if (loginLst != NULL) if (loginLst != NULL)
{ {
for (int i = 0; i < MaxLogin; ++i) delete[]loginLst[i]; for (int i = 0; i < MaxLogin; ++i) delete[]loginLst[i];
@ -82,12 +80,6 @@ public:
delete[]passLst; delete[]passLst;
passLst = NULL; passLst = NULL;
}; };
if (GlobalNegatives != NULL)
{
for (int i = 0; i < GlobalNegativeSize; ++i) delete[]GlobalNegatives[i];
delete[]GlobalNegatives;
GlobalNegatives = NULL;
};
if (wfPassLst != NULL) if (wfPassLst != NULL)
{ {
for (int i = 0; i < MaxWFPass; ++i) delete[]wfPassLst[i]; for (int i = 0; i < MaxWFPass; ++i) delete[]wfPassLst[i];

View File

@ -63,7 +63,6 @@ int _sshConnect(const char *user, const char *pass, const char *host, int port)
ssh_disconnect(ssh_session); ssh_disconnect(ssh_session);
ssh_free(ssh_session); ssh_free(ssh_session);
curl_easy_cleanup(curl); curl_easy_cleanup(curl);
++offlines;
return -2; return -2;
} }
else else

View File

@ -85,8 +85,7 @@ void STh::setPorts(QString ports) {
} }
void STh::run() void STh::run()
{ {
MainStarter ms(gMode, MainStarter ms(this->target.toLocal8Bit().data(),
this->target.toLocal8Bit().data(),
this->ports.toLocal8Bit().data() this->ports.toLocal8Bit().data()
); );
ms.start(); ms.start();

View File

@ -1,5 +1,6 @@
#include "Threader.h" #include "Threader.h"
int Threader::gThreadDelay = 10;
int Threader::threadId = 0; int Threader::threadId = 0;
std::mutex Threader::m; std::mutex Threader::m;
bool Threader::ready = false; bool Threader::ready = false;
@ -27,6 +28,7 @@ void Threader::cleanUp() {
std::unique_lock<std::mutex> lk(m); std::unique_lock<std::mutex> lk(m);
lk.unlock(); lk.unlock();
lk.release(); lk.release();
Sleep(1500);
threadId = 0; threadId = 0;
std::queue<std::string> empty = {}; std::queue<std::string> empty = {};
std::swap(ipQueue, empty); std::swap(ipQueue, empty);

View File

@ -16,6 +16,7 @@ public:
static bool ready; static bool ready;
static std::condition_variable cv; static std::condition_variable cv;
static std::queue<std::string> ipQueue; static std::queue<std::string> ipQueue;
static int gThreadDelay;
public: public:
static void fireThread(std::string ip, void *func(void)); static void fireThread(std::string ip, void *func(void));

23
Utils.h
View File

@ -3,6 +3,7 @@
#include <iostream> #include <iostream>
#include <algorithm> #include <algorithm>
#include <qstring.h>
using namespace std; using namespace std;
@ -23,7 +24,7 @@ private:
class Utils { class Utils {
public: public:
// find substring (case insensitive) // find substring (case insensitive)
template<typename T> static int ci_find_substr(const T& str1, template<typename T> static int ustrstr(const T& str1,
const T& str2, const T& str2,
const locale& loc = locale()) { const locale& loc = locale()) {
@ -33,7 +34,7 @@ public:
else return -1; else return -1;
} }
template<typename T> static int ci_find_substr(const T& str1, template<typename T> static int ustrstr(const T& str1,
const char* str2c, const char* str2c,
const locale& loc = locale()) { const locale& loc = locale()) {
@ -44,6 +45,24 @@ public:
else return -1; else return -1;
} }
static QString GetNSErrorDefinition(const char *str, const char *elem){
const char *temp = strstr(str, elem);
if (temp != NULL)
{
char definition[128] = { 0 };
const char *firstComma = strstr(temp + strlen(elem) + 1, "\"");
const char *lastComma = strstr(firstComma + 1, "\"");
int sz = lastComma - firstComma - 1;
strncpy(definition, firstComma + 1, (sz < 128 ? sz : 128));
return QString(definition);
}
else return QString("No definition found!");
}
char * getProxy(); char * getProxy();
int getProxyPort(); int getProxyPort();
}; };

View File

@ -12,20 +12,20 @@ lopaStr WFClass::parseResponse(const char *ip,
if(buffer->size() != 0) if(buffer->size() != 0)
{ {
if(Utils::ci_find_substr(*buffer, std::string(formVal)) == -1 if(Utils::ustrstr(*buffer, std::string(formVal)) == -1
&& Utils::ci_find_substr(*buffer, std::string("denied")) == -1 && Utils::ustrstr(*buffer, std::string("denied")) == -1
&& Utils::ci_find_substr(*buffer, std::string("Location:")) == -1 && Utils::ustrstr(*buffer, std::string("Location:")) == -1
&& Utils::ci_find_substr(*buffer, std::string("Authentication required")) == -1 && Utils::ustrstr(*buffer, std::string("Authentication required")) == -1
&& Utils::ci_find_substr(*buffer, std::string("invalid")) == -1 && Utils::ustrstr(*buffer, std::string("invalid")) == -1
&& Utils::ci_find_substr(*buffer, std::string("err")) == -1 && Utils::ustrstr(*buffer, std::string("err")) == -1
&& Utils::ci_find_substr(*buffer, std::string(".href")) == -1 && Utils::ustrstr(*buffer, std::string(".href")) == -1
&& Utils::ci_find_substr(*buffer, std::string(".replace")) == -1 && Utils::ustrstr(*buffer, std::string(".replace")) == -1
&& Utils::ci_find_substr(*buffer, std::string(".location")) == -1 && Utils::ustrstr(*buffer, std::string(".location")) == -1
&& Utils::ci_find_substr(*buffer, std::string("501 not implemented")) == -1 && Utils::ustrstr(*buffer, std::string("501 not implemented")) == -1
&& Utils::ci_find_substr(*buffer, std::string("http-equiv")) == -1 && Utils::ustrstr(*buffer, std::string("http-equiv")) == -1
&& Utils::ci_find_substr(*buffer, std::string("busy")) == -1 && Utils::ustrstr(*buffer, std::string("busy")) == -1
&& Utils::ci_find_substr(*buffer, std::string("later")) == -1 && Utils::ustrstr(*buffer, std::string("later")) == -1
&& Utils::ci_find_substr(*buffer, std::string("forbidden")) == -1 && Utils::ustrstr(*buffer, std::string("forbidden")) == -1
) { ) {
stt->doEmition_BAGreenData("[+] " + QString(ip) + ":" + QString::number(port) + " - WF pass: " + stt->doEmition_BAGreenData("[+] " + QString(ip) + ":" + QString::number(port) + " - WF pass: " +
@ -36,9 +36,9 @@ lopaStr WFClass::parseResponse(const char *ip,
} else { } else {
if(Utils::ci_find_substr(*buffer, std::string("501 not implemented")) != -1) stt->doEmitionRedFoundData("<a href=\"http://" + QString(ip) + ":" + QString::number(port) + "\"><font color=\"#c3c3c3\">" + QString(ip) + ":" + QString::number(port) + "</font></a> - [WF]: 501 Not Implemented."); if(Utils::ustrstr(*buffer, std::string("501 not implemented")) != -1) stt->doEmitionRedFoundData("<a href=\"http://" + QString(ip) + ":" + QString::number(port) + "\"><font color=\"#c3c3c3\">" + QString(ip) + ":" + QString::number(port) + "</font></a> - [WF]: 501 Not Implemented.");
if(Utils::ci_find_substr(*buffer, std::string("404 not found")) != -1) stt->doEmitionRedFoundData("<a href=\"http://" + QString(ip) + ":" + QString::number(port) + "\"><font color=\"#c3c3c3\">" + QString(ip) + ":" + QString::number(port) + "</font></a> - [WF]: 404 Not Found."); if(Utils::ustrstr(*buffer, std::string("404 not found")) != -1) stt->doEmitionRedFoundData("<a href=\"http://" + QString(ip) + ":" + QString::number(port) + "\"><font color=\"#c3c3c3\">" + QString(ip) + ":" + QString::number(port) + "</font></a> - [WF]: 404 Not Found.");
return result; return result;
} }

View File

@ -1,5 +1,6 @@
#ifndef EXTERNDATA_H #ifndef EXTERNDATA_H
#define EXTERNDATA_H #define EXTERNDATA_H
#include <atomic>
#include <qjsonarray.h> #include <qjsonarray.h>
#define RECV_MAX_SIZE 350000 #define RECV_MAX_SIZE 350000
@ -22,24 +23,24 @@ extern QJsonArray *jsonArr;
extern unsigned long long gTargetsNumber; extern unsigned long long gTargetsNumber;
extern long long unsigned int gTargets; extern long long unsigned int gTargets;
extern volatile int cons, BrutingThrds, gThreads; extern std::atomic<int> cons, BrutingThrds, gThreads;
extern char **loginLst, **passLst, **wfLoginLst, **wfPassLst, **sshlpLst, **GlobalNegatives; extern char **loginLst, **passLst, **wfLoginLst, **wfPassLst, **sshlpLst;
extern bool trackerOK, __savingBackUpFile, globalScanFlag, MapWidgetOpened, extern bool trackerOK, globalScanFlag, MapWidgetOpened,
widgetIsHidden, OnlineMsgSentFlag, HTMLDebugMode, gNegDebugMode, widgetIsHidden, gNegDebugMode,
gDebugMode, horLineFlag, gPingNScan, gShuffle, gDebugMode, horLineFlag, gPingNScan, gShuffle,
BALogSwitched; BALogSwitched;
extern int found, indexIP, gMode, extern int found, indexIP, gMode,
MaxPass, MaxLogin, MaxWFLogin, MaxWFPass, MaxSSHPass, MaxPass, MaxLogin, MaxWFLogin, MaxWFPass, MaxSSHPass,
GlobalNegativeSize, gMaxBrutingThreads, gMaxBrutingThreads,
gTimeOut, PieAnomC1, PieSusp, PieBA, PieLowl, PieWF, PieSSH, gTimeOut, PieAnomC1, PieSusp, PieBA, PieLowl, PieWF, PieSSH,
gThreadDelay, AnomC1, Filt, Overl, Lowl, Alive, saved, AnomC1, filtered, Overl, Lowl, Alive, saved,
Susp, Susp,
WF, WF,
baCount, baCount,
offlines, ssh, globalPinger, gPingTimeout, nickFlag, offlineFlag; ssh, globalPinger, gPingTimeout;
extern unsigned int Activity; extern unsigned int Activity;
extern char trcSrv[256], trcScr[256], trcProxy[128], trcPersKey[64], extern char trcSrv[256], trcScr[256], trcProxy[128], trcPersKey[64],
trcPort[32], trcSrvPortLine[32], saveEndIP[128], trcPort[32], trcSrvPortLine[32],
gTLD[128], gPorts[65536], gTLD[128], gPorts[65536],
gProxyIP[64], gProxyPort[8], gProxyIP[64], gProxyPort[8],
currentIP[MAX_ADDR_LEN], currentIP[MAX_ADDR_LEN],
@ -47,9 +48,4 @@ extern char trcSrv[256], trcScr[256], trcProxy[128], trcPersKey[64],
extern char gVER[32]; extern char gVER[32];
struct pl{
int loginCounter;
int passCounter;
};
#endif // EXTERNDATA #endif // EXTERNDATA

View File

@ -2,12 +2,6 @@
#define EF_H #define EF_H
extern std::string toLowerStr(const char *str); extern std::string toLowerStr(const char *str);
extern int startScan(char* argv);
extern QString GetNSErrorDefinition(const char *str, const char *defin);
extern char* strstri(const char *_Str, const char *_SubStr); extern char* strstri(const char *_Str, const char *_SubStr);
extern void getSubStr(char *src, char *startStr, char *endStr, char *dest, int szDest);
extern void getSubStrEx(char *src, char *startStr, char *endStr, char *dest, int szDest);
extern char *_findFirst(const char *str, char *delim);
#endif // EF_H #endif // EF_H

View File

@ -10,6 +10,40 @@
#include <memory> #include <memory>
#include "FileUpdater.h" #include "FileUpdater.h"
#include "IPCAuth.h" #include "IPCAuth.h"
#include <qjsonobject.h>
unsigned char tl(unsigned char d)
{
if (d >= 192 && d <= 223)
{
return (unsigned char)(d + 32);
}
else
{
return tolower(d);
};
}
std::string toLowerStr(const char *str)
{
if (str != NULL) {
int tsz = strlen(str);
char *strr = new char[tsz + 1];
ZeroMemory(strr, tsz);
for (int i = 0; i < tsz; i++)
{
strr[i] = tl(str[i]);
};
memset(strr + tsz, '\0', 1);
std::string tstr = std::string(strr);
delete[]strr;
return tstr;
}
else return "";
}
char* strstri(const char *_Str, const char *_SubStr) char* strstri(const char *_Str, const char *_SubStr)
{ {
@ -187,60 +221,69 @@ char *GetCodePage(const char *str)
}; };
} }
int globalSearchNeg(const char *buffcpy, const char *ip, int port) int globalSearchNeg(const std::string buff, const char *ip, int port, const char *cp)
{ {
QTextCodec *nCodec = QTextCodec::codecForName("Windows-1251"); QTextCodec *codec;
for(int i = 0; i < GlobalNegativeSize; ++i) QString codedStr;
if (strstri(cp, "shift_jis") != NULL)
{ {
codec = QTextCodec::codecForName("Shift-JIS");
codedStr = codec->toUnicode(buff.c_str());
}
else if (strstri(cp, "utf") != NULL)
{
codec = QTextCodec::codecForName("UTF-8");
codedStr = codec->toUnicode(buff.c_str());
}
else if (strstri(cp, "cp") != NULL || strstri(cp, "windows") != NULL)
{
codec = QTextCodec::codecForName("Windows-1251");
codedStr = codec->toUnicode(buff.c_str());
}
else if (strstri(cp, "gb") != NULL)
{
codec = QTextCodec::codecForName("GB2312");
codedStr = codec->toUnicode(buff.c_str());
}
else codedStr = QString(buff.c_str());
for (auto negEntry : FileUpdater::negativeVector) {
FileUpdater::cv.wait(FileUpdater::lk, []{return FileUpdater::ready; }); FileUpdater::cv.wait(FileUpdater::lk, []{return FileUpdater::ready; });
if (!globalScanFlag) return -1; if (!globalScanFlag) return -1;
if(strstr(buffcpy, GlobalNegatives[i]) != NULL) if (Utils::ustrstr(std::string(codedStr.toLocal8Bit().data()), negEntry) != -1){
{
if (gNegDebugMode) if (gNegDebugMode)
{ {
QTextCodec *nCodec = QTextCodec::codecForName("Windows-1251");
stt->doEmitionDebugFoundData("[<a href=\"http://" + QString(ip) + ":" + QString::number(port) + stt->doEmitionDebugFoundData("[<a href=\"http://" + QString(ip) + ":" + QString::number(port) +
"/\"><font color=\"#0084ff\">" + QString(ip) + ":" + QString::number(port) + "/\"><font color=\"#0084ff\">" + QString(ip) + ":" + QString::number(port) +
"</font></a>" + "]\tNegative hit: \"" + nCodec->toUnicode(GlobalNegatives[i]).toHtmlEscaped() + "\""); "</font></a>" + "]\tNegative hit: \"" + nCodec->toUnicode(negEntry.c_str()).toHtmlEscaped()
if(strlen(GlobalNegatives[i]) < 2) + "\"");
{
stt->doEmitionDebugFoundData(" Len:" + QString::number(strlen(GlobalNegatives[i])));
};
if(strcmp(GlobalNegatives[i], "") == 0)
{
stt->doEmitionDebugFoundData("Empty hit!");
};
if(strcmp(GlobalNegatives[i], " ") == 0)
{
stt->doEmitionDebugFoundData("Space hit!");
};
};
++Filt;
return -1;
};
};
} }
int globalSearchPrnt(const char *buffcpy) ++filtered;
return -1;
}
}
}
int globalSearchPrnt(const std::string buffcpy)
{ {
if(strstr(buffcpy, "en/_top.htm") != NULL || strstr(buffcpy, "cannon http server") != NULL if(Utils::ustrstr(buffcpy, "en/_top.htm") != -1 || Utils::ustrstr(buffcpy, "cannon http server") != -1
|| strstr(buffcpy, "konica minolta") != NULL || strstr(buffcpy, "/eng/home_frm.htm") != NULL || Utils::ustrstr(buffcpy, "konica minolta") != -1 || Utils::ustrstr(buffcpy, "/eng/home_frm.htm") != -1
|| strstr(buffcpy, "networkScanner webserver") != NULL || strstr(buffcpy, "/eng/htm/top.htm") != NULL || Utils::ustrstr(buffcpy, "networkScanner webserver") != -1 || Utils::ustrstr(buffcpy, "/eng/htm/top.htm") != -1
|| strstr(buffcpy, "pages/t_ixdmy.htm") != NULL || Utils::ustrstr(buffcpy, "pages/t_ixdmy.htm") != -1
|| strstr(buffcpy, "/web/guest/") != NULL || strstr(buffcpy, "printerInfo") != NULL || Utils::ustrstr(buffcpy, "/web/guest/") != -1 || Utils::ustrstr(buffcpy, "printerInfo") != -1
|| strstr(buffcpy, "hp photosmart") != NULL || Utils::ustrstr(buffcpy, "hp photosmart") != -1
|| strstr(buffcpy, "menu and") != NULL || Utils::ustrstr(buffcpy, "menu and") != -1
|| strstr(buffcpy, "hewlett packard") != NULL || Utils::ustrstr(buffcpy, "hewlett packard") != -1
|| strstr(buffcpy, "laserjet") != NULL || strstr(buffcpy, "supplies summary") != NULL || Utils::ustrstr(buffcpy, "laserjet") != -1 || Utils::ustrstr(buffcpy, "supplies summary") != -1
|| strstr(buffcpy, "seiko epson") != NULL || strstr(buffcpy, "ink_y.png") != NULL || Utils::ustrstr(buffcpy, "seiko epson") != -1 || Utils::ustrstr(buffcpy, "ink_y.png") != -1
|| strstr(buffcpy, "epsonnet") != NULL || strstr(buffcpy, "printer name") != NULL || Utils::ustrstr(buffcpy, "epsonnet") != -1 || Utils::ustrstr(buffcpy, "printer name") != -1
) )
{ {
if(gNegDebugMode) if(gNegDebugMode) stt->doEmitionDebugFoundData("Printer detected.");
{
stt->doEmitionDebugFoundData("Printer detected.");
};
return -1; return -1;
}; };
@ -248,95 +291,95 @@ int globalSearchPrnt(const char *buffcpy)
return 0; return 0;
} }
int sharedDetector(const char * ip, int port, const char *buffcpy) { int sharedDetector(const char * ip, int port, const std::string buffcpy, const char *cp) {
if(strstr(buffcpy, "401 authorization") != NULL || strstr(buffcpy, "401 unauthorized") != NULL if(Utils::ustrstr(buffcpy, "401 authorization") != -1 || Utils::ustrstr(buffcpy, "401 unauthorized") != -1
|| (strstr(buffcpy, "www-authenticate") != NULL && strstr(buffcpy, "401 ") != NULL ) || (Utils::ustrstr(buffcpy, "www-authenticate") != -1 && Utils::ustrstr(buffcpy, "401 ") != -1 )
|| strstr(buffcpy, "401 unauthorized access denied") != NULL || Utils::ustrstr(buffcpy, "401 unauthorized access denied") != -1
|| strstr(buffcpy, "401 unauthorised") != NULL || (strstr(buffcpy, "www-authenticate") != NULL || Utils::ustrstr(buffcpy, "401 unauthorised") != -1 || (Utils::ustrstr(buffcpy, "www-authenticate") != -1
&& strstr(buffcpy, " 401\r\n") != NULL) && Utils::ustrstr(buffcpy, " 401\r\n") != -1)
) { ) {
if(strstr(buffcpy, "digest realm") != NULL && strstr(buffcpy, "basic realm") == NULL) { if(Utils::ustrstr(buffcpy, "digest realm") != -1 && Utils::ustrstr(buffcpy, "basic realm") == -1) {
return 101; return 101;
} else return 1; } else return 1;
}; };
if(strstr(buffcpy, "netwave ip camera")) return 11; if (Utils::ustrstr(buffcpy, "netwave ip camera") != -1) return 11;
if(strstr(buffcpy, "live view / - axis")) return 12; if (Utils::ustrstr(buffcpy, "live view / - axis") != -1) return 12;
if(strstr(buffcpy, "vilar ipcamera")) return 13; if (Utils::ustrstr(buffcpy, "vilar ipcamera") != -1) return 13;
if(strstr(buffcpy, "window.location = \"rdr.cgi\"")) return 14; if (Utils::ustrstr(buffcpy, "window.location = \"rdr.cgi\"") != -1) return 14;
if(strstr(buffcpy, "httpfileserver")) return 15; if (Utils::ustrstr(buffcpy, "httpfileserver") != -1) return 15;
if(strstr(buffcpy, "real-time ip camera monitoring system") != NULL if(Utils::ustrstr(buffcpy, "real-time ip camera monitoring system") != -1
|| strstr(buffcpy, "server push mode") != NULL || Utils::ustrstr(buffcpy, "server push mode") != -1
) return 17; //Real-time IP Camera Monitoring System ) return 17; //Real-time IP Camera Monitoring System
if(strstr(buffcpy, "linksys.com") != NULL && strstr(buffcpy, "tm05") != NULL) return 18; //linksys.com cameras if(Utils::ustrstr(buffcpy, "linksys.com") != -1 && Utils::ustrstr(buffcpy, "tm05") != -1) return 18; //linksys.com cameras
if(strstr(buffcpy, "reecam ip camera") != NULL) return 19; //reecam cameras if(Utils::ustrstr(buffcpy, "reecam ip camera") != -1) return 19; //reecam cameras
if(strstr(buffcpy, "/view/viewer_index.shtml") != NULL) return 20; //axis cameras if(Utils::ustrstr(buffcpy, "/view/viewer_index.shtml") != -1) return 20; //axis cameras
if(strstr(buffcpy, "bridge eyeon") != NULL) return 21; //Bridge Eyeon if(Utils::ustrstr(buffcpy, "bridge eyeon") != -1) return 21; //Bridge Eyeon
if(strstr(buffcpy, "ip camera control webpage") != NULL && strstr(buffcpy, "/main/cs_motion.asp") != NULL) return 22; //ip camera control if(Utils::ustrstr(buffcpy, "ip camera control webpage") != -1 && Utils::ustrstr(buffcpy, "/main/cs_motion.asp") != -1) return 22; //ip camera control
if(strstr(buffcpy, "network camera") != NULL && strstr(buffcpy, "/live/index2.html") != NULL) return 23; //network camera BB-SC384 if(Utils::ustrstr(buffcpy, "network camera") != -1 && Utils::ustrstr(buffcpy, "/live/index2.html") != -1) return 23; //network camera BB-SC384
if(strstr(buffcpy, "network camera") != NULL && strstr(buffcpy, "/viewer/live/en/live.html") != NULL) return 24; //Network Camera VB-M40 if(Utils::ustrstr(buffcpy, "network camera") != -1 && Utils::ustrstr(buffcpy, "/viewer/live/en/live.html") != -1) return 24; //Network Camera VB-M40
if(strstr(buffcpy, "panasonic ") != NULL && strstr(buffcpy, ":60002/snapshotjpeg") != NULL) return 25; //Panasonic wtfidonteven-camera if(Utils::ustrstr(buffcpy, "panasonic ") != -1 && Utils::ustrstr(buffcpy, ":60002/snapshotjpeg") != -1) return 25; //Panasonic wtfidonteven-camera
if(strstr(buffcpy, "sony network camera") != NULL && strstr(buffcpy, "/command/inquiry.cgi?") != NULL) return 26; //Sony Network Camera if(Utils::ustrstr(buffcpy, "sony network camera") != -1 && Utils::ustrstr(buffcpy, "/command/inquiry.cgi?") != -1) return 26; //Sony Network Camera
if(strstr(buffcpy, "network camera") != NULL && strstr(buffcpy, "src=\"webs.cgi?") != NULL) return 27; //UA Network Camera if(Utils::ustrstr(buffcpy, "network camera") != -1 && Utils::ustrstr(buffcpy, "src=\"webs.cgi?") != -1) return 27; //UA Network Camera
if(strstr(buffcpy, "network camera") != NULL && strstr(buffcpy, "/viewer/live/index.html") != NULL) return 28; //Network Camera VB-M40 if(Utils::ustrstr(buffcpy, "network camera") != -1 && Utils::ustrstr(buffcpy, "/viewer/live/index.html") != -1) return 28; //Network Camera VB-M40
if(strstr(buffcpy, "lg smart ip device") != NULL) return 29; //LG Smart IP Device Camera if(Utils::ustrstr(buffcpy, "lg smart ip device") != -1) return 29; //LG Smart IP Device Camera
if(strstr(buffcpy, "/view/viewer_index.shtml") != NULL) return 20; //axis cameras if(Utils::ustrstr(buffcpy, "/view/viewer_index.shtml") != -1) return 20; //axis cameras
if(strstr(buffcpy, "nas") != NULL && strstr(buffcpy, "/cgi-bin/data/viostor-220/viostor/viostor.cgi") != NULL) return 30; //NAX if(Utils::ustrstr(buffcpy, "nas") != -1 && Utils::ustrstr(buffcpy, "/cgi-bin/data/viostor-220/viostor/viostor.cgi") != -1) return 30; //NAX
if(strstr(buffcpy, "ip camera") != NULL && strstr(buffcpy, "check_user.cgi") != NULL) return 31; //axis cameras if(Utils::ustrstr(buffcpy, "ip camera") != -1 && Utils::ustrstr(buffcpy, "check_user.cgi") != -1) return 31; //axis cameras
if(strstr(buffcpy, "ws(\"user\");") != NULL && strstr(buffcpy, "src=\"/tool.js") != NULL if(Utils::ustrstr(buffcpy, "ws(\"user\");") != -1 && Utils::ustrstr(buffcpy, "src=\"/tool.js") != -1
&& strstr(buffcpy, "<b class=\"xb1\"></b>") != NULL) return 32; //web ip cam && Utils::ustrstr(buffcpy, "<b class=\"xb1\"></b>") != -1) return 32; //web ip cam
if(strstr(buffcpy, "geovision") != NULL if(Utils::ustrstr(buffcpy, "geovision") != -1
&& (strstr(buffcpy, "ip camera") != NULL && (Utils::ustrstr(buffcpy, "ip camera") != -1
|| strstr(buffcpy, "ssi.cgi/login.htm") != NULL)) return 33; //GEO web ip cam || Utils::ustrstr(buffcpy, "ssi.cgi/login.htm") != -1)) return 33; //GEO web ip cam
if(strstr(buffcpy, "hikvision-webs") != NULL if(Utils::ustrstr(buffcpy, "hikvision-webs") != -1
|| (strstr(buffcpy, "hikvision digital") != NULL && strstr(buffcpy, "dvrdvs-webs") != NULL) || (Utils::ustrstr(buffcpy, "hikvision digital") != -1 && Utils::ustrstr(buffcpy, "dvrdvs-webs") != -1)
|| (strstr(buffcpy, "lapassword") != NULL && strstr(buffcpy, "lausername") != NULL && strstr(buffcpy, "dologin()") != NULL)) return 34; //hikvision cam || (Utils::ustrstr(buffcpy, "lapassword") != -1 && Utils::ustrstr(buffcpy, "lausername") != -1 && Utils::ustrstr(buffcpy, "dologin()") != -1)) return 34; //hikvision cam
if((strstr(buffcpy, "easy cam") != NULL && strstr(buffcpy, "easy life") != NULL) if((Utils::ustrstr(buffcpy, "easy cam") != -1 && Utils::ustrstr(buffcpy, "easy life") != -1)
|| (strstr(buffcpy, "ipcamera") != NULL && strstr(buffcpy, "/tool.js") != NULL)) return 35; //EasyCam || (Utils::ustrstr(buffcpy, "ipcamera") != -1 && Utils::ustrstr(buffcpy, "/tool.js") != -1)) return 35; //EasyCam
if(strstr(buffcpy, "/config/cam_portal.cgi") != NULL || strstr(buffcpy, "/config/easy_index.cgi") != NULL) return 36; //Panasonic Cam if(Utils::ustrstr(buffcpy, "/config/cam_portal.cgi") != -1 || Utils::ustrstr(buffcpy, "/config/easy_index.cgi") != -1) return 36; //Panasonic Cam
if(strstr(buffcpy, "panasonic") != NULL && strstr(buffcpy, "/view/getuid.cgi") != NULL) return 37; //Panasonic Cam WJ-HD180 if(Utils::ustrstr(buffcpy, "panasonic") != -1 && Utils::ustrstr(buffcpy, "/view/getuid.cgi") != -1) return 37; //Panasonic Cam WJ-HD180
if(strstr(buffcpy, "ipcam client") != NULL && strstr(buffcpy, "plugins.xpi") != NULL && strstr(buffcpy, "js/upfile.js") != NULL) return 38; //Foscam if(Utils::ustrstr(buffcpy, "ipcam client") != -1 && Utils::ustrstr(buffcpy, "plugins.xpi") != -1 && Utils::ustrstr(buffcpy, "js/upfile.js") != -1) return 38; //Foscam
if(strstr(buffcpy, "ip surveillance") != NULL && strstr(buffcpy, "customer login") != NULL) return 39; //EagleEye if(Utils::ustrstr(buffcpy, "ip surveillance") != -1 && Utils::ustrstr(buffcpy, "customer login") != -1) return 39; //EagleEye
if(strstr(buffcpy, "network camera") != NULL && strstr(buffcpy, "/admin/index.shtml?") != NULL) return 40; //Network Camera VB-C300 if(Utils::ustrstr(buffcpy, "network camera") != -1 && Utils::ustrstr(buffcpy, "/admin/index.shtml?") != -1) return 40; //Network Camera VB-C300
if(strstr(buffcpy, "sq-webcam") != NULL && strstr(buffcpy, "liveview.html") != NULL) return 41; //AVIOSYS-camera if(Utils::ustrstr(buffcpy, "sq-webcam") != -1 && Utils::ustrstr(buffcpy, "liveview.html") != -1) return 41; //AVIOSYS-camera
if(strstr(buffcpy, "nw_camera") != NULL && strstr(buffcpy, "/cgi-bin/getuid") != NULL) return 42; //NW_camera if(Utils::ustrstr(buffcpy, "nw_camera") != -1 && Utils::ustrstr(buffcpy, "/cgi-bin/getuid") != -1) return 42; //NW_camera
if(strstr(buffcpy, "micros") != NULL && strstr(buffcpy, "/gui/gui_outer_frame.shtml") != NULL) return 43; //NW_camera if(Utils::ustrstr(buffcpy, "micros") != -1 && Utils::ustrstr(buffcpy, "/gui/gui_outer_frame.shtml") != -1) return 43; //NW_camera
if(strstr(buffcpy, "lapassword") != NULL if(Utils::ustrstr(buffcpy, "lapassword") != -1
&& strstr(buffcpy, "lausername") != NULL && Utils::ustrstr(buffcpy, "lausername") != -1
&& strstr(buffcpy, "g_ologin.dologin()") != NULL && Utils::ustrstr(buffcpy, "g_ologin.dologin()") != -1
) return 44; //hikvision cam 2 ) return 44; //hikvision cam 2
if(strstr(buffcpy, "panasonic") != NULL && strstr(buffcpy, "/config/index.cgi") != NULL) return 45; //Panasonic Cam BB-HG??? if(Utils::ustrstr(buffcpy, "panasonic") != -1 && Utils::ustrstr(buffcpy, "/config/index.cgi") != -1) return 45; //Panasonic Cam BB-HG???
if(strstr(buffcpy, "/ui/") != NULL && strstr(buffcpy, "sencha-touch") != NULL) return 46; //BUFFALO disk if(Utils::ustrstr(buffcpy, "/ui/") != -1 && Utils::ustrstr(buffcpy, "sencha-touch") != -1) return 46; //BUFFALO disk
if(strstr(buffcpy, "digital video server") != NULL && strstr(buffcpy, "gui.css") != NULL) return 47; //Digital Video Server if(Utils::ustrstr(buffcpy, "digital video server") != -1 && Utils::ustrstr(buffcpy, "gui.css") != -1) return 47; //Digital Video Server
if(strstr(buffcpy, "/ipcamerasetup.zip") != NULL && strstr(buffcpy, "download player") != NULL if(Utils::ustrstr(buffcpy, "/ipcamerasetup.zip") != -1 && Utils::ustrstr(buffcpy, "download player") != -1
&& strstr(buffcpy, "ipcam") != NULL) return 48; //ipCam && Utils::ustrstr(buffcpy, "ipcam") != -1) return 48; //ipCam
if(strstr(buffcpy, "dvr") != NULL && strstr(buffcpy, "ieorforefox") != NULL if(Utils::ustrstr(buffcpy, "dvr") != -1 && Utils::ustrstr(buffcpy, "ieorforefox") != -1
&& strstr(buffcpy, "sofari") != NULL) return 49; //IEORFOREFOX && Utils::ustrstr(buffcpy, "sofari") != -1) return 49; //IEORFOREFOX
if (strstr(buffcpy, "seyeon") != NULL && (strstr(buffcpy, "/app/multi/single.asp") != NULL if (Utils::ustrstr(buffcpy, "seyeon") != -1 && (Utils::ustrstr(buffcpy, "/app/multi/single.asp") != -1
|| strstr(buffcpy, "/app/live/sim/single.asp") != NULL)) return 50; //Network Video System || Utils::ustrstr(buffcpy, "/app/live/sim/single.asp") != -1)) return 50; //Network Video System
if(((strstr(buffcpy, "220") != NULL) && (port == 21)) || if(((Utils::ustrstr(buffcpy, "220") != -1) && (port == 21)) ||
(strstr(buffcpy, "220 diskStation ftp server ready") != NULL) || (Utils::ustrstr(buffcpy, "220 diskStation ftp server ready") != -1) ||
(strstr(buffcpy, "220 ftp server ready") != NULL) (Utils::ustrstr(buffcpy, "220 ftp server ready") != -1)
|| strstr(buffcpy, "500 'get': command not understood") != NULL || Utils::ustrstr(buffcpy, "500 'get': command not understood") != -1
) return 16; // 16 - FTP ) return 16; // 16 - FTP
if((strstr(buffcpy, "camera web server") != NULL || strstr(buffcpy, "webcamxp 5") != NULL if((Utils::ustrstr(buffcpy, "camera web server") != -1 || Utils::ustrstr(buffcpy, "webcamxp 5") != -1
|| strstr(buffcpy, "ip box camera") != NULL || strstr(buffcpy, "snaff") != NULL || Utils::ustrstr(buffcpy, "ip box camera") != -1 || Utils::ustrstr(buffcpy, "snaff") != -1
|| strstr(buffcpy, "hfs /") != NULL || strstr(buffcpy, "httpfileserver") != NULL || Utils::ustrstr(buffcpy, "hfs /") != -1 || Utils::ustrstr(buffcpy, "httpfileserver") != -1
|| strstr(buffcpy, "network camera") != NULL || strstr(buffcpy, "index of") != NULL || Utils::ustrstr(buffcpy, "network camera") != -1 || Utils::ustrstr(buffcpy, "index of") != -1
|| strstr(buffcpy, "$lock extended") != NULL || strstr(buffcpy, "ip camera") != NULL || Utils::ustrstr(buffcpy, "$lock extended") != -1 || Utils::ustrstr(buffcpy, "ip camera") != -1
|| strstr(buffcpy, "/viewer/video.jpg") != NULL || strstr(buffcpy, "smart ip device") != NULL || Utils::ustrstr(buffcpy, "/viewer/video.jpg") != -1 || Utils::ustrstr(buffcpy, "smart ip device") != -1
|| strstr(buffcpy, "sanpshot_icon") != NULL || strstr(buffcpy, "snapshot_icon") != NULL || Utils::ustrstr(buffcpy, "sanpshot_icon") != -1 || Utils::ustrstr(buffcpy, "snapshot_icon") != -1
|| strstr(buffcpy, "ipcam") != NULL) || Utils::ustrstr(buffcpy, "ipcam") != -1)
&& strstr(buffcpy, "customer") == NULL && Utils::ustrstr(buffcpy, "customer") == -1
&& strstr(buffcpy, "purchase") == NULL && Utils::ustrstr(buffcpy, "purchase") == -1
&& strstr(buffcpy, "contac") == NULL && Utils::ustrstr(buffcpy, "contac") == -1
&& strstr(buffcpy, "company") == NULL && Utils::ustrstr(buffcpy, "company") == -1
) return 0; ) return 0;
if(globalSearchNeg(buffcpy, ip, port) == -1) return -1; if(globalSearchNeg(buffcpy, ip, port, cp) == -1) return -1;
if(globalSearchPrnt(buffcpy) == -1) return -1; if(globalSearchPrnt(buffcpy) == -1) return -1;
//if(strstr(buffcpy, "<form ") != NULL && strstr(buffcpy, "302 found") == NULL) return 10; //if(strstr(buffcpy, "<form ") != NULL && strstr(buffcpy, "302 found") == NULL) return 10;
//nic.sucks, etc //nic.sucks, etc
@ -345,76 +388,35 @@ int sharedDetector(const char * ip, int port, const char *buffcpy) {
} }
// 500 < 1600 // 500 < 1600
int _mainFinderFirst(const char *buffcpy, int f, int port, const char *ip, int sz) int _mainFinderFirst(const std::string buffcpy, int f, int port, const char *ip, const char *cp)
{ {
int flag = sharedDetector(ip, port, buffcpy); int flag = sharedDetector(ip, port, buffcpy, cp);
if(flag != -2) return flag; if(flag != -2) return flag;
if(f) return 7; if(f) return 7;
if(sz > 180000) return 2;
return 0; return 0;
} }
//> 1600 //> 1600
int _mainFinderSecond(const char *buffcpy, int port, const char *ip) int _mainFinderSecond(const std::string buffcpy, int port, const char *ip, const char *cp)
{ {
int flag = sharedDetector(ip, port, buffcpy); int flag = sharedDetector(ip, port, buffcpy, cp);
if(flag != -2) return flag; if(flag != -2) return flag;
return 3; //Suspicious return 3; //Suspicious
} }
int ContentFilter(const char *buff, int port, const char *ip, char *cp, int sz) int ContentFilter(const std::string buff, int port, const char *ip, const char *cp, int sz)
{ {
if(buff != NULL)
{
QTextCodec *codec;
QString strLower;
if (strstri(cp, "shift_jis") != NULL)
{
codec = QTextCodec::codecForName("Shift-JIS");
strLower = codec->toUnicode(buff);
}
else if (strstri(cp, "utf") != NULL)
{
codec = QTextCodec::codecForName("UTF-8");
strLower = codec->toUnicode(buff);
}
else if (strstri(cp, "cp") != NULL || strstri(cp, "windows") != NULL)
{
codec = QTextCodec::codecForName("Windows-1251");
strLower = codec->toUnicode(buff);
}
else if (strstri(cp, "gb") != NULL)
{
codec = QTextCodec::codecForName("GB2312");
strLower = codec->toUnicode(buff);
}
else strLower = QString(buff);
strLower = strLower.toLower();
int res = 0; int res = 0;
if (sz <= 500) res = _mainFinderFirst(buff, 1, port, ip, cp);
if(sz <= 500) else if ((sz > 500 && sz <= 3500) || sz > 180000) res = _mainFinderFirst(buff, 0, port, ip, cp);
{ else if (sz > 3500 && sz <= 180000) res = _mainFinderSecond(buff, port, ip, cp);
res = _mainFinderFirst(strLower.toLocal8Bit().data(), 1, port, ip, sz);
}
else if((sz > 500 && sz <= 3500) || sz > 180000)
{
res = _mainFinderFirst(strLower.toLocal8Bit().data(), 0, port, ip, sz);
}
else if(sz > 3500 && sz <= 180000)
{
res = _mainFinderSecond(strLower.toLocal8Bit().data(), port, ip);
};
return res; return res;
} }
else return -1;
}
void fillGlobalLogData(const char *ip, char *port, const char *sz, char *title, void fillGlobalLogData(const char *ip, int port, const char *sz, char *title,
const char *login, const char *pass, char *comment, char *cdpg, char *clss) const char *login, const char *pass, char *comment, char *cdpg, char *clss)
{ {
if(trackerOK == true) if(trackerOK == true)
@ -437,7 +439,7 @@ void fillGlobalLogData(const char *ip, char *port, const char *sz, char *title,
jsonData.insert("hostname", QJsonValue(QString(ip)) ); jsonData.insert("hostname", QJsonValue(QString(ip)) );
}; };
jsonData.insert("port", QJsonValue(QString(port).replace(":", "")) ); jsonData.insert("port", QJsonValue(QString::number(port)) );
jsonData.insert("recv", QJsonValue(QString(sz))); jsonData.insert("recv", QJsonValue(QString(sz)));
QString tt = QString(base64_encode((const unsigned char *)title, strlen(title)).c_str()); QString tt = QString(base64_encode((const unsigned char *)title, strlen(title)).c_str());
if(strlen(title) == 0) jsonData.insert("title", QJsonValue(QString("NULL")) ); if(strlen(title) == 0) jsonData.insert("title", QJsonValue(QString("NULL")) );
@ -453,9 +455,7 @@ void fillGlobalLogData(const char *ip, char *port, const char *sz, char *title,
if(strlen(clss) > 0) jsonData.insert("Class", QJsonValue(QString(clss)) ); if(strlen(clss) > 0) jsonData.insert("Class", QJsonValue(QString(clss)) );
else jsonData.insert("Class", QJsonValue(QString("")) ); else jsonData.insert("Class", QJsonValue(QString("")) );
while(jsonArr == NULL);
jsonArr->push_front(jsonData); jsonArr->push_front(jsonData);
gGlobalTrackLocked = false; gGlobalTrackLocked = false;
}; };
} }
@ -684,12 +684,12 @@ void fputsf(char *text, int flag, char *msg)
}; };
} }
void putInFile(int flag, const char *ip, char *port, int size, char *finalstr, char *cp) void putInFile(int flag, const char *ip, int port, int size, char *finalstr, char *cp)
{ {
char log[4096] = {0}, msg[512] = {0}; char log[4096] = {0}, msg[512] = {0};
QTextCodec *codec; QTextCodec *codec;
sprintf(msg, "<a href=\"http://%s:%s/\"><span style=\"color: #a1a1a1;\">%s:%s</span></a>", sprintf(msg, "<a href=\"http://%s:%d/\"><span style=\"color: #a1a1a1;\">%s:%d</span></a>",
ip, port, ip, port); ip, port, ip, port);
QString resMes(msg); QString resMes(msg);
@ -727,7 +727,7 @@ void putInFile(int flag, const char *ip, char *port, int size, char *finalstr, c
stt->doEmitionFoundData(resMes); stt->doEmitionFoundData(resMes);
sprintf(log, "<span id=\"hostSpan\"><a href=\"http://%s:%s\"/><font color=MediumSeaGreen>%s:%s</font></a>;</span> <span id=\"recvSpan\">Received: <font color=SteelBlue>%d</font>", sprintf(log, "<span id=\"hostSpan\"><a href=\"http://%s:%d\"/><font color=MediumSeaGreen>%s:%d</font></a>;</span> <span id=\"recvSpan\">Received: <font color=SteelBlue>%d</font>",
ip, port, ip, port, size); ip, port, ip, port, size);
if(flag == 666 || flag == 350) if(flag == 666 || flag == 350)
@ -773,17 +773,17 @@ void putInFile(int flag, const char *ip, char *port, int size, char *finalstr, c
ZeroMemory(msg, strlen(msg)); ZeroMemory(msg, strlen(msg));
} }
void _specFillerBA(const char *ip, char *port, char *finalstr, const char *login, const char *pass, int flag) void _specFillerBA(const char *ip, int port, char *finalstr, const char *login, const char *pass, int flag)
{ {
char log[512] = {0}; char log[512] = {0};
++PieBA; ++PieBA;
if(strcmp(login, "NULL") != 0 && strcmp(pass, "NULL") != 0) if(strcmp(login, "NULL") != 0 && strcmp(pass, "NULL") != 0)
{ {
sprintf(log, "[BA]:<span id=\"hostSpan\"><a href=\"http://%s:%s@%s%s\"><font color=MediumSeaGreen>%s:%s@%s%s</font></a></span> T: <font color=GoldenRod>%s</font>\n", sprintf(log, "[BA]:<span id=\"hostSpan\"><a href=\"http://%s:%s@%s:%d\"><font color=MediumSeaGreen>%s:%s@%s:%d</font></a></span> T: <font color=GoldenRod>%s</font>\n",
login, pass, ip, port, login, pass, ip, port, finalstr); login, pass, ip, port, login, pass, ip, port, finalstr);
} else { } else {
sprintf(log, "[BA]:<span id=\"hostSpan\"><a href=\"http://%s%s\"><font color=MediumSeaGreen>%s%s</font></a></span> T: <font color=GoldenRod>%s</font>\n", sprintf(log, "[BA]:<span id=\"hostSpan\"><a href=\"http://%s:%d\"><font color=MediumSeaGreen>%s:%d</font></a></span> T: <font color=GoldenRod>%s</font>\n",
ip, port, ip, port, finalstr); ip, port, ip, port, finalstr);
} }
@ -792,7 +792,7 @@ void _specFillerBA(const char *ip, char *port, char *finalstr, const char *login
fputsf (log , flag, "Basic Authorization"); fputsf (log , flag, "Basic Authorization");
} }
void _specFillerWF(const char *ip, char *port, char *finalstr, char *login, char *pass, int flag) void _specFillerWF(const char *ip, int port, char *finalstr, char *login, char *pass, int flag)
{ {
char log[512] = {0}; char log[512] = {0};
@ -1022,9 +1022,7 @@ void _specWFBrute(const char *ip, int port, const char *buff, int flag, char *pa
char *fBlock = strstri(buff, "<form "); char *fBlock = strstri(buff, "<form ");
char formVal[128] = {0}; char formVal[128] = {0};
int fbsz = 0; int fbsz = 0;
char tport[16] = {0};
sprintf(tport, "%d", port);
std::vector<std::string> inputVec; std::vector<std::string> inputVec;
if(fBlock != NULL) if(fBlock != NULL)
{ {
@ -1091,8 +1089,8 @@ void _specWFBrute(const char *ip, int port, const char *buff, int flag, char *pa
else else
{ {
stt->doEmitionFoundData("<a href=\"http://" + QString(ip) + ":" + QString::number(port) + "\"><font color=\"#c3c3c3\">" + QString(ip) + ":" + QString::number(port) + "</font></a> - [WF]: Cannot find form block."); stt->doEmitionFoundData("<a href=\"http://" + QString(ip) + ":" + QString::number(port) + "\"><font color=\"#c3c3c3\">" + QString(ip) + ":" + QString::number(port) + "</font></a> - [WF]: Cannot find form block.");
fillGlobalLogData(ip, tport, std::to_string(size).c_str(), title, "NULL", "NULL", comment, cp, tclass); fillGlobalLogData(ip, port, std::to_string(size).c_str(), title, "NULL", "NULL", comment, cp, tclass);
putInFile(flag, ip, tport, size, title, cp); putInFile(flag, ip, port, size, title, cp);
}; };
if(strlen(methodVal) == 0) if(strlen(methodVal) == 0)
@ -1157,10 +1155,10 @@ void _specWFBrute(const char *ip, int port, const char *buff, int flag, char *pa
if(strstr(lps.login, "UNKNOWN") == NULL && strlen(lps.other) == 0) if(strstr(lps.login, "UNKNOWN") == NULL && strlen(lps.other) == 0)
{ {
_specFillerWF(ip, tport, title, lps.login, lps.pass, flag); _specFillerWF(ip, port, title, lps.login, lps.pass, flag);
fillGlobalLogData(ip, tport, std::to_string(size).c_str(), title, lps.login, lps.pass, comment, cp, tclass); fillGlobalLogData(ip, port, std::to_string(size).c_str(), title, lps.login, lps.pass, comment, cp, tclass);
putInFile(flag, ip, tport, size, title, cp); putInFile(flag, ip, port, size, title, cp);
}; };
} }
else else
@ -1178,17 +1176,15 @@ void _specWEBIPCAMBrute(const char *ip, int port, char *finalstr, int flag, char
ZeroMemory(lps.login, sizeof(lps.login)); ZeroMemory(lps.login, sizeof(lps.login));
ZeroMemory(lps.pass, sizeof(lps.pass)); ZeroMemory(lps.pass, sizeof(lps.pass));
ZeroMemory(lps.other, sizeof(lps.other)); ZeroMemory(lps.other, sizeof(lps.other));
char tport[32] = {0};
sprintf(tport, ":%d", port);
IPC ipc; IPC ipc;
lps = ipc.IPCLobby(ip, port, SPEC); lps = ipc.IPCLobby(ip, port, SPEC);
if(strstr(lps.login, "UNKNOWN") == NULL && strlen(lps.other) == 0) if(strstr(lps.login, "UNKNOWN") == NULL && strlen(lps.other) == 0)
{ {
_specFillerBA(ip, tport, finalstr, lps.login, lps.pass, flag); _specFillerBA(ip, port, finalstr, lps.login, lps.pass, flag);
fillGlobalLogData(ip, tport, std::to_string(size).c_str(), finalstr, lps.login, lps.pass, comment, cp, "Basic Authorization"); fillGlobalLogData(ip, port, std::to_string(size).c_str(), finalstr, lps.login, lps.pass, comment, cp, "Basic Authorization");
}; };
} }
@ -1196,20 +1192,14 @@ void _specBrute(const char *ip, int port,
char *finalstr, int flag, char *finalstr, int flag,
char *path, char *comment, char *cp, int size) char *path, char *comment, char *cp, int size)
{ {
char temp[64] = {0};
char tport[32] = {0};
sprintf(tport, ":%d", port);
const lopaStr &lps = BA::BALobby((string(ip) + string(path)).c_str(), port); const lopaStr &lps = BA::BALobby((string(ip) + string(path)).c_str(), port);
if(strstr(lps.login, "UNKNOWN") == NULL && strlen(lps.other) == 0) if(strstr(lps.login, "UNKNOWN") == NULL && strlen(lps.other) == 0)
{ {
_specFillerBA(ip, tport, finalstr, lps.login, lps.pass, flag); _specFillerBA(ip, port, finalstr, lps.login, lps.pass, flag);
fillGlobalLogData(ip, tport, std::to_string(size).c_str(), finalstr, lps.login, lps.pass, comment, cp, "Basic Authorization"); fillGlobalLogData(ip, port, std::to_string(size).c_str(), finalstr, lps.login, lps.pass, comment, cp, "Basic Authorization");
}; };
ZeroMemory(temp, sizeof(temp));
} }
const char *GetTitle(const char* str) const char *GetTitle(const char* str)
@ -1343,8 +1333,6 @@ void _saveSSH(const char *ip, int port, int size, const char *buffcpy)
int gsz = ptr1 - buffcpy; int gsz = ptr1 - buffcpy;
strncpy(goodStr, buffcpy, gsz); strncpy(goodStr, buffcpy, gsz);
if(strlen(ptr1 + 3) > 0) strcpy(banner, ptr1 + 3); if(strlen(ptr1 + 3) > 0) strcpy(banner, ptr1 + 3);
char portString[16] = {0};
sprintf(portString, "%d", port);
sprintf(log, "[SSH] <font color=\"#00a8ff\"> %s:%d </font><font color=\"#323232\">; Banner:</font> <font color=\"#9cff00\"> %s </font>", goodStr, port, banner); sprintf(log, "[SSH] <font color=\"#00a8ff\"> %s:%d </font><font color=\"#323232\">; Banner:</font> <font color=\"#9cff00\"> %s </font>", goodStr, port, banner);
sprintf(logEmit, "[SSH] <span style=\"color: #00a8ff;\"> %s:%d </span>", goodStr, port); sprintf(logEmit, "[SSH] <span style=\"color: #00a8ff;\"> %s:%d </span>", goodStr, port);
@ -1359,7 +1347,7 @@ void _saveSSH(const char *ip, int port, int size, const char *buffcpy)
const char *ptrl2 = strstr(buffcpy, "@"); const char *ptrl2 = strstr(buffcpy, "@");
lpsz = ptrl2 - ptrl1; lpsz = ptrl2 - ptrl1;
strncpy(passSSH, ptrl1 + 1, lpsz); strncpy(passSSH, ptrl1 + 1, lpsz);
fillGlobalLogData(ip, portString, std::to_string(size).c_str(), "[SSH service]", loginSSH, passSSH, "NULL", "UTF-8", "SSH"); fillGlobalLogData(ip, port, std::to_string(size).c_str(), "[SSH service]", loginSSH, passSSH, "NULL", "UTF-8", "SSH");
stt->doEmitionFoundData(QString::fromLocal8Bit(logEmit)); stt->doEmitionFoundData(QString::fromLocal8Bit(logEmit));
} }
else else
@ -1373,10 +1361,10 @@ void _saveSSH(const char *ip, int port, int size, const char *buffcpy)
}; };
} }
int Lexems::_filler(int p, const char* buffcpy, char* ip, int size, Lexems *lx) int Lexems::_filler(int p, const std::string buffcpy, char* ip, int size, Lexems *lx)
{ {
if( strstr(buffcpy, "SSH-2.0-OpenSSH") != NULL || if (Utils::ustrstr(buffcpy, "SSH-2.0-OpenSSH") != -1 ||
strstr(buffcpy, "SSH-2.0-mod_sftp") != NULL) Utils::ustrstr(buffcpy, "SSH-2.0-mod_sftp") != -1)
{ {
std::string sshBuff; std::string sshBuff;
int res = SSHAuth::SSHLobby(ip, p, &sshBuff); int res = SSHAuth::SSHLobby(ip, p, &sshBuff);
@ -1386,7 +1374,7 @@ int Lexems::_filler(int p, const char* buffcpy, char* ip, int size, Lexems *lx)
if(p == 22) if(p == 22)
{ {
_saveSSH(ip, p, size, buffcpy); _saveSSH(ip, p, size, buffcpy.c_str());
return -1; return -1;
}; };
@ -1397,15 +1385,14 @@ int Lexems::_filler(int p, const char* buffcpy, char* ip, int size, Lexems *lx)
ZeroMemory(ps.path, sizeof(ps.path)); ZeroMemory(ps.path, sizeof(ps.path));
char finalstr[TITLE_MAX_SIZE] = {0}; char finalstr[TITLE_MAX_SIZE] = {0};
char port[32] = {0};
int flag = 0; int flag = 0;
char cp[32] = {0}; char cp[32] = {0};
strcpy(cp, GetCodePage(buffcpy)); strcpy(cp, GetCodePage(buffcpy.c_str()));
flag = ContentFilter(buffcpy, p, ip, cp, size); flag = ContentFilter(buffcpy, p, ip, cp, size);
if(flag == -1 ) return -1; if(flag == -1 ) return -1;
strcpy(ps.headr, GetTitle(buffcpy)); strcpy(ps.headr, GetTitle(buffcpy.c_str()));
ps.flag = flag; ps.flag = flag;
char baPath[256] = {0}; char baPath[256] = {0};
@ -1414,7 +1401,7 @@ int Lexems::_filler(int p, const char* buffcpy, char* ip, int size, Lexems *lx)
std::vector<std::string> redirStrLst; std::vector<std::string> redirStrLst;
if(flag == 0 || flag == 3 || flag == 7 ) if(flag == 0 || flag == 3 || flag == 7 )
{ {
int rh = _header(ip, p, buffcpy, lx, &ps, &redirStrLst, size); int rh = _header(ip, p, buffcpy.c_str(), lx, &ps, &redirStrLst, size);
strcpy(cp, ps.codepage); strcpy(cp, ps.codepage);
if (rh == -1) { if (rh == -1) {
return -1; return -1;
@ -1431,8 +1418,6 @@ int Lexems::_filler(int p, const char* buffcpy, char* ip, int size, Lexems *lx)
strncpy(baPath, ps.path, (sz < 256 ? sz : 256)); strncpy(baPath, ps.path, (sz < 256 ? sz : 256));
}; };
sprintf(port, "%d", p);
if(strstr(finalstr, ps.headr) == NULL) strcat(finalstr, ps.headr); if(strstr(finalstr, ps.headr) == NULL) strcat(finalstr, ps.headr);
if (flag == -1 || flag == 6) { if (flag == -1 || flag == 6) {
return -1; return -1;
@ -1449,14 +1434,14 @@ int Lexems::_filler(int p, const char* buffcpy, char* ip, int size, Lexems *lx)
{ {
++PieBA; ++PieBA;
sprintf(log, "[FTP]:<font color=\"#0f62e2\">%s:%s</font>; Received: %d<a href=\"ftp://%s:%s@%s/\"><span style=\"color: #ff6600;\">ftp://%s:%s@%s</span></a> <font color=\"#43EC00\"><a href=\"http://%s\" style=\"color:#43EC00;\">[ROUTER]</a></font>%s", sprintf(log, "[FTP]:<font color=\"#0f62e2\">%s:%d</font>; Received: %d<a href=\"ftp://%s:%s@%s/\"><span style=\"color: #ff6600;\">ftp://%s:%s@%s</span></a> <font color=\"#43EC00\"><a href=\"http://%s\" style=\"color:#43EC00;\">[ROUTER]</a></font>%s",
ip, port, size, lps.login, lps.pass, ip, lps.login, lps.pass, ip, ip, ps.headr); ip, p, size, lps.login, lps.pass, ip, lps.login, lps.pass, ip, ip, ps.headr);
sprintf(logEmit, "[FTP]:<a href=\"ftp://%s:%s@%s/\"><span style=\"color: #ff6600;\">ftp://%s:%s@%s</span></a> <font color=\"#43EC00\"><a href=\"http://%s/\" style=\"color:#43EC00;\">[ROUTER]</a></font>", sprintf(logEmit, "[FTP]:<a href=\"ftp://%s:%s@%s/\"><span style=\"color: #ff6600;\">ftp://%s:%s@%s</span></a> <font color=\"#43EC00\"><a href=\"http://%s/\" style=\"color:#43EC00;\">[ROUTER]</a></font>",
lps.login, lps.pass, ip, lps.login, lps.pass, ip, ip); lps.login, lps.pass, ip, lps.login, lps.pass, ip, ip);
fputsf (log, flag, "FTP"); fputsf (log, flag, "FTP");
fillGlobalLogData(ip, port, std::to_string(size).c_str(), "[FTP service]", lps.login, lps.pass, "Router FTP detected.", cp, "FTP"); fillGlobalLogData(ip, p, std::to_string(size).c_str(), "[FTP service]", lps.login, lps.pass, "Router FTP detected.", cp, "FTP");
stt->doEmitionFoundData(QString::fromLocal8Bit(logEmit)); stt->doEmitionFoundData(QString::fromLocal8Bit(logEmit));
} }
@ -1464,14 +1449,14 @@ int Lexems::_filler(int p, const char* buffcpy, char* ip, int size, Lexems *lx)
{ {
++PieBA; ++PieBA;
sprintf(log, "[FTP]:<font color=\"#0f62e2\">%s:%s</font>; Received: %d<a href=\"ftp://%s:%s@%s/\"><span style=\"color: #ff6600;\">ftp://%s:%s@%s</span></a>%s", sprintf(log, "[FTP]:<font color=\"#0f62e2\">%s:%d</font>; Received: %d<a href=\"ftp://%s:%s@%s/\"><span style=\"color: #ff6600;\">ftp://%s:%s@%s</span></a>%s",
ip, port, size, lps.login, lps.pass, ip, lps.login, lps.pass, ip, ps.headr); ip, p, size, lps.login, lps.pass, ip, lps.login, lps.pass, ip, ps.headr);
sprintf(logEmit, "[FTP]:<a href=\"ftp://%s:%s@%s/\"><span style=\"color: #ff6600;\">ftp://%s:%s@%s</span></a> (F:%d)", sprintf(logEmit, "[FTP]:<a href=\"ftp://%s:%s@%s/\"><span style=\"color: #ff6600;\">ftp://%s:%s@%s</span></a> (F:%d)",
lps.login, lps.pass, ip, lps.login, lps.pass, ip, ps.directoryCount); lps.login, lps.pass, ip, lps.login, lps.pass, ip, ps.directoryCount);
fputsf(log, flag, "FTP"); fputsf(log, flag, "FTP");
fillGlobalLogData(ip, port, std::to_string(size).c_str(), "[FTP service]", lps.login, lps.pass, "NULL", cp, "FTP"); fillGlobalLogData(ip, p, 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));
@ -1644,10 +1629,10 @@ int Lexems::_filler(int p, const char* buffcpy, char* ip, int size, Lexems *lx)
++AnomC1; ++AnomC1;
const lopaStr &lps = BA::BALobby((string(ip) + "/~login").c_str(), p); const lopaStr &lps = BA::BALobby((string(ip) + "/~login").c_str(), p);
sprintf(log, "[HFS]:<a href=\"http://%s:%s/\"><span style=\"color: #a1a1a1;\">%s:%s</span></a><font color=\"#0084ff\"> T: </font><font color=\"#ff9600\">%s Pass: %s:%s</font>", sprintf(log, "[HFS]:<a href=\"http://%s:%d/\"><span style=\"color: #a1a1a1;\">%s:%d</span></a><font color=\"#0084ff\"> T: </font><font color=\"#ff9600\">%s Pass: %s:%s</font>",
ip, port, ip, port, finalstr, lps.login, lps.pass); ip, p, ip, p, finalstr, lps.login, lps.pass);
fillGlobalLogData(ip, port, std::to_string(size).c_str(), finalstr, lps.login, lps.pass, "HFS-FTP", cp, "Basic Authorization"); fillGlobalLogData(ip, p, std::to_string(size).c_str(), finalstr, lps.login, lps.pass, "HFS-FTP", cp, "Basic Authorization");
fputsf (log , flag, "HFS"); fputsf (log , flag, "HFS");
stt->doEmitionFoundData(QString::fromLocal8Bit(log)); stt->doEmitionFoundData(QString::fromLocal8Bit(log));
} }
@ -1661,15 +1646,15 @@ int Lexems::_filler(int p, const char* buffcpy, char* ip, int size, Lexems *lx)
} }
else if(flag == 10) else if(flag == 10)
{ {
_specWFBrute(ip, p, buffcpy, flag, baPath, "Web Form", "Web Form", cp, size, finalstr); _specWFBrute(ip, p, buffcpy.c_str(), flag, baPath, "Web Form", "Web Form", cp, size, finalstr);
} }
else if(flag == 2) else if(flag == 2)
{ {
putInFile(0, ip, port, size, "[OVERFLOW]", cp); putInFile(0, ip, p, size, "[OVERFLOW]", cp);
} }
else else
{ {
putInFile(flag, ip, port, size, finalstr, cp); putInFile(flag, ip, p, size, finalstr, cp);
}; };
return flag; return flag;
@ -2621,7 +2606,7 @@ int Lexems::_header(char *ip, int port, const char str[], Lexems *l, PathStr *ps
"] Rejecting in _header::Lowload_body (&lt;15b)"); "] Rejecting in _header::Lowload_body (&lt;15b)");
}; };
++Filt; ++filtered;
strcpy(ps->path, "/"); strcpy(ps->path, "/");
return -1; return -1;
}; };

View File

@ -131,10 +131,8 @@ public:
std::vector<std::string> *lst, int size); std::vector<std::string> *lst, int size);
int _filler(int port, int _filler(int port,
const char *buffcpy, const std::string buffcpy,
char* ip, char* ip,
int size, int size,
Lexems *lx); Lexems *lx);
}; };
extern std::string xcode(LPCSTR src, UINT srcCodePage, UINT dstCodePage);

View File

@ -21,11 +21,11 @@ void _getNewMsg()
char *ptr1 = NULL; char *ptr1 = NULL;
if(buffer.size() > 0) if(buffer.size() > 0)
{ {
if(Utils::ci_find_substr(buffer, std::string("\r\n\r\n")) != -1 if(Utils::ustrstr(buffer, std::string("\r\n\r\n")) != -1
&& Utils::ci_find_substr(buffer, std::string("404 Not Found")) == -1 && Utils::ustrstr(buffer, std::string("404 Not Found")) == -1
&& Utils::ci_find_substr(buffer, std::string("502 Bad Gateway")) == -1 && Utils::ustrstr(buffer, std::string("502 Bad Gateway")) == -1
&& Utils::ci_find_substr(buffer, std::string("400 Bad Request")) == -1 && Utils::ustrstr(buffer, std::string("400 Bad Request")) == -1
&& Utils::ci_find_substr(buffer, std::string("\r\n\r\nEmpty")) == -1 && Utils::ustrstr(buffer, std::string("\r\n\r\nEmpty")) == -1
) )
{ {
ptr1 = strstr((char*)buffer.c_str(), "\r\n\r\n"); ptr1 = strstr((char*)buffer.c_str(), "\r\n\r\n");

View File

@ -1,5 +1,4 @@
#include <QGridLayout> #include <QFileDialog>
#include <QFileDialog>
#include "nesca_3.h" #include "nesca_3.h"
#include "CheckKey_Th.h" #include "CheckKey_Th.h"
#include "DrawerTh_QoSScanner.h" #include "DrawerTh_QoSScanner.h"
@ -13,17 +12,9 @@
#include "DrawerTh_VoiceScanner.h" #include "DrawerTh_VoiceScanner.h"
#include "piestat.h" #include "piestat.h"
#include <QMenu> #include <QMenu>
#include <QGraphicsSceneContextMenuEvent>
#include <QDesktopWidget>
#include <QtMultimedia/qsound.h>
#include <QtMultimedia/qsoundeffect.h>
#include <qscrollbar.h>
#include <qdesktopservices.h> #include <qdesktopservices.h>
#include <qmessagebox.h> #include <qmessagebox.h>
#include "progressbardrawer.h" #include "progressbardrawer.h"
#include "externFunctions.h"
#include "externData.h"
#include "Threader.h"
#include "FileDownloader.h" #include "FileDownloader.h"
QDate date = QDate::currentDate(); QDate date = QDate::currentDate();
@ -43,18 +34,10 @@ bool smBit_5 = false;
bool smBit_6 = false; bool smBit_6 = false;
bool smBit_7 = false; bool smBit_7 = false;
bool smBit_8 = false; bool smBit_8 = false;
bool privateMsgFlag = false;
bool proxyEnabledFlag = false;
bool disableBlink = false;
char gVER[32] = {0}; char gVER[32] = {0};
int nickFlag;
int offlineFlag;
bool OnlineMsgSentFlag = false;
int globalPinger = 0; int globalPinger = 0;
int nesca_3::savedTabIndex = 0; int nesca_3::savedTabIndex = 0;
bool dFlag = false;
bool startFlag = false; bool startFlag = false;
bool trackerOK = true; bool trackerOK = true;
char trcPort[32] = {0}; char trcPort[32] = {0};
@ -83,7 +66,6 @@ ProgressbarDrawer *pbTh = new ProgressbarDrawer();
bool MapWidgetOpened = false; bool MapWidgetOpened = false;
bool globalScanFlag; bool globalScanFlag;
float QoSStep = 1; float QoSStep = 1;
int MaxDataVal = 1;
QGraphicsScene *sceneGrid; QGraphicsScene *sceneGrid;
QGraphicsScene *sceneGrid2; QGraphicsScene *sceneGrid2;
QGraphicsScene *sceneGraph; QGraphicsScene *sceneGraph;
@ -138,13 +120,8 @@ QVector<QString> NodeAddrs;
const nesca_3 *gthis; const nesca_3 *gthis;
bool BALogSwitched = false; bool BALogSwitched = false;
bool widgetIsHidden = false; bool widgetIsHidden = false;
bool blinkFlag = false;
bool printDelimiter = false;
int PhraseIndex = 0;
QList<QString> PhraseLog;
bool ME2ScanFlag = true, QoSScanFlag = false, VoiceScanFlag = false, PieStatFlag = false; bool ME2ScanFlag = true, QoSScanFlag = false, VoiceScanFlag = false, PieStatFlag = false;
QVector<qreal> dots; QVector<qreal> dots;
QVector<qreal> dotsThreads; QVector<qreal> dotsThreads;
QFont multiFontSmallFontPie; QFont multiFontSmallFontPie;
@ -745,11 +722,11 @@ void nesca_3::slotQoSAddLine()
float gHeight = ui->graphicLog->height(); float gHeight = ui->graphicLog->height();
float fact = (float)100 / (float)MaxDataVal; float fact = (float)100 / (float)DrawerTh_QoSScanner::MaxDataVal;
if(QoSStep > 268) if(QoSStep > 268)
{ {
MaxDataVal = 1; DrawerTh_QoSScanner::MaxDataVal = 1;
QoSStep = 1; QoSStep = 1;
gLOL0.clear(); gLOL0.clear();
gLOL1.clear(); gLOL1.clear();
@ -813,7 +790,7 @@ void nesca_3::slotQoSAddLine()
fnt.setFamily("Eurostile"); fnt.setFamily("Eurostile");
fnt.setPixelSize(10); fnt.setPixelSize(10);
QGraphicsTextItem *item = sceneUpper->addText("Max = " + QString::number(MaxDataVal), fnt); QGraphicsTextItem *item = sceneUpper->addText("Max = " + QString::number(DrawerTh_QoSScanner::MaxDataVal), fnt);
item->setX(215); item->setX(215);
item->setDefaultTextColor(Qt::white); item->setDefaultTextColor(Qt::white);
QOSWait = false; QOSWait = false;
@ -824,8 +801,8 @@ void nesca_3::slotQoSAddGrid()
sceneGrid->clear(); sceneGrid->clear();
int gWidth = ui->graphicLog->width(); int gWidth = ui->graphicLog->width();
if(MaxDataVal > 100) MaxDataVal = 100; if (DrawerTh_QoSScanner::MaxDataVal > 100) DrawerTh_QoSScanner::MaxDataVal = 100;
float fact = (float)100/(float)MaxDataVal; float fact = (float)100 / (float)DrawerTh_QoSScanner::MaxDataVal;
float th = 0; float th = 0;
for(int i = 0; i < 100; ++i) for(int i = 0; i < 100; ++i)
@ -1036,7 +1013,7 @@ void nesca_3::activateQoSScanBut()
PieStatFlag = false; PieStatFlag = false;
QoSStep = 1; QoSStep = 1;
MaxDataVal = 1; DrawerTh_QoSScanner::MaxDataVal = 1;
sceneGrid2->clear(); sceneGrid2->clear();
sceneGraph->clear(); sceneGraph->clear();
@ -1438,18 +1415,12 @@ bool nesca_3::eventFilter(QObject* obj, QEvent *event)
QKeyEvent* keyEvent = static_cast<QKeyEvent*>(event); QKeyEvent* keyEvent = static_cast<QKeyEvent*>(event);
if(keyEvent->modifiers() == Qt::ControlModifier) if(keyEvent->modifiers() == Qt::ControlModifier)
{ {
privateMsgFlag = true;
event->accept(); event->accept();
return true; return true;
}; };
return false; return false;
} }
else if (event->type() == QEvent::KeyRelease) else if (event->type() == QEvent::KeyRelease) return true;
{
privateMsgFlag = false;
event->accept();
return true;
};
return false; return false;
} }
else else
@ -1459,7 +1430,6 @@ bool nesca_3::eventFilter(QObject* obj, QEvent *event)
QKeyEvent* keyEvent = static_cast<QKeyEvent*>(event); QKeyEvent* keyEvent = static_cast<QKeyEvent*>(event);
if(keyEvent->modifiers() == Qt::ControlModifier) if(keyEvent->modifiers() == Qt::ControlModifier)
{ {
privateMsgFlag = true;
event->accept(); event->accept();
return true; return true;
}; };
@ -1467,7 +1437,6 @@ bool nesca_3::eventFilter(QObject* obj, QEvent *event)
} }
else if(event->type() == QEvent::KeyRelease) else if(event->type() == QEvent::KeyRelease)
{ {
privateMsgFlag = false;
event->accept(); event->accept();
return true; return true;
} }
@ -2699,79 +2668,6 @@ void _startMsgCheck()
mct->start(); mct->start();
} }
nesca_3::nesca_3(QWidget *parent) : QMainWindow(parent)
{
setWindowFlags ( Qt::FramelessWindowHint );
gthis = this;
ui->setupUi(this);
setSomeStyleArea();
ui->dataText->setOpenExternalLinks(true);
ui->dataText->setOpenLinks(false);
ui->rVerLabel->hide();
setSceneArea();
dots << 0.5 << 0.3 << 0.5 << 0.3;
dotsThreads << 0.1 << 0.2 << 0.1 << 0.2;
penAllThreads.setCapStyle(Qt::FlatCap);
penAllThreads.setDashPattern(dotsThreads);
penThreads.setCapStyle(Qt::FlatCap);
penThreads.setDashPattern(dotsThreads);
penBAThreads.setDashPattern(dots);
penBAThreads.setCapStyle(Qt::FlatCap);
penAllTargets.setCapStyle(Qt::FlatCap);
penTargets.setCapStyle(Qt::FlatCap);
penSaved.setCapStyle(Qt::FlatCap);
multiFontSmallFontPie.setFamily("small_fonts");
multiFontSmallFontPie.setPixelSize(9);
multiFontSmallFontArc.setFamily("small_fonts");
multiFontSmallFontArc.setPixelSize(10);
multiFontSmallFontArc.setUnderline(true);
ui->ipLabel->setFont(multiFontSmallFontArc);
tray = new QSystemTrayIcon(QIcon(":/nesca_3/nesca.ico"), this);
tray->hide();
SetValidators();
ConnectEvrthng();
QTime time = QTime::currentTime();
qsrand((uint)time.msec());
const std::string &gVERStr = GetVer();
strcpy(gVER, gVERStr.c_str());
ui->logoLabel->setToolTip("v3-" + QString(gVER));
ui->logoLabel->setStyleSheet("color:white; border: none;background-color:black;");
ui->newMessageLabel->setStyleSheet("color:rgba(255, 0, 0, 0);background-color: rgba(2, 2, 2, 0);");
CreateVerFile();
RestoreSession();
PhraseLog.push_back("");
dtHN->start();
dtME2->start();
adtHN->start();
#if defined(WIN32) || defined(_WIN32) || defined(__WIN32) && !defined(__CYGWIN__)
WSADATA wsda;
if (WSAStartup(0x0101, &wsda))
{
stt->doEmitionRedFoundData("WSAStartup failed.");
qApp->quit();
};
#endif
std::thread fuThread(FileDownloader::checkWebFiles);
fuThread.detach();
_startVerCheck();
_startMsgCheck();
qrp.setMinimal(true);
drawVerboseArcs(0);
}
void nesca_3::mousePressEvent(QMouseEvent *event) void nesca_3::mousePressEvent(QMouseEvent *event)
{ {
if (event->button() == Qt::LeftButton) { if (event->button() == Qt::LeftButton) {
@ -2783,7 +2679,6 @@ void nesca_3::mousePressEvent(QMouseEvent *event)
void nesca_3::mouseReleaseEvent(QMouseEvent * event) void nesca_3::mouseReleaseEvent(QMouseEvent * event)
{ {
if (event->modifiers() == Qt::ControlModifier) { if (event->modifiers() == Qt::ControlModifier) {
privateMsgFlag = false;
event->accept(); event->accept();
}; };
} }
@ -2798,7 +2693,7 @@ void nesca_3::mouseMoveEvent(QMouseEvent * event)
void nesca_3::exitButtonClicked() void nesca_3::exitButtonClicked()
{ {
STTTerminate(); STTTerminate();
while (__savingBackUpFile) Sleep(100); while (MainStarter::savingBackUpFile) Sleep(100);
#if defined(WIN32) || defined(_WIN32) || defined(__WIN32) && !defined(__CYGWIN__) #if defined(WIN32) || defined(_WIN32) || defined(__WIN32) && !defined(__CYGWIN__)
WSACleanup(); WSACleanup();
#endif #endif
@ -2994,7 +2889,7 @@ void nesca_3::PingTO_ChangeValue(QString str)
void nesca_3::ThreadDelay_ChangeValue(QString str) void nesca_3::ThreadDelay_ChangeValue(QString str)
{ {
gThreadDelay = str.toInt(); Threader::gThreadDelay = str.toInt();
} }
void nesca_3::MaxBrutingThr_ChangeValue(QString str) void nesca_3::MaxBrutingThr_ChangeValue(QString str)
@ -3091,6 +2986,78 @@ QString GetColorCode(int mode, QString str)
return result; return result;
} }
nesca_3::nesca_3(QWidget *parent) : QMainWindow(parent)
{
setWindowFlags(Qt::FramelessWindowHint);
gthis = this;
ui->setupUi(this);
setSomeStyleArea();
ui->dataText->setOpenExternalLinks(true);
ui->dataText->setOpenLinks(false);
ui->rVerLabel->hide();
setSceneArea();
dots << 0.5 << 0.3 << 0.5 << 0.3;
dotsThreads << 0.1 << 0.2 << 0.1 << 0.2;
penAllThreads.setCapStyle(Qt::FlatCap);
penAllThreads.setDashPattern(dotsThreads);
penThreads.setCapStyle(Qt::FlatCap);
penThreads.setDashPattern(dotsThreads);
penBAThreads.setDashPattern(dots);
penBAThreads.setCapStyle(Qt::FlatCap);
penAllTargets.setCapStyle(Qt::FlatCap);
penTargets.setCapStyle(Qt::FlatCap);
penSaved.setCapStyle(Qt::FlatCap);
multiFontSmallFontPie.setFamily("small_fonts");
multiFontSmallFontPie.setPixelSize(9);
multiFontSmallFontArc.setFamily("small_fonts");
multiFontSmallFontArc.setPixelSize(10);
multiFontSmallFontArc.setUnderline(true);
ui->ipLabel->setFont(multiFontSmallFontArc);
tray = new QSystemTrayIcon(QIcon(":/nesca_3/nesca.ico"), this);
tray->hide();
SetValidators();
ConnectEvrthng();
QTime time = QTime::currentTime();
qsrand((uint)time.msec());
const std::string &gVERStr = GetVer();
strcpy(gVER, gVERStr.c_str());
ui->logoLabel->setToolTip("v3-" + QString(gVER));
ui->logoLabel->setStyleSheet("color:white; border: none;background-color:black;");
ui->newMessageLabel->setStyleSheet("color:rgba(255, 0, 0, 0);background-color: rgba(2, 2, 2, 0);");
CreateVerFile();
RestoreSession();
dtHN->start();
dtME2->start();
adtHN->start();
#if defined(WIN32) || defined(_WIN32) || defined(__WIN32) && !defined(__CYGWIN__)
WSADATA wsda;
if (WSAStartup(0x0101, &wsda))
{
stt->doEmitionRedFoundData("WSAStartup failed.");
qApp->quit();
};
#endif
std::thread fuThread(FileDownloader::checkWebFiles);
fuThread.detach();
_startVerCheck();
_startMsgCheck();
qrp.setMinimal(true);
drawVerboseArcs(0);
}
nesca_3::~nesca_3() nesca_3::~nesca_3()
{ {
delete[] ui; delete[] ui;

View File

@ -15,28 +15,19 @@
#include <QSystemTrayIcon> #include <QSystemTrayIcon>
#include <QtGui/qevent.h> #include <QtGui/qevent.h>
#include <qthread.h> #include <qthread.h>
#include <qjsonobject.h>
#include <qjsonvalue.h>
#include <qjsonarray.h>
#include <qtextcodec.h> #include <qtextcodec.h>
#include <qjsondocument.h>
#include <libssh/libssh.h> #include <libssh/libssh.h>
#include "mainResources.h"
extern Ui::nesca_3Class *ui; extern Ui::nesca_3Class *ui;
extern bool widgetIsHidden, blinkFlag, disableBlink, QOSWait, extern bool widgetIsHidden, QOSWait,
ME2ScanFlag, QoSScanFlag, VoiceScanFlag, PieStatFlag, proxyEnabledFlag, ME2ScanFlag, QoSScanFlag, VoiceScanFlag, PieStatFlag,
smBit_8, smBit_7, smBit_6, smBit_5, smBit_4, smBit_3, smBit_2, smBit_1, printDelimiter; smBit_8, smBit_7, smBit_6, smBit_5, smBit_4, smBit_3, smBit_2, smBit_1;
extern float QoSStep; extern float QoSStep;
extern int MaxDataVal;
extern SOCKET lSock;
extern QVector<int> vAlivLst, vAnomLst, vWFLst, vSuspLst, vLowlLst, vBALst, vSSHLst, vOvrlLst, actLst; extern QVector<int> vAlivLst, vAnomLst, vWFLst, vSuspLst, vLowlLst, vBALst, vSSHLst, vOvrlLst, actLst;
extern QList<int> lstOfLabels; extern QList<int> lstOfLabels;
extern QSystemTrayIcon *tray; extern QSystemTrayIcon *tray;
extern void ShowMsgPopup(QString str);
class nesca_3 : public QMainWindow class nesca_3 : public QMainWindow
{ {
Q_OBJECT Q_OBJECT
@ -157,7 +148,6 @@ protected:
} }
else if (evt->button() == Qt::RightButton) else if (evt->button() == Qt::RightButton)
{ {
disableBlink = true;
ui->newMessageLabel->setStyleSheet("color:rgba(255, 0, 0, 0);background-color: rgba(2, 2, 2, 0);"); ui->newMessageLabel->setStyleSheet("color:rgba(255, 0, 0, 0);background-color: rgba(2, 2, 2, 0);");
this->hide(); this->hide();
}; };

View File

@ -1,135 +0,0 @@
#include "STh.h"
#include "mainResources.h"
#include "externData.h"
#include "externFunctions.h"
bool __savingBackUpFile = false;
int gThreadDelay = 10;
int gC = 0;
int gTimeOut = 3;
int PieAnomC1 = 0, PieBA = 0, PieSusp = 0, PieLowl = 0, PieWF = 0, PieSSH = 0;
int AnomC1 = 0, Filt = 0, Overl = 0, Lowl = 0, Alive = 0, saved = 0, Susp = 0, WF = 0, offlines = 0, ssh = 0;
int GlobalNegativeSize = 0;
int found = 0, indexIP = 0;
int gMode;
int MaxPass = 0, MaxLogin = 0, MaxTags = 0, MaxWFLogin = 0, MaxWFPass = 0, MaxSSHPass = 0;
int ipsstart[4], ipsend[4],
overallPorts,
octet[4];
int baCount = 0;
int gPingTimeout = 1;
int gMaxBrutingThreads = 50;
unsigned int Activity = 0;
double ips = 0;
char **GlobalNegatives = 0;
char **loginLst, **passLst;
char **wfLoginLst, **wfPassLst;
char **sshlpLst;
char saveEndIP[128] = { 0 };
char gTLD[128] = { 0 };
char gPorts[65536] = { 0 };
char currentIP[MAX_ADDR_LEN] = { 0 };
char finalIP[32] = { 0 };
bool ErrLogFirstTime = true;
bool gPingNScan = false;
volatile int gThreads;
volatile int cons = 0;
volatile int BrutingThrds = 0;
volatile int threads = 20;
unsigned char tl(unsigned char d)
{
if (d >= 192 && d <= 223)
{
return (unsigned char)(d + 32);
}
else
{
return tolower(d);
};
}
std::string toLowerStr(const char *str)
{
if (str != NULL) {
int tsz = strlen(str);
char *strr = new char[tsz + 1];
ZeroMemory(strr, tsz);
for (int i = 0; i < tsz; i++)
{
strr[i] = tl(str[i]);
};
memset(strr + tsz, '\0', 1);
std::string tstr = std::string(strr);
delete[]strr;
return tstr;
}
else return "";
}
QString GetNSErrorDefinition(const char *str, const char *elem)
{
const char *temp = strstr(str, elem);
if (temp != NULL)
{
char definition[128] = { 0 };
const char *firstComma = strstr(temp + strlen(elem) + 1, "\"");
const char *lastComma = strstr(firstComma + 1, "\"");
int sz = lastComma - firstComma - 1;
strncpy(definition, firstComma + 1, (sz < 128 ? sz : 128));
return QString(definition);
}
else return QString("No definition found!");
}
#if defined(WIN32) || defined(_WIN32) || defined(__WIN32) && !defined(__CYGWIN__)
unsigned char* ASCIItoUNICODE(unsigned char ch)
{
unsigned char Val[2];
if ((ch < 192) && (ch != 168) && (ch != 184)) { Val[0] = 0; Val[1] = ch; return Val; }
if (ch == 168) { Val[0] = 208; Val[1] = 129; return Val; }
if (ch == 184) { Val[0] = 209; Val[1] = 145; return Val; }
if (ch < 240) { Val[0] = 208; Val[1] = ch - 48; return Val; }
if (ch < 249) { Val[0] = 209; Val[1] = ch - 112; return Val; }
}
#endif
std::string xcode(LPCSTR src, UINT srcCodePage, UINT dstCodePage) {
std::string res;
#if defined(WIN32) || defined(_WIN32) || defined(__WIN32) && !defined(__CYGWIN__)
int wsize = MultiByteToWideChar(srcCodePage, 0, src, -1, 0, 0);
LPWSTR wbuf = (LPWSTR)new char[wsize * sizeof(WCHAR)];
MultiByteToWideChar(srcCodePage, 0, src, -1, wbuf, wsize);
int size = WideCharToMultiByte(dstCodePage, 0, wbuf, -1, 0, 0, 0, 0);
char * buf = (char *)new char[size];
WideCharToMultiByte(dstCodePage, 0, wbuf, -1, buf, size, 0, 0);
delete wbuf;
res.append(buf);
delete buf;
#else
unsigned int size = 0;
while (src[size++]!=0);
char * buf = (char *)new char[size];
unsigned char uni[16] = {0};
size=0;
while (src[size]!=0)
{
};
delete buf;
#endif
return res;
}

View File

@ -14,7 +14,7 @@ void PieStat::run()
AnomC1 = 0; AnomC1 = 0;
WF = 0; WF = 0;
baCount = 0; baCount = 0;
Filt = 0; filtered = 0;
Overl = 0; Overl = 0;
Lowl = 0; Lowl = 0;
Alive = 0; Alive = 0;

View File

@ -15,7 +15,7 @@ void _checkVer()
char *ptr1 = NULL; char *ptr1 = NULL;
if(buffer.size() > 0) if(buffer.size() > 0)
{ {
if(Utils::ci_find_substr(buffer, std::string("\r\n\r\n")) != -1) if(Utils::ustrstr(buffer, std::string("\r\n\r\n")) != -1)
{ {
ptr1 = strstr((char*)buffer.c_str(), "\r\n\r\n"); ptr1 = strstr((char*)buffer.c_str(), "\r\n\r\n");
if(strcmp(gVER, ptr1 + 4) != 0) if(strcmp(gVER, ptr1 + 4) != 0)

View File

@ -1 +1 @@
24B8E-5B2 24B90-5A6