Single ip scan fix.

This commit is contained in:
cora32 2015-02-22 15:31:51 +03:00
parent a6cec0388f
commit 5196347746
10 changed files with 316 additions and 129 deletions

View File

@ -67,7 +67,7 @@ int KeyCheckerMain()
HOSTENT *host;
#if defined(WIN32)
#if defined(WIN32) || defined(_WIN32) || defined(__WIN32) && !defined(__CYGWIN__)
if(inet_addr(trcSrv) != INADDR_NONE) sockAddr.sin_addr.S_un.S_addr = inet_addr(trcSrv);
else if(host=gethostbyname (trcSrv)) ((unsigned long*) &sockAddr.sin_addr)[0] = ((unsigned long**)host->h_addr_list)[0][0];
#else
@ -184,7 +184,7 @@ int KeyCheckerMain()
strcat(msg, "\r\nConnection: close");
strcat(msg, "\r\n\r\n");
#if defined(WIN32)
#if defined(WIN32) || defined(_WIN32) || defined(__WIN32) && !defined(__CYGWIN__)
if(inet_addr(ndbServer) != INADDR_NONE) sockAddr.sin_addr.S_un.S_addr = inet_addr(ndbServer);
else if(host=gethostbyname (ndbServer)) ((unsigned long*) &sockAddr.sin_addr)[0] = ((unsigned long**)host->h_addr_list)[0][0];
#else

View File

@ -38,7 +38,7 @@ void CheckProxyLogic()
HOSTENT *host;
#if defined(WIN32)
#if defined(WIN32) || defined(_WIN32) || defined(__WIN32) && !defined(__CYGWIN__)
if(inet_addr(ircProxy) != INADDR_NONE) addr.sin_addr.S_un.S_addr = inet_addr(ircProxy);
else if(host = gethostbyname (ircProxy)) ((unsigned long*) &addr.sin_addr)[0] = ((unsigned long**)host->h_addr_list)[0][0];
#else

View File

