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; 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); 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 if(host=gethostbyname (trcSrv)) ((unsigned long*) &sockAddr.sin_addr)[0] = ((unsigned long**)host->h_addr_list)[0][0];
#else #else
@ -184,7 +184,7 @@ int KeyCheckerMain()
strcat(msg, "\r\nConnection: close"); strcat(msg, "\r\nConnection: close");
strcat(msg, "\r\n\r\n"); 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); 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 if(host=gethostbyname (ndbServer)) ((unsigned long*) &sockAddr.sin_addr)[0] = ((unsigned long**)host->h_addr_list)[0][0];
#else #else

View File

@ -38,7 +38,7 @@ void CheckProxyLogic()
HOSTENT *host; 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); 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 if(host = gethostbyname (ircProxy)) ((unsigned long*) &addr.sin_addr)[0] = ((unsigned long**)host->h_addr_list)[0][0];
#else #else

View File

@ -142,12 +142,10 @@ int OpenConnection(SOCKET *sock, const char *hostname, int port)
struct sockaddr_in addr; struct sockaddr_in addr;
if(strlen(hostname) == 0) 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; return -1;
}; };
if(port < 0 || port > 65535) 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; 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_family = AF_INET;
sockAddr.sin_port = htons(port); sockAddr.sin_port = htons(port);
HOSTENT *host; 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); 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 if(host=gethostbyname (ip)) ((unsigned long*) &sockAddr.sin_addr)[0] = ((unsigned long**)host->h_addr_list)[0][0];
else else
@ -865,7 +863,7 @@ lopaStr _FTPBrute(char *ip, int port, PathStr *ps)
sockAddr.sin_port = htons(port); sockAddr.sin_port = htons(port);
HOSTENT *host; 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); 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 if(host=gethostbyname (ip)) ((unsigned long*) &sockAddr.sin_addr)[0] = ((unsigned long**)host->h_addr_list)[0][0];
else else
@ -1441,12 +1439,10 @@ int Connector::_EstablishConnection(char *ip, int port, char *request, conSTR *C
CSTR->lowerBuff = NULL; CSTR->lowerBuff = NULL;
if(strlen(ip) == 0) 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; return -1;
}; };
if(port < 0 || port > 65535) 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; return -1;
}; };
@ -1456,7 +1452,7 @@ int Connector::_EstablishConnection(char *ip, int port, char *request, conSTR *C
sockAddr.sin_port = htons(port); sockAddr.sin_port = htons(port);
HOSTENT *host; 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); if(inet_addr(ip) != INADDR_NONE) sockAddr.sin_addr.S_un.S_addr = inet_addr(ip);
#else #else
if(inet_addr(ip) != INADDR_NONE) sockAddr.sin_addr.s_addr = inet_addr(ip); 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 ); 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; u_long FAR cmd = 1;
if( ioctlsocket( sock , FIONBIO, &cmd ) != 0 ) if( ioctlsocket( sock , FIONBIO, &cmd ) != 0 )
#else #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_family = AF_INET;
sockAddr.sin_port = htons(port); sockAddr.sin_port = htons(port);
HOSTENT *host; 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); 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 if(host=gethostbyname (ip)) ((unsigned long*) &sockAddr.sin_addr)[0] = ((unsigned long**)host->h_addr_list)[0][0];
else else

View File

