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

Method StartDialog

AdaptixClient/Source/UI/Dialogs/DialogConnect.cpp:339–391  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

337}
338
339AuthProfile* DialogConnect::StartDialog()
340{
341 toConnect = false;
342 exec();
343 if (!toConnect)
344 return nullptr;
345
346 QString projectDir = lineEdit_ProjectDir->text().trimmed();
347 if (projectDir.isEmpty())
348 projectDir = defaultProjectDir(lineEdit_Project->text());
349
350 QString host, port, endpoint;
351 parseUrl(host, port, endpoint);
352
353 auto* newProfile = new AuthProfile(lineEdit_Project->text(), lineEdit_User->text(), lineEdit_Password->text(), host, port, endpoint, projectDir);
354
355 QStringList selectedSubs;
356 for (int i = 0; i < dataListWidget->count(); ++i) {
357 auto *item = dataListWidget->item(i);
358 if (item && item->data(Qt::UserRole).toBool())
359 continue;
360 if (item->checkState() == Qt::Checked)
361 selectedSubs.append(item->text());
362 }
363 for (int i = 0; i < agentListWidget->count(); ++i) {
364 auto *item = agentListWidget->item(i);
365 if (item && item->data(Qt::UserRole).toBool())
366 continue;
367 if (item->checkState() == Qt::Checked)
368 selectedSubs.append(item->text());
369 }
370
371 auto agentsOnlyActiveCheck = subsPopupDialog ? subsPopupDialog->findChild<QCheckBox*>("agentsOnlyActiveCheck") : nullptr;
372 if (agentsOnlyActiveCheck && agentsOnlyActiveCheck->isChecked())
373 selectedSubs.append("agents_only_active");
374
375 auto tasksOnlyJobsCheck = subsPopupDialog ? subsPopupDialog->findChild<QCheckBox*>("tasksOnlyJobsCheck") : nullptr;
376 if (tasksOnlyJobsCheck && tasksOnlyJobsCheck->isChecked())
377 selectedSubs.append("tasks_only_jobs");
378
379 newProfile->SetSubscriptions(selectedSubs);
380 newProfile->SetRegisteredCategories(selectedSubs);
381
382 updateSubsDisplay();
383 newProfile->SetConsoleMultiuser(multiuserCheck->isChecked());
384
385 if (GlobalClient->storage->ExistsProject(lineEdit_Project->text()))
386 GlobalClient->storage->UpdateProject(*newProfile);
387 else
388 GlobalClient->storage->AddProject(*newProfile);
389
390 return newProfile;
391}
392
393void DialogConnect::updateSubsDisplay()
394{

Callers

nothing calls this directly

Calls 15

defaultProjectDirFunction · 0.85
itemMethod · 0.80
checkStateMethod · 0.80
appendMethod · 0.80
SetSubscriptionsMethod · 0.80
ExistsProjectMethod · 0.80
UpdateProjectMethod · 0.80
AddProjectMethod · 0.80
textMethod · 0.45
isEmptyMethod · 0.45
countMethod · 0.45
dataMethod · 0.45

Tested by

no test coverage detected