[hack]抵御部分自动注册机(不使用注册验证码,不需GD) 1.0
hack名称:抵御部分自动注册机
作 者:pk0909
适 用:D2.5Sp1
安装程度:简易
安装需求:本hack以D2.5SP1正式版050401为基础修改
修改文件:include/global.php、register.php、templates/default/register.htm
说 明:
本hack可以抵御部分自动注册用户名之后再自动发表广告帖的软件(仅抵御自动注册)
道高一尺魔高一丈,在此以后这些自动软件也许也会跟着推出能够破解此hack的程序,所以只是暂时抵御,大家觉得有需要的可以试试看,不保证可以完全抵御(偶自己测试目前可以抵御论坛游侠和群发王)
include/global.php
- return substr(md5(substr($timestamp, 0, -6).$discuz_user.$discuz_uid.$discuz_pw), 8, 8);
复制代码
改成-->(注意,下面的$secStr的值请改成任意的字符串,不要和我的一样)
- $secStr = 'Jg9_@de.cd';
- return substr(md5(substr($timestamp, 0, -6).$discuz_user.$discuz_uid.$discuz_pw.$secStr), 8, 8);
复制代码
register.php
- include template('register');
复制代码
之上添加-->
- //defend machine - start 1/2
- $js_setvalue = "theform.formhash.value = ''";
- $hidden_hashs = '<input type="hidden" name="formhash" value="">';
- $comma = '';
- $hash_arrry = array();
- mt_srand((double)microtime() * 1000000);
- for($i=0;$i<strlen(FORMHASH);$i++) {
- $var_name = randomStr(16);
- $rn = random(5,1);
- $hvalue = substr(FORMHASH, $i, 1);
- $rstring = random($i) . $hvalue . random(strlen(FORMHASH)-$i-1);
- $index = mt_rand(0, 10000);
- while (isset($hash_arrry[$index])) {
- $index = mt_rand(0, 10000);
- }
- $hash_arrry[$index] = array('id' => $i, 'n' => $var_name, 'v' => $rstring);
- $js_setvalue .= ' + theform.' . $var_name . ".value.charAt($i)";
- }
- $js_setvalue .= ';';
- ksort($hash_arrry);
- foreach($hash_arrry as $hv) {
- $hidden_hashs .= "\n" . '<input type="hidden" name="'.$hv['n'].'" value="'.$hv['v'].'">';
- }
- $tmp = explode("\n", $hidden_hashs);
- $tmp2 = array_rand($tmp, count($tmp));
- $hidden_hashs = '';
- foreach ($tmp2 as $t) {
- $hidden_hashs .= "\n" . $tmp[$t];
- }
- //defend machine - end 1/2
复制代码
之上添加-->
- //defend machine - start 2/2
- function randomStr($length) {
- $hash = '';
- $chars = 'ABCDEFGHIJKLMNOPQRSTUVWXYZ_abcdefghijklmnopqrstuvwxyz';
- $max = strlen($chars) - 1;
- $seed = explode(' ', microtime());
- mt_srand(((float)$seed[0] + (float)$seed[1]) * 1000000);
- for($i = 0; $i < $length; $i++) {
- $hash .= $chars[mt_rand(0, $max)];
- }
- return $hash;
- }
- //defend machine - end 2/2
复制代码
templates/default/register.htm
- <form method="post" action="register.php" $enctype>
- <input type="hidden" name="formhash" value="{FORMHASH}">
复制代码
改成-->
- <script language="javascript">
- function validate(theform) {
- {$js_setvalue}
- return true;
- }
- </script>
- <form name="reg" method="post" action="register.php" $enctype onSubmit="return validate(this)">
- {$hidden_hashs}
复制代码
[ 本帖最后由 hufanyun 于 2005-8-20 00:19 编辑 ] |