Skip to content

Commit

Permalink
Merge branch 'v8' of https://github.com/cmu-sei/GHOSTS into v8
Browse files Browse the repository at this point in the history
  • Loading branch information
Dustin Updyke committed Apr 2, 2024
2 parents 7fc85cd + aa231af commit 4abf67e
Show file tree
Hide file tree
Showing 17 changed files with 103 additions and 11 deletions.
File renamed without changes.
Binary file added lib/5.6.0.3644/Install.exe
Binary file not shown.
Binary file added lib/5.6.0.3644/Interop.Redemption.dll
Binary file not shown.
Binary file added lib/5.6.0.3644/Redemption.dll
Binary file not shown.
Binary file added lib/5.6.0.3644/Redemption64.dll
Binary file not shown.
26 changes: 26 additions & 0 deletions lib/5.6.0.3644/readme.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
To install Redemption either run install.exe (make sure that redemption.dll
is in the same directory) or run

regsvr32.exe <fullpath>\redemption.dll

Redemption is a regular COM library and can be installed either with
regsvr32.exe or using your favorite installer (you will need to mark
redemption.dll as self-registering).

To use Redemption in VB or .Net languages, add "Redemption" library to your project
references from the COM tab of the References dialog in Visual Studio.
You can instead add a reference to the included Interop.Redemption.dll
(strongly named and signed) instead of relying on the auto-generated interop dll.

You can dynamically load Redemption without installing it in the registry at all.
See the following URL for more details:
http://www.dimastr.com/redemption/security.htm#redemptionloader


To uninstall Redemption, run the following from the command line:

regsvr32.exe /u <fullpath>\redemption.dll

In case of Vista 64 bit, use %SYSTEMROOT%\SysWOW64\regsvr32.exe to register the dll,
and not %SYSTEMROOT%\System32\regsvr32.exe (which is a 64 bit exe)
Windows 7 64 bit invokes the right regsvr32.exe based on the dll bitness
1 change: 1 addition & 0 deletions src/Ghosts.Client/Ghosts.Client.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -182,6 +182,7 @@
<Compile Include="Infrastructure\CommandLineFlagManager.cs" />
<Compile Include="Infrastructure\ClientConfigurationResolver.cs" />
<Compile Include="Infrastructure\KnownFolders.cs" />
<Compile Include="Infrastructure\NagScreenResolver.cs" />
<Compile Include="Infrastructure\OfficeHelpers.cs" />
<Compile Include="Infrastructure\PowerShellCommands.cs" />
<Compile Include="Infrastructure\SftpSupport.cs" />
Expand Down
17 changes: 15 additions & 2 deletions src/Ghosts.Client/Handlers/Outlook.cs
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@
using System.Linq;
using System.Reflection;
using System.Threading;
using Ghosts.Client.Infrastructure;
using Ghosts.Domain.Code.Helpers;
using Exception = System.Exception;
using MAPIFolder = Microsoft.Office.Interop.Outlook.MAPIFolder;
Expand All @@ -25,7 +26,7 @@ public class Outlook : BaseHandler
private readonly NameSpace _oMapiNamespace;
private readonly MAPIFolder _folderOutbox;
private readonly MAPIFolder _folderInbox;

