แสดงบทความที่มีป้ายกำกับ spam-bot แสดงบทความทั้งหมด
แสดงบทความที่มีป้ายกำกับ spam-bot แสดงบทความทั้งหมด

วันศุกร์ที่ 18 กุมภาพันธ์ พ.ศ. 2554

Anti-Bot: Are You Human/Bot?

Anti-Bot: Are You Human/Bot?
ต้นฉบับ  http://custom.simplemachines.org/mods/index.php?mod=999

ม็อดตัวนี้คนเขาทำมานานแล้ว และไม่มีการอัพเดตเวอร์ชันมานาน สนับสนุนแค่นี้
1.1.4, 1.1.7, 1.1.8, 1.1.9, 1.1.10, 2.0 Beta 3 Public, 2.0 RC1, 2.0 RC1-1, 2.0 RC1.2 
ดังนั้น  1.1.12 กับ 2.0 RC4 จึงลงแบบแพ็คเกจไม่ได้ ต้องเมนวลเท่านั้น 
(ยังไงก็ต้องเมนวลอยู่ดี ถ้าใช้ไฟล์ภาษาไทย)

ถึงจะแก่แต่ก็เก๋า กันบอทสมัครสมาชิกได้ชะงัดนัก 


สำหรับ 1.1.12
เวอร์ชัน 2.0 RC3-4 ไม่จำเป็นต้องลงม็อดตัวนี้ 
เพราะมันฟังชันตั้งคำถามก่อนสมัครไว้ให้อยู่แล้ว ที่เมนูสแปม 


Themes/default/Register.template.php
ค้นหา

โค๊ด:
// Are there age restrictions in place?

วางก่อนที่ค้นหา
โค๊ด:
## Start MOD Are You Human?
if (!empty($modSettings['are_you_human_s']))
echo '
<tr valign="top">
<td width="40%" valign="top">
<b>', $context['are_you_human_question'], ':</b>
<div class="smalltext">', $txt['are_you_human_desc'], '</div>
</td>
<td>
<select name="', $_SESSION['are_you_human']['name'], '" tabindex="',  $context['tabindex']++, '" class="select">',
$context['are_you_human_answers'], '
</select>
</td>
</tr>';
## End MOD Are You Human?


ค้นหา

โค๊ด:
<input type="text" name="coppaPhone" id="coppaPhone_input" value="', !empty($modSettings['coppaPhone']) ? $modSettings['coppaPhone'] : '', '" size="22" maxlength="35" />
</td>
</tr>

วางหลัง
โค๊ด:
<tr class="windowbg2">
<td width="100%" colspan="2" align="center">
<hr />
</td>
</tr><tr class="windowbg2">
<th width="50%" align="right">
<label for="are_you_human_s">', $txt['are_you_human_s'], '</label>:
</th>
<td valign="top">
<input type="checkbox" name="are_you_human_s" id="are_you_human_s"', empty($modSettings['are_you_human_s']) ? '' : ' checked="checked"', ' class="check" />
</td>
</tr><tr class="windowbg2">
<th width="50%" align="right">
<label for="are_you_human_q">', $txt['are_you_human_q'], '</label>:
</th>
<td valign="top">
<select name="are_you_human_q" id="are_you_human_q" >
<option value="0" ', ('0' == $modSettings['are_you_human_q'] ? 'selected="selected"' : '') , '>', $txt['are_you_human_q_0'], '</option>
<option value="1" ', ('1' == $modSettings['are_you_human_q'] ? 'selected="selected"' : '') , '>', $txt['are_you_human_q_1'], '</option>
<option value="2" ', ('2' == $modSettings['are_you_human_q'] ? 'selected="selected"' : '') , '>', $txt['are_you_human_q_2'], '</option>
</select>
</td>
</tr><tr class="windowbg2">
<th width="50%" align="right">
<label for="are_you_human_a">', $txt['are_you_human_a'], '</label>:
</th>
<td valign="top">
<input type="checkbox" name="are_you_human_a" id="are_you_human_a"', empty($modSettings['are_you_human_a']) ? '' : ' checked="checked"', ' class="check" />
</td>
</tr>


Sources/Register.php
ค้นหา
โค๊ด:
// Under age restrictions?

