破解WordPress Footer Header加密主题的方法

2010年11月30日
分享到:
发表评论 阅读评论

WordPress虽然是个开源博客系统,大部分的主题、插件都是无偿使用的,但是也有不少免费的WP主题开发者遵守Creative Commons Attribute 2.0+条约,这也就意味着这些主题的footer可能使用base64加密代码,防止用户恶意删除主题创作者的链接。

下面就教你简单的破解这些Wordpress主题里的加密代码。

首先,找到这些加密代码,通常他们是这个样子的:

<?php $_F=__FILE__;$_X='Pz4JPGQ0diA0ZD0iZjIydDVyIj4NCg0KCQk8YnIgLz4NCgkJRDVzNGduIGJ5IDwxIGhyNWY9Imh0dHA6Ly93d3cuZjRyNWMxczRuMnMuYzJtIiB0NHRsNT0iQzFzNG4yIEcxbTVzIj5DMXM0bjIgRzFtNXM8LzE+IDo6IEluIEMybGwxYjJyMXQ0Mm4gdzR0aCANCjwxIGhyNWY9Imh0dHA6Ly93d3cuZzJmcjU1c2wydHMuYzJtIiB0NHRsNT0iRnI1NSBTbDJ0cyI+RnI1NSBTbDJ0czwvMT4sIDwxIGhyNWY9Imh0dHA6Ly93d3cueDJubDRuNWMxczRuMnMuYzJtIiB0NHRsNT0iT25sNG41IA0KDQpDMXM0bjJzIj5Pbmw0bjUgQzFzNG4yczwvMT4gMW5kIDwxIGhyNWY9Imh0dHA6Ly93d3cuZzJjMXM0bjJzMm5sNG41LmMybSIgdDR0bDU9IkMxczRuMnMgT25sNG41Ij5DMXM0bjJzIE9ubDRuNTwvMT4NCgkJPGJyIC8+DQoJCVYxbDRkIFhIVE1MIDFuZCBDU1MNCgk8L2Q0dj4NCjwvZDR2PjwvZDR2PjwvZDR2Pg0KPC9iMmR5Pg0KPC9odG1sPg==';eval(base64_decode('JF9YPWJhc2U2NF9kZWNvZGUoJF9YKTskX1g9c3RydHIoJF9YLCcxMjM0NTZhb3VpZScsJ2FvdWllMTIzNDU2Jyk7JF9SPWVyZWdfcmVwbGFjZSgnX19GSUxFX18nLCInIi4kX0YuIiciLCRfWCk7ZXZhbCgkX1IpOyRfUj0wOyRfWD0wOw=='));?>

然后,打开你的index.php文件,找到调用footer的php代码,通常你会看到:

< ?php get_footer(); ?>

关键一步:在这行代码前后加上代码注释,

<!–页脚开始–>

< ?php get_footer(); ?>

<!–页脚结束–>

保存index.php并上传到你的空间去。

接下来,我们在浏览器刷新一下自己的网站首页(homepage),并确保浏览器缓存已经删除,然后点击鼠标右键,点击“查看源文件V”。这个时候 你会看到你的首页footer前后出现你前面做的代码注释,注释里面的内容其实就是未加密的内容!现在任务就轻松了,把未加密的footer内容替代 footer.php里面的加密代码吧,大功告成!

注:你可以修改解密后的footer.php文件,而且不会对网站有任何影响。同样的方法也可以用在header加密的破解上。

以上的方法适用于较简单的加密,遇到复杂一点可以用下边介绍的方法:

如何真正解密被加密的Wordpress主题文件?下面就以keko为例子尝试一下真正的解密。

先看看keko主题的demo 很精致吧?!这款主题给我的映像是外观大方,设置简单,也很适合中文博客。打开footer.php看到如下代码(我用代码方式呈现可能不太直观,请拷贝到记事本方便查看)

