Skip to content

Instantly share code, notes, and snippets.

@hkneptune
Created January 1, 2022 05:49
Show Gist options
  • Save hkneptune/9ce0958222dc87cc9bd38fdee17649c6 to your computer and use it in GitHub Desktop.
Save hkneptune/9ce0958222dc87cc9bd38fdee17649c6 to your computer and use it in GitHub Desktop.
Discuz 4.0.0 (20051001) Crack

Discuz! 4.0.0 (20051001) Crack

  1. Replace the include/validate.class.php file
  2. Create a discuz_license.php file in the root directory
# ANY MODIFICATION WILL INVALIDATE THIS LICENSE
Product-name = Discuz! 3 Retail
License-issued = 25-Mar-2004
Registered-to = Discuz! Board Official
Registered-URL = http://discuz.net/
<?php
// Upgrade Discuz! Board from 2.5F to 3.1.2
header("Content-Type: text/html; charset=gb2312");
set_time_limit(1000);
define('IN_DISCUZ', TRUE);
if(file_exists('./config.php')) {
require "./config.php";
} else {
require "./config.inc.php";
}
require "./include/db_mysql.php";
error_reporting(E_ERROR | E_WARNING | E_PARSE);
@set_magic_quotes_runtime(0);
$action = ($HTTP_POST_VARS[action]) ? $HTTP_POST_VARS[action] : $HTTP_GET_VARS[action];
$step = $HTTP_GET_VARS[step];
$start = $HTTP_GET_VARS[start];
$upgrade1 = <<<EOT
DROP TABLE cdb_caches;
DROP TABLE cdb_plugins;
DROP TABLE cdb_plugins_settings;
DELETE FROM cdb_settings WHERE variable = 'attachimgcheck' LIMIT 1;
DELETE FROM cdb_settings WHERE variable = 'attachsoftdownload' LIMIT 1;
DELETE FROM cdb_settings WHERE variable = 'attach_max' LIMIT 1;
DELETE FROM cdb_settings WHERE variable = 'attach_newpost' LIMIT 1;
DELETE FROM cdb_settings WHERE variable = 'attach_editpost' LIMIT 1;
DELETE FROM cdb_settings WHERE variable = 'attach_replypost' LIMIT 1;
DELETE FROM cdb_settings WHERE variable = 'statcacherefresh' LIMIT 1;
DELETE FROM cdb_settings WHERE variable = 'delayeditpost' LIMIT 1;
DELETE FROM cdb_settings WHERE variable = 'delaykarma' LIMIT 1;
DELETE FROM cdb_settings WHERE variable = 'useimagemessage' LIMIT 1;
UPDATE cdb_settings SET value = '3.1' WHERE variable = 'version' LIMIT 1 ;
INSERT INTO cdb_settings ( variable , value ) VALUES ('dotfolders', '0');
ALTER TABLE cdb_settings ORDER BY variable;
ALTER TABLE cdb_adminsessions CHANGE uid sid CHAR( 6 ) BINARY DEFAULT '' NOT NULL,DROP ip,DROP PRIMARY KEY;
ALTER TABLE cdb_admingroups CHANGE admingid admingid TINYINT( 1 ) UNSIGNED DEFAULT '0',DROP admintitle,DROP adminglobal,DROP allowhighlight,DROP allowdigest,DROP allowclose,DROP allowmove,DROP allowtop,DROP allowmerge,DROP allowsplit;
ALTER TABLE cdb_announcements DROP posturl;
ALTER TABLE cdb_karmalog DROP kid,CHANGE score score TINYINT( 3 ) UNSIGNED DEFAULT '0' NOT NULL,DROP INDEX pid,DROP INDEX dateline;
DROP TABLE IF EXISTS cdb_profilefields;
CREATE TABLE cdb_profilefields (
fieldid smallint(6) unsigned NOT NULL auto_increment,
available tinyint(1) NOT NULL default '0',
invisible tinyint(1) NOT NULL default '0',
title varchar(50) NOT NULL default '',
description varchar(255) NOT NULL default '',
size tinyint(3) unsigned NOT NULL default '0',
displayorder smallint(6) NOT NULL default '0',
required tinyint(1) NOT NULL default '0',
showinthread tinyint(1) NOT NULL default '0',
selective tinyint(1) NOT NULL default '0',
choices text NOT NULL,
PRIMARY KEY (fieldid)
) TYPE=MyISAM;
ALTER TABLE cdb_attachments DROP uid,DROP dateline,DROP INDEX tid,DROP INDEX pid,CHANGE downloads downloads SMALLINT( 6 ) DEFAULT '0' NOT NULL;
EOT;
$upgrade2 = <<<EOT
ALTER TABLE cdb_members CHANGE adminid adminid TINYINT( 1 ) DEFAULT '0' NOT NULL;
EOT;
$upgrade3 = <<<EOT
ALTER TABLE cdb_posts CHANGE aid aid MEDIUMINT( 8 ) UNSIGNED DEFAULT '0' NOT NULL,ADD INDEX dotfolder ( tid , authorid );
EOT;
if(!$action) {
echo"<title>Discuz!升级程序: 2.5F 到 3.12(共六步)</title>";
echo"本程序用于升级 Discuz! 2.5F 到 Discuz! 3.12,请确认之前已经顺利安装 Discuz! 2.5F";
echo"<b><font color=\"red\">本升级程序只能从 2.5F 升级到 3.1.2,运行之前,请确认已经上传 3.1.2 的全部文件和目录</font></b>";
echo"<b><font color=\"red\">升级前请打开浏览器 JavaScript 支持,整个过程是自动完成的,不需人工点击和干预.<b>升级之前务必备份数据库资料,否则可能产生无法恢复的后果!</b>本次升级可能需要耗时很多,并可能占用大量CPU资源,根据您的数据量有关,请在服务器空闲时进行.请确保服务器上 PHP 没有在安全模式,或没有脚本运行时间的硬性限制,否则请在本地机器升级后上传数据库。</font></b>";
echo"正确的升级方法为:1. 关闭原有论坛,上传 Discuz! 3.1.2 版的全部文件和目录,覆盖服务器上的 2.5F2. 根据安装说明,设置目录announcement、customavatars、forumdata/accesslogs属性7773. 上传本程序到 Discuz! 目录中;4. 运行本程序,直到出现升级完成的提示;";
echo"<a href=\"$PHP_SELF?action=upgrade&step=1\">如果您已确认完成上面的步骤,请点这里升级</a>";
} else {
$tables = array('attachments', 'announcements', 'banned', 'caches', 'favorites', 'forumlinks', 'forums', 'karmalog', 'members', 'memo',
'news', 'polls', 'posts', 'searchindex', 'sessions', 'settings', 'styles', 'smilies', 'stats', 'subscriptions', 'templates', 'themes',
'threads', 'pm', 'pms', 'usergroups', 'words', 'buddys', 'stylevars');
foreach($tables as $tablename) {
${"table_".$tablename} = $tablepre.$tablename;
}
unset($tablename);
$db = new dbstuff;
$db->connect($dbhost, $dbuser, $dbpw, $dbname, $pconnect);
$db->select_db($dbname);
unset($dbhost, $dbuser, $dbpw, $dbname, $pconnect);
if($step == 1) {
$query = $db->query("SELECT value FROM ".$tablepre."settings WHERE variable='version'");
if(($db->result($query, 0)) != '2.5') {
echo"<title>发生错误!</title>";
exit('您当前数据库数据版本不是2.5,无法升级<a href="javascript:history.go(-1)">返回</a>'); //debug
}
echo"<title>$step .Discuz!升级程序: 2.5F 到 3.12(共六步)</title>";
runquery($upgrade1);
echo "第 $step 步升级成功";
redirect("$PHP_SELF?action=upgrade&step=".($step + 1));
} elseif($step == 2) {
echo"<title>$step .Discuz!升级程序: 2.5F 到 3.12(共六步)</title>";
runquery($upgrade2);
echo "第 $step 步升级成功";
redirect("$PHP_SELF?action=upgrade&step=".($step + 1));
} elseif($step == 3) {
echo"<title>$step .Discuz!升级程序: 2.5F 到 3.12(共六步)</title>";
runquery($upgrade3);
echo "第 $step 步升级成功";
redirect("$PHP_SELF?action=upgrade&step=".($step + 1));
} elseif($step == 4) {
echo"<title>$step .Discuz!升级程序: 2.5F 到 3.12(共六步)</title>";
$tagArray = array(
'fly'=>'\'\', 0, \'fly\', \'<marquee width="90%" behavior="alternate" scrollamount="3">{1}</marquee>\', \'[fly]This is sample text[/fly]\', \'Make text move horizontal, the same effect as html tag <marquee>. NOTE: Only Internet Explorer supports this feature\', 1, 1',
'wmv'=>'\'\', 0, \'wmv\', \'<object classid="CLSID:22d6f312-b0f6-11d0-94ab-0080c74c7e95" class="OBJECT" id="MediaPlayer" width="500" height="350" >\r\n<param name="ShowStatusBar" value="-1">\r\n<param name="Filename" value="{1}">\r\n<embed type="application/x-oleobject" codebase="http://activex.microsoft.com/activex/controls/mplayer/en/nsmp2inf.cab#Version=5,1,52,701" flename="wmv" src="{1}" width="500" height="350">\r\n</embed></object>\', \'[wmv]mms://your.com/example.wmv[/wmv]\', \'Embed Windows media file in thread page\', 1, 1',
'rm'=>'\'\', 0, \'rm\', \'<object classid="clsid:CFCDAA03-8BE4-11CF-B84B-0020AFBBCCFA" width="500" height="300" id="Player" viewastext>\r\n<param name="_ExtentX" value="12726">\r\n<param name="_ExtentY" value="8520">\r\n<param name="AUTOSTART" value="0">\r\n<param name="SHUFFLE" value="0">\r\n<param name="PREFETCH" value="0">\r\n<param name="NOLABELS" value="0">\r\n<param name="CONTROLS" value="ImageWindow">\r\n<param name="CONSOLE" value="_master">\r\n<param name="LOOP" value="0">\r\n<param name="NUMLOOP" value="0">\r\n<param name="CENTER" value="0">\r\n<param name="MAINTAINASPECT" value="{1}">\r\n<param name="BACKGROUNDCOLOR" value="#000000">\r\n</object><object classid="clsid:CFCDAA03-8BE4-11CF-B84B-0020AFBBCCFA" width="500" height="50" id="Player" viewastext>\r\n<param name="_ExtentX" value="18256">\r\n<param name="_ExtentY" value="794">\r\n<param name="AUTOSTART" value="-1">\r\n<param name="SHUFFLE" value="0">\r\n<param name="PREFETCH" value="0">\r\n<param name="NOLABELS" value="0">\r\n<param name="CONTROLS" value="controlpanel">\r\n<param name="CONSOLE" value="_master">\r\n<param name="LOOP" value="0">\r\n<param name="NUMLOOP" value="0">\r\n<param name="CENTER" value="0">\r\n<param name="MAINTAINASPECT" value="0">\r\n<param name="BACKGROUNDCOLOR" value="#000000">\r\n<param name="SRC" value="{1}"></object>\', \'[rm]rtsp://your.com/example.rm[/rm]\', \'Embed Real Movie in thread page\', 1, 1'
);
foreach ($tagArray AS $value=>$content) {
$query = $db->query("SELECT * FROM ".$tablepre."bbcodes WHERE tag='$value'");
$exists = mysql_num_rows($query);
if ($exists == 0) {
$InsertQuery = $db->query("INSERT INTO ".$tablepre."bbcodes (id, available, tag, replacement, example, explanation, params, nest) VALUES ($content);");
}
}
echo "第 $step 步升级成功";
redirect("$PHP_SELF?action=upgrade&step=".($step + 1));
} elseif($step == 5) {
$many = 2000;
$start = intval($start);
$start = $start < 1 ? 0 : $start;
$end = $start + $many;
$continue = 0;
echo"<title>$step .Discuz!升级程序: 2.5F 到 3.12(共六步)</title>";
echo "正在进行第 $step 步(转换POSTS表):";
echo "如果您的附件很多本步可能需要时间较长";
echo "当前影响第 $start 行到 $end 行数据。";
$query = $db->query("SELECT * FROM ".$tablepre."attachments LIMIT $start,$many;");
while($a = $db->fetch_array($query)) {
$query2 = $db->query("UPDATE ".$tablepre."posts SET aid='$a[aid]' WHERE pid='$a[pid]';");
$continue = 1;
}
if ($continue) {
echo "操作继续。";
redirect("$PHP_SELF?action=upgrade&step=$step&start=$end");
} else {
echo "第 $step 步升级成功";
redirect("$PHP_SELF?action=upgrade&step=".($step + 1));
}
} elseif($step == 6) {
@unlink('./forumdata/cache/cache_settings.php');
echo"<title>$step .Discuz!升级程序: 2.5F 到 3.12(共六步)</title>";
echo "恭喜您升级成功,请删除本程序。<a href='./index.php' target=_blank>点击这里进入您的论坛</a>";
}
}
function runquery($query) {
global $db, $tablepre;
$expquery = explode(";", $query);
foreach($expquery as $sql) {
$sql = trim($sql);
if($sql != "" && $sql[0] != "#") {
$db->query(str_replace("cdb_", $tablepre, $sql));
}
}
}
function redirect($url) {
echo"<script>";
echo"function redirect() {window.location.replace('$url');}\n";
echo"setTimeout('redirect();', 2000);\n";
echo"</script>";
echo"<a href=\"$url\">如果您的浏览器没有自动跳转,请点击这里</a>";
}
?>
<?php
class licensestuff
{
var $data = '';
var $key = array ();
var $env = array ();
function readfile ()
{
if ($fp = fopen ((DISCUZ_ROOT.'./discuz_license.php'), 'r'))
{
$this->data = fread ($fp, 9999);
fclose ($fp);
}
}
function initialize ()
{
$this->readfile ();
if ($this->data)
{
foreach (explode ('
', $this->data) as $string)
{
if (strpos ($string, ' = '))
{
eval (preg_replace (((((((((((((''.'/^(').'[').'a-z0-9').'\\-').']').'+)').'\\s').'\\=').'\\s').'(.+?)').'$').'/i'), '$this->key[\'\\1\'] = \'\\2\';', trim (str_replace ('\'', '\\\'', $string))));
}
else
{
if (preg_match ('/\\<\\?\'.+\'\\?\\>/', $string))
{
$this->key['Validation-code'] = $this->decrypt (preg_replace ('/\\<\\?\'(.+)\'\\?\\>/', '\\1', $string), 'I love my father, mother, my Grace, and my self, I am working hard', '##@Crossday Studio@##');
}
}
}
$this->getenvinfo ();
return 1;
}
/* else
{
if (((strtoupper (substr (PHP_OS, 0, 3)) == 'WIN') AND in_array ($GLOBALS['_SERVER']['HTTP_HOST'], array ('localhost', '127.0.0.1'))))
{
return 2;
}
else
{
return 0;
}
}*/
}
function checkinfo ()
{
if ((substr ($this->key['Validation-code'], 16, 8) == substr (md5 (preg_replace (((((((((((((''.'/^(.+?)').'\\s').'*').'\\<').'\\?').'\\\'').'.+').'\\\'').'\\?').'\\>').'$').'/s'), '\\1', $this->data)), 0, 8)))
{
return TRUE;
}
else
{
return TRUE;
}
}
function checkdate ()
{
if ((!$this->key['License-expires'] OR (time () < strtotime ($this->key['License-expires']))))
{
return TRUE;
}
else
{
return TRUE;
}
}
function checkkey ()
{
if ((substr ($this->key['Validation-code'], 8, 8) == substr (md5 ((((((((($this->env['os'].'|').$this->env['ip']).'|').$this->env['sapi']).'|').$this->env['cpu']).'|').$this->env['name'])), 0, 8)))
{
return TRUE;
}
else
{
return TRUE;
}
}
function checkhostpath ()
{
if ((((substr ($this->key['Validation-code'], 24, 6) == ((dechex (ord ('d')).dechex (ord ('z'))).dechex (ord ('k')))) OR (substr ($this->key['Validation-code'], 0, 8) == substr (md5 ($this->env['host']), 0, 8))) OR (substr ($this->key['Validation-code'], 24, 8) == substr (md5 ($this->env['path']), 0, 8))))
{
return TRUE;
}
else
{
return TRUE;
}
}
function getenvinfo ()
{
global $_SERVER;
global $_POST;
global $_ENV;
$env['time'] = gmdate ('d-M-Y', time ());
$env['os'] = PHP_OS;
$env['ip'] = getenv ('SERVER_ADDR');
$env['sapi'] = php_sapi_name ();
$env['host'] = (getenv ('HTTP_HOST') ? getenv ('HTTP_HOST') : $_SERVER['HTTP_HOST']);
// $env['path'] = dirname (('validate.class.php.LkuQHr' ? dirname ('validate.class.php.LkuQHr') : getenv ('SCRIPT_FILENAME')));//********
$env['cpu'] = (($_ENV['PROCESSOR_IDENTIFIER'].'/').$_ENV['PROCESSOR_REVISION']);
$env['name'] = $_ENV['COMPUTERNAME'];
$this->env = $env;
}
function decrypt ($txt, $key, $owner = '')
{
$txt = $this->keyED (base64_decode ($txt), (($owner == '##@Crossday Studio@##') ? $key : ''));
$tmp = '';
for ($i = 0; ($i < strlen ($txt)); $i++)
{
$md5 = $txt[$i];
$i++;
($tmp .= ($txt[$i] ^ $md5));
}
return $tmp;
}
function keyed ($txt, $encrypt_key)
{
$encrypt_key = md5 ($encrypt_key);
$ctr = 0;
$tmp = '';
for ($i = 0; ($i < strlen ($txt)); $i++)
{
if (($ctr == strlen ($encrypt_key)))
{
$ctr = 0;
}
($tmp .= ($txt[$i] ^ $encrypt_key[$ctr]));
$ctr++;
}
return $tmp;
}
function validate ()
{
$init = $this->initialize ();
if ((($init == 2) OR ((((($init == 1) AND $this->checkinfo ()) AND $this->checkdate ()) AND $this->checkkey ()) AND $this->checkhostpath ())))
{
if (($init == 2))
{
define ('DISCUZ_LICENSE_KEY', md5 ((base64_decode ('ISgqISEpQCZfRGlzY3V6IV9pc19SdW5uaW5nX3VuZGVyX0xvY2FsaG9zdA').md5 (((('#19811027_'.'DZK_').'WROTE_Discuz!_').substr (time (), 0, (0 - 2)))))));
}
else
{
define ('DISCUZ_LICENSE_KEY', md5 ((base64_decode ('ISgqISEpQCZfRGlzY3V6IV9XSUxMX1dJTl9USEVfRlVUVVJFX0ZST01fTk9XX09O').md5 (((('#19811027_'.'DZK_').'WROTE_Discuz!_').substr (time (), 0, (0 - 2)))))));
}
}
else
{
/* echo '<html>
<head>
<title>Invalid License File</title>
</head>
<body bgcolor="#FFFFFF">
<table cellpadding="0" cellspacing="0" border="0" width="600" align="center" height="85%">
<tr align="center" valign="middle">
<td>
<table cellpadding="10" cellspacing="0" border="0" width="80%" align="center" style="font-family: Verdana, Tahoma; color: #666666; font-size: 12px">
<tr>
<td valign="m';
echo 'iddle" bgcolor="#EBEBEB">
<br><b style="font-size: 20px">Your License was Invalid</b>
<br><br>License expiring, shifting to a new server, changing server IP, hardware, OS, PHP SAPI module, or, changing both host name and absolute directory on your disk, may invalidate your license. If you have trouble in activation, please visit <a href="http://www.discuz.com/license/" target="_blank">';
echo 'http://www.discuz.com/license/</a> for more information.
<br><br>您的密匙不存在、超过有效期、更换新的服务器空间、更改 IP 地址、硬件、操作系统、PHP 安装模&';
echo '#x5F0F;,或同时改变绝对路径或访问域名,都可能导致密匙失效。请访问 <a href="http://www.discuz.com/license/" target="_blank">http://www.discuz.com/license/</a> 重新生成密匙。
<br><b';
echo 'r>
</td>
</tr>
</table>
</td>
</tr>
</table>
</body>
</html>
';
exit ();
return TRUE;*/
}
}
}
if (!defined ('IN_DISCUZ'))
{
exit ('Access Denied');
}
$license = new licensestuff ();
$license->validate ();
unset ($license);
?>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment