nesca/nesca_3.cpp

3035 lines
95 KiB
C++
Raw Normal View History

2015-03-10 14:35:50 +00:00
#include <QGridLayout>
2015-02-24 14:00:19 +00:00
#include <QFileDialog>
#include "nesca_3.h"
#include "CheckKey_Th.h"
#include "DrawerTh_QoSScanner.h"
#include "STh.h"
#include "msgcheckerthread.h"
#include "vercheckerthread.h"
#include "DrawerTh_HorNet.h"
#include "ActivityDrawerTh_HorNet.h"
#include "DrawerTh_GridQoSScanner.h"
#include "DrawerTh_ME2Scanner.h"
#include "DrawerTh_VoiceScanner.h"
#include "piestat.h"
#include <QMenu>
#include <QGraphicsSceneContextMenuEvent>
#include <QDesktopWidget>
2015-02-26 14:20:37 +00:00
#include <QtMultimedia/qsound.h>
#include <QtMultimedia/qsoundeffect.h>
2015-02-24 14:00:19 +00:00
#include <qscrollbar.h>
#include <qdesktopservices.h>
#include <qmessagebox.h>
#include "progressbardrawer.h"
#include "externFunctions.h"
#include "externData.h"
2015-03-18 14:28:39 +00:00
#include "Threader.h"
2015-02-24 14:00:19 +00:00
QDate date = QDate::currentDate();
int ver = 100*(100*(date.year()%100) + date.month()) + date.day();
#define VER 130706
#define WIDGET_WIDTH 500
bool HTMLDebugMode = false;
bool code160 = false;
bool gDebugMode = false;
bool gNegDebugMode = false;
bool smBit_1 = false;
bool smBit_2 = false;
bool smBit_3 = false;
bool smBit_4 = false;
bool smBit_5 = false;
bool smBit_6 = false;
bool smBit_7 = false;
bool smBit_8 = false;
bool privateMsgFlag = false;
char inputStr[256] = {0};
bool proxyEnabledFlag = false;
bool disableBlink = false;
2015-03-24 11:15:38 +00:00
char gVER[32] = {0};
2015-02-24 14:00:19 +00:00
int nickFlag;
int offlineFlag;
bool OnlineMsgSentFlag = false;
int globalPinger = 0;
2015-03-20 14:28:51 +00:00
int nesca_3::savedTabIndex = 0;
2015-02-24 14:00:19 +00:00
bool dFlag = false;
bool startFlag = false;
bool trackerOK = true;
char trcPort[32] = {0};
char trcSrvPortLine[32] = {0};
char trcProxy[128] = {0};
char trcSrv[256] = {0};
char trcScr[256] = {0};
2015-03-10 14:35:50 +00:00
char trcPersKey[64] = {0};
2015-03-06 14:32:36 +00:00
char gProxyIP[64] = {0};
char gProxyPort[8] = {0};
2015-02-24 14:00:19 +00:00
SOCKET lSock;
VerCheckerThread *vct = new VerCheckerThread();
MSGCheckerThread *mct = new MSGCheckerThread();
STh *stt = new STh();
DrawerTh_HorNet *dtHN = new DrawerTh_HorNet();
DrawerTh_ME2Scanner *dtME2 = new DrawerTh_ME2Scanner();
DrawerTh_QoSScanner *dtQoS = new DrawerTh_QoSScanner();
DrawerTh_GridQoSScanner *dtGridQoS = new DrawerTh_GridQoSScanner();
CheckKey_Th *chKTh = new CheckKey_Th();
ActivityDrawerTh_HorNet *adtHN = new ActivityDrawerTh_HorNet();
DrawerTh_VoiceScanner *vsTh = new DrawerTh_VoiceScanner();
2015-03-23 12:52:07 +00:00
//IRC_NMBlinker *irc_nmb = new IRC_NMBlinker();
2015-02-24 14:00:19 +00:00
PieStat *psTh = new PieStat();
ProgressbarDrawer *pbTh = new ProgressbarDrawer();
bool MapWidgetOpened = false;
bool globalScanFlag;
float QoSStep = 1;
int MaxDataVal = 1;
QGraphicsScene *sceneGrid;
QGraphicsScene *sceneGrid2;
QGraphicsScene *sceneGraph;
QGraphicsScene *sceneUpper;
QGraphicsScene *sceneActivity;
QGraphicsScene *sceneActivityGrid;
QGraphicsScene *sceneTextPlacer;
QGraphicsScene *sceneVoice;
QGraphicsScene *pbScene;
QGraphicsScene *jobRangeVisualScene;
QString importFileName = "";
QSystemTrayIcon *tray;
QTextCodec *codec = QTextCodec::codecForName("Windows-1251");
QWidget *qwm;
PopupMsgWidget *msgWdgt;
QPen rpen(QColor(255, 0, 0, 190), 0.1, Qt::DotLine);
QPen pen(QColor(130, 130, 130), 0.1, Qt::DotLine);
QPen pen2(QColor(130, 130, 130), 0.5);
QPen penQoS0(QColor(255, 255, 255), 0.8);
QPen penQoS1(QColor(255, 0, 0), 0.9);
QPen penQoS2(QColor(0, 255, 0), 0.8);
QPen penQoS3(QColor(255, 85, 0), 0.8); //orange
QPen penQoS4(QColor(255, 0, 255), 0.8); //violet
QPen penQoS5(QColor(0, 0, 255), 0.8);
QPen penQoS6(QColor(82,180,229), 0.8); //sky-blue
QPen penQoS7(QColor(85,0,0), 0.8); //dRed
QPen penQoSWhite(QColor(255,255,255), 0.2);
QPen penQoSBlack(QColor(0,0,0), 0.3);
QPen penBlack(QColor(0,0,0));
QPen pen2i;
QVector<QGraphicsPathItem*> vectOld;
QList<int> lstOfLabels;
QVector<int> actLst;
QVector<int> vAlivLst;
QVector<int> vAnomLst;
QVector<int> vWFLst;
QVector<int> vSuspLst;
QVector<int> vLowlLst;
QVector<int> vBALst;
QVector<int> vSSHLst;
QVector<int> vOvrlLst;
QMenu *menuPS;
QVector<QRect> NodeDots;
QVector<QString> NodeAddrs;
const nesca_3 *gthis;
bool BALogSwitched = false;
bool widgetIsHidden = false;
bool blinkFlag = false;
bool printDelimiter = false;
int PhraseIndex = 0;
QList<QString> PhraseLog;
bool ME2ScanFlag = true, QoSScanFlag = false, VoiceScanFlag = false, PieStatFlag = false;
Ui::nesca_3Class *ui = new Ui::nesca_3Class;
void setSceneArea()
{
delete ui->graphicsVoice;
ui->graphicsVoice = new PieStatView(ui->widget);
ui->graphicsVoice->setObjectName(QStringLiteral("graphicsVoice"));
ui->graphicsVoice->setGeometry(QRect(220, 265, 270, 100));
ui->graphicsVoice->setStyleSheet(QStringLiteral("border:1px solid white;background-color: rgba(26, 26,26, 0);"));
ui->graphicsVoice->setVerticalScrollBarPolicy(Qt::ScrollBarAlwaysOff);
ui->graphicsVoice->setHorizontalScrollBarPolicy(Qt::ScrollBarAlwaysOff);
ui->graphicsVoice->setRenderHints(QPainter::TextAntialiasing);
ui->graphicsVoice->setCacheMode(QGraphicsView::CacheNone);
ui->graphicsVoice->raise();
sceneGrid = new QGraphicsScene();
sceneGrid2 = new QGraphicsScene();
sceneGraph = new QGraphicsScene();
sceneUpper = new QGraphicsScene();
2015-03-01 12:01:24 +00:00
sceneUpper->setSceneRect(0, 0, ui->graphicLog_Upper->width(), ui->graphicLog_Upper->height());
sceneGrid->setSceneRect(0, 0, ui->graphicLog_Upper->width(), ui->graphicLog_Upper->height());
2015-03-07 17:31:48 +00:00
QLinearGradient gradient(0, 0, 0, 94);
gradient.setColorAt(0, QColor(255, 0, 0));
gradient.setColorAt(0.7, QColor(255, 0, 0));
gradient.setColorAt(0.85, QColor(255, 255, 0));
gradient.setColorAt(0.9, QColor(0, 255, 0));
gradient.setColorAt(1, QColor(255, 255, 255, 60));
pen2i.setBrush(gradient);
sceneGraph->setItemIndexMethod(QGraphicsScene::NoIndex);
2015-02-24 14:00:19 +00:00
sceneActivity = new QGraphicsScene();
sceneActivityGrid = new QGraphicsScene();
sceneTextPlacer = new QGraphicsScene();
sceneVoice = new QGraphicsScene();
pbScene = new QGraphicsScene();
jobRangeVisualScene = new QGraphicsScene();
ui->graphicLog->setScene(sceneGrid);
ui->graphicLog_2->setScene(sceneGraph);
ui->graphicDelim->setScene(sceneGrid2);
ui->graphicLog_Upper->setScene(sceneUpper);
ui->graphicActivity->setScene(sceneActivity);
ui->graphicActivityGrid->setScene(sceneActivityGrid);
ui->graphicTextPlacer->setScene(sceneTextPlacer);
ui->graphicsVoice->setScene(sceneVoice);
ui->pbgv->setScene(pbScene);
ui->jobRangeVisual->setScene(jobRangeVisualScene);
ui->graphicLog->setSceneRect(0, 0, ui->graphicLog->width(), ui->graphicLog->height());
ui->graphicLog_2->setSceneRect(0, 0, ui->graphicLog_2->width(), ui->graphicLog_2->height());
ui->graphicDelim->setSceneRect(0, 0, ui->graphicDelim->width(), ui->graphicDelim->height());
ui->graphicLog_Upper->setSceneRect(0, 0, ui->graphicLog_Upper->width(), ui->graphicLog_Upper->height());
ui->graphicActivity->setSceneRect(0, 0, ui->graphicActivity->width(), ui->graphicActivity->height());
ui->graphicActivityGrid->setSceneRect(0, 0, ui->graphicActivityGrid->width(), ui->graphicActivityGrid->height());
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->jobRangeVisual->setSceneRect(0, 0, ui->jobRangeVisual->width(), ui->jobRangeVisual->height());
2015-02-27 13:55:35 +00:00
}
2015-02-24 14:00:19 +00:00
void setButtonStyleArea()
{
ui->checkKeyBut->setStyleSheet(
" #checkKeyBut {"
"background-color: qlineargradient(spread:none, x1:1, y1:0, x2:1, y2:1, stop:0.681818 rgba(0, 0, 0, 250), stop:1 rgba(255, 255, 255, 130));"
"color: #00b304;"
"border: 0.5px solid qlineargradient(spread:reflect, x1:0.54, y1:0.488591, x2:0.54, y2:0, stop:0 rgba(255, 255, 255, 130), stop:1 rgba(0, 0, 0, 255));"
"}"
" #checkKeyBut:hover{"
"background-color: qlineargradient(spread:none, x1:1, y1:0, x2:1, y2:1, stop:0.681818 rgba(0, 0, 0, 250), stop:1 rgba(255, 255, 255, 130));"
"color: #1efd00;"
"border: 0.5px solid qlineargradient(spread:reflect, x1:0.54, y1:0.488591, x2:0.54, y2:0, stop:0 rgba(255, 255, 255, 130), stop:1 rgba(0, 0, 0, 255));"
"}"
);
ui->importButton->setStyleSheet(
" #importButton {"
"background-color: qlineargradient(spread:none, x1:1, y1:0, x2:1, y2:1, stop:0.681818 rgba(0, 0, 0, 250), stop:1 rgba(255, 255, 255, 130));"
"color: #00b304;"
"border: 0.5px solid qlineargradient(spread:reflect, x1:0.54, y1:0.488591, x2:0.54, y2:0, stop:0 rgba(255, 255, 255, 130), stop:1 rgba(0, 0, 0, 255));"
"}"
" #importButton:hover{"
"background-color: qlineargradient(spread:none, x1:1, y1:0, x2:1, y2:1, stop:0.681818 rgba(0, 0, 0, 250), stop:1 rgba(255, 255, 255, 130));"
"color: #1efd00;"
"border: 0.5px solid qlineargradient(spread:reflect, x1:0.54, y1:0.488591, x2:0.54, y2:0, stop:0 rgba(255, 255, 255, 130), stop:1 rgba(0, 0, 0, 255));"
"}"
);
ui->startScanButton_3->setStyleSheet(
" #startScanButton_3 {"
"background-color: qlineargradient(spread:none, x1:1, y1:0, x2:1, y2:1, stop:0.681818 rgba(0, 0, 0, 250), stop:1 rgba(255, 255, 255, 130));"
"color: #919191;"
"border: 0.5px solid qlineargradient(spread:reflect, x1:0.54, y1:0.488591, x2:0.54, y2:0, stop:0 rgba(255, 255, 255, 130), stop:1 rgba(0, 0, 0, 255));"
"}"
" #startScanButton_3:hover{"
"background-color: qlineargradient(spread:none, x1:1, y1:0, x2:1, y2:1, stop:0.681818 rgba(0, 0, 0, 250), stop:1 rgba(255, 255, 255, 130));"
"color: #D1D1D1;"
"border: 0.5px solid qlineargradient(spread:reflect, x1:0.54, y1:0.488591, x2:0.54, y2:0, stop:0 rgba(255, 255, 255, 130), stop:1 rgba(0, 0, 0, 255));"
"}"
);
ui->startScanButton_4->setStyleSheet(
" #startScanButton_4 {"
"background-color: qlineargradient(spread:none, x1:1, y1:0, x2:1, y2:1, stop:0.681818 rgba(0, 0, 0, 250), stop:1 rgba(255, 255, 255, 130));"
"color: #919191;"
"border: 0.5px solid qlineargradient(spread:reflect, x1:0.54, y1:0.488591, x2:0.54, y2:0, stop:0 rgba(255, 255, 255, 130), stop:1 rgba(0, 0, 0, 255));"
"}"
" #startScanButton_4:hover{"
"background-color: qlineargradient(spread:none, x1:1, y1:0, x2:1, y2:1, stop:0.681818 rgba(0, 0, 0, 250), stop:1 rgba(255, 255, 255, 130));"
"color: #D1D1D1;"
"border: 0.5px solid qlineargradient(spread:reflect, x1:0.54, y1:0.488591, x2:0.54, y2:0, stop:0 rgba(255, 255, 255, 130), stop:1 rgba(0, 0, 0, 255));"
"}"
);
2015-02-27 13:55:35 +00:00
}
2015-02-24 14:00:19 +00:00
void setSomeStyleArea()
{
qApp->setStyleSheet(
"QMenu{"
"color:rgb(216, 216, 216);background-color: rgb(26, 26, 26); border: 1px solid white;"
"}"
".a{"
"color:rgb(216, 216, 216);background-color: rgb(26, 26, 26); border: 1px solid white;"
"}"
"QMenu::item {"
"padding: 2px 25px 2px 25px;"
"border: 1px solid transparent;"
"}"
"QMenu::item:disabled {"
"color:rgb(35, 35, 35);background-color: rgb(26, 26, 26); border: 1px solid white;"
"padding: 2px 25px 2px 25px;"
"border: 1px solid transparent;"
"}"
"QMenu::item:selected:enabled {"
"color:rgb(255, 255, 255);background-color: rgb(26, 26, 26); border: 1px solid white;"
"border-color: rgb(250, 170, 60);"
"background: rgba(250, 170, 60, 50);"
"}"
"QMenu::item:selected:disabled {"
"color:rgb(35, 35, 35);background-color: rgb(26, 26, 26); border: 1px solid white;"
"border-color: rgb(250, 170, 60);"
"background: rgba(250, 170, 60, 50);"
"}"
"QMenu::separator {"
"height: 2px;"
"margin-left: 25px;"
"}"
"QMenu::indicator {"
"width: 13px;"
"height: 13px;"
"}"
" #widget {"
"border: 1px solid #525252;"
"border-radius: 0px;"
"}"
" #exitButton {"
"color: #525252;"
"border: 0px solid black;"
"}"
" #exitButton:hover {"
"color: red;"
"border: 0px solid black;"
"}"
" #exitButton:pressed {"
"color: maroon;"
"border: 0px solid black;"
"}"
" #trayButton {"
"color: #525252;"
"border: 0px solid black;"
"}"
" #trayButton:hover {"
"color: red;"
"border: 0px solid black;"
"}"
" #trayButton:pressed {"
"color: maroon;"
"border: 0px solid black;"
"}"
" #exitButton_2 {"
"color: #525252;"
"border: 0px solid black;"
"}"
" #exitButton_2:hover {"
"color: red;"
"border: 0px solid black;"
"}"
" #exitButton_2:pressed {"
"color: maroon;"
"border: 0px solid black;"
"}"
" QLineEdit {"
"border: 1px solid #525252 !important;"
"border-radius: 0px !important;"
"padding: 0 8px !important;"
"background: yellow !important;"
"selection-background-color: darkgray !important;"
"}"
"QTabBar::tab {"
"color: white;"
"border: 1px solid #C4C4C3;"
"border-bottom-color: #C2C7CB;"
"border-top-left-radius: 4px;"
"border-top-right-radius: 4px;"
"padding: 1px 3px;"
"margin-left: 1px;"
"margin-bottom: 4px;"
"}"
"QTabBar::tab:selected {"
"color: black;"
"background-color: #505050;"
"}"
"QCheckBox::indicator:unchecked"
"{"
"background-color:black;"
"border: 1px solid #313131;"
"}"
"QCheckBox::indicator:checked"
"{"
"background-color: qradialgradient(spread:pad, cx:0.5, cy:0.5, radius:0.5, fx:0.5, fy:0.500318, stop:0.107955 rgba(255, 255, 255, 255), stop:0.204545 rgba(255, 255, 255, 0));"
"border: 1px solid #313131;"
"}"
);
setButtonStyleArea();
2015-02-27 13:55:35 +00:00
}
2015-02-24 14:00:19 +00:00
void SetValidators()
{
QRegExpValidator *validator = new QRegExpValidator(
QRegExp("([\\d*|.|//|-])+"),
NULL
);
ui->ipLine->setValidator(validator);
validator = new QRegExpValidator(QRegExp("(\\d{1,5}[,|-]\\s{0,1})+"), NULL);
ui->portLine->setValidator(validator);
ui->lineEditPort->setValidator(validator);
validator = new QRegExpValidator(QRegExp("\\d{1,3}"), NULL);
ui->importThreads->setValidator(validator);
ui->threadLine->setValidator(validator);
ui->lineEditThread->setValidator(validator);
ui->iptoLine_value->setValidator(validator);
ui->iptoLine_value_2->setValidator(validator);
ui->iptoLine_value_3->setValidator(validator);
ui->maxBrutingThrBox->setValidator(validator);
validator = new QRegExpValidator(QRegExp("\\d{1,5}"), NULL);
ui->PingTO->setValidator(validator);
ui->threadDelayBox->setValidator(validator);
validator = new QRegExpValidator(QRegExp("(\\w|-|\\.|\\[|\\]|\\\\)+"), NULL);
ui->lineEditStartIPDNS->setValidator(validator);
validator = new QRegExpValidator(QRegExp("(\\w|-|\\.)+((\\w|-|\\.)+)+"), NULL);
ui->lineILVL->setValidator(validator);
2015-03-23 12:52:07 +00:00
validator = new QRegExpValidator(QRegExp("\\d{1,5}"), NULL);
2015-02-24 14:00:19 +00:00
ui->trcSrvPortLine->setValidator(validator);
validator = new QRegExpValidator(QRegExp("[a-zA-Z0-9]{32}"), NULL);
ui->linePersKey->setValidator(validator);
2015-02-27 13:55:35 +00:00
}
2015-02-24 14:00:19 +00:00
void nesca_3::slotDrawTextPlacers()
{
QFont fnt;
fnt.setFamily("Eurostile");
if(ME2ScanFlag)
{
2015-02-27 13:55:35 +00:00
delete sceneTextPlacer;
2015-02-24 14:00:19 +00:00
sceneTextPlacer = NULL;
sceneTextPlacer = new QGraphicsScene();
ui->graphicTextPlacer->setScene(sceneTextPlacer);
sceneTextPlacer->clear();
QPen penPT(QColor(255, 255, 255), 0.5, Qt::SolidLine, Qt::SquareCap, Qt::RoundJoin);
ui->RedLabel->setVisible(false);
ui->GreenLabel->setVisible(false);
ui->CyanLabel->setVisible(false);
ui->BlueLabel->setVisible(false);
ui->PinkLabel->setVisible(false);
ui->YellowLabel->setVisible(false);
ui->WhiteLabel->setVisible(false);
ui->DredLabel->setVisible(false);
ui->labelAnomaly->setVisible(false);
ui->labelBA->setVisible(false);
ui->labelFiltered->setVisible(false);
ui->labelBads->setVisible(false);
ui->labelLowloads->setVisible(false);
ui->labelOverloads->setVisible(false);
ui->labelAlives->setVisible(false);
ui->labelSSH->setVisible(false);
fnt.setPixelSize(10);
sceneTextPlacer->addLine(85, 110, 90, 100, penPT);
sceneTextPlacer->addLine(23, 110, 83, 110, penPT);
2015-03-28 05:30:41 +00:00
int linuxOffsetKOSTYL = 0;
2015-03-24 14:29:27 +00:00
#if (!defined(WIN32) && !defined(_WIN32) && !defined(__WIN32)) || defined(__CYGWIN__)
2015-03-28 05:30:41 +00:00
linuxOffsetKOSTYL = 3;
2015-03-24 14:29:27 +00:00
#endif
QGraphicsTextItem *item = sceneTextPlacer->addText("- Anomalies", fnt);
2015-02-24 14:00:19 +00:00
item->setX(25);
2015-03-24 14:29:27 +00:00
item->setY(94+linuxOffsetKOSTYL);
2015-02-24 14:00:19 +00:00
item->setDefaultTextColor(QColor(255, 255, 255, 180));
sceneTextPlacer->addLine(118, 120, 130, 100, penPT);
sceneTextPlacer->addLine(23, 121, 117, 121, penPT);
2015-03-24 14:29:27 +00:00
item = sceneTextPlacer->addText("- Webforms", fnt);
2015-02-24 14:00:19 +00:00
item->setX(25);
2015-03-24 14:29:27 +00:00
item->setY(105+linuxOffsetKOSTYL);
2015-02-24 14:00:19 +00:00
item->setDefaultTextColor(QColor(255, 255, 255, 180));
sceneTextPlacer->addLine(155, 130, 170, 100, penPT);
sceneTextPlacer->addLine(23, 131, 154, 131, penPT);
2015-03-24 14:29:27 +00:00
item = sceneTextPlacer->addText("- Basic Auth", fnt);
2015-02-24 14:00:19 +00:00
item->setX(25);
2015-03-24 14:29:27 +00:00
item->setY(115+linuxOffsetKOSTYL);
2015-02-24 14:00:19 +00:00
item->setDefaultTextColor(QColor(255, 255, 255, 180));
sceneTextPlacer->addLine(190, 140, 210, 100, penPT);
sceneTextPlacer->addLine(23, 141, 189, 141, penPT);
item = sceneTextPlacer->addText("- Suspicious", fnt);
item->setX(25);
2015-03-24 14:29:27 +00:00
item->setY(125+linuxOffsetKOSTYL);
2015-02-24 14:00:19 +00:00
item->setDefaultTextColor(QColor(255, 255, 255, 180));
sceneTextPlacer->addLine(230, 150, 250, 100, penPT);
sceneTextPlacer->addLine(23, 151, 229, 151, penPT);
item = sceneTextPlacer->addText("- Overloads", fnt);
item->setX(25);
2015-03-24 14:29:27 +00:00
item->setY(135+linuxOffsetKOSTYL);
2015-02-24 14:00:19 +00:00
item->setDefaultTextColor(QColor(255, 255, 255, 180));
sceneTextPlacer->addLine(270, 160, 290, 100, penPT);
sceneTextPlacer->addLine(23, 161, 269, 161, penPT);
item = sceneTextPlacer->addText("- Lowloads", fnt);
item->setX(25);
2015-03-24 14:29:27 +00:00
item->setY(145+linuxOffsetKOSTYL);
2015-02-24 14:00:19 +00:00
item->setDefaultTextColor(QColor(255, 255, 255, 180));
sceneTextPlacer->addLine(310, 170, 330, 100, penPT);
sceneTextPlacer->addLine(23, 171, 309, 171, penPT);
2015-03-24 14:29:27 +00:00
item = sceneTextPlacer->addText("- Alive", fnt);
2015-02-24 14:00:19 +00:00
item->setX(25);
2015-03-24 14:29:27 +00:00
item->setY(155+linuxOffsetKOSTYL);
2015-02-24 14:00:19 +00:00
item->setDefaultTextColor(QColor(255, 255, 255, 180));
}
else if(VoiceScanFlag)
{
2015-02-27 13:55:35 +00:00
sceneTextPlacer->clear();
2015-02-24 14:00:19 +00:00
fnt.setPixelSize(8);
int h = ui->graphicLog->height();
2015-02-27 13:55:35 +00:00
delete sceneTextPlacer;
2015-02-24 14:00:19 +00:00
sceneTextPlacer = NULL;
sceneTextPlacer = new QGraphicsScene();
ui->graphicTextPlacer->setScene(sceneTextPlacer);
for(int i = 0; i < h; i += 10)
{
QGraphicsTextItem *item = sceneTextPlacer->addText(QString::number(i/10 + 1) + "-", fnt);
if(i != 90) item->setX(46);
else item->setX(42);
item->setY(h - i - 11);
item->setDefaultTextColor(QColor(255, 255, 255, 180));
};
};
2015-02-27 13:55:35 +00:00
}
2015-02-24 14:00:19 +00:00
void nesca_3::slotDrawDelimLines()
{
int gHeight = ui->graphicLog->height();
QPen penDelim(QColor(255, 0, 0), 0.5);
QPen penDelim2(QColor(255, 0, 0, 60), 1);
QLinearGradient gradient(0, 0, 0, 100);
gradient.setColorAt(0, QColor(255,0,0, 60));
gradient.setColorAt(0.5, QColor(255,0,0, 40));
gradient.setColorAt(1, QColor(255,0,0, 0));
penDelim2.setBrush(gradient);
sceneGrid2->addLine(33, gHeight, 33, gHeight - 3, penDelim);
sceneGrid2->addLine(73, gHeight, 73, gHeight - 3, penDelim);
sceneGrid2->addLine(113, gHeight, 113, gHeight - 3, penDelim);
sceneGrid2->addLine(153, gHeight, 153, gHeight - 3, penDelim);
sceneGrid2->addLine(193, gHeight, 193, gHeight - 3, penDelim);
sceneGrid2->addLine(233, gHeight, 233, gHeight - 3, penDelim);
sceneGrid2->addRect(1, 0, 31, gHeight - 3, penDelim2);
sceneGrid2->addRect(34, 0, 38, gHeight - 3, penDelim2);
sceneGrid2->addRect(74, 0, 38, gHeight - 3, penDelim2);
sceneGrid2->addRect(114, 0, 38, gHeight - 3, penDelim2);
sceneGrid2->addRect(154, 0, 38, gHeight - 3, penDelim2);
sceneGrid2->addRect(194, 0, 38, gHeight - 3, penDelim2);
sceneGrid2->addRect(234, 0, 35, gHeight - 3, penDelim2);
2015-02-27 13:55:35 +00:00
}
2015-02-24 14:00:19 +00:00
QList<int> gLOL0;
QList<int> gLOL1;
QList<int> gLOL2;
QList<int> gLOL3;
QList<int> gLOL4;
QList<int> gLOL5;
QList<int> gLOL6;
QList<int> gLOL7;
bool QOSWait = false;
void nesca_3::slotQoSAddLine()
{
QOSWait = true;
sceneGraph->clear();
sceneGrid2->clear();
sceneUpper->clear();
2015-02-27 13:55:35 +00:00
float gHeight = ui->graphicLog->height();
2015-02-24 14:00:19 +00:00
float fact = (float)100 / (float)MaxDataVal;
if(QoSStep > 268)
{
MaxDataVal = 1;
QoSStep = 1;
gLOL0.clear();
gLOL1.clear();
gLOL2.clear();
gLOL3.clear();
gLOL4.clear();
gLOL5.clear();
gLOL6.clear();
gLOL7.clear();
};
gLOL0.push_back(lstOfLabels[0]);
gLOL1.push_back(lstOfLabels[1]);
gLOL2.push_back(lstOfLabels[2]);
gLOL3.push_back(lstOfLabels[3]);
gLOL4.push_back(lstOfLabels[4]);
gLOL5.push_back(lstOfLabels[5]);
gLOL6.push_back(lstOfLabels[6]);
gLOL7.push_back(lstOfLabels[7]);
int d0;
int d1;
int d2;
int d3;
int d4;
int d5;
int d6;
int d7;
for(int QoSStepi = 0; QoSStepi < QoSStep; ++QoSStepi)
{
if(QoSStepi < gLOL0.size()
&& QoSStepi < gLOL1.size()
&& QoSStepi < gLOL2.size()
&& QoSStepi < gLOL3.size()
&& QoSStepi < gLOL4.size()
&& QoSStepi < gLOL5.size()
&& QoSStepi < gLOL6.size()
&& QoSStepi < gLOL7.size()
)
{
d0 = gHeight - gLOL0[QoSStepi] * fact - 1;
d1 = gHeight - gLOL1[QoSStepi] * fact - 1;
d2 = gHeight - gLOL2[QoSStepi] * fact - 1;
d3 = gHeight - gLOL3[QoSStepi] * fact - 1;
d4 = gHeight - gLOL4[QoSStepi] * fact - 1;
d5 = gHeight - gLOL5[QoSStepi] * fact - 1;
d6 = gHeight - gLOL6[QoSStepi] * fact - 1;
d7 = gHeight - gLOL7[QoSStepi] * fact - 1;
sceneGraph->addLine(QoSStepi, gHeight, QoSStepi, d0, penQoS0);
sceneGraph->addLine(QoSStepi, gHeight, QoSStepi, d1, penQoS1);
sceneGraph->addLine(QoSStepi, gHeight, QoSStepi, d2, penQoS2);
sceneGraph->addLine(QoSStepi, gHeight, QoSStepi, d3, penQoS3);
sceneGraph->addLine(QoSStepi, gHeight, QoSStepi, d4, penQoS4);
sceneGraph->addLine(QoSStepi, gHeight, QoSStepi, d5, penQoS5);
sceneGraph->addLine(QoSStepi, gHeight, QoSStepi, d6, penQoS6);
sceneGraph->addLine(QoSStepi, gHeight, QoSStepi, d7, penQoS7);
};
};
QFont fnt;
fnt.setFamily("Eurostile");
fnt.setPixelSize(10);
2015-03-10 14:35:50 +00:00
QGraphicsTextItem *item = sceneUpper->addText("Max = " + QString::number(MaxDataVal), fnt);
2015-02-24 14:00:19 +00:00
item->setX(215);
item->setDefaultTextColor(Qt::white);
QOSWait = false;
2015-02-27 13:55:35 +00:00
}
2015-02-24 14:00:19 +00:00
void nesca_3::slotQoSAddGrid()
{
sceneGrid->clear();
2015-02-27 13:55:35 +00:00
int gWidth = ui->graphicLog->width();
2015-02-24 14:00:19 +00:00
if(MaxDataVal > 100) MaxDataVal = 100;
float fact = (float)100/(float)MaxDataVal;
float th = 0;
for(int i = 0; i < 100; ++i)
{
th += fact;
sceneGrid->addLine(0, th, gWidth, th, rpen);
};
2015-02-27 13:55:35 +00:00
}
2015-02-24 14:00:19 +00:00
void nesca_3::slotAddLine(int x1, int y1, int x2, int y2)
{
sceneGrid->addLine(x1, y1, x2, y2, pen);
if(sceneGrid->items().size() > 10)
{
sceneGrid->removeItem(vectOld[10]);
sceneGrid->items().pop_back();
};
2015-02-27 13:55:35 +00:00
}
2015-02-24 14:00:19 +00:00
void nesca_3::slotAddPolyLine()
{
if(ME2ScanFlag)
2015-03-06 14:32:36 +00:00
{
QPainterPath path;
2015-03-22 00:43:15 +00:00
if (DrawerTh_ME2Scanner::vecSize > 0)
2015-03-06 14:32:36 +00:00
{
2015-03-10 14:35:50 +00:00
path.moveTo(DrawerTh_ME2Scanner::polyVect[0]);
2015-03-22 00:43:15 +00:00
for (int i = 1; i < DrawerTh_ME2Scanner::vecSize; ++i)
2015-03-06 14:32:36 +00:00
{
2015-03-10 14:35:50 +00:00
path.lineTo(DrawerTh_ME2Scanner::polyVect[i]);
2015-03-06 14:32:36 +00:00
};
};
2015-03-22 00:43:15 +00:00
2015-03-06 14:32:36 +00:00
QGraphicsPathItem* itm = new QGraphicsPathItem(path);
2015-03-02 14:27:38 +00:00
itm->setPen(pen2i);
2015-03-10 14:35:50 +00:00
sceneGraph->addItem(itm);
2015-03-22 00:43:15 +00:00
DrawerTh_ME2Scanner::itmList.push_front(itm);
DrawerTh_ME2Scanner::polyVect.clear();
2015-03-06 14:32:36 +00:00
2015-03-07 17:31:48 +00:00
int u = 0;
double uu = 1.0;
2015-03-20 14:28:51 +00:00
for (int i = 0; i < DrawerTh_ME2Scanner::itmList.size(); ++i)
2015-03-02 14:27:38 +00:00
{
2015-03-07 17:31:48 +00:00
int y = u - i - 1;
2015-03-10 14:35:50 +00:00
itm = DrawerTh_ME2Scanner::itmList[i];
itm->setY(y);
itm->setOpacity(uu);
2015-03-07 17:31:48 +00:00
uu -= 0.027;
u -= 1;
2015-03-02 14:27:38 +00:00
};
2015-03-20 14:28:51 +00:00
while (DrawerTh_ME2Scanner::itmList.size() > 38)
2015-03-02 14:27:38 +00:00
{
2015-03-10 14:35:50 +00:00
sceneGraph->removeItem(DrawerTh_ME2Scanner::itmList[38]);
delete DrawerTh_ME2Scanner::itmList[38];
DrawerTh_ME2Scanner::itmList.pop_back();
2015-03-06 14:32:36 +00:00
};
2015-02-24 14:00:19 +00:00
};
2015-02-27 13:55:35 +00:00
}
2015-02-24 14:00:19 +00:00
void nesca_3::slotDrawGrid()
{
sceneGrid->clear();
2015-02-27 13:55:35 +00:00
}
2015-02-24 14:00:19 +00:00
void nesca_3::slotDrawActivityGrid()
{
sceneActivityGrid->clear();
QPen penActivity(QColor(170, 170, 170, 150), 0.1);
int gHeight = ui->graphicActivityGrid->height();
//Vertical
for(int i = 0; i < 100; i+=10)
{
sceneActivityGrid->addLine(i, 0, i, gHeight, penActivity);
};
2015-02-27 13:55:35 +00:00
}
2015-02-24 14:00:19 +00:00
void nesca_3::slotDrawActivityLine(QString data)
{
sceneActivity->clear();
QPen penActivity(QColor(255, 255, 255), 0.3);
int as = 0;
for(int i = 1; i < actLst.size(); ++i)
{
2015-02-27 13:55:35 +00:00
as += 2;
2015-02-24 14:00:19 +00:00
sceneActivity->addLine(as - 2, 16 - actLst[i - 1], as, 16 - actLst[i], penActivity);
};
QFont fnt;
fnt.setFamily("Eurostile");
fnt.setPixelSize(9);
QGraphicsTextItem *titem = sceneActivity->addText(data, fnt);
titem->setX(43 - data.length()*2);
titem->setY(-5);
titem->setDefaultTextColor(QColor(255, 255, 255, 80));
2015-02-27 13:55:35 +00:00
}
2015-02-24 14:00:19 +00:00
void nesca_3::slotDrawVoiceGrid(int factor)
{
sceneGrid->clear();
QPen penActivity(QColor(170, 170, 170, factor), 0.1);
QPen rpenActivity(QColor(255, 0, 0, factor), 0.1);
int gWidth = ui->graphicLog->width();
int gHeight = ui->graphicLog->height();
//Horizontal
int th = 0;
for(int i = 0; i < 100; i+=5)
{
th = i - 2;
if(i % 10 == 0) sceneGrid->addLine(0, th, gWidth, th, rpenActivity);
else sceneGrid->addLine(0, th, gWidth, th, penActivity);
};
//Vertical
for(int i = 0; i < 270; i+=10)
{
sceneGrid->addLine(i, 0, i, gHeight, penActivity);
};
2015-02-27 13:55:35 +00:00
}
2015-02-24 14:00:19 +00:00
void nesca_3::activateME2ScanScene()
{
if(ME2ScanFlag == false)
{
ui->me2ScanBut->setStyleSheet("color: rgb(216, 216, 216);background-color: rgba(2, 2, 2, 0);border: 1px solid rgba(255, 255, 255, 40);");
ui->QoSScanBut->setStyleSheet("color: rgb(130, 130, 130);background-color: rgba(2, 2, 2, 0);border: 1px solid rgba(130, 130, 130, 80);");
ui->VoiceScanBut->setStyleSheet("color: rgb(130, 130, 130);background-color: rgba(2, 2, 2, 0);border: 1px solid rgba(130, 130, 130, 80);");
ui->PieStatBut->setStyleSheet("color: rgb(130, 130, 130);background-color: rgba(2, 2, 2, 0);border: 1px solid rgba(130, 130, 130, 80);");
sceneUpper->clear();
sceneGrid->clear();
sceneGrid2->clear();
sceneGraph->clear();
sceneVoice->clear();
vAlivLst.clear();
vAnomLst.clear();
vWFLst.clear();
vSuspLst.clear();
vLowlLst.clear();
vBALst.clear();
vOvrlLst.clear();
vSSHLst.clear();
vectOld.clear();
ME2ScanFlag = true;
QoSScanFlag = false;
VoiceScanFlag = false;
PieStatFlag = false;
if(dtHN->isRunning() == false)
{
dtHN->start();
};
2015-03-07 17:31:48 +00:00
2015-02-24 14:00:19 +00:00
if(dtME2->isRunning() == false)
{
dtME2->start();
};
};
2015-02-27 13:55:35 +00:00
}
2015-02-24 14:00:19 +00:00
void nesca_3::activateQoSScanBut()
{
if(QoSScanFlag == false)
{
ui->QoSScanBut->setStyleSheet("color: rgb(216, 216, 216);background-color: rgba(2, 2, 2, 0);border: 1px solid rgba(255, 255, 255, 40);");
ui->PieStatBut->setStyleSheet("color: rgb(130, 130, 130);background-color: rgba(2, 2, 2, 0);border: 1px solid rgba(130, 130, 130, 80);");
ui->VoiceScanBut->setStyleSheet("color: rgb(130, 130, 130);background-color: rgba(2, 2, 2, 0);border: 1px solid rgba(130, 130, 130, 80);");
ui->me2ScanBut->setStyleSheet("color: rgb(130, 130, 130);background-color: rgba(2, 2, 2, 0);border: 1px solid rgba(130, 130, 130, 80);");
ui->RedLabel->setVisible(true);
ui->GreenLabel->setVisible(true);
ui->CyanLabel->setVisible(true);
ui->BlueLabel->setVisible(true);
ui->PinkLabel->setVisible(true);
ui->YellowLabel->setVisible(true);
ui->WhiteLabel->setVisible(true);
ui->DredLabel->setVisible(true);
ui->labelAnomaly->setVisible(true);
ui->labelBA->setVisible(true);
ui->labelFiltered->setVisible(true);
ui->labelBads->setVisible(true);
ui->labelLowloads->setVisible(true);
ui->labelOverloads->setVisible(true);
ui->labelAlives->setVisible(true);
ui->labelSSH->setVisible(true);
vAlivLst.clear();
vAnomLst.clear();
vWFLst.clear();
vSuspLst.clear();
vLowlLst.clear();
vBALst.clear();
vOvrlLst.clear();
vSSHLst.clear();
vectOld.clear();
ME2ScanFlag = false;
QoSScanFlag = true;
VoiceScanFlag = false;
PieStatFlag = false;
QoSStep = 1;
MaxDataVal = 1;
sceneGrid2->clear();
sceneGraph->clear();
sceneGrid->clear();
sceneUpper->clear();
sceneTextPlacer->clear();
sceneVoice->clear();
2015-03-07 17:31:48 +00:00
DrawerTh_ME2Scanner::polyVect.clear();
2015-02-24 14:00:19 +00:00
if(dtQoS->isRunning() == false) dtQoS->start();
if(dtGridQoS->isRunning() == false) dtGridQoS->start();
};
2015-02-27 13:55:35 +00:00
}
2015-02-24 14:00:19 +00:00
void nesca_3::activateVoiceScanBut()
{
if(VoiceScanFlag == false)
{
ui->VoiceScanBut->setStyleSheet("color: rgb(216, 216, 216);background-color: rgba(2, 2, 2, 0);border: 1px solid rgba(255, 255, 255, 40);");
ui->me2ScanBut->setStyleSheet("color: rgb(130, 130, 130);background-color: rgba(2, 2, 2, 0);border: 1px solid rgba(130, 130, 130, 80);");
ui->QoSScanBut->setStyleSheet("color: rgb(130, 130, 130);background-color: rgba(2, 2, 2, 0);border: 1px solid rgba(130, 130, 130, 80);");
ui->PieStatBut->setStyleSheet("color: rgb(130, 130, 130);background-color: rgba(2, 2, 2, 0);border: 1px solid rgba(130, 130, 130, 80);");
ui->RedLabel->setVisible(true);
ui->GreenLabel->setVisible(true);
ui->CyanLabel->setVisible(true);
ui->BlueLabel->setVisible(true);
ui->PinkLabel->setVisible(true);
ui->YellowLabel->setVisible(true);
ui->WhiteLabel->setVisible(true);
ui->DredLabel->setVisible(true);
ui->labelAnomaly->setVisible(true);
ui->labelBA->setVisible(true);
ui->labelFiltered->setVisible(true);
ui->labelBads->setVisible(true);
ui->labelLowloads->setVisible(true);
ui->labelOverloads->setVisible(true);
ui->labelAlives->setVisible(true);
ui->labelSSH->setVisible(true);
ME2ScanFlag = false;
QoSScanFlag = false;
VoiceScanFlag = true;
PieStatFlag = false;
sceneGrid2->clear();
sceneGraph->clear();
sceneGrid->clear();
sceneUpper->clear();
sceneVoice->clear();
if(vsTh->isRunning() == false) vsTh->start();
};
2015-02-27 13:55:35 +00:00
}
2015-02-24 14:00:19 +00:00
void nesca_3::slotUpdatePie()
{
sceneGraph->clear();
vsTh->doEmitDrawGrid(70);
int goods = saved;
int nAlive = found - goods;
float degree = (16*360) / (float)100;
float perc0 = ((float)nAlive * 100) * degree;
float perc1 = ((float)PieAnomC1/(float)(found) * 100) * degree;
float perc2 = ((float)PieSusp/(float)(found) * 100) * degree;
float perc3 = ((float)PieBA/(float)(found) * 100) * degree;
float perc4 = ((float)PieLowl/(float)(found) * 100) * degree;
float perc5 = ((float)PieWF/(float)(found) * 100) * degree;
float perc6 = ((float)PieSSH/(float)(found) * 100) * degree;
QFont fnt;
fnt.setFamily("Eurostile");
fnt.setPixelSize(10);
QString dataSaved = "Saved: " + QString::number(goods/(float)(found > 0 ? found : 1) * 100) + "%(" + QString::number(goods) + ")";
QString dataParsed = "Filtered: " + QString::number((found - goods)/(float)(found > 0 ? found : 1) * 100) + "%(" + QString::number(found - goods) + ")";
QString dataOnline = "Online: " + QString::number(found);
QString dataAnom = "Anomalies: " + QString::number(PieAnomC1/(float)(goods > 0 ? goods : 1) * 100) + "%";
QString dataBA = "Basic Auth: " + QString::number(PieBA/(float)(goods > 0 ? goods : 1) * 100) + "%";
QString dataSusp = "Suspicious: " + QString::number(PieSusp/(float)(goods > 0 ? goods : 1) * 100) + "%";
QString dataLowl = "Lowload: " + QString::number(PieLowl/(float)(goods > 0 ? goods : 1) * 100) + "%";
QString dataWF = "WebForms: " + QString::number(PieWF/(float)(goods > 0 ? goods : 1) * 100) + "%";
QString dataSSH = "SSH: " + QString::number(PieSSH/(float)(goods > 0 ? goods : 1) * 100) + "%";
int dataX = 1;
int dataY = 13;
QGraphicsTextItem *titem = sceneGraph->addText(dataOnline, fnt);
titem->setX(dataX);
titem->setY(-5);
titem->setDefaultTextColor(QColor(255, 255, 255, 130));
titem = sceneGraph->addText(dataSaved, fnt);
titem->setX(dataX);
titem->setY(5);
titem->setDefaultTextColor(QColor(255, 255, 255, 130));
titem = sceneGraph->addText(dataParsed, fnt);
titem->setX(dataX);
titem->setY(15);
titem->setDefaultTextColor(QColor(255, 255, 255, 255));
titem = sceneGraph->addText(dataAnom, fnt);
titem->setX(dataX);
titem->setY(dataY + 17);
titem->setDefaultTextColor(QColor("red"));
titem = sceneGraph->addText(dataBA, fnt);
titem->setX(dataX);
titem->setY(dataY + 27);
titem->setDefaultTextColor(Qt::darkCyan);
titem = sceneGraph->addText(dataSusp, fnt);
titem->setX(dataX);
titem->setY(dataY + 37);
titem->setDefaultTextColor(Qt::darkRed);
titem = sceneGraph->addText(dataLowl, fnt);
titem->setX(dataX);
titem->setY(dataY + 47);
titem->setDefaultTextColor(Qt::magenta);
titem = sceneGraph->addText(dataWF, fnt);
titem->setX(dataX);
titem->setY(dataY + 56);
titem->setDefaultTextColor(Qt::darkGray);
titem = sceneGraph->addText(dataSSH, fnt);
titem->setX(dataX);
titem->setY(dataY + 66);
titem->setDefaultTextColor(Qt::darkRed);
int PieX = 155;
int PieW = 112;
//Alives
QGraphicsEllipseItem* item = NULL;
if(perc0 == 0)
{
item = new QGraphicsEllipseItem(PieX, 2, PieW, 97);
item->setStartAngle(0);
perc0 = 16*360;
item->setSpanAngle(perc0);
item->setBrush(QBrush(QColor(255, 255, 255, 10)));
sceneGraph->addItem(item);
}
else
{
item = new QGraphicsEllipseItem(PieX, 2, PieW, 97);
item->setStartAngle(0);
item->setSpanAngle(perc0);
item->setBrush(QBrush(Qt::white));
sceneGraph->addItem(item);
};
//Anomalies
if(perc1 > 0)
{
item = new QGraphicsEllipseItem(PieX, 2, PieW, 97);
item->setStartAngle(perc0);
item->setSpanAngle(perc1);
item->setBrush(QBrush(Qt::red));
sceneGraph->addItem(item);
};
//Suspicious
if(perc2 > 0)
{
item = new QGraphicsEllipseItem(PieX, 2, PieW, 97);
item->setStartAngle(perc0 + perc1);
item->setSpanAngle(perc2);
item->setBrush(QBrush(Qt::darkRed));
sceneGraph->addItem(item);
};
//BA
if(perc3 > 0)
{
item = new QGraphicsEllipseItem(PieX, 2, PieW, 97);
item->setStartAngle(perc0 + perc1 + perc2);
item->setSpanAngle(perc3);
item->setBrush(QBrush(Qt::darkCyan));
sceneGraph->addItem(item);
};
//Lowl
if(perc4 > 0)
{
item = new QGraphicsEllipseItem(PieX, 2, PieW, 97);
item->setStartAngle(perc0 + perc1 + perc2 + perc3);
item->setSpanAngle(perc4);
item->setBrush(QBrush(Qt::magenta));
sceneGraph->addItem(item);
};
//WF
if(perc5 > 0)
{
item = new QGraphicsEllipseItem(PieX, 2, PieW, 97);
item->setStartAngle(perc0 + perc1 + perc2 + perc3 + perc4);
item->setSpanAngle(perc5);
item->setBrush(QBrush(Qt::darkGray));
sceneGraph->addItem(item);
};
//SSH
if(perc6 > 0)
{
item = new QGraphicsEllipseItem(PieX, 2, PieW, 97);
item->setStartAngle(perc0 + perc1 + perc2 + perc3 + perc4 + perc5);
item->setSpanAngle(perc6);
item->setBrush(QBrush(Qt::darkRed));
sceneGraph->addItem(item);
};
2015-02-27 13:55:35 +00:00
}
2015-02-24 14:00:19 +00:00
void nesca_3::activatePieStatBut()
{
if(PieStatFlag == false)
{
ui->PieStatBut->setStyleSheet("color: rgb(216, 216, 216);background-color: rgba(2, 2, 2, 0);border: 1px solid rgba(255, 255, 255, 40);");
ui->QoSScanBut->setStyleSheet("color: rgb(130, 130, 130);background-color: rgba(2, 2, 2, 0);border: 1px solid rgba(130, 130, 130, 80);");
ui->VoiceScanBut->setStyleSheet("color: rgb(130, 130, 130);background-color: rgba(2, 2, 2, 0);border: 1px solid rgba(130, 130, 130, 80);");
ui->me2ScanBut->setStyleSheet("color: rgb(130, 130, 130);background-color: rgba(2, 2, 2, 0);border: 1px solid rgba(130, 130, 130, 80);");
ui->RedLabel->setVisible(false);
ui->GreenLabel->setVisible(false);
ui->CyanLabel->setVisible(false);
ui->BlueLabel->setVisible(false);
ui->PinkLabel->setVisible(false);
ui->YellowLabel->setVisible(false);
ui->WhiteLabel->setVisible(false);
ui->DredLabel->setVisible(false);
ui->labelAnomaly->setVisible(false);
ui->labelBA->setVisible(false);
ui->labelFiltered->setVisible(false);
ui->labelBads->setVisible(false);
ui->labelLowloads->setVisible(false);
ui->labelOverloads->setVisible(false);
ui->labelAlives->setVisible(false);
ui->labelSSH->setVisible(false);
ME2ScanFlag = false;
QoSScanFlag = false;
VoiceScanFlag = false;
PieStatFlag = true;
sceneGrid2->clear();
sceneGraph->clear();
sceneGrid->clear();
sceneUpper->clear();
sceneTextPlacer->clear();
sceneVoice->clear();
if(psTh->isRunning() == false) psTh->start();
};
2015-02-27 13:55:35 +00:00
}
2015-02-24 14:00:19 +00:00
bool stopFirst;
void nesca_3::importAndScan()
{
if(startFlag == false)
{
if(trackerOK)
{
if(ui->linePersKey->text().size() != 0)
{
CheckPersKey(2);
}
else
{
stt->doEmitionRedFoundData("Empty \"Personal key\" field. ");
};
}
else
{
stt->doEmitionStartScanImport();
};
}
else
{
ui->importButton->setStyleSheet(
" QPushButton {"
"background-color: qlineargradient(spread:none, x1:1, y1:0, x2:1, y2:1, stop:0.681818 rgba(0, 0, 0, 250), stop:1 rgba(255, 255, 255, 130));"
"color: yellow;"
"border: 0.5px solid qlineargradient(spread:reflect, x1:0.54, y1:0.488591, x2:0.54, y2:0, stop:0 rgba(255, 255, 255, 130), stop:1 rgba(0, 0, 0, 255));"
"}"
);
ui->importButton->setText("Wait...");
stt->doEmitionYellowFoundData("Trying to stop. Please, wait...");
globalScanFlag = false;
if(stopFirst == false)
{
stopFirst = true;
globalScanFlag = false;
ui->importButton->setStyleSheet(
" QPushButton {"
"background-color: qlineargradient(spread:none, x1:1, y1:0, x2:1, y2:1, stop:0.681818 rgba(0, 0, 0, 250), stop:1 rgba(255, 255, 255, 130));"
"color: red;"
"border: 0.5px solid qlineargradient(spread:reflect, x1:0.54, y1:0.488591, x2:0.54, y2:0, stop:0 rgba(255, 255, 255, 130), stop:1 rgba(0, 0, 0, 255));"
"}"
);
ui->importButton->setText("STOP!");
stt->doEmitionYellowFoundData("Trying to stop. Please, wait...");
importFileName = "";
}
else
{
globalScanFlag = false;
ui->importButton->setStyleSheet(
" QPushButton {"
"background-color: qlineargradient(spread:none, x1:1, y1:0, x2:1, y2:1, stop:0.681818 rgba(0, 0, 0, 250), stop:1 rgba(255, 255, 255, 130));"
"color: yellow;"
"border: 0.5px solid qlineargradient(spread:reflect, x1:0.54, y1:0.488591, x2:0.54, y2:0, stop:0 rgba(255, 255, 255, 130), stop:1 rgba(0, 0, 0, 255));"
"}"
);
ui->importButton->setText("Wait...");
stt->doEmitionYellowFoundData("Wait, killing threads...");
STTTerminate();
};
};
2015-02-27 13:55:35 +00:00
}
2015-02-24 14:00:19 +00:00
void nesca_3::switchDataFields()
{
if(ui->switcherBut->text() == "<")
{
BALogSwitched = true;
ui->dataText->lower();
ui->BAText->raise();
ui->switcherBut->setText(">");
}
else
{
BALogSwitched = false;
ui->dataText->raise();
ui->BAText->lower();
ui->switcherBut->setText("<");
};
2015-02-27 13:55:35 +00:00
}
2015-03-23 12:52:07 +00:00
//void nesca_3::slotBlinkMessage()
//{
// if(blinkFlag)
// {
// blinkFlag = false;
// ui->newMessageLabel->setStyleSheet("color:rgba(255, 0, 0, 0);background-color: rgba(2, 2, 2, 0);");
// ui->IRCModeBut->setStyleSheet("color: rgb(216, 216, 216);background-color: rgba(2, 2, 2, 0);border: 1px solid rgba(255, 255, 255, 40);");
// }
// else
// {
// blinkFlag = true;
// ui->newMessageLabel->setStyleSheet("color:rgba(255, 0, 0, 255);background-color: rgba(2, 2, 2, 0);");
// ui->IRCModeBut->setStyleSheet("color: rgb(255, 0, 0);background-color: rgba(2, 2, 2, 0);border: 1px solid rgba(255, 0, 0, 255);");
// };
//}
2015-02-27 13:55:35 +00:00
2015-03-10 14:35:50 +00:00
void nesca_3::slotTabChanged(int index){
if(index < 2) savedTabIndex = index;
}
2015-02-24 14:00:19 +00:00
void nesca_3::switchToJobMode()
{
if(ui->widgetJOB->geometry().x() == 500)
2015-03-23 12:52:07 +00:00
{
2015-02-24 14:00:19 +00:00
widgetIsHidden = false;
ui->widgetJOB->setGeometry(QRect(1, 44, 498, 730));
ui->JobModeBut->setStyleSheet("background-color: rgba(2, 2, 2, 0);border: 1px solid rgba(0, 214, 0, 40);color: rgb(0, 214, 0);");
2015-03-23 12:52:07 +00:00
}
2015-02-24 14:00:19 +00:00
else
{
ui->widgetJOB->setGeometry(QRect(500, 44, 500, 730));
ui->JobModeBut->setStyleSheet("color: rgb(216, 216, 216);background-color: rgba(2, 2, 2, 0);border: 1px solid rgba(255, 255, 255, 40);");
};
2015-02-27 13:55:35 +00:00
}
2015-02-24 14:00:19 +00:00
void nesca_3::CheckPersKey()
{
emitIfOK = -1;
2015-03-10 14:35:50 +00:00
saveOptions();
2015-02-24 14:00:19 +00:00
if(!chKTh->isRunning())
{
2015-03-22 00:43:15 +00:00
stt->doEmitionYellowFoundData("[Key check] Starting checker thread...");
2015-02-24 14:00:19 +00:00
chKTh->start();
}
else
{
2015-02-27 13:55:35 +00:00
stt->doEmitionRedFoundData("Still ckecking your key, please wait...");
2015-02-24 14:00:19 +00:00
};
2015-02-27 13:55:35 +00:00
}
2015-02-24 14:00:19 +00:00
void nesca_3::CheckPersKey(int val = -1)
{
emitIfOK = val;
2015-03-10 14:35:50 +00:00
saveOptions();
2015-02-24 14:00:19 +00:00
if(!chKTh->isRunning())
{
2015-03-22 00:43:15 +00:00
stt->doEmitionYellowFoundData("[Key check] Starting checker thread...");
2015-02-24 14:00:19 +00:00
chKTh->start();
}
else
{
2015-02-27 13:55:35 +00:00
stt->doEmitionRedFoundData("Still ckecking your key, please wait...");
2015-02-24 14:00:19 +00:00
};
2015-02-27 13:55:35 +00:00
}
2015-02-24 14:00:19 +00:00
bool nesca_3::eventFilter(QObject* obj, QEvent *event)
{
2015-03-23 12:52:07 +00:00
if (obj == qwm)
{
if(MapWidgetOpened && event->type() == QEvent::WindowActivate)
{
this->raise();
};
2015-02-24 14:00:19 +00:00
if (event->type() == QEvent::KeyPress)
{
QKeyEvent* keyEvent = static_cast<QKeyEvent*>(event);
if(keyEvent->modifiers() == Qt::ControlModifier)
{
privateMsgFlag = true;
event->accept();
2015-02-27 13:55:35 +00:00
return true;
2015-02-24 14:00:19 +00:00
};
2015-02-27 13:55:35 +00:00
return false;
2015-02-24 14:00:19 +00:00
}
else if (event->type() == QEvent::KeyRelease)
{
privateMsgFlag = false;
event->accept();
2015-02-27 13:55:35 +00:00
return true;
2015-02-24 14:00:19 +00:00
};
2015-02-27 13:55:35 +00:00
return false;
}
2015-02-24 14:00:19 +00:00
else
{
if (event->type() == QEvent::KeyPress)
{
QKeyEvent* keyEvent = static_cast<QKeyEvent*>(event);
if(keyEvent->modifiers() == Qt::ControlModifier)
{
privateMsgFlag = true;
event->accept();
2015-02-27 13:55:35 +00:00
return true;
2015-02-24 14:00:19 +00:00
};
2015-02-27 13:55:35 +00:00
return false;
2015-02-24 14:00:19 +00:00
}
else if(event->type() == QEvent::KeyRelease)
{
privateMsgFlag = false;
event->accept();
2015-02-27 13:55:35 +00:00
return true;
}
else if(MapWidgetOpened && event->type() == QEvent::WindowActivate)
{
qwm->raise();
};
2015-02-27 13:55:35 +00:00
return false;
2015-02-24 14:00:19 +00:00
};
2015-02-27 13:55:35 +00:00
}
2015-02-24 14:00:19 +00:00
void nesca_3::slotClearLogs()
{
ui->dataText->clear();
ui->BAText->clear();
2015-02-27 13:55:35 +00:00
}
2015-02-24 14:00:19 +00:00
int c = 1;
2015-03-22 00:43:15 +00:00
void nesca_3::slotSaveImage(QAction *qwe)
2015-02-24 14:00:19 +00:00
{
QObject *smB = this->sender();
int ci = ui->tabMainWidget->currentIndex();
2015-03-02 14:27:38 +00:00
QTime QT = QTime::currentTime();
QString t("*.png");
2015-02-24 14:00:19 +00:00
if(smB == menuPS)
{
if(ME2ScanFlag || VoiceScanFlag)
{
2015-03-01 12:01:24 +00:00
QString fn = QString::number(QT.msec()) + "_" + (ME2ScanFlag ? QString("ME2") : QString("Voice")) + "_" + (ci == 0 ? ui->ipLine->text() : ui->lineEditStartIPDNS->text()) + ".png";
2015-02-24 14:00:19 +00:00
int ax = 27;
int ay = 2;
int w = ui->graphicLog->width() + 30;
int h = ui->graphicLog->height() + 30;
int hOffset = 20;
int spX = -10;
int spY = 108;
int wsp = 40;
int hsp = 70;
2015-03-01 12:01:24 +00:00
2015-02-24 14:00:19 +00:00
if(VoiceScanFlag)
{
hOffset = -60;
spX = 8;
spY = -1;
wsp = 0;
hsp = -3;
};
2015-03-01 12:01:24 +00:00
QPixmap pixmap(ui->graphicTextPlacer->width() + 5, ui->graphicTextPlacer->height() + hOffset);
QPainter painter(&pixmap);
pixmap.fill(QColor(0, 0, 0));
2015-02-24 14:00:19 +00:00
sceneTextPlacer->render(&painter, QRect(spX, spY, w + wsp, h + hsp));
sceneUpper->render(&painter, QRect(ax, ay, w, h));
sceneVoice->render(&painter, QRect(ax, ay, w, h));
sceneGraph->render(&painter, QRect(ax, ay + 8, w - 2, h));
sceneGrid->render(&painter, QRect(ax, ay, w, h));
sceneGrid2->render(&painter, QRect(ax, ay, w, h));
2015-03-02 14:27:38 +00:00
2015-02-26 14:20:37 +00:00
QString filename = QFileDialog::getSaveFileName(
2015-02-24 14:00:19 +00:00
this,
tr("Save image"),
QDir::currentPath() + "/" + fn,
".png",
2015-03-02 14:27:38 +00:00
&t
2015-02-24 14:00:19 +00:00
);
2015-03-01 12:01:24 +00:00
if (filename != "") pixmap.save(filename);
2015-02-24 14:00:19 +00:00
}
else
{
2015-03-10 14:35:50 +00:00
QString fn = QString::number(QT.msec()) + "_" + (PieStatFlag ? "PieStat" : "QoS") + "_" + (ci == 0 ? ui->ipLine->text() : ui->lineEditStartIPDNS->text()) + ".png";
2015-03-01 12:01:24 +00:00
QPixmap pixmap(ui->graphicLog->width(), ui->graphicLog->height());
QPainter painter(&pixmap);
pixmap.fill(Qt::black);
sceneGrid->render(&painter);
sceneGrid2->render(&painter);
sceneGrid2->render(&painter);
2015-02-24 14:00:19 +00:00
sceneUpper->render(&painter);
sceneVoice->render(&painter);
sceneGraph->render(&painter);
2015-03-01 12:01:24 +00:00
painter.end();
QString filename = QFileDialog::getSaveFileName(
this,
tr("Save image"),
QDir::currentPath() + "/" + fn,
".png",
2015-03-02 14:27:38 +00:00
&t
2015-03-01 12:01:24 +00:00
);
if (filename != "") pixmap.save(filename);
2015-02-24 14:00:19 +00:00
};
};
2015-02-27 13:55:35 +00:00
}
2015-02-24 14:00:19 +00:00
void PieStatView::contextMenuEvent(QContextMenuEvent *event)
{
menuPS = new QMenu;
menuPS->addAction("Save image.");
menuPS->popup(event->globalPos());
2015-03-22 00:43:15 +00:00
connect(menuPS, SIGNAL(triggered(QAction *)), gthis, SLOT(slotSaveImage(QAction *)));
2015-02-27 13:55:35 +00:00
}
2015-02-24 14:00:19 +00:00
QTextBrowser *SendData;
QTextBrowser *RecvData;
void nesca_3::slotShowDataflow()
{
if(MapWidgetOpened == false)
{
MapWidgetOpened = true;
ui->DataflowModeBut->setStyleSheet("background-color: rgba(2, 2, 2, 0);border: 1px solid rgba(0, 214, 0, 40);color: rgb(0, 214, 0);");
qwm = new QWidget();
2015-03-10 14:35:50 +00:00
qwm->setWindowFlags(Qt::FramelessWindowHint|Qt::SubWindow);
qwm->installEventFilter(this);
2015-02-24 14:00:19 +00:00
qwm->setStyleSheet(
"background-color:qlineargradient(spread:pad, x1:0.541, y1:0.500364, x2:0.54, y2:0, stop:0 rgba(16, 16, 16, 255), stop:1 rgba(0, 0, 0, 255));"
"border: 1px solid #616161;");
qwm->setGeometry(QMainWindow::x() + ui->widget->width() + 5, QMainWindow::y(), 480, 800);
qwm->show();
QFont fnt;
fnt.setFamily("Eurostile");
fnt.setPixelSize(10);
SendData = new QTextBrowser(qwm);
SendData->setGeometry(5, 5, 470, 370);
SendData->setStyleSheet("color:rgb(150, 150, 150);");
SendData->setFont(fnt);
SendData->show();
RecvData = new QTextBrowser(qwm);
RecvData->setGeometry(5, 380, 470, 414);
RecvData->setStyleSheet("color:rgb(150, 150, 150);");
RecvData->setFont(fnt);
RecvData->show();
}
else
{
ui->DataflowModeBut->setStyleSheet("color: rgb(216, 216, 216);background-color: rgba(2, 2, 2, 0);border: 1px solid rgba(255, 255, 255, 40);");
2015-02-27 13:55:35 +00:00
delete SendData;
delete RecvData;
delete qwm;
2015-02-24 14:00:19 +00:00
qwm = NULL;
RecvData = NULL;
SendData = NULL;
MapWidgetOpened = false;
};
2015-02-27 13:55:35 +00:00
}
2015-02-24 14:00:19 +00:00
QGraphicsPathItem *GiveMeGItem(QVector<QPointF> vAnomLst)
{
QPolygonF qpf;
QPainterPath path;
for(int i = 0; i < vAnomLst.size(); ++i)
{
qpf.append(vAnomLst[i]);
};
if(qpf.size() > 0)
{
path.moveTo(qpf[0]);
for(int i = 1; i < qpf.size(); ++i)
{
path.lineTo(qpf[i]);
};
};
return new QGraphicsPathItem(path);
2015-02-27 13:55:35 +00:00
}
2015-02-24 14:00:19 +00:00
void nesca_3::slotVoiceAddLine()
{
int as = 0;
if(VoiceScanFlag)
{
sceneVoice->clear();
for(int i = 1; i < vAlivLst.size(); ++i)
{
as += 2;
sceneVoice->addLine(as - 2, 120 - vAlivLst[i - 1] - 1, as, 120 - vAlivLst[i] - 1, penQoS0);
};
as = 0;
for(int i = 1; i < vAnomLst.size(); ++i)
{
as += 2;
sceneVoice->addLine(as - 2, 120 - vAnomLst[i - 1] - 1, as, 120 - vAnomLst[i] - 1, penQoS1);
};
as = 0;
for(int i = 1; i < vWFLst.size(); ++i)
{
as += 2;
sceneVoice->addLine(as - 2, 120 - vWFLst[i - 1] - 1, as, 120 - vWFLst[i] - 1, penQoS2);
};
as = 0;
for(int i = 1; i < vSuspLst.size(); ++i)
{
as += 2;
sceneVoice->addLine(as - 2, 120 - vSuspLst[i - 1] - 1, as, 120 - vSuspLst[i] - 1, penQoS3);
};
as = 0;
for(int i = 1; i < vLowlLst.size(); ++i)
{
as += 2;
sceneVoice->addLine(as - 2, 120 - vLowlLst[i - 1] - 1, as, 120 - vLowlLst[i] - 1, penQoS4);
};
as = 0;
for(int i = 1; i < vBALst.size(); ++i)
{
as += 2;
sceneVoice->addLine(as - 2, 120 - vBALst[i - 1] - 1, as, 120 - vBALst[i] - 1, penQoS5);
};
as = 0;
for(int i = 1; i < vOvrlLst.size(); ++i)
{
as += 2;
sceneVoice->addLine(as - 2, 120 - vOvrlLst[i - 1], as, 120 - vOvrlLst[i] - 1, penQoS6);
};
as = 0;
for(int i = 1; i < vSSHLst.size(); ++i)
{
as += 2;
sceneVoice->addLine(as - 2, 120 - vSSHLst[i - 1], as, 120 - vSSHLst[i] - 1, penQoS7);
};
};
2015-02-27 13:55:35 +00:00
}
2015-02-24 14:00:19 +00:00
QRegExp _rOutProt(" HTTP/1.\\d+");
QRegExp _rOutPath(" /(\\w|\\.|,|/|:|-|_|\\?|!|\\@|#|\\$|%|\\^|&|\\*|\\(|\\)|=|\\+|<|>|;|:|\"|'|~|\\[|\\])* ");
QRegExp _rOutHost("Host: ((\\w|\\d|\\.|:|/)*)\\r\\n");
2015-03-17 14:30:53 +00:00
QRegExp qrp("\\n(.+):");
2015-03-10 20:09:05 +00:00
void nesca_3::slotOutData(QString str)
2015-02-24 14:00:19 +00:00
{
if(SendData != NULL)
{
_rOutPath.indexIn(str);
QString prot = _rOutPath.cap(0);
2015-03-10 14:35:50 +00:00
if(prot.size() > 0) str.replace(prot, "<font color=\"Turquoise\">" + prot + "</font>");
2015-02-24 14:00:19 +00:00
_rOutHost.indexIn(str);
prot = _rOutHost.cap(1);
2015-03-10 14:35:50 +00:00
if(prot.size() > 0) str.replace(prot, "<font color=\"Turquoise\">" + prot + "</font>");
str.replace("HTTP ", "<font color=\"GoldenRod\">HTTP </font>");
2015-02-24 14:00:19 +00:00
str.replace("GET ", "<font color=\"GoldenRod\">GET </font>");
str.replace("POST ", "<font color=\"GoldenRod\">POST </font>");
2015-03-17 14:30:53 +00:00
str.replace(qrp, "<br><font color=\"GoldenRod\">\\1:</font>");
str.replace(QRegExp("(ftp:.+@)"), "<font color=\"Crimson\">\\1</font>");
2015-03-10 14:35:50 +00:00
2015-02-24 14:00:19 +00:00
_rOutProt.indexIn(str);
prot = _rOutProt.cap(0);
if(prot.size() > 0) str.replace(prot, "<font color=\"GoldenRod\">" + prot + "</font>");
str.replace("\r\n", "<br>");
2015-03-10 20:09:05 +00:00
SendData->append("<br>" + str + "<hr><br>");
2015-02-24 14:00:19 +00:00
};
2015-02-27 13:55:35 +00:00
}
2015-02-24 14:00:19 +00:00
QRegExp _rIncProt("HTTP/1.\\d+ ");
QRegExp _rIncHost("Host: ((\\w|\\d|\\.|:|/)*)\\r\\n");
QRegExp _rIncTags1("&lt;.{1,8}&gt;");
QRegExp _rIncTagsClose("&lt;/.{1,8}&gt;");
QRegExp _rIncTags2("&lt;.{1,8} ");
QRegExp _rIncTags3("/&gt;");
QRegExp _rIncInnerTags("=&quot;((\\w|\\.|,|/|:|-|_|\\?|!|\\@|#|\\$|%|\\^|&|\\*|\\(|\\)|=|\\+|<|>|;|:|\"|'|~|\\s| )*)&quot;");
QRegExp _rIncScriptTag1("&lt;script&gt;.*&lt;/script&gt;");
QRegExp _rIncScriptTag2("&lt;script .*&lt;/script&gt;");
QRegExp _rIncStyleTag("&lt;style&gt;.*&lt;/style&gt;");
QRegExp _rIncRN("\r\n(_|-|=|.*)*:");
void nesca_3::slotIncData(QString ip, QString str)
{
if(RecvData != NULL)
2015-03-16 14:29:34 +00:00
{
2015-02-24 14:00:19 +00:00
QStringList headNbody = str.split("\r\n\r\n");
QString tStr;
QString tagRes;
QString prot;
int posTag = 0;
for(int i = 0; i < headNbody.size(); ++i)
{
if(headNbody[i].size() == 0) headNbody.erase(headNbody.begin() + i);
};
if(headNbody.size() == 0) return;
if(headNbody.size() > 1)
{
str = headNbody[0];
tStr = str;
_rIncRN.setMinimal(true);
while ((posTag = _rIncRN.indexIn(tStr, posTag)) != -1)
{
tagRes = _rIncRN.cap(0);
if(tagRes.size() > 0)
{
str.replace(tagRes, "<font color=\"GoldenRod\">" + tagRes + "</font>");
};
tStr.replace(tagRes, "");
2015-03-10 14:35:50 +00:00
};
str.replace("HTTP/1.0", "<font color=\"GoldenRod\">HTTP/1.0</font>");
str.replace("HTTP/1.1", "<font color=\"GoldenRod\">HTTP/1.1</font>");
2015-02-24 14:00:19 +00:00
str.replace("\r\n", "<br>");
RecvData->append("<font color=\"#F0FFFF\">[" + ip + "]</font><br>[HEAD]<br>" + str + "<hr><br>");
_rIncTags1.setMinimal(true);
_rIncInnerTags.setMinimal(true);
RecvData->append("<font color=\"#F0FFFF\">[" + ip + "]</font><br>[BODY]<br>");
for(int i = 1; i < headNbody.size(); ++i)
{
str = headNbody[i].toHtmlEscaped();
tStr = str;
posTag = 0;
while ((posTag = _rIncTags1.indexIn(tStr, posTag)) != -1)
{
tagRes = _rIncTags1.cap(0);
if(tagRes.size() > 0)
{
if(tagRes.contains("script") == false && tagRes.contains("style") == false)
{
str.replace(tagRes, "<font color=\"SteelBlue\">" + tagRes + "</font>");
};
tStr.replace(tagRes, "");
};
};
posTag = 0;
while ((posTag = _rIncTagsClose.indexIn(tStr, posTag)) != -1)
{
tagRes = _rIncTagsClose.cap(0);
if(tagRes.size() > 0)
{
if(tagRes.contains("script") == false && tagRes.contains("style") == false)
{
str.replace(tagRes, "<font color=\"SteelBlue\">" + tagRes + "</font>");
};
tStr.replace(tagRes, "");
};
};
posTag = 0;
while ((posTag = _rIncTags2.indexIn(tStr, posTag)) != -1)
{
tagRes = _rIncTags2.cap(0);
if(tagRes.size() > 0)
{
if(tagRes.contains("script") == false && tagRes.contains("style") == false)
{
str.replace(tagRes, "<font color=\"SteelBlue\">" + tagRes + "</font>");
};
tStr.replace(tagRes, "");
};
};
posTag = 0;
while ((posTag = _rIncInnerTags.indexIn(tStr, posTag)) != -1)
{
tagRes = _rIncInnerTags.cap(0);
if(tagRes.size() > 0)
{
str.replace(tagRes, "<font color=\"OliveDrab\">" + tagRes + "</font>");
tStr.replace(tagRes, "");
};
};
_rIncTags3.indexIn(str);
prot = _rIncTags3.cap(0);
if(prot.size() > 0) str.replace(prot, "<font color=\"SteelBlue\">" + prot + "</font>");
_rIncScriptTag1.indexIn(str);
prot = _rIncScriptTag1.cap(0);
if(prot.size() > 0) str.replace(prot, "<font color=\"Maroon\">" + prot + "</font>");
_rIncScriptTag2.indexIn(str);
prot = _rIncScriptTag2.cap(0);
if(prot.size() > 0) str.replace(prot, "<font color=\"Maroon\">" + prot + "</font>");
str.replace("&lt;/script&gt;", "<font color=\"Maroon\">&lt;/script&gt;</font>");
_rIncStyleTag.indexIn(str);
prot = _rIncStyleTag.cap(0);
if(prot.size() > 0) str.replace(prot, "<font color=\"NavajoWhite\">" + prot + "</font>");
str.replace("&lt;style&gt;", "<font color=\"NavajoWhite\">&lt;style&gt;</font>");
str.replace("\n", "<br>");
RecvData->append(str);
};
RecvData->append("<hr><br>");
}
else
{
str = headNbody[0];
tStr = str;
_rIncRN.setMinimal(true);
while ((posTag = _rIncRN.indexIn(tStr, posTag)) != -1)
{
tagRes = _rIncRN.cap(0);
if(tagRes.size() > 0)
{
str.replace(tagRes, "<font color=\"GoldenRod\">" + tagRes + "</font>");
};
tStr.replace(tagRes, "");
};
str.replace("HTTP/1.1", "<font color=\"SteelBlue\">HTTP/1.1</font>");
str.replace("\r\n", "<br>");
RecvData->append("<font color=\"#F0FFFF\">[" + ip + "]</font><br>" + str + "<hr><br>");
};
};
2015-02-27 13:55:35 +00:00
}
2015-02-24 14:00:19 +00:00
void nesca_3::smReaction()
{
QObject *smB = this->sender();
if(smB == ui->secretMessageBut_1)
{
if(smBit_1 == false)
{
smBit_1 = true;
ui->secretMessageBut_1->setStyleSheet("border: 0.5px solid #313131; background-color:qlineargradient(spread:pad, x1:0.511, y1:0.477727, x2:0.512, y2:1, stop:0 rgba(0, 0, 0, 255), stop:0.0113636 rgba(83, 83, 83, 255), stop:0.0568182 rgba(98, 98, 98, 255), stop:0.0625 rgba(13, 167, 0, 255), stop:1 rgba(4, 255, 0, 255));");
}
else
{
smBit_1 = false;
ui->secretMessageBut_1->setStyleSheet("border: 0.5px solid #313131; background-color:qlineargradient(spread:pad, x1:0.511, y1:0.477727, x2:0.512, y2:0, stop:0 rgba(0, 0, 0, 255), stop:0.0113636 rgba(83, 83, 83, 255), stop:0.0568182 rgba(98, 98, 98, 255), stop:0.0625 rgba(167, 0, 0, 255), stop:1 rgba(255, 0, 0, 255))");
};
}
else if(smB == ui->secretMessageBut_2)
{
if(smBit_2 == false)
{
smBit_2 = true;
ui->secretMessageBut_2->setStyleSheet("border: 0.5px solid #313131; background-color:qlineargradient(spread:pad, x1:0.511, y1:0.477727, x2:0.512, y2:1, stop:0 rgba(0, 0, 0, 255), stop:0.0113636 rgba(83, 83, 83, 255), stop:0.0568182 rgba(98, 98, 98, 255), stop:0.0625 rgba(13, 167, 0, 255), stop:1 rgba(4, 255, 0, 255));");
}
else
{
smBit_2 = false;
ui->secretMessageBut_2->setStyleSheet("border: 0.5px solid #313131; background-color:qlineargradient(spread:pad, x1:0.511, y1:0.477727, x2:0.512, y2:0, stop:0 rgba(0, 0, 0, 255), stop:0.0113636 rgba(83, 83, 83, 255), stop:0.0568182 rgba(98, 98, 98, 255), stop:0.0625 rgba(167, 0, 0, 255), stop:1 rgba(255, 0, 0, 255))");
};
}
else if(smB == ui->secretMessageBut_3)
{
if(smBit_3 == false)
{
smBit_3 = true;
ui->secretMessageBut_3->setStyleSheet("border: 0.5px solid #313131; background-color:qlineargradient(spread:pad, x1:0.511, y1:0.477727, x2:0.512, y2:1, stop:0 rgba(0, 0, 0, 255), stop:0.0113636 rgba(83, 83, 83, 255), stop:0.0568182 rgba(98, 98, 98, 255), stop:0.0625 rgba(13, 167, 0, 255), stop:1 rgba(4, 255, 0, 255));");
}
else
{
smBit_3 = false;
ui->secretMessageBut_3->setStyleSheet("border: 0.5px solid #313131; background-color:qlineargradient(spread:pad, x1:0.511, y1:0.477727, x2:0.512, y2:0, stop:0 rgba(0, 0, 0, 255), stop:0.0113636 rgba(83, 83, 83, 255), stop:0.0568182 rgba(98, 98, 98, 255), stop:0.0625 rgba(167, 0, 0, 255), stop:1 rgba(255, 0, 0, 255))");
};
}
else if(smB == ui->secretMessageBut_4)
{
if(smBit_4 == false)
{
smBit_4 = true;
ui->secretMessageBut_4->setStyleSheet("border: 0.5px solid #313131; background-color:qlineargradient(spread:pad, x1:0.511, y1:0.477727, x2:0.512, y2:1, stop:0 rgba(0, 0, 0, 255), stop:0.0113636 rgba(83, 83, 83, 255), stop:0.0568182 rgba(98, 98, 98, 255), stop:0.0625 rgba(13, 167, 0, 255), stop:1 rgba(4, 255, 0, 255));");
}
else
{
smBit_4 = false;
ui->secretMessageBut_4->setStyleSheet("border: 0.5px solid #313131; background-color:qlineargradient(spread:pad, x1:0.511, y1:0.477727, x2:0.512, y2:0, stop:0 rgba(0, 0, 0, 255), stop:0.0113636 rgba(83, 83, 83, 255), stop:0.0568182 rgba(98, 98, 98, 255), stop:0.0625 rgba(167, 0, 0, 255), stop:1 rgba(255, 0, 0, 255))");
};
}
else if(smB == ui->secretMessageBut_5)
{
if(smBit_5 == false)
{
smBit_5 = true;
ui->secretMessageBut_5->setStyleSheet("border: 0.5px solid #313131; background-color:qlineargradient(spread:pad, x1:0.511, y1:0.477727, x2:0.512, y2:1, stop:0 rgba(0, 0, 0, 255), stop:0.0113636 rgba(83, 83, 83, 255), stop:0.0568182 rgba(98, 98, 98, 255), stop:0.0625 rgba(13, 167, 0, 255), stop:1 rgba(4, 255, 0, 255));");
}
else
{
smBit_5 = false;
ui->secretMessageBut_5->setStyleSheet("border: 0.5px solid #313131; background-color:qlineargradient(spread:pad, x1:0.511, y1:0.477727, x2:0.512, y2:0, stop:0 rgba(0, 0, 0, 255), stop:0.0113636 rgba(83, 83, 83, 255), stop:0.0568182 rgba(98, 98, 98, 255), stop:0.0625 rgba(167, 0, 0, 255), stop:1 rgba(255, 0, 0, 255))");
};
}
else if(smB == ui->secretMessageBut_6)
{
if(smBit_6 == false)
{
smBit_6 = true;
ui->secretMessageBut_6->setStyleSheet("border: 0.5px solid #313131; background-color:qlineargradient(spread:pad, x1:0.511, y1:0.477727, x2:0.512, y2:1, stop:0 rgba(0, 0, 0, 255), stop:0.0113636 rgba(83, 83, 83, 255), stop:0.0568182 rgba(98, 98, 98, 255), stop:0.0625 rgba(13, 167, 0, 255), stop:1 rgba(4, 255, 0, 255));");
}
else
{
smBit_6 = false;
ui->secretMessageBut_6->setStyleSheet("border: 0.5px solid #313131; background-color:qlineargradient(spread:pad, x1:0.511, y1:0.477727, x2:0.512, y2:0, stop:0 rgba(0, 0, 0, 255), stop:0.0113636 rgba(83, 83, 83, 255), stop:0.0568182 rgba(98, 98, 98, 255), stop:0.0625 rgba(167, 0, 0, 255), stop:1 rgba(255, 0, 0, 255))");
};
}
else if(smB == ui->secretMessageBut_7)
{
if(smBit_7 == false)
{
smBit_7 = true;
ui->secretMessageBut_7->setStyleSheet("border: 0.5px solid #313131; background-color:qlineargradient(spread:pad, x1:0.511, y1:0.477727, x2:0.512, y2:1, stop:0 rgba(0, 0, 0, 255), stop:0.0113636 rgba(83, 83, 83, 255), stop:0.0568182 rgba(98, 98, 98, 255), stop:0.0625 rgba(13, 167, 0, 255), stop:1 rgba(4, 255, 0, 255));");
}
else
{
smBit_7 = false;
ui->secretMessageBut_7->setStyleSheet("border: 0.5px solid #313131; background-color:qlineargradient(spread:pad, x1:0.511, y1:0.477727, x2:0.512, y2:0, stop:0 rgba(0, 0, 0, 255), stop:0.0113636 rgba(83, 83, 83, 255), stop:0.0568182 rgba(98, 98, 98, 255), stop:0.0625 rgba(167, 0, 0, 255), stop:1 rgba(255, 0, 0, 255))");
};
}
else if(smB == ui->secretMessageBut_8)
{
if(smBit_8 == false)
{
smBit_8 = true;
ui->secretMessageBut_8->setStyleSheet("border: 0.5px solid #313131; background-color:qlineargradient(spread:pad, x1:0.511, y1:0.477727, x2:0.512, y2:1, stop:0 rgba(0, 0, 0, 255), stop:0.0113636 rgba(83, 83, 83, 255), stop:0.0568182 rgba(98, 98, 98, 255), stop:0.0625 rgba(13, 167, 0, 255), stop:1 rgba(4, 255, 0, 255));");
}
else
{
smBit_8 = false;
ui->secretMessageBut_8->setStyleSheet("border: 0.5px solid #313131; background-color:qlineargradient(spread:pad, x1:0.511, y1:0.477727, x2:0.512, y2:0, stop:0 rgba(0, 0, 0, 255), stop:0.0113636 rgba(83, 83, 83, 255), stop:0.0568182 rgba(98, 98, 98, 255), stop:0.0625 rgba(167, 0, 0, 255), stop:1 rgba(255, 0, 0, 255))");
};
};
if(smBit_1 && smBit_2 && smBit_3 && smBit_4 && smBit_5 && smBit_6 && smBit_7 && smBit_8)
{
gDebugMode = true;
stt->doEmitionDebugFoundData("[Debug mode ON]");
}
else if(smBit_1 && smBit_2 == false && smBit_3 && smBit_4 == false && smBit_5 == false && smBit_6 == false && smBit_7 == false && smBit_8 == false)
{
code160 = true;
stt->doEmitionDebugFoundData("[Tags-in-chat mode ON]");
}
else if(smBit_1 == false && smBit_2 == false && smBit_3 == false && smBit_4 == false && smBit_5 == false && smBit_6 == false && smBit_7 && smBit_8)
{
gNegDebugMode = true;
stt->doEmitionDebugFoundData("[Negative-hit mode ON]");
}
else if(smBit_1 == false && smBit_2 && smBit_3 && smBit_4 && smBit_5 && smBit_6 && smBit_7 && smBit_8)
{
HTMLDebugMode = true;
stt->doEmitionDebugFoundData("[HTML Debug mode ON]");
}
else
{
if(gDebugMode)
{
gDebugMode = false;
stt->doEmitionDebugFoundData("[Debug mode OFF]");
};
if(code160)
{
code160 = false;
stt->doEmitionDebugFoundData("[Tags-in-chat mode OFF]");
};
if(gNegDebugMode)
{
gNegDebugMode = false;
stt->doEmitionDebugFoundData("[Negative-hit mode OFF]");
};
if(HTMLDebugMode)
{
HTMLDebugMode = false;
stt->doEmitionDebugFoundData("[HTML Debug mode OFF]");
};
};
2015-02-27 13:55:35 +00:00
}
2015-02-24 14:14:32 +00:00
2015-02-24 14:00:19 +00:00
void nesca_3::IPScanSeq()
{
if(ui->ipLine->text() != "")
{
if(ui->portLine->text() != "")
{
2015-03-19 14:34:35 +00:00
saveOptions();
2015-04-01 12:39:14 +00:00
ui->labelParsed_Value->setText("0/0");
ui->labelOffline_Value->setText("0");
2015-03-16 14:29:34 +00:00
stopFirst = false;
2015-02-24 14:00:19 +00:00
ui->tabMainWidget->setTabEnabled(1, false);
ui->tabMainWidget->setTabEnabled(2, false);
QString rangeData = ui->ipLine->text();
if(rangeData.indexOf("-") > 0)
{
rangeData = ui->ipLine->text();
}
else
{
if(rangeData.indexOf("/") < 0)
{
rangeData = ui->ipLine->text() + "-" + ui->ipLine->text();
}
else
{
rangeData = ui->ipLine->text();
};
};
strcpy(inputStr, ("DUMMY|0|" + rangeData + "|" + ui->threadLine->text() + "|-p" + ui->portLine->text().replace(" ", "")).toLocal8Bit().data());
stt->start();
startFlag = true;
globalScanFlag = true;
ui->startScanButton_3->setText("Stop");
ui->startScanButton_3->setStyleSheet(
" QPushButton {"
"background-color: qlineargradient(spread:none, x1:1, y1:0, x2:1, y2:1, stop:0.681818 rgba(0, 0, 0, 250), stop:1 rgba(255, 255, 255, 130));"
"color: red;"
"border: 0.5px solid qlineargradient(spread:reflect, x1:0.54, y1:0.488591, x2:0.54, y2:0, stop:0 rgba(255, 255, 255, 130), stop:1 rgba(0, 0, 0, 255));"
"}"
);
ui->dataText->clear();
}
else
{
stt->doEmitionRedFoundData("No ports specified!");
};
}
else
{
if(stopFirst == false)
{
stopFirst = true;
globalScanFlag = false;
ui->startScanButton_3->setStyleSheet(
" QPushButton {"
"background-color: qlineargradient(spread:none, x1:1, y1:0, x2:1, y2:1, stop:0.681818 rgba(0, 0, 0, 250), stop:1 rgba(255, 255, 255, 130));"
"color: red;"
"border: 0.5px solid qlineargradient(spread:reflect, x1:0.54, y1:0.488591, x2:0.54, y2:0, stop:0 rgba(255, 255, 255, 130), stop:1 rgba(0, 0, 0, 255));"
"}"
);
ui->startScanButton_3->setText("STOP!");
stt->doEmitionYellowFoundData("Trying to stop. Please, wait...");
}
else
{
globalScanFlag = false;
ui->startScanButton_3->setStyleSheet(
" QPushButton {"
"background-color: qlineargradient(spread:none, x1:1, y1:0, x2:1, y2:1, stop:0.681818 rgba(0, 0, 0, 250), stop:1 rgba(255, 255, 255, 130));"
"color: yellow;"
"border: 0.5px solid qlineargradient(spread:reflect, x1:0.54, y1:0.488591, x2:0.54, y2:0, stop:0 rgba(255, 255, 255, 130), stop:1 rgba(0, 0, 0, 255));"
"}"
);
ui->startScanButton_3->setText("Wait...");
stt->doEmitionYellowFoundData("Wait, killing threads...");
STTTerminate();
};
};
2015-02-27 13:55:35 +00:00
}
2015-02-24 14:00:19 +00:00
void nesca_3::DNSScanSeq()
{
if(ui->lineEditStartIPDNS->text() != "")
{
if(ui->lineEditPort->text() != "")
{
2015-03-19 14:34:35 +00:00
saveOptions();
2015-02-24 14:00:19 +00:00
ui->labelParsed_Value->setText("0/0");
2015-04-01 12:39:14 +00:00
ui->labelOffline_Value->setText("0");
2015-02-24 14:00:19 +00:00
if(ui->lineEditStartIPDNS->text().indexOf(".") > 0)
{
QStringList lst = ui->lineEditStartIPDNS->text().split(".");
ui->lineEditStartIPDNS->setText(lst[0]);
QString topLevelDomainStr;
for(int i = 1; i < lst.size(); ++i)
{
topLevelDomainStr += ".";
topLevelDomainStr += lst[i];
};
ui->lineILVL->setText(topLevelDomainStr);
};
2015-03-16 14:29:34 +00:00
stopFirst = false;
2015-02-24 14:00:19 +00:00
ui->tabMainWidget->setTabEnabled(0, false);
ui->tabMainWidget->setTabEnabled(2, false);
strcpy(inputStr, ("DUMMY|1|" + ui->lineEditStartIPDNS->text() + "|" + ui->lineILVL->text() + "|" + ui->lineEditThread->text() + "|-p" + ui->lineEditPort->text().replace(" ", "")).toLocal8Bit().data());
stt->start();
startFlag = true;
globalScanFlag = true;
ui->startScanButton_4->setText("Stop");
ui->startScanButton_4->setStyleSheet(
" QPushButton {"
"background-color: qlineargradient(spread:none, x1:1, y1:0, x2:1, y2:1, stop:0.681818 rgba(0, 0, 0, 250), stop:1 rgba(255, 255, 255, 130));"
"color: red;"
"border: 0.5px solid qlineargradient(spread:reflect, x1:0.54, y1:0.488591, x2:0.54, y2:0, stop:0 rgba(255, 255, 255, 130), stop:1 rgba(0, 0, 0, 255));"
"}"
);
ui->dataText->clear();
}
else
{
stt->doEmitionRedFoundData("No ports specified!");
};
}
else
{
stt->doEmitionRedFoundData("Wrong mask input.");
};
2015-02-27 13:55:35 +00:00
}
2015-02-24 14:00:19 +00:00
void nesca_3::ImportScanSeq()
{
QString fileName;
if(importFileName.size() == 0) fileName = QFileDialog::getOpenFileName(this, tr("Open File"),
"",
tr("Files (*.txt)")
);
else fileName = importFileName;
if(fileName != "")
{
2015-03-19 14:34:35 +00:00
saveOptions();
2015-02-24 14:00:19 +00:00
ui->tabMainWidget->setTabEnabled(0, false);
ui->tabMainWidget->setTabEnabled(1, false);
2015-04-01 12:39:14 +00:00
ui->labelParsed_Value->setText("0/0");
ui->labelOffline_Value->setText("0");
2015-02-24 14:00:19 +00:00
strcpy(inputStr, ("DUMMY|-f|" + fileName + "|" + ui->importThreads->text() + "|-p" + ui->importPorts->text().replace(" ", "")).toLocal8Bit().data());
globalScanFlag = true;
stt->start();
startFlag = true;
stopFirst = false;
pbTh->start();
ui->importButton->setText("Stop");
ui->importButton->setStyleSheet(
" #importButton {"
"background-color: qlineargradient(spread:none, x1:1, y1:0, x2:1, y2:1, stop:0.681818 rgba(0, 0, 0, 250), stop:1 rgba(255, 255, 255, 130));"
"color: red;"
"border: 0.5px solid qlineargradient(spread:reflect, x1:0.54, y1:0.488591, x2:0.54, y2:0, stop:0 rgba(255, 255, 255, 130), stop:1 rgba(0, 0, 0, 255));"
"}"
);
ui->dataText->clear();
}
else
{
stt->doEmitionYellowFoundData("Empty filename.");
};
2015-02-27 13:55:35 +00:00
}
2015-02-24 14:00:19 +00:00
QLabel *smsgLbl;
QLabel *smsgNLbl;
void nesca_3::slotShowServerMsg(QString str)
{
QMessageBox msgBox;
msgBox.setWindowFlags ( Qt::FramelessWindowHint|Qt::WindowStaysOnTopHint|Qt::SubWindow );
msgBox.setStyleSheet("border: 0.5px solid #7c7c7c; background-color:rgba(25, 25, 25, 255); color:#7c7c7c;");
msgBox.setText("Server message");
msgBox.setInformativeText(str);
msgBox.setContentsMargins(0, 0, 25, 15);
msgBox.setStandardButtons(QMessageBox::Ok);
msgBox.setDefaultButton(QMessageBox::Ok);
msgBox.button(QMessageBox::Ok)->setStyleSheet(
"background-color: qlineargradient(spread:none, x1:1, y1:0, x2:1, y2:1, stop:0.681818 rgba(0, 0, 0, 250), stop:1 rgba(255, 255, 255, 130));"
"color: gray;"
"border: 0.5px solid qlineargradient(spread:reflect, x1:0.54, y1:0.488591, x2:0.54, y2:0, stop:0 rgba(255, 255, 255, 130), stop:1 rgba(0, 0, 0, 255));"
"width: 20px;"
"position: absolute;"
);
msgBox.exec();
2015-02-27 13:55:35 +00:00
}
void nesca_3::DNSLine_ValueChanged()
2015-02-24 14:00:19 +00:00
{
2015-03-23 08:39:37 +00:00
if(!globalScanFlag) ui->startScanButton_4->setText("Start");
2015-02-27 13:55:35 +00:00
}
2015-02-24 14:00:19 +00:00
void nesca_3::slotRestoreDefPorts()
{
int ci = ui->tabMainWidget->currentIndex();
if(ci == 0)
{
ui->portLine->setText(PORTSET);
}
else if(ci == 1)
{
ui->lineEditPort->setText(PORTSET);
}
else if(ci == 2)
{
ui->importPorts->setText(PORTSET);
};
2015-02-27 13:55:35 +00:00
}
2015-02-24 14:00:19 +00:00
QGraphicsTextItem *textItem = NULL;
QGraphicsRectItem* pbItem = NULL;
QGraphicsRectItem* pbBlackRectItem = NULL;
QPen pbPen(QColor(227, 227, 227, 150));
QFont pbPointerFont;
void nesca_3::slotPBUpdate()
{
int val = this->perc;
if(textItem != NULL)
{
delete textItem;
textItem = NULL;
};
if(pbItem != NULL)
{
delete pbItem;
pbItem = NULL;
};
if(pbBlackRectItem != NULL)
{
delete pbBlackRectItem;
pbBlackRectItem = NULL;
};
pbScene->clear();
QLinearGradient grad1(0, 0, 0, 110);
if(val < 33) grad1.setColorAt(0.1, QColor(207, 0, 0));
else if( val < 66 ) grad1.setColorAt(0.1, QColor(247, 244, 0));
else if( val < 99 ) grad1.setColorAt(0.1, QColor(0, 207, 0));
QLinearGradient gradBlack(0, 0, 0, 110);
gradBlack.setColorAt(0.1, QColor(0, 0, 0));
pbBlackRectItem = new QGraphicsRectItem(0,0,5,99);
pbBlackRectItem->setBrush(gradBlack);
pbScene->addItem(pbBlackRectItem);
pbItem = new QGraphicsRectItem(0,0,5,val);
pbItem->setBrush(grad1);
pbScene->addItem(pbItem);
textItem = pbScene->addText("- " + QString::number(val) + "%", pbPointerFont);
textItem->setX(2);
textItem->setY(val - 10);
textItem->setDefaultTextColor(QColor(255, 255, 255, 180));
pbScene->addLine(4, 11, 6, 11, pbPen);
pbScene->addLine(4, 22, 6, 22, pbPen);
pbScene->addLine(0, 33, 8, 33, pbPen);
pbScene->addLine(4, 44, 6, 44, pbPen);
pbScene->addLine(4, 55, 6, 55, pbPen);
pbScene->addLine(0, 66, 8, 66, pbPen);
pbScene->addLine(4, 77, 6, 77, pbPen);
pbScene->addLine(4, 88, 6, 88, pbPen);
2015-02-27 13:55:35 +00:00
}
2015-02-24 14:00:19 +00:00
void nesca_3::changeNSTrackLabel(bool status)
{
if(status) ui->NSTrackStatusLabel->setStyleSheet("background-color: green; border: 1px solid white;");
else ui->NSTrackStatusLabel->setStyleSheet("background-color: black; border: 1px solid white;");
2015-02-27 13:55:35 +00:00
}
2015-03-23 21:49:38 +00:00
void nesca_3::onLinkClicked(QUrl link)
{
QDesktopServices::openUrl(link);
}
2015-02-24 14:00:19 +00:00
void nesca_3::ConnectEvrthng()
{
connect ( pbTh, SIGNAL(upd()), this, SLOT(slotPBUpdate()));
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() ) );
connect ( ui->secretMessageBut_4, SIGNAL( clicked() ), this, SLOT( smReaction() ) );
connect ( ui->secretMessageBut_5, SIGNAL( clicked() ), this, SLOT( smReaction() ) );
connect ( ui->secretMessageBut_6, SIGNAL( clicked() ), this, SLOT( smReaction() ) );
connect ( ui->secretMessageBut_7, SIGNAL( clicked() ), this, SLOT( smReaction() ) );
2015-03-23 12:52:07 +00:00
connect ( ui->secretMessageBut_8, SIGNAL( clicked() ), this, SLOT( smReaction() ) );
connect ( ui->dataText, SIGNAL( anchorClicked(QUrl) ), this, SLOT( onLinkClicked(QUrl) ) );
2015-02-24 14:00:19 +00:00
connect ( ui->checkKeyBut, SIGNAL( clicked() ), this, SLOT( CheckPersKey() ) );
2015-03-23 12:52:07 +00:00
connect ( ui->DataflowModeBut, SIGNAL( clicked() ), this, SLOT( slotShowDataflow() ) );
connect ( ui->JobModeBut, SIGNAL( clicked() ), this, SLOT( switchToJobMode() ) );
connect ( ui->clearLogBut, SIGNAL( clicked() ), this, SLOT( slotClearLogs() ) );
2015-02-24 14:00:19 +00:00
connect ( mct, SIGNAL(showNewMsg(QString)), this, SLOT(slotShowServerMsg(QString)));
connect ( tray, SIGNAL(activated(QSystemTrayIcon::ActivationReason)),this,SLOT(trayButtonClicked()));
connect ( ui->exitButton, SIGNAL( clicked() ), this, SLOT( exitButtonClicked() ) );
connect ( ui->trayButton, SIGNAL( clicked() ), this, SLOT( trayButtonClicked() ) );
connect ( ui->switcherBut, SIGNAL( clicked() ), this, SLOT( switchDataFields() ) );
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->shuffle_onoff, SIGNAL(toggled(bool)), this, SLOT(ChangeShuffle(bool)));
connect ( ui->trackerOnOff, SIGNAL(toggled(bool)), this, SLOT(ChangeTrackerOK(bool)));
2015-02-24 14:00:19 +00:00
connect ( ui->importThreads, SIGNAL( textChanged(QString) ), this, SLOT( ChangeLabelThreads_ValueChanged(QString) ) );
connect ( ui->threadLine, SIGNAL( textChanged(QString) ), this, SLOT( ChangeLabelThreads_ValueChanged(QString) ) );
connect ( ui->PingTO, SIGNAL( textChanged(QString) ), this, SLOT( PingTO_ChangeValue(QString) ) );
connect ( ui->threadDelayBox, SIGNAL( textChanged(QString) ), this, SLOT( ThreadDelay_ChangeValue(QString) ) );
connect ( ui->maxBrutingThrBox, SIGNAL( textChanged(QString) ), this, SLOT( MaxBrutingThr_ChangeValue(QString) ) );
connect ( ui->lineEditThread, SIGNAL( textChanged(QString) ), this, SLOT( ChangeLabelThreads_ValueChanged(QString) ) );
connect ( ui->iptoLine_value, SIGNAL( textChanged(QString) ), this, SLOT( ChangeLabelTO_ValueChanged(QString) ) );
connect ( ui->iptoLine_value_2, SIGNAL( textChanged(QString) ), this, SLOT( ChangeLabelTO_ValueChanged(QString) ) );
connect ( ui->iptoLine_value_3, SIGNAL( textChanged(QString) ), this, SLOT( ChangeLabelTO_ValueChanged(QString) ) );
connect ( ui->restoreDefaultPorts1, SIGNAL( clicked() ), this, SLOT( slotRestoreDefPorts() ) );
connect ( ui->restoreDefaultPorts2, SIGNAL( clicked() ), this, SLOT( slotRestoreDefPorts() ) );
2015-03-23 12:52:07 +00:00
connect ( ui->restoreDefaultPorts3, SIGNAL( clicked() ), this, SLOT( slotRestoreDefPorts() ) );
2015-02-24 14:00:19 +00:00
connect ( ui->lineEditStartIPDNS, SIGNAL( textChanged(QString) ), this, SLOT( DNSLine_ValueChanged(QString) ) );
connect ( ui->ipLine, SIGNAL( returnPressed() ), this, SLOT( startScanButtonClicked() ) );
connect ( ui->threadLine, SIGNAL( returnPressed() ), this, SLOT( startScanButtonClicked() ) );
connect ( ui->portLine, SIGNAL( returnPressed() ), this, SLOT( startScanButtonClicked() ) );
connect ( ui->lineEditStartIPDNS, SIGNAL( returnPressed() ), this, SLOT( startScanButtonClickedDNS() ) );
connect ( ui->lineILVL, SIGNAL( returnPressed() ), this, SLOT( startScanButtonClickedDNS() ) );
connect ( ui->lineEditPort, SIGNAL( returnPressed() ), this, SLOT( startScanButtonClickedDNS() ) );
connect ( ui->lineEditThread, SIGNAL( returnPressed() ), this, SLOT( startScanButtonClickedDNS() ) );
connect ( ui->logoLabel, SIGNAL( clicked() ), this, SLOT( logoLabelClicked() ) );
connect ( ui->me2ScanBut, SIGNAL( clicked() ), this, SLOT( activateME2ScanScene() ) );
connect ( ui->QoSScanBut, SIGNAL( clicked() ), this, SLOT( activateQoSScanBut() ) );
connect ( ui->VoiceScanBut, SIGNAL( clicked() ), this, SLOT( activateVoiceScanBut() ) );
2015-03-23 12:52:07 +00:00
connect ( ui->PieStatBut, SIGNAL( clicked() ), this, SLOT( activatePieStatBut() ) );
2015-02-24 14:00:19 +00:00
connect ( stt, SIGNAL(showRedVersion()), this, SLOT(slotShowRedVersion()));
connect ( stt, SIGNAL(startScanIP()), this, SLOT(IPScanSeq()));
connect ( stt, SIGNAL(startScanDNS()), this, SLOT(DNSScanSeq()));
connect ( stt, SIGNAL(startScanImport()), this, SLOT(ImportScanSeq()));
connect ( stt, SIGNAL(sIncData(QString, QString)), this, SLOT(slotIncData(QString, QString)));
2015-03-10 20:09:05 +00:00
connect ( stt, SIGNAL(sOutData(QString)), this, SLOT(slotOutData(QString)));
2015-02-24 14:00:19 +00:00
connect ( stt, SIGNAL(changeDebugFoundData(QString)), this, SLOT(appendDebugText(QString)));
connect ( stt, SIGNAL(changeYellowFoundData(QString)), this, SLOT(appendNotifyText(QString)));
connect ( stt, SIGNAL(changeRedFoundData(QString)), this, SLOT(appendErrText(QString)));
connect ( stt, SIGNAL(changeGreenFoundData(QString)), this, SLOT(appendOKText(QString)));
connect ( stt, SIGNAL(killSttThread()), this, SLOT(STTTerminate()));
connect ( stt, SIGNAL(changeParsedValue(QString)), ui->labelParsed_Value, SLOT(setText(QString)));
connect ( stt, SIGNAL(changeIpRange(QString)), ui->labelIpRange_Value, SLOT(setText(QString)));
connect ( stt, SIGNAL(changeThreads(QString)), ui->labelThreads_Value, SLOT(setText(QString)));
connect ( stt, SIGNAL(changeIPS(QString)), ui->labelIPS_Value, SLOT(setText(QString)));
connect ( stt, SIGNAL(changeFoundData(QString)), this, SLOT(appendDefaultText(QString)));
connect ( stt, SIGNAL(changeBAValue(QString)), ui->labelBAThreads_Value, SLOT(setText(QString)));
connect ( stt, SIGNAL(changeStatus(QString)), ui->labelStatus_Value, SLOT(setText(QString)));
connect ( stt, SIGNAL(changeTargetsLeft(QString)), ui->labelTargetsLeft_Value, SLOT(setText(QString)));
connect ( stt, SIGNAL(changeOffline(QString)), ui->labelOffline_Value, SLOT(setText(QString)));
connect ( stt, SIGNAL(changeBAData(QString)), ui->BAText, SLOT(append(QString)));
connect ( stt, SIGNAL(changeGreenBAData(QString)), this, SLOT(appendGreenBAData(QString)));
connect ( stt, SIGNAL(changeRedBAData(QString)), this, SLOT(appendRedBAData(QString)));
connect ( stt, SIGNAL(signalDataSaved(bool)), this, SLOT(changeNSTrackLabel(bool)));
connect ( adtHN, SIGNAL(sDrawActivityLine(QString)), this, SLOT(slotDrawActivityLine(QString)));
connect ( adtHN, SIGNAL(sDrawGrid()), this, SLOT(slotDrawActivityGrid()));
connect ( dtHN, SIGNAL(sAddDelimLines()), this, SLOT(slotDrawDelimLines()));
connect ( dtHN, SIGNAL(sDrawGrid()), this, SLOT(slotDrawGrid()));
connect ( dtHN, SIGNAL(sAddLine(int, int, int, int)), this, SLOT(slotAddLine(int, int, int, int)));
connect ( dtME2, SIGNAL(sAddPolyLine()), this, SLOT(slotAddPolyLine()));
connect ( dtME2, SIGNAL(sDrawTextPlacers()), this, SLOT(slotDrawTextPlacers()));
connect ( dtQoS, SIGNAL(sAddLine()), this, SLOT(slotQoSAddLine()));
connect ( dtGridQoS, SIGNAL(sAddLine()), this, SLOT(slotQoSAddGrid()));
connect ( dtGridQoS, SIGNAL(sAddDelimLines()), this, SLOT(slotQoSDrawDelimLines()));
connect ( vsTh, SIGNAL(sAddLine()), this, SLOT(slotVoiceAddLine()));
connect ( vsTh, SIGNAL(sDrawGrid(int)), this, SLOT(slotDrawVoiceGrid(int)));
connect ( vsTh, SIGNAL(sDrawTextPlacers()), this, SLOT(slotDrawTextPlacers()));
2015-03-23 12:52:07 +00:00
connect ( psTh, SIGNAL(sUpdatePie()), this, SLOT(slotUpdatePie()) );
2015-03-10 14:35:50 +00:00
connect ( ui->tabMainWidget, SIGNAL(currentChanged(int)), this, SLOT(slotTabChanged(int)) );
2015-03-23 12:52:07 +00:00
/*Msg blinker*/
//connect ( irc_nmb, SIGNAL(sBlinkMessage()), this, SLOT(slotBlinkMessage()) );
2015-03-10 14:35:50 +00:00
}
2015-03-20 14:28:51 +00:00
void _LoadPersInfoToLocalVars(int savedTabIndex) {
2015-04-01 12:39:14 +00:00
ZeroMemory(currentIP, sizeof(currentIP));
ZeroMemory(finalIP, sizeof(finalIP));
2015-03-10 14:35:50 +00:00
ZeroMemory(gPorts, sizeof(gPorts));
2015-04-01 12:39:14 +00:00
ZeroMemory(gTLD, sizeof(gTLD));
2015-03-10 14:35:50 +00:00
if(savedTabIndex == 0)
{
gMode = 0;
gThreads = ui->threadLine->text().toInt();
2015-03-20 14:28:51 +00:00
QString targetLine = ui->ipLine->text();
2015-03-10 14:35:50 +00:00
2015-03-20 14:28:51 +00:00
if(ui->ipLine->text().indexOf("-") > 0)
2015-03-10 14:35:50 +00:00
{
2015-03-20 14:28:51 +00:00
if(ui->ipLine->text().indexOf("/") < 0) {
QList<QString> splittedTargetLine = targetLine.split("-");
strcpy(currentIP, splittedTargetLine[0].toLocal8Bit().data());
strcpy(finalIP, splittedTargetLine[1].toLocal8Bit().data());
}
2015-03-10 14:35:50 +00:00
}
else
{
if(ui->ipLine->text().indexOf("/") < 0)
{
2015-03-23 09:06:30 +00:00
strcpy(currentIP, ui->ipLine->text().toLocal8Bit().data());
strcat(currentIP, "-");
strcat(currentIP, ui->ipLine->text().toLocal8Bit().data());
2015-03-10 14:35:50 +00:00
};
};
strncpy(gPorts, ("-p" + ui->portLine->text()).toLocal8Bit().data(), 65536);
gPorts[ui->lineEditPort->text().length() + 2] = '\0';
2015-03-10 14:35:50 +00:00
}
else if(savedTabIndex == 1)
{
gMode = 1;
gThreads = ui->lineEditThread->text().toInt();
2015-03-23 09:06:30 +00:00
strcpy(currentIP, ui->lineEditStartIPDNS->text().toLocal8Bit().data());
2015-04-01 12:39:14 +00:00
strcpy(gTLD, ui->lineILVL->text().toLocal8Bit().data());
2015-03-10 14:35:50 +00:00
strncpy(gPorts, ("-p" + ui->lineEditPort->text()).toLocal8Bit().data(), 65536);
gPorts[ui->lineEditPort->text().length() + 2] = '\0';
2015-04-01 12:39:14 +00:00
}
else if(savedTabIndex == 2)
{
gMode = -1;
gThreads = ui->importThreads->text().toInt();
strncpy(gPorts, ("-p" + ui->importPorts->text()).toLocal8Bit().data(), 65536);
2015-03-10 14:35:50 +00:00
};
strcpy(trcSrv, ui->lineTrackerSrv->text().toLocal8Bit().data());
strcpy(trcScr, ui->lineTrackerScr->text().toLocal8Bit().data());
strncpy(trcPersKey, ui->linePersKey->text().toLocal8Bit().data(), 32);
memset(trcPersKey + 32, '\0', 1);
strcpy(trcSrvPortLine, ui->trcSrvPortLine->text().toLocal8Bit().data());
strncpy(gProxyIP, ui->systemProxyIP->text().toLocal8Bit().data(), 64);
gProxyIP[ui->systemProxyIP->text().size()] = '\0';
strncpy(gProxyPort, ui->systemProxyPort->text().toLocal8Bit().data(), 8);
gProxyPort[ui->systemProxyPort->text().size()] = '\0';
2015-03-20 14:28:51 +00:00
}
2015-03-10 14:35:50 +00:00
2015-03-20 14:28:51 +00:00
void nesca_3::saveOptions()
{
_LoadPersInfoToLocalVars(savedTabIndex);
2015-03-10 14:35:50 +00:00
_SaveBackupToFile();
2015-02-27 13:55:35 +00:00
}
2015-02-24 14:00:19 +00:00
2015-03-17 14:30:53 +00:00
QString loadNescaSetup(const char *resStr, const char *option) {
2015-03-06 14:32:36 +00:00
2015-03-17 14:30:53 +00:00
char *lex = NULL;
2015-03-06 14:32:36 +00:00
if(strstr(resStr, option) != NULL)
{
2015-03-17 14:30:53 +00:00
lex = (char*)(strstr(resStr, option) + strlen(option));
2015-03-06 14:32:36 +00:00
if(strlen(lex) > 1)
{
lex[strlen(lex) - 1] = '\0';
return QString(lex);
} return "";
}
2015-03-12 14:27:17 +00:00
2015-03-06 14:32:36 +00:00
return "";
}
2015-03-17 14:30:53 +00:00
void setUIText(char *field, QLineEdit *qle, const char *resStr) {
if (strstr(resStr, field) != NULL) {
QString intermediateString = loadNescaSetup(resStr, field).simplified();
intermediateString.length() > 0 ? qle->setText(intermediateString) : (void)NULL;
}
}
2015-02-24 14:00:19 +00:00
void RestoreSession()
{
2015-04-01 12:39:14 +00:00
ZeroMemory(gPorts, sizeof(gPorts));
ZeroMemory(gTLD, sizeof(gTLD));
2015-02-24 14:00:19 +00:00
FILE *resFile = fopen("restore", "r");
char resStr[128] = {0};
char *lex;
if(resFile != NULL)
{
stt->doEmitionYellowFoundData("Previous session file found! Restoring...");
2015-02-24 14:14:32 +00:00
2015-02-24 14:00:19 +00:00
while(fgets(resStr, 128, resFile) != NULL)
{
if(strstr(resStr, "[SESSION]:") != NULL)
2015-03-17 14:30:53 +00:00
{
2015-02-24 14:00:19 +00:00
lex = strtok(strstr(resStr, "[SESSION]:") + strlen("[SESSION]:"), " ");
gMode = atoi(lex);
lex = strtok(NULL, " ");
if (lex == nullptr) {
stt->doEmitionRedFoundData("Restore file is corrupted.");
return;
}
if(gMode == 0)
{
if(strstr(lex, "-") != NULL)
{
strncpy(gRange, lex, (int)(strstr(lex, "-") - lex));
strcat(gRange, "-");
strcat(gRange, strstr(lex, "-") + 1);
lex = strtok(NULL, " ");
gThreads = atoi(lex);
ui->threadLine->setText(QString(lex));
ui->ipLine->setText(QString(gRange));
ui->tabMainWidget->setCurrentIndex(0);
}
else if(strstr(lex, "/") != NULL)
{
strncpy(gRange, lex, (int)(strstr(lex, "/") - lex));
strcat(gRange, "/");
strcat(gRange, strstr(lex, "/") + 1);
lex = strtok(NULL, " ");
gThreads = atoi(lex);
ui->threadLine->setText(QString(lex));
ui->ipLine->setText(QString(gRange));
ui->tabMainWidget->setCurrentIndex(0);
};
}
else if(gMode == 1)
{
2015-03-10 14:35:50 +00:00
QString qLex(lex);
qLex.replace("[az]", "\\l");
qLex.replace("[0z]", "\\w");
qLex.replace("[09]", "\\d");
ui->lineEditStartIPDNS->setText(qLex);
2015-02-24 14:00:19 +00:00
lex = strtok(NULL, " ");
2015-04-01 12:39:14 +00:00
if(strstr(lex, ".") != NULL) {
strcpy(gTLD, lex);
lex = strtok(NULL, " ");
}
2015-03-10 14:35:50 +00:00
gThreads = atoi(lex);
2015-02-24 14:00:19 +00:00
ui->lineEditThread->setText(QString(lex));
2015-04-01 12:39:14 +00:00
ui->lineILVL->setText(QString(gTLD));
2015-02-24 14:00:19 +00:00
ui->tabMainWidget->setCurrentIndex(1);
ui->startScanButton_4->setText("RESTORE");
}
else if(gMode == -1)
{
lex = strtok(NULL, " ");
gThreads = atoi(lex);
ui->importThreads->setText(QString(lex));
FILE *testFile = fopen("tempIPLst.bk", "r");
if(testFile != NULL)
{
ui->importButton->setText("RESTORE");
importFileName = "tempIPLst.bk";
fclose(testFile);
};
ui->tabMainWidget->setCurrentIndex(2);
};
lex = strtok(NULL, " ");
if(lex != NULL && strstr(lex, "-p") != NULL)
{
QString PortString = "";
char *tPorts = strstr(lex, "-p");
int strln = strlen(tPorts);
char *fPorts = new char[strln];
strncpy(fPorts, tPorts + 2, strln);
PortString = QString(fPorts);
PortString.replace("\n", "");
2015-03-23 09:37:02 +00:00
if(PortString.length() > 0) {
ui->lineEditPort->setText(PortString);
ui->portLine->setText(PortString);
ui->importPorts->setText(PortString);
} else {
ui->lineEditPort->setText(PORTSET);
ui->portLine->setText(PORTSET);
ui->importPorts->setText(PORTSET);
}
2015-02-24 14:00:19 +00:00
delete []fPorts;
}
else
2015-03-23 09:37:02 +00:00
{
ui->lineEditPort->setText(PORTSET);
ui->portLine->setText(PORTSET);
ui->importPorts->setText(PORTSET);
2015-02-24 14:00:19 +00:00
};
};
2015-03-17 14:30:53 +00:00
setUIText("[NDBSERVER]:", ui->lineTrackerSrv, resStr);
setUIText("[NDBSCRIPT]:", ui->lineTrackerScr, resStr);
setUIText("[NDBPORT]:", ui->trcSrvPortLine, resStr);
if (strstr(resStr, "[PING]:") != NULL) {
lex = strstr(resStr, "[PING]:") + strlen("[PING]:");
if (strlen(lex) > 1)
{
lex[strlen(lex) - 1] = '\0';
ui->pingingOnOff->setChecked(strcmp(lex, "true") == 0 ? true : false);
};
2015-03-23 09:37:02 +00:00
} else if (strstr(resStr, "[SHUFFLE]:") != NULL) {
lex = strstr(resStr, "[SHUFFLE]:") + strlen("[SHUFFLE]:");
if (strlen(lex) > 1)
{
lex[strlen(lex) - 1] = '\0';
ui->shuffle_onoff->setChecked(strcmp(lex, "true") == 0 ? true : false);
};
} else if (strstr(resStr, "[NSTRACK]:") != NULL) {
lex = strstr(resStr, "[NSTRACK]:") + strlen("[NSTRACK]:");
if (strlen(lex) > 1)
{
lex[strlen(lex) - 1] = '\0';
ui->trackerOnOff->setChecked(strcmp(lex, "true") == 0 ? true : false);
};
2015-03-17 14:30:53 +00:00
}
setUIText("[PING_TO]:", ui->PingTO, resStr);
setUIText("[THREAD_DELAY]:", ui->threadDelayBox, resStr);
if (strstr(resStr, "[TIMEOUT]:") != NULL) {
const QString &tempLex = loadNescaSetup(resStr, "[TIMEOUT]:");
2015-03-10 14:35:50 +00:00
if(tempLex.toInt() > 0) {
2015-03-22 00:43:15 +00:00
ui->iptoLine_value->setText(tempLex.simplified());
2015-03-23 09:37:02 +00:00
ui->iptoLine_value_2->setText(tempLex.simplified());
ui->iptoLine_value_3->setText(tempLex.simplified());
2015-03-10 14:35:50 +00:00
}
2015-03-17 14:30:53 +00:00
}
setUIText("[MAXBTHR]:", ui->maxBrutingThrBox, resStr);
setUIText("[PERSKEY]:", ui->linePersKey, resStr);
setUIText("[SYSTEMPROXYIP]:", ui->systemProxyIP, resStr);
setUIText("[SYSTEMPROXYPORT]:", ui->systemProxyPort, resStr);
ZeroMemory(resStr, sizeof(resStr));
2015-02-24 14:00:19 +00:00
};
2015-03-06 14:32:36 +00:00
fclose(resFile);
2015-03-20 14:28:51 +00:00
_LoadPersInfoToLocalVars(nesca_3::savedTabIndex);
2015-03-10 14:35:50 +00:00
stt->doEmitionGreenFoundData("Previous session loaded.");
2015-02-24 14:00:19 +00:00
};
}
2015-02-27 13:55:35 +00:00
2015-02-24 14:00:19 +00:00
void CreateVerFile()
{
FILE *vf = fopen("version", "w");
if(vf != NULL)
{
fputs(gVER, vf);
fclose(vf);
};
2015-02-27 13:55:35 +00:00
}
2015-03-24 11:15:38 +00:00
std::string GetVer()
2015-02-24 14:00:19 +00:00
{
2015-03-24 14:29:27 +00:00
#if defined(WIN32) || defined(_WIN32) || defined(__WIN32) && !defined(__CYGWIN__)
int dver = 0;
2015-02-27 13:55:35 +00:00
int tver = 0;
2015-02-24 14:00:19 +00:00
2015-03-24 14:29:27 +00:00
dver = __DATE__[9] - 48;
dver *= 10;
dver += __DATE__[10] - 48;
dver *= 100;
if(__DATE__[0] == 'J' && __DATE__[1] == 'a') dver += 1;
else if(__DATE__[0] == 'F') dver += 2;
2015-03-17 14:30:53 +00:00
else if(__DATE__[0] == 'M' && __DATE__[2] == 'r') dver += 3;
2015-03-24 14:29:27 +00:00
else if(__DATE__[0] == 'A' && __DATE__[1] == 'p') dver += 4;
2015-03-17 14:30:53 +00:00
else if(__DATE__[0] == 'M' && __DATE__[2] == 'y') dver += 5;
else if(__DATE__[0] == 'J' && __DATE__[2] == 'n') dver += 6;
else if(__DATE__[0] == 'J' && __DATE__[2] == 'l') dver += 7;
2015-03-24 14:29:27 +00:00
else if(__DATE__[0] == 'A' && __DATE__[1] == 'u') dver += 8;
else if(__DATE__[0] == 'S') dver += 9;
else if(__DATE__[0] == 'O') dver += 10;
else if(__DATE__[0] == 'N') dver += 11;
else if(__DATE__[0] == 'D') dver += 12;
if(__DATE__[4] != ' ')
{
dver *= 10;
dver += __DATE__[4] - 48;
}
else dver *= 10;
dver *= 10;
dver += __DATE__[5] - 48;
tver = __TIME__[0] - 48;
tver *= 10;
tver += __TIME__[1] - 48;
tver *= 10;
tver += __TIME__[3] - 48;
tver *= 10;
tver += __TIME__[4] - 48;
2015-02-24 14:00:19 +00:00
2015-03-24 11:15:38 +00:00
char dverX[16] = {0};
char tverX[16] = {0};
sprintf(dverX, "%X", dver);
sprintf(tverX, "%X", tver);
std::string db = std::string(dverX) + "-" + std::string(tverX);
2015-02-24 14:00:19 +00:00
2015-03-22 00:43:15 +00:00
return db;
2015-03-24 14:29:27 +00:00
#else
FILE *f = fopen("version", "r");
if(f != NULL) {
char buff[32] = {0};
fgets(buff, 32, f);
fclose(f);
std::string db = std::string(buff);
return db;
} else {
stt->doEmitionRedFoundData("Cannot open version file.");
return "?";
};
#endif
2015-02-27 13:55:35 +00:00
}
2015-02-24 14:00:19 +00:00
void nesca_3::slotShowRedVersion()
{
ui->rVerLabel->show();
2015-02-27 13:55:35 +00:00
}
2015-02-24 14:00:19 +00:00
void _startVerCheck()
{
vct->start();
2015-02-27 13:55:35 +00:00
}
2015-02-24 14:00:19 +00:00
void _startMsgCheck()
{
mct->start();
2015-02-27 13:55:35 +00:00
}
2015-02-24 14:00:19 +00:00
nesca_3::nesca_3(QWidget *parent) : QMainWindow(parent)
{
setWindowFlags ( Qt::FramelessWindowHint );
gthis = this;
2015-03-10 14:35:50 +00:00
ui->setupUi(this);
2015-03-23 12:52:07 +00:00
setSomeStyleArea();
2015-02-24 14:00:19 +00:00
ui->dataText->setOpenExternalLinks(true);
ui->dataText->setOpenLinks(false);
ui->rVerLabel->hide();
setSceneArea();
tray = new QSystemTrayIcon(QIcon(":/nesca_3/nesca.ico"), this);
2015-02-24 14:00:19 +00:00
tray->hide();
SetValidators();
ConnectEvrthng();
QTime time = QTime::currentTime();
qsrand((uint)time.msec());
2015-03-23 12:52:07 +00:00
2015-03-24 11:15:38 +00:00
const std::string &gVERStr = GetVer();
strcpy(gVER, gVERStr.c_str());
QString QVER(gVER);
2015-02-24 14:00:19 +00:00
ui->logoLabel->setToolTip("v3-" + QVER);
ui->logoLabel->setStyleSheet("color:white; border: none;background-color:black;");
2015-03-24 14:29:27 +00:00
ui->newMessageLabel->setStyleSheet("color:rgba(255, 0, 0, 0);background-color: rgba(2, 2, 2, 0);");
2015-02-24 14:00:19 +00:00
CreateVerFile();
2015-03-10 14:35:50 +00:00
RestoreSession();
2015-03-23 12:52:07 +00:00
PhraseLog.push_back("");
2015-02-24 14:00:19 +00:00
dtHN->start();
dtME2->start();
adtHN->start();
pbPointerFont.setFamily("Eurostile");
pbPointerFont.setPixelSize(8);
#if defined(WIN32) || defined(_WIN32) || defined(__WIN32) && !defined(__CYGWIN__)
WSADATA wsda;
if (WSAStartup(0x0101, &wsda))
2015-03-17 14:30:53 +00:00
{
2015-02-24 14:00:19 +00:00
stt->doEmitionRedFoundData("WSAStartup failed.");
2015-03-22 00:43:15 +00:00
qApp->quit();
2015-02-24 14:00:19 +00:00
};
#endif
_startVerCheck();
2015-03-17 14:30:53 +00:00
_startMsgCheck();
qrp.setMinimal(true);
2015-02-27 13:55:35 +00:00
}
2015-02-24 14:00:19 +00:00
void nesca_3::mousePressEvent(QMouseEvent *event)
{
if (event->button() == Qt::LeftButton) {
dragPosition = event->globalPos() - frameGeometry().topLeft();
event->accept();
};
}
2015-02-27 13:55:35 +00:00
2015-02-24 14:00:19 +00:00
void nesca_3::mouseReleaseEvent(QMouseEvent * event)
{
if (event->modifiers() == Qt::ControlModifier) {
privateMsgFlag = false;
event->accept();
};
2015-02-27 13:55:35 +00:00
}
2015-02-24 14:00:19 +00:00
void nesca_3::mouseMoveEvent(QMouseEvent * event)
{
QPoint CPos = (event->globalPos() - dragPosition);
QWidget::move(CPos);
if(qwm != NULL) qwm->move(CPos.x() + WIDGET_WIDTH + 5, CPos.y());
2015-02-27 13:55:35 +00:00
}
2015-02-24 14:00:19 +00:00
void nesca_3::exitButtonClicked()
{
2015-03-22 00:43:15 +00:00
STTTerminate();
2015-02-24 14:00:19 +00:00
#if defined(WIN32) || defined(_WIN32) || defined(__WIN32) && !defined(__CYGWIN__)
WSACleanup();
#endif
qApp->quit();
2015-02-27 13:55:35 +00:00
}
2015-02-24 14:00:19 +00:00
void nesca_3::trayButtonClicked()
{
if(tray->isVisible())
{
show();
tray->hide();
}
else
{
hide();
tray->show();
};
2015-02-27 13:55:35 +00:00
}
2015-02-24 14:00:19 +00:00
void nesca_3::ChangeShuffle(bool val)
{
gShuffle = val;
2015-02-27 13:55:35 +00:00
}
2015-02-24 14:00:19 +00:00
void nesca_3::ChangeTrackerOK(bool val)
{
trackerOK = val;
2015-02-27 13:55:35 +00:00
}
2015-02-24 14:00:19 +00:00
void nesca_3::ChangePingerOK(bool val)
{
ui->PingTO->setEnabled(val);
gPingNScan = val;
if(val == false) ui->PingTO->setStyleSheet("color: rgb(116, 116, 116);background-color: rgb(56, 56, 56);border:none;");
else ui->PingTO->setStyleSheet("color: rgb(216, 216, 216);background-color: rgb(56, 56, 56);border:none;");
2015-02-27 13:55:35 +00:00
}
2015-02-24 14:00:19 +00:00
void nesca_3::STTTerminate()
{
importFileName = "";
startFlag = false;
globalScanFlag = false;
2015-03-22 00:43:15 +00:00
nCleanup();
2015-02-24 14:00:19 +00:00
while(__savingBackUpFile) Sleep(100);
ui->tabMainWidget->setTabEnabled(0, true);
ui->tabMainWidget->setTabEnabled(1, true);
ui->tabMainWidget->setTabEnabled(2, true);
ui->tabMainWidget->setTabEnabled(3, true);
stt->doEmitionThreads(QString::number(0) + "/" + QString::number(gThreads));
stt->doEmitionIPS("0");
stt->doEmitionChangeBA("0");
BrutingThrds = 0;
cons = 0;
setButtonStyleArea();
ui->startScanButton_3->setText("Start");
ui->startScanButton_4->setText("Start");
ui->importButton->setText("Import&&Scan");
ui->labelStatus_Value->setText("Idle");
2015-03-22 00:43:15 +00:00
stt->terminate();
2015-02-27 13:55:35 +00:00
}
2015-02-24 14:00:19 +00:00
void nesca_3::startScanButtonClicked()
{
if(startFlag == false)
{
if(trackerOK)
{
if(ui->linePersKey->text().size() != 0)
{
CheckPersKey(0);
}
else
{
stt->doEmitionRedFoundData("Empty \"Personal key\" field. ");
};
}
else
{
stt->doEmitionStartScanIP();
};
}
else
{
if(stopFirst == false)
{
stopFirst = true;
globalScanFlag = false;
ui->startScanButton_3->setStyleSheet(
" QPushButton {"
"background-color: qlineargradient(spread:none, x1:1, y1:0, x2:1, y2:1, stop:0.681818 rgba(0, 0, 0, 250), stop:1 rgba(255, 255, 255, 130));"
"color: red;"
"border: 0.5px solid qlineargradient(spread:reflect, x1:0.54, y1:0.488591, x2:0.54, y2:0, stop:0 rgba(255, 255, 255, 130), stop:1 rgba(0, 0, 0, 255));"
"}"
);
ui->startScanButton_3->setText("STOP!");
stt->doEmitionYellowFoundData("Trying to stop. Please, wait...");
}
else
{
globalScanFlag = false;
ui->startScanButton_3->setStyleSheet(
" QPushButton {"
"background-color: qlineargradient(spread:none, x1:1, y1:0, x2:1, y2:1, stop:0.681818 rgba(0, 0, 0, 250), stop:1 rgba(255, 255, 255, 130));"
"color: yellow;"
"border: 0.5px solid qlineargradient(spread:reflect, x1:0.54, y1:0.488591, x2:0.54, y2:0, stop:0 rgba(255, 255, 255, 130), stop:1 rgba(0, 0, 0, 255));"
"}"
);
ui->startScanButton_3->setText("Wait...");
stt->doEmitionYellowFoundData("Wait, killing threads...");
STTTerminate();
};
};
2015-02-27 13:55:35 +00:00
}
2015-02-24 14:00:19 +00:00
void nesca_3::startScanButtonClickedDNS()
{
if(startFlag == false)
{
if(trackerOK)
{
if(ui->linePersKey->text().size() != 0)
{
CheckPersKey(1);
}
else
{
stt->doEmitionRedFoundData("Empty \"Personal key\" field. ");
};
}
else
{
stt->doEmitionStartScanDNS();
};
}
else
{
if(stopFirst == false)
{
stopFirst = true;
globalScanFlag = false;
ui->startScanButton_4->setStyleSheet(
" #startScanButton_4 {"
"background-color: qlineargradient(spread:none, x1:1, y1:0, x2:1, y2:1, stop:0.681818 rgba(0, 0, 0, 250), stop:1 rgba(255, 255, 255, 130));"
"color: red;"
"border: 0.5px solid qlineargradient(spread:reflect, x1:0.54, y1:0.488591, x2:0.54, y2:0, stop:0 rgba(255, 255, 255, 130), stop:1 rgba(0, 0, 0, 255));"
"}"
);
ui->startScanButton_4->setText("STOP!");
stt->doEmitionYellowFoundData("Trying to stop. Please, wait...");
}
else
{
globalScanFlag = false;
ui->startScanButton_4->setStyleSheet(
" #startScanButton_4 {"
"background-color: qlineargradient(spread:none, x1:1, y1:0, x2:1, y2:1, stop:0.681818 rgba(0, 0, 0, 250), stop:1 rgba(255, 255, 255, 130));"
"color: yellow;"
"border: 0.5px solid qlineargradient(spread:reflect, x1:0.54, y1:0.488591, x2:0.54, y2:0, stop:0 rgba(255, 255, 255, 130), stop:1 rgba(0, 0, 0, 255));"
"}"
);
ui->startScanButton_4->setText("Wait...");
stt->doEmitionYellowFoundData("Killing threads...");
STTTerminate();
};
};
2015-02-27 13:55:35 +00:00
}
2015-02-24 14:00:19 +00:00
void nesca_3::logoLabelClicked()
{
QDesktopServices::openUrl(QUrl("http://nesca.d3w.org/"));
2015-02-27 13:55:35 +00:00
}
2015-02-24 14:00:19 +00:00
void nesca_3::ChangeLabelTO_ValueChanged(QString str)
{
2015-03-10 14:35:50 +00:00
int gto = str.toInt();
gTimeOut = gto > 0 ? gto : 1;
2015-02-27 13:55:35 +00:00
}
2015-02-24 14:00:19 +00:00
void nesca_3::ChangeLabelThreads_ValueChanged(QString str)
{
2015-03-19 14:34:35 +00:00
gThreads = str.toInt();
2015-02-27 13:55:35 +00:00
}
2015-02-24 14:00:19 +00:00
void nesca_3::PingTO_ChangeValue(QString str)
{
gPingTimeout = str.toInt();
2015-02-27 13:55:35 +00:00
}
2015-02-24 14:00:19 +00:00
void nesca_3::ThreadDelay_ChangeValue(QString str)
{
gThreadDelay = str.toInt();
2015-02-27 13:55:35 +00:00
}
2015-02-24 14:00:19 +00:00
void nesca_3::MaxBrutingThr_ChangeValue(QString str)
{
gMaxBrutingThreads = str.toInt();
2015-02-27 13:55:35 +00:00
}
2015-02-24 14:00:19 +00:00
void nesca_3::appendRedBAData(QString str)
{
ui->BAText->append("<span style=\"color:red;background-color:#313131;\">" + QString::fromUtf8(str.toLocal8Bit().data()) + "</span>");
2015-02-27 13:55:35 +00:00
}
2015-02-24 14:00:19 +00:00
void nesca_3::appendGreenBAData(QString str)
{
ui->BAText->append("<span style=\"color:#06ff00;\">" + str + "</span>");
2015-02-27 13:55:35 +00:00
}
2015-02-24 14:00:19 +00:00
void nesca_3::appendDefaultText(QString str)
{
ui->dataText->append("<p style=\"color: #a1a1a1;\">[" + QTime::currentTime().toString() + "] " + str + "</p>");
2015-02-27 13:55:35 +00:00
}
2015-02-24 14:00:19 +00:00
void nesca_3::appendErrText(QString str)
{
ui->dataText->append("<span style=\"color:red;background-color:#313131;\">[" + QTime::currentTime().toString() + "]" + QString::fromUtf8(str.toLocal8Bit().data()) + "</span>");
if(stt->isRunning() == false)
{
startFlag = false;
stt->doEmitionChangeStatus("Idle");
stt->doEmitionIPS("0");
ui->startScanButton_3->setText("Start");
stt->terminate();
};
2015-02-27 13:55:35 +00:00
}
2015-02-24 14:00:19 +00:00
void nesca_3::appendOKText(QString str)
{
ui->dataText->append("<span style=\"color:#06ff00;\">[" + QTime::currentTime().toString() + "][OK] " + str + "</span>");
2015-02-27 13:55:35 +00:00
}
2015-02-24 14:00:19 +00:00
void nesca_3::appendNotifyText(QString str)
{
ui->dataText->append("<span style=\"color:#efe100;\">[" + QTime::currentTime().toString() + "][*] " + str + "</span>");
2015-02-27 13:55:35 +00:00
}
2015-02-24 14:00:19 +00:00
void nesca_3::appendDebugText(QString str)
{
ui->dataText->append("<span style=\"color:#0084ff;\">[DEBUG] " + str + "</span>");
2015-02-27 13:55:35 +00:00
}
2015-02-24 14:00:19 +00:00
QRegExp r("[ht|f]{0,2}tp[s]{0,1}://(\\w|\\.|,|/|:|-|_|\\?|!|\\@|#|\\$|%|\\^|&|\\*|=|\\+|<|>|;|:|\"|'|~|\\[|\\])*[\\s|\\t]{0,1}");
QRegExp under("((.+|(.+$)))");
QRegExp boldr("((.+|(.+$)))");
QRegExp colr("(\\d+[,\\d+]{0,2})");
QString GetColorCode(int mode, QString str)
{
QRegExp c("(\\d{0,2})");
QRegExp bg(",(\\d{0,2})");
QString col;
if(mode == 0)
{
c.indexIn(str);
col = c.cap(1);
}
else
{
bg.indexIn(str);
col = bg.cap(1);
};
QString result;
int icol = col.toInt();
if(icol == 0) result = "#AFAFAF";
else if(icol == 1) result = "black";
else if(icol == 2) result = "darkblue";
else if(icol == 3) result = "green";
else if(icol == 4) result = "red";
else if(icol == 5) result = "darkred";
else if(icol == 6) result = "blueviolet";
else if(icol == 7) result = "darkorange";
else if(icol == 8) result = "yellow";
else if(icol == 9) result = "lightgreen";
else if(icol == 10) result = "darkcyan";
else if(icol == 11) result = "teal";
else if(icol == 12) result = "blue";
else if(icol == 13) result = "pink";
else if(icol == 14) result = "#4d4d4d";
else if(icol == 15) result = "gray";
else result = "#AFAFAF";
return result;
2015-02-27 13:55:35 +00:00
}
2015-02-24 14:00:19 +00:00
nesca_3::~nesca_3()
{
delete[] ui;
}