这个家伙不懒,什么都留下了
Stop-Service sshd -Force; Get-Process sshd -ErrorAction SilentlyContinue | Stop-Process -Force; sc.exe delete sshd -ErrorAction SilentlyContinue; Remove-Item C:\ProgramData\ssh\sshd_config -Force -ErrorAction SilentlyContinue; @'
Port 22
Protocol 2
HostKey __PROGRAMDATA__/ssh/ssh_host_rsa_key
HostKey __PROGRAMDATA__/ssh/ssh_host_ecdsa_key
HostKey __PROGRAMDATA__/ssh/ssh_host_ed25519_key
PasswordAuthentication yes
PubkeyAuthentication yes
StrictModes no
AuthorizedKeysFile .ssh/authorized_keys
Subsystem sftp sftp-server.exe
'@ | Out-File -FilePath C:\ProgramData\ssh\sshd_config -Encoding utf8; sc.exe create sshd binPath= "C:\Windows\System32\OpenSSH\sshd.exe -d" start= auto displayname= "OpenSSH SSH Server"; Remove-Item C:\Users\admin\.ssh -Recurse -Force -ErrorAction SilentlyContinue; mkdir C:\Users\admin\.ssh -Force; New-Item -ItemType File -Path C:\Users\admin\.ssh\authorized_keys -Force; icacls C:\Users\admin\.ssh /inheritance:r /grant "admin:F" /grant "SYSTEM:F"; icacls C:\Users\admin\.ssh\authorized_keys /inheritance:r /grant "admin:F" /grant "SYSTEM:F"; Start-Service sshd; Get-Service sshd; netstat -an | findstr :22