如何删除流氓软件

被流氓软件困扰? 连del命令都删不了,显示拒绝访问?那就试试这个程序吧!(必须管理员执行!只能保存再桌面,自己命名只能命名为Smasher.vbs)如果不想自己操作可以直接下载上面的exe软件

vbscript 复制代码
Option Explicit

' ==============================================================================
' Shredder.vbs - Stubborn File/Folder Remover
' Description: Forces deletion of files/folders by taking ownership and 
'              resetting ACLs via PowerShell/CMD.
' Language: VBScript
' ==============================================================================

Dim objShell, objFSO, strPath, strCommand, intResult
Dim bIsAdmin

Set objShell = CreateObject("WScript.Shell")
Set objFSO = CreateObject("Scripting.FileSystemObject")

' Check if running as Administrator
bIsAdmin = IsAdmin()

If Not bIsAdmin Then
    MsgBox "Error: This script requires Administrator privileges." & vbCrLf & _
           "Please right-click the script and select 'Run as administrator'.", _
           vbCritical, "Permission Denied"
    WScript.Quit 1
End If

' Main Input Loop
Do
    strPath = InputBox("Enter the full path of the file or folder to shred:" & vbCrLf & _
                       "(Example: C:\Windows.old or D:\Malware.exe)", _
                       "Stubborn File Shredder", "")
    
    ' Exit if user cancels or enters empty string
    If strPath = "" Then
        If MsgBox("Do you want to exit?", vbYesNo + vbQuestion, "Confirm Exit") = vbYes Then
            WScript.Quit 0
        End If
    Else
        Exit Do
    End If
Loop

' Validate Path Existence
If Not objFSO.FileExists(strPath) And Not objFSO.FolderExists(strPath) Then
    MsgBox "The specified path does not exist:" & vbCrLf & strPath, vbExclamation, "Invalid Path"
    WScript.Quit 1
End If

' Confirm Deletion
intResult = MsgBox("WARNING: This action is irreversible!" & vbCrLf & vbCrLf & _
                   "Target: " & strPath & vbCrLf & vbCrLf & _
                   "The script will force take ownership and delete this item." & vbCrLf & _
                   "Are you sure you want to proceed?", _
                   vbYesNo + vbCritical, "Final Confirmation")

If intResult = vbNo Then
    WScript.Quit 0
End If

' Execute Shredding Process
Call ShredPath(strPath)

MsgBox "Operation Completed.", vbInformation, "Success"

' ==============================================================================
' Subroutine: ShredPath
' Takes ownership, grants full control, and deletes the target.
' ==============================================================================
Sub ShredPath(ByVal targetPath)
    Dim cmdTakeOwn, cmdIcacls, cmdDelete
    Dim execResult
    
    ' Wrap path in quotes to handle spaces
    targetPath = """" & targetPath & """"
    
    ' Step 1: Take Ownership (Recursive for folders)
    ' /F: File/Folder, /R: Recursive, /A: Give to Administrators group
    cmdTakeOwn = "cmd.exe /c takeown /F " & targetPath & " /R /A /D Y"
    
    ' Step 2: Grant Full Control to Administrators
    ' /grant: Grant permission, (OI)(CI): Object/Container Inherit, F: Full Control, /T: Recursive
    cmdIcacls = "cmd.exe /c icacls " & targetPath & " /grant Administrators:(OI)(CI)F /T"
    
    ' Step 3: Delete
    ' Check if it's a file or folder to choose the right command
    If objFSO.FolderExists(Replace(targetPath, """", "")) Then
        ' Remove Directory /S (all subdirs) /Q (quiet)
        cmdDelete = "cmd.exe /c rd /S /Q " & targetPath
    Else
        ' Delete File /F (force read-only) /Q (quiet)
        cmdDelete = "cmd.exe /c del /F /Q " & targetPath
    End If
    
    ' Execute Commands with Hidden Window (0) and Wait (True)
    On Error Resume Next
    
    ' Run Take Ownership
    execResult = objShell.Run(cmdTakeOwn, 0, True)
    
    ' Run Icacls
    execResult = objShell.Run(cmdIcacls, 0, True)
    
    ' Run Delete
    execResult = objShell.Run(cmdDelete, 0, True)
    
    If Err.Number <> 0 Then
        MsgBox "An error occurred during the process:" & vbCrLf & Err.Description, vbCritical, "Error"
        Err.Clear
    End If
    
    On Error GoTo 0
End Sub

' ==============================================================================
' Function: IsAdmin
' Checks if the current script is running with elevated privileges.
' ==============================================================================
Function IsAdmin()
    Dim objNetwork, strComputer, colItems, objItem
    On Error Resume Next
    Set objNetwork = CreateObject("WScript.Network")
    strComputer = objNetwork.ComputerName
    
    ' Try to access a protected WMI class or check SID
    ' A simpler method for VBS is checking if we can write to a system dir or using Shell.Application
    Dim objShellApp
    Set objShellApp = CreateObject("Shell.Application")
    
    ' This method checks if the current process has admin rights by attempting a silent elevation check
    ' However, the most reliable way in VBS without external tools is often just trying to run a privileged command
    ' Here we use a common trick: checking if we can access the Admin share or similar, 
    ' but let's use the standard "whoami /groups" approach via shell execution for robustness.
    
    Dim objExec, strOutput
    Set objExec = objShell.Exec("cmd.exe /c whoami /groups")
    strOutput = objExec.StdOut.ReadAll
    
    If InStr(strOutput, "S-1-16-12288") > 0 Or InStr(strOutput, "S-1-16-16384") > 0 Then
        IsAdmin = True
    Else
        IsAdmin = False
    End If
End Function

如何操作使用

由于 VBScript 无法像 exe 那样直接右键"以管理员身份运行",你需要通过以下步骤正确执行该脚本:

第一步:保存脚本
  1. 新建一个文本文档。
  2. 将完整的代码粘贴进去
  3. 将文件另存为 Shredder.vbs(确保后缀名是 .vbs 而不是 .txt,编码必须ANSI)。
第二步:不能直接运行!

需要再cmd里运行以下代码即可:powershell -Command "Start-Process 'wscript.exe' -ArgumentList '\"%USERPROFILE%\Desktop\Smasher.vbs\"' -Verb RunAs"

麻烦各位评论点赞加关注,谢谢!

相关推荐
菩提小狗7 小时前
每日安全情报报告 · 2026-07-16
网络安全·漏洞·cve·安全情报·每日安全
Fnetlink19 小时前
2026年SDWAN供应商如何选,从“连通“到“智连“的架构演进
大数据·网络安全
todoitbo10 小时前
让数据看板随时可见:Grafana + cpolar 远程访问实战
ui·网络安全·grafana·数据看板·远程访问
Fnetlink111 小时前
Fnet 云网安 260717
网络·安全·网络安全
txg66613 小时前
Agent 攻击 Agent:自动检测 LLM Agent 中的污点式漏洞
人工智能·深度学习·安全·网络安全
2501_915106321 天前
TraceEagle 代理抓包教程 本机和手机的 HTTPS 抓包方法
网络协议·计算机网络·网络安全·ios·adb·https·udp
Chockmans1 天前
春秋云境CVE-2023-51385(保姆级教学)
大数据·web安全·elasticsearch·搜索引擎·网络安全·春秋云境·cve-2023-51385
ICT系统集成阿祥2 天前
WAF部署方式对比(主流5种:透明桥、反向代理、旁路镜像、串接路由、云WAF)
网络安全·waf·部署模式
清欢渡---2 天前
HCIP-第五章vrrp
网络·网络安全·hcip