<?php $_F=__FILE__;$_X='Pz48L2Q0dj4NCjwvZDR2Pg0KPC9kNHY+DQoNCjxkNHYgNGQ9ImYyMnQ1ci13cjFwIj4NCg0KPGQ0diA0ZD0iZjIydDVyIj4NCjxkNHYgY2wxc3M9ImM1bnQ1cjVkLTEiPg0KPGQ0diBjbDFzcz0iYzVudDVyNWQtYiI+DQoNCjxkNHYgY2wxc3M9ImYyMnQ1ci1jMm50NW50Ij4NCjxkNHYgY2wxc3M9ImZiMXIiPg0KPDNsIGNsMXNzPSJmMjJ0NXJfbDRzdCI+DQo8bDQgNGQ9Im0yc3QtYzJtbTVudDVkIj4NCjxobz48P3BocCBfNSgnTTJzdCBDMm1tNW50NWQnKTsgPz48L2hvPg0KPDNsPg0KPD9waHAgZ3Q1X20yc3RfYzJtbTVudDVkKCk7ID8+DQo8LzNsPg0KPC9sND4NCjwvM2w+DQo8L2Q0dj4NCg0KDQo8ZDR2IGNsMXNzPSJmYjFyIj4NCjwzbCBjbDFzcz0iZjIydDVyX2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IksycjUxbiBDbDJ0aDRuZyI+SzJyNTFuIENsMnRoNG5nPC8xPiZuYnNwOyZuYnNwO3wmbmJzcDsmbmJzcDs8MSBocjVmPSJodHRwOi8vd3d3LnRoNXA0Z2d5YjFuazVyLmMybS8iIHQ0dGw1PSJDRCBSMXQ1cyI+Q0QgUjF0NXM8LzE+Jm5ic3A7Jm5ic3A7fCZuYnNwOyZuYnNwOzwxIGhyNWY9Imh0dHA6Ly93d3cuYjFuazRuZ3o1bi5jMm0vIiB0NHRsNT0iQjFuayBSMXQ1cyI+QjFuayBSMXQ1czwvMT4NCjwvZDR2Pg0KPC9kNHY+DQo8L2Q0dj4NCjwvZDR2Pg0KPD9waHAgd3BfZjIydDVyKCk7ID8+DQo8L2IyZHk+DQo8L2h0bWw+';eval(base64_decode('JF9YPWJhc2U2NF9kZWNvZGUoJF9YKTskX1g9c3RydHIoJF9YLCcxMjM0NTZhb3VpZScsJ2FvdWllMTIzNDU2Jyk7JF9SPWVyZWdfcmVwbGFjZSgnX19GSUxFX18nLCInIi4kX0YuIiciLCRfWCk7ZXZhbCgkX1IpOyRfUj0wOyRfWD0wOw=='));?>

不要头晕,作者在加密的时候已经把解密的方法告诉我们了,在文件结尾出看到了base64_decode 先分析后面这段代码

base64_decode('JF9YPWJhc2U2NF9kZWNvZGUoJF9YKTskX1g9c3RydHIoJF9YLCcxMjM0NTZhb3VpZScsJ2FvdWllMTIzNDU2Jyk7JF9SPWVyZWdfcmVwbGFjZSgnX19GSUxFX18nLCInIi4kX0YuIiciLCRfWCk7ZXZhbCgkX1IpOyRfUj0wOyRfWD0wOw==')

很明显是用的base64加密了

JF9YPWJhc2U2NF9kZWNvZGUoJF9YKTskX1g9c3RydHIoJF9YLCcxMjM0NTZhb3VpZScsJ2FvdWllMTIzNDU2Jyk7JF9SPWVyZWdfcmVwbGFjZSgnX19GSUxFX18nLCInIi4kX0YuIiciLCRfWCk7ZXZhbCgkX1IpOyRfUj0wOyRfWD0wOw==

请出代码解密工具Malzilla ,可别看成了 Mozilla 咯,这可不是火狐出的。Malzilla是一款网页解密工具,集成了好多常见加密算法的解密工具,多用来分析网页木马Malzilla 下载地址 如果觉得用软件麻烦,可以直接使用在线base64解密工具 如:http://tool.chinaz.com/Tools/Base64.aspx

解密后的代码为:

$_X=base64_decode($_X);$_X=strtr($_X,'123456aouie','aouie123456');$_R=ereg_replace('__FILE__',"'".$_F."'",$_X);eval($_R);$_R=0;$_X=0;

