debug output fix

This commit is contained in:
cora48 2015-04-02 13:56:03 +03:00
parent 17261ac2d1
commit 391099eadc
4 changed files with 43 additions and 40 deletions

View File

@ -151,7 +151,7 @@ int Connector::nConnect(const char* ip, const int port, std::string *buffer,
} }
curl_easy_setopt(curl, CURLOPT_FOLLOWLOCATION, 1L); curl_easy_setopt(curl, CURLOPT_FOLLOWLOCATION, 1L);
curl_easy_setopt(curl, CURLOPT_CONNECTTIMEOUT, gTimeOut); curl_easy_setopt(curl, CURLOPT_CONNECTTIMEOUT, gTimeOut);
curl_easy_setopt(curl, CURLOPT_TIMEOUT, gTimeOut + 5); curl_easy_setopt(curl, CURLOPT_TIMEOUT, gTimeOut + 3);
if(postData != NULL) { if(postData != NULL) {
curl_easy_setopt(curl, CURLOPT_POSTFIELDS, postData); curl_easy_setopt(curl, CURLOPT_POSTFIELDS, postData);
@ -255,8 +255,7 @@ int Connector::_ConnectToPort(char* ip, int port)
if(size > 0) if(size > 0)
{ {
++Alive; ++Alive;
++found; stt->doEmitionChangeParsed(QString::number(saved) + "/" + QString::number(++found));
stt->doEmitionChangeParsed(QString::number(saved) + "/" + QString::number(found));
Lexems lx; Lexems lx;
lx._filler(port, buffer.c_str(), ip, size, &lx); lx._filler(port, buffer.c_str(), ip, size, &lx);
}; };

View File

@ -34,11 +34,7 @@ void checkWeb(const char *fileName, std::string *oldLM) {
if(lm.compare(*oldLM) != 0) { if(lm.compare(*oldLM) != 0) {
*oldLM = lm; *oldLM = lm;
//QString res(buffer.substr(buffer.find("\r\n\r\n") + 4).c_str());
std::string res(buffer.substr(buffer.find("\r\n\r\n") + 4).c_str()); std::string res(buffer.substr(buffer.find("\r\n\r\n") + 4).c_str());
//res.replace("\r\n", "\n");
//QTextCodec *codec = QTextCodec::codecForName("Windows-1251");
//res = codec->toUnicode(res.toLocal8Bit().data());
std::ofstream out(fileName); std::ofstream out(fileName);
out << std::string(res); out << std::string(res);
out.close(); out.close();

View File

@ -194,8 +194,7 @@ int globalSearchNeg(const char *buffcpy, const char *ip, int port)
FileUpdater::cv.wait(FileUpdater::lk, []{return FileUpdater::ready;}); FileUpdater::cv.wait(FileUpdater::lk, []{return FileUpdater::ready;});
if(!globalScanFlag) return -1; if(!globalScanFlag) return -1;
strcpy(negWord, GlobalNegatives[i]); strcpy(negWord, GlobalNegatives[i]);
printf("%s", buffcpy);
if(strstr(buffcpy, negWord) != NULL) if(strstr(buffcpy, negWord) != NULL)
{ {
if(gNegDebugMode) if(gNegDebugMode)

View File

@ -758,37 +758,6 @@ unsigned long int numOfIps(int ipsstart[], int ipsend[]) {
return gTargets; return gTargets;
} }
void _connect() {
std::string ip = "";
while (globalScanFlag) {
std::unique_lock<std::mutex> lk(Threader::m);
Threader::cv.wait(lk, []{return Threader::ready; });
if (Threader::threadId > gThreads || !globalScanFlag) {
--Threader::threadId;
Threader::ready = false;
lk.unlock();
return;
}
if (!Threader::ipQueue.empty()) {
ip = Threader::ipQueue.front();
Threader::ipQueue.pop();
Threader::ready = false;
lk.unlock();
ConInc();
for (int i = 0; i <= overallPorts; ++i)
{
if (!globalScanFlag) break;
if (Connector::_ConnectToPort((char*)ip.c_str(), portArr[i]) == -2) break;
};
ConDec();
}
}
}
void verboseProgress(unsigned long target) { void verboseProgress(unsigned long target) {
stt->doEmitionIPRANGE(QString(currentIP)); stt->doEmitionIPRANGE(QString(currentIP));
@ -1657,6 +1626,37 @@ int _getChunkCount(char *data) {
return secondPos - firstPos + 1; return secondPos - firstPos + 1;
} }
void _connect() {
std::string ip = "";
while (globalScanFlag) {
std::unique_lock<std::mutex> lk(Threader::m);
Threader::cv.wait(lk, []{return Threader::ready; });
if (Threader::threadId > gThreads || !globalScanFlag) {
--Threader::threadId;
Threader::ready = false;
lk.unlock();
return;
}
if (!Threader::ipQueue.empty()) {
ip = Threader::ipQueue.front();
Threader::ipQueue.pop();
Threader::ready = false;
lk.unlock();
ConInc();
for (int i = 0; i <= overallPorts; ++i)
{
if (!globalScanFlag) break;
if (Connector::_ConnectToPort((char*)ip.c_str(), portArr[i]) == -2) break;
};
ConDec();
}
}
}
int _GetDNSFromMask(char *mask, char *saveMask, char *saveMaskEnder) { int _GetDNSFromMask(char *mask, char *saveMask, char *saveMaskEnder) {
if(strstr(mask, "[") != NULL) if(strstr(mask, "[") != NULL)
@ -1744,6 +1744,15 @@ void runAuxiliaryThreads() {
saverThread.detach(); saverThread.detach();
} }
int startScan(char* args) { int startScan(char* args) {
curl_global_init(CURL_GLOBAL_ALL); curl_global_init(CURL_GLOBAL_ALL);