mirror of
https://github.com/ChronosX88/nesca.git
synced 2024-11-23 18:52:19 +00:00
qwe
This commit is contained in:
parent
38567a9177
commit
aeeb2d6e4b
@ -130,11 +130,12 @@ size_t nWriteCallback(void *contents, size_t size, size_t nmemb, void *userp)
|
|||||||
//return realsize;
|
//return realsize;
|
||||||
}
|
}
|
||||||
|
|
||||||
int Connector::nConnect(const char* ip, const int port, std::string *buffer,
|
int pConnect(const char* ip, const int port, std::string *buffer,
|
||||||
const char *postData,
|
const char *postData,
|
||||||
const std::vector<std::string> *customHeaders,
|
const std::vector<std::string> *customHeaders,
|
||||||
const std::string *lpString,
|
const std::string *lpString,
|
||||||
bool digestMode){
|
bool digestMode)
|
||||||
|
{
|
||||||
buffer->clear();
|
buffer->clear();
|
||||||
int res = 0;
|
int res = 0;
|
||||||
CURL *curl = curl_easy_init();
|
CURL *curl = curl_easy_init();
|
||||||
@ -233,12 +234,13 @@ int Connector::nConnect(const char* ip, const int port, std::string *buffer,
|
|||||||
res != 56 &&
|
res != 56 &&
|
||||||
res != 35 &&
|
res != 35 &&
|
||||||
res != 19 &&
|
res != 19 &&
|
||||||
res != 23)
|
res != 23)
|
||||||
{
|
{
|
||||||
if (res == 5) {
|
if (res == 5) {
|
||||||
stt->doEmitionRedFoundData("The given proxy host could not be resolved.");
|
stt->doEmitionRedFoundData("The given proxy host could not be resolved.");
|
||||||
return -2;
|
return -2;
|
||||||
} else if (res == 8) {
|
}
|
||||||
|
else if (res == 8) {
|
||||||
stt->doEmitionFoundData("Strange ftp reply. (" +
|
stt->doEmitionFoundData("Strange ftp reply. (" +
|
||||||
QString::number(res) + ") " + QString(ip) +
|
QString::number(res) + ") " + QString(ip) +
|
||||||
":" + QString::number(port));
|
":" + QString::number(port));
|
||||||
@ -264,12 +266,42 @@ int Connector::nConnect(const char* ip, const int port, std::string *buffer,
|
|||||||
if (MapWidgetOpened) stt->doEmitionAddIncData(QString(ip), QString(buffer->c_str()));
|
if (MapWidgetOpened) stt->doEmitionAddIncData(QString(ip), QString(buffer->c_str()));
|
||||||
|
|
||||||
return sz;
|
return sz;
|
||||||
} else {
|
}
|
||||||
stt->doEmitionRedFoundData("Curl error.");
|
else {
|
||||||
return -1;
|
stt->doEmitionRedFoundData("Curl error.");
|
||||||
|
return -1;
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void eraser(std::string *buffer, const std::string delim1, const std::string delim2) {
|
||||||
|
int pos = -1;
|
||||||
|
while ((pos = buffer->find(delim1)) != -1) {
|
||||||
|
int ePos = buffer->find(delim2, pos);
|
||||||
|
if (ePos != -1) {
|
||||||
|
buffer->erase(pos, ePos - pos - 1 + delim2.length());
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
buffer->erase(pos, buffer->length() - pos - 1);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
void cutoutComments(std::string *buffer) {
|
||||||
|
eraser(buffer, "<!--", "-->");
|
||||||
|
eraser(buffer, "/*", "*/");
|
||||||
|
eraser(buffer, "//", "\n");
|
||||||
|
}
|
||||||
|
|
||||||
|
int Connector::nConnect(const char* ip, const int port, std::string *buffer,
|
||||||
|
const char *postData,
|
||||||
|
const std::vector<std::string> *customHeaders,
|
||||||
|
const std::string *lpString,
|
||||||
|
bool digestMode){
|
||||||
|
int res = pConnect(ip, port, buffer, postData, customHeaders, lpString, digestMode);
|
||||||
|
cutoutComments(buffer);
|
||||||
|
|
||||||
|
return buffer->size();
|
||||||
|
}
|
||||||
|
|
||||||
bool portCheck(const char * sDVRIP, int wDVRPort) {
|
bool portCheck(const char * sDVRIP, int wDVRPort) {
|
||||||
// sockaddr_in sa;
|
// sockaddr_in sa;
|
||||||
// sa.sin_family = AF_INET;
|
// sa.sin_family = AF_INET;
|
||||||
|
@ -3208,7 +3208,7 @@ int handleFramesets(std::string *buffcpy, char* ip, int port, int flag) {
|
|||||||
|
|
||||||
Connector con;
|
Connector con;
|
||||||
int framePos = pos + 9;
|
int framePos = pos + 9;
|
||||||
|
int counter = 0;
|
||||||
while (framePos != -1) {
|
while (framePos != -1) {
|
||||||
framePos = buffcpy->find("<frame ", framePos + 1);
|
framePos = buffcpy->find("<frame ", framePos + 1);
|
||||||
if (-1 == framePos) {
|
if (-1 == framePos) {
|
||||||
@ -3233,6 +3233,9 @@ int handleFramesets(std::string *buffcpy, char* ip, int port, int flag) {
|
|||||||
int quotePos2 = frameString.find_first_of("\"'", quotePos1 + 1);
|
int quotePos2 = frameString.find_first_of("\"'", quotePos1 + 1);
|
||||||
|
|
||||||
if (quotePos1 != quotePos2) {
|
if (quotePos1 != quotePos2) {
|
||||||
|
if (counter++ > 5) {
|
||||||
|
return 0;
|
||||||
|
};
|
||||||
std::string location = frameString.substr(quotePos1 + 1, quotePos2 - quotePos1 - 1);
|
std::string location = frameString.substr(quotePos1 + 1, quotePos2 - quotePos1 - 1);
|
||||||
std::string tIP = std::string(ip) + (location[0] == '/' ? "" : "/") + location;
|
std::string tIP = std::string(ip) + (location[0] == '/' ? "" : "/") + location;
|
||||||
std::string buff;
|
std::string buff;
|
||||||
|
Loading…
Reference in New Issue
Block a user