2017-04-06 90 views

回答

1

要從bash中找到請求標題,你可以簡單地使用curl。如果你在windows上,你會希望新的windows bash shell或者cygwin來運行它。

還有幾十個技巧,你可以用任何你想要的格式來獲得任何想要的東西,大量的SO問題來回答你提出的任何問題。

curl --head www.google.com 


HTTP/1.1 200 OK 
Date: Thu, 06 Apr 2017 02:07:00 GMT 
Expires: -1 
Cache-Control: private, max-age=0 
Content-Type: text/html; charset=ISO-8859-1 
P3P: CP="This is not a P3P policy! See https://www.google.com/support/accounts/answer/151657?hl=en for more info." 
Server: gws 
X-XSS-Protection: 1; mode=block 
X-Frame-Options: SAMEORIGIN 
Set-Cookie: NID=100=IoNzfnVsz_oaEwIQE182ysgVSHoZYRVKjTqSQ5GqKrz1ewxwav2ae5GPo_bx0apr39Pnn4yvM5RfsmQnJ_QFmllVwS34ts-bNrvkzDFIfaokkDTo1BXHDDI69duBn1f9kx4sXJ_rcCK28og6; expires=Fri, 06-Oct-2017 02:07:00 GMT; path=/; domain=.google.com; HttpOnly 
Transfer-Encoding: chunked 
Accept-Ranges: none 
Vary: Accept-Encoding 

下面是使用curl得到響應頭的例子:

curl -D - www.google.com 


HTTP/1.1 200 OK 
Date: Thu, 06 Apr 2017 02:11:26 GMT 
Expires: -1 
Cache-Control: private, max-age=0 
Content-Type: text/html; charset=ISO-8859-1 
P3P: CP="This is not a P3P policy! See https://www.google.com/support/accounts/answer/151657?hl=en for more info." 
Server: gws 
X-XSS-Protection: 1; mode=block 
X-Frame-Options: SAMEORIGIN 
Set-Cookie: NID=100=DrUalBDiHKiZkX0yETtowdWhEfjJy7ioPU0Fe7Wch9pbbYI8MeSbg8M42dHmwu-hKZmYUlnE7VIgLhJ_Zi6byG_PYpTu5s2KYUv9XjPeH-GfSOTSq22I2GnEqXZwhJv-Bdn0aYzCUugF9FHb3Q; expires=Fri, 06-Oct-2017 02:11:26 GMT; path=/; domain=.google.com; HttpOnly 
Accept-Ranges: none 
Vary: Accept-Encoding 
Transfer-Encoding: chunked 

<!doctype html><html itemscope="" itemtype="http://schema.org/WebPage" lang="en"><head><meta content="Search the world's information, including webpages, images, videos and more. Google has many special features to help you find exactly what you're looking for." name="description"><meta content="noodp" name="robots"><meta content="text/html; charset=UTF-8" http-equiv="Content-Type"><meta content="/images/branding/googleg/1x/googleg_standard_color_128dp.png" itemprop=<cut the rest of the HTTP request> 
+0

不,我要檢測什麼像X-XSS-Protection使用bash腳本從請求中找到或沒有找到 –

+0

你能稍微詳細解釋一下你正在尋找什麼,目前尚不清楚。 –

相關問題