搭建我的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

相關文章
相關標籤/搜索