From 10e605d5ae477993eff17ae65ffe36143abf9e1c Mon Sep 17 00:00:00 2001 From: cora32 Date: Fri, 17 Apr 2015 02:24:41 +0300 Subject: [PATCH] File accessibility bug fixed. --- MainStarter.h | 2 +- finder.cpp | 84 +++++++++++++++------------------------------------ negatives.txt | 2 ++ nesca_3.cpp | 2 +- version | 2 +- 5 files changed, 29 insertions(+), 63 deletions(-) diff --git a/MainStarter.h b/MainStarter.h index 655a8d5..fabba06 100644 --- a/MainStarter.h +++ b/MainStarter.h @@ -51,7 +51,7 @@ public: curl_global_init(CURL_GLOBAL_ALL); #if defined(WIN32) || defined(_WIN32) || defined(__WIN32) && !defined(__CYGWIN__) - CreateDirectoryA(RESULT_DIR_NAME, NULL); + bool res = CreateDirectoryA(RESULT_DIR_NAME, NULL); #else struct stat str = { 0 }; if (stat(RESULT_DIR_NAME, &str) == -1) { diff --git a/finder.cpp b/finder.cpp index 50c8f39..4bf03eb 100644 --- a/finder.cpp +++ b/finder.cpp @@ -516,7 +516,7 @@ void fputsf(char *text, int flag, char *msg) else if(flag == 7) { if(ftsLL) ftsLL = __checkFileExistence(flag); - file = fopen(RESULT_DIR_NAME"/low_loads.html", "a"); + file = fopen(RESULT_DIR_NAME"/low_loads.html", "a"); } else if(flag == 10) { @@ -535,10 +535,7 @@ void fputsf(char *text, int flag, char *msg) if(ftsBA) ftsBA = __checkFileExistence(flag); file = fopen(RESULT_DIR_NAME"/Basicauth.html", "a"); } - else - { - stt->doEmitionRedFoundData("[WUT!?] Unknown flag [FLAG: " + QString::number(flag) + "]"); - }; + else stt->doEmitionRedFoundData("[WUT!?] Unknown flag [FLAG: " + QString::number(flag) + "]"); if(file != NULL) { @@ -558,8 +555,10 @@ void fputsf(char *text, int flag, char *msg) strcat(delimiter, "
"); fputs (delimiter, file); }; + ++saved; char *string = new char[strlen(text) + 512]; + if(flag != -22) { strcpy (string, "
"); @@ -680,7 +679,7 @@ void fputsf(char *text, int flag, char *msg) } else { - stt->doEmitionRedFoundData("Cannot open file [FLAG: " + QString::number(flag) + "]"); + stt->doEmitionRedFoundData("Cannot open file [FLAG: " + QString::number(flag) + "] " + QString::number(GetLastError())); }; } @@ -2158,7 +2157,7 @@ void _getLinkFromJSLocation(char *dataBuff, char *str, char *tag, char *ip, int }; } -int Lexems::_header(char *ip, int port, const char str[], Lexems *l, PathStr *ps, std::vector *redirStrLst, int size) +int Lexems::_header(char *ip, int port, const char *str, Lexems *l, PathStr *ps, std::vector *redirStrLst, int size) { std::string redirectStr = ""; @@ -2187,12 +2186,8 @@ int Lexems::_header(char *ip, int port, const char str[], Lexems *l, PathStr *ps && strstr(str, "company") == NULL ) { - if (strstr(str, "CgiStart?page=Single") != NULL) { - strcpy(ps->headr, "[IP Camera (Unibrowser)]"); - } - else { - strcpy(ps->headr, "[IP Camera]"); - } + if (strstr(str, "CgiStart?page=Single") != NULL) strcpy(ps->headr, "[IP Camera (Unibrowser)]"); + else strcpy(ps->headr, "[IP Camera]"); l->flag = 0; ps->flag = 0; }; @@ -2251,6 +2246,7 @@ int Lexems::_header(char *ip, int port, const char str[], Lexems *l, PathStr *ps strncpy(temp3, (char*)(temp + 4), sz < 128 ? sz : 127); }; }; + if(strstri(temp3, "http://") == NULL && strstri(temp3, "https://") == NULL) { if(temp3[0] != '.') @@ -2369,8 +2365,7 @@ int Lexems::_header(char *ip, int port, const char str[], Lexems *l, PathStr *ps if(ps->flag >= 17 || ps->flag == 11 || ps->flag == 12 || ps->flag == 13 || ps->flag == 14 || ps->flag == 1 || ps->flag == 10 - ) - return -2; + ) return -2; else if(ps->flag == -1) return -1; }; }; @@ -2379,25 +2374,13 @@ int Lexems::_header(char *ip, int port, const char str[], Lexems *l, PathStr *ps if(strstri(str, "ActiveXObject") != NULL || strstri(str, ".cab") != NULL || strstri(str, "clsid:") != NULL - ) - { - strcat(ps->headr, "[ActiveX]"); - }; + ) strcat(ps->headr, "[ActiveX]"); if(strstri(str, "headr, "[Java]"); - }; - if(strstri(str, "headr, "[Javascript]"); - }; - if(strstri(str, "headr, "[Video]"); - }; + ) strcat(ps->headr, "[Java]"); + if(strstri(str, "headr, "[Javascript]"); + if(strstri(str, "headr, "[Video]"); if(strstri(str, "flag; if(flag == 1 || flag == 11 || flag == 12 - || flag == 13 || flag == 14 || flag >= 17 || flag == 10) - { - return -2; - } + || flag == 13 || flag == 14 || flag >= 17 || flag == 10) return -2; else if(ps->flag == -1) return -1; } else { - stt->doEmitionRedFoundData("[FrameLocator] Corrupted tag. [" + QString(ip) +":" + QString::number(port) + "]"); + stt->doEmitionRedFoundData("[FrameLocator] Corrupted tag. [" + QString(ip) + ":" + + QString::number(port) + "]"); }; }; } while(str1 != NULL); return -2; }; - if (strstri(str, "
headr, "[Form]"); - } + + if (strstri(str, "headr, "[Form]"); //if(strstri(str, "headr, " [Login form detected]"); @@ -2565,14 +2544,8 @@ int Lexems::_header(char *ip, int port, const char str[], Lexems *l, PathStr *ps if(strlen(ps->headr) == 0) { strcat(ps->headr, "[Empty title]"); - if(strstri(str, "headr, "[No html]"); - }; - if(strstri(str, "headr, "[No body]"); - }; + if(strstri(str, "headr, "[No html]"); + if(strstri(str, "headr, "[No body]"); const char *ptr1 = strstr(str, "\r\n\r\n"); if( ptr1 != NULL) @@ -2582,16 +2555,10 @@ int Lexems::_header(char *ip, int port, const char str[], Lexems *l, PathStr *ps strcat(ps->headr, " [Data: "); char *ptr2 = strstri(ptr1 + 4, "headr, ptr2 + 5, 64); - } + if (ptr2 != NULL) strncat(ps->headr, ptr2 + 5, 64); else { ptr2 = strstri(ptr1 + 4, "headr, strstri(ptr1, "headr, strstri(ptr1, "headr, ptr1 + 4, 64); }; @@ -2621,10 +2588,7 @@ int Lexems::_header(char *ip, int port, const char str[], Lexems *l, PathStr *ps ps->flag = ContentFilter(str, port, ip, ps->codepage, size); - if(strstri(str, "window.open(") != NULL) - { - _getPopupTitle(ps, strstri(str, "window.open(")); - }; + if(strstri(str, "window.open(") != NULL) _getPopupTitle(ps, strstri(str, "window.open(")); strcpy(ps->path, "/"); return 0; diff --git a/negatives.txt b/negatives.txt index ed84282..cf806dd 100644 --- a/negatives.txt +++ b/negatives.txt @@ -1,7 +1,9 @@ +WebDAV Company Limited аренда серв й¦–йЎµ 51yes.com +nasne&trade google-site-verification бесплатный хост антивирус diff --git a/nesca_3.cpp b/nesca_3.cpp index 3813380..1bdd8d4 100644 --- a/nesca_3.cpp +++ b/nesca_3.cpp @@ -2914,7 +2914,7 @@ void nesca_3::appendDefaultText(QString str) void nesca_3::appendErrText(QString str) { - ui->dataText->append("[" + QTime::currentTime().toString() + "]" + QString::fromUtf8(str.toLocal8Bit().data()) + ""); + ui->dataText->append("[" + QTime::currentTime().toString() + "]" + QString::fromUtf8(str.toLocal8Bit().data()) + ""); if(stt->isRunning() == false) { diff --git a/version b/version index 04fade8..ed495f1 100644 --- a/version +++ b/version @@ -1 +1 @@ -24B90-5A6 \ No newline at end of file +24B91-DB \ No newline at end of file