Skip to content

Commit

Permalink
Function to toggle Run dialog
Browse files Browse the repository at this point in the history
  • Loading branch information
ocdtrekkie committed Jul 10, 2024
1 parent 4e0daed commit 7fe12aa
Show file tree
Hide file tree
Showing 4 changed files with 29 additions and 6 deletions.
4 changes: 2 additions & 2 deletions Properties/AssemblyInfo.cs
Original file line number Diff line number Diff line change
Expand Up @@ -32,5 +32,5 @@
// You can specify all the values or you can default the Build and Revision Numbers
// by using the '*' as shown below:
// [assembly: AssemblyVersion("1.0.*")]
[assembly: AssemblyVersion("1.0.0.9")]
[assembly: AssemblyFileVersion("1.0.0.9")]
[assembly: AssemblyVersion("1.0.0.10")]
[assembly: AssemblyFileVersion("1.0.0.10")]
4 changes: 2 additions & 2 deletions XRFAgent.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@
<UpdatePeriodically>false</UpdatePeriodically>
<UpdateRequired>false</UpdateRequired>
<MapFileExtensions>true</MapFileExtensions>
<ApplicationRevision>9</ApplicationRevision>
<ApplicationRevision>10</ApplicationRevision>
<ApplicationVersion>1.0.0.%2a</ApplicationVersion>
<UseApplicationTrust>false</UseApplicationTrust>
<BootstrapperEnabled>true</BootstrapperEnabled>
Expand Down Expand Up @@ -119,7 +119,7 @@
<Version>6.0.0</Version>
</PackageReference>
<PackageReference Include="System.Text.Json">
<Version>8.0.3</Version>
<Version>8.0.4</Version>
</PackageReference>
</ItemGroup>
<ItemGroup>
Expand Down
6 changes: 4 additions & 2 deletions modCommand.cs
Original file line number Diff line number Diff line change
Expand Up @@ -30,9 +30,11 @@ public static void Handle(string inputCommand, string inputSource, string reques
if (inputData[1] == "installed" && inputData[2] == "software") { outputResponse = modSystem.GetInstalledSoftware(); }
else if (inputData[1] == "system" && inputData[2] == "details") { outputResponse = modSystem.GetSystemDetails(); } break;
case "disable" when inputData.Length == 2:
if (inputData[1] == "autoupdate") { outputResponse = modUpdate.DisableAutoupdate(); } break;
if (inputData[1] == "autoupdate") { outputResponse = modUpdate.DisableAutoupdate(); }
if (inputData[1] == "rundialog") { outputResponse = modSystem.ConfigureRunDialog(inputData[0]); } break;
case "enable" when inputData.Length == 2:
if (inputData[1] == "autoupdate") { outputResponse = modUpdate.EnableAutoupdate(); } break;
if (inputData[1] == "autoupdate") { outputResponse = modUpdate.EnableAutoupdate(); }
if (inputData[1] == "rundialog") { outputResponse = modSystem.ConfigureRunDialog(inputData[0]); } break;
case "hac":
case "hacontroller":
string inputCommandTrimmed = inputCommand.Remove(0, inputData[0].Length + 1);
Expand Down
21 changes: 21 additions & 0 deletions modSystem.cs
Original file line number Diff line number Diff line change
Expand Up @@ -216,5 +216,26 @@ public static string ShutdownHost()
return "Shutdown failed";
}
}

/// <summary>
/// Configures the system Run dialog, which is frequently used by phone scammers
/// </summary>
/// <param name="action">(string) Action to take</param>
/// <returns>(string) Response</returns>
public static string ConfigureRunDialog(string action)
{
int newvalue = 0;
if (action == "disable") { newvalue = 1; }
RegistryKey explorerPolicies = Registry.LocalMachine.OpenSubKey(@"SOFTWARE\Microsoft\Windows\CurrentVersion\Policies\Explorer", true);
explorerPolicies.SetValue("NoRun", newvalue, RegistryValueKind.DWord);
explorerPolicies.Close();

modDatabase.Config ConfigObj = new modDatabase.Config { Key = "Security_RunDialog", Value = action + "d" };
modDatabase.AddOrUpdateConfig(ConfigObj);
string SystemDetailsJSON = "{\"systemdetails\":[" + JsonSerializer.Serialize(ConfigObj) + "]}";
modSync.SendMessage("server", "nodedata", "systemdetails", SystemDetailsJSON);

return "Run dialog " + action + "d";
}
}
}

0 comments on commit 7fe12aa

Please sign in to comment.