解密后的代码就比较容易分析了。是将$_X中的字符替换$_X=strtr($_X,’123456aouie’,'aouie123456′); 1换成a,2换成o,3换成u,4换成i,5换成e ,这是一个简单的替换规则。
然后直接将$_X 用base64解密,解密后的代码为:

?></d4v>
</d4v>
</d4v>
 
<d4v 4d="f22t5r-wr1p">
 
<d4v 4d="f22t5r">
<d4v cl1ss="c5nt5r5d-1">
<d4v cl1ss="c5nt5r5d-b">
 
<d4v cl1ss="f22t5r-c2nt5nt">
<d4v cl1ss="fb1r">
<3l cl1ss="f22t5r_l4st">
<l4 4d="m2st-c2mm5nt5d">
<ho><?php _5('M2st C2mm5nt5d'); ?></ho>
<3l>
<?php gt5_m2st_c2mm5nt5d(); ?>
</3l>
</l4>
</3l>
</d4v>
 
 
<d4v cl1ss="fb1r">
<3l cl1ss="f22t5r_l4st">
<l4 4d="r1nd2m-5ntr45s">
<ho><?php _5('R1nd2m Art4cl5s'); ?></ho>
<3l>
<?php gt5_r1nd2m_p2sts(); ?>
</3l>
</l4>
</3l>
</d4v>
 
 
<d4v cl1ss="fb1r">
<3l cl1ss="f22t5r_l4st">
<l4 4d="f51t3r5d-c1t">
 
<?php $th5_c1t_sl3g = g5t_2pt42n('tn_k5k2_f22t5r_f51t3r5d'); ?>
 
<?php 4f(($th5_c1t_sl3g == '') || ($th5_c1t_sl3g == 'Ch22s5 1 c1t5g2ry:')){ ?>
 
<ho>F51t3r5d n2t s5t y5t</ho>
<3l>
<l4>S5t3p f22t5r f51t3r5s 4n <1 hr5f="<?php 5ch2 g5t_s5tt4ngs('h2m5'); ?>/wp-1dm4n/th5m5s.php?p1g5=f3nct42ns.php">th5m5 2pt42n</1></l4>
</3l>
 
<?php } 5ls5 { ?>
 
<ho>R5c5ntly 4n <?php 5ch2 str4pcsl1sh5s($th5_c1t_sl3g); ?></ho>
<3l>
<?php
//4ns5rt y23r c1t5g2ry n1m5
$my_q35ry = n5w WP_Q35ry('c1t5g2ry_n1m5='. $th5_c1t_sl3g . '&' . 'sh2wp2sts=' . 8);
wh4l5 ($my_q35ry->h1v5_p2sts()) : $my_q35ry->th5_p2st();
$d2_n2t_d3pl4c1t5 = $p2st->ID;
$th5_p2st_4ds = g5t_th5_ID();
?>
<l4>
<?php th5_t4tl5(); ?><br />
<5m><1 hr5f="<?php th5_p5rm1l4nk(); ?>">Cl4ck h5r5 t2 r51d m2r5 &r1rr;</1></5m>
</l4>
<?php 5ndwh4l5;?>
</3l>
 
<?php } ?>
 
</l4>
</3l>
 
</d4v>
</d4v>
 
 
 
 
</d4v>
</d4v>
</d4v>
</d4v>
 
 
 
<d4v 4d="f22t5r-23t">
<d4v cl1ss="c5nt5r5d-1">
<d4v cl1ss="c5nt5r5d-b">
 
<d4v cl1ss="1l4gnl5ft">
C2pyr4ght &c2py;<?php 5ch2 gmd1t5(__('Y')); ?> <1 hr5f="<?php 5ch2 g5t_s5tt4ngs('h2m5'); ?>"><?php bl2g4nf2('n1m5'); ?></1><br />
<1 t4tl5="Fr55 W2rdPr5ss Th5m5" hr5f="http://www.mk5ls.c2m">Fr55 W2rdPr5ss Th5m5</1> By Mk5ls
</d4v>
 
<d4v cl1ss="1l4gnr4ght">
C2ll1b2r1t42n w4th <1 hr5f="http://www.k2r51n-cl2th4ng.c2m/" t4tl5="K2r51n Cl2th4ng">K2r51n Cl2th4ng</1>&nbsp;&nbsp;|&nbsp;&nbsp;<1 hr5f="http://www.th5p4ggyb1nk5r.c2m/" t4tl5="CD R1t5s">CD R1t5s</1>&nbsp;&nbsp;|&nbsp;&nbsp;<1 hr5f="http://www.b1nk4ngz5n.c2m/" t4tl5="B1nk R1t5s">B1nk R1t5s</1>
</d4v>
</d4v>
</d4v>
</d4v>
<?php wp_f22t5r(); ?>
</b2dy>
</html>

将解出的代码按照上面的替换规则依次替换,最终还原了被加密的wordpress主题文件如下:

</div>
</div>
</div>
 
<div id="footer-wrap">
 
<div id="footer">
<div class="centered-a">
<div class="centered-b">
 
<div class="footer-content">
<div class="fbar">
<ul class="footer_list">
<li id="most-commented">
<ho><?php _e('Most Commented'); ?></ho>
<ul>
<?php gte_most_commented(); ?>
</ul>
</li>
</ul>
</div>
 
 
<div class="fbar">
<ul class="footer_list">
<li id="random-entries">
<ho><?php _e('Random Articles'); ?></ho>
<ul>
<?php gte_random_posts(); ?>
</ul>
</li>
</ul>
</div>
 
 
<div class="fbar">
<ul class="footer_list">
<li id="featured-cat">
 
<?php $the_cat_slug = get_option('tn_keko_footer_featured'); ?>
 
<?php if(($the_cat_slug == '') || ($the_cat_slug == 'Choose a category:')){ ?>
 
<ho>Featured not set yet</ho>
<ul>
<li>Setup footer features in <a href="<?php echo get_settings('home'); ?>/wp-admin/themes.php?page=functions.php">theme option</a></li>
</ul>
 
<?php } else { ?>
 
<ho>Recently in <?php echo stripcslashes($the_cat_slug); ?></ho>
<ul>
<?php
//insert your category name
$my_query = new WP_Query('category_name='. $the_cat_slug . '&' . 'showposts=' . 8);
while ($my_query->have_posts()) : $my_query->the_post();
$do_not_duplicate = $post->ID;
$the_post_ids = get_the_ID();
?>
<li>
<?php the_title(); ?><br />
<em><a href="<?php the_permalink(); ?>">Click here to read more &rarr;</a></em>
</li>
<?php endwhile;?>
</ul>
 
<?php } ?>
 
</li>
</ul>
 
</div>
</div>
 
 
 
 
</div>
</div>
</div>
</div>
 
 
 
<div id="footer-out">
<div class="centered-a">
<div class="centered-b">
 
<div class="alignleft">
Copyright &copy;<?php echo gmdate(__('Y')); ?> <a href="<?php echo get_settings('home'); ?>"><?php bloginfo('name'); ?></a><br />
<a title="Free WordPress Theme" href="http://www.mkels.com">Free WordPress Theme</a> By Mkels
</div>
 
<div class="alignright">
Collaboration with <a href="http://www.korean-clothing.com/" title="Korean Clothing">Korean Clothing</a>&nbsp;&nbsp;|&nbsp;&nbsp;<a href="http://www.thepiggybanker.com/" title="CD Rates">CD Rates</a>&nbsp;&nbsp;|&nbsp;&nbsp;<a href="http://www.bankingzen.com/" title="Bank Rates">Bank Rates</a>
</div>
</div>
</div>
</div>
<?php wp_footer(); ?>
</body>
</html>

有了源文件就可以按照自己的需要修改了。如果你真的尊重主题的开发者的劳动(一个漂亮的主题开发起来非常困难),那么请把作者的链接加上吧。

声明: 本文采用 BY-NC-SA 协议进行授权. 转载请注明转自: 破解WordPress Footer Header加密主题的方法

  1. Pajamas | #1
    2011年5月1日14:37

    shopperpress怎么破解?

    [回复]

    Michael 回复:

    这个要高手来解决了!

    [回复]

  2. 哈哈 | #2
    2011年3月9日10:08

    太谢谢你啦,我按照前一种方法搞定了!

    [回复]

    Michael 回复:

    其实并不复杂,很容易自己动手破解!

    [回复]

  3. 爱新奇 | #3
    2010年12月8日13:55

    现在还不想折腾这个东东
    博客内容挺多的

    [回复]

    Michael 回复:

    当然是用得着时再弄啦!

    [回复]

  1. 本文目前尚无任何 trackbacks 和 pingbacks.