搭建個人xss平台


想記錄一下是因為這個原版的安裝配置是 nginx 搭建在 linux 服務器上,而我更習慣用 apache 搭建在物理機上。所以先在網上瀏覽了一下其他 xss 平台的搭建過程,自己總結、摸索之后成功搭建:)

環境是 win10,phpstudy,xss平台搭在物理機上,通過內網穿透從外網訪問。xss平台源碼 https://github.com/78778443/xssplatform

1.先下載花生殼,擁有自己的免費域名,內網映射的時候需要6塊錢(100年有效),整一個!不差錢。(之前做內網映射都是用 sunny-ngrok 的工具,免費的也很好用,但是花生殼的管理界面挺好看的)

 

2.WWW 文件夾下新建 xssplatform 文件夾,把源碼都放進去

 

3.修改 config.php,比較重要的是數據庫的用戶名密碼,和 urlroot,第三處還不清楚在哪里用到

 

3.根據 config.php 配置文件新建數據庫,導入源碼中的 xssplatform.sql,更新數據庫內容為自己的域名

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

 

4.修改 authtest.php 文件內 header 語句為自己的域名

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 配置文件

AllowOverride None 全部改為 AllowOverride All

取消 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

 


免責聲明!

本站轉載的文章為個人學習借鑒使用,本站對版權不負任何法律責任。如果侵犯了您的隱私權益,請聯系本站郵箱yoyou2525@163.com刪除。



 
粵ICP備18138465號   © 2018-2025 CODEPRJ.COM