mirror of
https://github.com/ChronosX88/nesca.git
synced 2024-12-26 01:11:47 +00:00
Threader fix
This commit is contained in:
parent
391099eadc
commit
f09e6e28b7
@ -8,7 +8,6 @@ std::queue<std::string> Threader::ipQueue;
|
||||
|
||||
void Threader::fireThread(std::string ip, void *func(void)) {
|
||||
|
||||
std::unique_lock<std::mutex> lk(m);
|
||||
ipQueue.push(ip);
|
||||
|
||||
if(threadId < gThreads) {
|
||||
@ -18,7 +17,7 @@ void Threader::fireThread(std::string ip, void *func(void)) {
|
||||
}
|
||||
|
||||
ready = true;
|
||||
Threader::cv.notify_one();
|
||||
cv.notify_one();
|
||||
Sleep(gThreadDelay);
|
||||
}
|
||||
|
||||
|
23
finder.cpp
23
finder.cpp
@ -188,31 +188,28 @@ char *GetCodePage(const char *str)
|
||||
|
||||
int globalSearchNeg(const char *buffcpy, const char *ip, int port)
|
||||
{
|
||||
char negWord[256] = {0};
|
||||
QTextCodec *nCodec = QTextCodec::codecForName("Windows-1251");
|
||||
for(int i = 0; i < GlobalNegativeSize; ++i)
|
||||
{
|
||||
FileUpdater::cv.wait(FileUpdater::lk, []{return FileUpdater::ready;});
|
||||
if(!globalScanFlag) return -1;
|
||||
|
||||
strcpy(negWord, GlobalNegatives[i]);
|
||||
if(strstr(buffcpy, negWord) != NULL)
|
||||
if(strstr(buffcpy, GlobalNegatives[i]) != NULL)
|
||||
{
|
||||
if(gNegDebugMode)
|
||||
{
|
||||
QTextCodec *codec = QTextCodec::codecForName("Windows-1251");
|
||||
QString neg = codec->toUnicode(negWord);
|
||||
{
|
||||
stt->doEmitionDebugFoundData("[<a href=\"http://" + QString(ip) + ":" + QString::number(port) +
|
||||
"/\"><font color=\"#0084ff\">" + QString(ip) + ":" + QString::number(port) +
|
||||
"</font></a>" + "]\tNegative hit: \"" + neg.toHtmlEscaped() + "\"");
|
||||
if(strlen(negWord) < 2)
|
||||
"</font></a>" + "]\tNegative hit: \"" + nCodec->toUnicode(GlobalNegatives[i]).toHtmlEscaped() + "\"");
|
||||
if(strlen(GlobalNegatives[i]) < 2)
|
||||
{
|
||||
stt->doEmitionDebugFoundData(" Len:" + QString::number(strlen(negWord)));
|
||||
stt->doEmitionDebugFoundData(" Len:" + QString::number(strlen(GlobalNegatives[i])));
|
||||
};
|
||||
if(strcmp(negWord, "") == 0)
|
||||
if(strcmp(GlobalNegatives[i], "") == 0)
|
||||
{
|
||||
stt->doEmitionDebugFoundData("Empty hit!");
|
||||
};
|
||||
if(strcmp(negWord, " ") == 0)
|
||||
if(strcmp(GlobalNegatives[i], " ") == 0)
|
||||
{
|
||||
stt->doEmitionDebugFoundData("Space hit!");
|
||||
};
|
||||
@ -220,9 +217,7 @@ int globalSearchNeg(const char *buffcpy, const char *ip, int port)
|
||||
|
||||
++Filt;
|
||||
return -1;
|
||||
};
|
||||
|
||||
ZeroMemory(negWord, 256);
|
||||
};
|
||||
};
|
||||
}
|
||||
|
||||
|
@ -171,39 +171,6 @@ QString GetNSErrorDefinition(const char *str, const char *elem)
|
||||
else return QString("No definition found!");
|
||||
}
|
||||
|
||||
void ConInc()
|
||||
{
|
||||
++ipCounter;
|
||||
#if defined(WIN32) || defined(_WIN32) || defined(__WIN32) && !defined(__CYGWIN__)
|
||||
__asm
|
||||
{
|
||||
lock inc cons;
|
||||
};
|
||||
#else
|
||||
asm("lock; incl cons");
|
||||
#endif
|
||||
|
||||
stt->doEmitionThreads(QString::number(cons) + "/" + QString::number(gThreads));
|
||||
}
|
||||
|
||||
void ConDec()
|
||||
{
|
||||
if(cons > 0)
|
||||
{
|
||||
#if defined(WIN32) || defined(_WIN32) || defined(__WIN32) && !defined(__CYGWIN__)
|
||||
__asm
|
||||
{
|
||||
lock dec cons;
|
||||
};
|
||||
#else
|
||||
asm("lock; decl cons");
|
||||
#endif
|
||||
|
||||
};
|
||||
|
||||
stt->doEmitionThreads(QString::number(cons) + "/" + QString::number(gThreads));
|
||||
}
|
||||
|
||||
void _SaveBackupToFile()
|
||||
{
|
||||
char saveStr[512] = {0};
|
||||
@ -384,7 +351,8 @@ void _timer() {
|
||||
|
||||
ZeroMemory(timeLeft, sizeof(timeLeft));
|
||||
ZeroMemory(dbuffer, sizeof(dbuffer));
|
||||
Sleep(1000);
|
||||
|
||||
Sleep(1000);
|
||||
};
|
||||
}
|
||||
|
||||
@ -1626,6 +1594,38 @@ int _getChunkCount(char *data) {
|
||||
return secondPos - firstPos + 1;
|
||||
}
|
||||
|
||||
|
||||
void ConInc()
|
||||
{
|
||||
#if defined(WIN32) || defined(_WIN32) || defined(__WIN32) && !defined(__CYGWIN__)
|
||||
__asm
|
||||
{
|
||||
lock inc cons;
|
||||
};
|
||||
#else
|
||||
asm("lock; incl cons");
|
||||
#endif
|
||||
stt->doEmitionThreads(QString::number(cons) + "/" +
|
||||
QString::number(gThreads));
|
||||
}
|
||||
void ConDec()
|
||||
{
|
||||
if(cons > 0)
|
||||
{
|
||||
#if defined(WIN32) || defined(_WIN32) || defined(__WIN32) && !defined(__CYGWIN__)
|
||||
__asm
|
||||
{
|
||||
lock dec cons;
|
||||
};
|
||||
#else
|
||||
asm("lock; decl cons");
|
||||
#endif
|
||||
|
||||
};
|
||||
stt->doEmitionThreads(QString::number(cons) + "/" +
|
||||
QString::number(gThreads));
|
||||
}
|
||||
|
||||
void _connect() {
|
||||
|
||||
std::string ip = "";
|
||||
@ -1637,6 +1637,7 @@ void _connect() {
|
||||
--Threader::threadId;
|
||||
Threader::ready = false;
|
||||
lk.unlock();
|
||||
Threader::cv.notify_one();
|
||||
return;
|
||||
}
|
||||
|
||||
@ -1645,7 +1646,9 @@ void _connect() {
|
||||
Threader::ipQueue.pop();
|
||||
Threader::ready = false;
|
||||
lk.unlock();
|
||||
Threader::cv.notify_one();
|
||||
|
||||
++ipCounter;
|
||||
ConInc();
|
||||
for (int i = 0; i <= overallPorts; ++i)
|
||||
{
|
||||
@ -1745,14 +1748,6 @@ void runAuxiliaryThreads() {
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
int startScan(char* args) {
|
||||
curl_global_init(CURL_GLOBAL_ALL);
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user