Test devel branch

This commit is contained in:
cora48 2015-03-23 10:51:58 +03:00
parent 99dc6f8162
commit bc8ac86418
6 changed files with 64 additions and 73 deletions

View File

@ -301,7 +301,7 @@ int Connector::nConnect(const char* ip, const int port, std::string *buffer,
if (lpString != NULL) { if (lpString != NULL) {
curl_easy_setopt(curl, CURLOPT_HTTPAUTH, (long)CURLAUTH_ANY); curl_easy_setopt(curl, CURLOPT_HTTPAUTH, (long)CURLAUTH_ANY);
curl_easy_setopt(curl, CURLOPT_FTPLISTONLY, TRUE); curl_easy_setopt(curl, CURLOPT_FTPLISTONLY, 1L);
curl_easy_setopt(curl, CURLOPT_USERPWD, lpString->c_str()); curl_easy_setopt(curl, CURLOPT_USERPWD, lpString->c_str());
}; };

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

@ -2,7 +2,6 @@
#include "base64.h" #include "base64.h"
#include <libssh/libssh.h> #include <libssh/libssh.h>
#include <openssl/ssl.h>
#include <vector> #include <vector>
#include <curl/curl.h> #include <curl/curl.h>
#if defined(WIN32) || defined(_WIN32) || defined(__WIN32) && !defined(__CYGWIN__) #if defined(WIN32) || defined(_WIN32) || defined(__WIN32) && !defined(__CYGWIN__)

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

@ -1,6 +1,6 @@
<?xml version="1.0" encoding="UTF-8"?> <?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE QtCreatorProject> <!DOCTYPE QtCreatorProject>
<!-- Written by QtCreator 3.2.1, 2015-03-20T15:45:12. --> <!-- Written by QtCreator 3.2.1, 2015-03-23T10:43:12. -->
<qtcreator> <qtcreator>
<data> <data>
<variable>EnvironmentId</variable> <variable>EnvironmentId</variable>

View File

@ -2124,9 +2124,9 @@ 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(); //SSL_library_init();
OpenSSL_add_all_algorithms(); /* Load cryptos, et.al. */ // OpenSSL_add_all_algorithms(); /* Load cryptos, et.al. */
SSL_load_error_strings(); /* Bring in and register error messages */ // SSL_load_error_strings(); /* Bring in and register error messages */
horLineFlag = false; horLineFlag = false;
flCounter = 0; flCounter = 0;
@ -2183,10 +2183,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 +2247,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 };
@ -2376,8 +2374,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)
{ {