Đây là một hàm khá hữu dụng (và nguy hiểm nếu có mục đích xấu) để bạn có thể thực thi một chương trình trên server thông qua một trang ASP. Hàm sẽ phát sinh một tiến trình trên server với các thông số nhận được.
Để chạy được chương trình yêu cầu Server phải cài đặt scripting và được phân quyền
Cú pháp:
Shell command
Ví dụ:
Để mở IIS trên server
<% Shell ''c:windowssystem32inetsrviis.msc'' %> |
Mở Notepad trên server
<% Shell ''notepad'' %> |
Đăng ký một dll trên server
<% Shell ''Regsrv32 C:WINNTSystem32some.dll'' %> |
Mã nguồn::
1 | <%Private Sub Shell(byVal command)dim wshShell, boolErr, strErrDescOn Error Resume NextSet wshShell = CreateObject(''WScript.Shell'')wshShell.Run commandif Err ThenboolErr = TruestrErrDesc = Err.Descriptionend ifSet wshShell = NothingOn Error GoTo 0if boolErr then Err.Raise 5105, ''Shell Statement'', strErrDescEnd Sub%> |
Theo : Diễn đàn tin học






0 nhận xét:
Đăng nhận xét