mirror of
https://github.com/ChronosX88/nesca.git
synced 2024-11-23 18:52:19 +00:00
DNS-mode fix. Speed increasing.
This commit is contained in:
parent
3d4f51f19c
commit
e784b1d566
@ -1476,21 +1476,16 @@ int Connector::_EstablishConnection(char *ip, int port, char *requesth, conSTR *
|
|||||||
HOSTENT *host;
|
HOSTENT *host;
|
||||||
#if defined(WIN32)
|
#if defined(WIN32)
|
||||||
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
|
||||||
|
if(inet_addr(ip) != INADDR_NONE) sockAddr.sin_addr.s_addr = inet_addr(ip);
|
||||||
|
#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;
|
||||||
return -1;
|
if(host == NULL) return -2;
|
||||||
|
else return -1;
|
||||||
};
|
};
|
||||||
#else
|
|
||||||
if(inet_addr(ip) != INADDR_NONE) sockAddr.sin_addr.s_addr = inet_addr(ip);
|
|
||||||
else if(host=gethostbyname (ip)) ((unsigned long*) &sockAddr.sin_addr)[0] = ((unsigned long**)host->h_addr_list)[0][0];
|
|
||||||
else
|
|
||||||
{
|
|
||||||
++offlines;
|
|
||||||
return -1;
|
|
||||||
};
|
|
||||||
#endif
|
|
||||||
|
|
||||||
SOCKET sock = socket( AF_INET, SOCK_STREAM, IPPROTO_TCP );
|
SOCKET sock = socket( AF_INET, SOCK_STREAM, IPPROTO_TCP );
|
||||||
while(sock == INVALID_SOCKET)
|
while(sock == INVALID_SOCKET)
|
||||||
@ -2518,13 +2513,13 @@ int _SSHLobby(char *ip, int port, conSTR *CSTR)
|
|||||||
return _EstablishSSHConnection(ip, port, CSTR, banner);
|
return _EstablishSSHConnection(ip, port, CSTR, banner);
|
||||||
};
|
};
|
||||||
};
|
};
|
||||||
void Connector::_ConnectToPort(char *ip, const char *portC, char *hl)
|
int Connector::_ConnectToPort(char *ip, const char *portC, char *hl)
|
||||||
{
|
{
|
||||||
if(gPingNScan)
|
if(gPingNScan)
|
||||||
{
|
{
|
||||||
if(_pingMyTarget(ip) == 0)
|
if(_pingMyTarget(ip) == 0)
|
||||||
{
|
{
|
||||||
return;
|
return -2;
|
||||||
};
|
};
|
||||||
};
|
};
|
||||||
|
|
||||||
@ -2540,11 +2535,13 @@ void Connector::_ConnectToPort(char *ip, const char *portC, char *hl)
|
|||||||
int port = atoi(portC);
|
int port = atoi(portC);
|
||||||
int cRes;
|
int cRes;
|
||||||
|
|
||||||
if(port == 443) cRes = _EstablishSSLConnection(ip, port, mes, &CSTR);
|
if(port == 443) cRes = _EstablishSSLConnection(ip, port, mes, &CSTR);
|
||||||
else if(port == 22) cRes = _SSHLobby(ip, port, &CSTR);
|
else if(port == 22) cRes = _SSHLobby(ip, port, &CSTR);
|
||||||
else cRes = _EstablishConnection(ip, port, mes, &CSTR);
|
else cRes = _EstablishConnection(ip, port, mes, &CSTR);
|
||||||
int size = CSTR.size;
|
int size = CSTR.size;
|
||||||
|
|
||||||
|
if(cRes == -2) return -2;
|
||||||
|
|
||||||
if(size > 0 && cRes != -1)
|
if(size > 0 && cRes != -1)
|
||||||
{
|
{
|
||||||
++Alive;
|
++Alive;
|
||||||
|
24
finder.cpp
24
finder.cpp
@ -1839,10 +1839,11 @@ int redirectReconnect(char *cookie, char *ip, int port, char *str, Lexems *ls, P
|
|||||||
{
|
{
|
||||||
tempPort = 443;
|
tempPort = 443;
|
||||||
char *ptr1 = strstri(str, "https://");
|
char *ptr1 = strstri(str, "https://");
|
||||||
char *ptr2 = _findFirstOcc(str + 8, ":/");
|
char *ptr2 = _findFirstOcc(str + 8, ":/?");
|
||||||
if(ptr2 != NULL)
|
if(ptr2 != NULL)
|
||||||
{
|
{
|
||||||
int sz = ptr2 - ptr1 - 8;
|
int sz = ptr2 - ptr1 - 8;
|
||||||
|
ZeroMemory(tempIP, MAX_ADDR_LEN);
|
||||||
strncpy(tempIP, ptr1 + 8, sz < 128 ? sz : 128);
|
strncpy(tempIP, ptr1 + 8, sz < 128 ? sz : 128);
|
||||||
if(ptr2[0] == ':')
|
if(ptr2[0] == ':')
|
||||||
{
|
{
|
||||||
@ -1867,6 +1868,11 @@ int redirectReconnect(char *cookie, char *ip, int port, char *str, Lexems *ls, P
|
|||||||
{
|
{
|
||||||
strncpy(tempPath, ptr2, strlen(ptr2));
|
strncpy(tempPath, ptr2, strlen(ptr2));
|
||||||
}
|
}
|
||||||
|
else if(ptr2[0] == '?')
|
||||||
|
{
|
||||||
|
strcpy(tempPath, "/");
|
||||||
|
strncat(tempPath, ptr2, strlen(ptr2));
|
||||||
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
stt->doEmitionRedFoundData("[Redirect] Unknown protocol (" + QString(ip) + ":" + QString::number(port) + ")");
|
stt->doEmitionRedFoundData("[Redirect] Unknown protocol (" + QString(ip) + ":" + QString::number(port) + ")");
|
||||||
@ -1874,6 +1880,7 @@ int redirectReconnect(char *cookie, char *ip, int port, char *str, Lexems *ls, P
|
|||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
|
ZeroMemory(tempIP, MAX_ADDR_LEN);
|
||||||
strncpy(tempIP, ptr1 + 8, strlen(str) - 8);
|
strncpy(tempIP, ptr1 + 8, strlen(str) - 8);
|
||||||
strcpy(tempPath, "/");
|
strcpy(tempPath, "/");
|
||||||
};
|
};
|
||||||
@ -1893,7 +1900,7 @@ int redirectReconnect(char *cookie, char *ip, int port, char *str, Lexems *ls, P
|
|||||||
conSTR cstr;
|
conSTR cstr;
|
||||||
cstr.size = 0;
|
cstr.size = 0;
|
||||||
cstr.lowerBuff = NULL;
|
cstr.lowerBuff = NULL;
|
||||||
if(con._EstablishSSLConnection(tempIP, tempPort, mes, &cstr) != -1)
|
if(con._EstablishSSLConnection(tempIP, tempPort, mes, &cstr) > -1)
|
||||||
{
|
{
|
||||||
strncpy(buff, cstr.lowerBuff, (cstr.size < 65535 ? cstr.size : 65535));
|
strncpy(buff, cstr.lowerBuff, (cstr.size < 65535 ? cstr.size : 65535));
|
||||||
strcpy(ps->codepage, GetCodePage(cstr.lowerBuff));
|
strcpy(ps->codepage, GetCodePage(cstr.lowerBuff));
|
||||||
@ -1958,10 +1965,11 @@ int redirectReconnect(char *cookie, char *ip, int port, char *str, Lexems *ls, P
|
|||||||
else if(strstr(str, "http://") != NULL) //http
|
else if(strstr(str, "http://") != NULL) //http
|
||||||
{
|
{
|
||||||
char *ptr1 = strstri(str, "http://");
|
char *ptr1 = strstri(str, "http://");
|
||||||
char *ptr2 = _findFirstOcc(str + 7, ":/");
|
char *ptr2 = _findFirstOcc(str + 7, ":/?");
|
||||||
if(ptr2 != NULL)
|
if(ptr2 != NULL)
|
||||||
{
|
{
|
||||||
int sz = ptr2 - ptr1 - 7;
|
int sz = ptr2 - ptr1 - 7;
|
||||||
|
ZeroMemory(tempIP, MAX_ADDR_LEN);
|
||||||
strncpy(tempIP, ptr1 + 7, sz < 128 ? sz : 128);
|
strncpy(tempIP, ptr1 + 7, sz < 128 ? sz : 128);
|
||||||
if(ptr2[0] == ':')
|
if(ptr2[0] == ':')
|
||||||
{
|
{
|
||||||
@ -1986,6 +1994,11 @@ int redirectReconnect(char *cookie, char *ip, int port, char *str, Lexems *ls, P
|
|||||||
{
|
{
|
||||||
strncpy(tempPath, ptr2, strlen(ptr2));
|
strncpy(tempPath, ptr2, strlen(ptr2));
|
||||||
}
|
}
|
||||||
|
else if(ptr2[0] == '?')
|
||||||
|
{
|
||||||
|
strcpy(tempPath, "/");
|
||||||
|
strncat(tempPath, ptr2, strlen(ptr2));
|
||||||
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
stt->doEmitionRedFoundData("[Redirect] Unknown protocol (" + QString(ip) + ":" + QString::number(port) + ")");
|
stt->doEmitionRedFoundData("[Redirect] Unknown protocol (" + QString(ip) + ":" + QString::number(port) + ")");
|
||||||
@ -1993,6 +2006,7 @@ int redirectReconnect(char *cookie, char *ip, int port, char *str, Lexems *ls, P
|
|||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
|
ZeroMemory(tempIP, MAX_ADDR_LEN);
|
||||||
strncpy(tempIP, ptr1 + 7, strlen(str) - 7);
|
strncpy(tempIP, ptr1 + 7, strlen(str) - 7);
|
||||||
strcpy(tempPath, "/");
|
strcpy(tempPath, "/");
|
||||||
};
|
};
|
||||||
@ -2013,7 +2027,7 @@ int redirectReconnect(char *cookie, char *ip, int port, char *str, Lexems *ls, P
|
|||||||
conSTR cstr;
|
conSTR cstr;
|
||||||
cstr.size = 0;
|
cstr.size = 0;
|
||||||
cstr.lowerBuff = NULL;
|
cstr.lowerBuff = NULL;
|
||||||
if(con._EstablishConnection(tempIP, tempPort, mes, &cstr) != -1)
|
if(con._EstablishConnection(tempIP, tempPort, mes, &cstr) > -1)
|
||||||
{
|
{
|
||||||
strncpy(buff, cstr.lowerBuff, (cstr.size < 65535 ? cstr.size : 65535));
|
strncpy(buff, cstr.lowerBuff, (cstr.size < 65535 ? cstr.size : 65535));
|
||||||
strcpy(ps->codepage, GetCodePage(cstr.lowerBuff));
|
strcpy(ps->codepage, GetCodePage(cstr.lowerBuff));
|
||||||
@ -2122,7 +2136,7 @@ int redirectReconnect(char *cookie, char *ip, int port, char *str, Lexems *ls, P
|
|||||||
{
|
{
|
||||||
strncpy(buff, cstr.lowerBuff, 65535);
|
strncpy(buff, cstr.lowerBuff, 65535);
|
||||||
};
|
};
|
||||||
if(cRes != -1)
|
if(cRes > -1)
|
||||||
{
|
{
|
||||||
strcpy(ps->codepage, GetCodePage(cstr.lowerBuff));
|
strcpy(ps->codepage, GetCodePage(cstr.lowerBuff));
|
||||||
|
|
||||||
|
@ -884,7 +884,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;
|
||||||
con._ConnectToPort( ip, std::to_string((long double)portArr[i]).c_str(), "" );
|
if(con._ConnectToPort( ip, std::to_string((long double)portArr[i]).c_str(), "" ) == -2) break;
|
||||||
};
|
};
|
||||||
|
|
||||||
ConDec();
|
ConDec();
|
||||||
@ -1604,8 +1604,8 @@ int fInit(int InitMode, char *gR)
|
|||||||
};
|
};
|
||||||
void FileLoader(char *str)
|
void FileLoader(char *str)
|
||||||
{
|
{
|
||||||
char res[64] = {0};
|
char res[256] = {0};
|
||||||
char curIP[64] = {0}, curIPCopy[64] = {0};
|
char curIP[256] = {0}, curIPCopy[256] = {0};
|
||||||
char tempBuff[4] = {0};
|
char tempBuff[4] = {0};
|
||||||
|
|
||||||
FILE *fl = fopen(str, "r");
|
FILE *fl = fopen(str, "r");
|
||||||
@ -1641,7 +1641,7 @@ void FileLoader(char *str)
|
|||||||
|
|
||||||
rewind(fl);
|
rewind(fl);
|
||||||
|
|
||||||
while(fgets(curIP, 64, fl) != NULL)
|
while(fgets(curIP, 256, fl) != NULL)
|
||||||
{
|
{
|
||||||
if(curIP[0] != '#' && curIP[0] != ' ' && curIP[0] != '\n' && curIP[0] != '\r' && strcmp(curIP, "") != 0 &&
|
if(curIP[0] != '#' && curIP[0] != ' ' && curIP[0] != '\n' && curIP[0] != '\r' && strcmp(curIP, "") != 0 &&
|
||||||
((curIP[0] == '/' && curIP[1] == '/') == false) && ((curIP[0] == '\t' && curIP[1] == '\t' && curIP[2] == '\t' && (curIP[3] == 13 || curIP[3] == 10 || curIP[3] == '#')) == false)
|
((curIP[0] == '/' && curIP[1] == '/') == false) && ((curIP[0] == '\t' && curIP[1] == '\t' && curIP[2] == '\t' && (curIP[3] == 13 || curIP[3] == 10 || curIP[3] == '#')) == false)
|
||||||
@ -1720,8 +1720,8 @@ void FileLoader(char *str)
|
|||||||
)
|
)
|
||||||
)
|
)
|
||||||
{
|
{
|
||||||
char tempMsg[64] = {0};
|
char tempMsg[256] = {0};
|
||||||
strcpy(tempMsg, "[IP Loader]Error in IP list. Line-> [");
|
strcpy(tempMsg, "[IP Loader]Wrong list format. Line-> [");
|
||||||
strcat(tempMsg, std::to_string((long double)flCounter).c_str());
|
strcat(tempMsg, std::to_string((long double)flCounter).c_str());
|
||||||
strcat(tempMsg, "] String-> [");
|
strcat(tempMsg, "] String-> [");
|
||||||
strcat(tempMsg, curIPCopy);
|
strcat(tempMsg, curIPCopy);
|
||||||
@ -1821,7 +1821,14 @@ void FileLoader(char *str)
|
|||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
stt->doEmitionRedFoundData("[IP Loader] Wrong list format. String: " + QString(curIP));
|
char tempMsg[256] = {0};
|
||||||
|
strcpy(tempMsg, "[IP Loader]Wrong list format. Line-> [");
|
||||||
|
strcat(tempMsg, std::to_string((long double)flCounter).c_str());
|
||||||
|
strcat(tempMsg, "] String-> [");
|
||||||
|
strcat(tempMsg, curIPCopy);
|
||||||
|
strcat(tempMsg, "]");
|
||||||
|
stt->doEmitionRedFoundData(QString(tempMsg));
|
||||||
|
return;
|
||||||
};
|
};
|
||||||
ZeroMemory(curIP, sizeof(curIP));
|
ZeroMemory(curIP, sizeof(curIP));
|
||||||
};
|
};
|
||||||
|
@ -243,6 +243,6 @@ class Connector
|
|||||||
int _EstablishSSLConnection(char *ip, int port, char *request, conSTR *cstr);
|
int _EstablishSSLConnection(char *ip, int port, char *request, conSTR *cstr);
|
||||||
void _StartRangeFapping(int ipsstart[], int ipsend[], int &cons, char *argv2, ST *st);
|
void _StartRangeFapping(int ipsstart[], int ipsend[], int &cons, char *argv2, ST *st);
|
||||||
void _Connect(void *s);
|
void _Connect(void *s);
|
||||||
void _ConnectToPort(char *ip, const char *port, char *hl);
|
int _ConnectToPort(char *ip, const char *port, char *hl);
|
||||||
};
|
};
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user