BA+FTP+finder

This commit is contained in:
cora48 2015-03-17 17:30:53 +03:00
parent 235db21829
commit e144b2823d
14 changed files with 284 additions and 1194 deletions

View File

@ -23,7 +23,6 @@ lopaStr BA::_BABrute(const char *ip, const int port) {
strcpy(lps.login, "UNKNOWN"); strcpy(lps.login, "UNKNOWN");
for(int i = 0; i < MaxLogin; ++i) { for(int i = 0; i < MaxLogin; ++i) {
if(!globalScanFlag) return lps;
for (int j = 0; j < MaxPass; ++j) { for (int j = 0; j < MaxPass; ++j) {
if (!globalScanFlag) return lps; if (!globalScanFlag) return lps;
@ -31,7 +30,7 @@ lopaStr BA::_BABrute(const char *ip, const int port) {
Connector::nConnect(ip, port, &buffer, NULL, NULL, &lpString); Connector::nConnect(ip, port, &buffer, NULL, NULL, &lpString);
if(checkOutput(&buffer) != 0) { if(checkOutput(&buffer)) {
strcpy(lps.login, loginLst[i]); strcpy(lps.login, loginLst[i]);
strcpy(lps.pass, passLst[j]); strcpy(lps.pass, passLst[j]);
return lps; return lps;
@ -44,13 +43,12 @@ lopaStr BA::_BABrute(const char *ip, const int port) {
return lps; return lps;
} }
lopaStr BA::_BALobby(const char *ip, const int port) lopaStr BA::_BALobby(const char *ip, const int port) {
{ while(BrutingThrds >= gMaxBrutingThreads) Sleep(1000);
while(BrutingThrds >= gMaxBrutingThreads) Sleep(700);
BruteUtils::BConInc(); BruteUtils::BConInc();
const lopaStr &res = _BABrute(ip, port); const lopaStr &lps = _BABrute(ip, port);
BruteUtils::BConDec(); BruteUtils::BConDec();
return res; return lps;
} }

View File

@ -176,6 +176,7 @@ int _EstablishSSHConnection(char *host, int port, std::string *buffer, const cha
int sz = 0; int sz = 0;
char *ptr1 = 0; char *ptr1 = 0;
int res = -1; int res = -1;
for(int i = 0; i < MaxSSHPass; ++i) for(int i = 0; i < MaxSSHPass; ++i)
{ {
if(globalScanFlag == false) break; if(globalScanFlag == false) break;
@ -188,6 +189,7 @@ int _EstablishSSHConnection(char *host, int port, std::string *buffer, const cha
ZeroMemory(login, sizeof(login)); ZeroMemory(login, sizeof(login));
ZeroMemory(pass, sizeof(pass)); ZeroMemory(pass, sizeof(pass));
ZeroMemory(temp, sizeof(temp)); ZeroMemory(temp, sizeof(temp));
if(res == 0) if(res == 0)
{ {
if(i == 0) return -2; //Failhit if(i == 0) return -2; //Failhit
@ -199,6 +201,7 @@ int _EstablishSSHConnection(char *host, int port, std::string *buffer, const cha
BruteUtils::BConDec(); BruteUtils::BConDec();
return -2; return -2;
}; };
Sleep(500); Sleep(500);
}; };
BruteUtils::BConDec(); BruteUtils::BConDec();
@ -227,12 +230,10 @@ int my_trace(CURL *handle, curl_infotype type,
char *data, size_t size, char *data, size_t size,
void *userp) void *userp)
{ {
switch (type) { if (type == CURLINFO_HEADER_OUT) {
case CURLINFO_HEADER_OUT: { Activity += strlen(data);
data[strstr(data, "\r\n\r\n") - data] = '\0'; data[strstr(data, "\r\n\r\n") - data] = '\0';
stt->doEmitionAddOutData(QString(data)); stt->doEmitionAddOutData(QString(data));
break;
}
} }
return 0; return 0;
@ -251,6 +252,7 @@ int Connector::nConnect(const char *ip, const int port, std::string *buffer,
buffer->clear(); buffer->clear();
CURL *curl = curl_easy_init(); CURL *curl = curl_easy_init();
curl_easy_setopt(curl, CURLOPT_NOSIGNAL, 0L); curl_easy_setopt(curl, CURLOPT_NOSIGNAL, 0L);
int res = 0;
if (curl) if (curl)
{ {
@ -299,10 +301,11 @@ int Connector::nConnect(const char *ip, const int port, std::string *buffer,
if(lpString != NULL) { if(lpString != NULL) {
curl_easy_setopt(curl, CURLOPT_HTTPAUTH, (long)CURLAUTH_ANY); curl_easy_setopt(curl, CURLOPT_HTTPAUTH, (long)CURLAUTH_ANY);
curl_easy_setopt(curl, CURLOPT_USERPWD, lpString); //curl_easy_setopt(curl, CURLOPT_FTPLISTONLY, TRUE);
}; curl_easy_setopt(curl, CURLOPT_USERPWD, lpString->c_str());
};//
curl_easy_perform(curl); if(curl_easy_perform(curl) != CURLE_OK) return -1;
curl_easy_cleanup(curl); curl_easy_cleanup(curl);
} else { } else {
stt->doEmitionRedFoundData("Curl error."); stt->doEmitionRedFoundData("Curl error.");
@ -310,8 +313,11 @@ int Connector::nConnect(const char *ip, const int port, std::string *buffer,
}; };
if(MapWidgetOpened) stt->doEmitionAddIncData(QString(ip), QString(buffer->c_str())); if(MapWidgetOpened) stt->doEmitionAddIncData(QString(ip), QString(buffer->c_str()));
Activity += buffer->size();
return buffer->size(); return buffer->size();
} }
int Connector::_ConnectToPort(char *ip, int port, char *hl) int Connector::_ConnectToPort(char *ip, int port, char *hl)
{ {
if(gPingNScan) if(gPingNScan)

View File

@ -35,11 +35,11 @@ void MakePolygonLine(int gWidth)
bool state = stt->isRunning(); bool state = stt->isRunning();
for(int i = 1; i < 130; ++i) for(int i = 1; i < 130; ++i)
{ {
x = qrand() % 4 + 2 + i; x = qrand() % 4 + i;
xtx = x + tx; xtx = x + tx;
if(xtx > 1 && xtx < 31) if(xtx > 1 && xtx < 31)
{ {
qp = QPointF(xtx, state ? qrand() % 3 - 3 + ME2YPOS - AnomC1 * 2 - fact1 : ME2YPOS); qp = QPointF(xtx, state ? qrand() % 3 + ME2YPOS - AnomC1 * 2 - fact1 : ME2YPOS);
if(AnomC1 > 0) if(AnomC1 > 0)
{ {
if(xtx < 16 ) fact1+=2; if(xtx < 16 ) fact1+=2;
@ -49,7 +49,7 @@ void MakePolygonLine(int gWidth)
if(xtx > 34 && xtx < 72) if(xtx > 34 && xtx < 72)
{ {
qp = QPointF(xtx, state ? qrand() % 3 - 3 + ME2YPOS - WF * 2 - fact2 : ME2YPOS); qp = QPointF(xtx, state ? qrand() % 3 + ME2YPOS - WF * 2 - fact2 : ME2YPOS);
if(WF > 0) if(WF > 0)
{ {
@ -60,7 +60,7 @@ void MakePolygonLine(int gWidth)
if(xtx > 74 && xtx < 112) if(xtx > 74 && xtx < 112)
{ {
qp = QPointF(xtx, state ? qrand() % 3 - 3 + ME2YPOS - BA * 2 - fact3 : ME2YPOS); qp = QPointF(xtx, state ? qrand() % 3 + ME2YPOS - BA * 2 - fact3 : ME2YPOS);
if(BA > 0) if(BA > 0)
{ {
@ -71,7 +71,7 @@ void MakePolygonLine(int gWidth)
if(xtx > 114 && xtx < 152) if(xtx > 114 && xtx < 152)
{ {
qp = QPointF(xtx, state ? qrand() % 3 - 3 + ME2YPOS - Susp * 2 - fact4 : ME2YPOS); qp = QPointF(xtx, state ? qrand() % 3 + ME2YPOS - Susp * 2 - fact4 : ME2YPOS);
if(Susp > 0) if(Susp > 0)
{ {
@ -82,7 +82,7 @@ void MakePolygonLine(int gWidth)
if(xtx > 154 && xtx < 192) if(xtx > 154 && xtx < 192)
{ {
qp = QPointF(xtx, state ? qrand() % 3 - 3 + ME2YPOS - Overl * 2 - fact5 : ME2YPOS); qp = QPointF(xtx, state ? qrand() % 3 + ME2YPOS - Overl * 2 - fact5 : ME2YPOS);
if(Overl > 0) if(Overl > 0)
{ {
@ -93,7 +93,7 @@ void MakePolygonLine(int gWidth)
if(xtx > 194 && xtx < 232) if(xtx > 194 && xtx < 232)
{ {
qp = QPointF(xtx, state ? qrand() % 3 - 3 + ME2YPOS - Lowl * 2 - fact6 : ME2YPOS); qp = QPointF(xtx, state ? qrand() % 3 + ME2YPOS - Lowl * 2 - fact6 : ME2YPOS);
if(Lowl > 0) if(Lowl > 0)
{ {
@ -104,12 +104,12 @@ void MakePolygonLine(int gWidth)
if(xtx > 234 && xtx < 269) if(xtx > 234 && xtx < 269)
{ {
qp = QPointF(xtx, state ? qrand() % 3 - 3 + ME2YPOS - Alive * 2 - fact7 : ME2YPOS); qp = QPointF(xtx, state ? qrand() % 3 + ME2YPOS - Alive * 2 - fact7 : ME2YPOS);
if(Alive > 0) if(Alive > 0)
{ {
if(xtx < 252 ) fact7+=2; if(xtx < 252 ) fact7+=1;
else fact7-=2; else fact7-=1;
}; };
}; };

View File

@ -1,7 +1,7 @@
#ifndef DRAWERTH_ME2SCANNER_H #ifndef DRAWERTH_ME2SCANNER_H
#define DRAWERTH_ME2SCANNER_H #define DRAWERTH_ME2SCANNER_H
#define ME2YPOS 100 #define ME2YPOS 97
#define ME2GRADPOS 10 #define ME2GRADPOS 10
#include "STh.h" #include "STh.h"

View File

@ -3,10 +3,7 @@
bool FTPA::checkOutput(const string *buffer) { bool FTPA::checkOutput(const string *buffer) {
//Login or password incorrect! //Login or password incorrect!
if(Utils::ci_find_substr(*buffer, "200 ok") != -1 || if(Utils::ci_find_substr(*buffer, "230") != -1) {
Utils::ci_find_substr(*buffer, "http/1.0 200") != -1 ||
Utils::ci_find_substr(*buffer, "http/1.1 200") != -1
) {
return true; return true;
} }
@ -36,9 +33,9 @@ lopaStr FTPA::_FTPBrute(const char *ip, const int port, const PathStr *ps) {
lpString = string(loginLst[i]) + ":" + string(passLst[j]); lpString = string(loginLst[i]) + ":" + string(passLst[j]);
Connector::nConnect(ip, port, &buffer, NULL, NULL, &lpString); Connector::nConnect((string("ftp://") + string(ip)).c_str(), port, &buffer, NULL, NULL, &lpString);
if(checkOutput(&buffer) != 0) { if(checkOutput(&buffer)) {
strcpy(lps.login, loginLst[i]); strcpy(lps.login, loginLst[i]);
strcpy(lps.pass, passLst[j]); strcpy(lps.pass, passLst[j]);
return lps; return lps;
@ -51,8 +48,8 @@ lopaStr FTPA::_FTPBrute(const char *ip, const int port, const PathStr *ps) {
return lps; return lps;
} }
lopaStr FTPA::_FTPLobby(const char *ip, const int port, const PathStr *ps){ lopaStr FTPA::_FTPLobby(const char *ip, const int port, const PathStr *ps) {
while(BrutingThrds >= gMaxBrutingThreads) Sleep(700); while(BrutingThrds >= gMaxBrutingThreads) Sleep(1000);
BruteUtils::BConInc(); BruteUtils::BConInc();
const lopaStr &lps = _FTPBrute(ip, port, ps); const lopaStr &lps = _FTPBrute(ip, port, ps);

21
Threader.cpp Normal file
View File

@ -0,0 +1,21 @@
#include <Threader.h>
std::vector<ThreadStruct> Threader::threadPool;
void Threader::createThreadPool(int poolSize, void *func, ST *st) {
for(int i = 0; i < poolSize; ++i) {
pthread_t thrc;
pthread_create(&thrc, NULL, (void *(*)(void*))func, st);
ThreadStruct threadStruct {
&thrc,
false
};
threadPool.push_back(threadStruct);
}
}
void Threader::fireThread(ST *st) {
}

21
Threader.h Normal file
View File

@ -0,0 +1,21 @@
#ifndef THREADER_H
#define THREADER_H
#include <mainResources.h>
struct ThreadStruct{
pthread_t *handler;
bool busy;
};
class Threader {
private:
static std::vector<ThreadStruct> threadPool;
public:
static void createThreadPool(int poolSize, void *func, ST *st);
static void fireThread(ST *st);
static pthread_t getFreeThread();
};
#endif // THREADER_H

File diff suppressed because it is too large Load Diff

View File

@ -456,15 +456,15 @@ int __checkFileExistence(int flag)
{ {
char fileName[64] = {0}; char fileName[64] = {0};
if(flag == 666 || flag == 350) strcpy(fileName, "./result_files/STRANGE_ERROR.html"); if(flag == 666 || flag == 350) strcpy(fileName, "./"RESULT_DIR_NAME"/STRANGE_ERROR.html");
else if(flag == -22) strcpy(fileName, "./result_files/ssh.html"); else if(flag == -22) strcpy(fileName, "./"RESULT_DIR_NAME"/ssh.html");
else if(flag == 0 || flag == 15 || flag == -10) strcpy(fileName, "./result_files/strange.html"); else if(flag == 0 || flag == 15 || flag == -10) strcpy(fileName, "./"RESULT_DIR_NAME"/strange.html");
else if(flag == 3) strcpy(fileName, "./result_files/other.html"); else if(flag == 3) strcpy(fileName, "./"RESULT_DIR_NAME"/other.html");
else if(flag == 7) strcpy(fileName, "./result_files/low_loads.html"); else if(flag == 7) strcpy(fileName, "./"RESULT_DIR_NAME"/low_loads.html");
else if(flag == 10) strcpy(fileName, "./result_files/LoginForms.html"); else if(flag == 10) strcpy(fileName, "./"RESULT_DIR_NAME"/LoginForms.html");
else if(flag == 16) strcpy(fileName, "./result_files/FTP.html"); else if(flag == 16) strcpy(fileName, "./"RESULT_DIR_NAME"/FTP.html");
else if(flag >= 17 || flag == 11 || flag == 12 else if(flag >= 17 || flag == 11 || flag == 12
|| flag == 13 || flag == 14 || flag == 1) strcpy(fileName, "./result_files/Basicauth.html"); || flag == 13 || flag == 14 || flag == 1) strcpy(fileName, "./"RESULT_DIR_NAME"/Basicauth.html");
FILE *f = fopen(fileName, "r"); FILE *f = fopen(fileName, "r");
if(f == NULL) return true; if(f == NULL) return true;
@ -493,39 +493,39 @@ void fputsf(char *text, int flag, char *msg)
if(flag == 0 || flag == 15 || flag == -10) if(flag == 0 || flag == 15 || flag == -10)
{ {
if(ftsAnom) ftsAnom = __checkFileExistence(flag); if(ftsAnom) ftsAnom = __checkFileExistence(flag);
file = fopen("./result_files/strange.html", "a"); file = fopen("./"RESULT_DIR_NAME"/strange.html", "a");
} }
else if(flag == 3) else if(flag == 3)
{ {
if(ftsOther) ftsOther = __checkFileExistence(flag); if(ftsOther) ftsOther = __checkFileExistence(flag);
file = fopen("./result_files/other.html", "a"); file = fopen("./"RESULT_DIR_NAME"/other.html", "a");
} }
else if(flag == -22) else if(flag == -22)
{ {
if(ftsSSH) ftsSSH = __checkFileExistence(flag); if(ftsSSH) ftsSSH = __checkFileExistence(flag);
file = fopen("./result_files/SSH.html", "a"); file = fopen("./"RESULT_DIR_NAME"/SSH.html", "a");
} }
else if(flag == 7) else if(flag == 7)
{ {
if(ftsLL) ftsLL = __checkFileExistence(flag); if(ftsLL) ftsLL = __checkFileExistence(flag);
file = fopen("./result_files/low_loads.html", "a"); file = fopen("./"RESULT_DIR_NAME"/low_loads.html", "a");
} }
else if(flag == 10) else if(flag == 10)
{ {
if(ftsLF) ftsLF = __checkFileExistence(flag); if(ftsLF) ftsLF = __checkFileExistence(flag);
file = fopen("./result_files/LoginForms.html", "a"); file = fopen("./"RESULT_DIR_NAME"/LoginForms.html", "a");
} }
else if(flag == 16) else if(flag == 16)
{ {
if(ftsFTP) ftsFTP = __checkFileExistence(flag); if(ftsFTP) ftsFTP = __checkFileExistence(flag);
file = fopen("./result_files/FTP.html", "a"); file = fopen("./"RESULT_DIR_NAME"/FTP.html", "a");
} }
else if(flag >= 17 || flag == 11 || flag == 12 else if(flag >= 17 || flag == 11 || flag == 12
|| flag == 13 || flag == 14 || flag == 1 || flag == 13 || flag == 14 || flag == 1
) )
{ {
if(ftsBA) ftsBA = __checkFileExistence(flag); if(ftsBA) ftsBA = __checkFileExistence(flag);
file = fopen("./result_files/Basicauth.html", "a"); file = fopen("./"RESULT_DIR_NAME"/Basicauth.html", "a");
} }
else else
{ {
@ -1718,7 +1718,8 @@ int redirectReconnect(char *cookie, char *ip, int port, char *str, Lexems *ls, P
{ {
tempPort = 443; tempPort = 443;
char *ptr1 = strstri(str, "https://"); char *ptr1 = strstri(str, "https://");
char *ptr2 = _findFirst(str + 8, ":/?"); char *ptr2 = _findFirst(ptr1 + 8, ":/?");
if(ptr2 != NULL) if(ptr2 != NULL)
{ {
int sz = ptr2 - ptr1 - 8; int sz = ptr2 - ptr1 - 8;
@ -1829,7 +1830,7 @@ int redirectReconnect(char *cookie, char *ip, int port, char *str, Lexems *ls, P
{ {
tempPort = 80; tempPort = 80;
char *ptr1 = strstri(str, "http://"); char *ptr1 = strstri(str, "http://");
char *ptr2 = _findFirst(str + 7, ":/?"); char *ptr2 = _findFirst(ptr1 + 7, ":/?");
if(ptr2 != NULL) if(ptr2 != NULL)
{ {
@ -2260,6 +2261,73 @@ int Lexems::_header(char *ip, int port, const char str[], Lexems *l, PathStr *ps
|| strstri(str, "top.htm?") != NULL || strstri(str, "top.htm?") != NULL
) strcat(finalstr, " [?][SecCam detected]"); ) strcat(finalstr, " [?][SecCam detected]");
if(strstri(str, "http-equiv=\"refresh\"") != NULL
|| strstri(str, "http-equiv=refresh") != NULL
|| strstri(str, "http-equiv='refresh'") != NULL
)
{
char *temp = NULL;
char *strTmp = NULL;
if(strstri(str, "http-equiv=\"refresh\"") != NULL) strTmp = strstri(str, "http-equiv=\"refresh\"");
else if(strstri(str, "http-equiv=refresh") != NULL) strTmp = strstri(str, "http-equiv=refresh");
else if(strstri(str, "http-equiv='refresh'") != NULL) strTmp = strstri(str, "http-equiv='refresh'");
if(strstri(strTmp, "url=") != NULL )
{
if((int)(strstri(strTmp, "url=") - strTmp) < 100)
{
temp = strstri(strTmp, "url=");
char *temp2 = NULL, temp3[128] = {0};
int sz = 0;
if(temp[4] == '"' || temp[4] == '\'' || temp[4] == ' ' || temp[4] == '\n' || temp[4] == '\r')
{
temp2 = _findFirst(temp + 6, " \n>\"'");
if(temp2 != NULL)
{
sz = (int)(temp2 - temp) - 5;
strncpy(temp3, (char*)(temp + 5), (sz < 128 ? sz : 127));
};
}
else
{
temp2 = _findFirst(temp + 4, " \n>\"'");
if(temp2 != NULL)
{
sz = (int)(temp2 - temp) - 4;
strncpy(temp3, (char*)(temp + 4), sz < 128 ? sz : 127);
};
};
if(strstri(temp3, "http://") == NULL && strstri(temp3, "https://") == NULL)
{
if(temp3[0] != '.')
{
if(temp3[0] != '/')
{
char temp4[128] = {0};
strcpy(temp4, "/");
strncat(temp4, temp3, 127);
strncpy(temp3, temp4, 128);
};
};
};
redirectStr = std::string(temp3);
if(std::find(redirStrLst->begin(), redirStrLst->end(), redirectStr) == redirStrLst->end())
{
redirStrLst->push_back(redirectStr);
return redirectReconnect(ps->cookie, ip, port, temp3, l, ps, redirStrLst);
} return -1;
strcat(ps->headr, " ");
return -2;
};
strcat(ps->headr, finalstr);
strcat(ps->headr, " ");
return 0;
};
};
if(strstri(str, "<script") != NULL) if(strstri(str, "<script") != NULL)
{ {
if(strstri(str, "document.cookie") != NULL) if(strstri(str, "document.cookie") != NULL)

View File

@ -86,6 +86,11 @@ typedef int BOOL;
#define MAX_ADDR_LEN 128 #define MAX_ADDR_LEN 128
#define TITLE_MAX_SIZE 512 #define TITLE_MAX_SIZE 512
#define COOKIE_MAX_SIZE 1024 #define COOKIE_MAX_SIZE 1024
#define RESULT_DIR_NAME "./result_files-" __DATE__
typedef struct {
char argv[MAX_ADDR_LEN];
} ST;
struct PathStr{ struct PathStr{
char codepage[32]; char codepage[32];

View File

@ -43,7 +43,8 @@ SOURCES +=\
Utils.cpp \ Utils.cpp \
BruteUtils.cpp \ BruteUtils.cpp \
BasicAuth.cpp \ BasicAuth.cpp \
FTPAuth.cpp FTPAuth.cpp \
Threader.cpp
HEADERS += ActivityDrawerTh_HorNet.h \ HEADERS += ActivityDrawerTh_HorNet.h \
@ -73,7 +74,8 @@ HEADERS += ActivityDrawerTh_HorNet.h \
Connector.h \ Connector.h \
BasicAuth.h \ BasicAuth.h \
BruteUtils.h \ BruteUtils.h \
FTPAuth.h FTPAuth.h \
Threader.h
FORMS += nesca_3.ui FORMS += nesca_3.ui

View File

@ -2190,6 +2190,8 @@ void nesca_3::slotShowNicks()
QRegExp _rOutProt(" HTTP/1.\\d+"); QRegExp _rOutProt(" HTTP/1.\\d+");
QRegExp _rOutPath(" /(\\w|\\.|,|/|:|-|_|\\?|!|\\@|#|\\$|%|\\^|&|\\*|\\(|\\)|=|\\+|<|>|;|:|\"|'|~|\\[|\\])* "); QRegExp _rOutPath(" /(\\w|\\.|,|/|:|-|_|\\?|!|\\@|#|\\$|%|\\^|&|\\*|\\(|\\)|=|\\+|<|>|;|:|\"|'|~|\\[|\\])* ");
QRegExp _rOutHost("Host: ((\\w|\\d|\\.|:|/)*)\\r\\n"); QRegExp _rOutHost("Host: ((\\w|\\d|\\.|:|/)*)\\r\\n");
QRegExp qrp("\\n(.+):");
void nesca_3::slotOutData(QString str) void nesca_3::slotOutData(QString str)
{ {
if(SendData != NULL) if(SendData != NULL)
@ -2203,19 +2205,8 @@ void nesca_3::slotOutData(QString str)
str.replace("HTTP ", "<font color=\"GoldenRod\">HTTP </font>"); str.replace("HTTP ", "<font color=\"GoldenRod\">HTTP </font>");
str.replace("GET ", "<font color=\"GoldenRod\">GET </font>"); str.replace("GET ", "<font color=\"GoldenRod\">GET </font>");
str.replace("POST ", "<font color=\"GoldenRod\">POST </font>"); str.replace("POST ", "<font color=\"GoldenRod\">POST </font>");
str.replace("Host: ", "<font color=\"GoldenRod\">Host: </font>"); str.replace(qrp, "<br><font color=\"GoldenRod\">\\1:</font>");
str.replace("Cookie: ", "<font color=\"GoldenRod\">Cookie: </font>"); str.replace(QRegExp("(ftp:.+@)"), "<font color=\"Crimson\">\\1</font>");
str.replace("Accept-Language:", "<font color=\"GoldenRod\">Accept-Language:</font>");
str.replace("Accept-Charset:", "<font color=\"GoldenRod\">Accept-Charset:</font>");
str.replace("Accept-Encoding:", "<font color=\"GoldenRod\">Accept-Encoding:</font>");
str.replace("Accept:", "<font color=\"GoldenRod\">Accept:</font>");
str.replace("User-Agent:", "<font color=\"GoldenRod\">User-Agent:</font>");
str.replace("Proxy-Connection:", "<font color=\"GoldenRod\">Proxy-Connection:</font>");
str.replace("Connection:", "<font color=\"GoldenRod\">Connection:</font>");
str.replace("Content-Length:", "<font color=\"GoldenRod\">Content-Length:</font>");
str.replace("Authorization:", "<font color=\"GoldenRod\">Authorization:</font>");
str.replace("X-Nescav3:", "<font color=\"GoldenRod\">X-Nescav3:</font>");
str.replace("Referer:", "<font color=\"GoldenRod\">Referer:</font>");
_rOutProt.indexIn(str); _rOutProt.indexIn(str);
prot = _rOutProt.cap(0); prot = _rOutProt.cap(0);
@ -3009,13 +3000,12 @@ void nesca_3::saveOptions()
_SaveBackupToFile(); _SaveBackupToFile();
} }
QString loadNescaSetup(char *resStr, char *option) { QString loadNescaSetup(const char *resStr, const char *option) {
char *lex = NULL char *lex = NULL;
;
if(strstr(resStr, option) != NULL) if(strstr(resStr, option) != NULL)
{ {
lex = strstr(resStr, option) + strlen(option); lex = (char*)(strstr(resStr, option) + strlen(option));
if(strlen(lex) > 1) if(strlen(lex) > 1)
{ {
@ -3026,6 +3016,12 @@ QString loadNescaSetup(char *resStr, char *option) {
return ""; return "";
} }
void setUIText(char *field, QLineEdit *qle, const char *resStr) {
if (strstr(resStr, field) != NULL) {
QString intermediateString = loadNescaSetup(resStr, field).simplified();
intermediateString.length() > 0 ? qle->setText(intermediateString) : (void)NULL;
}
}
void RestoreSession() void RestoreSession()
{ {
FILE *resFile = fopen("restore", "r"); FILE *resFile = fopen("restore", "r");
@ -3040,7 +3036,6 @@ void RestoreSession()
{ {
if(strstr(resStr, "[SESSION]:") != NULL) if(strstr(resStr, "[SESSION]:") != NULL)
{ {
lex = strtok(strstr(resStr, "[SESSION]:") + strlen("[SESSION]:"), " "); lex = strtok(strstr(resStr, "[SESSION]:") + strlen("[SESSION]:"), " ");
gMode = atoi(lex); gMode = atoi(lex);
lex = strtok(NULL, " "); lex = strtok(NULL, " ");
@ -3140,10 +3135,10 @@ void RestoreSession()
}; };
}; };
if (strstr(resStr, "[NDBSERVER]:") != NULL) ui->lineTrackerSrv->setText(loadNescaSetup(resStr, "[NDBSERVER]:").simplified()); setUIText("[NDBSERVER]:", ui->lineTrackerSrv, resStr);
else if (strstr(resStr, "[NDBSCRIPT]:") != NULL) ui->lineTrackerScr->setText(loadNescaSetup(resStr, "[NDBSCRIPT]:").simplified()); setUIText("[NDBSCRIPT]:", ui->lineTrackerScr, resStr);
else if (strstr(resStr, "[NDBPORT]:") != NULL) ui->trcSrvPortLine->setText(loadNescaSetup(resStr, "[NDBPORT]:").simplified()); setUIText("[NDBPORT]:", ui->trcSrvPortLine, resStr);
else if (strstr(resStr, "[PING]:") != NULL) { if (strstr(resStr, "[PING]:") != NULL) {
lex = strstr(resStr, "[PING]:") + strlen("[PING]:"); lex = strstr(resStr, "[PING]:") + strlen("[PING]:");
if (strlen(lex) > 1) if (strlen(lex) > 1)
@ -3152,9 +3147,9 @@ void RestoreSession()
ui->pingingOnOff->setChecked(strcmp(lex, "true") == 0 ? true : false); ui->pingingOnOff->setChecked(strcmp(lex, "true") == 0 ? true : false);
}; };
} }
else if (strstr(resStr, "[PING_TO]:") != NULL) ui->PingTO->setText(loadNescaSetup(resStr, "[PING_TO]:").simplified()); setUIText("[PING_TO]:", ui->PingTO, resStr);
else if (strstr(resStr, "[THREAD_DELAY]:") != NULL) ui->threadDelayBox->setText(loadNescaSetup(resStr, "[THREAD_DELAY]:").simplified()); setUIText("[THREAD_DELAY]:", ui->threadDelayBox, resStr);
else if (strstr(resStr, "[TIMEOUT]:") != NULL) { if (strstr(resStr, "[TIMEOUT]:") != NULL) {
const QString &tempLex = loadNescaSetup(resStr, "[TIMEOUT]:"); const QString &tempLex = loadNescaSetup(resStr, "[TIMEOUT]:");
if(tempLex.toInt() > 0) { if(tempLex.toInt() > 0) {
ui->iptoLine_value->setText(tempLex); ui->iptoLine_value->setText(tempLex);
@ -3162,15 +3157,16 @@ void RestoreSession()
ui->iptoLine_value_3->setText(tempLex); ui->iptoLine_value_3->setText(tempLex);
} }
} }
else if (strstr(resStr, "[MAXBTHR]:") != NULL) ui->maxBrutingThrBox->setText(loadNescaSetup(resStr, "[MAXBTHR]:").simplified()); setUIText("[MAXBTHR]:", ui->maxBrutingThrBox, resStr);
else if (strstr(resStr, "[PERSKEY]:") != NULL) ui->linePersKey->setText(loadNescaSetup(resStr, "[PERSKEY]:").simplified()); setUIText("[PERSKEY]:", ui->linePersKey, resStr);
else if (strstr(resStr, "[IRCSERVER]:") != NULL) ui->ircServerBox->setText(loadNescaSetup(resStr, "[IRCSERVER]:").simplified()); setUIText("[IRCSERVER]:", ui->ircServerBox, resStr);
else if (strstr(resStr, "[IRCPORT]:") != NULL) ui->serverPortBox->setText(loadNescaSetup(resStr, "[IRCPORT]:").simplified()); setUIText("[IRCPORT]:", ui->serverPortBox, resStr);
else if (strstr(resStr, "[IRCPROXY]:") != NULL) ui->ircProxy->setText(loadNescaSetup(resStr, "[IRCPROXY]:").simplified()); setUIText("[IRCPROXY]:", ui->ircProxy, resStr);
else if (strstr(resStr, "[IRCPROXYPORT]:") != NULL) ui->ircProxyPort->setText(loadNescaSetup(resStr, "[IRCPROXYPORT]:").simplified()); setUIText("[IRCPROXYPORT]:", ui->ircProxyPort, resStr);
else if (strstr(resStr, "[SYSTEMPROXYIP]:") != NULL) ui->systemProxyIP->setText(loadNescaSetup(resStr, "[SYSTEMPROXYIP]:").simplified()); setUIText("[SYSTEMPROXYIP]:", ui->systemProxyIP, resStr);
else if (strstr(resStr, "[SYSTEMPROXYPORT]:") != NULL) ui->systemProxyPort->setText(loadNescaSetup(resStr, "[SYSTEMPROXYPORT]:").simplified()); setUIText("[SYSTEMPROXYPORT]:", ui->systemProxyPort, resStr);
else if (strstr(resStr, "[IRCNICK]:") != NULL) ui->ircNickBox->setText(loadNescaSetup(resStr, "[IRCNICK]:").simplified()); setUIText("[IRCNICK]:", ui->ircNickBox, resStr);
ZeroMemory(resStr, sizeof(resStr)); ZeroMemory(resStr, sizeof(resStr));
}; };
@ -3203,11 +3199,11 @@ const char *GetVer()
if(__DATE__[0] == 'J' && __DATE__[1] == 'a') dver += 1; if(__DATE__[0] == 'J' && __DATE__[1] == 'a') dver += 1;
else if(__DATE__[0] == 'F') dver += 2; else if(__DATE__[0] == 'F') dver += 2;
else if(__DATE__[0] == 'M' && __DATE__[1] == 'a' && __DATE__[2] == 'r') dver += 3; else if(__DATE__[0] == 'M' && __DATE__[2] == 'r') dver += 3;
else if(__DATE__[0] == 'A' && __DATE__[1] == 'p') dver += 4; else if(__DATE__[0] == 'A' && __DATE__[1] == 'p') dver += 4;
else if(__DATE__[0] == 'M' && __DATE__[1] == 'a' && __DATE__[2] == 'y') dver += 5; else if(__DATE__[0] == 'M' && __DATE__[2] == 'y') dver += 5;
else if(__DATE__[0] == 'J' && __DATE__[1] == 'u' && __DATE__[2] == 'n') dver += 6; else if(__DATE__[0] == 'J' && __DATE__[2] == 'n') dver += 6;
else if(__DATE__[0] == 'J' && __DATE__[1] == 'u' && __DATE__[2] == 'l') dver += 7; else if(__DATE__[0] == 'J' && __DATE__[2] == 'l') dver += 7;
else if(__DATE__[0] == 'A' && __DATE__[1] == 'u') dver += 8; else if(__DATE__[0] == 'A' && __DATE__[1] == 'u') dver += 8;
else if(__DATE__[0] == 'S') dver += 9; else if(__DATE__[0] == 'S') dver += 9;
else if(__DATE__[0] == 'O') dver += 10; else if(__DATE__[0] == 'O') dver += 10;
@ -3301,15 +3297,14 @@ void _startMsgCheck()
WSADATA wsda; WSADATA wsda;
if (WSAStartup(0x0101, &wsda)) if (WSAStartup(0x0101, &wsda))
{ {
stt->doEmitionRedFoundData("WSAStartup failed."); stt->doEmitionRedFoundData("WSAStartup failed.");
stt->doEmitionKillSttThread(); stt->doEmitionKillSttThread();
}; };
#endif #endif
_startVerCheck(); _startVerCheck();
_startMsgCheck(); _startMsgCheck();
qrp.setMinimal(true);
} }
void nesca_3::playFcknSound() void nesca_3::playFcknSound()

View File

@ -1764,9 +1764,15 @@ border-radius: 3px;</string>
<property name="frameShadow"> <property name="frameShadow">
<enum>QFrame::Plain</enum> <enum>QFrame::Plain</enum>
</property> </property>
<property name="sizeAdjustPolicy">
<enum>QAbstractScrollArea::AdjustIgnored</enum>
</property>
<property name="undoRedoEnabled"> <property name="undoRedoEnabled">
<bool>false</bool> <bool>false</bool>
</property> </property>
<property name="lineWrapMode">
<enum>QTextEdit::NoWrap</enum>
</property>
<property name="readOnly"> <property name="readOnly">
<bool>true</bool> <bool>true</bool>
</property> </property>

View File

@ -4,10 +4,6 @@
#include "externFunctions.h" #include "externFunctions.h"
#include "Connector.h" #include "Connector.h"
typedef struct {
char argv[MAX_ADDR_LEN];
} ST;
ST *st = NULL; ST *st = NULL;
QJsonArray *jsonArr = new QJsonArray(); QJsonArray *jsonArr = new QJsonArray();
@ -910,29 +906,21 @@ void *_connect(void* ss)
void targetAndIPWriter(long long unsigned int target, char *buff) void targetAndIPWriter(long long unsigned int target, char *buff)
{ {
char curIPBuff[256] = {0}, targetNPers[32] = {0}, dbuffer[32] = {0}; char curIPBuff[256] = {0}, targetNPers[32] = {0};
strcpy(metaIPDNS, buff); strcpy(metaIPDNS, buff);
char b[32] = {0}; sprintf(targetNPers, "%Lu (%.1f%%)",
sprintf(b, "%Lu", target); target, (gTargetsOverall != 0 ? (100 - target/(double)gTargetsOverall * 100) : 0));
strcpy(targetNPers, b); sprintf(metaTargets, "%Lu", target);
strcpy(metaTargets, targetNPers); sprintf(metaPercent, "%.1f",
if(gTargetsOverall != 0) sprintf(dbuffer, "%.1f", (100 - target/(double)gTargetsOverall * 100)); (gTargetsOverall != 0 ? (100 - target/(double)gTargetsOverall * 100) : 0));
else strcpy(dbuffer, "0"); sprintf(curIPBuff, "--->%s", buff);
strcat(targetNPers, " (");
strcat(targetNPers, dbuffer);
strcat(targetNPers, "%)");
strcpy(metaPercent, dbuffer);
strcpy(curIPBuff, "--->");
strcat(curIPBuff, buff);
stt->doEmitionIPRANGE(QString(curIPBuff)); stt->doEmitionIPRANGE(QString(curIPBuff));
stt->doEmitionTargetsLeft(QString(targetNPers)); stt->doEmitionTargetsLeft(QString(targetNPers));
} }
void _passLoginFapper() void _passLoginLoader()
{ {
MaxLogin = 0; MaxLogin = 0;
MaxPass = 0; MaxPass = 0;
@ -985,9 +973,7 @@ void _passLoginFapper()
ZeroMemory(buffFG, sizeof(buffFG)); ZeroMemory(buffFG, sizeof(buffFG));
}; };
stt->doEmitionGreenFoundData("Password list loaded (" + QString::number(MaxPass) + " entries)");
stt->doEmitionGreenFoundData("Password list loaded (" + QString(std::to_string(MaxPass).c_str()) + " entries)");
i = 0; i = 0;
@ -1000,19 +986,15 @@ void _passLoginFapper()
ZeroMemory(buffFG, sizeof(buffFG)); ZeroMemory(buffFG, sizeof(buffFG));
}; };
stt->doEmitionGreenFoundData("Login list loaded (" + QString::number(MaxLogin) + " entries)");
stt->doEmitionGreenFoundData("Login list loaded (" + QString(std::to_string(MaxLogin).c_str()) + " entries)");
fclose(loginList); fclose(loginList);
fclose(passList); fclose(passList);
} }
else else
{ {
stt->doEmitionRedFoundData("No password/login list found"); stt->doEmitionRedFoundData("No password/login list found");
stt->doEmitionKillSttThread(); stt->doEmitionKillSttThread();
}; };
MaxWFLogin = 0; MaxWFLogin = 0;
@ -1066,8 +1048,7 @@ void _passLoginFapper()
ZeroMemory(buffFG, sizeof(buffFG)); ZeroMemory(buffFG, sizeof(buffFG));
}; };
stt->doEmitionGreenFoundData("WFPassword list loaded (" + QString::number(MaxWFPass) + " entries)");
stt->doEmitionGreenFoundData("WFPassword list loaded (" + QString(std::to_string(MaxWFPass).c_str()) + " entries)");
i = 0; i = 0;
@ -1080,7 +1061,7 @@ void _passLoginFapper()
ZeroMemory(buffFG, sizeof(buffFG)); ZeroMemory(buffFG, sizeof(buffFG));
}; };
stt->doEmitionGreenFoundData("WFLogin list loaded (" + QString(std::to_string(MaxWFLogin).c_str()) + " entries)"); stt->doEmitionGreenFoundData("WFLogin list loaded (" + QString::number(MaxWFLogin) + " entries)");
fclose(wfPassList); fclose(wfPassList);
fclose(wfLoginList); fclose(wfLoginList);
} }
@ -1123,7 +1104,7 @@ void _passLoginFapper()
ZeroMemory(buffFG, sizeof(buffFG)); ZeroMemory(buffFG, sizeof(buffFG));
}; };
stt->doEmitionGreenFoundData("SSH Password list loaded (" + QString(std::to_string(MaxSSHPass).c_str()) + " entries)"); stt->doEmitionGreenFoundData("SSH Password list loaded (" + QString::number(MaxSSHPass) + " entries)");
fclose(sshlpList); fclose(sshlpList);
} }
@ -1133,9 +1114,9 @@ void _passLoginFapper()
stt->doEmitionKillSttThread(); stt->doEmitionKillSttThread();
}; };
stt->doEmitionYellowFoundData("BA: ~" + QString(std::to_string(MaxLogin * MaxPass/gTimeOut/60).c_str()) stt->doEmitionYellowFoundData("BA: ~" + QString::number(MaxLogin * MaxPass/gTimeOut/60)
+ "; WF: ~" + QString(std::to_string(MaxWFLogin * MaxWFPass/gTimeOut/60).c_str()) + "; WF: ~" + QString::number(MaxWFLogin * MaxWFPass/gTimeOut/60)
+ "; SSH: ~" + QString(std::to_string(MaxSSHPass/gTimeOut/60).c_str())); + "; SSH: ~" + QString::number(MaxSSHPass/gTimeOut/60));
} }
void ReadUTF8(FILE* nFile, char *cp) void ReadUTF8(FILE* nFile, char *cp)
@ -1292,7 +1273,7 @@ std::string xcode(LPCSTR src, UINT srcCodePage, UINT dstCodePage)
#endif #endif
return res; return res;
} }
void _NegativeFapper() void _NegativeLoader()
{ {
FILE *nFile = fopen("negatives.txt", "rb"); FILE *nFile = fopen("negatives.txt", "rb");
@ -1369,10 +1350,8 @@ void CheckMaskBits(char *res, int index)
} }
else else
{ {
stt->doEmitionRedFoundData("[CheckMaskBits] Cannot parse IP list"); stt->doEmitionRedFoundData("[CheckMaskBits] Cannot parse IP list");
stt->doEmitionKillSttThread(); stt->doEmitionKillSttThread();
}; };
} }
@ -2307,11 +2286,11 @@ int startScan(char* args)
ZeroMemory(ipsend, sizeof(ipsend)); ZeroMemory(ipsend, sizeof(ipsend));
#if defined(WIN32) || defined(_WIN32) || defined(__WIN32) && !defined(__CYGWIN__) #if defined(WIN32) || defined(_WIN32) || defined(__WIN32) && !defined(__CYGWIN__)
CreateDirectory(L"./result_files", NULL); CreateDirectory(L(RESULT_DIR_NAME), NULL);
#else #else
struct stat str = {0}; struct stat str = {0};
if (stat("./result_files", &str) == -1) { if (stat(RESULT_DIR_NAME, &str) == -1) {
mkdir("./result_files", 0700); mkdir(RESULT_DIR_NAME, 0700);
} }
#endif #endif
@ -2330,7 +2309,6 @@ int startScan(char* args)
int resInit = fInit(gMode, gRange); int resInit = fInit(gMode, gRange);
if(resInit == -1 ) if(resInit == -1 )
{ {
stt->doEmitionRedFoundData("[Error] fInit failure"); stt->doEmitionRedFoundData("[Error] fInit failure");
stt->doEmitionKillSttThread(); stt->doEmitionKillSttThread();
@ -2340,8 +2318,8 @@ int startScan(char* args)
stt->doEmitionIPRANGE(QString(saveEndIP)); stt->doEmitionIPRANGE(QString(saveEndIP));
stt->doEmitionThreads(QString::number(0) + "/" + QString::number(gThreads)); stt->doEmitionThreads(QString::number(0) + "/" + QString::number(gThreads));
_passLoginFapper(); _passLoginLoader();
_NegativeFapper(); _NegativeLoader();
char res[256] = {0}; char res[256] = {0};
if (gMode == 0) if (gMode == 0)
@ -2467,10 +2445,10 @@ stt->doEmitionThreads(QString::number(0) + "/" + QString::number(gThreads));
if(trackerOK) if(trackerOK)
{ {
#if defined(WIN32) || defined(_WIN32) || defined(__WIN32) && !defined(__CYGWIN__) #if defined(WIN32) || defined(_WIN32) || defined(__WIN32) && !defined(__CYGWIN__)
if(trackerOK) _beginthread( (void(*)(void*))_tracker, 0, NULL ); _beginthread( (void(*)(void*))_tracker, 0, NULL );
#else #else
pthread_t thrt; pthread_t thrt;
if(trackerOK) pthread_create(&thrt, NULL, (void *(*)(void*))&_tracker, NULL); pthread_create(&thrt, NULL, (void *(*)(void*))&_tracker, NULL);
#endif #endif
}; };
@ -2482,11 +2460,10 @@ stt->doEmitionThreads(QString::number(0) + "/" + QString::number(gThreads));
pthread_create(&thrtt, NULL, (void *(*)(void*))&_timer, NULL); pthread_create(&thrtt, NULL, (void *(*)(void*))&_timer, NULL);
#endif #endif
char dataEntry[1024] = {0}; char dataEntry[1024] = {0};
int innerCounter = 0; int innerCounter = 0;
int sz = strlen(saveEndIP); int sz = strlen(saveEndIP);
for(int i = 0; i < sz; ++i) for(int i = 0; i < sz; ++i)
{ {
if(saveEndIP[i] == '\\') if(saveEndIP[i] == '\\')