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

View File

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

View File

@ -2124,9 +2124,6 @@ void runAuxiliaryThreads() {
int startScan(char* args) {
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;
flCounter = 0;
@ -2146,7 +2143,6 @@ int startScan(char* args) {
ZeroMemory(ipsend, sizeof(ipsend));
#if defined(WIN32) || defined(_WIN32) || defined(__WIN32) && !defined(__CYGWIN__)
//std::string OutputFolder = std::string(RESULT_DIR_NAME);
CreateDirectoryA(RESULT_DIR_NAME, NULL);
#else
struct stat str = {0};
@ -2183,10 +2179,10 @@ int startScan(char* args) {
_passLoginLoader();
_NegativeLoader();
if (gMode == 0)
{
runAuxiliaryThreads();
if (gMode == 0)
{
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];
@ -2248,8 +2244,6 @@ int startScan(char* args) {
}
else if (gMode == 1)
{
runAuxiliaryThreads();
strcpy(top_level_domain, gFirstDom);
char dataEntry[1024] = { 0 };
@ -2301,6 +2295,7 @@ int startScan(char* args) {
memset(dataEntry + innerCounter++, saveEndIP[i], 1);
};
};
memset(dataEntry + innerCounter + 1, '\0', 1);
for (int i = 0; i < sz; ++i)
@ -2376,8 +2371,6 @@ int startScan(char* args) {
return -1;
};
runAuxiliaryThreads();
stt->doEmitionChangeStatus("Scanning...");
for (gC = 0; gC < flCounter; ++gC)
{
@ -2476,6 +2469,7 @@ int startScan(char* args) {
void nCleanup(){
Threader::cleanUp();
curl_global_cleanup();
if(loginLst != NULL)
{
@ -2491,10 +2485,7 @@ void nCleanup(){
};
if(GlobalNegatives != NULL)
{
for(int i = 0; i < GlobalNegativeSize; ++i)
{
delete []GlobalNegatives[i];
};
for(int i = 0; i < GlobalNegativeSize; ++i) delete []GlobalNegatives[i];
delete []GlobalNegatives;
GlobalNegatives = NULL;
};