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
12be36e2e6
commit
833be4b4d4
@ -8,10 +8,10 @@
|
|||||||
void getSubStrEx(char *src, char *startStr, char *endStr, char *dest, int szDest)
|
void getSubStrEx(char *src, char *startStr, char *endStr, char *dest, int szDest)
|
||||||
{
|
{
|
||||||
ZeroMemory(dest, szDest);
|
ZeroMemory(dest, szDest);
|
||||||
char *ptr1 = strstri(src, startStr);
|
char *ptr1 = strstri((const char*)src, startStr);
|
||||||
if(ptr1 != NULL)
|
if(ptr1 != NULL)
|
||||||
{
|
{
|
||||||
char *ptr2 = strstri(ptr1, endStr);
|
char *ptr2 = strstri((const char*)ptr1, endStr);
|
||||||
if(ptr2 != NULL)
|
if(ptr2 != NULL)
|
||||||
{
|
{
|
||||||
int szStartStr = strlen(startStr);
|
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)
|
void getSubStr(char *src, char *startStr, char *endStr, char *dest, int szDest)
|
||||||
{
|
{
|
||||||
ZeroMemory(dest, szDest);
|
ZeroMemory(dest, szDest);
|
||||||
char *ptr1 = strstri(src, startStr);
|
char *ptr1 = strstri((const char*)src, startStr);
|
||||||
if(ptr1 != NULL)
|
if(ptr1 != NULL)
|
||||||
{
|
{
|
||||||
char *ptr2 = strstri(ptr1, endStr);
|
char *ptr2 = strstri((const char*)ptr1, endStr);
|
||||||
if(ptr2 != NULL)
|
if(ptr2 != NULL)
|
||||||
{
|
{
|
||||||
int sz = ptr2 - ptr1;
|
int sz = ptr2 - ptr1;
|
||||||
@ -117,10 +117,10 @@ int KeyCheckerMain()
|
|||||||
if(strstr(msg, "http://") != NULL)
|
if(strstr(msg, "http://") != NULL)
|
||||||
{
|
{
|
||||||
t1 = strstr(msg, "http://");
|
t1 = strstr(msg, "http://");
|
||||||
if(strstr((char*)(t1 + strlen("http://")), "/") != NULL)
|
if(strstr((char*)(t1 + 7), "/") != NULL)
|
||||||
{
|
{
|
||||||
t2 = strstr((char*)(t1 + strlen("http://")), "/");
|
t2 = strstr((char*)(t1 + 7), "/");
|
||||||
int ln = t2 - t1 - strlen("http://");
|
int ln = t2 - t1 - 7;
|
||||||
if(ln > 64)
|
if(ln > 64)
|
||||||
{
|
{
|
||||||
stt->doEmitionRedFoundData("[Key check] -Received server string is not valid!");
|
stt->doEmitionRedFoundData("[Key check] -Received server string is not valid!");
|
||||||
@ -128,7 +128,7 @@ int KeyCheckerMain()
|
|||||||
|
|
||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
else strncpy(ndbServer, (char*)(t1 + strlen("http://")), ln);
|
else strncpy(ndbServer, (char*)(t1 + 7), ln);
|
||||||
|
|
||||||
|
|
||||||
if(strlen(t2) > 64)
|
if(strlen(t2) > 64)
|
||||||
|
@ -5,12 +5,13 @@
|
|||||||
void DrawerTh_ME2Scanner::doEmitDrawTextPlacers()
|
void DrawerTh_ME2Scanner::doEmitDrawTextPlacers()
|
||||||
{
|
{
|
||||||
emit dtME2->sDrawTextPlacers();
|
emit dtME2->sDrawTextPlacers();
|
||||||
};
|
}
|
||||||
|
|
||||||
void DrawerTh_ME2Scanner::doEmitionAddPolyLine()
|
void DrawerTh_ME2Scanner::doEmitionAddPolyLine()
|
||||||
{
|
{
|
||||||
emit dtME2->sAddPolyLine();
|
emit dtME2->sAddPolyLine();
|
||||||
};
|
}
|
||||||
|
|
||||||
void MakePolygonLine(int gWidth)
|
void MakePolygonLine(int gWidth)
|
||||||
{
|
{
|
||||||
vect.clear();
|
vect.clear();
|
||||||
@ -120,7 +121,8 @@ void MakePolygonLine(int gWidth)
|
|||||||
Alive = 0;
|
Alive = 0;
|
||||||
Susp = 0;
|
Susp = 0;
|
||||||
vect.append(QPointF(gWidth, 20));
|
vect.append(QPointF(gWidth, 20));
|
||||||
};
|
}
|
||||||
|
|
||||||
void DrawerTh_ME2Scanner::run()
|
void DrawerTh_ME2Scanner::run()
|
||||||
{
|
{
|
||||||
int gWidth = ui->graphicLog->width();
|
int gWidth = ui->graphicLog->width();
|
||||||
@ -144,6 +146,6 @@ void DrawerTh_ME2Scanner::run()
|
|||||||
Alive = 0;
|
Alive = 0;
|
||||||
Susp = 0;
|
Susp = 0;
|
||||||
};
|
};
|
||||||
msleep(150);
|
msleep(120);
|
||||||
};
|
};
|
||||||
};
|
}
|
||||||
|
221
connector.cpp
221
connector.cpp
@ -86,9 +86,8 @@ void _DebugWriteHTMLToFile(char *request, char *buff)
|
|||||||
unsigned char tl(unsigned char d)
|
unsigned char tl(unsigned char d)
|
||||||
{
|
{
|
||||||
if(d >= 192 && d <= 223)
|
if(d >= 192 && d <= 223)
|
||||||
{
|
{
|
||||||
unsigned char y = d + 32;
|
return (unsigned char)(d + 32);
|
||||||
return y;
|
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
@ -124,29 +123,45 @@ int recvWT(
|
|||||||
|
|
||||||
std::string toLowerStr(const char *str)
|
std::string toLowerStr(const char *str)
|
||||||
{
|
{
|
||||||
int tsz = strlen(str);
|
if(str != NULL) {
|
||||||
if(tsz == 1)
|
int tsz = strlen(str);
|
||||||
{
|
char *strr = new char[tsz+1];
|
||||||
if(str[0] == 10) return "[No data!]";
|
ZeroMemory(strr, tsz);
|
||||||
else return str;
|
|
||||||
}
|
|
||||||
else if(tsz > 1)
|
|
||||||
{
|
|
||||||
char * strr = new char[tsz+1];
|
|
||||||
ZeroMemory(strr, tsz);
|
|
||||||
|
|
||||||
for (int i = 0; i < tsz; i++)
|
for (int i = 0; i < tsz; i++)
|
||||||
{
|
{
|
||||||
strr[i] = tl(str[i]);
|
strr[i] = tl(str[i]);
|
||||||
};
|
};
|
||||||
|
|
||||||
memset(strr + tsz, '\0', 1);
|
memset(strr + tsz, '\0', 1);
|
||||||
|
|
||||||
std::string tstr = strr;
|
std::string tstr = std::string(strr);
|
||||||
delete []strr;
|
delete []strr;
|
||||||
return tstr;
|
return tstr;
|
||||||
};
|
} else return "";
|
||||||
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)
|
int OpenConnection(SOCKET *sock, const char *hostname, int port)
|
||||||
@ -1506,9 +1521,9 @@ int Connector::_EstablishConnection(char *ip, int port, char *request, conSTR *C
|
|||||||
#if defined(WIN32) || defined(_WIN32) || defined(__WIN32) && !defined(__CYGWIN__)
|
#if defined(WIN32) || defined(_WIN32) || defined(__WIN32) && !defined(__CYGWIN__)
|
||||||
if(inet_addr(ip) != INADDR_NONE) sockAddr.sin_addr.S_un.S_addr = inet_addr(ip);
|
if(inet_addr(ip) != INADDR_NONE) sockAddr.sin_addr.S_un.S_addr = inet_addr(ip);
|
||||||
#else
|
#else
|
||||||
if(inet_addr(ip) != INADDR_NONE) sockAddr.sin_addr.s_addr = inet_addr(ip);
|
if(inet_addr(ip) != INADDR_NONE) sockAddr.sin_addr.s_addr = inet_addr(ip);
|
||||||
#endif
|
#endif
|
||||||
else if(host = gethostbyname (ip)) ((unsigned long*) &sockAddr.sin_addr)[0] = ((unsigned long**)host->h_addr_list)[0][0];
|
else if(host = gethostbyname (ip)) ((unsigned long*) &sockAddr.sin_addr)[0] = ((unsigned long**)host->h_addr_list)[0][0];
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
++offlines;
|
++offlines;
|
||||||
@ -1528,18 +1543,18 @@ int Connector::_EstablishConnection(char *ip, int port, char *request, conSTR *C
|
|||||||
|
|
||||||
#if defined(WIN32) || defined(_WIN32) || defined(__WIN32) && !defined(__CYGWIN__)
|
#if defined(WIN32) || defined(_WIN32) || defined(__WIN32) && !defined(__CYGWIN__)
|
||||||
u_long FAR cmd = 1;
|
u_long FAR cmd = 1;
|
||||||
if( ioctlsocket( sock , FIONBIO, &cmd ) != 0 )
|
if( ioctlsocket( sock, FIONBIO, &cmd ) != 0 )
|
||||||
#else
|
#else
|
||||||
if( fcntl( sock , F_SETFL, O_NDELAY ) == -1 )
|
if( fcntl( sock, F_SETFL, O_NDELAY ) == -1 )
|
||||||
#endif
|
#endif
|
||||||
{
|
{
|
||||||
stt->doEmitionRedFoundData("[FIONBIO failed]");
|
stt->doEmitionRedFoundData("[FIONBIO failed]");
|
||||||
};
|
};
|
||||||
|
|
||||||
int recvBuffSize = 0;
|
int recvBuffSize = 0;
|
||||||
linger.l_onoff = 1;
|
linger.l_onoff = 1;
|
||||||
linger.l_linger = 5;
|
linger.l_linger = 5;
|
||||||
setsockopt(sock, SOL_SOCKET, SO_LINGER, (const char *) &linger, sizeof(linger));
|
setsockopt(sock, SOL_SOCKET, SO_LINGER, (const char *) &linger, sizeof(linger));
|
||||||
|
|
||||||
int iError, iResult = connect(sock, (sockaddr*)&sockAddr, sizeof(sockAddr));
|
int iError, iResult = connect(sock, (sockaddr*)&sockAddr, sizeof(sockAddr));
|
||||||
while(sock == INVALID_SOCKET)
|
while(sock == INVALID_SOCKET)
|
||||||
@ -1555,15 +1570,18 @@ int Connector::_EstablishConnection(char *ip, int port, char *request, conSTR *C
|
|||||||
if(iResult == SOCKET_ERROR)
|
if(iResult == SOCKET_ERROR)
|
||||||
{
|
{
|
||||||
iError = WSAGetLastError();
|
iError = WSAGetLastError();
|
||||||
if (iError == WSAEWOULDBLOCK)
|
if (iError == WSAEWOULDBLOCK || iError == WSAEINPROGRESS)
|
||||||
{
|
{
|
||||||
fd_set read_fs;
|
fd_set read_fs;
|
||||||
|
fd_set write_fs;
|
||||||
FD_ZERO(&read_fs);
|
FD_ZERO(&read_fs);
|
||||||
FD_SET(sock, &read_fs);
|
FD_ZERO(&write_fs);
|
||||||
|
FD_SET(sock, &read_fs);
|
||||||
|
FD_SET(sock, &write_fs);
|
||||||
timeval tv = { gTimeOut, 0 };
|
timeval tv = { gTimeOut, 0 };
|
||||||
|
|
||||||
int oldErr = WSAGetLastError();
|
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)
|
if (iResult == SOCKET_ERROR)
|
||||||
{
|
{
|
||||||
@ -1575,7 +1593,10 @@ int Connector::_EstablishConnection(char *ip, int port, char *request, conSTR *C
|
|||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
if (!iResult) ++offlines;
|
if (!iResult) {
|
||||||
|
++offlines;
|
||||||
|
stt->doEmitionFoundData(QString::number(WSAGetLastError()));
|
||||||
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
int sResult = send(sock, request, strlen(request), 0);
|
int sResult = send(sock, request, strlen(request), 0);
|
||||||
@ -1686,9 +1707,9 @@ int Connector::_EstablishConnection(char *ip, int port, char *request, conSTR *C
|
|||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
stt->doEmitionRedFoundData("[?!] Strange behavior detected - " +
|
stt->doEmitionRedFoundData("[?!] Strange behavior detected (" +
|
||||||
QString::number(WSAGetLastError()) +
|
QString::number(WSAGetLastError()) +
|
||||||
" - " + QString(ip) + ":" + QString::number(port));
|
") " + QString(ip) + ":" + QString::number(port));
|
||||||
};
|
};
|
||||||
|
|
||||||
CSSOCKET(sock);
|
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 _WFBrut(char *cookie, char *ip, int port, char *methodVal, char *actionVal, char *userVal, char *passVal, char *formVal)
|
||||||
{
|
{
|
||||||
lopaStr lps;
|
lopaStr lps;
|
||||||
@ -2088,7 +2108,7 @@ char *_get_ssh_banner(char *ip, int port)
|
|||||||
return recvBuff;
|
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;
|
int res = -1;
|
||||||
if(BALogSwitched) stt->doEmitionBAData("Probing SSH: " + QString(user) + ":" + QString(pass) + "@" + QString(host) + ":" + QString::number(port));
|
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)
|
if(res == 0)
|
||||||
{
|
{
|
||||||
stt->doEmition_BAGreenData("[+] SSH: " + QString(user) + ":" + QString(pass) + "@" + QString(host));
|
stt->doEmition_BAGreenData("[+] SSH: " + QString(user) + ":" + QString(pass) + "@" + QString(host));
|
||||||
char goodStr[512] = {0};
|
buffer->append(userPass);
|
||||||
strcpy(goodStr, userPass);
|
buffer->append("@");
|
||||||
strcat(goodStr, "@");
|
buffer->append(host);
|
||||||
strcat(goodStr, host);
|
buffer->append("|+|");
|
||||||
strcat(goodStr, "|+|");
|
buffer->append(banner);
|
||||||
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);
|
|
||||||
return 0;
|
return 0;
|
||||||
};
|
};
|
||||||
return res;
|
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 login[32] = {0};
|
||||||
char pass[32] = {0};
|
char pass[32] = {0};
|
||||||
char temp[64] = {0};
|
char temp[64] = {0};
|
||||||
@ -2133,7 +2144,7 @@ int _EstablishSSHConnection(char *host, int port, conSTR *CSTR, char *banner)
|
|||||||
sz = ptr1 - temp;
|
sz = ptr1 - temp;
|
||||||
strncpy(login, temp, sz);
|
strncpy(login, temp, sz);
|
||||||
strcpy(pass, ptr1 + 1);
|
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(login, sizeof(login));
|
||||||
ZeroMemory(pass, sizeof(pass));
|
ZeroMemory(pass, sizeof(pass));
|
||||||
ZeroMemory(temp, sizeof(temp));
|
ZeroMemory(temp, sizeof(temp));
|
||||||
@ -2157,7 +2168,6 @@ int _EstablishSSHConnection(char *host, int port, conSTR *CSTR, char *banner)
|
|||||||
return -1;
|
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)
|
int _webLoginSeq(char *request, char *login, char *pass, char *ip, int port, int passCounter, char *type, std::vector<char*> negVector)
|
||||||
{
|
{
|
||||||
char recvBuff[256] = {0};
|
char recvBuff[256] = {0};
|
||||||
@ -2653,20 +2663,53 @@ int _pingMyTarget(char *ip)
|
|||||||
|
|
||||||
QString strIP;
|
QString strIP;
|
||||||
QString strPort;
|
QString strPort;
|
||||||
const char *buff1 = "GET / HTTP/1.1\r\nHost: ";
|
int Connector::_SSHLobby(char *ip, int port, std::string *buffer)
|
||||||
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)
|
|
||||||
{
|
{
|
||||||
char banner[256] = {0};
|
char banner[256] = {0};
|
||||||
strncpy(banner, _get_ssh_banner(ip, port), 256);
|
strncpy(banner, _get_ssh_banner(ip, port), 256);
|
||||||
if(strlen(banner) > 0)
|
if(strlen(banner) > 0)
|
||||||
{
|
{
|
||||||
return _EstablishSSHConnection(ip, port, CSTR, banner);
|
return _EstablishSSHConnection(ip, port, buffer, banner);
|
||||||
};
|
};
|
||||||
return -1;
|
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)
|
if(gPingNScan)
|
||||||
{
|
{
|
||||||
@ -2676,44 +2719,30 @@ int Connector::_ConnectToPort(char *ip, const char *portC, char *hl)
|
|||||||
};
|
};
|
||||||
};
|
};
|
||||||
|
|
||||||
char mes[512] = {0};
|
std::string buffer = "";
|
||||||
conSTR CSTR;
|
int size = 0;
|
||||||
CSTR.lowerBuff = NULL;
|
|
||||||
CSTR.size = 0;
|
|
||||||
|
|
||||||
strcpy(mes, buff1);
|
if(port == 22) size = _SSHLobby(ip, port, &buffer);
|
||||||
strcat(mes, ip);
|
else size = nConnect(ip, port, &buffer);
|
||||||
int port = atoi(portC);
|
|
||||||
if(port != 80){
|
|
||||||
strcat(mes, ":");
|
|
||||||
strcat(mes, portC);
|
|
||||||
};
|
|
||||||
strcat(mes, buff2);
|
|
||||||
int cRes;
|
|
||||||
|
|
||||||
if(port == 443) cRes = _EstablishSSLConnection(ip, port, mes, &CSTR);
|
if(size > 0)
|
||||||
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)
|
|
||||||
{
|
|
||||||
++Alive;
|
++Alive;
|
||||||
++found;
|
++found;
|
||||||
stt->doEmitionChangeParsed(QString::number(saved) + "/" + QString::number(found));
|
stt->doEmitionChangeParsed(QString::number(saved) + "/" + QString::number(found));
|
||||||
|
|
||||||
Lexems lx;
|
conSTR CSTR;
|
||||||
lx._filler(port, CSTR.lowerBuff, ip, size, &lx, hl);
|
CSTR.lowerBuff = new char[size + 1];
|
||||||
delete []CSTR.lowerBuff;
|
CSTR.size = size;
|
||||||
CSTR.lowerBuff = NULL;
|
memcpy(CSTR.lowerBuff, buffer.c_str(), size);
|
||||||
};
|
memset(CSTR.lowerBuff + size, '\0', 1);
|
||||||
|
|
||||||
if(CSTR.lowerBuff != NULL)
|
Lexems lx;
|
||||||
{
|
lx._filler(port, (char *)buffer.c_str(), ip, size, &lx, hl);
|
||||||
delete []CSTR.lowerBuff;
|
|
||||||
CSTR.lowerBuff = NULL;
|
delete []CSTR.lowerBuff;
|
||||||
|
CSTR.lowerBuff = NULL;
|
||||||
};
|
};
|
||||||
|
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
@ -8,10 +8,11 @@ extern void BConInc();
|
|||||||
extern void BConDec();
|
extern void BConDec();
|
||||||
extern QString GetNSErrorDefinition(char *str, char *defin);
|
extern QString GetNSErrorDefinition(char *str, char *defin);
|
||||||
extern void _SaveBackupToFile();
|
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* _getAttribute(char *str, char *attrib);
|
||||||
extern char *_findFirst(char *str, char *delim);
|
extern char *_findFirst(char *str, char *delim);
|
||||||
extern void nCleanup();
|
extern void nCleanup();
|
||||||
extern void getSubStr(char *src, char *startStr, char *endStr, char *dest, int szDest);
|
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 void getSubStrEx(char *src, char *startStr, char *endStr, char *dest, int szDest);
|
||||||
extern std::string xcode(LPCSTR src, UINT srcCodePage, UINT dstCodePage);
|
extern std::string xcode(LPCSTR src, UINT srcCodePage, UINT dstCodePage);
|
||||||
|
extern int nConnect(char *ip, int port, std::string *buffer);
|
||||||
|
110
finder.cpp
110
finder.cpp
@ -4,16 +4,17 @@
|
|||||||
#include "externFunctions.h"
|
#include "externFunctions.h"
|
||||||
#include "externData.h"
|
#include "externData.h"
|
||||||
|
|
||||||
char* strstri(char *_Str, const char *_SubStr)
|
char* strstri(const char *_Str, const char *_SubStr)
|
||||||
{
|
{
|
||||||
if(_Str != NULL)
|
if(_Str != NULL)
|
||||||
{
|
{
|
||||||
std::string _lowStr = toLowerStr(_Str);
|
const std::string &_lowStr = toLowerStr(_Str);
|
||||||
std::string _lowSubStr = toLowerStr(_SubStr);
|
const std::string &_lowSubStr = toLowerStr(_SubStr);
|
||||||
const char *resChar = strstr(_lowStr.c_str(), _lowSubStr.c_str());
|
const char *resChar = strstr(_lowStr.c_str(), _lowSubStr.c_str());
|
||||||
int offset = resChar - _lowStr.c_str();
|
if(resChar == 0) return NULL;
|
||||||
if(offset < 0) return NULL;
|
else {
|
||||||
else return (char*)(_Str + offset);
|
return (char*)(_Str + (resChar - _lowStr.c_str()));
|
||||||
|
}
|
||||||
};
|
};
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
@ -50,73 +51,76 @@ char *_findLast(char *str, char *delim)
|
|||||||
return (char *)(str + savedPosition);
|
return (char *)(str + savedPosition);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
char *GetCodePage(char *str)
|
char *GetCodePage(char *str)
|
||||||
{
|
{
|
||||||
char cdpg[32] = {0};
|
char cdpg[32] = {0};
|
||||||
if(strstri(str, "<meta ") != NULL)
|
char *ptr1 = strstri(str, "<meta ");
|
||||||
{
|
|
||||||
char *temp2 = strstri(str, "<meta ");
|
|
||||||
|
|
||||||
if(strstri((char *)(temp2 + strlen("<meta ")), "charset=") != NULL)
|
if(ptr1 != NULL)
|
||||||
{
|
{
|
||||||
char *temp3 = strstri((char *)(temp2 + strlen("<meta ")), "charset=");
|
char *ptr2 = strstri(ptr1 + 6, "charset=");
|
||||||
char *temp4 = _findFirst((char *)(temp3 + strlen("charset=")), " \"'>\n\r");
|
if(ptr2 != NULL)
|
||||||
|
{
|
||||||
|
char *temp4 = _findFirst((char *)(ptr2 + 6), " \"'>\n\r");
|
||||||
if(temp4 != NULL)
|
if(temp4 != NULL)
|
||||||
{
|
{
|
||||||
int ln = (int)(temp4 - temp3 - strlen("charset="));
|
int ln = (int)(temp4 - ptr2 - 8);
|
||||||
if(ln > 16)
|
if(ln > 16)
|
||||||
{
|
{
|
||||||
return "WTF?";
|
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";
|
if(strstri(cdpg, "%s") != NULL) return "UTF-8";
|
||||||
return cdpg;
|
return cdpg;
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
stt->doEmitionRedFoundData("[GetCodePage] [" + QString(temp3).mid(0, 16) + "]");
|
stt->doEmitionRedFoundData("[GetCodePage] [" + QString(ptr2).mid(0, 16) + "]");
|
||||||
return "NULL";
|
return "NULL";
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
else if(strstri((char *)(temp2 + strlen("<meta ")), "charset = ") != NULL)
|
|
||||||
{
|
ptr2 = strstri(ptr1 + 6, "charset = ");
|
||||||
char *temp3 = strstri((char *)(temp2 + strlen("<meta ")), "charset = ");
|
if(ptr2 != NULL)
|
||||||
char *temp4 = _findFirst((char *)(temp3 + strlen("charset = ")), " \"'>\n\r");
|
{
|
||||||
|
char *temp4 = _findFirst((char *)(ptr2 + 10), " \"'>\n\r");
|
||||||
if(temp4 != NULL)
|
if(temp4 != NULL)
|
||||||
{
|
{
|
||||||
int ln = (int)(temp4 - temp3 - strlen("charset = "));
|
int ln = (int)(temp4 - ptr2 - 10);
|
||||||
if(ln > 16)
|
if(ln > 16)
|
||||||
{
|
{
|
||||||
return "WTF?";
|
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";
|
if(strstri(cdpg, "%s") != NULL) return "UTF-8";
|
||||||
return cdpg;
|
return cdpg;
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
stt->doEmitionRedFoundData("[GetCodePage] [" + QString(temp3).mid(0, 16) + "]");
|
stt->doEmitionRedFoundData("[GetCodePage] [" + QString(ptr2).mid(0, 16) + "]");
|
||||||
return "NULL";
|
return "NULL";
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
else if(strstri((char *)(temp2 + strlen("<meta ")), "charset =") != NULL)
|
|
||||||
{
|
ptr2 = strstri(ptr1 + 6, "charset =");
|
||||||
char *temp3 = strstri((char *)(temp2 + strlen("<meta ")), "charset =");
|
if(ptr2 != NULL)
|
||||||
char *temp4 = _findFirst((char *)(temp3 + strlen("charset =")), " \"'>\n\r");
|
{
|
||||||
|
char *temp4 = _findFirst((char *)(ptr2 + 9), " \"'>\n\r");
|
||||||
if(temp4 != NULL)
|
if(temp4 != NULL)
|
||||||
{
|
{
|
||||||
int ln = (int)(temp4 - temp3 - strlen("charset ="));
|
int ln = (int)(temp4 - ptr2 - 9);
|
||||||
if(ln > 16)
|
if(ln > 16)
|
||||||
{
|
{
|
||||||
return "WTF?";
|
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";
|
if(strstri(cdpg, "%s") != NULL) return "UTF-8";
|
||||||
return cdpg;
|
return cdpg;
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
stt->doEmitionRedFoundData("[GetCodePage] [" + QString(temp3).mid(0, 16) + "]");
|
stt->doEmitionRedFoundData("[GetCodePage] [" + QString(ptr2).mid(0, 16) + "]");
|
||||||
return "NULL";
|
return "NULL";
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
@ -125,15 +129,15 @@ char *GetCodePage(char *str)
|
|||||||
if(strstri(str, "charset=") != NULL)
|
if(strstri(str, "charset=") != NULL)
|
||||||
{
|
{
|
||||||
char *temp2 = strstri(str, "charset=");
|
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)
|
if(temp3 != NULL)
|
||||||
{
|
{
|
||||||
int ln = (int)(temp3 - temp2 - strlen("charset="));
|
int ln = (int)(temp3 - temp2 - 8);
|
||||||
if(ln > 16)
|
if(ln > 16)
|
||||||
{
|
{
|
||||||
return "WTF?";
|
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";
|
if(strstri(cdpg, "%s") != NULL) return "UTF-8";
|
||||||
return cdpg;
|
return cdpg;
|
||||||
}
|
}
|
||||||
@ -149,18 +153,19 @@ char *GetCodePage(char *str)
|
|||||||
};
|
};
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
else if(strstri(str, "charset=") != NULL)
|
|
||||||
{
|
ptr1 = strstri(str, "charset=");
|
||||||
char *temp2 = strstri(str, "charset=");
|
if(ptr1 != NULL)
|
||||||
char *temp3 = _findFirst((char *)(temp2 + strlen("charset=")), " \"'\n\r");
|
{
|
||||||
|
char *temp3 = _findFirst((char *)(ptr1 + 8), " \"'\n\r");
|
||||||
if(temp3 != NULL)
|
if(temp3 != NULL)
|
||||||
{
|
{
|
||||||
int ln = (int)(temp3 - temp2 - strlen("charset="));
|
int ln = (int)(temp3 - ptr1 - 8);
|
||||||
if(ln > 16)
|
if(ln > 16)
|
||||||
{
|
{
|
||||||
return "WTF?";
|
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";
|
if(strstri(cdpg, "%s") != NULL) return "UTF-8";
|
||||||
return cdpg;
|
return cdpg;
|
||||||
}
|
}
|
||||||
@ -429,7 +434,7 @@ int _mainFinderSecond(char *buffcpy, int port, char *ip)
|
|||||||
|
|
||||||
int ContentFilter(char *buff, int port, char *ip, char *cp)
|
int ContentFilter(char *buff, int port, char *ip, char *cp)
|
||||||
{
|
{
|
||||||
if(buff != NULL)
|
if(buff != NULL)
|
||||||
{
|
{
|
||||||
int res = 0;
|
int res = 0;
|
||||||
std::string tempString = "";
|
std::string tempString = "";
|
||||||
@ -440,7 +445,11 @@ int ContentFilter(char *buff, int port, char *ip, char *cp)
|
|||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
tempString = toLowerStr(xcode(buff, CP_UTF8, CP_ACP).c_str());
|
#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();
|
int sz = tempString.size();
|
||||||
@ -1512,19 +1521,17 @@ void _saveSSH(char *ip, int port, int recd, char *buffcpy)
|
|||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
||||||
int Lexems::_filler(int p, char* buffcpy, char* ip, int recd, Lexems *lx, char *hl)
|
int Lexems::_filler(int p, char* buffcpy, char* ip, int recd, Lexems *lx, char *hl)
|
||||||
{
|
{
|
||||||
if( strstr(buffcpy, "[IGNR_ADDR]") != NULL ) return -1;
|
if( strstr(buffcpy, "[IGNR_ADDR]") != NULL ) return -1;
|
||||||
if( strstr(buffcpy, "SSH-2.0-OpenSSH") != NULL || strstr(buffcpy, "SSH-2.0-mod_sftp") != NULL)
|
if( strstr(buffcpy, "SSH-2.0-OpenSSH") != NULL || strstr(buffcpy, "SSH-2.0-mod_sftp") != NULL)
|
||||||
{
|
{
|
||||||
Connector con;
|
Connector con;
|
||||||
conSTR CSTR;
|
std::string sshBuff;
|
||||||
CSTR.lowerBuff = NULL;
|
int res = con._SSHLobby(ip, p, &sshBuff);
|
||||||
CSTR.size = 0;
|
|
||||||
int res = con._SSHLobby(ip, p, &CSTR);
|
|
||||||
if(res != -1 && res != -2)
|
if(res != -1 && res != -2)
|
||||||
{
|
{
|
||||||
_saveSSH(ip, p, recd, CSTR.lowerBuff);
|
_saveSSH(ip, p, recd, (char*)sshBuff.c_str());
|
||||||
};
|
};
|
||||||
return -1;
|
return -1;
|
||||||
};
|
};
|
||||||
@ -1551,7 +1558,7 @@ int Lexems::_filler(int p, char* buffcpy, char* ip, int recd, Lexems *lx, char *
|
|||||||
int flag = 0;
|
int flag = 0;
|
||||||
char cp[32] = {0};
|
char cp[32] = {0};
|
||||||
|
|
||||||
strcpy(cp, GetCodePage(buffcpy));
|
strcpy(cp, GetCodePage(buffcpy));
|
||||||
flag = ContentFilter(buffcpy, p, ip, cp);
|
flag = ContentFilter(buffcpy, p, ip, cp);
|
||||||
if(flag == -1 ) return -1;
|
if(flag == -1 ) 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(strstr(finalstr, ps.headr) == NULL) strcat(finalstr, ps.headr);
|
||||||
if(flag == -1 || flag == 6 || strstr(finalstr, "[IGNR_ADDR]") != NULL) return -1;
|
if(flag == -1 || flag == 6 || strstr(finalstr, "[IGNR_ADDR]") != NULL) return -1;
|
||||||
|
|
||||||
#pragma region Fillers
|
|
||||||
if(flag == 16)
|
if(flag == 16)
|
||||||
{
|
{
|
||||||
Connector con;
|
Connector con;
|
||||||
|
@ -3,6 +3,7 @@
|
|||||||
|
|
||||||
#include <libssh/libssh.h>
|
#include <libssh/libssh.h>
|
||||||
#include <openssl/ssl.h>
|
#include <openssl/ssl.h>
|
||||||
|
#include <curl/curl.h>
|
||||||
#if defined(WIN32) || defined(_WIN32) || defined(__WIN32) && !defined(__CYGWIN__)
|
#if defined(WIN32) || defined(_WIN32) || defined(__WIN32) && !defined(__CYGWIN__)
|
||||||
#pragma once
|
#pragma once
|
||||||
#include "iostream"
|
#include "iostream"
|
||||||
@ -118,14 +119,15 @@ class Lexems
|
|||||||
{
|
{
|
||||||
iterationCount = 0;
|
iterationCount = 0;
|
||||||
flag = 0;
|
flag = 0;
|
||||||
};
|
}
|
||||||
|
|
||||||
~Lexems()
|
~Lexems()
|
||||||
{
|
{
|
||||||
iterationCount = 0;
|
iterationCount = 0;
|
||||||
};
|
}
|
||||||
|
|
||||||
int _header(char *ip, int port, char str[], Lexems *l, PathStr *ps, std::vector<std::string> *lst, char *rBuff);
|
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);
|
int _filler(int p, char *buffcpy, char* ipi, int recd, Lexems *lx, char *hl);
|
||||||
int globalSearchNeg(const char *buffcpy, char *ip, int port);
|
int globalSearchNeg(const char *buffcpy, char *ip, int port);
|
||||||
};
|
};
|
||||||
|
|
||||||
@ -139,11 +141,11 @@ class Connector
|
|||||||
lopaStr _BALobby(char *cookie, char *ip, int port, char *path, char *method, char *data);
|
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 _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);
|
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 _EstablishConnection(char *ip, int port, char *request, conSTR *cstr, int force = 0);
|
||||||
int _EstablishSSLConnection(char *ip, int port, char *request, conSTR *cstr);
|
int _EstablishSSLConnection(char *ip, int port, char *request, conSTR *cstr);
|
||||||
void _Connect(void *s);
|
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 += -lcrypto
|
||||||
|
|
||||||
unix|win32: LIBS += -lpthread
|
unix|win32: LIBS += -lpthread
|
||||||
|
|
||||||
|
unix|win32: LIBS += -lcurl
|
||||||
|
@ -1,6 +1,6 @@
|
|||||||
<?xml version="1.0" encoding="UTF-8"?>
|
<?xml version="1.0" encoding="UTF-8"?>
|
||||||
<!DOCTYPE QtCreatorProject>
|
<!DOCTYPE QtCreatorProject>
|
||||||
<!-- Written by QtCreator 3.2.1, 2015-02-27T15:04:30. -->
|
<!-- Written by QtCreator 3.2.1, 2015-03-02T14:52:09. -->
|
||||||
<qtcreator>
|
<qtcreator>
|
||||||
<data>
|
<data>
|
||||||
<variable>EnvironmentId</variable>
|
<variable>EnvironmentId</variable>
|
||||||
|
95
nesca_3.cpp
95
nesca_3.cpp
@ -740,7 +740,7 @@ void nesca_3::slotAddPolyLine()
|
|||||||
{
|
{
|
||||||
if(ME2ScanFlag)
|
if(ME2ScanFlag)
|
||||||
{
|
{
|
||||||
double uu = 0;
|
double uu = 0.0;
|
||||||
QPainterPath path;
|
QPainterPath path;
|
||||||
if(vect.size() > 0)
|
if(vect.size() > 0)
|
||||||
{
|
{
|
||||||
@ -750,30 +750,23 @@ void nesca_3::slotAddPolyLine()
|
|||||||
path.lineTo(vect[i]);
|
path.lineTo(vect[i]);
|
||||||
};
|
};
|
||||||
};
|
};
|
||||||
|
|
||||||
QGraphicsPathItem* itm = new QGraphicsPathItem(path);
|
QGraphicsPathItem* itm = new QGraphicsPathItem(path);
|
||||||
|
|
||||||
itm->setPen(pen2i);
|
itm->setPen(pen2i);
|
||||||
vectOld.push_front(itm);
|
int vSz = sceneGraph->items().size();
|
||||||
QGraphicsPathItem* itemN;
|
for(int i = 0; i < vSz; ++i)
|
||||||
for(int i = 0; i < vectOld.size(); ++i)
|
{
|
||||||
{
|
sceneGraph->items()[i]->setY(u+i + 1);
|
||||||
itemN = vectOld[i];
|
sceneGraph->items()[i]->setOpacity(1 - uu);
|
||||||
|
uu+=0.027;
|
||||||
|
u+=1;
|
||||||
|
};
|
||||||
|
sceneGraph->addItem(itm);
|
||||||
|
|
||||||
itemN->setY(u+i);
|
if(vSz == 50)
|
||||||
itemN->setOpacity(1 - uu);
|
{
|
||||||
uu+=0.04;
|
sceneGraph->items().pop_back();
|
||||||
sceneGraph->addItem(itemN);
|
|
||||||
u+=2;
|
|
||||||
};
|
|
||||||
int maxPrnt = 30;
|
|
||||||
while(vectOld.size() > maxPrnt)
|
|
||||||
{
|
|
||||||
if(vectOld[maxPrnt] != 0)
|
|
||||||
{
|
|
||||||
sceneGraph->removeItem(vectOld[maxPrnt]);
|
|
||||||
delete vectOld[maxPrnt];
|
|
||||||
if(vectOld.size() > 0) vectOld.pop_back();
|
|
||||||
};
|
|
||||||
};
|
};
|
||||||
if(u > 10) u = 1;
|
if(u > 10) u = 1;
|
||||||
};
|
};
|
||||||
@ -1918,7 +1911,8 @@ void nesca_3::slotSaveImage(QAction *qwe)
|
|||||||
{
|
{
|
||||||
QObject *smB = this->sender();
|
QObject *smB = this->sender();
|
||||||
int ci = ui->tabMainWidget->currentIndex();
|
int ci = ui->tabMainWidget->currentIndex();
|
||||||
QTime QT = QTime::currentTime();
|
QTime QT = QTime::currentTime();
|
||||||
|
QString t("*.png");
|
||||||
|
|
||||||
if(smB == menuPS)
|
if(smB == menuPS)
|
||||||
{
|
{
|
||||||
@ -1953,13 +1947,13 @@ void nesca_3::slotSaveImage(QAction *qwe)
|
|||||||
sceneGraph->render(&painter, QRect(ax, ay + 8, w - 2, h));
|
sceneGraph->render(&painter, QRect(ax, ay + 8, w - 2, h));
|
||||||
sceneGrid->render(&painter, QRect(ax, ay, w, h));
|
sceneGrid->render(&painter, QRect(ax, ay, w, h));
|
||||||
sceneGrid2->render(&painter, QRect(ax, ay, w, h));
|
sceneGrid2->render(&painter, QRect(ax, ay, w, h));
|
||||||
|
|
||||||
QString filename = QFileDialog::getSaveFileName(
|
QString filename = QFileDialog::getSaveFileName(
|
||||||
this,
|
this,
|
||||||
tr("Save image"),
|
tr("Save image"),
|
||||||
QDir::currentPath() + "/" + fn,
|
QDir::currentPath() + "/" + fn,
|
||||||
".png",
|
".png",
|
||||||
(QString*)&tr("*.png")
|
&t
|
||||||
);
|
);
|
||||||
if (filename != "") pixmap.save(filename);
|
if (filename != "") pixmap.save(filename);
|
||||||
}
|
}
|
||||||
@ -1985,7 +1979,7 @@ void nesca_3::slotSaveImage(QAction *qwe)
|
|||||||
tr("Save image"),
|
tr("Save image"),
|
||||||
QDir::currentPath() + "/" + fn,
|
QDir::currentPath() + "/" + fn,
|
||||||
".png",
|
".png",
|
||||||
(QString*)&tr("*.png")
|
&t
|
||||||
);
|
);
|
||||||
if (filename != "") pixmap.save(filename);
|
if (filename != "") pixmap.save(filename);
|
||||||
};
|
};
|
||||||
@ -3342,6 +3336,13 @@ void _startMsgCheck()
|
|||||||
mct->start();
|
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)
|
nesca_3::nesca_3(QWidget *parent) : QMainWindow(parent)
|
||||||
{
|
{
|
||||||
setWindowFlags ( Qt::FramelessWindowHint );
|
setWindowFlags ( Qt::FramelessWindowHint );
|
||||||
@ -3413,6 +3414,48 @@ void _startMsgCheck()
|
|||||||
_startVerCheck();
|
_startVerCheck();
|
||||||
_startMsgCheck();
|
_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;
|
//float step = 0;
|
||||||
//QPen iprvPenRegular(QColor(51, 51, 51, 100));
|
//QPen iprvPenRegular(QColor(51, 51, 51, 100));
|
||||||
//QPen iprvPen(QColor(51, 51, 51, 100));
|
//QPen iprvPen(QColor(51, 51, 51, 100));
|
||||||
|
@ -512,10 +512,10 @@ void *_tracker()
|
|||||||
if(strstr(rBuffT, "http://") != NULL)
|
if(strstr(rBuffT, "http://") != NULL)
|
||||||
{
|
{
|
||||||
t1 = strstr(rBuffT, "http://");
|
t1 = strstr(rBuffT, "http://");
|
||||||
if(strstr((char*)(t1 + strlen("http://")), "/") != NULL)
|
if(strstr((char*)(t1 + 7), "/") != NULL)
|
||||||
{
|
{
|
||||||
t2 = strstr((char*)(t1 + strlen("http://")), "/");
|
t2 = strstr((char*)(t1 + 7), "/");
|
||||||
int ln = t2 - t1 - strlen("http://");
|
int ln = t2 - t1 - 7;
|
||||||
if(ln > 64)
|
if(ln > 64)
|
||||||
{
|
{
|
||||||
CSSOCKET(sock);
|
CSSOCKET(sock);
|
||||||
@ -525,7 +525,7 @@ void *_tracker()
|
|||||||
|
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
else strncpy(ndbServer, (char*)(t1 + strlen("http://")), ln);
|
else strncpy(ndbServer, (char*)(t1 + 7), ln);
|
||||||
|
|
||||||
if(strlen(t2) > 64)
|
if(strlen(t2) > 64)
|
||||||
{
|
{
|
||||||
@ -895,7 +895,7 @@ void *_connect(void* ss)
|
|||||||
for(int i = 0; i <= overallPorts; ++i)
|
for(int i = 0; i <= overallPorts; ++i)
|
||||||
{
|
{
|
||||||
if(globalScanFlag == false) break;
|
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();
|
ConDec();
|
||||||
@ -1196,6 +1196,7 @@ void ReadUTF8(FILE* nFile, char *cp)
|
|||||||
#if defined(WIN32) || defined(_WIN32) || defined(__WIN32) && !defined(__CYGWIN__)
|
#if defined(WIN32) || defined(_WIN32) || defined(__WIN32) && !defined(__CYGWIN__)
|
||||||
res = xcode(buffFG, CP_UTF8, CP_ACP);
|
res = xcode(buffFG, CP_UTF8, CP_ACP);
|
||||||
#else
|
#else
|
||||||
|
res = std::string(buffFG);
|
||||||
#endif
|
#endif
|
||||||
int sz = res.size();
|
int sz = res.size();
|
||||||
GlobalNegatives[i] = new char[sz + 1];
|
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__)
|
#if defined(WIN32) || defined(_WIN32) || defined(__WIN32) && !defined(__CYGWIN__)
|
||||||
res = xcode(buffFG, CP_UTF8, CP_ACP);
|
res = xcode(buffFG, CP_UTF8, CP_ACP);
|
||||||
#else
|
#else
|
||||||
|
res = std::string(buffFG);
|
||||||
#endif
|
#endif
|
||||||
int sz = res.size();
|
int sz = res.size();
|
||||||
GlobalNegatives[i] = new char[sz + 1];
|
GlobalNegatives[i] = new char[sz + 1];
|
||||||
@ -1226,23 +1228,17 @@ void ReadUTF8(FILE* nFile, char *cp)
|
|||||||
#else
|
#else
|
||||||
strncpy((char*)buffcpy2, buffFG, sz);
|
strncpy((char*)buffcpy2, buffFG, sz);
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
ZeroMemory(buffFG, sizeof(buffFG));
|
ZeroMemory(buffFG, sizeof(buffFG));
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
stt->doEmitionGreenFoundData("Negative list loaded (" + QString::number(GlobalNegativeSize) + " entries)");
|
stt->doEmitionGreenFoundData("Negative list loaded (" + QString::number(GlobalNegativeSize) + " entries)");
|
||||||
|
|
||||||
ZeroMemory(buffFG, sizeof(buffFG));
|
ZeroMemory(buffFG, sizeof(buffFG));
|
||||||
|
|
||||||
fclose(nFile);
|
fclose(nFile);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
|
|
||||||
stt->doEmitionRedFoundData("No negative list found");
|
stt->doEmitionRedFoundData("No negative list found");
|
||||||
stt->doEmitionKillSttThread();
|
stt->doEmitionKillSttThread();
|
||||||
|
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user