mirror of
https://github.com/ChronosX88/nesca.git
synced 2024-12-27 17:51:47 +00:00
IP randomizer fix
This commit is contained in:
parent
0179b11188
commit
b55618722f
@ -35,6 +35,6 @@ void ActivityDrawerTh_HorNet::run()
|
||||
makeActLine(((float)Activity / (nm != 0 ? nm : 1)) * 10);
|
||||
adtHN->doEmitDrawActivityLine(QString::number(Activity) + "b");
|
||||
Activity = 0;
|
||||
msleep(150);
|
||||
msleep(200);
|
||||
};
|
||||
}
|
||||
|
@ -1,32 +0,0 @@
|
||||
#include "ColoredIndexBarDrawer.h"
|
||||
|
||||
int cIndex = 0;
|
||||
|
||||
void ColoredIndexBarDrawer::doEmitionDrawPointerPB2(int pointer)
|
||||
{
|
||||
emit pbTh2->drawPointerPB2(pointer);
|
||||
};
|
||||
|
||||
void ColoredIndexBarDrawer::run()
|
||||
{
|
||||
globalScanFlag = true;
|
||||
int oldPointer = 0;
|
||||
msleep(1000);
|
||||
while (globalScanFlag)
|
||||
{
|
||||
msleep(200);
|
||||
int sz = stt->getColoredIndexes().size();
|
||||
if (sz > 0) {
|
||||
int pointer = 100 * cIndex / sz;
|
||||
|
||||
if (pointer < oldPointer) {
|
||||
oldPointer = 0;
|
||||
}
|
||||
if (pointer > oldPointer) {
|
||||
doEmitionDrawPointerPB2(pointer);
|
||||
oldPointer = pointer;
|
||||
}
|
||||
}
|
||||
msleep(1000);
|
||||
}
|
||||
};
|
@ -1,20 +0,0 @@
|
||||
#ifndef CIPBD_H
|
||||
#define CIPBD_H
|
||||
|
||||
#pragma once
|
||||
#include "STh.h"
|
||||
#include "externData.h"
|
||||
|
||||
class ColoredIndexBarDrawer : public QThread
|
||||
{
|
||||
Q_OBJECT
|
||||
|
||||
public: signals : void drawPointerPB2(int);
|
||||
public:
|
||||
static void doEmitionDrawPointerPB2(int pointer);
|
||||
protected:
|
||||
void run();
|
||||
};
|
||||
extern ColoredIndexBarDrawer *pbTh2;
|
||||
|
||||
#endif // CIPBD_H
|
147
MainStarter.cpp
147
MainStarter.cpp
@ -6,6 +6,9 @@
|
||||
#include <qjsonvalue.h>
|
||||
#include <qjsonarray.h>
|
||||
#include <qjsondocument.h>
|
||||
#include "IPRandomizer.h"
|
||||
#include "HikvisionLogin.h"
|
||||
#include <ctime>
|
||||
|
||||
int gTimeOut = 3;
|
||||
int gPingTimeout = 1;
|
||||
@ -1176,10 +1179,6 @@ void MainStarter::startDNSScan(){
|
||||
};
|
||||
}
|
||||
|
||||
struct Corac {
|
||||
int index;
|
||||
std::string ip;
|
||||
};
|
||||
void MainStarter::startImportScan(){
|
||||
|
||||
if (MainStarter::flCounter == 0)
|
||||
@ -1190,35 +1189,21 @@ void MainStarter::startImportScan(){
|
||||
return;
|
||||
};
|
||||
|
||||
//std::vector<std::string> ipVec;
|
||||
std::vector<Corac> ipVec;
|
||||
struct in_addr tAddr;
|
||||
int ipOffset = 6;
|
||||
//for (gflIndex = 0; gflIndex < MainStarter::flCounter; ++gflIndex)
|
||||
for (gflIndex = 0; gflIndex < MainStarter::flCounter; gflIndex += ipOffset)
|
||||
{
|
||||
//sprintf(metaRange, "%d.%d.%d.%d-%d.%d.%d.%d",
|
||||
// ipsstartfl[gflIndex][0], ipsstartfl[gflIndex][1], ipsstartfl[gflIndex][2], ipsstartfl[gflIndex][3],
|
||||
// ipsendfl[gflIndex][0], ipsendfl[gflIndex][1], ipsendfl[gflIndex][2], ipsendfl[gflIndex][3]);
|
||||
|
||||
//ip1 = (ipsstartfl[gflIndex][0] * 16777216) +
|
||||
// (ipsstartfl[gflIndex][1] * 65536) +
|
||||
// (ipsstartfl[gflIndex][2] * 256) +
|
||||
// ipsstartfl[gflIndex][3];
|
||||
//ip2 = (ipsendfl[gflIndex][0] * 16777216) +
|
||||
// (ipsendfl[gflIndex][1] * 65536) +
|
||||
// (ipsendfl[gflIndex][2] * 256) +
|
||||
// ipsendfl[gflIndex][3];
|
||||
|
||||
switch (gShuffle) {
|
||||
case true: {
|
||||
switch (gShuffle) {
|
||||
case true: {
|
||||
int ipOffset = 6;
|
||||
for (gflIndex = 0; gflIndex < MainStarter::flCounter; gflIndex += ipOffset)
|
||||
{
|
||||
int ipGap = MainStarter::flCounter - gflIndex;
|
||||
if (ipGap < ipOffset)
|
||||
{
|
||||
ipOffset = ipGap;
|
||||
};
|
||||
|
||||
for (int j = gflIndex, coracIndex = 0; j < gflIndex + ipOffset; ++j, coracIndex++)
|
||||
std::vector<IPRangeHolder> ipRangeVec;
|
||||
for (int j = gflIndex; j < gflIndex + ipOffset; ++j)
|
||||
{
|
||||
/*sprintf(metaRange, "%d.%d.%d.%d-%d.%d.%d.%d",
|
||||
ipsstartfl[j][0], ipsstartfl[j][1], ipsstartfl[j][2], ipsstartfl[j][3],
|
||||
@ -1232,94 +1217,54 @@ void MainStarter::startImportScan(){
|
||||
(ipsendfl[j][2] * 256) +
|
||||
ipsendfl[j][3];
|
||||
|
||||
for (unsigned long i = ip1; i <= ip2; ++i)
|
||||
{
|
||||
if (!globalScanFlag) goto haters_gonna_hate_IM;
|
||||
|
||||
tAddr.s_addr = ntohl(i);
|
||||
Corac corac;
|
||||
corac.ip = std::string(inet_ntoa(tAddr));
|
||||
corac.index = coracIndex;
|
||||
ipVec.push_back(corac);
|
||||
}
|
||||
IPRangeHolder holder;
|
||||
holder.ip1 = ip1;
|
||||
holder.ip2 = ip2;
|
||||
ipRangeVec.push_back(holder);
|
||||
}
|
||||
IPRandomizer ipRandomizer(ipRangeVec, 20000);
|
||||
|
||||
std::random_shuffle(ipVec.begin(), ipVec.end());
|
||||
for (int k = 0; k < ipVec.size(); ++k)
|
||||
{
|
||||
stt->addColoredIndex(ipVec[k].index);
|
||||
}
|
||||
|
||||
stt->doEmitionUpdatePB2();
|
||||
|
||||
while (ipVec.size() != 0) {
|
||||
++cIndex;
|
||||
//stt->doEmitionDrawPointerPB2(pointer++);
|
||||
int ip = 0;
|
||||
while ((ip = ipRandomizer.getNext()) != 0) {
|
||||
while (cons >= gThreads && globalScanFlag) Sleep(500);
|
||||
if (!globalScanFlag) goto haters_gonna_hate_IM;
|
||||
|
||||
++indexIP;
|
||||
|
||||
strcpy(currentIP, ipVec[0].ip.c_str());
|
||||
ipVec.erase(ipVec.begin());
|
||||
tAddr.s_addr = ntohl(ip);
|
||||
strcpy(currentIP, inet_ntoa(tAddr));
|
||||
verboseProgress(gTargets);
|
||||
|
||||
Threader::fireThread(currentIP, (void*(*)(void))_connect);
|
||||
}
|
||||
}
|
||||
haters_gonna_hate_IM:;
|
||||
break;
|
||||
}
|
||||
case false: {
|
||||
ip1 = (ipsstartfl[gflIndex][0] * 16777216) +
|
||||
(ipsstartfl[gflIndex][1] * 65536) +
|
||||
(ipsstartfl[gflIndex][2] * 256) +
|
||||
ipsstartfl[gflIndex][3];
|
||||
ip2 = (ipsendfl[gflIndex][0] * 16777216) +
|
||||
(ipsendfl[gflIndex][1] * 65536) +
|
||||
(ipsendfl[gflIndex][2] * 256) +
|
||||
ipsendfl[gflIndex][3];
|
||||
struct in_addr tAddr;
|
||||
for (unsigned long i = ip1; i <= ip2; ++i) {
|
||||
|
||||
// for (unsigned long i = ip1; i <= ip2; ++i) {
|
||||
while (cons >= gThreads && globalScanFlag) Sleep(500);
|
||||
if (!globalScanFlag) break;
|
||||
|
||||
// if (!globalScanFlag) break;
|
||||
++indexIP;
|
||||
|
||||
// tAddr.s_addr = ntohl(i);
|
||||
// ipVec.push_back(inet_ntoa(tAddr));
|
||||
|
||||
// if (ipVec.size() >= (gTargets > 10000 ? 10000 : gTargets)) {
|
||||
|
||||
// std::random_shuffle(ipVec.begin(), ipVec.end());
|
||||
// while (ipVec.size() != 0) {
|
||||
|
||||
// while (cons >= gThreads && globalScanFlag) Sleep(500);
|
||||
// if (!globalScanFlag) goto haters_gonna_hate_IM;
|
||||
|
||||
// ++indexIP;
|
||||
|
||||
// strcpy(currentIP, ipVec[0].c_str());
|
||||
// ipVec.erase(ipVec.begin());
|
||||
// verboseProgress(gTargets);
|
||||
|
||||
// Threader::fireThread(currentIP, (void*(*)(void))_connect);
|
||||
// }
|
||||
// }
|
||||
// }
|
||||
haters_gonna_hate_IM:;
|
||||
break;
|
||||
}
|
||||
case false: {
|
||||
ip1 = (ipsstartfl[gflIndex][0] * 16777216) +
|
||||
(ipsstartfl[gflIndex][1] * 65536) +
|
||||
(ipsstartfl[gflIndex][2] * 256) +
|
||||
ipsstartfl[gflIndex][3];
|
||||
ip2 = (ipsendfl[gflIndex][0] * 16777216) +
|
||||
(ipsendfl[gflIndex][1] * 65536) +
|
||||
(ipsendfl[gflIndex][2] * 256) +
|
||||
ipsendfl[gflIndex][3];
|
||||
struct in_addr tAddr;
|
||||
for (unsigned long i = ip1; i <= ip2; ++i) {
|
||||
|
||||
while (cons >= gThreads && globalScanFlag) Sleep(500);
|
||||
if (!globalScanFlag) break;
|
||||
|
||||
++indexIP;
|
||||
|
||||
tAddr.s_addr = ntohl(i);
|
||||
strcpy(currentIP, inet_ntoa(tAddr));
|
||||
verboseProgress(gTargets);
|
||||
Threader::fireThread(currentIP, (void*(*)(void))_connect);
|
||||
}
|
||||
break;
|
||||
};
|
||||
}
|
||||
tAddr.s_addr = ntohl(i);
|
||||
strcpy(currentIP, inet_ntoa(tAddr));
|
||||
verboseProgress(gTargets);
|
||||
Threader::fireThread(currentIP, (void*(*)(void))_connect);
|
||||
}
|
||||
break;
|
||||
};
|
||||
}
|
||||
}
|
||||
|
||||
@ -1417,9 +1362,9 @@ int thread_cleanup(void)
|
||||
return 1;
|
||||
}
|
||||
|
||||
#include "HikvisionLogin.h"
|
||||
|
||||
void MainStarter::start(const char* targets, const char* ports) {
|
||||
std::srand(std::time(NULL));
|
||||
|
||||
HikVis::hikCounter = 0;
|
||||
HikVis::rviCounter = 0;
|
||||
saveBackup = true;
|
||||
|
6
STh.cpp
6
STh.cpp
@ -7,12 +7,6 @@ void STh::doEmitionChangeBARow(int index, QString loginPass, QString percentage)
|
||||
emit stt->signalChangeBARow(index, loginPass, percentage);
|
||||
}
|
||||
|
||||
void STh::doEmitionUpdatePB2()
|
||||
{
|
||||
cIndex = 0;
|
||||
emit stt->updPB2();
|
||||
}
|
||||
|
||||
void STh::doEmitionShowRedVersion()
|
||||
{
|
||||
emit stt->showRedVersion();
|
||||
|
2
STh.h
2
STh.h
@ -51,7 +51,6 @@ public:
|
||||
static void doEmitionBlockButton(bool value);
|
||||
//BA TablelistView
|
||||
static void doEmitionChangeBARow(int index, QString loginPass, QString percentage);
|
||||
static void doEmitionUpdatePB2();
|
||||
|
||||
signals:
|
||||
public: signals: void showRedVersion();
|
||||
@ -59,7 +58,6 @@ public: signals: void startScanIP();
|
||||
public: signals: void startScanDNS();
|
||||
public: signals: void startScanImport();
|
||||
public: signals: void signalDataSaved(bool);
|
||||
public: signals : void updPB2();
|
||||
|
||||
public: signals: void changeFoundData(QString);
|
||||
public: signals: void changeRedFoundData(QString);
|
||||
|
51
nesca_3.cpp
51
nesca_3.cpp
@ -15,7 +15,6 @@
|
||||
#include <qdesktopservices.h>
|
||||
#include <qmessagebox.h>
|
||||
#include "progressbardrawer.h"
|
||||
#include "ColoredIndexBarDrawer.h"
|
||||
#include "FileDownloader.h"
|
||||
#include "HikvisionLogin.h"
|
||||
#include <QCryptographicHash>
|
||||
@ -80,7 +79,6 @@ ActivityDrawerTh_HorNet *adtHN = new ActivityDrawerTh_HorNet();
|
||||
DrawerTh_VoiceScanner *vsTh = new DrawerTh_VoiceScanner();
|
||||
PieStat *psTh = new PieStat();
|
||||
ProgressbarDrawer *pbTh = new ProgressbarDrawer();
|
||||
ColoredIndexBarDrawer *pbTh2 = new ColoredIndexBarDrawer();
|
||||
|
||||
bool MapWidgetOpened = false;
|
||||
bool globalScanFlag;
|
||||
@ -94,7 +92,6 @@ QGraphicsScene *sceneActivityGrid;
|
||||
QGraphicsScene *sceneTextPlacer;
|
||||
QGraphicsScene *sceneVoice;
|
||||
QGraphicsScene *pbScene;
|
||||
QGraphicsScene *pb2Scene;
|
||||
QGraphicsScene *jobRangeVisualScene;
|
||||
|
||||
QString importFileName = "";
|
||||
@ -154,7 +151,6 @@ int PekoWidget::m_windowCounter = 0;
|
||||
int PekoWidget::offset = 0;
|
||||
|
||||
|
||||
|
||||
int psh_lul(PIP_ADAPTER_INFO zzaza)
|
||||
{
|
||||
int chc = 0;
|
||||
@ -401,7 +397,6 @@ void setSceneArea()
|
||||
sceneTextPlacer = new QGraphicsScene();
|
||||
sceneVoice = new QGraphicsScene();
|
||||
pbScene = new QGraphicsScene();
|
||||
pb2Scene = new QGraphicsScene();
|
||||
jobRangeVisualScene = new QGraphicsScene();
|
||||
|
||||
ui->graphicLog->setScene(sceneGrid);
|
||||
@ -413,7 +408,6 @@ void setSceneArea()
|
||||
ui->graphicTextPlacer->setScene(sceneTextPlacer);
|
||||
ui->graphicsVoice->setScene(sceneVoice);
|
||||
ui->pbgv->setScene(pbScene);
|
||||
ui->pbgv_2->setScene(pb2Scene);
|
||||
ui->jobRangeVisual->setScene(jobRangeVisualScene);
|
||||
|
||||
ui->graphicLog->setSceneRect(0, 0, ui->graphicLog->width(), ui->graphicLog->height());
|
||||
@ -425,7 +419,6 @@ void setSceneArea()
|
||||
ui->graphicTextPlacer->setSceneRect(0, 0, ui->graphicTextPlacer->width(), ui->graphicTextPlacer->height());
|
||||
ui->graphicsVoice->setSceneRect(0, 0, ui->graphicsVoice->width(), ui->graphicsVoice->height());
|
||||
ui->pbgv->setSceneRect(0, 0, ui->pbgv->width(), ui->pbgv->height());
|
||||
ui->pbgv_2->setSceneRect(0, 0, ui->pbgv_2->width(), ui->pbgv_2->height());
|
||||
ui->jobRangeVisual->setSceneRect(0, 0, ui->jobRangeVisual->width(), ui->jobRangeVisual->height());
|
||||
|
||||
|
||||
@ -2101,40 +2094,6 @@ void nesca_3::slotPBUpdate()
|
||||
pbScene->addLine(4, 77, 6, 77, pbPen);
|
||||
pbScene->addLine(4, 88, 6, 88, pbPen);
|
||||
}
|
||||
#include <unordered_map>
|
||||
std::unordered_map<int, QColor> colorMap = {
|
||||
{ 0, QColor("#DC143C") },
|
||||
{ 1, QColor("#000080") },
|
||||
{ 2, QColor("#3CB371") },
|
||||
{ 3, QColor("#20B2AA") },
|
||||
{ 4, QColor("#00BFFF") },
|
||||
{ 5, QColor("#DEB887") }
|
||||
};
|
||||
int ciSz = 1;
|
||||
void nesca_3::slotPB2Update()
|
||||
{
|
||||
pb2Scene->clear();
|
||||
QList<int> cIndexes = stt->getColoredIndexes();
|
||||
|
||||
ciSz = cIndexes.size();
|
||||
int percValue = ciSz / 100;
|
||||
|
||||
for (int i = 0, j = 0; i < ciSz; i += percValue, j++) {
|
||||
int val = ciSz - i;
|
||||
if (val < percValue) {
|
||||
percValue = val;
|
||||
}
|
||||
pb2Scene->addLine(0, j, 26, j, colorMap[cIndexes[i]]);
|
||||
}
|
||||
}
|
||||
|
||||
void nesca_3::slotPB2DrawPointer(int pointer) {
|
||||
QGraphicsRectItem* rect = new QGraphicsRectItem(0, 0, 26, pointer);
|
||||
rect->setBrush(QBrush(QColor(0, 0, 0, 100)));
|
||||
pb2Scene->addItem(rect);
|
||||
//pb2Scene->addRect(0, pointer, 26, pointer, QColor(255, 255, 255, 160));
|
||||
pb2Scene->addLine(0, pointer, 26, pointer, QColor(255, 255, 255, 255));
|
||||
}
|
||||
void nesca_3::changeNSTrackLabel(bool status)
|
||||
{
|
||||
if(status) ui->NSTrackStatusLabel->setStyleSheet("background-color: green; border: 1px solid white;");
|
||||
@ -2255,8 +2214,6 @@ void nesca_3::ConnectEvrthng()
|
||||
{
|
||||
connect(stt, SIGNAL(signalBlockButton(bool)), this, SLOT(slotBlockButtons(bool)));
|
||||
connect(pbTh, SIGNAL(upd()), this, SLOT(slotPBUpdate()));
|
||||
connect(stt, SIGNAL(updPB2()), this, SLOT(slotPB2Update()));
|
||||
connect(pbTh2, SIGNAL(drawPointerPB2(int)), this, SLOT(slotPB2DrawPointer(int)));
|
||||
connect ( ui->secretMessageBut_1, SIGNAL( clicked() ), this, SLOT( smReaction() ) );
|
||||
connect ( ui->secretMessageBut_2, SIGNAL( clicked() ), this, SLOT( smReaction() ) );
|
||||
connect ( ui->secretMessageBut_3, SIGNAL( clicked() ), this, SLOT( smReaction() ) );
|
||||
@ -2691,7 +2648,6 @@ void nesca_3::trayButtonClicked()
|
||||
void nesca_3::ChangeShuffle(bool val)
|
||||
{
|
||||
gShuffle = val;
|
||||
ui->pbgv_2->setVisible(val);
|
||||
}
|
||||
|
||||
void nesca_3::ChangeTrackerOK(bool val)
|
||||
@ -3007,7 +2963,6 @@ void nesca_3::ImportScanSeq()
|
||||
|
||||
startFlag = true;
|
||||
pbTh->start();
|
||||
pbTh2->start();
|
||||
ui->importButton->setText("Stop");
|
||||
ui->importButton->setStyleSheet(
|
||||
" #importButton {"
|
||||
@ -3176,9 +3131,9 @@ void nesca_3::finishLoading() {
|
||||
|
||||
CreateVerFile();
|
||||
|
||||
dtHN->start();
|
||||
dtME2->start();
|
||||
adtHN->start();
|
||||
//dtHN->start();
|
||||
//dtME2->start();
|
||||
//adtHN->start();
|
||||
|
||||
|
||||
#if defined(WIN32) || defined(_WIN32) || defined(__WIN32) && !defined(__CYGWIN__)
|
||||
|
@ -65,8 +65,6 @@ protected:
|
||||
void ChangePingerOK(bool val);
|
||||
void changeNSTrackLabel(bool status);
|
||||
void slotPBUpdate();
|
||||
void slotPB2Update();
|
||||
void slotPB2DrawPointer(int pointer);
|
||||
void DNSLine_ValueChanged();
|
||||
void slotShowRedVersion();
|
||||
void slotTabChanged(int index);
|
||||
|
23
nesca_3.ui
23
nesca_3.ui
@ -963,28 +963,7 @@ color: rgb(214, 214, 0);</string>
|
||||
<widget class="QGraphicsView" name="pbgv">
|
||||
<property name="geometry">
|
||||
<rect>
|
||||
<x>451</x>
|
||||
<y>20</y>
|
||||
<width>26</width>
|
||||
<height>102</height>
|
||||
</rect>
|
||||
</property>
|
||||
<property name="styleSheet">
|
||||
<string notr="true">background-color:rgb(38, 38, 38);
|
||||
border: 1px solid rgb(227, 227, 227);
|
||||
border-radius: 3px;</string>
|
||||
</property>
|
||||
<property name="verticalScrollBarPolicy">
|
||||
<enum>Qt::ScrollBarAlwaysOff</enum>
|
||||
</property>
|
||||
<property name="horizontalScrollBarPolicy">
|
||||
<enum>Qt::ScrollBarAlwaysOff</enum>
|
||||
</property>
|
||||
</widget>
|
||||
<widget class="QGraphicsView" name="pbgv_2">
|
||||
<property name="geometry">
|
||||
<rect>
|
||||
<x>420</x>
|
||||
<x>440</x>
|
||||
<y>20</y>
|
||||
<width>26</width>
|
||||
<height>102</height>
|
||||
|
Loading…
Reference in New Issue
Block a user