PowerShell 滲透測試 (Penetration Test Scripts)


  1. 清單
    1. 取得 Windwos Product Key

整理滲透測試時使用的 Scripts,同時藉由分析 Powershell Scripts 來精進👨‍💻自己編輯 Powershell Scripts 的技術。
⚠️進行滲透測試,務必要遵照規範在事前取得對象的允許授權,以免誤觸法網。

logo

清單

取得 Windwos Product Key

$ProductKeyValue = (Get-ItemProperty -Path "HKLM:\SOFTWARE\Microsoft\Windows NT\CurrentVersion").digitalproductid[0x34..0x42]
$ProductKey = ""

for($i = 24; $i -ge 0; $i--) 
{ 
	$r = 0 

	for($j = 14; $j -ge 0; $j--) 
	{ 
		$r = ($r * 256) -bxor $ProductKeyValue[$j] 
		$ProductKeyValue[$j] = [math]::Floor([double]($r/24)) 
		$r = $r % 24 
	}
	
	$ProductKey = $Chars[$r] + $ProductKey 

	if (($i % 5) -eq 0 -and $i -ne 0) 
	{ 
		$ProductKey = "-" + $ProductKey 
	} 
} 

echo $ProductKey

參考 GitHub - BornToBeRoot / PowerShell


參考 GitHub - Mr-Un1k0d3r/RedTeamPowershellScripts