Test devel branch

This commit is contained in:
cora48 2015-03-23 11:03:39 +03:00
parent 99dc6f8162
commit f150180473
3 changed files with 62 additions and 75 deletions

View File

@ -143,66 +143,66 @@ int OpenConnection(SOCKET *sock, const char *hostname, int port)
return 0; return 0;
} }
void _baSSLWorker(char *ip, char *request, char *rvBuff) //void _baSSLWorker(char *ip, char *request, char *rvBuff)
{ //{
const SSL_METHOD *method = SSLv3_client_method(); /* Create new client-method instance */ // const SSL_METHOD *method = SSLv3_client_method(); /* Create new client-method instance */
SSL_CTX *ctx = SSL_CTX_new(method); /* Create new context */ // SSL_CTX *ctx = SSL_CTX_new(method); /* Create new context */
if(ctx != NULL) // if(ctx != NULL)
{ // {
SOCKET sock; // SOCKET sock;
SSL_CTX_set_timeout(ctx, gTimeOut); // SSL_CTX_set_timeout(ctx, gTimeOut);
int result = OpenConnection(&sock, ip, 443); // int result = OpenConnection(&sock, ip, 443);
if(result >= 0) // if(result >= 0)
{ // {
SSL *ssl = NULL; // SSL *ssl = NULL;
ssl = SSL_new(ctx); /* create new SSL connection state */ // ssl = SSL_new(ctx); /* create new SSL connection state */
if(ssl != NULL) // if(ssl != NULL)
{ // {
SSL_set_fd(ssl, sock); /* attach the socket descriptor */ // SSL_set_fd(ssl, sock); /* attach the socket descriptor */
if(SSL_connect(ssl)) // if(SSL_connect(ssl))
{ // {
SSL_write(ssl, request, strlen(request)); // SSL_write(ssl, request, strlen(request));
if(MapWidgetOpened) stt->doEmitionAddOutData(QString(request)); // if(MapWidgetOpened) stt->doEmitionAddOutData(QString(request));
char tempBuff[128] = {0}; // char tempBuff[128] = {0};
int x = 1; // int x = 1;
int xx = 0; // int xx = 0;
ZeroMemory(rvBuff, sizeof(*rvBuff)); // ZeroMemory(rvBuff, sizeof(*rvBuff));
while(xx < 512) // while(xx < 512)
{ // {
x = SSL_read(ssl, tempBuff, sizeof(tempBuff)); // x = SSL_read(ssl, tempBuff, sizeof(tempBuff));
if(x <= 0) break; // if(x <= 0) break;
Activity += x; // Activity += x;
xx += x; // xx += x;
strncat(rvBuff, tempBuff, x); // strncat(rvBuff, tempBuff, x);
ZeroMemory(tempBuff, sizeof(tempBuff)); // ZeroMemory(tempBuff, sizeof(tempBuff));
}; // };
if(MapWidgetOpened) stt->doEmitionAddIncData(QString(ip), QString(rvBuff)); // if(MapWidgetOpened) stt->doEmitionAddIncData(QString(ip), QString(rvBuff));
if(HTMLDebugMode) _DebugWriteHTMLToFile(request, rvBuff); // if(HTMLDebugMode) _DebugWriteHTMLToFile(request, rvBuff);
}; // };
SSL_shutdown(ssl); // SSL_shutdown(ssl);
SSL_free(ssl); // SSL_free(ssl);
CSSOCKET(sock); // CSSOCKET(sock);
SSL_CTX_free(ctx); /* release context */ // SSL_CTX_free(ctx); /* release context */
return; // return;
}; // };
}; // };
CSSOCKET(sock); // CSSOCKET(sock);
SSL_CTX_free(ctx); /* release context */ // SSL_CTX_free(ctx); /* release context */
} // }
else // else
{ // {
char buff1[512] = {0}; // char buff1[512] = {0};
char buff2[512] = {0}; // char buff2[512] = {0};
ERR_error_string(ERR_peek_error(), buff1); // ERR_error_string(ERR_peek_error(), buff1);
ERR_error_string(ERR_peek_last_error(), buff2); // ERR_error_string(ERR_peek_last_error(), buff2);
stt->doEmitionRedFoundData(QString(ip) + " SSL(InitCTX) 1:" + QString(buff1) + " 2:" + QString(buff2)); // stt->doEmitionRedFoundData(QString(ip) + " SSL(InitCTX) 1:" + QString(buff1) + " 2:" + QString(buff2));
}; // };
} //}
char *_getAttributeValue(char *str, char *val, char *ip, int port) char *_getAttributeValue(char *str, char *val, char *ip, int port)
{ {

View File

@ -86,12 +86,8 @@ OTHER_FILES += \
nesca_3.rc nesca_3.rc
unix|win32: LIBS += -lssl
unix|win32: LIBS += -lssh unix|win32: LIBS += -lssh
unix|win32: LIBS += -lcrypto unix|win32: LIBS += -lcrypto
unix|win32: LIBS += -lpthread
unix|win32: LIBS += -lcurl unix|win32: LIBS += -lcurl

View File

@ -2124,9 +2124,6 @@ void runAuxiliaryThreads() {
int startScan(char* args) { int startScan(char* args) {
curl_global_init(CURL_GLOBAL_ALL); curl_global_init(CURL_GLOBAL_ALL);
SSL_library_init();
OpenSSL_add_all_algorithms(); /* Load cryptos, et.al. */
SSL_load_error_strings(); /* Bring in and register error messages */
horLineFlag = false; horLineFlag = false;
flCounter = 0; flCounter = 0;
@ -2146,7 +2143,6 @@ int startScan(char* args) {
ZeroMemory(ipsend, sizeof(ipsend)); ZeroMemory(ipsend, sizeof(ipsend));
#if defined(WIN32) || defined(_WIN32) || defined(__WIN32) && !defined(__CYGWIN__) #if defined(WIN32) || defined(_WIN32) || defined(__WIN32) && !defined(__CYGWIN__)
//std::string OutputFolder = std::string(RESULT_DIR_NAME);
CreateDirectoryA(RESULT_DIR_NAME, NULL); CreateDirectoryA(RESULT_DIR_NAME, NULL);
#else #else
struct stat str = {0}; struct stat str = {0};
@ -2183,10 +2179,10 @@ int startScan(char* args) {
_passLoginLoader(); _passLoginLoader();
_NegativeLoader(); _NegativeLoader();
if (gMode == 0) runAuxiliaryThreads();
{
runAuxiliaryThreads();
if (gMode == 0)
{
unsigned long ip1 = (ipsstart[0] * 16777216) + (ipsstart[1] * 65536) + (ipsstart[2] * 256) + ipsstart[3]; unsigned long ip1 = (ipsstart[0] * 16777216) + (ipsstart[1] * 65536) + (ipsstart[2] * 256) + ipsstart[3];
unsigned long ip2 = (ipsend[0] * 16777216) + (ipsend[1] * 65536) + (ipsend[2] * 256) + ipsend[3]; unsigned long ip2 = (ipsend[0] * 16777216) + (ipsend[1] * 65536) + (ipsend[2] * 256) + ipsend[3];
@ -2247,9 +2243,7 @@ int startScan(char* args) {
} }
} }
else if (gMode == 1) else if (gMode == 1)
{ {
runAuxiliaryThreads();
strcpy(top_level_domain, gFirstDom); strcpy(top_level_domain, gFirstDom);
char dataEntry[1024] = { 0 }; char dataEntry[1024] = { 0 };
@ -2301,6 +2295,7 @@ int startScan(char* args) {
memset(dataEntry + innerCounter++, saveEndIP[i], 1); memset(dataEntry + innerCounter++, saveEndIP[i], 1);
}; };
}; };
memset(dataEntry + innerCounter + 1, '\0', 1); memset(dataEntry + innerCounter + 1, '\0', 1);
for (int i = 0; i < sz; ++i) for (int i = 0; i < sz; ++i)
@ -2376,8 +2371,6 @@ int startScan(char* args) {
return -1; return -1;
}; };
runAuxiliaryThreads();
stt->doEmitionChangeStatus("Scanning..."); stt->doEmitionChangeStatus("Scanning...");
for (gC = 0; gC < flCounter; ++gC) for (gC = 0; gC < flCounter; ++gC)
{ {
@ -2476,6 +2469,7 @@ int startScan(char* args) {
void nCleanup(){ void nCleanup(){
Threader::cleanUp(); Threader::cleanUp();
curl_global_cleanup();
if(loginLst != NULL) if(loginLst != NULL)
{ {
@ -2491,10 +2485,7 @@ void nCleanup(){
}; };
if(GlobalNegatives != NULL) if(GlobalNegatives != NULL)
{ {
for(int i = 0; i < GlobalNegativeSize; ++i) for(int i = 0; i < GlobalNegativeSize; ++i) delete []GlobalNegatives[i];
{
delete []GlobalNegatives[i];
};
delete []GlobalNegatives; delete []GlobalNegatives;
GlobalNegatives = NULL; GlobalNegatives = NULL;
}; };