วางก่อน
โค๊ด:
## Start MOD Are You Human? - Generating Code
if (!empty($modSettings['are_you_human_s']))
{
// Generate Random field name
$_SESSION['are_you_human']['name'] = chr(mt_rand(97, 122)) . md5(mt_rand());
$_SESSION['are_you_human']['answer'] = chr(mt_rand(97, 122)) . md5(mt_rand());

// Choice the Question
$context['are_you_human_question'] = $modSettings['are_you_human_q'] >> 1
? $txt['are_you_human_q' . mt_rand(1, 2)]
: ($modSettings['are_you_human_q'] ? $txt['are_you_human_q2'] : $txt['are_you_human_q1']);

// Choice the Answer
$answer_correct = $context['are_you_human_question'] == $txt['are_you_human_q1']
? $txt['are_you_human_answers'][0] : $txt['are_you_human_answers'][1];

// Shuffle the Answers?
if ($modSettings['are_you_human_a'])
shuffle($txt['are_you_human_answers']);

// Create the Options
$context['are_you_human_answers'] = '';
foreach ($txt['are_you_human_answers'] as $value)
$context['are_you_human_answers'] .= '
<option value="' . ($value == $answer_correct ? $_SESSION['are_you_human']['answer'] : chr(mt_rand(97, 122)) . md5(mt_rand())) . '">' . $value . '</option>';
unset($answer_correct);

// This page should be reaload always
header('Cache-Control: no-store');
}
## End MOD Are You Human? - Generating Code

ค้นหา
โค๊ด:
// Are they under age, and under age users are banned?

วางก่อน
โค๊ด:
## Start MOD Are You Human? - Capturing Bots

// Backup & Deleting SuperGlobal
$session = isset($_SESSION['are_you_human']) ? $_SESSION['are_you_human'] : false;
unset($_SESSION['are_you_human']);

// Are You Human?
if (!empty($modSettings['are_you_human_s']))
if (empty($session) || empty($_POST[$session['name']]) || $_POST[$session['name']] != $session['answer'])
fatal_lang_error(empty($session) ? 'are_you_human_expired' : 'are_you_human_fail', false);

// Old way - spammers should be the only one trying this
if (isset($_POST['areyouhuman']))
fatal_lang_error('are_you_human_fail', false);

## End MOD Are You Human? - Capturing Bots


Sources/ManageRegistration.php
ค้นหา
โค๊ด:
'coppaPhone' => !empty($_POST['coppaPhone']) ? $_POST['coppaPhone'] : '',

วางหลัง
โค๊ด:
## MOD Are You Human?
'are_you_human_s' => empty($_POST['are_you_human_s']) ? '0' : '1',
'are_you_human_q' => ereg('[0-2]', $_POST['are_you_human_q']) ? $_POST['are_you_human_q'] : '0',
'are_you_human_a' => empty($_POST['are_you_human_a']) ? '0' : '1',


Themes/default/languages/Modifications.english.php

ค้นหา
โค๊ด:
?>

วางก่อน
โค๊ด:
// Are You Human?
$txt['are_you_human_q1'] = 'Are You Human?';
$txt['are_you_human_q2'] = 'Are You Bot?';
$txt['are_you_human_desc'] = 'Another Anti-Bot Measure';
$txt['are_you_human_answers'][0] = 'Yes';
$txt['are_you_human_answers'][1] = 'No';
$txt['are_you_human_answers'][2] = 'I don\'t know';
$txt['are_you_human_answers'][3] = 'Maybe';
$txt['are_you_human_answers'][4] = 'I think...';
$txt['are_you_human_answers'][5] = 'Waits';
$txt['are_you_human_answers'][6] = 'Hmm'; 
// You can add more Answers for confused the bots

$txt['are_you_human_expired'] = 'This page has expired. Please restart the <a href="' . $scripturl . '?action=register;">registration page</a>.';
$txt['are_you_human_fail'] = 'Please confirm that you are human in order to proceed with registration.<br />
Bots are not allowed to register.';

$txt['are_you_human_s'] = 'Enable MOD Are You Human';
$txt['are_you_human_q'] = 'Select the Question';
$txt['are_you_human_a'] = 'Order Rand the Answers';
$txt['are_you_human_q_0'] = 'Are You Human?';
$txt['are_you_human_q_1'] = 'Are You Bot?';
$txt['are_you_human_q_2'] = 'Random Question';


Themes/default/languages/Modifications.thai-utf8.php
เครดิตภาษาไทย  it-dark.org

ค้นหา
โค๊ด:
?>

วางก่อน
โค๊ด:
/Are You Human?it-dark.org
$txt['are_you_human_q1'] = 'กรุณาตอบคำถามของท่าน?';
$txt['are_you_human_q2'] = 'กรุณาตอบคำถามของท่าน';
$txt['are_you_human_desc'] = '<font color=yellow>คุณจะไม่สแปมบอร์ดใช่หรือไม่. </font>';
$txt['are_you_human_answers'][0] = 'ไม่ใช่';
$txt['are_you_human_answers'][1] = 'ใช่';
$txt['are_you_human_answers'][2] = 'ฉันไม่รู้';
$txt['are_you_human_answers'][3] = 'อาจจะใช่';
$txt['are_you_human_answers'][4] = 'คิดว่าน่าจะใช่...';
$txt['are_you_human_answers'][5] = 'รอคิดดูก่อน';
$txt['are_you_human_answers'][6] = 'อืม..';

