mirror of
https://github.com/GhostPack/SharpDPAPI
synced 2026-06-08 11:11:23 +00:00
-Combined TriageUserMasterKeysWithPass into TriageUserMasterKeys -'/password:X' now properly works in SharpDPAPI while elevated, as well as remotely -'/password:X' now works for SharpChrome, elevated + remotely
82 lines
3.0 KiB
C#
Executable File
82 lines
3.0 KiB
C#
Executable File
using System;
|
|
using System.Collections.Generic;
|
|
using System.IO;
|
|
|
|
namespace SharpDPAPI.Commands
|
|
{
|
|
public class Vaults : ICommand
|
|
{
|
|
public static string CommandName => "vaults";
|
|
|
|
public void Execute(Dictionary<string, string> arguments)
|
|
{
|
|
Console.WriteLine("\r\n[*] Action: User DPAPI Vault Triage\r\n");
|
|
arguments.Remove("vaults");
|
|
|
|
string server = ""; // used for remote server specification
|
|
|
|
if (arguments.ContainsKey("/server"))
|
|
{
|
|
server = arguments["/server"];
|
|
Console.WriteLine("[*] Triaging remote server: {0}\r\n", server);
|
|
}
|
|
|
|
// {GUID}:SHA1 keys are the only ones that don't start with /
|
|
Dictionary<string, string> masterkeys = new Dictionary<string, string>();
|
|
foreach (KeyValuePair<string, string> entry in arguments)
|
|
{
|
|
if (!entry.Key.StartsWith("/"))
|
|
{
|
|
masterkeys.Add(entry.Key, entry.Value);
|
|
}
|
|
}
|
|
if (arguments.ContainsKey("/pvk"))
|
|
{
|
|
// use a domain DPAPI backup key to triage masterkeys
|
|
masterkeys = SharpDPAPI.Dpapi.PVKTriage(arguments);
|
|
}
|
|
else if (arguments.ContainsKey("/mkfile"))
|
|
{
|
|
masterkeys = SharpDPAPI.Helpers.ParseMasterKeyFile(arguments["/mkfile"]);
|
|
}
|
|
else if (arguments.ContainsKey("/password"))
|
|
{
|
|
string password = arguments["/password"];
|
|
Console.WriteLine("[*] Will decrypt user masterkeys with password: {0}\r\n", password);
|
|
if (arguments.ContainsKey("/server"))
|
|
{
|
|
masterkeys = Triage.TriageUserMasterKeys(null, true, arguments["/server"], password);
|
|
}
|
|
else
|
|
{
|
|
masterkeys = Triage.TriageUserMasterKeys(null, true, "", password);
|
|
}
|
|
}
|
|
|
|
if (arguments.ContainsKey("/target"))
|
|
{
|
|
string target = arguments["/target"].Trim('"').Trim('\'');
|
|
|
|
if (Directory.Exists(target))
|
|
{
|
|
Triage.TriageVaultFolder(target, masterkeys);
|
|
}
|
|
else
|
|
{
|
|
Console.WriteLine("\r\n[X] '{0}' is not a valid Vault directory.", target);
|
|
}
|
|
}
|
|
else
|
|
{
|
|
if (arguments.ContainsKey("/server") && !arguments.ContainsKey("/pvk") && !arguments.ContainsKey("/password"))
|
|
{
|
|
Console.WriteLine("[X] The '/server:X' argument must be used with '/pvk:BASE64...' or '/password:X' !");
|
|
}
|
|
else
|
|
{
|
|
Triage.TriageUserVaults(masterkeys, server);
|
|
}
|
|
}
|
|
}
|
|
}
|
|
} |