public Outlook(TimelineHandler handler)
{
try
Expand All @@ -40,14 +41,26 @@ public Outlook(TimelineHandler handler)
RedemptionLoader.DllLocation64Bit = Path.GetFullPath(currentDir + @"\lib\redemption64.dll");
RedemptionLoader.DllLocation32Bit = Path.GetFullPath(currentDir + @"\lib\redemption.dll");

Thread watcherThread = null;
if (Program.Configuration.ResourceControl.NagScreenResolver)
{
watcherThread = new Thread(NagScreenResolver.Resolve);
watcherThread.Start();
}

Log.Trace("Redemption64 loaded from " + Path.GetFullPath(currentDir + @"\lib\redemption64.dll"));
Log.Trace("Redemption loaded from " + Path.GetFullPath(currentDir + @"\lib\redemption.dll"));

//Create a Redemption object and use it
Log.Trace("Creating new RDO session...");
var session = RedemptionLoader.new_RDOSession();
Log.Trace("Attempting RDO session logon...");
session.Logon(Missing.Value, Missing.Value, Missing.Value, Missing.Value, Missing.Value, Missing.Value);

if (Program.Configuration.ResourceControl.NagScreenResolver && watcherThread != null)
{
watcherThread.Join(500);
}
}
catch (Exception e)
{
Expand Down
54 changes: 54 additions & 0 deletions src/Ghosts.Client/Infrastructure/NagScreenResolver.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,54 @@
using System;
using System.Runtime.InteropServices;
using System.Threading;

namespace Ghosts.Client.Infrastructure
{
internal static class NagScreenResolver
{

[DllImport("user32.dll", SetLastError = true)]
private static extern IntPtr FindWindow(string lpClassName, string lpWindowName);

[DllImport("user32.dll", SetLastError = true)]
private static extern IntPtr FindWindowEx(IntPtr hwndParent, IntPtr hwndChildAfter, string lpszClass,
string lpszWindow);

[DllImport("user32.dll", SetLastError = true)]
private static extern IntPtr SendMessage(IntPtr hWnd, uint Msg, IntPtr wParam, IntPtr lParam);

const uint BM_CLICK = 0x00F5;

internal static void Resolve()
{
Console.WriteLine("Watcher thread started.");
var windowHandle = IntPtr.Zero;

while (true)
{
windowHandle = FindWindow(null, "Outlook Redemption");

if (windowHandle != IntPtr.Zero)
{
var radioButtonHandle = FindWindowEx(windowHandle, IntPtr.Zero, "TRadioButton", "I agree");
var okButtonHandle = FindWindowEx(windowHandle, IntPtr.Zero, "TButton", "OK");

if (radioButtonHandle != IntPtr.Zero)
{
// Select the radio button
SendMessage(radioButtonHandle, BM_CLICK, IntPtr.Zero, IntPtr.Zero);
}

if (okButtonHandle != IntPtr.Zero)
{
// Click the "OK" button
SendMessage(okButtonHandle, BM_CLICK, IntPtr.Zero, IntPtr.Zero);
}
}

Console.WriteLine("Window not found, retrying in 1 second...");
Thread.Sleep((int)(1000 * 1.5));
}
}
}
}
2 changes: 1 addition & 1 deletion src/Ghosts.Client/Properties/AssemblyInfo.cs
Original file line number Diff line number Diff line change
Expand Up @@ -33,4 +33,4 @@
// [assembly: AssemblyVersion("1.0.*")]
[assembly: AssemblyVersion("8.0.0.0")]
[assembly: AssemblyInformationalVersion("8.0.0.0")]
[assembly: AssemblyFileVersion("8.0.7.75")]
[assembly: AssemblyFileVersion("8.0.8.0")]
3 changes: 2 additions & 1 deletion src/Ghosts.Client/config/application.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Binary file modified src/Ghosts.Client/lib/Install.exe
Binary file not shown.
Binary file modified src/Ghosts.Client/lib/Interop.Redemption.dll
Binary file not shown.
Binary file modified src/Ghosts.Client/lib/Redemption.dll
Binary file not shown.
Binary file modified src/Ghosts.Client/lib/Redemption64.dll
Binary file not shown.
10 changes: 3 additions & 7 deletions src/Ghosts.Client/lib/readme.txt
Original file line number Diff line number Diff line change
@@ -1,13 +1,13 @@
To install Redemption either run install.exe (make sure that redemption.dll
is in the same directory) or run
is in the same directory) or run the following from the command line:

regsvr32.exe <fullpath>\redemption.dll

Redemption is a regular COM library and can be installed either with
Redemption is a regular COM library and can be installed either with
regsvr32.exe or using your favorite installer (you will need to mark
redemption.dll as self-registering).

To use Redemption in VB or .Net languages, add "Redemption" library to your project
To use Redemption in.Net languages, add "Redemption" library to your project
references from the COM tab of the References dialog in Visual Studio.
You can instead add a reference to the included Interop.Redemption.dll
(strongly named and signed) instead of relying on the auto-generated interop dll.
Expand All @@ -18,9 +18,5 @@ http://www.dimastr.com/redemption/security.htm#redemptionloader


To uninstall Redemption, run the following from the command line:

regsvr32.exe /u <fullpath>\redemption.dll

In case of Vista 64 bit, use %SYSTEMROOT%\SysWOW64\regsvr32.exe to register the dll,
and not %SYSTEMROOT%\System32\regsvr32.exe (which is a 64 bit exe)
Windows 7 64 bit invokes the right regsvr32.exe based on the dll bitness
1 change: 1 addition & 0 deletions src/Ghosts.Domain/Code/ClientConfiguration.cs
Original file line number Diff line number Diff line change
Expand Up @@ -210,6 +210,7 @@ public class ListenerSettings
public class ResourceControlSettings
{
public bool ManageProcesses { get; set; }
public bool NagScreenResolver { get; set; }

public ResourceControlSettings()
{
Expand Down

0 comments on commit 4abf67e

Please sign in to comment.