CMD command execution in an ASP.NET environment

zhaozj2021-02-16  107

CMD.asp Trojans must have used it. This is an ASP file that can execute the cmd command (but to be killed by anti-virus software. ^ _ ^). The principle is to call CMD.exe with WScript.Shell object, and then put the returned information into a temporary file, and then read the temporary file information to display the temporary file information. Oh, it is also possible to write similar programs in the ASP.NET environment. However, you can use those objects. There is a shell function in VB.NET that can perform an external program. Oh, just use it! Take a look at Microsoft .NET Framework SDK: [Shell function namespace: Microsoft.visualbasic module: Interaction assembly: Microsoft Visual Basic .Net Running (in Microsoft.visualBasic.dll) Run an executable, and If the program is still running, an integer of the process ID containing the program is returned. Public Function Shell (_ ByVal Pathname As String, _ Optional ByVal Style As AppWinStyle = AppWinStyle.MinimizedFocus, _ Optional ByVal Wait As Boolean = False, _ Optional ByVal Timeout As Integer = -1 _) As Integer Required Pathname parameters. String. The program name to be executed, and any required parameters and command line switches. PathName can also include a drive and a directory path or folder. STYLE Options. AppWinStyle. From the value selected from the AppWinStyle enumeration, the enumeration corresponds to the window style to run the program. If Style is omitted, the shell uses AppWinsTyle.minimizedFocus, which will make the program to minimize startup and focus. The Style parameter can have one of the following: Enumeration Value Description AppWinStyle.hide hides the window and provides focus for hidden windows. AppWinStyLe.NormalFoc is a focus to the window and displays the window in the nearest size and location. AppWinStyle.minimizedFocus provides a focus for the window and displays the window in the form of an icon. AppWinStyle.maximizedfocus provides a focus for the window and a full screen display window. AppWinStyLe.Normalnofocus Set the window to the nearest size and location. The current active window keeps the focus. AppWinStyle.minimizednofocus displays the window in the form of an icon. The current active window keeps the focus. WAIT options. Boolean. Indicates whether the shell function should wait for the value to complete. If Wait is omitted, the shell uses false. Timeout options. Integer. Wait Waizards the number of milliseconds waiting for TRUE. If timeout is omitted, the shell uses -1, indicates that there is no timeout, the shell returns until the program is completed. Therefore, if Timeout is omitted or set to -1, the shell may never return control to the program.

转载请注明原文地址:https://www.9cbs.com/read-10229.html

New Post(0)