搭建我的xss平台

想记录一下是由于这个原版的安装配置是 nginx 搭建在 linux 服务器上,而我更习惯用 apache 搭建在物理机上。因此先在网上浏览了一下其余 xss 平台的搭建过程,本身总结、摸索以后成功搭建:)php

环境是 win10,phpstudy,xss平台搭在物理机上,经过内网穿透从外网访问。xss平台源码 https://github.com/78778443/xssplatformhtml

1.先下载花生壳,拥有本身的免费域名,内网映射的时候须要6块钱(100年有效),整一个!不差钱。(以前作内网映射都是用 sunny-ngrok 的工具,免费的也很好用,可是花生壳的管理界面挺好看的)linux

 

2.WWW 文件夹下新建 xssplatform 文件夹,把源码都放进去nginx

 

3.修改 config.php,比较重要的是数据库的用户名密码,和 urlroot,第三处还不清楚在哪里用到git

 

3.根据 config.php 配置文件新建数据库,导入源码中的 xssplatform.sql,更新数据库内容为本身的域名github

update oc_module set code=REPLACE(code,"http://xsser.me","http://3b打码打码.vip/xssplatform/");

 

4.修改 authtest.php 文件内 header 语句为本身的域名sql

header("Location: http://3b打码打码.vip/xssplatform/index.php?do=api&id={$_GET['id']}&username={$_SERVER[PHP_AUTH_USER]}&password={$_SERVER[PHP_AUTH_PW]}");

 

5.网站根目录下新建 .htaccess 文件,这里注意在 index.php 前添加 xssplatform(文件夹名)是和网上普通的 apache 配置 .htaccess 不一样的数据库

<IfModule mod_rewrite.c>
RewriteEngine On
RewriteBase /
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]
</IfModule>

 

6.而后修改 httpd.conf 配置文件apache

AllowOverride None 所有改成 AllowOverride Allapi

取消 LoadModule rewrite_module modules/mod_rewrite.so 前面的注释符,重启 phpstudy

 

7.这个时候访问 xss 平台有报错,我查了一下资料,是 file_get_contents 函数致使的,修改了 allow_url_fopen = On 和 user_agent="PHP" 都没能解决,看到一些博客说如今流行使用 curl,再根据报错看下原版代码,意思是存在 file_get_contents 函数就使用 file_get_contents,不然使用 curl,干脆就把代码改了,直接使用 curl,成功解决问题

/*网页访问容错代码*/
/*原版报错代码
function vita_get_url_content($url)
{
    if (function_exists('file_get_contents')) {
        $file_contents = file_get_contents($url);
    } else {
        $ch = curl_init();
        $timeout = 5;
        curl_setopt($ch, CURLOPT_URL, $url);
        curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);
        curl_setopt($ch, CURLOPT_CONNECTTIMEOUT, $timeout);
        $file_contents = curl_exec($ch);
        curl_close($ch);
    }
    return $file_contents;
}
*/
function vita_get_url_content($url)
{
    $ch = curl_init();
    $timeout = 5;
    curl_setopt($ch, CURLOPT_URL, $url);
    curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);
    curl_setopt($ch, CURLOPT_CONNECTTIMEOUT, $timeout);
    $file_contents = curl_exec($ch);
    curl_close($ch);
    return $file_contents;
}

 

8.本身搭建 xss 漏洞代码测试一下,平台能够正常使用

 

 

参考:

https://www.jianshu.com/p/6cc3bb1d3716

https://bbs.ichunqiu.com/thread-13187-1-1.html

https://www.jb51.net/article/27300.htm

相关文章
相关标签/搜索