// You can add more Answers for confused the bots

$txt['are_you_human_expired'] = 'หมดเวลาของการสมัคร. กรุณาเริ่มต้นใหม่ <a href="' . $scripturl . '?
action=register;">สมัครสมาชิก</a>.';
$txt['are_you_human_fail'] = 'กรุณาตรวจสอบคำตอบของคุณ..<br />คุณแอบแฝงเข้ามา ไม่อนุญาติให้ลงทะเบียน.';
$txt['are_you_human_s'] = 'เปิดใช้งาน';
$txt['are_you_human_q'] = 'เลือกคำถาม';
$txt['are_you_human_a'] = 'สุ่มตอบ';
$txt['are_you_human_q_0'] = 'คำถามที่1';
$txt['are_you_human_q_1'] = 'คำถามที่2';
$txt['are_you_human_q_2'] = 'สุมคำถาม';


หลังจากแก้โค๊ดทั้งหมดเสร็จแล้ว ต้องเพิ่มฐานข้อมูล
ดาวน์โหลดไฟล์แนบ install1.php  จากนั้นอัพขึ้นโฮสต์ วางไว้ที่เดียวกับ SSI.php
คลิกเพื่อดาวน์โหลด* install1.php 

จากนั้นเข้าเบราว์เซอร์ แล้วพิมพ์
http://www/.เว็บคุณ.โดเมน/บอร์ด/install1.php

Visual Verification Options

download mod 
http://custom.simplemachines.org/mods/index.php?mod=734

Features
--------
- Prompt for verification on posts by guests
- Prompt for verification on searches by guests
(น่าจะทำงานกับบุคคลทั่วไปเท่านั้น)


ลองติดตั้งอย่างธรรมดาแล้ว แต่ไม่แสดงผล  
เพราะภาษายังไม่เข้ากัน  ต้องไปแก้ให้ไฟล์ภาษาแสดงผล

ค้นหาไฟล์  Modifications.thai.php  หรือ ม็อดดิฟิเคชั่น.ไทย-ยูทีเอฟ8


เพิ่ม

โค๊ด:
$txt['visual_verification_guest_post'] = 'Require image verification on all guest posts';
$txt['visual_verification_guest_search'] = 'Enable visual verification for search by guests';
$txt['error_visual_verification_failed'] = 'The letters you typed don\'t match the letters that were shown in the picture.';

ไว้ก่อนหน้า
โค๊ด:
?>

จากนั้นไปที่  ผู้ดูแล  - หัวข้อ กระทู้  -  ตั้งค่าให้เปิดใช้งานเรียกหาโค๊ดสำหรับบุคคลทั่วไป


จากที่ได้ทดลองทำ  สามารถแสดงผลเป็นอย่างดีในขั้นตอนการโพสต์ ตั้ง-ตอบ กระทู้โดยบุคคลทั่วไป
แต่การค้นหายังไม่สามารถทำได้  แต่คิดว่าคงไม่มีความจำเป็นเท่าไหร่ที่จะป้องกัน ไม่ให้บุคคลทั่วไปค้นหา
1.สามารถปิดไม่ให้บุคคลทั่วไปค้นหาได้จาก การแก้ไขการอนุญาตอยู่แล้ว
2.การค้นหานั้นมีผลอย่างเดียวคือแบนวิธ  หากไม่มีความจำเป็น อาจไม่ต้องป้องกันก็ได้


หากทำแล้วไม่แสดงผล  ก็คงต้องใช้การลงแบบเมนวล

การเพิ่มคำสั่งบล็อกบ็อท spam (ลิตเติลแคท)

อ้างถึง

การเพิ่มคำสั่งบล็อกบ็อท spam

ในกรณีที่เจอปัญหาบ็อทโพสกระทู้ที่ทิ้งลิงค์ไว้ เราสามารถเพิ่มสคริปคำสั่งบล็อกการโพสกระทู้เหล่านั้นด้วยผู้ใช้งานที่ไม่ล็อกอิน (บ็อท)


ในไฟล์ /Sources/Post.php
ค้นหาส่วนนี้้

