推奨:ASPのファイルシステムオブジェクトの詳細な説明指定されたドライブは存在しますか?この例は、ドライブエキシスト法を使用してドライブが存在するかどうかを検出する方法を示しています。コードは次のとおりです。HTMLBODY%setFS = server.createObject(scripting.filesystemobject)ifffs.driveExists(c:)= truethen response.write(drive c:exists。)else response.wr
データベースがハングアップした後、多くの人がそれに対処する方法を知らないか、処理が不完全であるため、Webページが開かれた後もトロイの木馬が表示されます。この記事では、参考のためのより良いソリューションを紹介します。ステップ1 :既存のデータベースのバックアップを作成します。
ステップ2 :次のASPファイルを実行して、データベース内のJSトロイの木馬を削除します。 (注:conn.aspは省略されています)
| 「JSトロイの木馬のコンテンツをここに置く:あなた自身のデータベースでJSトロイの木馬のコンテンツに変更することを忘れないでください。 <! - #includefile = conn.asp-> <% server.scripttimeout = 180 setrstschema = conn.openschema(20) k = 1 dountilrstschema.eof '転送データベーステーブル ifrstschema(table_type)= tablethen respons.writek&。<fontcolor = red> <b>&rstschema(table_name)&</b> </font>: 'テーブル名を表示します setrs = server.createObject(adodb.Recordset) sql = select*from [&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).type)= 203then 'with with with with with with field conn.execute(update [&rstschema(table_name)&] set&rs(i).name&= fack(cast(&rs(i).name&asvarchar(8000))、 'js trojan content "、' ')) Response.Writers(i).Name && rs(i).Type& '実行されたフィールド名を表示します。 endif 次 Response.Write <br> endif rstschema.movenext k = k+1 ループ response.write実行を正常に作成します %> |
多くのデータベーステーブルがある場合、上記のトラバーサルデータベース構造は、実行する前にIISによって停止されます。この時点で、できます
| rstschema(table_type)=テーブルの場合 |
k値の範囲は、次のような適切に追加されます。
| ifrstschema(table_type)= tablek> 10andk <20then |
このようにして、一度に操作されるのは9つのテーブルのみです。
ステップ3 :
データベースJSインジェクションの特性(<スクリプト、</スクリプト>、http://などの文字が含まれる)によると、
次のコードをconn.aspに入れます:
| functionCheack_sqljs() 'データベース外部リンクJSインジェクションを防ぐ:TRUEは、外部リンクJSインジェクションを発見することです。 dimf_post、f_get check_sqljs = false ifrequest.form <> then 'フォーム提出時の検出 foreachf_postinrequest.form if(strums(lcase.form(f_post))、<script)<> 0Orinstr(lickes.form(f_post))、</script>)<> 0)andinstr(request.form(f_post))、http://)<> 0then check_sqljs = true exitfor endif 次 endif ifrequest.querystring <> then 'querystringの提出時の検出 foreachf_getinrequest.querystring if(strust(lcase.form(f_get))、<script)<> 0Orinstr(lieck.form(f_get))、</script>)<> 0)andinstr(request.form(f_get))、http://)<> 0then check_sqljs = true exitfor endif 次 endif エンド機能 functionCheckDataFrom() '送信されたデータを確認するソース:Trueはサイトの外から送信されます 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 エンド機能 ifcheack_sqljsorcheckdatafromthen respons.write <scriptlanguage = javascript> alert( '実行は禁止されており、違法な操作。'); </script> Response.End() endif |
共有:ASPコールサブルーチンを解釈するためのチュートリアルASPプログラムは、VBScriptなどを介してサブルーチンを呼び出すことができます。 VBScriptを使用してサブルーチンを呼び出し、サンプルコード:HTMLヘッド%SubVBProc(num1、num2)response.write.write(num1**num2)endub% /head body pは次のようなプログラムを呼び出すことができます: /pp result:%callvbproc(3,4)% /ppまたはこのように: /pp result