แนะนำ: คำอธิบายโดยละเอียดเกี่ยวกับวัตถุระบบไฟล์ของ ASP ไดรฟ์ที่ระบุมีอยู่หรือไม่? ตัวอย่างนี้แสดงให้เห็นถึงวิธีการใช้วิธี DriveExists เพื่อตรวจสอบว่ามีไดรฟ์อยู่หรือไม่ รหัสมีดังนี้: html body % setfs = server.createObject (scripting.filesystemobject) ifffs.driveexists (c :) = truethen response.write (ไดรฟ์ C: มีอยู่)
หลังจากที่ฐานข้อมูลถูกวางสายหลายคนไม่ทราบวิธีจัดการกับมันหรือการประมวลผลไม่สมบูรณ์ส่งผลให้โทรจันยังคงปรากฏขึ้นหลังจากเปิดหน้าเว็บ บทความนี้แนะนำทางออกที่ดีกว่าสำหรับการอ้างอิงของคุณขั้นตอนที่ 1 : ทำการสำรองข้อมูลสำหรับฐานข้อมูลที่มีอยู่
ขั้นตอนที่ 2 : เรียกใช้ไฟล์ ASP ต่อไปนี้เพื่อลบ JS Trojans ในฐานข้อมูล (หมายเหตุ: ถูกละเว้น conn.asp)
| 'ใส่เนื้อหา JS Trojan ที่นี่: โปรดอย่าลืมเปลี่ยนเป็นเนื้อหา JS Trojan ในฐานข้อมูลของคุณเอง <!-#includit file = conn.asp-> - Server.ScriptTimeOut = 180 setrstschema = conn.openschema (20) k = 1 dountilrstschema.eof 'ตารางฐานข้อมูลการถ่ายโอน ifrstschema (table_type) = tablethen response.writek &. <fontcolor = red> <b> & rstschema (table_name) & </b> </font>: 'แสดงชื่อตาราง setRs = server.createObject (adodb.recordset) sql = select*จาก [& rstschema (table_name) &] Rs.opensql, Conn, 1,3 fori = 0tors.fields.count-1 'เดินทางไปยังฟิลด์ในตาราง ifint (rs (i) .Type) = 129Orint (RS (i) .Type) = 130Orint (RS (i) .Type) = 200Orint (RS (i) .Type) = 201Orint (RS (i) .Type) = 202Orint (RS (i). conn.execute (อัปเดต [& rstschema (table_name) &] set & rs (i) .name & = แทนที่ (cast (& rs (i) .name & asvarchar (8000)), 'ใส่เนื้อหา JS Trojan ที่นี่', ''))))))) Response.writers (i) .name && rs (i) .type & 'แสดงชื่อฟิลด์ที่ดำเนินการ endif ต่อไป Response.write <br> endif rstschema.movenext k = k+1 วง Response.write การดำเนินการสำเร็จ - |
หากมีตารางฐานข้อมูลจำนวนมากโครงสร้างฐานข้อมูล Traversal ด้านบนจะหยุดโดย IIS ก่อนที่จะดำเนินการ ในเวลานี้คุณสามารถ
| ถ้า rstschema (table_type) = ตารางจากนั้น |
ช่วงของค่า k ถูกเพิ่มอย่างเหมาะสมเช่น:
| ifrstschema (table_type) = tablek> 10andk <20 แล้ว |
ด้วยวิธีนี้มีเพียง 9 ตารางเท่านั้นที่ใช้งานได้ในแต่ละครั้ง
ขั้นตอนที่ 3 :
ตามคุณสมบัติของการฉีด JS ฐานข้อมูล (ซึ่งจะรวมถึงอักขระเช่น <script, </script> และ http: //)
ใส่รหัสต่อไปนี้ใน conn.asp:
| FunctionCheAck_SQLJS () 'ป้องกันการเชื่อมโยงภายนอกฐานข้อมูลการฉีด JS: จริงคือการค้นพบการฉีดลิงค์ภายนอก JS dimf_post, f_get check_sqljs = false ifrequest.form <> จากนั้น 'การตรวจจับในการส่งแบบฟอร์ม foreachf_postinrequest.form if (instr (lcase (request.form (f_post)), <สคริปต์) <> 0orinstr (lcase (request.form (f_post)), </script>) <> 0) Andinstr (lcase (request.form (f_post)), http: //) <> 0then check_sqljs = true ออกจาก endif ต่อไป endif ifrequest.querystring <> จากนั้น 'การตรวจจับในการส่ง QueryString foreachf_getinrequest.querystring if (instr (lcase (request.form (f_get)), <สคริปต์) <> 0orinstr (lcase (request.form (f_get)), </script>) <> 0) Andinstr (lcase (request.form (f_get)), http: //) <> 0then check_sqljs = true ออกจาก endif ต่อไป endif endfunction FunctionCheckDataFrom () 'ตรวจสอบแหล่งข้อมูลที่ส่งข้อมูล: จริงถูกส่งจากภายนอกเว็บไซต์ checkDataFrom = true server_v1 = cstr (request.serverVariables (http_referer)) server_v2 = cstr (request.serverVariables (server_name)) ifmid (server_v1,8, len (server_v2)) <> server_v2then checkDataFrom = false endif endfunction ifcheack_sqljsorcheckdatafromthen Response.write <scriptLanguage = JavaScript> การแจ้งเตือน ('การดำเนินการเป็นสิ่งต้องห้ามดำเนินการผิดกฎหมาย'); </script> Response.end () endif |
แบ่งปัน: การสอนสำหรับการตีความรูทีนย่อย ASP Call โปรแกรม ASP สามารถเรียกรูทีนย่อยผ่าน VBScript และวิธีอื่น ๆ เรียกรูทีนย่อยโดยใช้ VBScript, ตัวอย่างโค้ด: HTML Head %subvbProc (NUM1, NUM2) Response.Write (NUM1*NUM2) ENDENTUB % /หัวร่างกาย P คุณสามารถเรียกโปรแกรมแบบนี้: /pp ผลลัพธ์: %callvbproc (3,4) % /pp หรือเช่นนี้: /pp ผล