Skip to content

Instantly share code, notes, and snippets.

@ffcommax
Created June 26, 2019 10:09
Show Gist options
  • Save ffcommax/58c75b10d6a0ca1b171e648c0bfe3c5e to your computer and use it in GitHub Desktop.
Save ffcommax/58c75b10d6a0ca1b171e648c0bfe3c5e to your computer and use it in GitHub Desktop.
CleanNTDS
param (
[string]$ntds = ""
)
write-host " CleanNTDSCleanNTDSCleanNTDS
CleanNTDSCleanNTDS" -ForegroundColor green
write-host " CleanNTDS
CleanNTDS" -ForegroundColor Yellow
write-host " CleanNTDSCleanNTDS
CleanNTDSCleanNTDSCleanNTDS" -ForegroundColor green
$a = @()
$b = @()
$i = 0
if($ntds){
foreach($line in Get-Content($ntds)){
$hash = $line.split(":")[3]
$i++
}
write-host "`r`n::ALL HASH:: $i" -ForegroundColor Cyan
foreach($line in Get-Content($ntds)){
$hash = $line.split(":")[3]
if ($a | where { $_ -eq $hash }){
#"Exsist"
$b += $hash
}
else{
$a += $hash
#"ADD::$hash"
}
}
write-host "::Uniqe::"($a.Length) -ForegroundColor Cyan
$cc = $b | Get-Unique
sleep(1)
write-host "::Most Repete Hash::"($cc.Length) -ForegroundColor Cyan
write-host "`r`n"
sleep(3)
$b | Get-Unique
}
else{
write-host "`r`n`r`nOops Insert Ntds Address" -ForegroundColor Red
write-host ".\CleanNTDS.ps1 -ntds c:\users\public\ntds.dit`r`n" -ForegroundColor Red
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment