-
Notifications
You must be signed in to change notification settings - Fork 0
/
aireplaydeauth.cpp
executable file
·141 lines (111 loc) · 3.73 KB
/
aireplaydeauth.cpp
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
#include "ui_aireplaydeauth.h"
#include "aireplaydeauth.h"
aireplayDeauth::aireplayDeauth(QWidget *parent) :
QWidget(parent),
ui(new Ui::aireplayDeauth)
{
logThread::addLog("Constructor of fake deauth GUI", logInfo::MAIN);
qRegisterMetaType<QProcess::ExitStatus>("QProcess::ExitStatus");
attack = new attackDeauth();
ui->setupUi(this);
connect(attack, SIGNAL(processOutput(QString)), this, SLOT(update(QString)), Qt::QueuedConnection);
connect(this->ui->pushButtonLog, SIGNAL(clicked()), this, SLOT(clearLog()));
connect(this->ui->pushButtonStop, SIGNAL(clicked()), this, SLOT(stop()));
//CONNECT WITH FUNCTION WHEN THE PROCESS END BY HIMSELF
connect(attack->getProcess(), SIGNAL(finished(int,QProcess::ExitStatus)), this, SLOT(endAuthentication(int,QProcess::ExitStatus)));
this->setStatus(STOPPED);
}
aireplayDeauth::~aireplayDeauth()
{
logThread::addLog("Destructor of fake deauth GUI", logInfo::MAIN);
delete ui;
delete attack;
}
void aireplayDeauth::clearLog()
{
utils::customClearLog(this->ui->textEdit, "Fake Deauth Log");
}
QString aireplayDeauth::getStatusQString()
{
switch (status) {
case STOPPED:
return "STOPPED";
break;
case DEAUTHENTICATING:
return "DEAUTHENTICATING";
break;
case DEAUTHENTICATED:
return "DEAUTHENTICATED";
break;
default:
return "UNKNOWN";
break;
}
}
void aireplayDeauth::setStatus(const STATUS &s)
{
{status = s;}
switch (s) {
case STOPPED:
this->ui->lineEditStatus->setText("STOPPED");
utils::setBackgroundColor(this->ui->lineEditStatus, utils::RED);
break;
case DEAUTHENTICATING:
this->ui->lineEditStatus->setText("DEAUTHENTICATING");
utils::setBackgroundColor(this->ui->lineEditStatus, utils::YELLOW);
break;
case DEAUTHENTICATED:
utils::setBackgroundColor(this->ui->lineEditStatus, utils::GREEN);
this->ui->lineEditStatus->setText("DEUTHENTICATED");
break;
}
logThread::addLog("Fake Deauth: Status changes to " + getStatusQString(), logInfo::MAIN);
emit statusChanged(getStatusQString());
}
void aireplayDeauth::toThisLog(const QString &com)
{
this->ui->textEdit->append(com);
}
bool aireplayDeauth::start(const QString &BSSID, QString MAC)
{
logThread::addLog(QString("Fake Deauth: Starting attack with BSSID=%1, MAC=%2").arg(BSSID).arg(MAC)+ getStatusQString(), logInfo::MAIN);
const bool ok = attack->start(BSSID, MAC);
//set status
if (ok) {
this->setStatus(DEAUTHENTICATING);
this->ui->labelBSSID->setText("BSSID: " + BSSID);
}
return ok;
}
bool aireplayDeauth::stop()
{
logThread::addLog("Fake Deauth: Stopping", logInfo::MAIN);
if (attack->isRunning()) {
attack->stop();
toThisLog("Process stopped");
}
this->setStatus(STOPPED);
return true;
}
void aireplayDeauth::endAuthentication(int, QProcess::ExitStatus status)
{
if (status == QProcess::NormalExit) {
this->setStatus(DEAUTHENTICATED);
emit succesfull("DEAUTHENTICATION SUCCESFULL!");
}
}
void aireplayDeauth::update(QString info)
{
info.remove("\n");
if (info.count('[') < 3)
info.remove("\r");
if (!info.isEmpty()) {
if (info.contains("failed") || info.contains("select failed") || info.contains("but the AP uses") || info.contains("No such BSSID available")){ //checking errors...
toThisLog(utils::htmlRojo(info));
this->stop();
return; //exit recursion, creo k no hace falta
}
else
toThisLog(info);
}
}