溫馨提示×

您好,登錄后才能下訂單哦!

密碼登錄×
登錄注冊(cè)×
其他方式登錄
點(diǎn)擊 登錄注冊(cè) 即表示同意《億速云用戶服務(wù)條款》

PUT上傳

發(fā)布時(shí)間:2020-06-23 14:45:15 來源:網(wǎng)絡(luò) 閱讀:1498 作者:nw01f 欄目:安全技術(shù)
配置支持PUT上傳的web環(huán)境
支持put上傳需要修改以下配置
http.conf
//打開下面兩個(gè)module
LoadModule dav_module modules/mod_dav.so
LoadModule dav_fs_module modules/mod_dav_fs.so

//增加一下配置,允許Apache支持put方法
<Directory />
   Dav On
   AllowOverride None
   Options ALL
   Order allow,deny
   Allow from all
</Directory>
DavLockDB  DavLock
除此之外,想要通過put上傳文件,需要建立一個(gè)文件夾 DavLock 
文件目錄位置為  ./Apache/DavLock
為Apache安裝目錄下增加一個(gè)鎖文件
WebDAV使得應(yīng)用程序可以直接將文件寫到 Web Server 上,
并且在寫文件時(shí)候可以對(duì)文件加鎖,寫完后對(duì)文件解鎖,還可以支持對(duì)文件所做的版本控制。
基于 WebDAV可以實(shí)現(xiàn)一個(gè)功能強(qiáng)大的內(nèi)容管理系統(tǒng)或者配置管理系統(tǒng)。
PUT上傳報(bào)文模板
PUT /test.txt HTTP/1.1
Accept: */*
Accept-Language: en-US
User-Agent: Mozilla/4.0 (compatible; MSIE 6.0; Win32)
Host: 127.0.0.1

hello world
COPY報(bào)文模板
COPY /test.txt HTTP/1.1
Host: test.com
Destination:  http://test.com/test.asp
MOVE報(bào)文模板
MOVE /dir_name/test.aspx HTTP/1.1
Destination: /test.aspx
Host: test.com

//MOVE方法要求移動(dòng)的文件不在同一個(gè)文件夾內(nèi)
Success后服務(wù)器響應(yīng)狀態(tài)
PUT,COPY,MOVE等方法執(zhí)行成功后服務(wù)器響應(yīng)的返回值都會(huì)是201
測(cè)試

使用BurpSuit的Repeater模塊發(fā)包

put上傳

Request請(qǐng)求包

PUT /test.txt HTTP/1.1
Accept: */*
Accept-Language: en-US
User-Agent: Mozilla/4.0 (compatible; MSIE 6.0; Win32)
Host: 127.0.0.1
Content-Length: 35

<?php echo "<h3>hello world<h3>" ?>

Respons響應(yīng)包

HTTP/1.1 201 Created
Date: Fri, 22 Dec 2017 09:46:32 GMT
Server: Apache/2.4.23 (Win32) OpenSSL/1.0.2j PHP/5.5.38
Location: http://127.0.0.1/test.txt
Content-Length: 181
Content-Type: text/html; charset=ISO-8859-1

<!DOCTYPE HTML PUBLIC "-//IETF//DTD HTML 2.0//EN">
<html><head>
<title>201 Created</title>
</head><body>
<h2>Created</h2>
<p>Resource /test.txt has been created.</p>
</body></html>
COPY修改文件后綴

Request請(qǐng)求包

COPY /test.txt HTTP/1.1
Accept: */*
Accept-Language: en-US
User-Agent: Mozilla/4.0 (compatible; MSIE 6.0; Win32)
Host: 127.0.0.1
Destination: http://127.0.0.1/test.php
Content-Length: 2
\r\n
\r\n
#必須要有兩個(gè)回車,便于理解使用(\r\n)表明,實(shí)際直接敲兩個(gè)回車就好。

Respons響應(yīng)包

HTTP/1.1 201 Created
Date: Fri, 22 Dec 2017 09:56:11 GMT
Server: Apache/2.4.23 (Win32) OpenSSL/1.0.2j PHP/5.5.38
Location: http://127.0.0.1/test.php
Content-Length: 184
Content-Type: text/html; charset=ISO-8859-1

<!DOCTYPE HTML PUBLIC "-//IETF//DTD HTML 2.0//EN">
<html><head>
<title>201 Created</title>
</head><body>
<h2>Created</h2>
<p>Destination /test.php has been created.</p>
</body></html>
訪問test.php

Request請(qǐng)求包

GET /test.php HTTP/1.1
Host: 127.0.0.1
User-Agent: Mozilla/5.0 (Windows NT 6.1; WOW64; rv:52.0) Gecko/20100101 Firefox/52.0
Accept: text/html,application/xhtml+xml,application/xml;q=0.9,*/*;q=0.8
Accept-Language: zh-CN,zh;q=0.8,en-US;q=0.5,en;q=0.3
Accept-Encoding: gzip, deflate
Referer: http://127.0.0.1/
Connection: close
Upgrade-Insecure-Requests: 1

Respons響應(yīng)包

HTTP/1.1 200 OK
Date: Fri, 22 Dec 2017 10:07:57 GMT
Server: Apache/2.4.23 (Win32) OpenSSL/1.0.2j PHP/5.5.38
X-Powered-By: PHP/5.5.38
Content-Length: 19
Connection: close
Content-Type: text/html

<h3>hello world<h3>
訪問test.txt

Request請(qǐng)求包

GET /test.txt HTTP/1.1
Host: 127.0.0.1
User-Agent: Mozilla/5.0 (Windows NT 6.1; WOW64; rv:52.0) Gecko/20100101 Firefox/52.0
Accept: text/html,application/xhtml+xml,application/xml;q=0.9,*/*;q=0.8
Accept-Language: zh-CN,zh;q=0.8,en-US;q=0.5,en;q=0.3
Accept-Encoding: gzip, deflate
Referer: http://127.0.0.1/
Connection: close
Upgrade-Insecure-Requests: 1

Respons響應(yīng)包

HTTP/1.1 200 OK
Date: Fri, 22 Dec 2017 10:09:23 GMT
Server: Apache/2.4.23 (Win32) OpenSSL/1.0.2j PHP/5.5.38
Last-Modified: Fri, 22 Dec 2017 09:46:32 GMT
ETag: "1a-560eab110da27"
Accept-Ranges: bytes
Content-Length: 26
Connection: close
Content-Type: text/plain

echo "<h3>hello world<h3>"
向AI問一下細(xì)節(jié)

免責(zé)聲明:本站發(fā)布的內(nèi)容(圖片、視頻和文字)以原創(chuàng)、轉(zhuǎn)載和分享為主,文章觀點(diǎn)不代表本網(wǎng)站立場(chǎng),如果涉及侵權(quán)請(qǐng)聯(lián)系站長(zhǎng)郵箱:is@yisu.com進(jìn)行舉報(bào),并提供相關(guān)證據(jù),一經(jīng)查實(shí),將立刻刪除涉嫌侵權(quán)內(nèi)容。

AI