搭建过程:
本例以http://127.0.0.1/ xssplatform作为例子讲解搭建过程。
一、数据库修改
新建以数据库如xsser,编码为utf8。将xssplatform.sql文件导入数据库。
执行以下命令修改数据库:
UPDATE oc_module SET code=REPLACE(code,'http://xsser.me','http://127.0.0.1/xssplatform')
即将数据库中的url信息改为自己网站的url路径。
二、源码修改
将源码解压到wamp目录中,若解压到根目录则最后访问url为:http://127.0.0.1 ,若解压到xssplatform则访问url为:http://127.0.0.1/platform
1、打开config.php文件,根据实际情况修改数据库连接信息。然后将$config[‘urlroot’]修改为访问的起始url,即http://127.0.0.1/xssplatform
2、修改themes\default\templates\register.html中的提交按钮的源码为
行53 <input id="btnRegister" type="button" onclick="Register()" value="提交注册" /> 修改为 <input id="btnRegister" type="submit" value="提交注册" />
3、邀请码的生成
(1)将文件source\user.php第10行和50行的权限控制注释掉
//if($user->userId<=0) ShowError('未登录或已超时',$url['login'],'重新登录'); //if($user->adminLevel<=0) ShowError('没有操作权限',URL_ROOT.'/index.php?do=user&act=invite');
然后访问/index.php?do=user&act=invite即可生成邀请码
(2)注册个用户admin,进入数据库,将该用户的adminLevel修改为1,然后去掉(1)中添加到注释;并在第15行case ‘invite’:处添加权限控制:
if($user->adminLevel<=0) ShowError('没有操作权限',URL_ROOT.'/index.php');
(3)或者开放普通注册权限,修改文件/config.php的第18行
$config['register']='invite'; //normal,正常;invite,只允许邀请注册;close,关闭注册功能
4、修改删除cookie代码
修改文件themes\default\templates\project_view.html中的Delete()和MultiDelete()函数,将其中post的URL修改为
‘/xssplatform/index.php?do=project&act=delcontent&r=’,即根据实际的服务器路径,在前面添加’/xssplatform’或其他路径。如果直接是在网站根目录下搭建的,那么此处就不用修改了。
5、参考“xsser.me2个小bug” (http://zone.wooyun.org/content/4355)修改文件source\class\user.class.php
bug:登录的时候会把所有用户的登录时间更新为一个时间 ,原因是没有加where。。
行 74 $this->db->Execute("UPDATE ".$this->tbUser." SET loginTime='".time()."'"); 修改为 $this->db->Execute("UPDATE ".$this->tbUser." SET loginTime='".time()."' where id={$row['id']}");
三、启用Apache Mod_Rewrite实现URL重写
配置步骤:
1、找到apache的配置文件httpd.conf。wamp安装的话,是在wamp\bin\apache\Apache2.2.21\conf目录中。
2、让服务器支持mod_rewrite,如果你使用的是虚拟主机,请事先询问你的主机提供商。
(1)在httpd.conf配置文件中找到
#LoadModule rewrite_module modules/mod_rewrite.so
将#去掉。
(2)找到AllowOverride None 改成 AllowOverride All。
ps:AllowOverride 的参数设置为All,表示整台服务器上都支持URL规则重写。Apache 服务器要读每个网站下目录下的 .htaccess 文件。如果没有这个文件,或者这个文档没有定义任何关于URL重写的规则就不会有任何效果。
3、在xss代码目录下建文件.htaccess,并填写url重写规则。(注意:文件名.htaccess在Windiws下不能直接建立,可以用记事本新建一个文件然后另存为.htaccess)。
规则参考http://zone.wooyun.org/content/3897
在htaccess文件中写:
RewriteEngine On RewriteRule ^([0-9a-zA-Z]{6})$ /xssplatform/index.php?do=code&urlKey=$1 [L] RewriteRule ^do/auth/(\w+?)(/domain/([\w\.]+?))?$ /xssplatform
/index.php?do=do&auth=$1&domain=$3 [L] RewriteRule ^register/(.*?)$ /xssplatform
/index.php?do=register&key=$1 [L] RewriteRule ^register-validate/(.*?)$ /xssplatform
/index.php?do=register&act=validate&key=$1 [L]
ps:在上面的四条规则中都有xssplatform
,xssplatform
是xss代码所在的目录可以根据实际情况修改。如果是在网站根目录下搭建,则上面四个重写规则直接去掉xssplatform
。
4、重启wamp服务器。
参考文章:
1、xss平台搭建(使用xsser.me源码) http://blog.csdn.net/gzliu_hit/article/details/9159357
2、xsser.me2个小bug http://zone.wooyun.org/content/4355
3、Xsser.me 平台化部署文档 http://zone.wooyun.org/content/3897
4、Apache Mod_Rewrite实现URL重写的配置方法 http://www.leapsoul.cn/?p=25
5、[xsser.me]分享一下自己新浪短网址生成代码不需要申请接口[非插件] http://zone.wooyun.org/content/4325
ps:最后一篇参考文献还没有研究,抽空看一下
转载请注明:jinglingshu的博客 » xsser.me搭建