我有 Sonicwall TZ210 的备份文件,但丢失了管理员密码。
备份文件是.exp,有没有办法使用windows pc对其进行解码?
答案1
这不是一个完整的解决方案,而是一个开始。在 Linux 中,你可以使用它来解码转储:
base64 -d your-backup.exp | sed 's/&/\n/g'
或者使用这个 Perl 脚本:
#!/usr/bin/perl
use strict;
use MIME::Base64;
local($/) = undef; # slurp
my $decoded = decode_base64(<STDIN>);
$decoded =~ s/&/\n/gms;
print $decoded;
您将找到密码行,并可以使用 John the Ripper 进行暴力破解(http://www.openwall.com/john/)这里没有更简单的方法。
答案2
PowerShell 脚本可以在 Windows 系统上将文件解码为可读文本,但是,正如另一个答案所指出的,这并不能解决密码解密问题:
Function SonicWall_Exp2Txt ($Exp)
{
$Txt = $Exp -ireplace ".exp$", ".txt"
# Create temporary file names.
$Tmp = "." + $(get-date -uformat %s) + "."
$TmpTxt = $Txt -replace ".txt$", $($Tmp + ".txt")
$TmpExp = $TmpTxt -replace ".txt$", ".exp"
# Show input/output file names while processing.
Write-Host $("`n" + $Exp + "`n--> " + $Txt)
# Remove two "&" characters at the end of an .exp file before decoding it.
( Get-Content $Exp ) -replace ".{2}$" |
Out-File -Encoding default -FilePath $TmpExp
# certutil.exe -decode /?
# Usage:
# CertUtil [Options] -decode InFile OutFile
# Decode Base64-encoded file
# Note:
# certutil.exe aborts if OutFile already exists.
& certutil.exe -decode $TmpExp $TmpTxt
# Reformat the decoded file with line breaks to make it more readable. It
# is also possible to recode the output file with Out-File -Encoding set
# to unicode, utf7, utf8, utf32, ascii, bigendianunicode, default, or oem.
( Get-Content $TmpTxt ) -replace '\&', "`n" |
Out-File -Encoding utf8 -FilePath $Txt
# Remove the temporary files.
Remove-Item $TmpExp
Remove-Item $TmpTxt
}
# Get-ChildItem returns a scalar if one .exp file exists or an array if more
# than one .exp file is present. Force $Files to an array value to avoid
# error if only one file exists as scalars do not have a Count method.
#
$Files = @( Get-ChildItem "." -Filter "*.exp" )
For ($Loop=0; $Loop -lt $Files.Count; $Loop++)
{
SonicWall_Exp2Txt $Files[$Loop].FullName
}
脚本保存为时的调用示例exp2txt.ps1:
powershell.exe -NoLogo -ExecutionPolicy bypass -Command exp2txt.ps1 <NUL
归因: 此主题启发了上述脚本,该脚本的编写可能有助于识别保存文件的差异。