@ -142,12 +142,10 @@ int OpenConnection(SOCKET *sock, const char *hostname, int port)
struct sockaddr_in addr;
if(strlen(hostname) == 0)
{
stt->doEmitionDebugFoundData("[<a href=\"http://" + QString(hostname) + ":" + QString::number(port) + "/\"><font color=\"#0084ff\">" + QString(hostname) + ":" + QString::number(port) + "</font></a>" + "] Rejecting in _connection: Bad IP.");
return -1;
};
if(port < 0 || port > 65535)
{
stt->doEmitionDebugFoundData("[<a href=\"http://" + QString(hostname) + ":" + QString::number(port) + "/\"><font color=\"#0084ff\">" + QString(hostname) + ":" + QString::number(port) + "</font></a>" + "] Rejecting in _connection: Bad port.");
return -1;
};
@ -410,7 +408,7 @@ lopaStr _BABrute(char *cookie, char *ip, int port, char *pathT, char *method)
sockAddr.sin_family = AF_INET;
sockAddr.sin_port = htons(port);
HOSTENT *host;
#if defined(WIN32)
#if defined(WIN32) || defined(_WIN32) || defined(__WIN32) && !defined(__CYGWIN__)
if(inet_addr(ip) != INADDR_NONE) sockAddr.sin_addr.S_un.S_addr = inet_addr(ip);
else if(host=gethostbyname (ip)) ((unsigned long*) &sockAddr.sin_addr)[0] = ((unsigned long**)host->h_addr_list)[0][0];
else
@ -865,7 +863,7 @@ lopaStr _FTPBrute(char *ip, int port, PathStr *ps)
sockAddr.sin_port = htons(port);
HOSTENT *host;
#if defined(WIN32)
#if defined(WIN32) || defined(_WIN32) || defined(__WIN32) && !defined(__CYGWIN__)
if(inet_addr(ip) != INADDR_NONE) sockAddr.sin_addr.S_un.S_addr = inet_addr(ip);
else if(host=gethostbyname (ip)) ((unsigned long*) &sockAddr.sin_addr)[0] = ((unsigned long**)host->h_addr_list)[0][0];
else
@ -1441,12 +1439,10 @@ int Connector::_EstablishConnection(char *ip, int port, char *request, conSTR *C
CSTR->lowerBuff = NULL;
if(strlen(ip) == 0)
{
stt->doEmitionDebugFoundData("[<a href=\"http://" + QString(ip) + ":" + QString::number(port) + "/\"><font color=\"#0084ff\">" + QString(ip) + ":" + QString::number(port) + "</font></a>" + "] Rejecting in _connection: Bad IP.");
return -1;
};
if(port < 0 || port > 65535)
{
stt->doEmitionDebugFoundData("[<a href=\"http://" + QString(ip) + ":" + QString::number(port) + "/\"><font color=\"#0084ff\">" + QString(ip) + ":" + QString::number(port) + "</font></a>" + "] Rejecting in _connection: Bad port.");
return -1;
};
@ -1456,7 +1452,7 @@ int Connector::_EstablishConnection(char *ip, int port, char *request, conSTR *C
sockAddr.sin_port = htons(port);
HOSTENT *host;
#if defined(WIN32)
#if defined(WIN32) || defined(_WIN32) || defined(__WIN32) && !defined(__CYGWIN__)
if(inet_addr(ip) != INADDR_NONE) sockAddr.sin_addr.S_un.S_addr = inet_addr(ip);
#else
if(inet_addr(ip) != INADDR_NONE) sockAddr.sin_addr.s_addr = inet_addr(ip);
@ -1479,7 +1475,7 @@ int Connector::_EstablishConnection(char *ip, int port, char *request, conSTR *C
sock = socket( AF_INET, SOCK_STREAM, IPPROTO_TCP );
};
#if defined(WIN32)
#if defined(WIN32) || defined(_WIN32) || defined(__WIN32) && !defined(__CYGWIN__)
u_long FAR cmd = 1;
if( ioctlsocket( sock , FIONBIO, &cmd ) != 0 )
#else
@ -2120,7 +2116,7 @@ int _webLoginSeq(char *request, char *login, char *pass, char *ip, int port, int
sockAddr.sin_family = AF_INET;
sockAddr.sin_port = htons(port);
HOSTENT *host;
#if defined(WIN32)
#if defined(WIN32) || defined(_WIN32) || defined(__WIN32) && !defined(__CYGWIN__)
if(inet_addr(ip) != INADDR_NONE) sockAddr.sin_addr.S_un.S_addr = inet_addr(ip);
else if(host=gethostbyname (ip)) ((unsigned long*) &sockAddr.sin_addr)[0] = ((unsigned long**)host->h_addr_list)[0][0];
else

View File

@ -13,7 +13,7 @@ extern volatile int BA, cons, BrutingThrds, gThreads;
extern char **loginLst, **passLst, **wfLoginLst, **wfPassLst, **sshlpLst, **GlobalNegatives;
extern bool trackerOK, __savingBackUpFile, globalScanFlag, MapWidgetOpened,
widgetIsHidden, OnlineMsgSentFlag, utfIRCFlag, HTMLDebugMode, gNegDebugMode,
gDebugMode, horLineFlag, gPingNScan;
gDebugMode, horLineFlag, gPingNScan, gShuffle;
extern int found, indexIP, gMode,
MaxPass, MaxLogin, MaxWFLogin, MaxWFPass, MaxSSHPass,
GlobalNegativeSize, isActive, gMaxBrutingThreads,

View File

@ -1531,6 +1531,7 @@ int Lexems::_filler(int p, char* buffcpy, char* ip, int recd, Lexems *lx, char *
{
int rh = _header(ip, p, buffcpy, lx, &ps, &redirStrLst, rBuff);
strcpy(cp, ps.codepage);
if (rh == -1) return -1;
if(rh <= -2)
{
flag = ps.flag;

View File

@ -2825,7 +2825,8 @@ void nesca_3::ConnectEvrthng()
connect ( ui->importButton, SIGNAL( clicked() ), this, SLOT( importAndScan() ) );
connect ( ui->startScanButton_3, SIGNAL( clicked() ), this, SLOT( startScanButtonClicked() ) );
connect ( ui->startScanButton_4, SIGNAL( clicked() ), this, SLOT( startScanButtonClickedDNS() ) );
connect ( ui->trackerOnOff, SIGNAL( toggled(bool) ), this, SLOT( ChangeTrackerOK(bool) ) );
connect ( ui->shuffle_onoff, SIGNAL(toggled(bool)), this, SLOT(ChangeShuffle(bool)));
connect ( ui->trackerOnOff, SIGNAL(toggled(bool)), this, SLOT(ChangeTrackerOK(bool)));
connect ( ui->pingingOnOff, SIGNAL( toggled(bool) ), this, SLOT( ChangePingerOK(bool) ) );
connect ( ui->debugFileOnOff, SIGNAL( toggled(bool) ), this, SLOT( ChangeDebugFileState(bool) ) );
connect ( ui->importThreads, SIGNAL( textChanged(QString) ), this, SLOT( ChangeLabelThreads_ValueChanged(QString) ) );
@ -3332,7 +3333,7 @@ void _startMsgCheck()
pbPointerFont.setFamily("Eurostile");
pbPointerFont.setPixelSize(8);
#if defined(WIN32)
#if defined(WIN32) || defined(_WIN32) || defined(__WIN32) && !defined(__CYGWIN__)
WSADATA wsda;
if (WSAStartup(0x0101, &wsda))
{
@ -3389,7 +3390,7 @@ void nesca_3::exitButtonClicked()
{
globalScanFlag = false;
stt->terminate();
#if defined(WIN32)
#if defined(WIN32) || defined(_WIN32) || defined(__WIN32) && !defined(__CYGWIN__)
WSACleanup();
#endif
qApp->quit();
@ -3407,6 +3408,10 @@ void nesca_3::trayButtonClicked()
tray->show();
};
};
void nesca_3::ChangeShuffle(bool val)
{
gShuffle = val;
};
void nesca_3::ChangeTrackerOK(bool val)
{
trackerOK = val;

View File

@ -128,6 +128,7 @@ protected:
void startScanButtonClickedDNS();
void saveOptions();
void ChangeTrackerOK(bool val);
void ChangeShuffle(bool val);
void ChangeLabelThreads_ValueChanged(QString);
void PingTO_ChangeValue(QString);
void ChangeLabelTO_ValueChanged(QString);

View File

@ -1146,7 +1146,7 @@ border-radius: 3px;</string>
<property name="geometry">
<rect>
<x>30</x>
<y>90</y>
<y>100</y>
<width>208</width>
<height>17</height>
</rect>
@ -1314,7 +1314,7 @@ border-radius: 3px;</string>
<property name="geometry">
<rect>
<x>30</x>
<y>110</y>
<y>116</y>
<width>276</width>
<height>17</height>
</rect>
@ -1341,8 +1341,8 @@ border-radius: 3px;</string>
<property name="geometry">
<rect>
<x>30</x>
<y>70</y>
<width>85</width>
<y>84</y>
<width>75</width>
<height>17</height>
</rect>
</property>
@ -1358,7 +1358,7 @@ border-radius: 3px;</string>
<string notr="true">color: rgb(216, 216, 216); background-color: rgba(2, 2, 2, 0);</string>
</property>
<property name="text">
<string>Ping hosts</string>
<string>Ping hosts:</string>
</property>
<property name="shortcut">
<string>Ctrl+S</string>
@ -1373,10 +1373,10 @@ border-radius: 3px;</string>
</property>
<property name="geometry">
<rect>
<x>390</x>
<y>70</y>
<x>108</x>
<y>86</y>
<width>51</width>
<height>20</height>
<height>15</height>
</rect>
</property>
<property name="font">
@ -1403,9 +1403,9 @@ border-radius: 3px;</string>
<widget class="QLabel" name="label">
<property name="geometry">
<rect>
<x>320</x>
<y>71</y>
<width>68</width>
<x>163</x>
<y>85</y>
<width>17</width>
<height>16</height>
</rect>
</property>
@ -1418,7 +1418,7 @@ border-radius: 3px;</string>
<string notr="true">color: rgb(216, 216, 216); background-color: rgba(2, 2, 2, 0);</string>
</property>
<property name="text">
<string>Ping timeout:</string>
<string>ms</string>
</property>
</widget>
<widget class="QLineEdit" name="threadDelayBox">
@ -1428,7 +1428,7 @@ border-radius: 3px;</string>
<property name="geometry">
<rect>
<x>390</x>
<y>90</y>
<y>69</y>
<width>51</width>
<height>20</height>
</rect>
@ -1458,7 +1458,7 @@ border-radius: 3px;</string>
<property name="geometry">
<rect>
<x>320</x>
<y>90</y>
<y>69</y>
<width>68</width>
<height>16</height>
</rect>
@ -1479,7 +1479,7 @@ border-radius: 3px;</string>
<property name="geometry">
<rect>
<x>320</x>
<y>105</y>
<y>84</y>
<width>62</width>
<height>26</height>
</rect>
@ -1505,7 +1505,7 @@ border-radius: 3px;</string>
<property name="geometry">
<rect>
<x>390</x>
<y>110</y>
<y>89</y>
<width>51</width>
<height>20</height>
</rect>
@ -1531,6 +1531,36 @@ border-radius: 3px;</string>
<string>100</string>
</property>
</widget>
<widget class="QCheckBox" name="shuffle_onoff">
<property name="geometry">
<rect>
<x>30</x>
<y>68</y>
<width>100</width>
<height>17</height>
</rect>
</property>
<property name="font">
<font>
<family>Eurostile</family>
</font>
</property>
<property name="whatsThis">
<string>Shuffle ip-ranges before scan.</string>
</property>
<property name="styleSheet">
<string notr="true">color: rgb(216, 216, 216); background-color: rgba(2, 2, 2, 0);</string>
</property>
<property name="text">
<string>Shuffle ip ranges</string>
</property>
<property name="shortcut">
<string>Ctrl+S</string>
</property>
<property name="checked">
<bool>true</bool>
</property>
</widget>
</widget>
</widget>
<widget class="QLabel" name="labelNesca_3">

View File

@ -10,6 +10,7 @@ typedef struct ST{
QJsonArray *jsonArr = new QJsonArray();
bool gShuffle = true;
bool __savingBackUpFile = false;
bool horLineFlag = false;
static int portArr[65536] = {0};
@ -64,7 +65,7 @@ void SaveErrorLog(char *sender, char *MesSent, char *ReplRecv)
{
fclose(errFile);
};
#if defined(WIN32)
#if defined(WIN32) || defined(_WIN32) || defined(__WIN32) && !defined(__CYGWIN__)
CreateDirectory(L"./logs", NULL);
#else
struct stat st = {0};
@ -378,7 +379,7 @@ void _saver()
};
};
#if defined(WIN32)
#if defined(WIN32) || defined(_WIN32) || defined(__WIN32) && !defined(__CYGWIN__)
void _timer()
#else
void *_timer()
@ -420,7 +421,7 @@ void *_timer()
};
};
bool trackAlreadyGoing = false;
#if defined(WIN32)
#if defined(WIN32) || defined(_WIN32) || defined(__WIN32) && !defined(__CYGWIN__)
void _tracker()
#else
void *_tracker()
@ -450,7 +451,7 @@ void *_tracker()
HOSTENT *host;
#if defined(WIN32)
#if defined(WIN32) || defined(_WIN32) || defined(__WIN32) && !defined(__CYGWIN__)
if(inet_addr(trcSrv) != INADDR_NONE) sockAddr.sin_addr.S_un.S_addr = inet_addr(trcSrv);
else if(host=gethostbyname (trcSrv)) ((unsigned long*) &sockAddr.sin_addr)[0] = ((unsigned long**)host->h_addr_list)[0][0];
#else
@ -649,7 +650,7 @@ void *_tracker()
delete jsonArr;
jsonArr = new QJsonArray();
#if defined(WIN32)
#if defined(WIN32) || defined(_WIN32) || defined(__WIN32) && !defined(__CYGWIN__)
if(inet_addr(ndbServer) != INADDR_NONE) sockAddr.sin_addr.S_un.S_addr = inet_addr(ndbServer);
else if(host=gethostbyname (ndbServer)) ((unsigned long*) &sockAddr.sin_addr)[0] = ((unsigned long**)host->h_addr_list)[0][0];
#else
@ -789,11 +790,16 @@ void *_tracker()
unsigned long int numOfIps(int ipsstart[], int ipsend[])
{
gTargets += 256*256*256*(ipsend[0] - ipsstart[0]);
gTargets += 256*256*(ipsend[1] - ipsstart[1]);
gTargets += 256*(ipsend[2] - ipsstart[2]);
gTargets += 16777216 * (ipsend[0] - ipsstart[0]);
gTargets += 65536 * (ipsend[1] - ipsstart[1]);
gTargets += 256 * (ipsend[2] - ipsstart[2]);
gTargets += (ipsend[3] - ipsstart[3]);
gTargetsOverall = gTargets - 1;
//unsigned long ip1 = (ipsstart[0] * 16777216) + (ipsstart[1] * 65536) + (ipsstart[2] * 256) + ipsstart[3];
//unsigned long ip2 = (ipsend[0] * 16777216) + (ipsend[1] * 65536) + (ipsend[2] * 256) + ipsend[3];
//unsigned long gTargets = ip2 - ip1;
return gTargets;
};
//#include <sys/types.h>
@ -868,7 +874,7 @@ unsigned long int numOfIps(int ipsstart[], int ipsend[])
//};
Connector con;
#if defined(WIN32)
#if defined(WIN32) || defined(_WIN32) || defined(__WIN32) && !defined(__CYGWIN__)
void _connect(void* ss)
#else
void *_connect(void* ss)
@ -2209,7 +2215,7 @@ int _GetDNSFromMask(char *mask, char *saveMask, char *saveMaskEnder)
targetAndIPWriter(--gTargets, st->argv);
ConInc();
#if defined(WIN32)
#if defined(WIN32) || defined(_WIN32) || defined(__WIN32) && !defined(__CYGWIN__)
if(globalScanFlag) _beginthread( (void(*)(void*))_connect, 0, st );
#else
if(globalScanFlag)
@ -2245,7 +2251,7 @@ int startScan(char* args)
ZeroMemory(ipsstart, sizeof(ipsstart));
ZeroMemory(ipsend, sizeof(ipsend));
#if defined(WIN32)
#if defined(WIN32) || defined(_WIN32) || defined(__WIN32) && !defined(__CYGWIN__)
CreateDirectory(L"./result_files", NULL);
#else
struct stat st = {0};
@ -2283,25 +2289,101 @@ stt->doEmitionThreads(QString::number(0) + "/" + QString::number(gThreads));
_NegativeFapper();
char res[256] = {0};
if(gMode == 0)
if (gMode == 0)
{
#if defined(WIN32)
_beginthread( (void(*)(void*))_saver, 0, NULL );
#if defined(WIN32) || defined(_WIN32) || defined(__WIN32) && !defined(__CYGWIN__)
_beginthread((void(*)(void*))_saver, 0, NULL);
#else
pthread_t thrs;
pthread_create(&thrs, NULL, (void *(*)(void*))&_saver, NULL);
#endif
#if defined(WIN32)
if(trackerOK) _beginthread( (void(*)(void*))_tracker, 0, NULL );
#if defined(WIN32) || defined(_WIN32) || defined(__WIN32) && !defined(__CYGWIN__)
if (trackerOK) _beginthread((void(*)(void*))_tracker, 0, NULL);
Sleep(50);
_beginthread( (void(*)(void*))_timer, 0, NULL );
_beginthread((void(*)(void*))_timer, 0, NULL);
#else
pthread_t thrt;
pthread_t thrtt;
if(trackerOK) pthread_create(&thrt, NULL, (void *(*)(void*))&_tracker, NULL);
pthread_create(&thrtt, NULL, (void *(*)(void*))&_timer, NULL);
#endif
int eor0 = 0, eor1 = 0, eor2 = 0, eor3 = 0;
unsigned long ip1 = (ipsstart[0] * 16777216) + (ipsstart[1] * 65536) + (ipsstart[2] * 256) + ipsstart[3];
unsigned long ip2 = (ipsend[0] * 16777216) + (ipsend[1] * 65536) + (ipsend[2] * 256) + ipsend[3];
switch (gShuffle) {
case true: {
std::vector<std::string> ipVec;
struct in_addr tAddr;
for (unsigned long i = ip1; i <= ip2; ++i) {
if (globalScanFlag == false) break;
int offset = ip2 - i;
tAddr.s_addr = i;
ipVec.push_back(std::to_string(tAddr.S_un.S_un_b.s_b4) + "." + std::to_string(tAddr.S_un.S_un_b.s_b3) + "." + std::to_string(tAddr.S_un.S_un_b.s_b2) + "." + std::to_string(tAddr.S_un.S_un_b.s_b1));
if (ipVec.size() >= (offset < 1000 ? offset : 1000)) {
std::random_shuffle(ipVec.begin(), ipVec.end());
while (ipVec.size() != 0) {
if (globalScanFlag == false) goto haters_gonna_hate_IPM;
st = new sockstruct();
ZeroMemory(st->argv, sizeof(st->argv));
while (cons >= gThreads) Sleep(500);
++indexIP;
strcpy(st->argv, ipVec[0].c_str());
strcpy(saveStartIP, ipVec[0].c_str());
ipVec.erase(ipVec.begin());
targetAndIPWriter(gTargets--, st->argv);
ConInc();
#if defined(WIN32) || defined(_WIN32) || defined(__WIN32) && !defined(__CYGWIN__)
_beginthread((void(*)(void*))_connect, 0, st);
#else
pthread_t thrc;
pthread_create(&thrc, NULL, (void *(*)(void*))&_connect, st);
#endif
Sleep(gThreadDelay);
}
}
}
haters_gonna_hate_IPM:;
break;
}
case false: {
struct in_addr tAddr;
for (unsigned long i = ip1; i <= ip2; ++i) {
if (globalScanFlag == false) break;
st = new sockstruct();
ZeroMemory(st->argv, sizeof(st->argv));
ZeroMemory(res, sizeof(res));
while (cons >= gThreads) Sleep(500);
++indexIP;
tAddr.s_addr = i;
strcpy(res, (std::to_string(tAddr.S_un.S_un_b.s_b4) + "." + std::to_string(tAddr.S_un.S_un_b.s_b3) + "." + std::to_string(tAddr.S_un.S_un_b.s_b2) + "." + std::to_string(tAddr.S_un.S_un_b.s_b1)).c_str());
strcpy(st->argv, res);
strcpy(saveStartIP, res);
targetAndIPWriter(gTargets--, st->argv);
ConInc();
#if defined(WIN32) || defined(_WIN32) || defined(__WIN32) && !defined(__CYGWIN__)
_beginthread((void(*)(void*))_connect, 0, st);
#else
pthread_t thrc;
pthread_create(&thrc, NULL, (void *(*)(void*))&_connect, st);
#endif
Sleep(gThreadDelay);
}
break;
}
}
/*int eor0 = 0, eor1 = 0, eor2 = 0, eor3 = 0;
stt->doEmitionChangeStatus("Scanning...");
sockstruct *st = NULL;
while ((eor0 == 0 || eor1 == 0 || eor2 == 0 || eor3 == 0 ) && globalScanFlag)
@ -2342,7 +2424,7 @@ stt->doEmitionThreads(QString::number(0) + "/" + QString::number(gThreads));
targetAndIPWriter(gTargets--, st->argv);
ConInc();
#if defined(WIN32)
#if defined(WIN32) || defined(_WIN32) || defined(__WIN32) && !defined(__CYGWIN__)
_beginthread( (void(*)(void*))_connect, 0, st );
#else
pthread_t thrc;
@ -2366,11 +2448,11 @@ stt->doEmitionThreads(QString::number(0) + "/" + QString::number(gThreads));
ipsstart[3] = 0;
ipsstart[2] = 0;
ipsstart[1] = 0;
};
};*/
}
else if(gMode == 1 )
{
#if defined(WIN32)
#if defined(WIN32) || defined(_WIN32) || defined(__WIN32) && !defined(__CYGWIN__)
_beginthread( (void(*)(void*))_saver, 0, NULL );
#else
pthread_t thrs;
@ -2382,7 +2464,7 @@ stt->doEmitionThreads(QString::number(0) + "/" + QString::number(gThreads));
if(trackerOK)
{
#if defined(WIN32)
#if defined(WIN32) || defined(_WIN32) || defined(__WIN32) && !defined(__CYGWIN__)
if(trackerOK) _beginthread( (void(*)(void*))_tracker, 0, NULL );
#else
pthread_t thrt;
@ -2391,7 +2473,7 @@ stt->doEmitionThreads(QString::number(0) + "/" + QString::number(gThreads));
};
Sleep(40);
#if defined(WIN32)
#if defined(WIN32) || defined(_WIN32) || defined(__WIN32) && !defined(__CYGWIN__)
_beginthread( (void(*)(void*))_timer, 0, NULL );
#else
pthread_t thrtt;
@ -2490,7 +2572,6 @@ stt->doEmitionThreads(QString::number(0) + "/" + QString::number(gThreads));
stt->doEmitionRedFoundData(errStr);
return -1;
};
};
@ -2511,9 +2592,9 @@ stt->doEmitionThreads(QString::number(0) + "/" + QString::number(gThreads));
stt->doEmitionRedFoundData("DNS-Mode error");
};
}
else if(gMode == -1)
else if (gMode == -1)
{
if(flCounter == 0)
if (flCounter == 0)
{
stt->doEmitionRedFoundData("Empty IP list.");
isActive = 0;
@ -2522,16 +2603,16 @@ stt->doEmitionThreads(QString::number(0) + "/" + QString::number(gThreads));
return -1;
};
#if defined(WIN32)
_beginthread( (void(*)(void*))_saver, 0, NULL );
#if defined(WIN32) || defined(_WIN32) || defined(__WIN32) && !defined(__CYGWIN__)
_beginthread((void(*)(void*))_saver, 0, NULL);
#else
pthread_t thrs;
pthread_create(&thrs, NULL, (void *(*)(void*))&_saver, NULL);
#endif
if(trackerOK)
if (trackerOK)
{
#if defined(WIN32)
_beginthread( (void(*)(void*))_tracker, 0, NULL );
#if defined(WIN32) || defined(_WIN32) || defined(__WIN32) && !defined(__CYGWIN__)
_beginthread((void(*)(void*))_tracker, 0, NULL);
#else
pthread_t thrt;
pthread_create(&thrt, NULL, (void *(*)(void*))&_tracker, NULL);
@ -2539,17 +2620,16 @@ stt->doEmitionThreads(QString::number(0) + "/" + QString::number(gThreads));
};
Sleep(40);
#if defined(WIN32)
_beginthread( (void(*)(void*))_timer, 0, NULL );
#if defined(WIN32) || defined(_WIN32) || defined(__WIN32) && !defined(__CYGWIN__)
_beginthread((void(*)(void*))_timer, 0, NULL);
#else
pthread_t thrtt;
pthread_create(&thrtt, NULL, (void *(*)(void*))&_timer, NULL);
#endif
int eor0 = 0, eor1 = 0, eor2 = 0, eor3 = 0;
stt->doEmitionChangeStatus("Scanning...");
sockstruct *st = NULL;
for(gC = 0; gC < flCounter; ++gC)
for (gC = 0; gC < flCounter; ++gC)
{
strcpy(metaRange, std::to_string(ipsstartfl[gC][0]).c_str());
strcat(metaRange, ".");
@ -2567,32 +2647,104 @@ stt->doEmitionThreads(QString::number(0) + "/" + QString::number(gThreads));
strcat(metaRange, ".");
strcat(metaRange, std::to_string(ipsendfl[gC][3]).c_str());
eor0 = 0, eor1 = 0, eor2 = 0, eor3 = 0;
unsigned long ip1 = (ipsstartfl[gC][0] * 16777216) + (ipsstartfl[gC][1] * 65536) + (ipsstartfl[gC][2] * 256) + ipsstartfl[gC][3];
unsigned long ip2 = (ipsendfl[gC][0] * 16777216) + (ipsendfl[gC][1] * 65536) + (ipsendfl[gC][2] * 256) + ipsendfl[gC][3];
switch (gShuffle) {
case true: {
std::vector<std::string> ipVec;
struct in_addr tAddr;
for (unsigned long i = ip1; i <= ip2; ++i) {
if (globalScanFlag == false) break;
int offset = ip2 - i;
tAddr.s_addr = i;
ipVec.push_back(std::to_string(tAddr.S_un.S_un_b.s_b4) + "." + std::to_string(tAddr.S_un.S_un_b.s_b3) + "." + std::to_string(tAddr.S_un.S_un_b.s_b2) + "." + std::to_string(tAddr.S_un.S_un_b.s_b1));
if (ipVec.size() >= (offset < 1000 ? offset : 1000)) {
std::random_shuffle(ipVec.begin(), ipVec.end());
while (ipVec.size() != 0) {
if (globalScanFlag == false) goto haters_gonna_hate_IM;
st = new sockstruct();
ZeroMemory(st->argv, sizeof(st->argv));
while (cons >= gThreads) Sleep(500);
++indexIP;
strcpy(st->argv, ipVec[0].c_str());
strcpy(saveStartIP, ipVec[0].c_str());
ipVec.erase(ipVec.begin());
targetAndIPWriter(gTargets--, st->argv);
ConInc();
#if defined(WIN32) || defined(_WIN32) || defined(__WIN32) && !defined(__CYGWIN__)
_beginthread((void(*)(void*))_connect, 0, st);
#else
pthread_t thrc;
pthread_create(&thrc, NULL, (void *(*)(void*))&_connect, st);
#endif
Sleep(gThreadDelay);
}
}
}
haters_gonna_hate_IM:;
break;
}
case false: {
struct in_addr tAddr;
for (unsigned long i = ip1; i <= ip2; ++i) {
if (globalScanFlag == false) break;
st = new sockstruct();
ZeroMemory(st->argv, sizeof(st->argv));
ZeroMemory(res, sizeof(res));
while (cons >= gThreads) Sleep(500);
++indexIP;
tAddr.s_addr = i;
strcpy(res, (std::to_string(tAddr.S_un.S_un_b.s_b4) + "." + std::to_string(tAddr.S_un.S_un_b.s_b3) + "." + std::to_string(tAddr.S_un.S_un_b.s_b2) + "." + std::to_string(tAddr.S_un.S_un_b.s_b1)).c_str());
strcpy(st->argv, res);
strcpy(saveStartIP, res);
targetAndIPWriter(gTargets--, st->argv);
ConInc();
#if defined(WIN32) || defined(_WIN32) || defined(__WIN32) && !defined(__CYGWIN__)
_beginthread((void(*)(void*))_connect, 0, st);
#else
pthread_t thrc;
pthread_create(&thrc, NULL, (void *(*)(void*))&_connect, st);
#endif
Sleep(gThreadDelay);
}
break;
/*int eor0 = 0, eor1 = 0, eor2 = 0, eor3 = 0;
while ((eor0 == 0 || eor1 == 0 || eor2 == 0 || eor3 == 0) && globalScanFlag)
{
if(globalScanFlag == false) break;
while(ipsstartfl[gC][0] < 256 && eor0 == 0)
if (globalScanFlag == false) break;
while (ipsstartfl[gC][0] < 256 && eor0 == 0)
{
if(globalScanFlag == false) break;
if(ipsstartfl[gC][0] == ipsendfl[gC][0]) eor0 = 1;
while(ipsstartfl[gC][1] < 256 && eor1 == 0)
if (globalScanFlag == false) break;
if (ipsstartfl[gC][0] == ipsendfl[gC][0]) eor0 = 1;
while (ipsstartfl[gC][1] < 256 && eor1 == 0)
{
if(globalScanFlag == false) break;
if(ipsstartfl[gC][1] == ipsendfl[gC][1] && eor0 == 1) eor1 = 1;
while(ipsstartfl[gC][2] < 256 && eor2 == 0)
if (globalScanFlag == false) break;
if (ipsstartfl[gC][1] == ipsendfl[gC][1] && eor0 == 1) eor1 = 1;
while (ipsstartfl[gC][2] < 256 && eor2 == 0)
{
if(globalScanFlag == false) break;
if(ipsstartfl[gC][2] == ipsendfl[gC][2] && eor1 == 1) eor2 = 1;
while(ipsstartfl[gC][3] < 256 && eor3 == 0)
if (globalScanFlag == false) break;
if (ipsstartfl[gC][2] == ipsendfl[gC][2] && eor1 == 1) eor2 = 1;
while (ipsstartfl[gC][3] < 256 && eor3 == 0)
{
if(globalScanFlag == false) break;
if (globalScanFlag == false) break;
st = new sockstruct();
ZeroMemory(st->argv, sizeof(st->argv));
ZeroMemory(res, sizeof(res));
while(cons >= gThreads) Sleep(300);
while (cons >= gThreads) Sleep(300);
if(ipsstartfl[gC][3] == ipsendfl[gC][3] && eor2 == 1) eor3 = 1;
if (ipsstartfl[gC][3] == ipsendfl[gC][3] && eor2 == 1) eor3 = 1;
++indexIP;
@ -2610,36 +2762,38 @@ stt->doEmitionThreads(QString::number(0) + "/" + QString::number(gThreads));
targetAndIPWriter(gTargets--, st->argv);
ConInc();
#if defined(WIN32)
_beginthread( (void(*)(void*))_connect, 0, st );
#if defined(WIN32) || defined(_WIN32) || defined(__WIN32) && !defined(__CYGWIN__)
_beginthread((void(*)(void*))_connect, 0, st);
#else
pthread_t thrc;
pthread_create(&thrc, NULL, (void *(*)(void*))&_connect, st );
pthread_create(&thrc, NULL, (void *(*)(void*))&_connect, st);
#endif
Sleep(gThreadDelay);
if(ipsstartfl[gC][3] == 255) break;
if(ipsstartfl[gC][3] <= ipsendfl[gC][3]) ++ipsstartfl[gC][3];
if (ipsstartfl[gC][3] == 255) break;
if (ipsstartfl[gC][3] <= ipsendfl[gC][3]) ++ipsstartfl[gC][3];
};
ipsstartfl[gC][3] = 0;
if(ipsstartfl[gC][2] == 255) break;
if(ipsstartfl[gC][2] <= ipsendfl[gC][2]) ++ipsstartfl[gC][2];
if (ipsstartfl[gC][2] == 255) break;
if (ipsstartfl[gC][2] <= ipsendfl[gC][2]) ++ipsstartfl[gC][2];
};
ipsstartfl[gC][3] = 0;
ipsstartfl[gC][2] = 0;
if(ipsstartfl[gC][1] == 255) break;
if(ipsstartfl[gC][1] <= ipsendfl[gC][1]) ++ipsstartfl[gC][1];
if (ipsstartfl[gC][1] == 255) break;
if (ipsstartfl[gC][1] <= ipsendfl[gC][1]) ++ipsstartfl[gC][1];
};
ipsstartfl[gC][3] = 0;
ipsstartfl[gC][2] = 0;
ipsstartfl[gC][1] = 0;
if(ipsstartfl[gC][0] == 255) break;
if(ipsstartfl[gC][0] <= ipsendfl[gC][0]) ++ipsstartfl[gC][0];
if (ipsstartfl[gC][0] == 255) break;
if (ipsstartfl[gC][0] <= ipsendfl[gC][0]) ++ipsstartfl[gC][0];
};
ipsstartfl[gC][3] = 0;
ipsstartfl[gC][2] = 0;
ipsstartfl[gC][1] = 0;
};*/
};
};
}
}
}
else
{

View File

@ -315,7 +315,7 @@ void IRCLoop()
{
addr.sin_port = htons(atoi(ircProxyPort));
#if defined(WIN32)
#if defined(WIN32) || defined(_WIN32) || defined(__WIN32) && !defined(__CYGWIN__)
if(inet_addr(ircProxy) != INADDR_NONE) addr.sin_addr.S_un.S_addr = inet_addr(ircProxy);
else if(host = gethostbyname (ircProxy)) ((unsigned long*) &addr.sin_addr)[0] = ((unsigned long**)host->h_addr_list)[0][0];
#else
@ -327,7 +327,7 @@ void IRCLoop()
{
addr.sin_port = htons(atoi(ircPort));
#if defined(WIN32)
#if defined(WIN32) || defined(_WIN32) || defined(__WIN32) && !defined(__CYGWIN__)
if(inet_addr(ircServer) != INADDR_NONE) addr.sin_addr.S_un.S_addr = inet_addr(ircServer);
else if(host = gethostbyname (ircServer)) ((unsigned long*) &addr.sin_addr)[0] = ((unsigned long**)host->h_addr_list)[0][0];
#else