mirror of
https://github.com/ChronosX88/nesca.git
synced 2024-11-23 18:52:19 +00:00
zz
This commit is contained in:
parent
90d94b8a3a
commit
4cf3b15f36
122
Connector.cpp
122
Connector.cpp
@ -211,6 +211,18 @@ int Connector::nConnect(const char* ip, const int port, std::string *buffer,
|
|||||||
|| res == CURLE_SEND_ERROR
|
|| res == CURLE_SEND_ERROR
|
||||||
|| res == CURLE_RECV_ERROR
|
|| res == CURLE_RECV_ERROR
|
||||||
) {
|
) {
|
||||||
|
if (gNegDebugMode)
|
||||||
|
{
|
||||||
|
stt->doEmitionDebugFoundData("NConnect failed (curl_code: " + QString::number(res) + ") [<a href=\"" + QString(ip) + ":" + QString::number(port) +
|
||||||
|
"/\"><font color=\"#0084ff\">" + QString(ip) + ":" + QString::number(port) + "</font></a>]");
|
||||||
|
}
|
||||||
|
SOCKET eNobuffSocket = socket(AF_INET, SOCK_STREAM, IPPROTO_TCP);
|
||||||
|
shutdown(eNobuffSocket, SD_BOTH);
|
||||||
|
closesocket(eNobuffSocket);
|
||||||
|
if (ENOBUFS == eNobuffSocket || ENOMEM == eNobuffSocket) {
|
||||||
|
stt->doEmitionRedFoundData("Insufficient buffer/memory space. Sleeping for 10 sec...");
|
||||||
|
Sleep(10000);
|
||||||
|
}
|
||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
@ -259,26 +271,104 @@ int Connector::nConnect(const char* ip, const int port, std::string *buffer,
|
|||||||
}
|
}
|
||||||
|
|
||||||
bool portCheck(const char * sDVRIP, int wDVRPort) {
|
bool portCheck(const char * sDVRIP, int wDVRPort) {
|
||||||
CURL *curl = curl_easy_init();
|
sockaddr_in sa;
|
||||||
if (curl != NULL) {
|
sa.sin_family = AF_INET;
|
||||||
curl_easy_setopt(curl, CURLOPT_NOSIGNAL, 1L);
|
sa.sin_port = htons(wDVRPort);
|
||||||
curl_easy_setopt(curl, CURLOPT_URL, sDVRIP);
|
|
||||||
curl_easy_setopt(curl, CURLOPT_PORT, wDVRPort);
|
|
||||||
int proxyPort = std::atoi(gProxyPort);
|
|
||||||
if (proxyPort > 0 && proxyPort < 65535) curl_easy_setopt(curl, CURLOPT_PROXYPORT, proxyPort);
|
|
||||||
curl_easy_setopt(curl, CURLOPT_PROXY, gProxyIP);
|
|
||||||
curl_easy_setopt(curl, CURLOPT_CONNECTTIMEOUT, gTimeOut);
|
|
||||||
curl_easy_setopt(curl, CURLOPT_TIMEOUT, gTimeOut);
|
|
||||||
curl_easy_setopt(curl, CURLOPT_CONNECT_ONLY, 1L);
|
|
||||||
|
|
||||||
int res = curl_easy_perform(curl);
|
hostent *host = NULL;
|
||||||
curl_easy_cleanup(curl);
|
#if defined(WIN32)
|
||||||
if (res != CURLE_OK) {
|
if (inet_addr(sDVRIP) != INADDR_NONE) sa.sin_addr.S_un.S_addr = inet_addr(sDVRIP);
|
||||||
|
else if (host = gethostbyname(sDVRIP)) ((unsigned long*)&sa.sin_addr)[0] = ((unsigned long**)host->h_addr_list)[0][0];
|
||||||
|
#else
|
||||||
|
if (inet_addr(sDVRIP) != INADDR_NONE) sa.sin_addr.s_addr = inet_addr(sDVRIP);
|
||||||
|
else if (host = gethostbyname(sDVRIP)) ((unsigned long*)&sa.sin_addr)[0] = ((unsigned long**)host->h_addr_list)[0][0];
|
||||||
|
#endif
|
||||||
|
else return false;
|
||||||
|
|
||||||
|
SOCKET sock = socket(AF_INET, SOCK_STREAM, IPPROTO_TCP);
|
||||||
|
if (sock == INVALID_SOCKET) return -1;
|
||||||
|
else if (ENOBUFS == sock || ENOMEM == sock) {
|
||||||
|
stt->doEmitionRedFoundData("Insufficient buffer/memory space. Sleeping for 10 sec...");
|
||||||
|
return -1;
|
||||||
|
}
|
||||||
|
|
||||||
|
struct linger linger = { 1, gTimeOut };
|
||||||
|
setsockopt(sock, SOL_SOCKET, SO_LINGER, (const char *)&linger, sizeof(linger));
|
||||||
|
|
||||||
|
int res = connect(sock, (sockaddr*)&sa, sizeof(sa));
|
||||||
|
|
||||||
|
shutdown(sock, SD_BOTH);
|
||||||
|
closesocket(sock);
|
||||||
|
|
||||||
|
if (res == SOCKET_ERROR) {
|
||||||
|
if (gNegDebugMode)
|
||||||
|
{
|
||||||
|
stt->doEmitionDebugFoundData("Port check failed - SOCKET_ERROR. [<a href=\"" + QString(sDVRIP) + ":" + QString::number(wDVRPort) +
|
||||||
|
"/\"><font color=\"#0084ff\">" + QString(sDVRIP) + ":" + QString::number(wDVRPort) + "</font></a>]");
|
||||||
|
}
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
else return true;
|
else {
|
||||||
|
if (gNegDebugMode)
|
||||||
|
{
|
||||||
|
stt->doEmitionDebugFoundData("Port check succeeded (curl_code: " + QString::number(res) + ") [<a href=\"" + QString(sDVRIP) + ":" + QString::number(wDVRPort) +
|
||||||
|
"/\"><font color=\"#0084ff\">" + QString(sDVRIP) + ":" + QString::number(wDVRPort) + "</font></a>]");
|
||||||
}
|
}
|
||||||
else return false;
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (gNegDebugMode)
|
||||||
|
{
|
||||||
|
stt->doEmitionDebugFoundData("Port check failed - unknown socket error. [<a href=\"" + QString(sDVRIP) + ":" + QString::number(wDVRPort) +
|
||||||
|
"/\"><font color=\"#0084ff\">" + QString(sDVRIP) + ":" + QString::number(wDVRPort) + "</font></a>]");
|
||||||
|
}
|
||||||
|
return false;
|
||||||
|
|
||||||
|
//CURL *curl = curl_easy_init();
|
||||||
|
//if (curl != NULL) {
|
||||||
|
// curl_easy_setopt(curl, CURLOPT_NOSIGNAL, 1L);
|
||||||
|
// curl_easy_setopt(curl, CURLOPT_URL, sDVRIP);
|
||||||
|
// curl_easy_setopt(curl, CURLOPT_PORT, wDVRPort);
|
||||||
|
// int proxyPort = std::atoi(gProxyPort);
|
||||||
|
// if (proxyPort > 0 && proxyPort < 65535) curl_easy_setopt(curl, CURLOPT_PROXYPORT, proxyPort);
|
||||||
|
// curl_easy_setopt(curl, CURLOPT_PROXY, gProxyIP);
|
||||||
|
// curl_easy_setopt(curl, CURLOPT_CONNECTTIMEOUT, gTimeOut);
|
||||||
|
// curl_easy_setopt(curl, CURLOPT_TIMEOUT, gTimeOut);
|
||||||
|
// //curl_easy_setopt(curl, CURLOPT_CONNECT_ONLY, 1L); //DO_NOT_USE. Windows XP - returns CURLE_OK even if port is closed.
|
||||||
|
// int res = curl_easy_perform(curl);
|
||||||
|
// curl_easy_cleanup(curl);
|
||||||
|
// if (res != CURLE_OK) {
|
||||||
|
// if (gNegDebugMode)
|
||||||
|
// {
|
||||||
|
// stt->doEmitionDebugFoundData("Port check failed (curl_code: " + QString::number(res) + ") [<a href=\"" + QString(sDVRIP) + ":" + QString::number(wDVRPort) +
|
||||||
|
// "/\"><font color=\"#0084ff\">" + QString(sDVRIP) + ":" + QString::number(wDVRPort) + "</font></a>]");
|
||||||
|
// }
|
||||||
|
// SOCKET eNobuffSocket = socket(AF_INET, SOCK_STREAM, IPPROTO_TCP);
|
||||||
|
// shutdown(eNobuffSocket, SD_BOTH);
|
||||||
|
// closesocket(eNobuffSocket);
|
||||||
|
// if (ENOBUFS == eNobuffSocket || ENOMEM == eNobuffSocket) {
|
||||||
|
// stt->doEmitionRedFoundData("Insufficient buffer/memory space. Sleeping for 10 sec...");
|
||||||
|
// Sleep(10000);
|
||||||
|
// }
|
||||||
|
// return false;
|
||||||
|
// }
|
||||||
|
// else {
|
||||||
|
// if (gNegDebugMode)
|
||||||
|
// {
|
||||||
|
// stt->doEmitionDebugFoundData("Port check succeeded (curl_code: " + QString::number(res) + ") [<a href=\"" + QString(sDVRIP) + ":" + QString::number(wDVRPort) +
|
||||||
|
// "/\"><font color=\"#0084ff\">" + QString(sDVRIP) + ":" + QString::number(wDVRPort) + "</font></a>]");
|
||||||
|
// }
|
||||||
|
// return true;
|
||||||
|
// }
|
||||||
|
//}
|
||||||
|
//else {
|
||||||
|
// if (gNegDebugMode)
|
||||||
|
// {
|
||||||
|
// stt->doEmitionDebugFoundData("Port check failed - curl_easy_init() error. [<a href=\"" + QString(sDVRIP) + ":" + QString::number(wDVRPort) +
|
||||||
|
// "/\"><font color=\"#0084ff\">" + QString(sDVRIP) + ":" + QString::number(wDVRPort) + "</font></a>]");
|
||||||
|
// }
|
||||||
|
// return false;
|
||||||
|
//}
|
||||||
}
|
}
|
||||||
int Connector::connectToPort(char* ip, int port)
|
int Connector::connectToPort(char* ip, int port)
|
||||||
{
|
{
|
||||||
|
@ -80,10 +80,24 @@ bool HikVis::checkHikk(const char * sDVRIP, int port) {
|
|||||||
if (inet_addr(sDVRIP) != INADDR_NONE) sa.sin_addr.s_addr = inet_addr(sDVRIP);
|
if (inet_addr(sDVRIP) != INADDR_NONE) sa.sin_addr.s_addr = inet_addr(sDVRIP);
|
||||||
else if (host = gethostbyname(sDVRIP)) ((unsigned long*)&sa.sin_addr)[0] = ((unsigned long**)host->h_addr_list)[0][0];
|
else if (host = gethostbyname(sDVRIP)) ((unsigned long*)&sa.sin_addr)[0] = ((unsigned long**)host->h_addr_list)[0][0];
|
||||||
#endif
|
#endif
|
||||||
else return false;
|
else {
|
||||||
|
if (gNegDebugMode)
|
||||||
|
{
|
||||||
|
stt->doEmitionDebugFoundData("inet_addr error - iVMS check failed [<a href=\"" + QString(sDVRIP) + ":" + QString::number(port) +
|
||||||
|
"/\"><font color=\"#0084ff\">" + QString(sDVRIP) + ":" + QString::number(port) + "</font></a>]");
|
||||||
|
}
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
SOCKET sock = socket(AF_INET, SOCK_STREAM, IPPROTO_TCP);
|
SOCKET sock = socket(AF_INET, SOCK_STREAM, IPPROTO_TCP);
|
||||||
if (sock == INVALID_SOCKET) return false;
|
if (sock == INVALID_SOCKET) {
|
||||||
|
if (gNegDebugMode)
|
||||||
|
{
|
||||||
|
stt->doEmitionDebugFoundData("Socket error - iVMS check failed [<a href=\"" + QString(sDVRIP) + ":" + QString::number(port) +
|
||||||
|
"/\"><font color=\"#0084ff\">" + QString(sDVRIP) + ":" + QString::number(port) + "</font></a>]");
|
||||||
|
}
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
struct linger linger = { 1, gTimeOut };
|
struct linger linger = { 1, gTimeOut };
|
||||||
setsockopt(sock, SOL_SOCKET, SO_LINGER, (const char *)&linger, sizeof(linger));
|
setsockopt(sock, SOL_SOCKET, SO_LINGER, (const char *)&linger, sizeof(linger));
|
||||||
@ -104,12 +118,31 @@ bool HikVis::checkHikk(const char * sDVRIP, int port) {
|
|||||||
shutdown(sock, SD_BOTH);
|
shutdown(sock, SD_BOTH);
|
||||||
closesocket(sock);
|
closesocket(sock);
|
||||||
|
|
||||||
if (buff[3] == 0x10) return true;
|
if (buff[3] == 0x10) {
|
||||||
else return false;
|
if (gNegDebugMode)
|
||||||
|
{
|
||||||
|
stt->doEmitionDebugFoundData("iVMS check succeeded [<a href=\"" + QString(sDVRIP) + ":" + QString::number(port) +
|
||||||
|
"/\"><font color=\"#0084ff\">" + QString(sDVRIP) + ":" + QString::number(port) + "</font></a>]");
|
||||||
|
}
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
if (gNegDebugMode)
|
||||||
|
{
|
||||||
|
stt->doEmitionDebugFoundData("iVMS check failed [<a href=\"" + QString(sDVRIP) + ":" + QString::number(port) +
|
||||||
|
"/\"><font color=\"#0084ff\">" + QString(sDVRIP) + ":" + QString::number(port) + "</font></a>]");
|
||||||
|
}
|
||||||
|
return false;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
shutdown(sock, SD_BOTH);
|
shutdown(sock, SD_BOTH);
|
||||||
closesocket(sock);
|
closesocket(sock);
|
||||||
|
if (gNegDebugMode)
|
||||||
|
{
|
||||||
|
stt->doEmitionDebugFoundData("Unknown error - iVMS check failed [<a href=\"" + QString(sDVRIP) + ":" + QString::number(port) +
|
||||||
|
"/\"><font color=\"#0084ff\">" + QString(sDVRIP) + ":" + QString::number(port) + "</font></a>]");
|
||||||
|
}
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -126,10 +159,24 @@ bool HikVis::checkRVI(const char * sDVRIP, int port) {
|
|||||||
if (inet_addr(sDVRIP) != INADDR_NONE) sa.sin_addr.s_addr = inet_addr(sDVRIP);
|
if (inet_addr(sDVRIP) != INADDR_NONE) sa.sin_addr.s_addr = inet_addr(sDVRIP);
|
||||||
else if (host = gethostbyname(sDVRIP)) ((unsigned long*)&sa.sin_addr)[0] = ((unsigned long**)host->h_addr_list)[0][0];
|
else if (host = gethostbyname(sDVRIP)) ((unsigned long*)&sa.sin_addr)[0] = ((unsigned long**)host->h_addr_list)[0][0];
|
||||||
#endif
|
#endif
|
||||||
else return false;
|
else {
|
||||||
|
if (gNegDebugMode)
|
||||||
|
{
|
||||||
|
stt->doEmitionDebugFoundData("inet_addr error - RVI check failed [<a href=\"" + QString(sDVRIP) + ":" + QString::number(port) +
|
||||||
|
"/\"><font color=\"#0084ff\">" + QString(sDVRIP) + ":" + QString::number(port) + "</font></a>]");
|
||||||
|
}
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
SOCKET sock = socket(AF_INET, SOCK_STREAM, IPPROTO_TCP);
|
SOCKET sock = socket(AF_INET, SOCK_STREAM, IPPROTO_TCP);
|
||||||
if (sock == INVALID_SOCKET) return false;
|
if (sock == INVALID_SOCKET) {
|
||||||
|
if (gNegDebugMode)
|
||||||
|
{
|
||||||
|
stt->doEmitionDebugFoundData("Socket error - RVI check failed [<a href=\"" + QString(sDVRIP) + ":" + QString::number(port) +
|
||||||
|
"/\"><font color=\"#0084ff\">" + QString(sDVRIP) + ":" + QString::number(port) + "</font></a>]");
|
||||||
|
}
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
struct linger linger = { 1, gTimeOut };
|
struct linger linger = { 1, gTimeOut };
|
||||||
setsockopt(sock, SOL_SOCKET, SO_LINGER, (const char *)&linger, sizeof(linger));
|
setsockopt(sock, SOL_SOCKET, SO_LINGER, (const char *)&linger, sizeof(linger));
|
||||||
@ -150,12 +197,31 @@ bool HikVis::checkRVI(const char * sDVRIP, int port) {
|
|||||||
shutdown(sock, SD_BOTH);
|
shutdown(sock, SD_BOTH);
|
||||||
closesocket(sock);
|
closesocket(sock);
|
||||||
|
|
||||||
if (buff[0] == -80) return true;
|
if (buff[0] == -80) {
|
||||||
else return false;
|
if (gNegDebugMode)
|
||||||
|
{
|
||||||
|
stt->doEmitionDebugFoundData("RVI check succeeded [<a href=\"" + QString(sDVRIP) + ":" + QString::number(port) +
|
||||||
|
"/\"><font color=\"#0084ff\">" + QString(sDVRIP) + ":" + QString::number(port) + "</font></a>]");
|
||||||
|
}
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
if (gNegDebugMode)
|
||||||
|
{
|
||||||
|
stt->doEmitionDebugFoundData("RVI check failed [<a href=\"" + QString(sDVRIP) + ":" + QString::number(port) +
|
||||||
|
"/\"><font color=\"#0084ff\">" + QString(sDVRIP) + ":" + QString::number(port) + "</font></a>]");
|
||||||
|
}
|
||||||
|
return false;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
shutdown(sock, SD_BOTH);
|
shutdown(sock, SD_BOTH);
|
||||||
closesocket(sock);
|
closesocket(sock);
|
||||||
|
if (gNegDebugMode)
|
||||||
|
{
|
||||||
|
stt->doEmitionDebugFoundData("Unknown error - RVI check failed [<a href=\"" + QString(sDVRIP) + ":" + QString::number(port) +
|
||||||
|
"/\"><font color=\"#0084ff\">" + QString(sDVRIP) + ":" + QString::number(port) + "</font></a>]");
|
||||||
|
}
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -172,10 +238,24 @@ bool HikVis::checkSAFARI(const char * sDVRIP, int port) {
|
|||||||
if (inet_addr(sDVRIP) != INADDR_NONE) sa.sin_addr.s_addr = inet_addr(sDVRIP);
|
if (inet_addr(sDVRIP) != INADDR_NONE) sa.sin_addr.s_addr = inet_addr(sDVRIP);
|
||||||
else if (host = gethostbyname(sDVRIP)) ((unsigned long*)&sa.sin_addr)[0] = ((unsigned long**)host->h_addr_list)[0][0];
|
else if (host = gethostbyname(sDVRIP)) ((unsigned long*)&sa.sin_addr)[0] = ((unsigned long**)host->h_addr_list)[0][0];
|
||||||
#endif
|
#endif
|
||||||
else return false;
|
else {
|
||||||
|
if (gNegDebugMode)
|
||||||
|
{
|
||||||
|
stt->doEmitionDebugFoundData("inet_addr error - SAFARI check failed [<a href=\"" + QString(sDVRIP) + ":" + QString::number(port) +
|
||||||
|
"/\"><font color=\"#0084ff\">" + QString(sDVRIP) + ":" + QString::number(port) + "</font></a>]");
|
||||||
|
}
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
SOCKET sock = socket(AF_INET, SOCK_STREAM, IPPROTO_TCP);
|
SOCKET sock = socket(AF_INET, SOCK_STREAM, IPPROTO_TCP);
|
||||||
if (sock == INVALID_SOCKET) return false;
|
if (sock == INVALID_SOCKET) {
|
||||||
|
if (gNegDebugMode)
|
||||||
|
{
|
||||||
|
stt->doEmitionDebugFoundData("Socket error - SAFARI check failed [<a href=\"" + QString(sDVRIP) + ":" + QString::number(port) +
|
||||||
|
"/\"><font color=\"#0084ff\">" + QString(sDVRIP) + ":" + QString::number(port) + "</font></a>]");
|
||||||
|
}
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
struct linger linger = { 1, gTimeOut };
|
struct linger linger = { 1, gTimeOut };
|
||||||
setsockopt(sock, SOL_SOCKET, SO_LINGER, (const char *)&linger, sizeof(linger));
|
setsockopt(sock, SOL_SOCKET, SO_LINGER, (const char *)&linger, sizeof(linger));
|
||||||
@ -197,15 +277,39 @@ bool HikVis::checkSAFARI(const char * sDVRIP, int port) {
|
|||||||
closesocket(sock);
|
closesocket(sock);
|
||||||
|
|
||||||
if (buff[0] != '\0') {
|
if (buff[0] != '\0') {
|
||||||
|
if (gNegDebugMode)
|
||||||
|
{
|
||||||
|
stt->doEmitionDebugFoundData("SAFARI check succeeded [<a href=\"" + QString(sDVRIP) + ":" + QString::number(port) +
|
||||||
|
"/\"><font color=\"#0084ff\">" + QString(sDVRIP) + ":" + QString::number(port) + "</font></a>]");
|
||||||
|
}
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (buff[0] == 8) return true;
|
if (buff[0] == 8) {
|
||||||
else return false;
|
if (gNegDebugMode)
|
||||||
|
{
|
||||||
|
stt->doEmitionDebugFoundData("SAFARI check succeeded [<a href=\"" + QString(sDVRIP) + ":" + QString::number(port) +
|
||||||
|
"/\"><font color=\"#0084ff\">" + QString(sDVRIP) + ":" + QString::number(port) + "</font></a>]");
|
||||||
|
}
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
if (gNegDebugMode)
|
||||||
|
{
|
||||||
|
stt->doEmitionDebugFoundData("SAFARI check failed [<a href=\"" + QString(sDVRIP) + ":" + QString::number(port) +
|
||||||
|
"/\"><font color=\"#0084ff\">" + QString(sDVRIP) + ":" + QString::number(port) + "</font></a>]");
|
||||||
|
}
|
||||||
|
return false;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
shutdown(sock, SD_BOTH);
|
shutdown(sock, SD_BOTH);
|
||||||
closesocket(sock);
|
closesocket(sock);
|
||||||
|
if (gNegDebugMode)
|
||||||
|
{
|
||||||
|
stt->doEmitionDebugFoundData("Unknown error - SAFARI check failed [<a href=\"" + QString(sDVRIP) + ":" + QString::number(port) +
|
||||||
|
"/\"><font color=\"#0084ff\">" + QString(sDVRIP) + ":" + QString::number(port) + "</font></a>]");
|
||||||
|
}
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1381,10 +1381,10 @@ void MainStarter::runAuxiliaryThreads() {
|
|||||||
std::thread lpThread(FileUpdater::updateLists);
|
std::thread lpThread(FileUpdater::updateLists);
|
||||||
lpThread.detach();
|
lpThread.detach();
|
||||||
}
|
}
|
||||||
if (!trackerRunning) {
|
//if (!trackerRunning) {
|
||||||
std::thread trackerThread(_tracker);
|
// std::thread trackerThread(_tracker);
|
||||||
trackerThread.detach();
|
// trackerThread.detach();
|
||||||
}
|
//}
|
||||||
if (!ipPerSecTimer) {
|
if (!ipPerSecTimer) {
|
||||||
std::thread timerThread(_IPPerSecTimer);
|
std::thread timerThread(_IPPerSecTimer);
|
||||||
timerThread.detach();
|
timerThread.detach();
|
||||||
|
45
finder.cpp
45
finder.cpp
@ -233,7 +233,7 @@ bool isNegative(const std::string *buff, const char *ip, int port, const char *c
|
|||||||
FileUpdater::cv.wait(FileUpdater::lk, []{return FileUpdater::ready; });
|
FileUpdater::cv.wait(FileUpdater::lk, []{return FileUpdater::ready; });
|
||||||
if (!globalScanFlag) return true;
|
if (!globalScanFlag) return true;
|
||||||
|
|
||||||
if (Utils::ustrstr(std::string(codedStr.toLocal8Bit().data()), negEntry) != -1){
|
if (Utils::ustrstr(std::string(codedStr.toLocal8Bit().data()), negEntry) != -1) {
|
||||||
if (gNegDebugMode)
|
if (gNegDebugMode)
|
||||||
{
|
{
|
||||||
QTextCodec *nCodec = QTextCodec::codecForName("Windows-1251");
|
QTextCodec *nCodec = QTextCodec::codecForName("Windows-1251");
|
||||||
@ -282,6 +282,11 @@ int globalSearchPrnt(const std::string *buff)
|
|||||||
{
|
{
|
||||||
//if(gNegDebugMode) stt->doEmitionDebugFoundData("Printer detected.");
|
//if(gNegDebugMode) stt->doEmitionDebugFoundData("Printer detected.");
|
||||||
|
|
||||||
|
if (gNegDebugMode)
|
||||||
|
{
|
||||||
|
QTextCodec *nCodec = QTextCodec::codecForName("Windows-1251");
|
||||||
|
stt->doEmitionDebugFoundData("Printer ignored");
|
||||||
|
}
|
||||||
return -1;
|
return -1;
|
||||||
};
|
};
|
||||||
|
|
||||||
@ -294,19 +299,43 @@ int sharedDetector(const char * ip, int port, const std::string *buffcpy, const
|
|||||||
if (HikVis::checkSAFARI(ip, port)) return 6; //Safari CCTV
|
if (HikVis::checkSAFARI(ip, port)) return 6; //Safari CCTV
|
||||||
else if (HikVis::checkHikk(ip, port)) return 4; //Hikkvision iVMS
|
else if (HikVis::checkHikk(ip, port)) return 4; //Hikkvision iVMS
|
||||||
else if (HikVis::checkRVI(ip, port)) return 5; //RVI
|
else if (HikVis::checkRVI(ip, port)) return 5; //RVI
|
||||||
else return -1;
|
else
|
||||||
|
{
|
||||||
|
if (gNegDebugMode)
|
||||||
|
{
|
||||||
|
stt->doEmitionDebugFoundData("Safari CCTV check failed - ignoring [<a href=\"" + QString(ip) + ":" + QString::number(port) +
|
||||||
|
"/\"><font color=\"#0084ff\">" + QString(ip) + ":" + QString::number(port) + "</font></a>]");
|
||||||
|
}
|
||||||
|
return -1;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
else if(port == 8000) {
|
else if(port == 8000) {
|
||||||
if (HikVis::checkHikk(ip, port)) return 4; //Hikkvision iVMS
|
if (HikVis::checkHikk(ip, port)) return 4; //Hikkvision iVMS
|
||||||
else if (HikVis::checkRVI(ip, port)) return 5; //RVI
|
else if (HikVis::checkRVI(ip, port)) return 5; //RVI
|
||||||
//else if (HikVis::checkSAFARI(ip, port)) return 6; //Safari CCTV
|
//else if (HikVis::checkSAFARI(ip, port)) return 6; //Safari CCTV
|
||||||
else return -1;
|
else
|
||||||
|
{
|
||||||
|
if (gNegDebugMode)
|
||||||
|
{
|
||||||
|
stt->doEmitionDebugFoundData("Hikkvision iVMS check failed - ignoring [<a href=\"" + QString(ip) + ":" + QString::number(port) +
|
||||||
|
"/\"><font color=\"#0084ff\">" + QString(ip) + ":" + QString::number(port) + "</font></a>]");
|
||||||
|
}
|
||||||
|
return -1;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
else if (port == 37777) {
|
else if (port == 37777) {
|
||||||
if (HikVis::checkRVI(ip, port)) return 5; //RVI
|
if (HikVis::checkRVI(ip, port)) return 5; //RVI
|
||||||
else if(HikVis::checkHikk(ip, port)) return 4; //Hikkvision iVMS
|
else if(HikVis::checkHikk(ip, port)) return 4; //Hikkvision iVMS
|
||||||
else if (HikVis::checkSAFARI(ip, port)) return 6; //Safari CCTV
|
else if (HikVis::checkSAFARI(ip, port)) return 6; //Safari CCTV
|
||||||
else return -1;
|
else
|
||||||
|
{
|
||||||
|
if (gNegDebugMode)
|
||||||
|
{
|
||||||
|
stt->doEmitionDebugFoundData("RVI check failed - ignoring [<a href=\"" + QString(ip) + ":" + QString::number(port) +
|
||||||
|
"/\"><font color=\"#0084ff\">" + QString(ip) + ":" + QString::number(port) + "</font></a>]");
|
||||||
|
}
|
||||||
|
return -1;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -2831,8 +2860,8 @@ void parseFlag(int flag, char* ip, int port, int size, const std::string &header
|
|||||||
lopaStr lps = hv.HVLobby(ip, port);
|
lopaStr lps = hv.HVLobby(ip, port);
|
||||||
if (strstr(lps.login, "UNKNOWN") == NULL && strlen(lps.other) == 0)
|
if (strstr(lps.login, "UNKNOWN") == NULL && strlen(lps.other) == 0)
|
||||||
{
|
{
|
||||||
_specFillerBA(ip, port, "[Hikvision IVMS].", lps.login, lps.pass, 0);
|
_specFillerBA(ip, port, "[Hikvision IVMS]", lps.login, lps.pass, 0);
|
||||||
fillGlobalLogData(ip, port, std::to_string(size).c_str(), "[Hikvision IVMS] ().",
|
fillGlobalLogData(ip, port, std::to_string(size).c_str(), "[Hikvision IVMS] ()",
|
||||||
lps.login, lps.pass, "[Hikvision IVMS]", "UTF-8", "Basic Authorization");
|
lps.login, lps.pass, "[Hikvision IVMS]", "UTF-8", "Basic Authorization");
|
||||||
|
|
||||||
while (hikkaStop) Sleep(10);
|
while (hikkaStop) Sleep(10);
|
||||||
@ -2865,8 +2894,8 @@ void parseFlag(int flag, char* ip, int port, int size, const std::string &header
|
|||||||
lopaStr lps = hv.RVILobby(ip, port);
|
lopaStr lps = hv.RVILobby(ip, port);
|
||||||
if (strstr(lps.login, "UNKNOWN") == NULL && strlen(lps.other) == 0)
|
if (strstr(lps.login, "UNKNOWN") == NULL && strlen(lps.other) == 0)
|
||||||
{
|
{
|
||||||
_specFillerBA(ip, port, "[RVI].", lps.login, lps.pass, 0);
|
_specFillerBA(ip, port, "[RVI]", lps.login, lps.pass, 0);
|
||||||
fillGlobalLogData(ip, port, std::to_string(size).c_str(), "[RVI] ().",
|
fillGlobalLogData(ip, port, std::to_string(size).c_str(), "[RVI] ()",
|
||||||
lps.login, lps.pass, "[RVI]", "UTF-8", "Basic Authorization");
|
lps.login, lps.pass, "[RVI]", "UTF-8", "Basic Authorization");
|
||||||
|
|
||||||
while (rviStop) Sleep(10);
|
while (rviStop) Sleep(10);
|
||||||
|
Loading…
Reference in New Issue
Block a user