Skip to content

Commit

Permalink
violent: bug fix
Browse files Browse the repository at this point in the history
  • Loading branch information
stowmyy committed Oct 24, 2023
1 parent 287da20 commit 53cc3d9
Show file tree
Hide file tree
Showing 4 changed files with 20 additions and 5 deletions.
13 changes: 13 additions & 0 deletions dropship/src/DashboardManager.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -276,6 +276,17 @@ DashboardManager::DashboardManager() :
}).detach();

//::global_message = done ? "done cover_browser.jpg" : "D: failed.";

{
// 1) load rules from wf.msc
firewallManager._syncFirewallWithEndpoints(&(this->endpoints));

// 2) reset all rules
firewallManager.flushRules(&(this->endpoints));

// 3) sync with endpoints
firewallManager._syncEndpointsWithFirewall(&(this->endpoints));
}
}

void DashboardManager::loadAssets() {
Expand Down Expand Up @@ -326,6 +337,8 @@ void DashboardManager::loadAssets() {
void DashboardManager::RenderInline(/* bool* p_open */)
{



if (ImGui::GetCurrentContext() != nullptr && ImGui::IsWindowAppearing())
{
this->loadAssets();
Expand Down
1 change: 0 additions & 1 deletion dropship/src/DashboardManager.h
Original file line number Diff line number Diff line change
Expand Up @@ -58,7 +58,6 @@ class DashboardManager : public manager

bool active = { false };


float __date_new_selection = 0;

std::unordered_map<std::string, Process> processes;
Expand Down
2 changes: 1 addition & 1 deletion dropship/src/FirewallManager.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -34,8 +34,8 @@ void FirewallManager::_syncFirewallWithEndpoints(std::vector<Endpoint>* endpoint
void FirewallManager::sync(std::vector<Endpoint>* endpoints)
{
printf("sync()\n");
this->_syncFirewallWithEndpoints(endpoints);
this->_syncEndpointsWithFirewall(endpoints);
this->_syncFirewallWithEndpoints(endpoints);
}

// destroys previous rules
Expand Down
9 changes: 6 additions & 3 deletions dropship/src/_WindowsFirewallUtil.h
Original file line number Diff line number Diff line change
Expand Up @@ -1317,10 +1317,13 @@ class _WindowsFirewallUtil : public failable
{
if (!e.selected != ruleEnabled)
{

// if endpointDominant, set firewall to mirror endpoint state
if (endpointDominant)
{
printf(std::format("firewall rule \"{0}\" was {1} but endpoint was {2}. turning {2}.\n", s_ruleName, ruleEnabled ? "on" : "off", e.selected ? "on" : "off").c_str());

std::string s_ruleEnabled = ruleEnabled ? "block" : "allow";
printf(std::format("({0}) firewall: {1}, ui: {2} . Setting firewall rule to match UI state\n", s_ruleName, ruleEnabled ? "block" : "allow", e.selected ? "selected" : "not selected").c_str());
if (FAILED(pFwRule->put_Enabled(e.selected ? VARIANT_FALSE : VARIANT_TRUE)))
continue;

Expand All @@ -1331,8 +1334,8 @@ class _WindowsFirewallUtil : public failable
else

{
printf(std::format("endpoint \"{0}\" was {2} but firewall rule was {1}. turning {1}.\n", s_ruleName, ruleEnabled ? "on" : "off", e.selected ? "on" : "off").c_str());
e.selected = ruleEnabled;
printf(std::format("({0}) firewall: {1}, ui: {2}. Setting UI state to match firewall state\n", s_ruleName, ruleEnabled ? "block" : "allow", e.selected ? "selected" : "not selected").c_str());
e.selected = !ruleEnabled;
// e.unsynced = false;
}
}
Expand Down

0 comments on commit 53cc3d9

Please sign in to comment.