mirror of
https://github.com/GhostPack/SharpDPAPI.git
synced 2026-11-10 10:11:28 -10:00
-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
48 lines
1.4 KiB
C#
Executable File
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);
|
|
}
|
|
}
|
|
} |