From 9a60c9261daf152894bdac02a6ab5a1fc683cf61 Mon Sep 17 00:00:00 2001 From: cora32 Date: Sat, 15 Nov 2014 04:29:37 +0300 Subject: [PATCH] More verbose output from key-checker thread --- CheckKey_Th.cpp | 19 ++++++++++++++++++- nesca_startModule.cpp | 2 +- 2 files changed, 19 insertions(+), 2 deletions(-) diff --git a/CheckKey_Th.cpp b/CheckKey_Th.cpp index 05ff886..aaad806 100644 --- a/CheckKey_Th.cpp +++ b/CheckKey_Th.cpp @@ -5,6 +5,15 @@ #include "externData.h" #include "externFunctions.h" +char *getHeader(char *buff) +{ + char result[64] = {0}; + char *ptr1 = strstri(buff, "http"); + char *ptr2 = strstri(ptr1, "\r\n"); + int sz = ptr2 - ptr1 - 8; + strncpy(result, ptr1 + 8, sz < 64 ? sz : 64); + return result; +} int emitIfOK = -1; int KeyCheckerMain() { @@ -214,10 +223,18 @@ int KeyCheckerMain() closesocket(sock); return -1; } + else if(strstr(msg, "502 Bad Gateway") != NULL) + { + stt->doEmitionYellowFoundData("[NS-Track] 502 Backend not responding!"); + closesocket(sock); + return -1; + } else { #pragma region QTGUI_Area - stt->doEmitionYellowFoundData("[Key check] -FAIL! An error occured. (" + QString::number(WSAGetLastError()) + ")"); + char header[64] = {0}; + strcpy(header, getHeader(msg)); + stt->doEmitionYellowFoundData("[Key check] -FAIL! An error occured. (" + QString::number(WSAGetLastError()) + ") Header: " + QString::fromLocal8Bit(header) + ""); if(gDebugMode) stt->doEmitionDebugFoundData(QString(msg)); #pragma endregion closesocket(sock); diff --git a/nesca_startModule.cpp b/nesca_startModule.cpp index 1ba1401..0bb199f 100644 --- a/nesca_startModule.cpp +++ b/nesca_startModule.cpp @@ -28,7 +28,6 @@ int MaxPass = 0, MaxLogin = 0, MaxTags = 0, MaxWFLogin = 0, MaxWFPass = 0, MaxSS int ipsstart[4], ipsend[4], overallPorts, flCounter, octet[4]; unsigned char **ipsstartfl = NULL, **ipsendfl = NULL, **starterIP = NULL; -unsigned int importFileSize = 0; int gPingTimeout = 2000; double ips = 0; char top_level_domain[128] = {0}; @@ -1603,6 +1602,7 @@ void FileLoader(char *str) char res[256] = {0}; char curIP[256] = {0}, curIPCopy[256] = {0}; char tempBuff[4] = {0}; + unsigned int importFileSize = 0; FILE *fl = fopen(str, "r"); if(fl != NULL)