อ้างถึง
if (empty($modSettings['guest_post_no_email'])) { if (!isset($_REQUEST['email']) || $_REQUEST['email'] == '') $context['post_error']['no_email'] = true; elseif (preg_match('~^[0-9A-Za-z=_+\-/][0-9A-Za-z=_\'+\-/\.]*[แอท][\w\-]+(\.[\w\-]+)*(\.[\w]{2,6})$~', stripslashes($_REQUEST['email'])) == 0) $context['post_error']['bad_email'] = true; }


เพิ่มส่วนนี้ไว้ต่อท้าย

อ้างถึง
//  ป้องกัน Spam
$linkpos = strpos ($_POST['message'], "://"); // look for :// 
if ($linkpos !== false) $context['post_error']['guest_no_link'] = true; else { $linkpos = strpos ($_POST['message'], "www."); // look for www. 
if ($linkpos !== false) $context['post_error']['guest_no_link'] = true;}


ในไฟล์เดียวกัน ค้นหาส่วนนี้

อ้างถึง
// Now make sure this email address is not banned from posting.
isBannedEmail($_POST['email'], 'cannot_post', sprintf($txt['you_are_post_banned'], $txt[28]));


เพิ่มส่วนนี้ต่อท้าย

อ้างถึง
// ป้องกัน Spam
 if (isset($_POST['message'])) { $linkpos = strpos ($_POST['message'], "://"); 
// look for :// 
 if ($linkpos !== false) $post_errors[] = 'guest_no_link'; else { $linkpos = strpos ($_POST['message'], "www."); 
// look for www. 
 if ($linkpos !== false) $post_errors[] = 'guest_no_link'; } }


ทีนี้ บุคคลทั่วไป หรือผู้ใช้งานใดๆ ก็ตามที่ไม่ได้ล็อกอิน ก็จะไม่สามารถตั้งกระทู้ที่มี :// หรือ www. (ตามที่ตั้งค่าไว้) ได้





การเพิ่มเหตุผลของข้อผิดพลาด

เมื่อเราเพิ่มคำสั่งบล็อกการโพสลิงค์แล้ว เรายังสามารถแนบเหตุผลของข้อผิดพลาดดังกล่าวได้ด้วยการเพิ่มสคริป

จากเดิมที่ไม่แสดงเหตุผลใดๆ 
ปรากฎข้อผิดพลาดตังต่อไปนี้ขณะส่งข้อความนี้:



ในไฟล์ /Themes/default/languages/Errors.thai.php
เพิ่มส่วนนี้ไว้ต่อท้าย

อ้างถึง
//  ป้องกัน Spam
$txt['error_guest_no_link'] = 'ขออภัย  บุคคลทั่วไปไม่สามารถโพสลิงค์ได้  กรุณาลงทะเบียน';


ผลสุดท้าย เมื่อมีบุคคลทั่วไปทำการตั้งกระทู้ด้วยเนื้อหาที่มีลิงค์ ก็จะได้ผลดังนี้

วิธีปกป้องเว็บบอร์ด SMF ให้ปลอดภัย

รบกวนท่านสมาชิกทุกท่าน  ช่วยแนะนำวิธี  หรือแนวทางป้องกันเว็บบอร์ด SMF จากแฮกเกอร์  หรือพวกชอบลองของด้วยครับ  ว่าควรทำอย่างไร?  ผมมือใหม่จริงๆ ครับ  ตอนนี้ทำเว็บแล้วรู้สึกหวั่นๆ เหมือนกัน

เห็นใน thai smf บางคนบอกให้เปลี่ยน chmode 777  เป็น  755  หลังจากลงบอร์ดแล้ว (จำได้แค่นี้ครับ)

ขอบคุณทุกความคิดเห็นครับ


1.chmode 777  เป็น  755 
2.พาสเวิดเอฟทีพี+พาสดาต้าเบส ก็ให้ยากหน่อย
3.ไฟล์อินสตอลต้องลบออก  
4.สำรองฐานข้อมูลและไฟล์อินเด็ก+เซ็ตติ้ง เป็นประจำ 


รบกวนท่านเซียวเหล่งนึ่ง  อธิบายขั้นตอนและวิธีการ ข้อ 1 กับ ข้อ 4  แบบละเอียดนิดนึงได้ไหมขอรับ  นายท่าน  

1.chmode 777  เป็น  755
> 777 คือ All permission (Read + Execute + Write)
  755 คือ Read + Execure (เปิดไฟล์ php ได้ , รันสคริป php ได้)
# ทำบน Control panel ของโฮสที่ใช้ หรือโดยโปรแกรม FTP (ถ้าโฮสรองรับคำสั่งนั้นๆ)

