これでいいかナ?(Re:xmobile& protectorスパム誤判定)

投稿ツリー

  • なし だめか??(Re:testing) (なーお, 2007/10/15 15:41)
  • なし だめじゃん(Re:xmobile& protectでスパム誤判定) (なーお, 2007/10/16 5:16)
  • なし これもだめ(Re:xmobile& protectスパム誤判定) (なーお, 2007/10/16 23:52)
  • なし これでいいかナ?(Re:xmobile& protectorスパム誤判定) (なーお, 2007/10/19 0:47)
  • なし Re: [xoops] xmobile 書込みが protectorでスパム判定される (長さん, 2009/4/25 9:04)
  • なし Re: [xoops] xmobile 書込みが protectorでスパム判定される (なーお, 2009/4/26 10:17)

  • このトピックの投稿一覧へ

    なーお

    なし これでいいかナ?(Re:xmobile& protectorスパム誤判定)

    msg# 1.1.1.3
    depth:
    3
    前の投稿 - 次の投稿 | 親投稿 - 子投稿なし | 投稿日時 2007/10/19 0:47
    なーお  長老   投稿数: 1832 オンライン

    結局、上のロジックの判定文字列数下限値を「80」とし、更に150以上のsinglebyte文字列があれば無条件にアウト、にて様子を見ています。
     ・文字数が150以上:日本語文字が無いデータが1つあればSPAM(下表の「拒否3」)
     ・キー名称が'message','com_text','excerpt'で日本語文字がある2文字以上データが1つあれば許可(「許可1」)
     ・文字数80以上150未満:日本語文字があるデータが1つあれば許可(「許可2」)

     ループを抜けた段階で「拒否」が優先処理され、「許可」も「拒否」も無いばあいは
     (1)判定文字数以上の文字列が無かった場合は「許可」
     (2)判定文字数以上の文字列が有った場合「拒否」となる。

     まとめると、以下の感じです。

    1
    2
    3
    4
    5
    6
    7
    8
    
     凡例:★=キー名称が'message','com_text','excerpt'のデータ
        △=その他の文字列
     
     文字byte数  1?2  3?80 81?150 150?
    ★マルチbyte無  無  無   無   拒否3
    ★マルチbyte有  無  許可1 ←   ← 
    △マルチbyte無  無  無   無   拒否3
    △マルチbyte有  無  無   許可2 ← 

     d3forumでスルーになった原因は、返信フォームのpost文字列中に「引用」用の文字列がそのまま割り込んで送信されてくるため、上記表の「許可1」の部分に当たったのでした。
     singlebyteスパムのほとんどはロボットでしょうから、その場合は「引用」部分は送信されてこないので問題なくブロックされるはずです。
     まあ、オリジナルのロジックで判定文字列数下限値を「150」とするのとどちらが良いのか、一概には決められません。

     1
     2
     3
     4
     5
     6
     7
     8
     9
    10
    11
    12
    13
    14
    15
    16
    17
    18
    19
    20
    21
    22
    23
    24
    25
    26
    27
    28
    29
    30
    31
    32
    33
    34
    35
    36
    37
    38
    39
    40
    41
    42
    43
    44
    45
    46
    47
    48
    49
    50
    51
    52
    53
    54
    55
    
    <?php
     
    // Don't enable this for site using single-byte
    // Perhaps, japanese, schinese, tchinese, and korean can use it
     
    class protector_postcommon_post_need_multibyte extends ProtectorFilterAbstract {
     
    	function execute()
    	{
    		global $xoopsUser ;
    	
    		if( ! function_exists( 'mb_strlen' ) ) return true ;
    	
    		// registered users always pass this plugin
    		if( is_object( $xoopsUser ) ) return true ;
    	
    		$multibyte_cheked = false ; 
    		$multibyte_ok = false ; 
    		$multibyte_ng = false ;			
    		$check_length2 = 150 ;			
    	
    		$lengths = array(
    			0 => 80 ,	 //
    			'message' => 2 ,
    			'com_text' => 2 ,
    			'excerpt' => 2 ,
    		) ;
    	
    		foreach( $_POST as $key => $data ) {
    			// dare to ignore arrays/objects
    			if( ! is_string( $data ) ) continue ;
    	
    			$check_length = isset( $lengths[ $key ] ) ? $lengths[ $key ] : $lengths[ 0 ] ;
    			if( strlen( $data ) > $check_length ) {
    				$multibyte_cheked = true ;
    				if( strlen( $data ) > mb_strlen( $data ))  {
    					$multibyte_ok = true ;
    				}
    			}
    			if(( strlen( $data ) > $check_length2 ) && ( strlen( $data ) == mb_strlen( $data ) )) {
    				$multibyte_ng = true ;
    				break;
    			}
    		}
    		if((($multibyte_checked == true ) && ($multibyte_ok == false )) || $multibyte_ng == true ) {
    			$this->protector->message .= "No multibyte character was found ($data)\n" ;
    			$this->protector->output_log( 'Singlebyte SPAM' , 0 , false , 128 ) ;
    			die( 'Protector rejects your post, because your post looks like SPAM' ) ;
    		}
    		return true ;
    	}
     
    }
     
    ?>
    投票数:0 平均点:0.00
    返信する

    この投稿に返信する

    題名
    ゲスト名
    投稿本文

      条件検索へ