如何删除流氓软件

被流氓软件困扰? 连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"

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

相关推荐
HungryGoogle1 小时前
CIC2017的CICFlowMeter 的使用
网络安全
数据知道13 小时前
宽字节注入、二次注入、堆叠注入:高级 SQLi 专题
linux·运维·安全·网络安全
2501_9159184119 小时前
iOS 怎么抓包?抓包鹰系统级 网卡 应用层三种方式对比,不越狱抓 iPhone 流量
网络协议·计算机网络·网络安全·ios·adb·https·udp
菩提小狗21 小时前
每日安全情报报告 · 2026-08-06
网络安全·漏洞·cve·安全情报·每日安全
数据知道1 天前
XSS 攻防全解:反射型、存储型、DOM 型实战演示
前端·安全·web安全·网络安全·xss
2501_915921431 天前
抓包鹰抓取系统 App 的流量,从底层读明文
网络协议·计算机网络·网络安全·adb·https·udp
Atomic121381 天前
登录界面渗透测试全攻略
web安全·网络安全
treesforest1 天前
随意装软件也会被恶意IP入侵电脑?
网络·网络协议·tcp/ip·网络安全·ip属地·查ip归属地
Yan_chen6662 天前
SQL-LABS_Less18-20实战攻略
数据库·sql·web安全·网络安全
Lust Dusk2 天前
记一次Linux应急响应题目解析
linux·运维·服务器·网络·安全·网络安全