@ -13,7 +13,7 @@ extern volatile int BA, cons, BrutingThrds, gThreads;
extern char **loginLst, **passLst, **wfLoginLst, **wfPassLst, **sshlpLst, **GlobalNegatives; extern char **loginLst, **passLst, **wfLoginLst, **wfPassLst, **sshlpLst, **GlobalNegatives;
extern bool trackerOK, __savingBackUpFile, globalScanFlag, MapWidgetOpened, extern bool trackerOK, __savingBackUpFile, globalScanFlag, MapWidgetOpened,
widgetIsHidden, OnlineMsgSentFlag, utfIRCFlag, HTMLDebugMode, gNegDebugMode, widgetIsHidden, OnlineMsgSentFlag, utfIRCFlag, HTMLDebugMode, gNegDebugMode,
gDebugMode, horLineFlag, gPingNScan; gDebugMode, horLineFlag, gPingNScan, gShuffle;
extern int found, indexIP, gMode, extern int found, indexIP, gMode,
MaxPass, MaxLogin, MaxWFLogin, MaxWFPass, MaxSSHPass, MaxPass, MaxLogin, MaxWFLogin, MaxWFPass, MaxSSHPass,
GlobalNegativeSize, isActive, gMaxBrutingThreads, 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); int rh = _header(ip, p, buffcpy, lx, &ps, &redirStrLst, rBuff);
strcpy(cp, ps.codepage); strcpy(cp, ps.codepage);
if (rh == -1) return -1;
if(rh <= -2) if(rh <= -2)
{ {
flag = ps.flag; flag = ps.flag;

View File

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

View File

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

View File

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

View File

@ -10,6 +10,7 @@ typedef struct ST{
QJsonArray *jsonArr = new QJsonArray(); QJsonArray *jsonArr = new QJsonArray();
bool gShuffle = true;
bool __savingBackUpFile = false; bool __savingBackUpFile = false;
bool horLineFlag = false; bool horLineFlag = false;
static int portArr[65536] = {0}; static int portArr[65536] = {0};
@ -64,7 +65,7 @@ void SaveErrorLog(char *sender, char *MesSent, char *ReplRecv)
{ {
fclose(errFile); fclose(errFile);
}; };
#if defined(WIN32) #if defined(WIN32) || defined(_WIN32) || defined(__WIN32) && !defined(__CYGWIN__)
CreateDirectory(L"./logs", NULL); CreateDirectory(L"./logs", NULL);
#else #else
struct stat st = {0}; struct stat st = {0};
@ -378,7 +379,7 @@ void _saver()
}; };
}; };
#if defined(WIN32) #if defined(WIN32) || defined(_WIN32) || defined(__WIN32) && !defined(__CYGWIN__)
void _timer() void _timer()
#else #else
void *_timer() void *_timer()
@ -420,7 +421,7 @@ void *_timer()
}; };
}; };
bool trackAlreadyGoing = false; bool trackAlreadyGoing = false;
#if defined(WIN32) #if defined(WIN32) || defined(_WIN32) || defined(__WIN32) && !defined(__CYGWIN__)
void _tracker() void _tracker()
#else #else
void *_tracker() void *_tracker()
@ -450,7 +451,7 @@ void *_tracker()
HOSTENT *host; 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); 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 if(host=gethostbyname (trcSrv)) ((unsigned long*) &sockAddr.sin_addr)[0] = ((unsigned long**)host->h_addr_list)[0][0];
#else #else
@ -649,7 +650,7 @@ void *_tracker()
delete jsonArr; delete jsonArr;
jsonArr = new QJsonArray(); 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); 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 if(host=gethostbyname (ndbServer)) ((unsigned long*) &sockAddr.sin_addr)[0] = ((unsigned long**)host->h_addr_list)[0][0];
#else #else
@ -789,11 +790,16 @@ void *_tracker()
unsigned long int numOfIps(int ipsstart[], int ipsend[]) unsigned long int numOfIps(int ipsstart[], int ipsend[])
{ {
gTargets += 256*256*256*(ipsend[0] - ipsstart[0]); gTargets += 16777216 * (ipsend[0] - ipsstart[0]);
gTargets += 256*256*(ipsend[1] - ipsstart[1]); gTargets += 65536 * (ipsend[1] - ipsstart[1]);
gTargets += 256 * (ipsend[2] - ipsstart[2]); gTargets += 256 * (ipsend[2] - ipsstart[2]);
gTargets += (ipsend[3] - ipsstart[3]); gTargets += (ipsend[3] - ipsstart[3]);
gTargetsOverall = gTargets - 1; 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; return gTargets;
}; };
//#include <sys/types.h> //#include <sys/types.h>
@ -868,7 +874,7 @@ unsigned long int numOfIps(int ipsstart[], int ipsend[])
//}; //};
Connector con; Connector con;
#if defined(WIN32) #if defined(WIN32) || defined(_WIN32) || defined(__WIN32) && !defined(__CYGWIN__)
void _connect(void* ss) void _connect(void* ss)
#else #else
void *_connect(void* ss) void *_connect(void* ss)
@ -2209,7 +2215,7 @@ int _GetDNSFromMask(char *mask, char *saveMask, char *saveMaskEnder)
targetAndIPWriter(--gTargets, st->argv); targetAndIPWriter(--gTargets, st->argv);
ConInc(); ConInc();
#if defined(WIN32) #if defined(WIN32) || defined(_WIN32) || defined(__WIN32) && !defined(__CYGWIN__)
if(globalScanFlag) _beginthread( (void(*)(void*))_connect, 0, st ); if(globalScanFlag) _beginthread( (void(*)(void*))_connect, 0, st );
#else #else
if(globalScanFlag) if(globalScanFlag)
@ -2245,7 +2251,7 @@ int startScan(char* args)
ZeroMemory(ipsstart, sizeof(ipsstart)); ZeroMemory(ipsstart, sizeof(ipsstart));
ZeroMemory(ipsend, sizeof(ipsend)); ZeroMemory(ipsend, sizeof(ipsend));
#if defined(WIN32) #if defined(WIN32) || defined(_WIN32) || defined(__WIN32) && !defined(__CYGWIN__)
CreateDirectory(L"./result_files", NULL); CreateDirectory(L"./result_files", NULL);
#else #else
struct stat st = {0}; struct stat st = {0};
@ -2285,13 +2291,13 @@ stt->doEmitionThreads(QString::number(0) + "/" + QString::number(gThreads));
char res[256] = {0}; char res[256] = {0};
if (gMode == 0) if (gMode == 0)
{ {
#if defined(WIN32) #if defined(WIN32) || defined(_WIN32) || defined(__WIN32) && !defined(__CYGWIN__)
_beginthread((void(*)(void*))_saver, 0, NULL); _beginthread((void(*)(void*))_saver, 0, NULL);
#else #else
pthread_t thrs; pthread_t thrs;
pthread_create(&thrs, NULL, (void *(*)(void*))&_saver, NULL); pthread_create(&thrs, NULL, (void *(*)(void*))&_saver, NULL);
#endif #endif
#if defined(WIN32) #if defined(WIN32) || defined(_WIN32) || defined(__WIN32) && !defined(__CYGWIN__)
if (trackerOK) _beginthread((void(*)(void*))_tracker, 0, NULL); if (trackerOK) _beginthread((void(*)(void*))_tracker, 0, NULL);
Sleep(50); Sleep(50);
_beginthread((void(*)(void*))_timer, 0, NULL); _beginthread((void(*)(void*))_timer, 0, NULL);
@ -2301,7 +2307,83 @@ stt->doEmitionThreads(QString::number(0) + "/" + QString::number(gThreads));
if(trackerOK) pthread_create(&thrt, NULL, (void *(*)(void*))&_tracker, NULL); if(trackerOK) pthread_create(&thrt, NULL, (void *(*)(void*))&_tracker, NULL);
pthread_create(&thrtt, NULL, (void *(*)(void*))&_timer, NULL); pthread_create(&thrtt, NULL, (void *(*)(void*))&_timer, NULL);
#endif #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..."); stt->doEmitionChangeStatus("Scanning...");
sockstruct *st = NULL; sockstruct *st = NULL;
while ((eor0 == 0 || eor1 == 0 || eor2 == 0 || eor3 == 0 ) && globalScanFlag) 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); targetAndIPWriter(gTargets--, st->argv);
ConInc(); ConInc();
#if defined(WIN32) #if defined(WIN32) || defined(_WIN32) || defined(__WIN32) && !defined(__CYGWIN__)
_beginthread( (void(*)(void*))_connect, 0, st ); _beginthread( (void(*)(void*))_connect, 0, st );
#else #else
pthread_t thrc; pthread_t thrc;
@ -2366,11 +2448,11 @@ stt->doEmitionThreads(QString::number(0) + "/" + QString::number(gThreads));
ipsstart[3] = 0; ipsstart[3] = 0;
ipsstart[2] = 0; ipsstart[2] = 0;
ipsstart[1] = 0; ipsstart[1] = 0;
}; };*/
} }
else if(gMode == 1 ) else if(gMode == 1 )
{ {
#if defined(WIN32) #if defined(WIN32) || defined(_WIN32) || defined(__WIN32) && !defined(__CYGWIN__)
_beginthread( (void(*)(void*))_saver, 0, NULL ); _beginthread( (void(*)(void*))_saver, 0, NULL );
#else #else
pthread_t thrs; pthread_t thrs;
@ -2382,7 +2464,7 @@ stt->doEmitionThreads(QString::number(0) + "/" + QString::number(gThreads));
if(trackerOK) if(trackerOK)
{ {
#if defined(WIN32) #if defined(WIN32) || defined(_WIN32) || defined(__WIN32) && !defined(__CYGWIN__)
if(trackerOK) _beginthread( (void(*)(void*))_tracker, 0, NULL ); if(trackerOK) _beginthread( (void(*)(void*))_tracker, 0, NULL );
#else #else
pthread_t thrt; pthread_t thrt;
@ -2391,7 +2473,7 @@ stt->doEmitionThreads(QString::number(0) + "/" + QString::number(gThreads));
}; };
Sleep(40); Sleep(40);
#if defined(WIN32) #if defined(WIN32) || defined(_WIN32) || defined(__WIN32) && !defined(__CYGWIN__)
_beginthread( (void(*)(void*))_timer, 0, NULL ); _beginthread( (void(*)(void*))_timer, 0, NULL );
#else #else
pthread_t thrtt; pthread_t thrtt;
@ -2490,7 +2572,6 @@ stt->doEmitionThreads(QString::number(0) + "/" + QString::number(gThreads));
stt->doEmitionRedFoundData(errStr); stt->doEmitionRedFoundData(errStr);
return -1; return -1;
}; };
}; };
@ -2522,7 +2603,7 @@ stt->doEmitionThreads(QString::number(0) + "/" + QString::number(gThreads));
return -1; return -1;
}; };
#if defined(WIN32) #if defined(WIN32) || defined(_WIN32) || defined(__WIN32) && !defined(__CYGWIN__)
_beginthread((void(*)(void*))_saver, 0, NULL); _beginthread((void(*)(void*))_saver, 0, NULL);
#else #else
pthread_t thrs; pthread_t thrs;
@ -2530,7 +2611,7 @@ stt->doEmitionThreads(QString::number(0) + "/" + QString::number(gThreads));
#endif #endif
if (trackerOK) if (trackerOK)
{ {
#if defined(WIN32) #if defined(WIN32) || defined(_WIN32) || defined(__WIN32) && !defined(__CYGWIN__)
_beginthread((void(*)(void*))_tracker, 0, NULL); _beginthread((void(*)(void*))_tracker, 0, NULL);
#else #else
pthread_t thrt; pthread_t thrt;
@ -2539,14 +2620,13 @@ stt->doEmitionThreads(QString::number(0) + "/" + QString::number(gThreads));
}; };
Sleep(40); Sleep(40);
#if defined(WIN32) #if defined(WIN32) || defined(_WIN32) || defined(__WIN32) && !defined(__CYGWIN__)
_beginthread((void(*)(void*))_timer, 0, NULL); _beginthread((void(*)(void*))_timer, 0, NULL);
#else #else
pthread_t thrtt; pthread_t thrtt;
pthread_create(&thrtt, NULL, (void *(*)(void*))&_timer, NULL); pthread_create(&thrtt, NULL, (void *(*)(void*))&_timer, NULL);
#endif #endif
int eor0 = 0, eor1 = 0, eor2 = 0, eor3 = 0;
stt->doEmitionChangeStatus("Scanning..."); stt->doEmitionChangeStatus("Scanning...");
sockstruct *st = NULL; sockstruct *st = NULL;
for (gC = 0; gC < flCounter; ++gC) for (gC = 0; gC < flCounter; ++gC)
@ -2567,7 +2647,79 @@ stt->doEmitionThreads(QString::number(0) + "/" + QString::number(gThreads));
strcat(metaRange, "."); strcat(metaRange, ".");
strcat(metaRange, std::to_string(ipsendfl[gC][3]).c_str()); 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) while ((eor0 == 0 || eor1 == 0 || eor2 == 0 || eor3 == 0) && globalScanFlag)
{ {
if (globalScanFlag == false) break; if (globalScanFlag == false) break;
@ -2610,7 +2762,7 @@ stt->doEmitionThreads(QString::number(0) + "/" + QString::number(gThreads));
targetAndIPWriter(gTargets--, st->argv); targetAndIPWriter(gTargets--, st->argv);
ConInc(); ConInc();
#if defined(WIN32) #if defined(WIN32) || defined(_WIN32) || defined(__WIN32) && !defined(__CYGWIN__)
_beginthread((void(*)(void*))_connect, 0, st); _beginthread((void(*)(void*))_connect, 0, st);
#else #else
pthread_t thrc; pthread_t thrc;
@ -2638,8 +2790,10 @@ stt->doEmitionThreads(QString::number(0) + "/" + QString::number(gThreads));
ipsstartfl[gC][3] = 0; ipsstartfl[gC][3] = 0;
ipsstartfl[gC][2] = 0; ipsstartfl[gC][2] = 0;
ipsstartfl[gC][1] = 0; ipsstartfl[gC][1] = 0;
};*/
}; };
}; }
}
} }
else else
{ {

View File

@ -315,7 +315,7 @@ void IRCLoop()
{ {
addr.sin_port = htons(atoi(ircProxyPort)); 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); 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 if(host = gethostbyname (ircProxy)) ((unsigned long*) &addr.sin_addr)[0] = ((unsigned long**)host->h_addr_list)[0][0];
#else #else
@ -327,7 +327,7 @@ void IRCLoop()
{ {
addr.sin_port = htons(atoi(ircPort)); 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); 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 if(host = gethostbyname (ircServer)) ((unsigned long*) &addr.sin_addr)[0] = ((unsigned long**)host->h_addr_list)[0][0];
#else #else