Fixed ignoing of first string in negative list.

This commit is contained in:
cora48 2015-03-27 13:38:38 +03:00
parent 40d69a654a
commit a17df57d90
6 changed files with 51 additions and 36 deletions

1
.gitignore vendored
View File

@ -40,3 +40,4 @@ result_files-*
nesca
moc_*
*~
*.user

View File

@ -1,4 +1,5 @@
#include "FTPAuth.h"
#include "FileUpdater.h"
bool FTPA::checkOutput(const string *buffer) {
if(Utils::ci_find_substr(*buffer, "230") != -1) {
@ -27,6 +28,7 @@ lopaStr FTPA::FTPBrute(const char *ip, const int port, PathStr *ps) {
for(int i = 0; i < MaxLogin; ++i)
{
if(!globalScanFlag) return lps;
FileUpdater::cv.wait(FileUpdater::lk, []{return FileUpdater::ready;});
if(strlen(loginLst[i]) <= 1) continue;
strcpy(login, loginLst[i]);
@ -34,6 +36,7 @@ lopaStr FTPA::FTPBrute(const char *ip, const int port, PathStr *ps) {
for(int j = 0; j < MaxPass; ++j)
{
if(!globalScanFlag) return lps;
FileUpdater::cv.wait(FileUpdater::lk, []{return FileUpdater::ready;});
if(strlen(passLst[j]) <= 1) continue;
strcpy(pass, passLst[j]);

View File

@ -27,7 +27,7 @@ void ReadUTF8(FILE* nFile, char *cp) {
&& (buffFG[0] == '\t' && buffFG[1] == '\t' && buffFG[2] == '\t' && (buffFG[3] == '/' && buffFG[4] == '/')) == false)
{
++GlobalNegativeSize;
};
}
ZeroMemory(buffFG, sizeof(buffFG));
};
@ -139,6 +139,7 @@ void negativeLoader() {
}
else
{
rewind(nFile);
ReadUTF8(nFile, "1251");
};
}

View File

@ -1,4 +1,5 @@
#include "SSHAuth.h"
#include "FileUpdater.h"
int _sshConnect(char *user, char *pass, const char *host, int port)
{
@ -17,8 +18,9 @@ int _sshConnect(char *user, char *pass, const char *host, int port)
ssh_options_set(my_ssh_session, SSH_OPTIONS_HOST, hostStr);
ssh_options_set(my_ssh_session, SSH_OPTIONS_PORT, &port);
int sshTimeout = gTimeOut + 1;
ssh_options_set(my_ssh_session, SSH_OPTIONS_TIMEOUT, &sshTimeout);
ssh_options_set(my_ssh_session, SSH_OPTIONS_STRICTHOSTKEYCHECK, 0);
ssh_options_set(my_ssh_session, SSH_OPTIONS_GSSAPI_DELEGATE_CREDENTIALS, 0);
ssh_options_set(my_ssh_session, SSH_OPTIONS_TIMEOUT, &(gTimeOut + 1));
int rc = ssh_connect(my_ssh_session);
@ -91,17 +93,22 @@ int SSHBrute(const char* host, int port, std::string *buffer, const char *banner
for(int i = 0; i < MaxSSHPass; ++i)
{
FileUpdater::cv.wait(FileUpdater::lk, []{return FileUpdater::ready;});
if(!globalScanFlag) break;
strcpy(temp, sshlpLst[i]);
ptr1 = strstr(temp, ":");
if (ptr1 == NULL) {
stt->doEmitionRedFoundData("[SSH]Wrong format: " + QString(temp));
return -1;
}
sz = ptr1 - temp;
strncpy(login, temp, sz);
strcpy(pass, ptr1 + 1);
res = check_ssh_pass(login, pass, temp, host, port, buffer, banner);
ZeroMemory(login, sizeof(login));
ZeroMemory(pass, sizeof(pass));
ZeroMemory(temp, sizeof(temp));

View File

@ -8,6 +8,7 @@
#include "FTPAuth.h"
#include "SSHAuth.h"
#include <memory>
#include "FileUpdater.h"
char* strstri(const char *_Str, const char *_SubStr)
{
@ -190,6 +191,8 @@ int globalSearchNeg(const char *buffcpy, const char *ip, int port)
char negWord[256] = {0};
for(int i = 0; i < GlobalNegativeSize; ++i)
{
FileUpdater::cv.wait(FileUpdater::lk, []{return FileUpdater::ready;});
if(!globalScanFlag) return -1;
strcpy(negWord, GlobalNegatives[i]);

View File

@ -60,6 +60,38 @@ volatile int cons = 0;
volatile int BrutingThrds = 0;
volatile int threads = 20;
unsigned char tl(unsigned char d)
{
if(d >= 192 && d <= 223)
{
return (unsigned char)(d + 32);
}
else
{
return tolower(d);
};
}
std::string toLowerStr(const char *str)
{
if(str != NULL) {
int tsz = strlen(str);
char *strr = new char[tsz+1];
ZeroMemory(strr, tsz);
for (int i = 0; i < tsz; i++)
{
strr[i] = tl(str[i]);
};
memset(strr + tsz, '\0', 1);
std::string tstr = std::string(strr);
delete []strr;
return tstr;
} else return "";
}
void SaveErrorLog(char *sender, char *MesSent, char *ReplRecv)
{
FILE *errFile = fopen("./logs/ns-track_errors.html", "r");
@ -725,38 +757,6 @@ unsigned long int numOfIps(int ipsstart[], int ipsend[]) {
return gTargets;
}
unsigned char tl(unsigned char d)
{
if(d >= 192 && d <= 223)
{
return (unsigned char)(d + 32);
}
else
{
return tolower(d);
};
}
std::string toLowerStr(const char *str)
{
if(str != NULL) {
int tsz = strlen(str);
char *strr = new char[tsz+1];
ZeroMemory(strr, tsz);
for (int i = 0; i < tsz; i++)
{
strr[i] = tl(str[i]);
};
memset(strr + tsz, '\0', 1);
std::string tstr = std::string(strr);
delete []strr;
return tstr;
} else return "";
}
void _connect() {
std::string ip = "";
while (globalScanFlag) {