#!/usr/local/bin/perl #----------------------------------------------------------------------------- #- #- ブラクラチェッカー by kuri|minima #- 4/18 conchから持ってきた ver. 0.01 #- #----------------------------------------------------------------------------- # 【重大な警告】 # #   このスクリプトは決して利用しないで下さい。 #   常識的な HTTP 処理を行っておらず, #   ネットワークに無用な負荷を与えるだけです。 #   我ながら "厨房さ" 炸裂のスクリプトでした。とほほー。 # use Socket; $cgi = './bcc.cgi'; $version = '0.03'; $copyright = '
Browser Crasher Checker - (C) kuri|minima. All rights reserved.(warai'; $view = './view.cgi'; #チェック済みサイト表示 $nowTime = time; $data_not_enough = 0; # データが不十分だったらコレ $lastdata = ''; # タイムアウト処理された時,直前に受け取ったデータはここ #----------------------------------------------------------------------------- #- GETデータ取得 #----------------------------------------------------------------------------- $url = $ENV{'QUERY_STRING'}; #- 270というのは,ほんのわずかな優しみのつもり(わらい if( 270 < length( $url ) ){ $url = substr( $url, 0, 255 ); } $url =~ s/\++$//; $url =~ s/%([2-7][a-fA-F0-9])/pack("C",hex($1))/eg; $url =~ s/^url=//; $url =~ s/\x7f/%7f/ig; $url =~ s/,/%2c/g; $url =~ s/チェック済みURL一覧
飛び先のチェック by ぴょん基地の友達 - 併せてご覧下さい
"concon問題"修正モジュール:
Decon - 株式会社テクノクラフト
サポート技術情報 - →Microsoft社から修正モジュールが出ています


この情報による損害は責任とれません。
当然,リンクは自由。商用も雑誌掲載も知りません。ご自由に。
ソ\ースはSmart Contents Collectionの方で。商売でも何でもご自由に(´ー`)

これ,↓流行ってます←虚偽
  <FORM action="http://cgi.coara.or.jp/cgi-bin/cgiwrap/tkuri/BCC/bcc.cgi" method="GET">
  Browser Crasher Checker : <INPUT type="text" name="url" size="60" value="http://"> <INPUT type="submit" value="Check">
  </FORM>
デザインは各自で工夫してください。

こんな使い方を不許可にした覚えはありませんヽ('-'*)
  <A href="http://cgi.coara.or.jp/cgi-bin/cgiwrap/tkuri/BCC/bcc.cgi?http://www.minima.com/~minima/">
  http://www.minima.com/~minima/ を検査する
  </A>

4/30 ver. 0.03
  ↓20秒内にデータを処理できなくても,</HTML>まではちゃんとデータを取得できているのです。
  あと,検査済みURL一覧をソ\ートしました。やっぱりこっちの方がみやすいです。
4/25 ver. 0.02
  どうしてhttp://www.goo.ne.jpを検査しても20秒内にデータを処理できないかなぁと思ったら・・・。
4/23 ver. 0.01 unfold...
  っていうか,conconチェッカーのスクリプトをそのまま使いまわしてます。笑い

$copyright _HTML_ exit; } #----------------------------------------------------------------------------- #- サーバ名,ポートを取得 #----------------------------------------------------------------------------- if( $target_url =~ m|^http://(.*?)/(.*)| ){ ($server, $port) = split(/:/, $1); $url = '/' . $2; $port = 80 unless $port; } else{ &error_html("URLの記述が間違っていませんか?"); } #----------------------------------------------------------------------------- #- タイムアウト処理ルーチン #----------------------------------------------------------------------------- $timeout= 20; sub timeout_server{ close( SOCK ); $data_not_enough = 1; if( $lastdata =~ /<\/HTML>/i ){ $data_not_enough = 2; } } #----------------------------------------------------------------------------- #- サーバに接続開始 #----------------------------------------------------------------------------- #- ホスト名からIPアドレスを取得 $ipaddr = inet_aton( $server ) or &error_html("$server : IPアドレスが取得できません"); #- ソケットのオープン # socket( SOCK, PF_INET, SOCK_STREAM, getprotobyname( 'tcp' ) ) socket( SOCK, AF_INET, SOCK_STREAM, getprotobyname( 'tcp' ) ) or &error_html("ソ\ケットがオープンできませんでした
ごめんなさい"); #- ホスト,ポートへの接続 # if( !connect( SOCK, sockaddr_in( $port, $ipaddr ) ) ) { if( !connect( SOCK, pack( 'S n a4 x8', AF_INET, $port, $ipaddr) ) ) { close( SOCK ); &error_html("$server:$port に接続できませんでした"); } #- ソケットのバッファリングを止める select( SOCK ); $| = 1; select( STDOUT ); #----------------------------------------------------------------------------- #- リクエストをサーバに送る #----------------------------------------------------------------------------- print SOCK "GET $url HTTP/1.1\r\n"; print SOCK "Referer: $target_url\r\n"; print SOCK "Host: $server\r\n"; print SOCK "Accept: */*\r\n"; print SOCK "User-Agent: BrowserCrasherChecker $version\r\n"; print SOCK "\r\n"; #----------------------------------------------------------------------------- #- 受信 #----------------------------------------------------------------------------- #- タイムアウトの設定 $SIG{'ALRM'} = \&timeout_server; alarm( $timeout ); $head = ''; $text = ''; $status = ''; $content = ''; #- テキストかどうか $len = 0; $head_flg = 1; #- ヘッダを見分けるためのフラグ while ( ){ #- タイムアウト設定 alarm( $timeout ); #- とりあえず,これ # s/%([a-fA-F0-9][a-fA-F0-9])/pack("C", hex($1))/eg; #- ヘッダかどうかを見分ける if( $_ eq "\n" || $_ eq "\r\n" ){ $head_flg = 0; } #- まだヘッダなら if( $head_flg ){ $head .= $_; chomp; ($mes, $cont) = split(/:/, $_, 2); $cont =~ s/ //g; #---------------------------------- #- ここで Location チェック #---------------------------------- if( $mes =~ m/Location/i ){ $head_location = $cont; if( &file_scheme( $cont ) ){ $head_location_filescheme = 1; } } #- forbidden とか,not found とか if( $mes =~ m/HTTP(.*)403(.*)Forbidden/i ){ $status = 'forbidden'; } if( $mes =~ m/HTTP(.*)404(.*)Not/i ){ $status = 'notfound'; } #- コンテントデータはどうよ? if( $mes =~ m/Content-type/i ){ $content = $cont; } } else{ #- 連結 $len += length( $_ ); $text .= $lastdata = $_; if( 204800 < $len ){ # 200kbまで $data_not_enough = 3; last; } } } close( SOCK ); alarm( 0 ); #- htaccess はチェックはこれだけ if( $target_url =~ /htaccess$/ ){ if( $status eq 'forbidden' ){ $htaccess_forbidden = 1; goto _Print; } $htaccess_filescheme = &file_scheme( $text ); goto _Print; } #- cssファイルはチェックはこれだけ if( $content =~ /text\/css/ ){ $css_filescheme = &file_scheme( $text ); goto _Print; } $text_view = $text; $text =~ s/[\r\n]/ /g; $text =~ s/\s*url/url/ig; $text =~ s/["']/ /g; $text =~ s/"/ /ig; # $text =~ s/([>\)])/ $1/g; $text =~ s/>/ >/g; $text =~ s/\s*([=\(])\s*/$1/g; $text =~ s/\s*\+\s*//g; @in_style = ( $text =~ m!.*? これ以上imgを調べる余地なし if( $html_img_filescheme && $html_img_mailto ){ next; } #- imgが50を超えた -> これ以上imgを調べたくない if( 50 < @img ){ next; } ($temp) = ( /src=([^\s]*)/i ); foreach( @img ){ #重複uzeee if( $temp eq $_ ){ goto _Escape; } } if( &file_scheme( $temp ) ){ $html_img_filescheme = 1; $html_img_is = 0; } elsif( $temp =~ m!^mailto:!i ){ $html_img_mailto = 1; $html_img_is = 0; } push( @img, $temp ); next; } if( /^a/i ){ # or 量が多いから特別にココで #- file:// があった -> これ以上調べる余地なし if( $html_ank_filescheme ){ next; } if( /onmouseover=([\S]*)/i ){ push @ank_onmouseover, $1; } ($temp) = ( /href=([\S]*)/i ); foreach( @ank ){ #重複uzeee if( $temp eq $_ ){ goto _Escape; } } if( &file_scheme( $temp ) ){ $html_ank_filescheme = 1; } push( @ank, $temp ); next; } # tableタグネストチェック if( /^table/i ){ # カウンタ $nest_table++; if( 10 < $nest_table ){ $html_table_nest = 1; } # ネストが10を超えた next; } if( /^\/table/i ){ #
カウンタ if( 0 < $nest_table ){ $nest_table--; } next; } if( /^meta.*url=([\S]*)/i ){ $meta = $1; next; } if( /^frame.*src=([\S]*)/i ){ push( @frame, $1 ); next; } if( /^embed.*src=([\S]*)/i ){ push( @embed, $1 ); next; } if( /^iframe.*src=([\S]*)/i ){ push( @iframe, $1 ); next; } if( /^layer.*src=([\S]*)/i ){ push( @layer, $1 ); next; } if( /^b.*ground=([\S]*)/i ){ push( @body, $1 ); next; } if( /^body.*onload=([\S]*)/i ){ push( @body_onload, $1 ); next; } if( /^in.*src=([\S]*)/i ){ push( @input, $1 ); next; } if( /^l.*rel=([\S]*)/i ){ push( @rel_of_link, $1 ); } if( /^l.*href=([\S]*)/i ){ push( @link, $1 ); next; } if( /^obj.*(?:data|classid)=([\S]*)/i ){ push( @object, $1 ); next; } if( /^s.*src=([\S]*)/i ){ push( @script, $1 ); next; } if( /^t.*ground=([\S]*)/i ){ push( @table, $1 ); next; } if( /^fo.*on=([\S]*)/i ){ push( @form, $1 ); next; } #
if( /^base.*href=([\S]*)/i ){ $baseurl = $1; } _Escape: 1; } #----------------------------------------------------------------------------- # conconチェック,mailto:チェック #----------------------------------------------------------------------------- #-- HTML lv.A -- 自動で他のURLを読み込むタグ $html_lvA_is = 0; foreach( $meta, @frame ){ # $metaはスカラね unless( $_ ){ next; } # $meta がスカラなもんで,必ず1回はループに入ってくる $html_lvA_is = 1; #- とりあえず,何かあったということで if( &file_scheme( $_ ) ){ $html_lvA_filescheme = 1; $html_lvA_is = 0; last; } } #-- HTML lv.B -- 機種によって違うタグ foreach( @embed, @iframe, @layer ){ unless( $html_lvB_filescheme ){ $html_lvB_is = 1; } if( &file_scheme( $_ ) ){ $html_lvB_filescheme = 1; $html_lvB_is = 0; } if( $cont =~ /^mailto:/ ){ $html_lvB_mailto = 1; } } $lfh = 0; # lfh = "@link" from here.(warai #-- HTML lv.C -- 一般的なHTMLタグ #- imgは調査済み foreach( @body, @input, @object, @script, @table, 'lfh', @link ){ if( $_ eq 'lfh' ){ $lfh = 1; next; } if( !$html_lvC_filescheme && ($_ ne 'lfh') ){ $html_lvC_is = 1; } if( &file_scheme( $_ ) ){ $html_lvC_filescheme = 1; $html_lvC_is = 0; } if( !$lfh && /^mailto:/ ){ $html_lvC_mailto = 1; } } #-- JavaScriptのヤシ foreach( @window_open, @history_go, @location_js, @location_href, @navigate, @src_js ){ unless( $javascript_filescheme ){ $javascript_is = 1; } if( &file_scheme( $_ ) ){ $javascript_filescheme = 1; $javascript_is = 0; } if( /^mailto:/ ){ $javascript_mailto = 1; } } #-- スタイルシート foreach( @style_prop, @in_style ){ unless( $stylesheet_filescheme ){ $stylesheet_is = 1; } if( m!file:[/|\\]+!i || m![a-zA-Z]:[/|\\]! ){ $stylesheet_filescheme = 1; $stylesheet_is = 0; } if( /^mailto:/ ){ $stylesheet_mailto = 1; } } # foreach( @form ){ if( &file_scheme( $_ ) ){ $html_ank_filescheme = 1; # これはアンカータグと同じね } } # 意外と見落としがち # は全てのURLを汚染する if( &file_scheme( $baseurl ) ){ $baseurl = ''; $html_base_filescheme = 1; } #----------------------------------------------------------------------------- # メッセージ出力 #----------------------------------------------------------------------------- _Print: print "Content-type: text/html\n\n"; &title; &form; if( $data_not_enough == 1 ){ print qq!

$timeout秒内にデータを完全に読み込めませんでした。

\n!; } elsif( $data_not_enough == 2 ){ print qq!

$timeout秒内にデータを完全に読み込めませんでした。
\n!; print qq!ただし,“</HTML>”というデータまでは読み込めたはずです。

\n!; } elsif( $data_not_enough == 3 ){ print qq!

データが200kbを超えているので,完全に読み込んでいません。
\n!; print qq!ソ\ースを確認するのを忘れないで下さい。

\n!; } print qq!
対象URL=$target_url
!; $warn_history = ''; if( $head_location_filescheme ){ $warn = 1; # 警告を出したよ,という意味 if( !$cashe ){ $warn_history .= ' - w_cloc'; } print <<"EOM";

conconクラッシャー
[Location]


HTTPレスポンスヘッダ“Location”によりfileスキーマにアクセスします。
“conconクラッシャー”の中では,最も悪質なタイプです。
EOM } if( $html_base_filescheme ){ $warn = 1; if( !$cashe ){ $warn_history .= ' - w_cbase'; } print <<"EOM";

conconクラッシャー
[BASEタグ]


BASEタグにより,基準URLがfileスキーマに設定されています。
このページの相対URLは全て汚染されています。
EOM } if( $html_table_nest ){ $warn = 1; if( !$cashe ){ $warn_history .= ' - w_nest'; } print <<"EOM";
Nested HTML

TABLE タグが10段以上ネストされています。
バージョン4.7 以前のNetscapeはフリーズする可能\性があります。
EOM } if( 10 <= @frame ){ $warn = 1; if( !$cashe ){ $warn_history .= ' - w_frame'; } print <<"EOM";
大質量FRAME

FRAME タグが多すぎると思いませんか?
悪意ありと考えられます。
EOM } if( $html_lvA_mailto || $html_lvB_mailto || $html_img_mailto || $html_lvC_mailto ){ $warn = 1; if( !$cashe ){ $warn_history .= ' - w_mail'; } print <<"EOM";
mailtoストーム

アンカータグではないタグで mailto: の記述が見つかりました。
一般的なパワーのマシンでは,ブラウザがフリーズする可能\性があります。
EOM } if( $javascript_mailto || $stylesheet_mailto ){ $warn = 1; if( !$cashe ){ $warn_history .= ' - w_mail'; } print <<"EOM";
mailtoストーム?

JavaScript,もしくはスタイルシートで mailto: の記述が見つかりました。
“mailtoストーム”かもしれません。
EOM } if( $html_lvA_filescheme ){ $warn = 1; if( !$cashe ){ $warn_history .= ' - w_c1'; } print <<"EOM";
conconクラッシャー [META,FRAMEタグ]

METAタグ もしくは FRAMEタグによりfileスキーマを参照します。
ブラウザがこのHTMLを解釈した瞬間,OSがクラッシュする可能\性があります。
EOM } if( $html_lvB_filescheme ){ $warn = 1; if( !$cashe ){ $warn_history .= ' - w_c2'; } print <<"EOM";
conconクラッシャー [EMBED,IFRAME,LAYERタグ]

EMBEDタグ,IFRAMEタグ,もしくは LAYERタグによりfileスキーマを参照します。
お使いのブラウザによってはこのHTMLを解釈した瞬間,OSがクラッシュする可能\性があります。
EOM } if( $html_img_filescheme || $html_lvC_filescheme || $javascript_filescheme ){ $warn = 1; if( !$cashe ){ $warn_history .= ' - w_c3'; } print <<"EOM";
conconクラッシャー [HTMLタグ,JavaScript] / FDDアタック

IMGタグやJavaScript等によりfileスキーマを参照します。
“conconクラッシャー”の場合は,ブラウザの設定によってはOSがクラッシュする可能\性があります。
“FDDアタック”の場合は,フロッピーディスクドライブへの不用なアクセスが続きます。
EOM } if( $stylesheet_filescheme ){ $warn = 1; if( !$cashe ){ $warn_history .= ' - w_c4'; } print <<"EOM";
conconクラッシャー [スタイルシート] / FDDアタック

fileスキーマを参照するスタイルシートが組み込まれています。
“conconクラッシャー”か“FDDアタック”の可能\性があります。
ソ\ースを確認し,十\分に警戒してください。
EOM } if( $html_ank_filescheme ){ $warn = 1; if( !$cashe ){ $warn_history .= ' - w_c5'; } print <<"EOM";
conconクラッシャー [アンカータグ,FORMタグ]

Aタグ,AREAタグ,もしくはFORMタグによりfileスキーマを参照します。
リンク先へジャンプしようとするかsumbitボタンを押すと,OSがクラッシュする可能\性があります。
EOM } if( $htaccess_filescheme ){ $warn = 1; if( !$cashe ){ $warn_history .= ' - w_c6'; } print <<"EOM";

conconクラッシャー警報
[.htaccess]


この.htaccessにfileスキーマへアクセスするような文字列が含まれています。
十\分にお気を付けください。
EOM } if( $htaccess_forbidden ){ $warn = 1; if( !$cashe ){ $warn_history .= ' - w_htfbd'; } print <<"EOM";
接続拒否
この.htaccessは接続を拒否されました。
十\分にお気を付けください。
EOM } if( $css_filescheme ){ $warn = 1; if( !$cashe ){ $warn_history .= ' - w_c7'; } print <<"EOM";

conconクラッシャー警報
[カスケーディングスタイルシート]


このカスケーディングスタイルシートはfileスキーマへアクセスするような文字列が含まれています。
十\分にお気を付けください。
EOM } foreach( @rel_of_link ){ $warn = 1; if( /stylesheet/i ){ if( !$cashe ){ $warn_history .= ' - css_is'; } print <<"EOM";
警戒喚起
このURLは外部カスケードスタイルシートファイルを読み込みます。
下記“LINK から呼び出されたURL”に表\示されるURLもチェックして下さい。
EOM last; } } if( $html_lvA_is ){ $warn = 1; if( !$cashe ){ $warn_history .= ' - at1'; } print <<"EOM";
警戒喚起
METAタグ,FRAMEタグにより外部ファイルを読み込みます。
ファイルがNotFoundでないか,また,それぞれのファイルの内容にもお気を付けください。
EOM } if( $html_lvB_is ){ $warn = 1; if( !$cashe ){ $warn_history .= ' - at2'; } print <<"EOM";
警戒喚起
EMBEDタグ,IFRAMEタグ,LAYERタグにより外部ファイルを読み込みます。
ファイルがNotFoundでないかにお気を付けください。ブラウザによって危険さが異なります。
EOM } if( $html_img_is || $html_lvC_is || $javascript_is || $stylesheet_is ){ $warn = 1; if( !$cashe ){ $warn_history .= ' - at3'; } print <<"EOM";
注意喚起
このファイルにはIMGタグなどのHTMLタグ,外部ファイルを読み込むようなJavaScript,
もしくはカスケーディングスタイルシートが存在します。
外部ファイルを読み込む場合はそのファイルがNotFoundでないか,また,内容にもお気を付けください。
EOM } unless( $warn ){ print "危険なページではないと思われます。\n"; } #- で,ちなみに・・・ if( $status eq 'notfound' ){ if( !$cashe ){ $warn_history .= ' - 404'; } print '
参考 - このURLはNotFoundでした。'; } print "
\n"; #----------------------------------------------------------------------------- #- 履歴に記録 #----------------------------------------------------------------------------- &write_history( $target_url, $warn_history ); #----------------------------------------------------------------------------- #- タグ内のJavaScript #----------------------------------------------------------------------------- print "
タグの中に組み込まれているJavaScript:
\n"; if( $body_onload[0] ){ print "BODYタグ内の onLoad に組み込まれたJavaScript:
\n"; foreach( @body_onload ){ print " ", $_, "
\n"; } print "
\n"; } if( $ank_onmouseover[0] ){ print "アンカータグ内の onmouseover に組み込まれたJavaScript:
\n"; foreach( @ank_onmouseover ){ print " ", $_, "
\n"; } print "
\n"; } #----------------------------------------------------------------------------- #- リンク先の検出結果を出力 #----------------------------------------------------------------------------- unless( $baseurl ){ $baseurl = $target_url }; $baseurl =~ s|^([^\?]*)/.*|$1/|; #--- とりあえず.htacessを探してみる if( $target_url =~ m!^(http://.*?/~.*?/)([^\?]*/)! ){ # ~ があるなら,多分 http://www.net.com/~hp/ という形式 $rooturl = $1; $dir = $2; } elsif( $target_url =~ m!^(http://.*?/~.*?/)! ){ $rooturl = $1; $dir = ''; } elsif( $target_url =~ m!^(http://.*?/)([^\?]*/)! ){ # じゃなければ,多分 http://user.domain.com/ という形式 $rooturl = $1; $dir = $2; } elsif( $target_url =~ m!^(http://.*?/)! ){ $rooturl = $1; $dir = ''; } @dirs = split('/',$dir); print "
基準URL:$baseurl
\n
\n"; print ".htaccessがあると思われる場所:アクセスが許可されていない場合もあります
\n"; &print_url("$rooturl.htaccess"); foreach( @dirs ){ $rooturl .= "$_/"; &print_url("$rooturl.htaccess"); } print "\n
\n"; print "
以下のURLもチェックできます
"; if( $head_location ){ print "Location により移動するURL:
\n"; &print_url( $head_location ); print "
\n"; } if( $meta ){ print "META により移動するURL:
\n"; &print_url( $meta ); print "
\n"; } &print_url_list( "FRAME から呼び出されたURL",@frame); &print_url_list( "EMBED から呼び出されたURL", @embed); &print_url_list( "IFRAME から呼び出されたURL",@iframe); &print_url_list( "LAYER から呼び出されたURL", @layer); &print_url_list( "BODY から呼び出されたURL", @body); &print_url_list( "INPUT から呼び出されたURL",@input); &print_url_list( "IMG から呼び出されたURL", @img); &print_url_list( "LINK から呼び出されたURL", @link); &print_url_list( "OBJECT から呼び出されたURL", @object); &print_url_list( "SCRIPT から呼び出されたURL", @script); &print_url_list( "TABLE関連のタグで指定されたURL", @table); &print_url_list( "JavaScript:window.openメソ\ッドで呼び出されたURL", @window_open ); &print_url_list( "JavaScript:history.goメソ\ッドで呼び出されたURL", @history_go ); &print_url_list( "JavaScript:locationプロパティに設定されたURL", @location_js ); &print_url_list( "JavaScript:hrefプロパティに設定されたURL", @location_href ); &print_url_list( "JavaScript:navigateメソッドで呼び出されたURL", @navigate); &print_url_list( "JavaScript:src,lowsrcなどのメソッドで呼び出されたURL", @src_js ); &print_url_list( "A,AREA から呼び出されたURL", @ank ); &print_url_list( "FORM から呼び出されたURL", @form ); print "
ステータスとヘッダ\n$head\n";

if( $head_location_filescheme ){
	print "サーバから送られてきたデータは以下の通りです\n";
	$text_view =~ s/今回のチェックは,移動先URLをチェックしたわけではありません\n";
	print "念のために移動先のURLもご確認ください\n";
	print "\n";
	print "なお,今回のチェックでサーバから送られてきたデータは以下の通りです\n";
	$text_view =~ s/ソ\ースを確認\n!;
}
else{
	print "(このURLはソ\ースを確認できません。ご了承ください。)\n";
}

print qq!
\n$copyright\n!; exit; #- スクリプト終了〜 #----------------------------------------------------------------------------- #--- file scheme アクセスチェック sub file_scheme{ if( $_[0] =~ m!^file:[/|\\]+!i || $_[0] =~ m!^[a-zA-Z]:[/|\\]! ){ return 1; } return 0; } #--- URLの貼り付け sub print_url_list{ my $mes = shift; if( $_[0] ){ print( $mes, ":
\n" ); foreach( @_ ){ &print_url( $_ ); } print "
\n"; } } sub print_url{ s/'//g; if( $_[0] =~ m!^#! ){ return; } if( $_[0] =~ m!^mailto:! ){ print qq! !, $_[0], qq!
\n!; return; } if( $_[0] =~ m!^http://! ){ print qq! $_[0]
\n!; } elsif( $_[0] =~ m!file:[/|\\]+!i || $_[0] =~ m!^[a-zA-Z]:[/|\\]! ){ print qq! $_[0]
\n!; } else{ print qq! $_[0]
\n!; } } #----------------------------------------------------------------------------- #- タイトルを描く #----------------------------------------------------------------------------- sub title{ print qq!Browser Crasher Checker\n!; print qq!

Browser Crasher Checker ver.$version

\n!; # print qq!今,ちょっと調整中です。これらの情報を信頼しないで下さい。
!; } #----------------------------------------------------------------------------- #- 入力フォーム #----------------------------------------------------------------------------- sub form{ print <<"endof_html"; URL:
endof_html } #----------------------------------------------------------------------------- #- 履歴記録 #----------------------------------------------------------------------------- sub write_history{ my $new_url = $_[0]; my $new_warn = $_[1]; my ($tm, $url, $warn, $i); my @lines; # if( &my_lock() ){ # goto _denied; # } if( open DB,"./hist.dat" ){ @lines = ; close(DB); } else{ @lines = (); } for( $i = 0; $i <= @lines; $i++ ){ ($tm, $url, $warn) = split(/,/, $lines[$i]); if( $url eq $new_url ) { splice( @lines,$i,1 ); goto _nextstep; } } #- 初めて調べるURL(もしくは最近調べてなかったURL) if( !open(DB,">>./back.dat") ){ open(DB,">./back.dat") or goto _nextstep; } print DB "$nowTime,$new_url,$new_warn\n"; close(DB); _nextstep: unshift( @lines, "$nowTime,$new_url,$new_warn\n" ); #- ここはウザいので実行しない。何件でも記録すれ #$data_max = 50; #if( $data_max < @lines ){ # for( ; $data_max <= @lines; $data_max++ ){ # $lines[$data_max] = ''; # } #} open DB,">./hist.dat" or return 0; print DB (@lines); close(DB); # &my_unlock(); _denied: return 1; } #----------------------------------------------------------------------------- # ロック処理 #----------------------------------------------------------------------------- sub my_lock{ my $count = 0; while( -e 'lock.tmp' ){ sleep( 2 ); if( 10 < $count++ ){ goto _denied; } } if( open( FP, '>lock.tmp' ) ){ close( FP ); } return 0; _denied: return 1; } sub my_unlock{ unlink 'lock.tmp'; } #----------------------------------------------------------------------------- #- エラーを表示して終わる #----------------------------------------------------------------------------- sub error_html{ print "Content-type: text/html\n\n"; &title; &form; print "
$_[0]
"; print "$copyright"; exit; }