This commit is contained in:
cora32 2015-12-12 02:46:27 +03:00
parent 4cf3b15f36
commit b39014f783
2 changed files with 78 additions and 42 deletions

View File

@ -213,8 +213,8 @@ int Connector::nConnect(const char* ip, const int port, std::string *buffer,
) {
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>]");
stt->doEmitionDebugFoundData("NConnect failed (curl_code: " + QString::number(res) + ") [<a href=\"" + QString(ip) +
"/\"><font color=\"#0084ff\">" + QString(ip) + " Port:" + QString::number(port) + "</font></a>]");
}
SOCKET eNobuffSocket = socket(AF_INET, SOCK_STREAM, IPPROTO_TCP);
shutdown(eNobuffSocket, SD_BOTH);

View File

@ -110,14 +110,25 @@ bool HikVis::checkHikk(const char * sDVRIP, int port) {
char tBuff[32] = { 0 };
int offset = 0;
int sz = 0;
int bsz = 0;
while ((sz = recvWT(sock, tBuff, 16, gTimeOut, &bTO)) > 0) {
memcpy(buff + offset, tBuff, sz);
offset = sz;
bsz += sz;
}
shutdown(sock, SD_BOTH);
closesocket(sock);
if (bsz == 0) {
if (gNegDebugMode)
{
stt->doEmitionDebugFoundData("iVMS check failed - size = 0, code = (" + QString::number(sz) + ") [<a href=\"" + QString(sDVRIP) + ":" + QString::number(port) +
"/\"><font color=\"#0084ff\">" + QString(sDVRIP) + ":" + QString::number(port) + "</font></a>]");
}
return false;
}
else {
if (buff[3] == 0x10) {
if (gNegDebugMode)
{
@ -135,6 +146,7 @@ bool HikVis::checkHikk(const char * sDVRIP, int port) {
return false;
}
}
}
shutdown(sock, SD_BOTH);
closesocket(sock);
@ -189,14 +201,24 @@ bool HikVis::checkRVI(const char * sDVRIP, int port) {
char tBuff[32] = { 0 };
int offset = 0;
int sz = 0;
int bsz = 0;
while ((sz = recvWT(sock, tBuff, 16, gTimeOut, &bTO)) > 0) {
memcpy(buff + offset, tBuff, sz);
offset = sz;
bsz += sz;
}
shutdown(sock, SD_BOTH);
closesocket(sock);
if (bsz == 0) {
if (gNegDebugMode)
{
stt->doEmitionDebugFoundData("RVI check failed - size = 0, code = (" + QString::number(sz) + ") [<a href=\"" + QString(sDVRIP) + ":" + QString::number(port) +
"/\"><font color=\"#0084ff\">" + QString(sDVRIP) + ":" + QString::number(port) + "</font></a>]");
}
return false;
}
else {
if (buff[0] == -80) {
if (gNegDebugMode)
{
@ -210,10 +232,12 @@ bool HikVis::checkRVI(const char * sDVRIP, int port) {
{
stt->doEmitionDebugFoundData("RVI check failed [<a href=\"" + QString(sDVRIP) + ":" + QString::number(port) +
"/\"><font color=\"#0084ff\">" + QString(sDVRIP) + ":" + QString::number(port) + "</font></a>]");
stt->doEmitionDebugFoundData("Buffer: " + QString(buff).toLocal8Bit().toHex());
}
return false;
}
}
}
shutdown(sock, SD_BOTH);
closesocket(sock);
@ -268,14 +292,25 @@ bool HikVis::checkSAFARI(const char * sDVRIP, int port) {
char tBuff[128] = { 0 };
int offset = 0;
int sz = 0;
int bsz = 0;
while ((sz = recvWT(sock, tBuff, 128, gTimeOut, &bTO)) > 0) {
memcpy(buff + offset, tBuff, sz);
offset = sz;
bsz += sz;
}
shutdown(sock, SD_BOTH);
closesocket(sock);
if (bsz == 0) {
if (gNegDebugMode)
{
stt->doEmitionDebugFoundData("SAFARI check failed - size = 0, code = (" + QString::number(sz) + ") [<a href=\"" + QString(sDVRIP) + ":" + QString::number(port) +
"/\"><font color=\"#0084ff\">" + QString(sDVRIP) + ":" + QString::number(port) + "</font></a>]");
}
return false;
}
else {
if (buff[0] != '\0') {
if (gNegDebugMode)
{
@ -302,6 +337,7 @@ bool HikVis::checkSAFARI(const char * sDVRIP, int port) {
return false;
}
}
}
shutdown(sock, SD_BOTH);
closesocket(sock);