MCPcopy Create free account
hub / github.com/Adaptix-Framework/AdaptixC2 / OnReconnect

Method OnReconnect

AdaptixClient/Source/UI/Widgets/AdaptixWidget.cpp:1277–1337  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

1275void AdaptixWidget::LoadTargetsUI() const { this->PlaceDock(dockBottom, TargetsDock->dock() ); }
1276
1277void AdaptixWidget::OnReconnect()
1278{
1279 if (ChannelThread->isRunning()) {
1280 QThread* workerThread = new QThread();
1281 QObject* worker = new QObject();
1282 worker->moveToThread(workerThread);
1283
1284 connect(workerThread, &QThread::started, worker, [=, this]() {
1285 bool result = HttpReqJwtUpdate(profile);
1286
1287 QMetaObject::invokeMethod(this, [=, this]() {
1288 if (!result) {
1289 MessageError("Login failure");
1290 }
1291
1292 workerThread->quit();
1293 workerThread->wait();
1294 worker->deleteLater();
1295 workerThread->deleteLater();
1296 }, Qt::QueuedConnection);
1297 });
1298
1299 workerThread->start();
1300 }
1301 else {
1302 QThread* workerThread = new QThread();
1303 QObject* worker = new QObject();
1304 worker->moveToThread(workerThread);
1305
1306 connect(workerThread, &QThread::started, worker, [=, this]() {
1307 bool result = HttpReqLogin(profile);
1308
1309 QMetaObject::invokeMethod(this, [=, this]() {
1310 if (!result) {
1311 MessageError("Login failure");
1312 if (dialogSyncPacket && dialogSyncPacket->splashScreen)
1313 dialogSyncPacket->splashScreen->close();
1314 } else {
1315 this->ClearAdaptix();
1316
1317 connect( ChannelWsWorker, &WebSocketWorker::connected, this, &AdaptixWidget::OnWebSocketConnected, Qt::UniqueConnection );
1318
1319 ChannelThread->start();
1320
1321 QIcon onReconnectButton = RecolorIcon(QIcon(":/icons/link"), COLOR_NeonGreen);
1322 reconnectButton->setIcon(onReconnectButton);
1323 }
1324
1325 workerThread->quit();
1326 workerThread->wait();
1327 worker->deleteLater();
1328 workerThread->deleteLater();
1329 }, Qt::QueuedConnection);
1330 });
1331
1332 if (dialogSyncPacket && dialogSyncPacket->splashScreen)
1333 dialogSyncPacket->splashScreen->show();
1334

Callers

nothing calls this directly

Calls 11

ClearAdaptixMethod · 0.95
HttpReqJwtUpdateFunction · 0.85
invokeMethodFunction · 0.85
MessageErrorFunction · 0.85
HttpReqLoginFunction · 0.85
RecolorIconFunction · 0.85
isRunningMethod · 0.45
startMethod · 0.45
closeMethod · 0.45
setIconMethod · 0.45
showMethod · 0.45

Tested by

no test coverage detected