Trojan principle: Intruders use tools such as ASP image Trojan generator to combine a normal image with an ASP Trojan file into an image file (which will soon be harmful to the website)
After the ASP code is inserted into the image encoding, although the image can still be normally displayed, but the file content and size have been changed), and then upload this image using the file upload function provided by the website.
And then the ASP Trojan is uploaded.
'Defense method: Because this Trojan is a combination of pictures and Trojans, you need to check the file content before uploading the image. If the file content is illegal (that is, it contains malicious code ),
'Then the upload is prohibited, blocking the source of the Trojan attack. This is the first level of the Trojan attack and is crucial and must be blocked.
'*************************************** ************************************
Copy codeThe Code is as follows: 'beginners --------------------------------------------------------------------------------------------------------------------------
Function CheckFileContent (FileName)
Dim ClientFile, ClientText, ClientContent, DangerString, DSArray, AttackFlag, k
Set ClientFile = Server. CreateObject ("Scripting. FileSystemObject ")
Set ClientText = ClientFile. OpenTextFile (Server. MapPath (FileName), 1)
ClientContent = LCase (ClientText. ReadAll)
Set ClientText = nothing
Set ClientFile = nothing
AttackFlag = false
DangerString = ". getfolder |. createfolder |. deletefolder |. createdirectory |. deletedirectory |. saveas | wscript. shell | script. encode | server. |. createobject | execute | activexobject | language = | include | filesystemobject | shell. application"
DSArray = split (DangerString, "| ")
For k = 0 to UBound (DSArray)
If InStr (ClientContent, DSArray (k)> 0 then' determines whether the file contains dangerous operation characters. if yes, you must delete the file.
AttackFlag = true
Exit
End if
Next
CheckFileContent = AttackFlag
End function
'End Vertex ----------------------------------------------------------------------------------------------------------------------------