mirror of
https://github.com/ChronosX88/nesca.git
synced 2024-11-23 10:42:21 +00:00
Commit from eclipse!
This commit is contained in:
commit
98b9fc2f17
37
ActivityDrawerTh_HorNet.cpp
Normal file
37
ActivityDrawerTh_HorNet.cpp
Normal file
@ -0,0 +1,37 @@
|
||||
#include "ActivityDrawerTh_HorNet.h"
|
||||
#include "externData.h"
|
||||
|
||||
void ActivityDrawerTh_HorNet::doEmitDrawActivityLine(QString data)
|
||||
{
|
||||
emit adtHN->sDrawActivityLine(data);
|
||||
};
|
||||
void ActivityDrawerTh_HorNet::doEmitDrawGrid()
|
||||
{
|
||||
emit adtHN->sDrawGrid();
|
||||
};
|
||||
|
||||
void makeActLine(int val)
|
||||
{
|
||||
if(actLst.size() < 50) actLst.push_back(val);
|
||||
else
|
||||
{
|
||||
actLst.pop_front();
|
||||
actLst.push_back(val);
|
||||
};
|
||||
};
|
||||
void ActivityDrawerTh_HorNet::run()
|
||||
{
|
||||
adtHN->doEmitDrawGrid();
|
||||
int maxAct = Activity + 1;
|
||||
int nm = 0;
|
||||
while(true)
|
||||
{
|
||||
if(maxAct < Activity) maxAct = Activity;
|
||||
if(maxAct > 1000) nm = maxAct-=1000;
|
||||
else if(maxAct > 10) nm = maxAct-=10;
|
||||
makeActLine(((float)Activity/(nm != 0 ? nm : 1)) * 10);
|
||||
adtHN->doEmitDrawActivityLine(QString::number(Activity) + "b");
|
||||
Activity = 0;
|
||||
msleep(130);
|
||||
};
|
||||
};
|
21
ActivityDrawerTh_HorNet.h
Normal file
21
ActivityDrawerTh_HorNet.h
Normal file
@ -0,0 +1,21 @@
|
||||
#ifndef ACTIVITYDRAWERTH_HORNET_H
|
||||
#define ACTIVITYDRAWERTH_HORNET_H
|
||||
|
||||
#pragma once
|
||||
#include "STh.h"
|
||||
|
||||
class ActivityDrawerTh_HorNet : public QThread
|
||||
{
|
||||
Q_OBJECT
|
||||
|
||||
public: signals: void sDrawActivityLine(QString);
|
||||
public: signals: void sDrawGrid();
|
||||
|
||||
public:
|
||||
static void doEmitDrawActivityLine(QString data);
|
||||
static void doEmitDrawGrid();
|
||||
protected:
|
||||
void run();
|
||||
};
|
||||
extern ActivityDrawerTh_HorNet *adtHN;
|
||||
#endif // ACTIVITYDRAWERTH_HORNET_H
|
270
CheckKey_Th.cpp
Normal file
270
CheckKey_Th.cpp
Normal file
@ -0,0 +1,270 @@
|
||||
#pragma once
|
||||
#include "CheckKey_Th.h"
|
||||
#include "CheckProxy_Th.h"
|
||||
#include "STh.h"
|
||||
#include "externData.h"
|
||||
#include "externFunctions.h"
|
||||
|
||||
void getSubStrEx(char *src, char *startStr, char *endStr, char *dest, int szDest)
|
||||
{
|
||||
ZeroMemory(dest, szDest);
|
||||
char *ptr1 = strstri(src, startStr);
|
||||
if(ptr1 != NULL)
|
||||
{
|
||||
char *ptr2 = strstri(ptr1, endStr);
|
||||
if(ptr2 != NULL)
|
||||
{
|
||||
int szStartStr = strlen(startStr);
|
||||
int sz = ptr2 - ptr1 - szStartStr;
|
||||
strncpy(dest, ptr1 + szStartStr, sz < szDest ? sz : szDest);
|
||||
};
|
||||
};
|
||||
}
|
||||
void getSubStr(char *src, char *startStr, char *endStr, char *dest, int szDest)
|
||||
{
|
||||
ZeroMemory(dest, szDest);
|
||||
char *ptr1 = strstri(src, startStr);
|
||||
if(ptr1 != NULL)
|
||||
{
|
||||
char *ptr2 = strstri(ptr1, endStr);
|
||||
if(ptr2 != NULL)
|
||||
{
|
||||
int sz = ptr2 - ptr1;
|
||||
strncpy(dest, ptr1, sz < szDest ? sz : szDest);
|
||||
};
|
||||
};
|
||||
}
|
||||
int emitIfOK = -1;
|
||||
int KeyCheckerMain()
|
||||
{
|
||||
int kLen = strlen(trcPersKey);
|
||||
if(kLen == 0)
|
||||
{
|
||||
stt->doEmitionRedFoundData("[Key check] Key field is empty.");
|
||||
return -1;
|
||||
}
|
||||
else if(kLen < 32)
|
||||
{
|
||||
stt->doEmitionRedFoundData("[Key check] Key length is not valid.");
|
||||
return -1;
|
||||
};
|
||||
char msg[1024] = {0};
|
||||
char ndbServer[64] = {0};
|
||||
char ndbScript[64] = {0};
|
||||
|
||||
sockaddr_in sockAddr;
|
||||
sockAddr.sin_family = AF_INET;
|
||||
sockAddr.sin_port = htons(atoi(trcSrvPortLine));
|
||||
|
||||
strcpy(msg, "GET ");
|
||||
strcat(msg, "/");
|
||||
strcat(msg, trcScr);
|
||||
strcat(msg, " HTTP/1.0\r\nHost: ");
|
||||
strcat(msg, trcSrv);
|
||||
strcat(msg, "\r\nX-Nescav3: True");
|
||||
strcat(msg, "\r\nConnection: close");
|
||||
strcat(msg, "\r\n\r\n");
|
||||
|
||||
HOSTENT *host;
|
||||
|
||||
#if defined(WIN32) || defined(_WIN32) || defined(__WIN32) && !defined(__CYGWIN__)
|
||||
if(inet_addr(trcSrv) != INADDR_NONE) sockAddr.sin_addr.S_un.S_addr = inet_addr(trcSrv);
|
||||
else if(host=gethostbyname (trcSrv)) ((unsigned long*) &sockAddr.sin_addr)[0] = ((unsigned long**)host->h_addr_list)[0][0];
|
||||
#else
|
||||
if(inet_addr(trcSrv) != INADDR_NONE) sockAddr.sin_addr.s_addr = inet_addr(trcSrv);
|
||||
else if(host=gethostbyname (trcSrv)) ((unsigned long*) &sockAddr.sin_addr)[0] = ((unsigned long**)host->h_addr_list)[0][0];
|
||||
#endif
|
||||
SOCKET sock = socket( AF_INET, SOCK_STREAM, IPPROTO_TCP );
|
||||
|
||||
stt->doEmitionYellowFoundData("[Key check] Requesting server ip...");
|
||||
int test = connect(sock, (sockaddr*)&sockAddr, sizeof(sockAddr));
|
||||
if(test == -1)
|
||||
{
|
||||
stt->doEmitionRedFoundData("[Key check] -connect() returned. Cannot connect to balancer! " + QString::number(WSAGetLastError()) + ".");
|
||||
CSSOCKET(sock);
|
||||
return -1;
|
||||
};
|
||||
|
||||
test = send(sock, msg, strlen(msg), 0);
|
||||
|
||||
if(test == -1)
|
||||
{
|
||||
stt->doEmitionRedFoundData("[Key check] -send() returned. Cannot send to balancer! " + QString::number(WSAGetLastError()) + ".");
|
||||
CSSOCKET(sock);
|
||||
|
||||
return -1;
|
||||
};
|
||||
|
||||
ZeroMemory(msg, sizeof(msg));
|
||||
int ror = sizeof(msg);
|
||||
|
||||
test = recv(sock, msg, sizeof(msg), 0);
|
||||
char buff[512] = {0};
|
||||
while((test = recv(sock, msg, sizeof(msg), 0)) != 0)
|
||||
{
|
||||
strcat(msg, buff);
|
||||
};
|
||||
|
||||
if(test == -1)
|
||||
{
|
||||
stt->doEmitionRedFoundData("[Key check] -recv() returned. Cannot recv from balancer! " + QString::number(WSAGetLastError()) + ".");
|
||||
CSSOCKET(sock);
|
||||
|
||||
return -1;
|
||||
};
|
||||
|
||||
char *t1;
|
||||
char *t2;
|
||||
if(strstr(msg, "http://") != NULL)
|
||||
{
|
||||
t1 = strstr(msg, "http://");
|
||||
if(strstr((char*)(t1 + strlen("http://")), "/") != NULL)
|
||||
{
|
||||
t2 = strstr((char*)(t1 + strlen("http://")), "/");
|
||||
int ln = t2 - t1 - strlen("http://");
|
||||
if(ln > 64)
|
||||
{
|
||||
stt->doEmitionRedFoundData("[Key check] -Received server string is not valid!");
|
||||
CSSOCKET(sock);
|
||||
|
||||
return -1;
|
||||
}
|
||||
else strncpy(ndbServer, (char*)(t1 + strlen("http://")), ln);
|
||||
|
||||
|
||||
if(strlen(t2) > 64)
|
||||
{
|
||||
stt->doEmitionYellowFoundData("[Key check] -Fragmentation detected!");
|
||||
if(strstr(t2, "\r\n") != NULL)
|
||||
{
|
||||
char *t3 = strstr(t2, "\r\n");
|
||||
int y = (int)(t3 - t2);
|
||||
|
||||
if(y > 64)
|
||||
{
|
||||
stt->doEmitionRedFoundData("[Key check] -Received server string is not valid!");
|
||||
CSSOCKET(sock);
|
||||
|
||||
return -1;
|
||||
}
|
||||
else
|
||||
{
|
||||
strncpy(ndbScript, t2, y);
|
||||
};
|
||||
}
|
||||
else
|
||||
{
|
||||
stt->doEmitionRedFoundData("[Key check] -Received server string is not valid!");
|
||||
CSSOCKET(sock);
|
||||
|
||||
return -1;
|
||||
};
|
||||
} else strcpy(ndbScript, t2);
|
||||
}
|
||||
else
|
||||
{
|
||||
stt->doEmitionRedFoundData("[Key check] -Cannot receive script value!");
|
||||
CSSOCKET(sock);
|
||||
|
||||
return -1;
|
||||
};
|
||||
|
||||
ZeroMemory(msg, sizeof(msg));
|
||||
|
||||
stt->doEmitionGreenFoundData("[Key check] -OK. -Server string aquired! Checking key...");
|
||||
CSSOCKET(sock);
|
||||
|
||||
sockAddr.sin_family = AF_INET;
|
||||
sockAddr.sin_port = htons(atoi(trcSrvPortLine));
|
||||
strcpy(msg, "GET ");
|
||||
strcat(msg, "/api/checkaccount?key=");
|
||||
strncat(msg, trcPersKey, 32);
|
||||
strcat(msg, " HTTP/1.0\r\nHost: ");
|
||||
strcat(msg, ndbServer);
|
||||
strcat(msg, "\r\nConnection: close");
|
||||
strcat(msg, "\r\n\r\n");
|
||||
|
||||
#if defined(WIN32) || defined(_WIN32) || defined(__WIN32) && !defined(__CYGWIN__)
|
||||
if(inet_addr(ndbServer) != INADDR_NONE) sockAddr.sin_addr.S_un.S_addr = inet_addr(ndbServer);
|
||||
else if(host=gethostbyname (ndbServer)) ((unsigned long*) &sockAddr.sin_addr)[0] = ((unsigned long**)host->h_addr_list)[0][0];
|
||||
#else
|
||||
if(inet_addr(ndbServer) != INADDR_NONE) sockAddr.sin_addr.s_addr = inet_addr(ndbServer);
|
||||
else if(host=gethostbyname (ndbServer)) ((unsigned long*) &sockAddr.sin_addr)[0] = ((unsigned long**)host->h_addr_list)[0][0];
|
||||
#endif
|
||||
sock = socket( AF_INET, SOCK_STREAM, IPPROTO_TCP );
|
||||
|
||||
int c = connect(sock, (sockaddr*)&sockAddr, sizeof(sockAddr));
|
||||
if(c == SOCKET_ERROR)
|
||||
{
|
||||
stt->doEmitionRedFoundData("[Key check] -Connection timeout.");
|
||||
CSSOCKET(sock);
|
||||
return -1;
|
||||
};
|
||||
c = send(sock, msg, strlen(msg), 0);
|
||||
if(c == SOCKET_ERROR)
|
||||
{
|
||||
stt->doEmitionRedFoundData("[Key check] -Send error.");
|
||||
CSSOCKET(sock);
|
||||
return -1;
|
||||
};
|
||||
ZeroMemory(msg, sizeof(msg));
|
||||
test = recv(sock, msg, 512, 0);
|
||||
|
||||
if(strstr(msg, "202 Accepted") != NULL)
|
||||
{
|
||||
#pragma region QTGUI_Area
|
||||
stt->doEmitionGreenFoundData("[Key check] -OK. Key is valid!");
|
||||
#pragma endregion
|
||||
CSSOCKET(sock);
|
||||
|
||||
if(emitIfOK == 0) stt->doEmitionStartScanIP();
|
||||
else if(emitIfOK == 1) stt->doEmitionStartScanDNS();
|
||||
else if(emitIfOK == 2) stt->doEmitionStartScanImport();
|
||||
return 1;
|
||||
}
|
||||
else if(strstr(msg, "400 Bad Request") != NULL)
|
||||
{
|
||||
#pragma region QTGUI_Area
|
||||
QString errorDef = GetNSErrorDefinition(msg, "notify");
|
||||
if(errorDef == "Invalid access key") stt->doEmitionYellowFoundData("[NS-Track] [Key is unauthorized] A valid key is required.");
|
||||
else stt->doEmitionYellowFoundData("[NS-Track] -FAIL! [400 Bad Request : " + GetNSErrorDefinition(msg, "notify") + "]");
|
||||
#pragma endregion
|
||||
CSSOCKET(sock);
|
||||
return -1;
|
||||
}
|
||||
else if(strstr(msg, "503 Bad Gateway") != NULL)
|
||||
{
|
||||
stt->doEmitionYellowFoundData("[NS-Track] 503 Backend not responding!");
|
||||
CSSOCKET(sock);
|
||||
return -1;
|
||||
}
|
||||
else
|
||||
{
|
||||
#pragma region QTGUI_Area
|
||||
char header[64] = {0};
|
||||
getSubStrEx(msg, "http/1.1 ", "\r\n", header, 64);
|
||||
stt->doEmitionYellowFoundData("[Key check] -FAIL! An error occured. (" + QString::number(WSAGetLastError()) + ") Header: <u>" + QString::fromLocal8Bit(header) + "</u>");
|
||||
if(gDebugMode) stt->doEmitionDebugFoundData(QString(msg));
|
||||
#pragma endregion
|
||||
CSSOCKET(sock);
|
||||
return -1;
|
||||
};
|
||||
|
||||
ZeroMemory(msg, sizeof(msg));
|
||||
CSSOCKET(sock);
|
||||
}
|
||||
else
|
||||
{
|
||||
#pragma region QTGUI_Area
|
||||
stt->doEmitionRedFoundData("[Key check] -Balancer replied with invalid string.");
|
||||
if(gDebugMode) stt->doEmitionDebugFoundData(QString(msg));
|
||||
CSSOCKET(sock);
|
||||
return -1;
|
||||
#pragma endregion
|
||||
};
|
||||
};
|
||||
|
||||
void CheckKey_Th::run()
|
||||
{
|
||||
KeyCheckerMain();
|
||||
};
|
16
CheckKey_Th.h
Normal file
16
CheckKey_Th.h
Normal file
@ -0,0 +1,16 @@
|
||||
#ifndef CHECKKEY_TH_H
|
||||
#define CHECKKEY_TH_H
|
||||
|
||||
#pragma once
|
||||
#include "STh.h"
|
||||
extern int emitIfOK;
|
||||
class CheckKey_Th : public QThread
|
||||
{
|
||||
Q_OBJECT
|
||||
|
||||
protected:
|
||||
void run();
|
||||
};
|
||||
|
||||
extern CheckKey_Th *chKTh;
|
||||
#endif // CHECKKEY_TH_H
|
154
CheckProxy_Th.cpp
Normal file
154
CheckProxy_Th.cpp
Normal file
@ -0,0 +1,154 @@
|
||||
#include "CheckProxy_Th.h"
|
||||
#include "externData.h"
|
||||
|
||||
void CheckProxy_Th::doEmitChangeRedIRCData(QString str)
|
||||
{
|
||||
emit chPTh->changeRedIRCData(str);
|
||||
};
|
||||
void CheckProxy_Th::doEmitChangeGreenIRCData(QString str)
|
||||
{
|
||||
emit chPTh->changeGreenIRCData(str);
|
||||
};
|
||||
void CheckProxy_Th::doEmitChangeYellowIRCData(QString str)
|
||||
{
|
||||
emit chPTh->changeYellowIRCData(str);
|
||||
};
|
||||
void CheckProxy_Th::doEmitChangeRawIRCDataInc(QString str)
|
||||
{
|
||||
emit chPTh->changeRawIRCDataInc(str);
|
||||
};
|
||||
void CheckProxy_Th::doEmitChangeRawIRCDataOut(QString str)
|
||||
{
|
||||
emit chPTh->changeRawIRCDataOut(str);
|
||||
};
|
||||
|
||||
void CheckProxyLogic()
|
||||
{
|
||||
QString str1 = ui->ircProxyPort->text();
|
||||
QString str2 = ui->ircProxy->text();
|
||||
strcpy(ircProxy, str2.toUtf8().data());
|
||||
strcpy(ircProxyPort, str1.toUtf8().data());
|
||||
|
||||
int err, yes = 1;
|
||||
SOCKET pSock;
|
||||
char precvBuff[2048] = {0};
|
||||
sockaddr_in addr;
|
||||
addr.sin_family = AF_INET;
|
||||
addr.sin_port = htons(atoi(ircProxyPort));
|
||||
|
||||
HOSTENT *host;
|
||||
|
||||
#if defined(WIN32) || defined(_WIN32) || defined(__WIN32) && !defined(__CYGWIN__)
|
||||
if(inet_addr(ircProxy) != INADDR_NONE) addr.sin_addr.S_un.S_addr = inet_addr(ircProxy);
|
||||
else if(host = gethostbyname (ircProxy)) ((unsigned long*) &addr.sin_addr)[0] = ((unsigned long**)host->h_addr_list)[0][0];
|
||||
#else
|
||||
if(inet_addr(ircProxy) != INADDR_NONE) addr.sin_addr.s_addr = inet_addr(ircProxy);
|
||||
else if(host=gethostbyname (ircProxy)) ((unsigned long*) &addr.sin_addr)[0] = ((unsigned long**)host->h_addr_list)[0][0];
|
||||
#endif
|
||||
pSock = socket(AF_INET, SOCK_STREAM, IPPROTO_TCP);
|
||||
|
||||
if(pSock == INVALID_SOCKET)
|
||||
{
|
||||
#pragma region QTGUI_Area
|
||||
chPTh->doEmitChangeRedIRCData("CheckProxy: -INVALID SOCKET.");
|
||||
#pragma endregion
|
||||
}
|
||||
else
|
||||
{
|
||||
if(connect(pSock, (sockaddr*)&addr, sizeof(addr)) != SOCKET_ERROR)
|
||||
{
|
||||
#pragma region QTGUI_Area
|
||||
chPTh->doEmitChangeRawIRCDataOut(QString::fromLocal8Bit("CONNECT 2ip.ru HTTP/1.1\r\n\r\n"));
|
||||
#pragma endregion
|
||||
send(pSock, "CONNECT 2ip.ru HTTP/1.1\r\n\r\n", strlen("CONNECT 2ip.ru HTTP/1.1\r\n\r\n"), 0);
|
||||
|
||||
while(recv(pSock, precvBuff, sizeof(precvBuff), 0) > 0)
|
||||
{
|
||||
#pragma region QTGUI_Area
|
||||
chPTh->doEmitChangeRawIRCDataInc(QString::fromLocal8Bit(precvBuff));
|
||||
#pragma endregion
|
||||
if( (strstr(precvBuff, "HTTP/1.1 200 OK") || strstr(precvBuff, "200 OK")
|
||||
|| strstr(precvBuff, "OK 200") || strstr(precvBuff, "200 Connection")
|
||||
)
|
||||
&& (strlen(precvBuff) < 150)
|
||||
&& strstr(precvBuff, "404 File Not Found") == NULL
|
||||
&&
|
||||
(
|
||||
strstr(precvBuff, "Invalid Request") == NULL
|
||||
|| strstr(precvBuff, "Invalid request") == NULL || strstr(precvBuff, "invalid request") == NULL
|
||||
|| strstr(precvBuff, "400 Bad Request") == NULL || strstr(precvBuff, " 400 bad request") == NULL
|
||||
)
|
||||
)
|
||||
{
|
||||
|
||||
#pragma region QTGUI_Area
|
||||
chPTh->doEmitChangeRawIRCDataOut(QString::fromLocal8Bit("GET / HTTP/1.1\r\nHost: 2ip.ru\r\n\r\n"));
|
||||
#pragma endregion
|
||||
send(pSock, "GET / HTTP/1.1\r\nHost: 2ip.ru\r\n\r\n", strlen("GET / HTTP/1.1\r\nHost: 2ip.ru\r\n\r\n"), 0);
|
||||
ZeroMemory(precvBuff, sizeof(precvBuff));
|
||||
while(recv(pSock, precvBuff, sizeof(precvBuff), 0) > 0)
|
||||
{
|
||||
|
||||
#pragma region QTGUI_Area
|
||||
chPTh->doEmitChangeRawIRCDataInc(QString::fromLocal8Bit(precvBuff));
|
||||
#pragma endregion
|
||||
if(strstr(precvBuff, "404 File Not Found") == NULL && strstr(precvBuff, "Invalid Request") == NULL
|
||||
&& strstr(precvBuff, "Invalid request") == NULL && strstr(precvBuff, "invalid request") == NULL
|
||||
&& strstr(precvBuff, "400 Bad Request") == NULL && strstr(precvBuff, "400 bad request") == NULL
|
||||
&& strstr(precvBuff, "404 Not") == NULL && strstr(precvBuff, "404 not") == NULL
|
||||
&& strstr(precvBuff, "500 Internal") == NULL && strstr(precvBuff, "500 internal") == NULL
|
||||
&& strstr(precvBuff, "401 Unauthorized") == NULL && strstr(precvBuff, "401 unauthorized") == NULL
|
||||
&& strstr(precvBuff, "InvalidUrl") == NULL && strstr(precvBuff, "invalidurl") == NULL
|
||||
&& strstr(precvBuff, "Invalid Url") == NULL && strstr(precvBuff, "invalid url") == NULL
|
||||
&& strstr(precvBuff, "Gateway Timeout") == NULL && strstr(precvBuff, "Gateway timeout") == NULL
|
||||
&& strstr(precvBuff, "gateway timeout") == NULL
|
||||
)
|
||||
{
|
||||
|
||||
#pragma region QTGUI_Area
|
||||
chPTh->doEmitChangeGreenIRCData("[OK] Success! Now using " + QString(ircProxy) + ":" + QString(ircProxyPort) + ".");
|
||||
#pragma endregion
|
||||
proxyEnabledFlag = 1;
|
||||
|
||||
CSSOCKET(pSock);
|
||||
break;
|
||||
}
|
||||
else
|
||||
{
|
||||
#pragma region QTGUI_Area
|
||||
chPTh->doEmitChangeRedIRCData(QString(ircProxy) + ":" + QString(ircProxyPort) + " - is not CONNECT proxy? Try another one.");
|
||||
#pragma endregion
|
||||
proxyEnabledFlag = 0;
|
||||
|
||||
CSSOCKET(pSock);
|
||||
break;
|
||||
};
|
||||
};
|
||||
break;
|
||||
}
|
||||
else
|
||||
{
|
||||
#pragma region QTGUI_Area
|
||||
chPTh->doEmitChangeRedIRCData(QString(ircProxy) + ":" + QString(ircProxyPort) + " - is not CONNECT proxy? Try another one.");
|
||||
#pragma endregion
|
||||
proxyEnabledFlag = 0;
|
||||
|
||||
CSSOCKET(pSock);
|
||||
break;
|
||||
};
|
||||
};
|
||||
}
|
||||
else
|
||||
{
|
||||
#pragma region QTGUI_Area
|
||||
chPTh->doEmitChangeRedIRCData("Cannot connect to " + QString(ircProxy) + ":" + QString(ircProxyPort) + ".");
|
||||
#pragma endregion
|
||||
proxyEnabledFlag = 0;
|
||||
};
|
||||
};
|
||||
};
|
||||
|
||||
void CheckProxy_Th::run()
|
||||
{
|
||||
CheckProxyLogic();
|
||||
};
|
27
CheckProxy_Th.h
Normal file
27
CheckProxy_Th.h
Normal file
@ -0,0 +1,27 @@
|
||||
#ifndef CHECKPROXY_TH_H
|
||||
#define CHECKPROXY_TH_H
|
||||
|
||||
#pragma once
|
||||
#include "nesca_3.h"
|
||||
|
||||
class CheckProxy_Th : public QThread
|
||||
{
|
||||
Q_OBJECT
|
||||
|
||||
public: signals: void changeRedIRCData(QString);
|
||||
public: signals: void changeGreenIRCData(QString);
|
||||
public: signals: void changeYellowIRCData(QString);
|
||||
public: signals: void changeRawIRCDataInc(QString);
|
||||
public: signals: void changeRawIRCDataOut(QString);
|
||||
|
||||
public:
|
||||
void doEmitChangeRedIRCData(QString str);
|
||||
void doEmitChangeGreenIRCData(QString str);
|
||||
void doEmitChangeYellowIRCData(QString str);
|
||||
void doEmitChangeRawIRCDataOut(QString str);
|
||||
void doEmitChangeRawIRCDataInc(QString str);
|
||||
protected:
|
||||
void run();
|
||||
};
|
||||
extern CheckProxy_Th *chPTh;
|
||||
#endif // CHECKPROXY_TH_H
|
22
DrawerTh_GridQoSScanner.cpp
Normal file
22
DrawerTh_GridQoSScanner.cpp
Normal file
@ -0,0 +1,22 @@
|
||||
#include "DrawerTh_GridQoSScanner.h"
|
||||
|
||||
void DrawerTh_GridQoSScanner::doEmitAddLine()
|
||||
{
|
||||
emit dtGridQoS->sAddLine();
|
||||
};
|
||||
|
||||
void DrawerTh_GridQoSScanner::run()
|
||||
{
|
||||
while(QoSScanFlag)
|
||||
{
|
||||
if(stt->isRunning() == true)
|
||||
{
|
||||
if(widgetIsHidden == false && tray->isVisible() == false)
|
||||
{
|
||||
++QoSStep;
|
||||
emit dtGridQoS->doEmitAddLine();
|
||||
};
|
||||
};
|
||||
msleep(2000);
|
||||
};
|
||||
};
|
22
DrawerTh_GridQoSScanner.h
Normal file
22
DrawerTh_GridQoSScanner.h
Normal file
@ -0,0 +1,22 @@
|
||||
#ifndef DRAWERTH_GRIDQOSSCANNER_H
|
||||
#define DRAWERTH_GRIDQOSSCANNER_H
|
||||
|
||||
#pragma once
|
||||
#include "STh.h"
|
||||
|
||||
class DrawerTh_GridQoSScanner : public QThread
|
||||
{
|
||||
Q_OBJECT
|
||||
|
||||
public:
|
||||
public: signals: void sAddLine();
|
||||
|
||||
public:
|
||||
void doEmitAddLine();
|
||||
|
||||
protected:
|
||||
void run();
|
||||
};
|
||||
|
||||
extern DrawerTh_GridQoSScanner *dtGridQoS;
|
||||
#endif // DRAWERTH_GRIDQOSSCANNER_H
|
42
DrawerTh_HorNet.cpp
Normal file
42
DrawerTh_HorNet.cpp
Normal file
@ -0,0 +1,42 @@
|
||||
#include "DrawerTh_HorNet.h"
|
||||
|
||||
void DrawerTh_HorNet::run()
|
||||
{
|
||||
qsrand (QDateTime::currentMSecsSinceEpoch());
|
||||
int factor = 0;
|
||||
|
||||
int gWidth = ui->graphicLog->width();
|
||||
int gHeight = ui->graphicLog->height();
|
||||
|
||||
dtHN->doEmitionAddDelimLines();
|
||||
|
||||
while(ME2ScanFlag)
|
||||
{
|
||||
if(widgetIsHidden == false && tray->isVisible() == false)
|
||||
{
|
||||
++factor > 9 ? factor = 0 : NULL;
|
||||
dtHN->doEmitionDrawGrid();
|
||||
|
||||
for(int i = 0; i < gHeight; i += 10)
|
||||
{
|
||||
QApplication::processEvents();
|
||||
dtHN->doEmitionAddLine(0, i + factor, gWidth, i + factor);
|
||||
QApplication::processEvents();
|
||||
};
|
||||
};
|
||||
msleep(200);
|
||||
};
|
||||
};
|
||||
|
||||
void DrawerTh_HorNet::doEmitionDrawGrid()
|
||||
{
|
||||
emit dtHN->sDrawGrid();
|
||||
};
|
||||
void DrawerTh_HorNet::doEmitionAddLine(int x1, int y1, int x2, int y2)
|
||||
{
|
||||
emit dtHN->sAddLine(x1, y1, x2, y2);
|
||||
};
|
||||
void DrawerTh_HorNet::doEmitionAddDelimLines()
|
||||
{
|
||||
emit dtHN->sAddDelimLines();
|
||||
};
|
25
DrawerTh_HorNet.h
Normal file
25
DrawerTh_HorNet.h
Normal file
@ -0,0 +1,25 @@
|
||||
#ifndef DRAWERTH_HORNET_H
|
||||
#define DRAWERTH_HORNET_H
|
||||
|
||||
#pragma once
|
||||
#include "nesca_3.h"
|
||||
|
||||
class DrawerTh_HorNet : public QThread
|
||||
{
|
||||
Q_OBJECT
|
||||
|
||||
public:
|
||||
static void doEmitionDrawGrid();
|
||||
static void doEmitionAddLine(int x1, int y1, int x2, int y2);
|
||||
static void doEmitionAddDelimLines();
|
||||
|
||||
public: signals: void sAddDelimLines();
|
||||
public: signals: void sAddLine(int, int, int, int);
|
||||
public: signals: void sDrawGrid();
|
||||
|
||||
protected:
|
||||
void run();
|
||||
};
|
||||
|
||||
extern DrawerTh_HorNet *dtHN;
|
||||
#endif // DRAWERTH_HORNET_H
|
149
DrawerTh_ME2Scanner.cpp
Normal file
149
DrawerTh_ME2Scanner.cpp
Normal file
@ -0,0 +1,149 @@
|
||||
#include "DrawerTh_ME2Scanner.h"
|
||||
#include "STh.h"
|
||||
#include "externData.h"
|
||||
|
||||
void DrawerTh_ME2Scanner::doEmitDrawTextPlacers()
|
||||
{
|
||||
emit dtME2->sDrawTextPlacers();
|
||||
};
|
||||
|
||||
void DrawerTh_ME2Scanner::doEmitionAddPolyLine()
|
||||
{
|
||||
emit dtME2->sAddPolyLine();
|
||||
};
|
||||
void MakePolygonLine(int gWidth)
|
||||
{
|
||||
vect.clear();
|
||||
int x = 0;
|
||||
int tx = 0;
|
||||
int xtx = 0;
|
||||
QPointF qp(0, 20);
|
||||
vect.append(qp);
|
||||
int fact1 = 0,
|
||||
fact2 = 0,
|
||||
fact3 = 0,
|
||||
fact4 = 0,
|
||||
fact5 = 0,
|
||||
fact6 = 0,
|
||||
fact7 = 0;
|
||||
|
||||
bool state = stt->isRunning();
|
||||
for(int i = 1; i < 130; ++i)
|
||||
{
|
||||
x = qrand() % 4 + 2 + i;
|
||||
xtx = x + tx;
|
||||
if(xtx > 1 && xtx < 31)
|
||||
{
|
||||
qp = QPointF(xtx, state ? qrand() % 3 - 3 + 20 - AnomC1*2 - fact1 : 20);
|
||||
if(AnomC1 > 0)
|
||||
{
|
||||
if(xtx < 16 ) fact1+=2;
|
||||
else fact1-=2;
|
||||
};
|
||||
}
|
||||
|
||||
if(xtx > 34 && xtx < 72)
|
||||
{
|
||||
qp = QPointF(xtx, state ? qrand() % 3 - 3 + 20 - WF*2 - fact2 : 20);
|
||||
|
||||
if(WF > 0)
|
||||
{
|
||||
if(xtx < 52 ) fact2+=2;
|
||||
else fact2-=2;
|
||||
};
|
||||
}
|
||||
|
||||
if(xtx > 74 && xtx < 112)
|
||||
{
|
||||
qp = QPointF(xtx, state ? qrand() % 3 - 3 + 20 - BA*2 - fact3 : 20);
|
||||
|
||||
if(BA > 0)
|
||||
{
|
||||
if(xtx < 92 ) fact3+=2;
|
||||
else fact3-=2;
|
||||
};
|
||||
}
|
||||
|
||||
if(xtx > 114 && xtx < 152)
|
||||
{
|
||||
qp = QPointF(xtx, state ? qrand() % 3 - 3 + 20 - Susp*2 - fact4 : 20);
|
||||
|
||||
if(Susp > 0)
|
||||
{
|
||||
if(xtx < 132 ) fact4+=2;
|
||||
else fact4-=2;
|
||||
};
|
||||
}
|
||||
|
||||
if(xtx > 154 && xtx < 192)
|
||||
{
|
||||
qp = QPointF(xtx, state ? qrand() % 3 - 3 + 20 - Overl*2 - fact5 : 20);
|
||||
|
||||
if(Overl > 0)
|
||||
{
|
||||
if(xtx < 172 ) fact5+=2;
|
||||
else fact5-=2;
|
||||
};
|
||||
}
|
||||
|
||||
if(xtx > 194 && xtx < 232)
|
||||
{
|
||||
qp = QPointF(xtx, state ? qrand() % 3 - 3 + 20 - Lowl*2 - fact6 : 20);
|
||||
|
||||
if(Lowl > 0)
|
||||
{
|
||||
if(xtx < 212 ) fact6+=2;
|
||||
else fact6-=2;
|
||||
};
|
||||
}
|
||||
|
||||
if(xtx > 234 && xtx < 269)
|
||||
{
|
||||
qp = QPointF(xtx, state ? qrand() % 3 - 3 + 20 - Alive*2 - fact7 : 20);
|
||||
|
||||
if(Alive > 0)
|
||||
{
|
||||
if(xtx < 252 ) fact7+=2;
|
||||
else fact7-=2;
|
||||
};
|
||||
};
|
||||
|
||||
vect.append(qp);
|
||||
tx = x;
|
||||
};
|
||||
AnomC1 = 0;
|
||||
WF = 0;
|
||||
BA = 0;
|
||||
Filt = 0;
|
||||
Overl = 0;
|
||||
Lowl = 0;
|
||||
Alive = 0;
|
||||
Susp = 0;
|
||||
vect.append(QPointF(gWidth, 20));
|
||||
};
|
||||
void DrawerTh_ME2Scanner::run()
|
||||
{
|
||||
int gWidth = ui->graphicLog->width();
|
||||
dtME2->doEmitDrawTextPlacers();
|
||||
while(ME2ScanFlag)
|
||||
{
|
||||
if(widgetIsHidden == false && tray->isVisible() == false)
|
||||
{
|
||||
MakePolygonLine(gWidth);
|
||||
dtME2->doEmitionAddPolyLine();
|
||||
}
|
||||
else
|
||||
{
|
||||
msleep(1000);
|
||||
AnomC1 = 0;
|
||||
WF = 0;
|
||||
BA = 0;
|
||||
Filt = 0;
|
||||
Overl = 0;
|
||||
Lowl = 0;
|
||||
Alive = 0;
|
||||
Susp = 0;
|
||||
};
|
||||
msleep(150);
|
||||
};
|
||||
};
|
22
DrawerTh_ME2Scanner.h
Normal file
22
DrawerTh_ME2Scanner.h
Normal file
@ -0,0 +1,22 @@
|
||||
#ifndef DRAWERTH_ME2SCANNER_H
|
||||
#define DRAWERTH_ME2SCANNER_H
|
||||
|
||||
#pragma once
|
||||
#include "STh.h"
|
||||
|
||||
class DrawerTh_ME2Scanner : public QThread
|
||||
{
|
||||
Q_OBJECT
|
||||
|
||||
public:
|
||||
static void doEmitionAddPolyLine();
|
||||
static void doEmitDrawTextPlacers();
|
||||
|
||||
public: signals: void sAddPolyLine();
|
||||
public: signals: void sDrawTextPlacers();
|
||||
|
||||
protected:
|
||||
void run();
|
||||
};
|
||||
extern DrawerTh_ME2Scanner *dtME2;
|
||||
#endif // DRAWERTH_ME2SCANNER_H
|
64
DrawerTh_QoSScanner.cpp
Normal file
64
DrawerTh_QoSScanner.cpp
Normal file
@ -0,0 +1,64 @@
|
||||
#pragma once
|
||||
#include "DrawerTh_QoSScanner.h"
|
||||
#include "STh.h"
|
||||
#include "externData.h"
|
||||
|
||||
int tMax;
|
||||
|
||||
void DrawerTh_QoSScanner::run()
|
||||
{
|
||||
while(QoSScanFlag)
|
||||
{
|
||||
tMax = 0;
|
||||
|
||||
if(stt->isRunning() == true && widgetIsHidden == false && tray->isVisible() == false && QOSWait == false)
|
||||
{
|
||||
lstOfLabels.clear();
|
||||
lstOfLabels.append(Alive);
|
||||
lstOfLabels.append(AnomC1);
|
||||
lstOfLabels.append(WF);
|
||||
lstOfLabels.append(Susp);
|
||||
lstOfLabels.append(Lowl);
|
||||
lstOfLabels.append((int)BA);
|
||||
lstOfLabels.append(Overl);
|
||||
lstOfLabels.append(ssh);
|
||||
|
||||
QList<int> lstOfLabelsCopy = lstOfLabels;
|
||||
qSort(lstOfLabelsCopy.begin(), lstOfLabelsCopy.end(), qGreater<float>());
|
||||
int curVal = lstOfLabelsCopy[0];
|
||||
if(curVal > MaxDataVal) MaxDataVal = curVal;
|
||||
if(curVal > tMax) tMax = curVal;
|
||||
|
||||
dtQoS->doEmitionAddLine();
|
||||
}
|
||||
else
|
||||
{
|
||||
msleep(500);
|
||||
AnomC1 = 0;
|
||||
WF = 0;
|
||||
BA = 0;
|
||||
Filt = 0;
|
||||
Overl = 0;
|
||||
Lowl = 0;
|
||||
Alive = 0;
|
||||
Susp = 0;
|
||||
ssh = 0;
|
||||
};
|
||||
|
||||
AnomC1 = 0;
|
||||
WF = 0;
|
||||
BA = 0;
|
||||
Filt = 0;
|
||||
Overl = 0;
|
||||
Lowl = 0;
|
||||
Alive = 0;
|
||||
Susp = 0;
|
||||
ssh = 0;
|
||||
msleep(2000);
|
||||
};
|
||||
};
|
||||
|
||||
void DrawerTh_QoSScanner::doEmitionAddLine()
|
||||
{
|
||||
emit dtQoS->sAddLine();
|
||||
};
|
21
DrawerTh_QoSScanner.h
Normal file
21
DrawerTh_QoSScanner.h
Normal file
@ -0,0 +1,21 @@
|
||||
#ifndef DRAWERTH_QOSSCANNER_H
|
||||
#define DRAWERTH_QOSSCANNER_H
|
||||
|
||||
#pragma once
|
||||
#include "nesca_3.h"
|
||||
|
||||
class DrawerTh_QoSScanner : public QThread
|
||||
{
|
||||
Q_OBJECT
|
||||
|
||||
public:
|
||||
static void doEmitionAddLine();
|
||||
|
||||
public: signals: void sAddLine();
|
||||
|
||||
protected:
|
||||
void run();
|
||||
};
|
||||
|
||||
extern DrawerTh_QoSScanner *dtQoS;
|
||||
#endif // DRAWERTH_QOSSCANNER_H
|
135
DrawerTh_VoiceScanner.cpp
Normal file
135
DrawerTh_VoiceScanner.cpp
Normal file
@ -0,0 +1,135 @@
|
||||
#include "DrawerTh_VoiceScanner.h"
|
||||
#include "externData.h"
|
||||
|
||||
void DrawerTh_VoiceScanner::doEmitAddLine()
|
||||
{
|
||||
emit vsTh->sAddLine();
|
||||
};
|
||||
void DrawerTh_VoiceScanner::doEmitDrawGrid(int factor)
|
||||
{
|
||||
emit vsTh->sDrawGrid(factor);
|
||||
};
|
||||
void DrawerTh_VoiceScanner::doEmitDrawTextPlacers()
|
||||
{
|
||||
emit vsTh->sDrawTextPlacers();
|
||||
};
|
||||
|
||||
void makeVoiceLine(int Al, int An, int Bd, int Sp, int Lo, int var, int Ovl, int WF, int SSH)
|
||||
{
|
||||
if(vAlivLst.size() < 140)
|
||||
{
|
||||
if(Al > 0) vAlivLst.push_back((Al + 1)*10);
|
||||
}
|
||||
else
|
||||
{
|
||||
vAlivLst.pop_front();
|
||||
if(Al > 0) vAlivLst.push_back((Al + 1)*10);
|
||||
};
|
||||
|
||||
if(vAnomLst.size() < 140)
|
||||
{
|
||||
if(An > 0) vAnomLst.push_back((An + 1)*10);
|
||||
}
|
||||
else
|
||||
{
|
||||
vAnomLst.pop_front();
|
||||
if(An > 0) vAnomLst.push_back((An + 1)*10);
|
||||
};
|
||||
|
||||
if(vWFLst.size() < 140)
|
||||
{
|
||||
if(Bd > 0) vWFLst.push_back((Bd + 1)*10);
|
||||
}
|
||||
else
|
||||
{
|
||||
vWFLst.pop_front();
|
||||
if(Bd > 0) vWFLst.push_back((Bd + 1)*10);
|
||||
};
|
||||
|
||||
if(vSuspLst.size() < 140)
|
||||
{
|
||||
if(Sp > 0) vSuspLst.push_back((Sp + 1)*10);
|
||||
}
|
||||
else
|
||||
{
|
||||
vSuspLst.pop_front();
|
||||
if(Sp > 0) vSuspLst.push_back((Sp + 1)*10);
|
||||
};
|
||||
|
||||
if(vLowlLst.size() < 140)
|
||||
{
|
||||
if(Lo > 0) vLowlLst.push_back((Lo + 1)*10);
|
||||
}
|
||||
else
|
||||
{
|
||||
vLowlLst.pop_front();
|
||||
if(Lo > 0) vLowlLst.push_back((Lo + 1)*10);
|
||||
};
|
||||
|
||||
if(vLowlLst.size() < 140)
|
||||
{
|
||||
if(var > 0) vBALst.push_back((var + 1)*10);
|
||||
}
|
||||
else
|
||||
{
|
||||
vBALst.pop_front();
|
||||
if(var > 0) vBALst.push_back((var + 1)*10);
|
||||
};
|
||||
|
||||
if(vOvrlLst.size() < 140)
|
||||
{
|
||||
if(Ovl > 0) vOvrlLst.push_back((Ovl + 1)*10);
|
||||
}
|
||||
else
|
||||
{
|
||||
vOvrlLst.pop_front();
|
||||
if(Ovl > 0) vOvrlLst.push_back((Ovl + 1)*10);
|
||||
};
|
||||
|
||||
if(vSSHLst.size() < 140)
|
||||
{
|
||||
if(SSH > 0) vSSHLst.push_back((SSH + 1)*10);
|
||||
}
|
||||
else
|
||||
{
|
||||
vSSHLst.pop_front();
|
||||
if(SSH > 0) vSSHLst.push_back((SSH + 1)*10);
|
||||
};
|
||||
};
|
||||
void DrawerTh_VoiceScanner::run()
|
||||
{
|
||||
vsTh->doEmitDrawGrid(150);
|
||||
vsTh->doEmitDrawTextPlacers();
|
||||
while(VoiceScanFlag)
|
||||
{
|
||||
if(widgetIsHidden == false && tray->isVisible() == false)
|
||||
{
|
||||
makeVoiceLine(Alive, AnomC1, WF, Susp, Lowl, BA, Overl, WF, ssh);
|
||||
Alive = 0;
|
||||
AnomC1 = 0;
|
||||
WF = 0;
|
||||
Filt = 0;
|
||||
Lowl = 0;
|
||||
BA = 0;
|
||||
Overl = 0;
|
||||
Susp = 0;
|
||||
ssh = 0;
|
||||
|
||||
vsTh->doEmitAddLine();
|
||||
msleep(150);
|
||||
}
|
||||
else
|
||||
{
|
||||
msleep(500);
|
||||
Alive = 0;
|
||||
AnomC1 = 0;
|
||||
WF = 0;
|
||||
Filt = 0;
|
||||
Lowl = 0;
|
||||
BA = 0;
|
||||
Overl = 0;
|
||||
Susp = 0;
|
||||
ssh = 0;
|
||||
};
|
||||
};
|
||||
};
|
23
DrawerTh_VoiceScanner.h
Normal file
23
DrawerTh_VoiceScanner.h
Normal file
@ -0,0 +1,23 @@
|
||||
#ifndef DRAWERTH_VOICESCANNER_H
|
||||
#define DRAWERTH_VOICESCANNER_H
|
||||
|
||||
#pragma once
|
||||
#include "nesca_3.h"
|
||||
|
||||
class DrawerTh_VoiceScanner : public QThread
|
||||
{
|
||||
Q_OBJECT
|
||||
|
||||
public:
|
||||
public: signals: void sAddLine();
|
||||
public: signals: void sDrawGrid(int factor);
|
||||
public: signals: void sDrawTextPlacers();
|
||||
public:
|
||||
void doEmitAddLine();
|
||||
void doEmitDrawGrid(int factor);
|
||||
void doEmitDrawTextPlacers();
|
||||
protected:
|
||||
void run();
|
||||
};
|
||||
extern DrawerTh_VoiceScanner *vsTh;
|
||||
#endif // DRAWERTH_VOICESCANNER_H
|
BIN
Eurostile.ttf
Normal file
BIN
Eurostile.ttf
Normal file
Binary file not shown.
31
IRCPinger_Th.cpp
Normal file
31
IRCPinger_Th.cpp
Normal file
@ -0,0 +1,31 @@
|
||||
#pragma once
|
||||
#include "IRCPinger_Th.h"
|
||||
#include "externData.h"
|
||||
|
||||
void IRCPinger_Th::doEmitChangeRedIRCData(QString str)
|
||||
{
|
||||
emit ircPTh->changeRedIRCData(str);
|
||||
};
|
||||
void IRCPinger_Th::doEmitRestartIRC()
|
||||
{
|
||||
emit ircPTh->RestartIRC();
|
||||
};
|
||||
|
||||
void IRCPinger_Th::run()
|
||||
{
|
||||
while(iWantToConnect)
|
||||
{
|
||||
if(globalPinger >= 360) //6min timeout
|
||||
{
|
||||
#pragma region QTGUI_Area
|
||||
ircPTh->doEmitChangeRedIRCData("-//- Ping timeout. Reconnecting... ");
|
||||
#pragma endregion
|
||||
|
||||
ircPTh->doEmitRestartIRC();
|
||||
globalPinger = 0;
|
||||
msleep(10000);
|
||||
};
|
||||
++globalPinger;
|
||||
msleep(1000);
|
||||
};
|
||||
};
|
23
IRCPinger_Th.h
Normal file
23
IRCPinger_Th.h
Normal file
@ -0,0 +1,23 @@
|
||||
#ifndef IRCPINGER_TH_H
|
||||
#define IRCPINGER_TH_H
|
||||
|
||||
#pragma once
|
||||
#include "nesca_3.h"
|
||||
extern int iWantToConnect;
|
||||
|
||||
class IRCPinger_Th : public QThread
|
||||
{
|
||||
Q_OBJECT
|
||||
|
||||
public:
|
||||
static void doEmitChangeRedIRCData(QString str);
|
||||
static void doEmitRestartIRC();
|
||||
|
||||
public: signals: void changeRedIRCData(QString);
|
||||
public: signals: void RestartIRC();
|
||||
|
||||
protected:
|
||||
void run();
|
||||
};
|
||||
extern IRCPinger_Th *ircPTh;
|
||||
#endif // IRCPINGER_TH_H
|
102
STh.cpp
Normal file
102
STh.cpp
Normal file
@ -0,0 +1,102 @@
|
||||
#include "STh.h"
|
||||
|
||||
void STh::doEmitionShowRedVersion()
|
||||
{
|
||||
emit stt->showRedVersion();
|
||||
};
|
||||
void STh::doEmitionStartScanIP()
|
||||
{
|
||||
emit stt->startScanIP();
|
||||
};
|
||||
void STh::doEmitionStartScanDNS()
|
||||
{
|
||||
emit stt->startScanDNS();
|
||||
};
|
||||
void STh::doEmitionStartScanImport()
|
||||
{
|
||||
emit stt->startScanImport();
|
||||
};
|
||||
void STh::doEmitionAddIncData(QString(ip), QString str)
|
||||
{
|
||||
emit stt->sIncData(ip, str);
|
||||
};
|
||||
void STh::doEmitionAddOutData(QString ip, QString str)
|
||||
{
|
||||
emit stt->sOutData(ip, str);
|
||||
};
|
||||
void STh::doEmitionIPRANGE(QString str)
|
||||
{
|
||||
emit stt->changeIpRange(str);
|
||||
}
|
||||
void STh::doEmitionThreads(QString str)
|
||||
{
|
||||
emit stt->changeThreads(str);
|
||||
}
|
||||
void STh::doEmitionIPS(QString str)
|
||||
{
|
||||
emit stt->changeIPS(str);
|
||||
}
|
||||
void STh::doEmitionFoundData(QString str)
|
||||
{
|
||||
emit stt->changeFoundData(str);
|
||||
}
|
||||
void STh::doEmitionBAData(QString str)
|
||||
{
|
||||
emit stt->changeBAData(str);
|
||||
}
|
||||
void STh::doEmition_BARedData(QString str)
|
||||
{
|
||||
emit stt->changeRedBAData(str);
|
||||
};
|
||||
void STh::doEmition_BAGreenData(QString str)
|
||||
{
|
||||
emit stt->changeGreenBAData(str);
|
||||
}
|
||||
void STh::doEmitionRedFoundData(QString str)
|
||||
{
|
||||
emit stt->changeRedFoundData(str);
|
||||
}
|
||||
void STh::doEmitionGreenFoundData(QString str)
|
||||
{
|
||||
emit stt->changeGreenFoundData(str);
|
||||
}
|
||||
void STh::doEmitionYellowFoundData(QString str)
|
||||
{
|
||||
emit stt->changeYellowFoundData(str);
|
||||
}
|
||||
void STh::doEmitionDebugFoundData(QString str)
|
||||
{
|
||||
emit stt->changeDebugFoundData(str);
|
||||
}
|
||||
void STh::doEmitionChangeStatus(QString str)
|
||||
{
|
||||
emit stt->changeStatus(str);
|
||||
}
|
||||
void STh::doEmitionTargetsLeft(QString str)
|
||||
{
|
||||
emit stt->changeTargetsLeft(str);
|
||||
}
|
||||
void STh::doEmitionKillSttThread()
|
||||
{
|
||||
emit stt->killSttThread();
|
||||
};
|
||||
void STh::doEmitionChangeParsed(QString str)
|
||||
{
|
||||
emit stt->changeParsedValue(str);
|
||||
};
|
||||
void STh::doEmitionChangeBA(QString str)
|
||||
{
|
||||
emit stt->changeBAValue(str);
|
||||
};
|
||||
void STh::doEmitionOffline(QString str)
|
||||
{
|
||||
emit stt->changeOffline(str);
|
||||
};
|
||||
void STh::doEmitionDataSaved(bool status)
|
||||
{
|
||||
emit stt->signalDataSaved(status);
|
||||
};
|
||||
void STh::run()
|
||||
{
|
||||
startScan(inputStr);
|
||||
}
|
71
STh.h
Normal file
71
STh.h
Normal file
@ -0,0 +1,71 @@
|
||||
#ifndef STH_H
|
||||
#define STH_H
|
||||
|
||||
#pragma once
|
||||
#include "nesca_3.h"
|
||||
#include "externFunctions.h"
|
||||
|
||||
extern int tMax;
|
||||
|
||||
class STh : public QThread
|
||||
{
|
||||
Q_OBJECT
|
||||
public:
|
||||
|
||||
public:
|
||||
static void doEmitionDataSaved(bool status);
|
||||
static void doEmitionStartScanIP();
|
||||
static void doEmitionStartScanDNS();
|
||||
static void doEmitionStartScanImport();
|
||||
static void doEmitionAddIncData(QString ip, QString str);
|
||||
static void doEmitionAddOutData(QString ip, QString str);
|
||||
static void doEmition_BAGreenData(QString str);
|
||||
static void doEmition_BARedData(QString str);
|
||||
static void doEmitionIPRANGE(QString str);
|
||||
static void doEmitionThreads(QString str);
|
||||
static void doEmitionIPS(QString str);
|
||||
static void doEmitionFoundData(QString str);
|
||||
static void doEmitionRedFoundData(QString str);
|
||||
static void doEmitionGreenFoundData(QString);
|
||||
static void doEmitionYellowFoundData(QString);
|
||||
static void doEmitionChangeStatus(QString);
|
||||
static void doEmitionTargetsLeft(QString);
|
||||
static void doEmitionKillSttThread();
|
||||
static void doEmitionChangeParsed(QString);
|
||||
static void doEmitionChangeBA(QString);
|
||||
static void doEmitionOffline(QString);
|
||||
static void doEmitionBAData(QString str);
|
||||
static void doEmitionDebugFoundData(QString);
|
||||
static void doEmitionShowRedVersion();
|
||||
|
||||
signals:
|
||||
public: signals: void showRedVersion();
|
||||
public: signals: void startScanIP();
|
||||
public: signals: void startScanDNS();
|
||||
public: signals: void startScanImport();
|
||||
public: signals: void signalDataSaved(bool);
|
||||
public: signals: void changeGreenBAData(QString);
|
||||
public: signals: void changeRedBAData(QString);
|
||||
public: signals: void changeBAData(QString);
|
||||
public: signals: void changeOffline(QString);
|
||||
public: signals: void changeBAValue(QString);
|
||||
public: signals: void changeParsedValue(QString);
|
||||
public: signals: void changeIpRange(QString);
|
||||
public: signals: void changeThreads(QString);
|
||||
public: signals: void changeIPS(QString);
|
||||
public: signals: void changeFoundData(QString);
|
||||
public: signals: void changeRedFoundData(QString);
|
||||
public: signals: void changeGreenFoundData(QString);
|
||||
public: signals: void changeYellowFoundData(QString);
|
||||
public: signals: void changeDebugFoundData(QString);
|
||||
public: signals: void changeStatus(QString);
|
||||
public: signals: void changeTargetsLeft(QString);
|
||||
public: signals: void killSttThread();
|
||||
public: signals: void sIncData(QString, QString);
|
||||
public: signals: void sOutData(QString, QString);
|
||||
|
||||
protected:
|
||||
void run();
|
||||
};
|
||||
extern STh *stt;
|
||||
#endif // STH_H
|
96
base64.cpp
Normal file
96
base64.cpp
Normal file
@ -0,0 +1,96 @@
|
||||
#include "base64.h"
|
||||
#include <iostream>
|
||||
|
||||
static const std::string base64_chars =
|
||||
"ABCDEFGHIJKLMNOPQRSTUVWXYZ"
|
||||
"abcdefghijklmnopqrstuvwxyz"
|
||||
"0123456789+/";
|
||||
|
||||
|
||||
static inline bool is_base64(unsigned char c) {
|
||||
return (isalnum(c) || (c == '+') || (c == '/'));
|
||||
}
|
||||
|
||||
std::string base64_encode(unsigned char const* bytes_to_encode, unsigned int in_len) {
|
||||
std::string ret;
|
||||
int i = 0;
|
||||
int j = 0;
|
||||
unsigned char char_array_3[3];
|
||||
unsigned char char_array_4[4];
|
||||
|
||||
while (in_len--) {
|
||||
char_array_3[i++] = *(bytes_to_encode++);
|
||||
if (i == 3) {
|
||||
char_array_4[0] = (char_array_3[0] & 0xfc) >> 2;
|
||||
char_array_4[1] = ((char_array_3[0] & 0x03) << 4) + ((char_array_3[1] & 0xf0) >> 4);
|
||||
char_array_4[2] = ((char_array_3[1] & 0x0f) << 2) + ((char_array_3[2] & 0xc0) >> 6);
|
||||
char_array_4[3] = char_array_3[2] & 0x3f;
|
||||
|
||||
for(i = 0; (i <4) ; i++)
|
||||
ret += base64_chars[char_array_4[i]];
|
||||
i = 0;
|
||||
}
|
||||
}
|
||||
|
||||
if (i)
|
||||
{
|
||||
for(j = i; j < 3; j++)
|
||||
char_array_3[j] = '\0';
|
||||
|
||||
char_array_4[0] = (char_array_3[0] & 0xfc) >> 2;
|
||||
char_array_4[1] = ((char_array_3[0] & 0x03) << 4) + ((char_array_3[1] & 0xf0) >> 4);
|
||||
char_array_4[2] = ((char_array_3[1] & 0x0f) << 2) + ((char_array_3[2] & 0xc0) >> 6);
|
||||
char_array_4[3] = char_array_3[2] & 0x3f;
|
||||
|
||||
for (j = 0; (j < i + 1); j++)
|
||||
ret += base64_chars[char_array_4[j]];
|
||||
|
||||
while((i++ < 3))
|
||||
ret += '=';
|
||||
|
||||
}
|
||||
|
||||
return ret;
|
||||
|
||||
}
|
||||
|
||||
std::string base64_decode(std::string const& encoded_string) {
|
||||
int in_len = encoded_string.size();
|
||||
int i = 0;
|
||||
int j = 0;
|
||||
int in_ = 0;
|
||||
unsigned char char_array_4[4], char_array_3[3];
|
||||
std::string ret;
|
||||
|
||||
while (in_len-- && ( encoded_string[in_] != '=') && is_base64(encoded_string[in_])) {
|
||||
char_array_4[i++] = encoded_string[in_]; in_++;
|
||||
if (i ==4) {
|
||||
for (i = 0; i <4; i++)
|
||||
char_array_4[i] = base64_chars.find(char_array_4[i]);
|
||||
|
||||
char_array_3[0] = (char_array_4[0] << 2) + ((char_array_4[1] & 0x30) >> 4);
|
||||
char_array_3[1] = ((char_array_4[1] & 0xf) << 4) + ((char_array_4[2] & 0x3c) >> 2);
|
||||
char_array_3[2] = ((char_array_4[2] & 0x3) << 6) + char_array_4[3];
|
||||
|
||||
for (i = 0; (i < 3); i++)
|
||||
ret += char_array_3[i];
|
||||
i = 0;
|
||||
}
|
||||
}
|
||||
|
||||
if (i) {
|
||||
for (j = i; j <4; j++)
|
||||
char_array_4[j] = 0;
|
||||
|
||||
for (j = 0; j <4; j++)
|
||||
char_array_4[j] = base64_chars.find(char_array_4[j]);
|
||||
|
||||
char_array_3[0] = (char_array_4[0] << 2) + ((char_array_4[1] & 0x30) >> 4);
|
||||
char_array_3[1] = ((char_array_4[1] & 0xf) << 4) + ((char_array_4[2] & 0x3c) >> 2);
|
||||
char_array_3[2] = ((char_array_4[2] & 0x3) << 6) + char_array_4[3];
|
||||
|
||||
for (j = 0; (j < i - 1); j++) ret += char_array_3[j];
|
||||
}
|
||||
|
||||
return ret;
|
||||
}
|
4
base64.h
Normal file
4
base64.h
Normal file
@ -0,0 +1,4 @@
|
||||
#include <string>
|
||||
|
||||
std::string base64_encode(unsigned char const* , unsigned int len);
|
||||
std::string base64_decode(std::string const& s);
|
2625
connector.cpp
Normal file
2625
connector.cpp
Normal file
File diff suppressed because it is too large
Load Diff
32
externData.h
Normal file
32
externData.h
Normal file
@ -0,0 +1,32 @@
|
||||
#define RECV_MAX_SIZE 350000
|
||||
#define REQUEST_MAX_SIZE 4096
|
||||
#define SD_BOTH 2
|
||||
#define PORTSET "80,81,88,8080,8081,60001,60002,8008,8888,554,9000,441,4111,6667,3536,22,21"
|
||||
#define IRC_CHAN "iskopasi_lab03"
|
||||
#define CSSOCKET(Socket) shutdown(Socket, SD_BOTH); closesocket(Socket); Socket = -1;
|
||||
|
||||
extern QJsonArray *jsonArr;
|
||||
|
||||
extern unsigned long long gTargetsOverall, Activity;
|
||||
extern char top_level_domain[128];
|
||||
extern volatile int BA, cons, BrutingThrds, gThreads;
|
||||
extern char **loginLst, **passLst, **wfLoginLst, **wfPassLst, **sshlpLst, **GlobalNegatives;
|
||||
extern bool trackerOK, __savingBackUpFile, globalScanFlag, MapWidgetOpened,
|
||||
widgetIsHidden, OnlineMsgSentFlag, utfIRCFlag, HTMLDebugMode, gNegDebugMode,
|
||||
gDebugMode, horLineFlag, gPingNScan, gShuffle;
|
||||
extern int found, indexIP, gMode,
|
||||
MaxPass, MaxLogin, MaxWFLogin, MaxWFPass, MaxSSHPass,
|
||||
GlobalNegativeSize, isActive, gMaxBrutingThreads,
|
||||
gTimeOut, PieAnomC1, PieSusp, PieBA, PieLowl, PieWF, PieSSH,
|
||||
gThreadDelay, AnomC1, Filt, Overl, Lowl, Alive, saved,
|
||||
Susp, WF, offlines, ssh, globalPinger, gPingTimeout, nickFlag, offlineFlag;
|
||||
extern char trcSrv[256], trcScr[256], trcProxy[128], trcPersKey[32],
|
||||
ircServer[32], ircPort[32], ircProxy[64], ircProxyPort[8], ircNick[32],
|
||||
trcPort[32], trcSrvPortLine[32], saveStartIP[128], saveEndIP[128],
|
||||
gRange[128], gFirstDom[128], gPorts[65536], endIP2[128],
|
||||
gVER[16];
|
||||
|
||||
struct pl{
|
||||
int loginCounter;
|
||||
int passCounter;
|
||||
};
|
18
externFunctions.h
Normal file
18
externFunctions.h
Normal file
@ -0,0 +1,18 @@
|
||||
extern std::string toLowerStr(const char *str);
|
||||
extern int recvS(int lSock, char *recvBuffT, int len, int mode);
|
||||
extern int sendS(int lSock, char *msg, int len, int mode);
|
||||
extern std::string xcode(LPCSTR src, UINT srcCodePage, UINT dstCodePage);
|
||||
extern void UserNickInit(SOCKET lSock);
|
||||
extern void GetNicks();
|
||||
extern int startScan(char* argv);
|
||||
extern void BConInc();
|
||||
extern void BConDec();
|
||||
extern QString GetNSErrorDefinition(char *str, char *defin);
|
||||
extern void _SaveBackupToFile();
|
||||
extern char* __cdecl strstri(char *_Str, const char *_SubStr);
|
||||
extern char* _getAttribute(char *str, char *attrib);
|
||||
extern char *_findFirst(char *str, char *delim);
|
||||
extern void nCleanup();
|
||||
extern void getSubStr(char *src, char *startStr, char *endStr, char *dest, int szDest);
|
||||
extern void getSubStrEx(char *src, char *startStr, char *endStr, char *dest, int szDest);
|
||||
|
16
irc_nmblinker.cpp
Normal file
16
irc_nmblinker.cpp
Normal file
@ -0,0 +1,16 @@
|
||||
#include "irc_nmblinker.h"
|
||||
#include "nesca_3.h"
|
||||
|
||||
void IRC_NMBlinker::doEmitBlinkMessage()
|
||||
{
|
||||
emit irc_nmb->sBlinkMessage();
|
||||
};
|
||||
|
||||
void IRC_NMBlinker::run()
|
||||
{
|
||||
while(widgetIsHidden == false && disableBlink == false && tray->isVisible() == false)
|
||||
{
|
||||
irc_nmb->doEmitBlinkMessage();
|
||||
msleep(500);
|
||||
};
|
||||
};
|
20
irc_nmblinker.h
Normal file
20
irc_nmblinker.h
Normal file
@ -0,0 +1,20 @@
|
||||
#ifndef IRC_NMBLINKER_H
|
||||
#define IRC_NMBLINKER_H
|
||||
|
||||
#include "nesca_3.h"
|
||||
|
||||
class IRC_NMBlinker : public QThread
|
||||
{
|
||||
Q_OBJECT
|
||||
|
||||
public:
|
||||
static void doEmitBlinkMessage();
|
||||
|
||||
public: signals: void sBlinkMessage();
|
||||
|
||||
protected:
|
||||
void run();
|
||||
};
|
||||
extern IRC_NMBlinker *irc_nmb;
|
||||
|
||||
#endif // IRC_NMBLINKER_H
|
47
main.cpp
Normal file
47
main.cpp
Normal file
@ -0,0 +1,47 @@
|
||||
#include "nesca_3.h"
|
||||
#include <QApplication>
|
||||
#if defined(Q_OS_WIN32)
|
||||
#include <windows.h>
|
||||
#include <qfontdatabase.h>
|
||||
#endif
|
||||
|
||||
//--Fixing _ITERATOR_DEBUG_LEVEL 0!=2
|
||||
//#if defined(Q_OS_WIN32)
|
||||
//int WINAPI WinMain(HINSTANCE hInstance,
|
||||
// HINSTANCE hPrevInstance, LPSTR lpcmdline, int ncmdshow)
|
||||
//{
|
||||
// QApplication a(ncmdshow, (char **)lpcmdline);
|
||||
//#else
|
||||
//int main(int argc, char *argv[])
|
||||
//{
|
||||
// QApplication a(argc, argv);
|
||||
//#endif
|
||||
//#if defined(Q_OS_WIN32)
|
||||
int main(int argc, char *argv[])
|
||||
{
|
||||
QApplication a(argc, argv);
|
||||
QStringList list;
|
||||
list << "Eurostile.ttf";
|
||||
int fontID(-1);
|
||||
bool fontWarningShown(false);
|
||||
for (QStringList::const_iterator constIterator = list.constBegin(); constIterator != list.constEnd(); ++constIterator) {
|
||||
QFile res(":/nesca_3/" + *constIterator);
|
||||
if (res.open(QIODevice::ReadOnly) == false) {
|
||||
if (fontWarningShown == false) {
|
||||
fontWarningShown = true;
|
||||
}
|
||||
} else {
|
||||
fontID = QFontDatabase::addApplicationFontFromData(res.readAll());
|
||||
if (fontID == -1 && fontWarningShown == false) {
|
||||
fontWarningShown = true;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
//#endif
|
||||
nesca_3 *gui = new nesca_3();
|
||||
|
||||
gui->showNormal();
|
||||
return a.exec();
|
||||
}
|
||||
|
115
mainResources.h
Normal file
115
mainResources.h
Normal file
@ -0,0 +1,115 @@
|
||||
#pragma once
|
||||
#include "base64.h"
|
||||
|
||||
#include <libssh\libssh.h>
|
||||
#if defined(Q_OS_WIN32)
|
||||
#pragma once
|
||||
#include "iostream"
|
||||
#include <time.h>
|
||||
#include <process.h>
|
||||
#include <conio.h>
|
||||
#include <openssl/ssl.h>
|
||||
#endif
|
||||
#if defined(Q_OS_LINUX)
|
||||
#pragma once
|
||||
#include <string>
|
||||
#include <iostream>
|
||||
#include <stdio.h>
|
||||
#include <stdlib.h>
|
||||
#include <unistd.h>
|
||||
#include <arpa/inet.h>
|
||||
#include <sys/types.h>
|
||||
#include <sys/stat.h>
|
||||
#include <sys/socket.h>
|
||||
#include <sys/ioctl.h>
|
||||
#include <netinet/in.h>
|
||||
#include <arpa/inet.h>
|
||||
#include <pthread.h>
|
||||
#include <netdb.h>
|
||||
#include <errno.h>
|
||||
#include <fcntl.h>
|
||||
#include <math.h>
|
||||
#include <cstring>
|
||||
|
||||
#define ZeroMemory(Destination,Length) memset((Destination),0,(Length))
|
||||
#define Sleep(secs) usleep((secs)*1000)
|
||||
#define WSAGetLastError() errno
|
||||
#define closesocket(sock) ::close((sock))
|
||||
|
||||
typedef unsigned int UINT;
|
||||
typedef const char * LPCSTR;
|
||||
typedef int SOCKET;
|
||||
typedef hostent HOSTENT;
|
||||
typedef struct linger LINGER;
|
||||
typedef int BOOL;
|
||||
#define INVALID_SOCKET (SOCKET)(~0)
|
||||
#define SOCKET_ERROR (-1)
|
||||
#define SD_BOTH 0x02
|
||||
#define FAR far
|
||||
#endif
|
||||
|
||||
#define MAX_ADDR_LEN 128
|
||||
#define TITLE_MAX_SIZE 512
|
||||
#define COOKIE_MAX_SIZE 1024
|
||||
|
||||
struct PathStr{
|
||||
char codepage[32];
|
||||
char headr[TITLE_MAX_SIZE];
|
||||
char path[1024];
|
||||
int flag;
|
||||
int port;
|
||||
char ip[MAX_ADDR_LEN];
|
||||
char cookie[COOKIE_MAX_SIZE];
|
||||
int directoryCount;
|
||||
};
|
||||
|
||||
struct lopaStr{
|
||||
char login[128];
|
||||
char pass[32];
|
||||
char other[128];
|
||||
};
|
||||
|
||||
struct conSTR{
|
||||
char *lowerBuff;
|
||||
int size;
|
||||
bool overflow = false;
|
||||
};
|
||||
|
||||
class Lexems
|
||||
{
|
||||
public:
|
||||
int iterationCount, flag;
|
||||
|
||||
Lexems()
|
||||
{
|
||||
iterationCount = 0;
|
||||
flag = 0;
|
||||
};
|
||||
~Lexems()
|
||||
{
|
||||
iterationCount = 0;
|
||||
};
|
||||
|
||||
int _header(char *ip, int port, char str[], Lexems *l, PathStr *ps, std::vector<std::string> *lst, char *rBuff);
|
||||
int _filler(int p, char* buffcpy, char* ipi, int recd, Lexems *lx, char *hl);
|
||||
int globalSearchNeg(const char *buffcpy, char *ip, int port);
|
||||
};
|
||||
|
||||
|
||||
class Connector
|
||||
{
|
||||
public:
|
||||
int _Updater();
|
||||
|
||||
lopaStr _FTPLobby(char *ip, int port, PathStr *ps);
|
||||
lopaStr _BALobby(char *cookie, char *ip, int port, char *path, char *method, char *data);
|
||||
lopaStr _WFLobby(char *cookie, char *ip, int port, char *methodVal, char *actionVal, char *userVal, char *passVal, char *formVal);
|
||||
lopaStr _IPCameraBLobby(char *ip, int port, char *SPEC);
|
||||
int _SSHLobby(char *ip, int port, conSTR *CSTR);
|
||||
|
||||
int _EstablishConnection(char *ip, int port, char *request, conSTR *cstr, int force = 0);
|
||||
int _EstablishSSLConnection(char *ip, int port, char *request, conSTR *cstr);
|
||||
void _Connect(void *s);
|
||||
int _ConnectToPort(char *ip, const char *port, char *hl);
|
||||
};
|
||||
|
14
mainwindow.cpp
Normal file
14
mainwindow.cpp
Normal file
@ -0,0 +1,14 @@
|
||||
#include "mainwindow.h"
|
||||
#include "ui_mainwindow.h"
|
||||
|
||||
MainWindow::MainWindow(QWidget *parent) :
|
||||
QMainWindow(parent),
|
||||
ui(new Ui::MainWindow)
|
||||
{
|
||||
ui->setupUi(this);
|
||||
}
|
||||
|
||||
MainWindow::~MainWindow()
|
||||
{
|
||||
delete ui;
|
||||
}
|
22
mainwindow.h
Normal file
22
mainwindow.h
Normal file
@ -0,0 +1,22 @@
|
||||
#ifndef MAINWINDOW_H
|
||||
#define MAINWINDOW_H
|
||||
|
||||
#include <QMainWindow>
|
||||
|
||||
namespace Ui {
|
||||
class MainWindow;
|
||||
}
|
||||
|
||||
class MainWindow : public QMainWindow
|
||||
{
|
||||
Q_OBJECT
|
||||
|
||||
public:
|
||||
explicit MainWindow(QWidget *parent = 0);
|
||||
~MainWindow();
|
||||
|
||||
private:
|
||||
Ui::MainWindow *ui;
|
||||
};
|
||||
|
||||
#endif // MAINWINDOW_H
|
24
mainwindow.ui
Normal file
24
mainwindow.ui
Normal file
@ -0,0 +1,24 @@
|
||||
<ui version="4.0">
|
||||
<class>MainWindow</class>
|
||||
<widget class="QMainWindow" name="MainWindow" >
|
||||
<property name="geometry" >
|
||||
<rect>
|
||||
<x>0</x>
|
||||
<y>0</y>
|
||||
<width>400</width>
|
||||
<height>300</height>
|
||||
</rect>
|
||||
</property>
|
||||
<property name="windowTitle" >
|
||||
<string>MainWindow</string>
|
||||
</property>
|
||||
<widget class="QMenuBar" name="menuBar" />
|
||||
<widget class="QToolBar" name="mainToolBar" />
|
||||
<widget class="QWidget" name="centralWidget" />
|
||||
<widget class="QStatusBar" name="statusBar" />
|
||||
</widget>
|
||||
<layoutDefault spacing="6" margin="11" />
|
||||
<pixmapfunction></pixmapfunction>
|
||||
<resources/>
|
||||
<connections/>
|
||||
</ui>
|
45
msgcheckerthread.cpp
Normal file
45
msgcheckerthread.cpp
Normal file
@ -0,0 +1,45 @@
|
||||
#include "msgcheckerthread.h"
|
||||
#include "externData.h"
|
||||
#include "mainResources.h"
|
||||
|
||||
void MSGCheckerThread::doEmitionShowNewMsg(QString str)
|
||||
{
|
||||
emit mct->showNewMsg(str);
|
||||
};
|
||||
|
||||
void _getNewMsg()
|
||||
{
|
||||
Connector con;
|
||||
conSTR CSTR;
|
||||
CSTR.lowerBuff = NULL;
|
||||
CSTR.size = 0;
|
||||
char request[256] = {0};
|
||||
strcpy(request, "GET /mailbox?key=");
|
||||
strncat(request, trcPersKey, 32);
|
||||
strcat(request, " HTTP/1.1\r\nHost: nesca.d3w.org\r\nX-Nescav3: True\r\n\r\n");
|
||||
con._EstablishConnection("nesca.d3w.org", 80, request, &CSTR, 1);
|
||||
|
||||
char *ptr1 = NULL;
|
||||
if(CSTR.lowerBuff != NULL)
|
||||
{
|
||||
if(strstr(CSTR.lowerBuff, "\r\n\r\n") != NULL && strstr(CSTR.lowerBuff, "HTTP/1.1 404 Not Found") == NULL && strstr(CSTR.lowerBuff, "HTTP/1.1 502 Bad Gateway") == NULL && strstr(CSTR.lowerBuff, "HTTP/1.1 400 Bad Request") == NULL && strstr(CSTR.lowerBuff, "\r\n\r\nEmpty") == NULL)
|
||||
{
|
||||
ptr1 = strstr(CSTR.lowerBuff, "\r\n\r\n");
|
||||
if(strlen(ptr1 + 4) != 0)
|
||||
{
|
||||
mct->doEmitionShowNewMsg(QString(ptr1 + 4));
|
||||
};
|
||||
};
|
||||
delete []CSTR.lowerBuff;
|
||||
CSTR.lowerBuff = NULL;
|
||||
};
|
||||
};
|
||||
|
||||
void MSGCheckerThread::run()
|
||||
{
|
||||
for(;;)
|
||||
{
|
||||
Sleep(60000);
|
||||
_getNewMsg();
|
||||
};
|
||||
};
|
19
msgcheckerthread.h
Normal file
19
msgcheckerthread.h
Normal file
@ -0,0 +1,19 @@
|
||||
#ifndef MSGCHECKERTHREAD_H
|
||||
#define MSGCHECKERTHREAD_H
|
||||
|
||||
#pragma once
|
||||
#include "nesca_3.h"
|
||||
|
||||
class MSGCheckerThread : public QThread
|
||||
{
|
||||
Q_OBJECT
|
||||
public:
|
||||
static void doEmitionShowNewMsg(QString str);
|
||||
public: signals: void showNewMsg(QString);
|
||||
|
||||
protected:
|
||||
void run();
|
||||
};
|
||||
extern MSGCheckerThread *mct;
|
||||
|
||||
#endif // MSGCHECKERTHREAD_H
|
20
nesca.pro
Normal file
20
nesca.pro
Normal file
@ -0,0 +1,20 @@
|
||||
#-------------------------------------------------
|
||||
#
|
||||
# Project created by QtCreator 2015-02-24T13:25:33
|
||||
#
|
||||
#-------------------------------------------------
|
||||
|
||||
QT += core gui
|
||||
|
||||
greaterThan(QT_MAJOR_VERSION, 4): QT += widgets
|
||||
|
||||
TARGET = nesca
|
||||
TEMPLATE = app
|
||||
|
||||
|
||||
SOURCES += main.cpp\
|
||||
mainwindow.cpp
|
||||
|
||||
HEADERS += mainwindow.h
|
||||
|
||||
FORMS += mainwindow.ui
|
4000
nesca_3.cpp
Normal file
4000
nesca_3.cpp
Normal file
File diff suppressed because it is too large
Load Diff
209
nesca_3.h
Normal file
209
nesca_3.h
Normal file
@ -0,0 +1,209 @@
|
||||
#ifndef nesca_3_H
|
||||
#define nesca_3_H
|
||||
|
||||
#pragma once
|
||||
#include <QMainWindow>
|
||||
#include <qapplication.h>
|
||||
#include <qgraphicsitem.h>
|
||||
#include <QGraphicsView>
|
||||
#include <QGraphicsScene>
|
||||
#include <QGraphicsItem>
|
||||
#include "ui_nesca_3.h"
|
||||
#include <QSystemTrayIcon.h>
|
||||
#include <QtGui\qevent.h>
|
||||
#include <qthread.h>
|
||||
#include <qdatetime.h>
|
||||
#include <qjsonobject.h>
|
||||
#include <qjsonvalue.h>
|
||||
#include <qjsonarray.h>
|
||||
#include <qtextcodec.h>
|
||||
#include <qjsondocument.h>
|
||||
#include <libssh\libssh.h>
|
||||
|
||||
extern Ui::nesca_3Class *ui;
|
||||
extern bool widgetIsHidden, IRCLogToggled, BALogSwitched, blinkFlag, disableBlink, debugFileOK, QOSWait,
|
||||
connectedToIRC, ME2ScanFlag, QoSScanFlag, VoiceScanFlag, PieStatFlag, proxyEnabledFlag,
|
||||
smBit_8, smBit_7, smBit_6, smBit_5, smBit_4, smBit_3, smBit_2, smBit_1, printDelimiter;
|
||||
extern float QoSStep;
|
||||
extern int MaxDataVal;
|
||||
extern char endIP2[128], inputStr[256];
|
||||
extern SOCKET lSock;
|
||||
|
||||
extern QVector<int> vAlivLst, vAnomLst, vWFLst, vSuspLst, vLowlLst, vBALst, vSSHLst, vOvrlLst, actLst;
|
||||
extern QVector<QPointF> vect;
|
||||
extern QList<int> lstOfLabels;
|
||||
extern QSystemTrayIcon *tray;
|
||||
|
||||
extern void ShowMsgPopup(QString str);
|
||||
|
||||
class nesca_3 : public QMainWindow
|
||||
{
|
||||
Q_OBJECT
|
||||
|
||||
public:
|
||||
nesca_3(QWidget *parent = 0);
|
||||
~nesca_3();
|
||||
|
||||
void ConnectEvrthng();
|
||||
void ChangeLabelIpRange_Value(QString str);
|
||||
void ChangeLabelIPS_Value(QString str);
|
||||
void newListItem(QString str);
|
||||
static int perc;
|
||||
private:
|
||||
|
||||
protected:
|
||||
bool eventFilter(QObject* obj, QEvent *event);
|
||||
void run();
|
||||
|
||||
QString GetSSLContent(QString str);
|
||||
void SSLConnect(QString str);
|
||||
protected slots:
|
||||
void MaxBrutingThr_ChangeValue(QString str);
|
||||
void ThreadDelay_ChangeValue(QString val);
|
||||
void ChangePingerOK(bool val);
|
||||
void changeNSTrackLabel(bool status);
|
||||
void slotPBUpdate();
|
||||
void DNSLine_ValueChanged(QString str);
|
||||
void slotChangeCPModeToUTF();
|
||||
void slotChangeCPModeTo1251();
|
||||
void slotShowRedVersion();
|
||||
void ChangeDebugFileState(bool val);
|
||||
void ChangeTopic();
|
||||
void slotIRCGetTopic(QString str);
|
||||
void slotIRCOfflined();
|
||||
void slotUnhidePopup(QString str, QString senderNick);
|
||||
void slotItemClicked(QListWidgetItem* wi);
|
||||
void slotClearNickList();
|
||||
void slotAppendIRCNick(QString str);
|
||||
void slotShowNicks();
|
||||
void slotBlinkMessage();
|
||||
void IPScanSeq();
|
||||
void DNSScanSeq();
|
||||
void ImportScanSeq();
|
||||
void smReaction();
|
||||
void slotShowDataflow();
|
||||
void slotOutData(QString ip, QString str);
|
||||
void slotIncData(QString ip, QString str);
|
||||
void slotShowServerMsg(QString str);
|
||||
void slotSaveImage(QAction *qwe);
|
||||
void slotUpdatePie();
|
||||
void slotClearLogs();
|
||||
void slotRestartIRC();
|
||||
void slotDrawVoiceGrid(int factor);
|
||||
void slotDrawTextPlacers();
|
||||
void onLinkClicked(QUrl link);
|
||||
void CheckPersKey();
|
||||
void CheckPersKey(int val);
|
||||
void slotRestoreDefPorts();
|
||||
void ChangeNick();
|
||||
void setNickBox(QString str);
|
||||
void SaySmthng();
|
||||
void ChangeIRCRawLog();
|
||||
void switchToJobMode();
|
||||
void ConnectToIRCServer();
|
||||
void CheckProxy();
|
||||
void ChangeDispalyMode();
|
||||
void switchDataFields();
|
||||
void importAndScan();
|
||||
void slotQoSAddGrid();
|
||||
void slotVoiceAddLine();
|
||||
void slotDrawDelimLines();
|
||||
void slotDrawActivityLine(QString data);
|
||||
void slotDrawActivityGrid();
|
||||
void activateME2ScanScene();
|
||||
void activateQoSScanBut();
|
||||
void activateVoiceScanBut();
|
||||
void activatePieStatBut();
|
||||
void slotAddPolyLine();
|
||||
void slotQoSAddLine();
|
||||
void slotAddLine(int x1, int y1, int x2, int y2);
|
||||
void slotDrawGrid();
|
||||
void exitButtonClicked();
|
||||
void trayButtonClicked();
|
||||
void mouseMoveEvent(QMouseEvent * event);
|
||||
void mousePressEvent(QMouseEvent *event);
|
||||
void mouseReleaseEvent(QMouseEvent *event);
|
||||
void logoLabelClicked();
|
||||
void startScanButtonClicked();
|
||||
void startScanButtonClickedDNS();
|
||||
void saveOptions();
|
||||
void ChangeTrackerOK(bool val);
|
||||
void ChangeShuffle(bool val);
|
||||
void ChangeLabelThreads_ValueChanged(QString);
|
||||
void PingTO_ChangeValue(QString);
|
||||
void ChangeLabelTO_ValueChanged(QString);
|
||||
void appendErrText(QString str);
|
||||
void appendOKText(QString str);
|
||||
void appendDebugText(QString str);
|
||||
void appendNotifyText(QString str);
|
||||
void appendDefaultText(QString str);
|
||||
void appendRedIRCText(QString str);
|
||||
void appendGreenIRCText(QString str);
|
||||
void appendYellowIRCText(QString str);
|
||||
void appendDefaultIRCText(bool, bool, int, QString str, QString s);
|
||||
void appendDefaultIRCTextOut(QString str);
|
||||
void appendDefaultIRCRawTextInc(QString str);
|
||||
void appendDefaultIRCRawTextOut(QString str);
|
||||
void appendGreenBAData(QString str);
|
||||
void appendRedBAData(QString str);
|
||||
void STTTerminate();
|
||||
void playFcknSound();
|
||||
private:
|
||||
QPoint dragPosition;
|
||||
};
|
||||
class PieStatView : public QGraphicsView
|
||||
{
|
||||
Q_OBJECT
|
||||
public:
|
||||
PieStatView(QWidget *parent = 0) : QGraphicsView(parent) {};
|
||||
public:
|
||||
void contextMenuEvent(QContextMenuEvent *event);
|
||||
};
|
||||
class PopupMsgWidget : public QWidget
|
||||
{
|
||||
Q_OBJECT
|
||||
public:
|
||||
PopupMsgWidget(QWidget* parent = 0) : QWidget(parent)
|
||||
{ };
|
||||
|
||||
public: signals: void clicked(bool checked = false);
|
||||
protected:
|
||||
bool switchWindows;
|
||||
void mousePressEvent(QMouseEvent *evt)
|
||||
{
|
||||
switchWindows = false;
|
||||
if (evt->button() == Qt::LeftButton)
|
||||
{
|
||||
switchWindows = true;
|
||||
oldPos = evt->globalPos();
|
||||
evt->accept();
|
||||
}
|
||||
else if (evt->button() == Qt::RightButton)
|
||||
{
|
||||
disableBlink = true;
|
||||
ui->newMessageLabel->setStyleSheet("color:rgba(255, 0, 0, 0);background-color: rgba(2, 2, 2, 0);");
|
||||
this->hide();
|
||||
};
|
||||
}
|
||||
void mouseMoveEvent(QMouseEvent *evt)
|
||||
{
|
||||
switchWindows = false;
|
||||
const QPoint delta = evt->globalPos() - oldPos;
|
||||
move(x()+delta.x(), y()+delta.y());
|
||||
oldPos = evt->globalPos();
|
||||
}
|
||||
void mouseReleaseEvent(QMouseEvent *evt)
|
||||
{
|
||||
if(switchWindows)
|
||||
{
|
||||
switchWindows = false;
|
||||
emit ui->IRCModeBut->clicked();
|
||||
};
|
||||
}
|
||||
|
||||
private:
|
||||
QPoint oldPos;
|
||||
};
|
||||
|
||||
#endif // nesca_3_H
|
||||
|
6
nesca_3.qrc
Normal file
6
nesca_3.qrc
Normal file
@ -0,0 +1,6 @@
|
||||
<RCC>
|
||||
<qresource prefix="/nesca_3">
|
||||
<file>Eurostile.ttf</file>
|
||||
<file>Z:/nesca.ico</file>
|
||||
</qresource>
|
||||
</RCC>
|
BIN
nesca_3.rc
Normal file
BIN
nesca_3.rc
Normal file
Binary file not shown.
3891
nesca_3.ui
Normal file
3891
nesca_3.ui
Normal file
File diff suppressed because it is too large
Load Diff
2881
nesca_startModule.cpp
Normal file
2881
nesca_startModule.cpp
Normal file
File diff suppressed because it is too large
Load Diff
828
oIRC_Th.cpp
Normal file
828
oIRC_Th.cpp
Normal file
@ -0,0 +1,828 @@
|
||||
#include "oIRC_Th.h"
|
||||
#include <QtMultimedia\qsound.h>
|
||||
#include "externData.h"
|
||||
#include "externFunctions.h"
|
||||
|
||||
int iWantToConnect = false;
|
||||
|
||||
#define MAX_IRC_RECV_LEN 2048
|
||||
//#define IRC_CHAN "iskopasi_lab01"
|
||||
|
||||
void oIRC_Th::doEmitionPlayDckingSound()
|
||||
{
|
||||
emit ircTh->notifyPlay();
|
||||
};
|
||||
void oIRC_Th::doEmitUnhidePopup(QString str1, QString str2)
|
||||
{
|
||||
emit ircTh->sUnhidePopup(str1, str2);
|
||||
};
|
||||
void oIRC_Th::doEmitChangeIRCData(bool pm, bool hlflag, int code, QString str, QString s)
|
||||
{
|
||||
emit ircTh->changeIRCData(pm, hlflag, code, str, s);
|
||||
};
|
||||
void oIRC_Th::doEmitChangeRedIRCData(QString str)
|
||||
{
|
||||
emit ircTh->changeRedIRCData(str);
|
||||
};
|
||||
void oIRC_Th::doEmitChangeGreenIRCData(QString str)
|
||||
{
|
||||
emit ircTh->changeGreenIRCData(str);
|
||||
};
|
||||
void oIRC_Th::doEmitChangeYellowIRCData(QString str)
|
||||
{
|
||||
emit ircTh->changeYellowIRCData(str);
|
||||
};
|
||||
void oIRC_Th::doEmitChangeRawIRCDataInc(QString str)
|
||||
{
|
||||
emit ircTh->changeRawIRCDataInc(str);
|
||||
};
|
||||
void oIRC_Th::doEmitChangeRawIRCDataOut(QString str)
|
||||
{
|
||||
emit ircTh->changeRawIRCDataOut(str);
|
||||
};
|
||||
void oIRC_Th::doEmitSetNick(QString str)
|
||||
{
|
||||
emit ircTh->setNick(str);
|
||||
};
|
||||
void oIRC_Th::doEmitAddNick(QString str)
|
||||
{
|
||||
emit ircTh->AddNick(str);
|
||||
};
|
||||
void oIRC_Th::doEmitClearNickList()
|
||||
{
|
||||
emit ircTh->ClearNickList();
|
||||
};
|
||||
void oIRC_Th::doEmitIRCOfflined()
|
||||
{
|
||||
emit ircTh->IRCOfflined();
|
||||
};
|
||||
void oIRC_Th::doEmitGetTopic(QString str)
|
||||
{
|
||||
emit ircTh->getTopic(str);
|
||||
};
|
||||
|
||||
QString GetNickColor(char *sn)
|
||||
{
|
||||
QString str(sn);
|
||||
QString hexNick = str.toLocal8Bit().toHex();
|
||||
int origLen = str.size();
|
||||
int hln = hexNick.length();
|
||||
while(hln < 7)
|
||||
{
|
||||
hexNick += "0";
|
||||
hln = hexNick.length();
|
||||
};
|
||||
|
||||
QString nickColorStr = hexNick.mid(0, 6);
|
||||
QString nickBGColorStr = hexNick.mid(hexNick.size() - 6, hexNick.size());
|
||||
|
||||
int nickColor = nickColorStr.toUInt(NULL, 16);
|
||||
int nickBGColor = nickBGColorStr.toUInt(NULL, 16);
|
||||
int dim = QString::number(nickColor).length();
|
||||
int factor = pow((float)10, dim);
|
||||
|
||||
nickColor += (7*origLen + nickColor*6 + 123456 - hln*hln*hln*hln + (int)(str[0].toLatin1())*123);
|
||||
nickColorStr.setNum(nickColor, 16);
|
||||
nickColorStr = nickColorStr.mid(nickColorStr.size() - 6, nickColorStr.size());
|
||||
|
||||
int R = nickColorStr.mid(0, 2).toUInt(NULL, 16);
|
||||
int G = nickColorStr.mid(2, 2).toUInt(NULL, 16);
|
||||
int B = nickColorStr.mid(4, 2).toUInt(NULL, 16);
|
||||
|
||||
if(R < 100 && G < 100 && B < 100) nickBGColorStr = "#fd7e31";
|
||||
else nickBGColorStr = "#000000";
|
||||
|
||||
return nickColorStr + "; background-color: " + nickBGColorStr + ";";
|
||||
};
|
||||
bool doHL(char *rawData)
|
||||
{
|
||||
if(strstr(rawData, ircNick) != NULL) return true;
|
||||
else return false;
|
||||
};
|
||||
void _blinkNLine(QString tempData = "", QString senderNick = "")
|
||||
{
|
||||
if(widgetIsHidden == false && tray->isVisible() == false)
|
||||
{
|
||||
disableBlink = false;
|
||||
if(irc_nmb->isRunning() == false) irc_nmb->start();
|
||||
ircTh->doEmitUnhidePopup(tempData, senderNick);
|
||||
|
||||
#pragma region QTGUI_Area
|
||||
if(printDelimiter) ircTh->doEmitChangeIRCData(false, false, 0, "------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------", "");
|
||||
printDelimiter = false;
|
||||
#pragma endregion
|
||||
};
|
||||
};
|
||||
int sendS(int lSock, char *msg, int len, int mode)
|
||||
{
|
||||
int b;
|
||||
|
||||
b = send(lSock, msg, len, mode);
|
||||
if(b == -1) ircTh->doEmitChangeRedIRCData("[IRC: RecvS error - (" + QString::number(WSAGetLastError()) + ")]");
|
||||
else
|
||||
{
|
||||
Activity += len;
|
||||
|
||||
#pragma region QTGUI_Area
|
||||
ircTh->doEmitChangeRawIRCDataOut(QString::fromLocal8Bit(msg));
|
||||
#pragma endregion
|
||||
};
|
||||
return b;
|
||||
};
|
||||
int recvS(int lSock, char *recvBuffT, int len, int mode)
|
||||
{
|
||||
int b;
|
||||
char recvBuff[MAX_IRC_RECV_LEN] = {0};
|
||||
|
||||
b = recv(lSock, recvBuff, sizeof(recvBuff), 0);
|
||||
if(b == -1) ircTh->doEmitChangeRedIRCData("[IRC: RecvS error - (" + QString::number(WSAGetLastError()) + ")]");
|
||||
else
|
||||
{
|
||||
Activity += len;
|
||||
|
||||
strcpy(recvBuffT, recvBuff);
|
||||
#pragma region QTGUI_Area
|
||||
ircTh->doEmitChangeRawIRCDataInc(QString::fromLocal8Bit(recvBuff));
|
||||
#pragma endregion
|
||||
ZeroMemory(recvBuff, sizeof(recvBuff));
|
||||
};
|
||||
return b;
|
||||
};
|
||||
void UserNickInit(SOCKET sock)
|
||||
{
|
||||
strcpy(ircNick, ui->ircNickBox->text().toLocal8Bit().data());
|
||||
char tempBuffUser[1024] = {0};
|
||||
strcpy(tempBuffUser, "USER ");
|
||||
strcat(tempBuffUser, ircNick);
|
||||
strcat(tempBuffUser, " \"netstalker01\" * : ");
|
||||
strcat(tempBuffUser, ircNick);
|
||||
strcat(tempBuffUser, "\r\n");
|
||||
|
||||
char tempBuffNick[1024] = {0};
|
||||
|
||||
strcpy(tempBuffNick, "NICK ");
|
||||
strcat(tempBuffNick, ircNick);
|
||||
strcat(tempBuffNick, "\r\n");
|
||||
|
||||
sendS(lSock, tempBuffUser, strlen(tempBuffUser), 0);
|
||||
sendS(lSock, tempBuffNick, strlen(tempBuffNick), 0);
|
||||
|
||||
memset(tempBuffUser, '0', sizeof(tempBuffUser));
|
||||
memset(tempBuffNick, '0', sizeof(tempBuffNick));
|
||||
};
|
||||
void GetNicks()
|
||||
{
|
||||
char chanTemp[64] = {0};
|
||||
strcpy(chanTemp, "NAMES #");
|
||||
strcat(chanTemp, IRC_CHAN);
|
||||
strcat(chanTemp, "\r\n");
|
||||
sendS(lSock, chanTemp, strlen(chanTemp), 0);
|
||||
};
|
||||
char *GetServerName(char *buff)
|
||||
{
|
||||
char *temp1 = NULL;
|
||||
int sz = 0;
|
||||
char name[128] = {0};
|
||||
if(strstr(buff, " ") != NULL)
|
||||
{
|
||||
temp1 = strstr(buff, " ");
|
||||
sz = temp1 - buff - 1;
|
||||
strncpy(name, buff + 1, (sz < 128 ? sz : 128));
|
||||
};
|
||||
|
||||
return name;
|
||||
};
|
||||
int jFlag1 = 0;
|
||||
void __pinger(char *recvBuff)
|
||||
{
|
||||
if(strstr(recvBuff, "PING") != NULL)
|
||||
{
|
||||
char tmpa[128] = {0};
|
||||
|
||||
if(strstr(recvBuff, "PING :") != NULL)
|
||||
{
|
||||
if(strstr(strstr(recvBuff, "PING :") + strlen("PING :"), "\r\n") != NULL)
|
||||
{
|
||||
strcpy(tmpa, "PONG ");
|
||||
strncat(tmpa, strstr(recvBuff, "PING :") + strlen("PING "), strlen(strstr(recvBuff, "PING :") + strlen("PING ")) - strlen(strstr(strstr(recvBuff, "PING :") + strlen("PING :"), "\r\n")));
|
||||
strcat(tmpa, "\r\n");
|
||||
|
||||
sendS(lSock, tmpa, strlen(tmpa), 0);
|
||||
}
|
||||
else
|
||||
{
|
||||
strcpy(tmpa, "PONG ");
|
||||
strncat(tmpa, strstr(recvBuff, ":"), 16);
|
||||
strcat(tmpa, "\r\n");
|
||||
|
||||
sendS(lSock, tmpa, strlen(tmpa), 0);
|
||||
};
|
||||
|
||||
|
||||
if(ircPTh->isRunning() == false) ircPTh->start();
|
||||
};
|
||||
|
||||
if(!jFlag1) //Channel-entering sequence
|
||||
{
|
||||
Sleep(500);
|
||||
char chanTemp[32] = {0};
|
||||
strcpy(chanTemp, "JOIN #");
|
||||
strcat(chanTemp, IRC_CHAN);
|
||||
strcat(chanTemp, "\r\n");
|
||||
sendS(lSock, chanTemp, strlen(chanTemp), 0);
|
||||
|
||||
jFlag1 = 1;
|
||||
};
|
||||
|
||||
globalPinger = 0;
|
||||
memset(tmpa, '\0', sizeof(tmpa));
|
||||
}
|
||||
if(strstr(recvBuff, "PONG") != NULL)
|
||||
{
|
||||
char tmpa[128] = {0};
|
||||
|
||||
if(!jFlag1) //Channel-entering sequence
|
||||
{
|
||||
Sleep(500);
|
||||
char chanTemp[32] = {0};
|
||||
strcpy(chanTemp, "JOIN #");
|
||||
strcat(chanTemp, IRC_CHAN);
|
||||
strcat(chanTemp, "\r\n");
|
||||
sendS(lSock, chanTemp, strlen(chanTemp), 0);
|
||||
|
||||
jFlag1 = 1;
|
||||
};
|
||||
|
||||
globalPinger = 0;
|
||||
memset(tmpa, '\0', sizeof(tmpa));
|
||||
}
|
||||
else if(strstr(recvBuff, "G :") != NULL)
|
||||
{
|
||||
char tmpa[128] = {0};
|
||||
if(strstr(recvBuff, "G :") != NULL)
|
||||
{
|
||||
if(strstr(strstr(recvBuff, "G :") + strlen("G :"), "\r\n") != NULL)
|
||||
{
|
||||
strcpy(tmpa, "PONG ");
|
||||
strncat(tmpa, strstr(recvBuff, "G :") + strlen("G :"), strlen(strstr(recvBuff, "G :") + strlen("G :")) - strlen(strstr(strstr(recvBuff, "G :") + strlen("G :"), "\r\n")));
|
||||
strcat(tmpa, "\r\n");
|
||||
sendS(lSock, tmpa, strlen(tmpa), 0);
|
||||
}
|
||||
else
|
||||
{
|
||||
strcpy(tmpa, "PONG ");
|
||||
strncat(tmpa, strstr(recvBuff, ":"), 16);
|
||||
strcat(tmpa, "\r\n");
|
||||
sendS(lSock, tmpa, strlen(tmpa), 0);
|
||||
};
|
||||
};
|
||||
|
||||
if(!jFlag1) //Channel-entering sequence
|
||||
{
|
||||
Sleep(500);
|
||||
char chanTemp[32] = {0};
|
||||
strcpy(chanTemp, "JOIN #");
|
||||
strcat(chanTemp, IRC_CHAN);
|
||||
strcat(chanTemp, "\r\n");
|
||||
sendS(lSock, chanTemp, strlen(chanTemp), 0);
|
||||
|
||||
jFlag1 = 1;
|
||||
};
|
||||
|
||||
globalPinger = 0;
|
||||
if(ircPTh->isRunning() == false) ircPTh->start();
|
||||
memset(tmpa, '\0', sizeof(tmpa));
|
||||
};
|
||||
};
|
||||
|
||||
void IRCLoop()
|
||||
{
|
||||
nickFlag = 0;
|
||||
offlineFlag = 0;
|
||||
|
||||
#pragma region QTGUI_Area
|
||||
ircTh->doEmitChangeYellowIRCData("Connecting to IRC server " + QString(ircServer) + ":" + QString(ircPort) + "...");
|
||||
#pragma endregion
|
||||
|
||||
int err, yes = 1;
|
||||
jFlag1 = 0;
|
||||
sockaddr_in addr;
|
||||
addr.sin_family = AF_INET;
|
||||
|
||||
HOSTENT *host;
|
||||
|
||||
if(proxyEnabledFlag)
|
||||
{
|
||||
addr.sin_port = htons(atoi(ircProxyPort));
|
||||
|
||||
#if defined(WIN32) || defined(_WIN32) || defined(__WIN32) && !defined(__CYGWIN__)
|
||||
if(inet_addr(ircProxy) != INADDR_NONE) addr.sin_addr.S_un.S_addr = inet_addr(ircProxy);
|
||||
else if(host = gethostbyname (ircProxy)) ((unsigned long*) &addr.sin_addr)[0] = ((unsigned long**)host->h_addr_list)[0][0];
|
||||
#else
|
||||
if(inet_addr(ircProxy) != INADDR_NONE) addr.sin_addr.s_addr = inet_addr(ircProxy);
|
||||
else if(host=gethostbyname (ircProxy)) ((unsigned long*) &addr.sin_addr)[0] = ((unsigned long**)host->h_addr_list)[0][0];
|
||||
#endif
|
||||
}
|
||||
else
|
||||
{
|
||||
addr.sin_port = htons(atoi(ircPort));
|
||||
|
||||
#if defined(WIN32) || defined(_WIN32) || defined(__WIN32) && !defined(__CYGWIN__)
|
||||
if(inet_addr(ircServer) != INADDR_NONE) addr.sin_addr.S_un.S_addr = inet_addr(ircServer);
|
||||
else if(host = gethostbyname (ircServer)) ((unsigned long*) &addr.sin_addr)[0] = ((unsigned long**)host->h_addr_list)[0][0];
|
||||
#else
|
||||
if(inet_addr(ircServer) != INADDR_NONE) addr.sin_addr.s_addr = inet_addr(ircServer);
|
||||
else if(host=gethostbyname (ircServer)) ((unsigned long*) &addr.sin_addr)[0] = ((unsigned long**)host->h_addr_list)[0][0];
|
||||
#endif
|
||||
};
|
||||
|
||||
for(int conCounter = 1; conCounter <= 100; ++conCounter)
|
||||
{
|
||||
char topicData[256] = {0};
|
||||
if(iWantToConnect == false) break;
|
||||
OnlineMsgSentFlag = false;
|
||||
|
||||
lSock = socket(AF_INET, SOCK_STREAM, IPPROTO_TCP);
|
||||
|
||||
if(proxyEnabledFlag) ircTh->doEmitChangeYellowIRCData("Connecting to proxy " + QString(ircProxy) + "...");
|
||||
if(connect(lSock, (sockaddr*)&addr, sizeof(addr)) != SOCKET_ERROR)
|
||||
{
|
||||
if(proxyEnabledFlag) ircTh->doEmitChangeYellowIRCData("Connection to proxy " + QString(ircProxy) + " established.");
|
||||
globalPinger = 0;
|
||||
|
||||
char temprecvBuff[512] = {0};
|
||||
char tempSendMsg[512] = {0};
|
||||
|
||||
if(proxyEnabledFlag)
|
||||
{
|
||||
strcpy(tempSendMsg, "CONNECT ");
|
||||
strcat(tempSendMsg, ircServer);
|
||||
strcat(tempSendMsg, ":");
|
||||
strcat(tempSendMsg, ircPort);
|
||||
strcat(tempSendMsg, " HTTP/1.1\r\n\r\n");
|
||||
|
||||
sendS(lSock, tempSendMsg, strlen(tempSendMsg), 0);
|
||||
|
||||
recvS(lSock, temprecvBuff, sizeof(temprecvBuff), 0);
|
||||
|
||||
if(strstr(temprecvBuff, "HTTP/1.1 200 OK") || strstr(temprecvBuff, "200 OK")
|
||||
|| strstr(temprecvBuff, "OK 200") || strstr(temprecvBuff, "200 Connection") )
|
||||
{
|
||||
ircTh->doEmitChangeYellowIRCData("Proxy accepted connection. Waiting for IRC reply...");
|
||||
sendS(lSock, "\r\n", strlen("\r\n"), 0);
|
||||
}
|
||||
else
|
||||
{
|
||||
ircTh->doEmitChangeRedIRCData("[IRC: Bad proxy reply.]");
|
||||
break;
|
||||
};
|
||||
}
|
||||
else
|
||||
{
|
||||
sendS(lSock, "\r\n", strlen("\r\n"), 0);
|
||||
};
|
||||
|
||||
UserNickInit(lSock);
|
||||
|
||||
char recvBuffG[MAX_IRC_RECV_LEN] = {0};
|
||||
char serverRealName[256] = {0};
|
||||
bool nameLocked = false;
|
||||
|
||||
char pTemp[32] = {0};
|
||||
strcpy(pTemp, "PRIV");
|
||||
strcat(pTemp, "MSG ");
|
||||
while(recvS(lSock, recvBuffG, MAX_IRC_RECV_LEN, 0) > 0 && iWantToConnect)
|
||||
{
|
||||
if(strlen(recvBuffG) > 0)
|
||||
{
|
||||
char *recvBuff = recvBuffG;
|
||||
#pragma region Pinger
|
||||
__pinger(recvBuff);
|
||||
#pragma endregion
|
||||
char comStr[512] = {0};
|
||||
char delimBf[512] = {0};
|
||||
strcpy(delimBf, ":");
|
||||
strcat(delimBf, serverRealName);
|
||||
|
||||
char *Gtemp = recvBuff;
|
||||
while(strstr(Gtemp + 1, "\n") != NULL)
|
||||
{
|
||||
char *temp1 = NULL;
|
||||
if(strstr(Gtemp + 1, "\n") != NULL) temp1 = strstr(Gtemp + 1, "\n");
|
||||
else temp1 = Gtemp + strlen(Gtemp);
|
||||
int csz = temp1 - Gtemp - 1;
|
||||
strncpy(comStr, Gtemp, csz);
|
||||
Gtemp = strstr(Gtemp + 1, "\n");
|
||||
|
||||
char privTemp[64] = {0};
|
||||
|
||||
strcpy(privTemp, "PRIV");
|
||||
strcat(privTemp, "MSG #");
|
||||
strcat(privTemp, IRC_CHAN);
|
||||
strcat(privTemp, " :");
|
||||
|
||||
char pTemp[32] = {0};
|
||||
strcpy(pTemp, " PRIV");
|
||||
strcat(pTemp, "MSG ");
|
||||
if(strstr(comStr, pTemp) == NULL)
|
||||
{
|
||||
char topicTemp[64] = {0};
|
||||
strcpy(topicTemp, "TOPIC #");
|
||||
strcat(topicTemp, IRC_CHAN);
|
||||
strcat(topicTemp, " :");
|
||||
if(strstr(comStr, serverRealName) != NULL && (strstr(comStr, "while we process your") != NULL || strstr(comStr, "Looking up your hostname") != NULL)
|
||||
)
|
||||
{
|
||||
#pragma region QTGUI_Area
|
||||
ircTh->doEmitChangeGreenIRCData("[OK] Connected to irc server: " + ui->ircServerBox->text()+ ":" + ui->serverPortBox->text() + ".");
|
||||
#pragma endregion
|
||||
if(nameLocked == false)
|
||||
{
|
||||
nameLocked = true;
|
||||
strncpy(serverRealName, GetServerName(recvBuff), 128);
|
||||
};
|
||||
|
||||
Sleep(500);
|
||||
UserNickInit(lSock);
|
||||
|
||||
Sleep(500);
|
||||
char chanTemp[32] = {0};
|
||||
strcpy(chanTemp, "JOIN #");
|
||||
strcat(chanTemp, IRC_CHAN);
|
||||
strcat(chanTemp, "\r\n");
|
||||
sendS(lSock, chanTemp, strlen(chanTemp), 0);
|
||||
}
|
||||
else if(strstr(comStr, serverRealName) != NULL && (strstr(comStr, "ERROR :Closing Link:") != NULL || strstr(comStr, "ERROR :") != NULL) )
|
||||
{
|
||||
if(strstr(comStr, "Registration timed out") != NULL)
|
||||
{
|
||||
#pragma region QTGUI_Area
|
||||
ircTh->doEmitChangeRedIRCData("-//- [!] Connection failure. (Registration timed out)");
|
||||
ircTh->terminate();
|
||||
#pragma endregion
|
||||
}
|
||||
else
|
||||
{
|
||||
#pragma region QTGUI_Area
|
||||
ircTh->doEmitChangeRedIRCData("-//- [!] Connection failure. (Closed link)");
|
||||
ircTh->terminate();
|
||||
#pragma endregion
|
||||
};
|
||||
}
|
||||
else if(strstr(comStr, serverRealName) != NULL && strstr(comStr, "flooding") != NULL)
|
||||
{
|
||||
ircTh->doEmitChangeYellowIRCData("[" + QString::fromLocal8Bit("Óïûðüòå ìåë") + "] Flooding detected.");
|
||||
}
|
||||
else if((strstr(comStr, serverRealName) != NULL && strstr(comStr, " 332 ") != NULL)
|
||||
|| strstr(comStr, topicTemp) != NULL)
|
||||
{
|
||||
char chanTemp[32] = {0};
|
||||
strcpy(chanTemp, IRC_CHAN);
|
||||
strcat(chanTemp, " :");
|
||||
char *temp = strstr(comStr, chanTemp);
|
||||
strncpy(topicData, temp + strlen(chanTemp), 256);
|
||||
if(utfIRCFlag)
|
||||
{
|
||||
QTextCodec *codec = QTextCodec::codecForName("Windows-1251");
|
||||
QByteArray wtf_s(QString::fromLocal8Bit(topicData).toStdString().c_str());
|
||||
QByteArray wtf = codec->fromUnicode(wtf_s);
|
||||
ircTh->doEmitGetTopic(wtf);
|
||||
}
|
||||
else ircTh->doEmitGetTopic(QString::fromLocal8Bit(topicData));
|
||||
}
|
||||
else if(strstr(comStr, "not channel operator") != NULL)
|
||||
{
|
||||
ircTh->doEmitChangeRedIRCData("[Nope] You're not channel operator.");
|
||||
ircTh->doEmitGetTopic(QString::fromLocal8Bit(topicData));
|
||||
}
|
||||
else if(strstr(comStr, serverRealName) != NULL && (strstr(comStr, "353") != NULL || strstr(comStr, "End of /NAMES list") != NULL))
|
||||
{
|
||||
char *strMain = NULL;
|
||||
char *str1 = NULL;
|
||||
char *str2 = NULL;
|
||||
|
||||
if(strstr(comStr, " 353 ") != NULL) strMain = strstr(comStr, " 353 ");
|
||||
if(strMain != NULL)
|
||||
{
|
||||
char cTemp[64] = {0};
|
||||
strcpy(cTemp, IRC_CHAN);
|
||||
strcat(cTemp, " :");
|
||||
|
||||
if(strstri(strMain, cTemp) != NULL) str1 = strstri(strMain, cTemp);
|
||||
else
|
||||
{
|
||||
char chanTemp[64] = {0};
|
||||
strcpy(chanTemp, IRC_CHAN);
|
||||
strcat(chanTemp, " : Error in /NAMES");
|
||||
|
||||
str1 = chanTemp;
|
||||
};
|
||||
if(strstr(str1, ":") != NULL) str2 = strstr(str1 + 1, ":");
|
||||
|
||||
char temp[MAX_IRC_RECV_LEN] = {0};
|
||||
|
||||
int dsz = strlen(str2);
|
||||
if(dsz > 0)
|
||||
{
|
||||
ircTh->doEmitClearNickList();
|
||||
strncpy(temp, str2, dsz);
|
||||
|
||||
char *lex = strtok(temp + 1, " ");
|
||||
|
||||
while(lex != NULL && lex != "" && lex != "\r" && lex != "\r\n" && *lex != 13)
|
||||
{
|
||||
ircTh->doEmitAddNick(QString::fromLocal8Bit(lex));
|
||||
lex = strtok(NULL, " ");
|
||||
};
|
||||
};
|
||||
};
|
||||
}
|
||||
else if(strstr(comStr, serverRealName) != NULL && (strstr(comStr, " 432 ") > 0 || strstr(comStr, "Erroneous Nickname") > 0))
|
||||
{
|
||||
#pragma region QTGUI_Area
|
||||
ircTh->doEmitChangeRedIRCData("[Nope] Erroneous Nickname: Illegal characters.");
|
||||
#pragma endregion
|
||||
}
|
||||
else if(strstr(comStr, serverRealName) != NULL && (strstr(comStr, " 433 ") > 0 || strstr(comStr, "Nickname is already") > 0) )
|
||||
{
|
||||
#pragma region QTGUI_Area
|
||||
QTime time = QTime::currentTime();
|
||||
qsrand((uint)time.msec());
|
||||
ircTh->doEmitChangeRedIRCData("[Nope] Nickname is already in use.");
|
||||
ircTh->doEmitSetNick("ns_" + QString::number(qrand() % 8999 + 1000 ));
|
||||
#pragma endregion
|
||||
UserNickInit(lSock);
|
||||
}
|
||||
else if(strstr(comStr, serverRealName) != NULL && (strstr(comStr, " 438 ") > 0 || strstr(comStr, "Nick change too") > 0))
|
||||
{
|
||||
#pragma region QTGUI_Area
|
||||
ircTh->doEmitChangeRedIRCData("[Nope] You are changing nicks too fast.");
|
||||
#pragma endregion
|
||||
}
|
||||
else if(strstr(comStr, serverRealName) != NULL && (strstr(comStr, "End of /NAMES list") != NULL || strstr(comStr, "End of /names list") != NULL
|
||||
|| strstr(comStr, "end of /NAMES list") != NULL || strstr(comStr, "end of /names list") != NULL)
|
||||
&& strstr(comStr, "353") == NULL)
|
||||
{
|
||||
ircTh->doEmitChangeRedIRCData("[IRC: NAMES! lol]");
|
||||
}
|
||||
else if(strstr(comStr, "QUIT :Ping timeout") != NULL || strstr(comStr, "EOF From") != NULL
|
||||
|| strstr(comStr, "EOF from") != NULL || strstr(comStr, " QUIT :") != NULL)
|
||||
{
|
||||
if(strstr(comStr, ":") != NULL)
|
||||
{
|
||||
if(strstr(comStr, "!") != NULL)
|
||||
{
|
||||
if(strstr(comStr, "@") != NULL)
|
||||
{
|
||||
char *temp1 = strstr(comStr, ":");
|
||||
char *temp2 = strstr(temp1, "!");
|
||||
char leaverNick[32] = {0};
|
||||
|
||||
int sz = temp2 - temp1;
|
||||
|
||||
strncpy(leaverNick, temp1, (sz < 16 ? sz : 16));
|
||||
|
||||
#pragma region QTGUI_Area
|
||||
if(strstr(comStr, "QUIT :Ping timeout") != NULL)
|
||||
{
|
||||
ircTh->doEmitChangeYellowIRCData("-//- " + QString(leaverNick) + " left channel (Ping timeout).");
|
||||
_blinkNLine(QString(leaverNick) + " left channel (Ping timeout)", "[Server]");
|
||||
}
|
||||
else
|
||||
{
|
||||
ircTh->doEmitChangeYellowIRCData("-//- " + QString(leaverNick) + " left channel.");
|
||||
_blinkNLine(QString(leaverNick) + " left channel.", "[Server]");
|
||||
};
|
||||
#pragma endregion
|
||||
};
|
||||
};
|
||||
};
|
||||
}
|
||||
else if(strstr(comStr, "NICK :") != NULL)
|
||||
{
|
||||
char *temp;
|
||||
char *temp2;
|
||||
char senderNick[32] = {0};
|
||||
if(strstr(comStr, ":") != NULL) temp = strstr(comStr, ":");
|
||||
if(strstr(temp, "!") != NULL) temp2 = strstr(comStr, "!");
|
||||
int nickLen = temp2 - temp - 1;
|
||||
if(nickLen > 0) strncpy(senderNick, temp + 1, nickLen);
|
||||
|
||||
if(strstr(comStr, "NICK :") != NULL) temp = strstr(comStr, "NICK :");
|
||||
memset(temp + strlen(temp), '\0', 1);
|
||||
|
||||
QString newNick = QString((char*)(temp + strlen("NICK :")));
|
||||
#pragma region QTGUI_Area
|
||||
ircTh->doEmitChangeYellowIRCData("[" + QString(senderNick) + "] is now known as [" + newNick + "].");
|
||||
#pragma endregion
|
||||
_blinkNLine("[" + QString(senderNick) + "] is now known as [" + newNick + "].", "[Server]");
|
||||
|
||||
}
|
||||
else if(iWantToConnect && (strstr(comStr, "JOIN :#") > 0 || strstr(comStr, "Join :#") > 0
|
||||
|| strstr(comStr, "join :#") > 0))
|
||||
{
|
||||
char *temp;
|
||||
char *temp2;
|
||||
char senderNick[32] = {0};
|
||||
if(strstr(comStr, ":") != NULL) temp = strstr(comStr, ":");
|
||||
if(strstr(temp, "!") != NULL) temp2 = strstr(comStr, "!");
|
||||
int nickLen = temp2 - temp;
|
||||
if(nickLen > 0) strncpy(senderNick, temp + 1, nickLen - 1);
|
||||
|
||||
#pragma region QTGUI_Area
|
||||
if(QString::fromLocal8Bit(senderNick) != ui->ircNickBox->text())
|
||||
{
|
||||
ircTh->doEmitChangeYellowIRCData("[" + QString(senderNick) + "] joined the channel.");
|
||||
_blinkNLine("[" + QString(senderNick) + "] joined the channel.", "[Server]");
|
||||
}
|
||||
else
|
||||
{
|
||||
ircTh->doEmitChangeYellowIRCData("You have joined the channel.");
|
||||
_blinkNLine("You have joined the channel.", "[Server]");
|
||||
if(!OnlineMsgSentFlag) //Sending data only once per connect
|
||||
{
|
||||
OnlineMsgSentFlag = true;
|
||||
|
||||
char temp[64] = {0};
|
||||
strcpy(temp, "PRIV");
|
||||
strcat(temp, "MSG #");
|
||||
strcat(temp, IRC_CHAN);
|
||||
strcat(temp, " :My version: v3_");
|
||||
strcat(temp, gVER);
|
||||
strcat(temp, "\n");
|
||||
sendS(lSock, temp, strlen(temp), 0);
|
||||
|
||||
connectedToIRC = true;
|
||||
};
|
||||
};
|
||||
#pragma endregion
|
||||
}
|
||||
else if(iWantToConnect && (strstr(comStr, "PART #") > 0 || strstr(comStr, "Part #") > 0
|
||||
|| strstr(comStr, "part #") > 0))
|
||||
{
|
||||
char *temp;
|
||||
char *temp2;
|
||||
char senderNick[32] = {0};
|
||||
if(strstr(comStr, ":") != NULL) temp = strstr(comStr, ":");
|
||||
if(strstr(temp, "!") != NULL) temp2 = strstr(comStr, "!");
|
||||
int nickLen = temp2 - temp;
|
||||
if(nickLen > 0) strncpy(senderNick, temp + 1, nickLen - 1);
|
||||
|
||||
#pragma region QTGUI_Area
|
||||
if(QString::fromLocal8Bit(senderNick) != ui->ircNickBox->text()) ircTh->doEmitChangeYellowIRCData("[" + QString(senderNick) + "] left the channel.");
|
||||
else ircTh->doEmitChangeYellowIRCData("You have left the channel.");
|
||||
#pragma endregion
|
||||
};
|
||||
}
|
||||
else if(strstri(comStr, privTemp) != NULL)
|
||||
{
|
||||
char channelName[64] = {0};
|
||||
strcpy(channelName, "PRIV");
|
||||
strcat(channelName, "MSG #");
|
||||
strcat(channelName, IRC_CHAN);
|
||||
strcat(channelName, " :");
|
||||
|
||||
char *tprv = comStr;
|
||||
char *temp = NULL;
|
||||
char *temp2 = NULL;
|
||||
|
||||
#pragma region Pinger
|
||||
__pinger(recvBuff);
|
||||
#pragma endregion
|
||||
char senderNick[32] = {0};
|
||||
if(strstr(tprv, ":") != NULL) temp = strstr(tprv, ":");
|
||||
if(strstr(temp, "!") != NULL) temp2 = strstr(tprv, "!");
|
||||
if(temp != NULL && temp2 != NULL)
|
||||
{
|
||||
if(strlen(temp) > 0 && strlen(temp2) > 0)
|
||||
{
|
||||
int nickLen = temp2 - temp;
|
||||
if(nickLen <= 32)
|
||||
{
|
||||
char *tempD = strstri(tprv, channelName);
|
||||
int nsz = strlen(channelName);
|
||||
|
||||
if(tempD == NULL) break;
|
||||
char *temp4 = NULL;
|
||||
int dsz = 0;
|
||||
if(strstr(tempD, "\n") != NULL)
|
||||
{
|
||||
temp4 = strstr(tempD, "\n");
|
||||
dsz = temp4 - tempD - nsz - 1;
|
||||
};
|
||||
|
||||
char tempData[512] = {0};
|
||||
if(temp4 != NULL)
|
||||
{
|
||||
strncpy(tempData, tempD + nsz, (dsz == 0 ? strlen(temp4) : dsz));
|
||||
}
|
||||
else strcpy(tempData, tempD + nsz);
|
||||
|
||||
if(nickLen > 0) strncpy(senderNick, temp + 1, nickLen - 1);
|
||||
|
||||
if(strlen(tempData) > 0)
|
||||
{
|
||||
QString strf;
|
||||
strf = QString::fromLocal8Bit(tempData);
|
||||
_blinkNLine(strf, QString::fromLocal8Bit(senderNick));
|
||||
ircTh->doEmitionPlayDckingSound();
|
||||
bool HLFlag = doHL(strf.toLocal8Bit().data());
|
||||
int cCode = 0;
|
||||
#pragma region QTGUI_Area
|
||||
ircTh->doEmitChangeIRCData(false, HLFlag, cCode, strf, " <a href=\"nesca:" + QString::fromLocal8Bit(senderNick) + "\"><font style=\"color:#" + GetNickColor(senderNick) + "\">[" + QString::fromLocal8Bit(senderNick) + "]:</font></a>");
|
||||
#pragma endregion
|
||||
};
|
||||
};
|
||||
};
|
||||
};
|
||||
ZeroMemory(senderNick, sizeof(senderNick));
|
||||
|
||||
}
|
||||
else if(strstri( comStr, QString(QString(pTemp) + " " + QString(ircNick)).toLocal8Bit().data() ) != NULL)
|
||||
{
|
||||
char *tprv = comStr;
|
||||
char *temp = NULL;
|
||||
char *temp2 = NULL;
|
||||
char senderNick[32] = {0};
|
||||
if(strstr(tprv, ":") != NULL) temp = strstr(tprv, ":");
|
||||
if(strstr(temp, "!") != NULL) temp2 = strstr(tprv, "!");
|
||||
if(temp != NULL && temp2 != NULL)
|
||||
{
|
||||
if(strlen(temp) > 0 && strlen(temp2) > 0)
|
||||
{
|
||||
int nickLen = temp2 - temp;
|
||||
if(nickLen <= 32)
|
||||
{
|
||||
char *tempD = strstri(tprv, QString(QString(pTemp) + " " + QString(ircNick)).toLocal8Bit().data());
|
||||
int nsz = QString(ircNick).size() + 10;
|
||||
|
||||
if(tempD == NULL) break;
|
||||
char *temp4 = NULL;
|
||||
int dsz = 0;
|
||||
if(strstr(tempD, "\n") != NULL)
|
||||
{
|
||||
temp4 = strstr(tempD, "\n");
|
||||
dsz = temp4 - tempD - nsz - 1;
|
||||
};
|
||||
|
||||
char tempData[512] = {0};
|
||||
if(temp4 != NULL)
|
||||
{
|
||||
strncpy(tempData, tempD + nsz, (dsz == 0 ? strlen(temp4) : dsz));
|
||||
}
|
||||
else strcpy(tempData, tempD + nsz);
|
||||
|
||||
if(nickLen > 0) strncpy(senderNick, temp + 1, nickLen - 1);
|
||||
|
||||
if(strlen(tempData) > 0)
|
||||
{
|
||||
QString strf;
|
||||
strf = QString::fromLocal8Bit(tempData);
|
||||
_blinkNLine(strf, QString::fromLocal8Bit(senderNick));
|
||||
ircTh->doEmitionPlayDckingSound();
|
||||
bool HLFlag = doHL(strf.toLocal8Bit().data());
|
||||
int cCode = 0;
|
||||
#pragma region QTGUI_Area
|
||||
ircTh->doEmitChangeIRCData(true, HLFlag, cCode, strf, "<a href=\"nesca:" + QString::fromLocal8Bit(senderNick) + "\"><font style=\"color:#" + GetNickColor(senderNick) + "\">[" + QString::fromLocal8Bit(senderNick) + "]:</font></a>");
|
||||
#pragma endregion
|
||||
};
|
||||
};
|
||||
};
|
||||
};
|
||||
ZeroMemory(senderNick, sizeof(senderNick));
|
||||
};
|
||||
ZeroMemory(comStr, sizeof(comStr));
|
||||
};
|
||||
ZeroMemory(recvBuffG, MAX_IRC_RECV_LEN);
|
||||
};
|
||||
};
|
||||
|
||||
if(iWantToConnect == true)
|
||||
{
|
||||
#pragma region QTGUI_Area
|
||||
ircTh->doEmitChangeRedIRCData("[-//-] IRC server went offline.");
|
||||
#pragma endregion
|
||||
_blinkNLine("IRC server offlined!", "[Server]");
|
||||
Sleep(5000);
|
||||
connectedToIRC == false;
|
||||
};
|
||||
}
|
||||
else
|
||||
{
|
||||
#pragma region QTGUI_Area
|
||||
if(proxyEnabledFlag) ircTh->doEmitChangeRedIRCData("[-//-] Cannot connect to proxy. (" + QString::number(WSAGetLastError()) + ")" );
|
||||
else ircTh->doEmitChangeRedIRCData("[-//-] Connection failed. (" + QString::number(WSAGetLastError()) + ")" );
|
||||
|
||||
#pragma endregion
|
||||
};
|
||||
CSSOCKET(lSock);
|
||||
};
|
||||
//};
|
||||
CSSOCKET(lSock);
|
||||
};
|
||||
|
||||
void oIRC_Th::run()
|
||||
{
|
||||
IRCLoop();
|
||||
ircTh->doEmitIRCOfflined();
|
||||
};
|
47
oIRC_Th.h
Normal file
47
oIRC_Th.h
Normal file
@ -0,0 +1,47 @@
|
||||
#ifndef OIRC_TH_H
|
||||
#define OIRC_TH_H
|
||||
|
||||
#pragma once
|
||||
#include "nesca_3.h"
|
||||
#include "irc_nmblinker.h"
|
||||
#include "IRCPinger_Th.h"
|
||||
|
||||
class oIRC_Th : public QThread
|
||||
{
|
||||
Q_OBJECT
|
||||
|
||||
public:
|
||||
void doEmitUnhidePopup(QString, QString);
|
||||
void doEmitChangeIRCData(bool, bool, int, QString, QString);
|
||||
void doEmitChangeRedIRCData(QString);
|
||||
void doEmitChangeGreenIRCData(QString);
|
||||
void doEmitChangeYellowIRCData(QString);
|
||||
void doEmitChangeRawIRCDataInc(QString);
|
||||
void doEmitChangeRawIRCDataOut(QString);
|
||||
void doEmitSetNick(QString);
|
||||
void doEmitAddNick(QString);
|
||||
void doEmitClearNickList();
|
||||
void doEmitIRCOfflined();
|
||||
void doEmitionPlayDckingSound();
|
||||
void doEmitGetTopic(QString str);
|
||||
|
||||
public: signals: void sUnhidePopup(QString, QString);
|
||||
public: signals: void changeIRCData(bool, bool, int, QString, QString);
|
||||
public: signals: void changeRedIRCData(QString);
|
||||
public: signals: void changeGreenIRCData(QString);
|
||||
public: signals: void changeYellowIRCData(QString);
|
||||
public: signals: void changeRawIRCDataInc(QString);
|
||||
public: signals: void changeRawIRCDataOut(QString);
|
||||
public: signals: void setNick(QString);
|
||||
public: signals: void AddNick(QString);
|
||||
public: signals: void ClearNickList();
|
||||
public: signals: void IRCOfflined();
|
||||
public: signals: void notifyPlay();
|
||||
public: signals: void getTopic(QString);
|
||||
|
||||
protected:
|
||||
void run();
|
||||
};
|
||||
|
||||
extern oIRC_Th *ircTh;
|
||||
#endif // OIRC_TH_H
|
25
piestat.cpp
Normal file
25
piestat.cpp
Normal file
@ -0,0 +1,25 @@
|
||||
#include "piestat.h"
|
||||
#include "externData.h"
|
||||
|
||||
void PieStat::doEmitUpdatePie()
|
||||
{
|
||||
emit psTh->sUpdatePie();
|
||||
};
|
||||
|
||||
void PieStat::run()
|
||||
{
|
||||
while(PieStatFlag)
|
||||
{
|
||||
psTh->doEmitUpdatePie();
|
||||
AnomC1 = 0;
|
||||
WF = 0;
|
||||
BA = 0;
|
||||
Filt = 0;
|
||||
Overl = 0;
|
||||
Lowl = 0;
|
||||
Alive = 0;
|
||||
Susp = 0;
|
||||
ssh = 0;
|
||||
msleep(500);
|
||||
};
|
||||
};
|
21
piestat.h
Normal file
21
piestat.h
Normal file
@ -0,0 +1,21 @@
|
||||
#ifndef PIESTAT_H
|
||||
#define PIESTAT_H
|
||||
|
||||
#pragma once
|
||||
#include "nesca_3.h"
|
||||
|
||||
class PieStat : public QThread
|
||||
{
|
||||
Q_OBJECT
|
||||
|
||||
public:
|
||||
public: signals: void sUpdatePie();
|
||||
|
||||
public:
|
||||
void doEmitUpdatePie();
|
||||
protected:
|
||||
void run();
|
||||
};
|
||||
extern PieStat *psTh;
|
||||
|
||||
#endif // PIESTAT_H
|
18
progressbardrawer.cpp
Normal file
18
progressbardrawer.cpp
Normal file
@ -0,0 +1,18 @@
|
||||
#include "progressbardrawer.h"
|
||||
#include "externData.h"
|
||||
|
||||
void ProgressbarDrawer::update()
|
||||
{
|
||||
emit pbTh->upd();
|
||||
};
|
||||
|
||||
int nesca_3::perc = 0;
|
||||
void ProgressbarDrawer::run()
|
||||
{
|
||||
while(globalScanFlag)
|
||||
{
|
||||
msleep(1000);
|
||||
nesca_3::perc = (unsigned long)100*indexIP/(gTargetsOverall == 0 ? 1 : gTargetsOverall);
|
||||
update();
|
||||
};
|
||||
};
|
19
progressbardrawer.h
Normal file
19
progressbardrawer.h
Normal file
@ -0,0 +1,19 @@
|
||||
#ifndef PROGRESSBARDRAWER_H
|
||||
#define PROGRESSBARDRAWER_H
|
||||
|
||||
#pragma once
|
||||
#include "nesca_3.h"
|
||||
|
||||
class ProgressbarDrawer : public QThread
|
||||
{
|
||||
Q_OBJECT
|
||||
|
||||
public: signals: void upd();
|
||||
public:
|
||||
void update();
|
||||
protected:
|
||||
void run();
|
||||
};
|
||||
extern ProgressbarDrawer *pbTh;
|
||||
|
||||
#endif // PROGRESSBARDRAWER_H
|
BIN
resource.h
Normal file
BIN
resource.h
Normal file
Binary file not shown.
34
vercheckerthread.cpp
Normal file
34
vercheckerthread.cpp
Normal file
@ -0,0 +1,34 @@
|
||||
#include "vercheckerthread.h"
|
||||
#include "externData.h"
|
||||
#include "mainResources.h"
|
||||
|
||||
void _checkVer()
|
||||
{
|
||||
Connector con;
|
||||
conSTR CSTR;
|
||||
CSTR.lowerBuff = NULL;
|
||||
CSTR.size = 0;
|
||||
con._EstablishConnection("nesca.d3w.org", 80, "GET /version HTTP/1.1\r\nHost: nesca.d3w.org\r\nX-Nescav3: True\r\n\r\n", &CSTR, 1);
|
||||
|
||||
char *ptr1 = NULL;
|
||||
if(CSTR.lowerBuff != NULL)
|
||||
{
|
||||
if(strstr(CSTR.lowerBuff, "\r\n\r\n") != 0)
|
||||
{
|
||||
ptr1 = strstr(CSTR.lowerBuff, "\r\n\r\n");
|
||||
if(strcmp(gVER, ptr1 + 4) != 0)
|
||||
{
|
||||
stt->doEmitionShowRedVersion();
|
||||
};
|
||||
};
|
||||
delete []CSTR.lowerBuff;
|
||||
CSTR.lowerBuff = NULL;
|
||||
};
|
||||
|
||||
vct->terminate();
|
||||
};
|
||||
|
||||
void VerCheckerThread::run()
|
||||
{
|
||||
_checkVer();
|
||||
};
|
18
vercheckerthread.h
Normal file
18
vercheckerthread.h
Normal file
@ -0,0 +1,18 @@
|
||||
#ifndef VERCHECKERTHREAD_H
|
||||
#define VERCHECKERTHREAD_H
|
||||
|
||||
#pragma once
|
||||
#include "STh.h"
|
||||
|
||||
class VerCheckerThread : public QThread
|
||||
{
|
||||
Q_OBJECT
|
||||
|
||||
public:
|
||||
|
||||
protected:
|
||||
void run();
|
||||
};
|
||||
|
||||
extern VerCheckerThread *vct;
|
||||
#endif // VERCHECKERTHREAD_H
|
Loading…
Reference in New Issue
Block a user