1
0
mirror of https://github.com/hashcat/hashcat.git synced 2025-07-22 22:48:47 +00:00

Merge pull request #4080 from lakiw/4079-radmin3_to_hashcat

Updated radmin3_to_hashcat.pl to support multiple users
This commit is contained in:
Jens Steube 2025-07-12 14:16:10 +02:00 committed by GitHub
commit 2ac3fd2053
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194

View File

@ -48,6 +48,8 @@
use strict;
use warnings;
use utf8;
use Encode;
use Encode::Guess;
#
@ -93,16 +95,69 @@ if (! open ($fh, "<", $file_name))
binmode ($fh);
my $file_content = "";
# Strip out any leading info from the registry file or the registry dumping program
# Then break up the registry keys into an array so each one can be processed if there are multiple
# Radmin users
my @sections;
my $current_section = '';
{
local $/ = undef;
local $/; # Enable slurp mode
my $file_info = <$fh>;
$file_content = <$fh>;
# Registry dumps are often UTF-16LE, but some programs might dump
# it as a different format
my $enc = guess_encoding($file_info, qw/ ascii cp1252 iso-8859-1 utf-8 UTF-16LE /);
# Decode using the encoding detected
$file_info = decode($enc->name, $file_info);
# Split lines, handling both Unix and Windows line endings
my @lines = split /\r?\n/, $file_info;
# Read the file line by line
foreach my $line (@lines) {
chomp $line;
# Check if the line is a section header
if ($line =~ /^\[HKEY_LOCAL_MACHINE\\SOFTWARE\\WOW6432Node\\Radmin\\v3\.0\\Server\\Parameters\\Radmin Security\\/) {
# If we already have a section, push it to the array
if ($current_section) {
push @sections, $current_section;
}
close ($fh);
# Start a new section with the header
$current_section = "$line\n";
}
elsif ($current_section) {
# If we are in a section, continue adding lines to it
if ($line =~ /^\[.*\]$/) {
# New section starts, save the current one
push @sections, $current_section;
$current_section = '';
} else {
# Add data to the current section
$current_section .= "$line\n";
}
}
}
}
# Push the last section if there was one
if ($current_section) {
push @sections, $current_section;
}
close $fh;
if (!@sections) {
print STDERR "ERROR: Did not find any Radmin users in the file'\n";
exit (1);
}
# Loop over the data
my $file_content = '';
while($file_content=shift(@sections)) {
if (length ($file_content) < 5 + 0) # replace 0 with minimum expected length
{
@ -143,9 +198,6 @@ if ($file_content_len < 2 + 1 + 2 + 1 + 2 + 32 + 2 + 256 + 2 + 256) # replace wi
exit (1);
}
# loop over the data:
my $user = "";
my $salt = "";
my $verifier = "";
@ -287,3 +339,4 @@ print sprintf ("\$radmin3\$%s*%s*%s\n",
$user,
$salt,
$verifier);
}