4.สำรองฐานข้อมูลและไฟล์อินเด็ก+เซ็ตติ้ง เป็นประจำ 
> 1. สำรองฐานข้อมูล โดยเข้าไปเมนูผู้ดูแลระบบ , (* เมนูต่อจากนั้น จำไม่ได้ เพราะตอนนี้ในเครื่องี้ไม่มี SMF ที่ใช้ได้ซักตัว  )
    2. สำรองไฟล์ .php สำคัญไว้ทั้งหมด (Settings.php , index.php) หรือถ้าเป็นไปได้ ก็ให้สำรองให้หมดทั้งบอร์ดเลยก็ดี (ไฟล์ไม่ใหญ่ไปนักหรอก )


หากเกิดปัญหาจะเรียกใช้ไฟล์นี้ยังไงครับ?

จาก รวมกระทู้-ติดตั้ง-ปรับแต่ง [SMF]
http://www.justusers.net/forum/index.php?topic=988.0
(เซียวเหล่งนึ่ง แห่งสำนักสุสานโบราณ)

ทำคล้ายๆ กับหัวข้อนี้   
~ วิธีย้ายเว็บบอร์ด SMF ~ (TinaCat) 
http://www.justusers.net/forum/index.php?topic=17.0

สู้ๆ  


ไฟล์ Settings.php ให้เซ็ตเป็น ๗๕๕ ดีกว่า
chmod 777 อันตราย!

ไวรัสที่ติดเข้าเว็บ มาจากไหน? (ตอนที่ 1-ธุลีดาว)

ปัญหาว่าเว็บมีอาการแปลกๆ เช่นจะมี code แปลกติดมาทุกหน้า
สาเหตุนั้นเกิดมาจากเว็บนั้นติดไวรัส (หรือโทรจัน)


แล้วในเว็บติดมาได้ยังไงล่ะ?

เมื่อคอมฯ ที่เราใช้งานติดไวรัส (หรือโทรจัน) จะมีไวรัสบางตัว
ที่มีพฤติกรรมขโมยรหัสผ่านของ FTP ที่เราใช้ upload หน้าเว็บขึ้นไปเก็บใน host

เมื่อมันได้รหัสผ่านไปแล้ว มันก็สามารถที่จะต่อเข้าไปยัง host
ด้วยรหัสผ่านของเรา จากนั้นก็เข้าไปแทรก script ไว้กับหน้าเว็บ
ทำให้เว็บเรามี code แปลกปลอม


ถ้าโดนไปแล้ว จะแก้ปัญหายังไงดี?

  • กำจัดไวรัสในเครื่องให้หมด แต่ถ้าใช้ anti virus ในเครื่องเรา scan อาจตรวจไม่เจอ
    เพราะไวรัสมันจัดการเครื่องเราซะงอมพระรามไปแล้ว
    ถ้าลำบากนักก็ format ทิ้งเลย ง่ายดี  ;D
  • เข้าไปไล่ลบ code ที่ถูกแทรก ทุกๆ หน้า (ทั้ง html, php, asp, jsp)
  • ให้เข้าไปที่หน้าจัดการระบบของ host นั้นๆ แล้วลบ FTP user account ให้หมด
  • จากนั้นสร้าง FTP user account ขึ้นมาใหม่ ควรจะให้ user name และ password ต่างจากเดิม


จะป้องกันไวรัสติดคอมฯ ได้ยังไงบ้าง
  • ขยัน update ข้อมูลไวรัสให้ตัว anti virus และเปิดใช้งานไว้ด้วยนะ  ;)
  • ใช้โปรแกรมจำพวก anti autorun เช่น Ardv (แนะนำเป็นการส่วนตัวเลย ตัวนี้โดนใจมาก)  ;D
  • IE 6 เก็บเข้ากรุ เลิกใช้ได้เลย ถ้าเป็นไปได้ แนะนำ FireFox, Opera, Chrome, Safari
    โปรแกรม browser ตัวอื่นๆ ที่เป็นหน้ากากครอบ IE ก็ไม่แนะนำให้ใช้
  • พยายามอย่าใช้โปรแกรม crack ทั้งหลาย หันมาใช้พวก Open Source ดีกว่า
    หรือถ้ายังอยากใช้โปรแกรมละเมิดลิขสิทธิ์ ก็ใช้เป็น serial ดีกว่า crack
  • สวดมนต์ ทำบุญสร้างกุศลเยอะๆ  :D

และคอมฯ เครื่องที่ใช้ในการ upload ขึ้น host
ก็ไม่ควรใช้คอมฯ ที่เป็นเครื่องสาธารณะใช้กันหลายมือ
ถ้าไม่ชัวร์ว่าปลอดไวรัสสนิท