Files
harmj0y 4425d8a595 Version 1.10.0
-CNG certificate private key support
-/nowrap added to `backupkey`
-key component error fix
-combined `machinecerts` to `certificates /machine`
-fixed SHA1 "hash" calculation for entropy
-only decrypted certs now display by default, `/showall` will show all
2021-02-25 10:37:37 -08:00

48 lines
1.4 KiB
C#
Executable File

using System;
using System.Collections.Generic;
using System.IO;
namespace SharpChrome.Commands
{
public class Backupkey : ICommand
{
public static string CommandName => "backupkey";
public void Execute(Dictionary<string, string> arguments)
{
Console.WriteLine("\r\n[*] Action: Retrieve domain DPAPI backup key\r\n");
string server = "";
string outFile = "";
bool noWrap = false;
if (arguments.ContainsKey("/nowrap"))
{
noWrap = true;
}
if (arguments.ContainsKey("/server"))
{
server = arguments["/server"];
Console.WriteLine("\r\n[*] Using server : {0}", server);
}
else
{
server = SharpDPAPI.Interop.GetDCName();
if (String.IsNullOrEmpty(server))
{
return;
}
Console.WriteLine("\r\n[*] Using current domain controller : {0}", server);
}
if (arguments.ContainsKey("/file"))
{
// if we want the backup key piped to an output file
outFile = arguments["/file"];
}
SharpDPAPI.Backup.GetBackupKey(server, outFile, noWrap);
}
}
}