information gathering
就是信息蒐集。在做滲透測試的過程中,蒐集信息一定是第一步。
IG就是信息蒐集。
IG-001測試Spiders, Robots, and Crawlers
這一節主要描述如何測試robot.txt文件。
每個網站都有一個robot.txt,在這個文件中聲明該網站中不想被robot訪問的部分,這樣,該網站的部分或全部內容就可以不被搜索引擎收錄了,或者指定搜索引擎只收錄指定的內容。
示例: http://www.google.com/robots.txt
“robots.txt”文件包含一條或更多的記錄,
User-agent:
該項的值用於描述搜索引擎robot的名字,在“robots.txt”文件中,如果有多條 User-agent記錄說明有多個robot會受到該協議的限制,對該文件來說,至少要有一條User- agent記錄。如果該項的值設爲*,則該協議對任何機器人均有效,在“robots.txt”文件 中,“User-agent:*”這樣的記錄只能有一條。
Disallow:
該項的值用於描述不希望被訪問到的一個URL,這個URL可以是 一條完整的路徑,也可以 是 部分的,任何以Disallow開頭的URL均不會被robot訪問到。例如:
“Disallow: /help”對/help.html 和/help/index.html都不允許搜索引擎訪問, 而“Disallow: /help/”則允許robot訪問/help.html,而不能訪問/help/index.html。
任何一條Disallow記錄爲空,說明該網站的所有部分都允許被訪問,在 “/robots.txt”文件中,至少要有一條Disallow記錄。如果“/robots.txt”是 一個空文 件,則對於所有的搜索引擎robot,該網站都是 開放的。
但是,網絡爬蟲/機器人/抓取工具可以故意忽略robots.txt文件中規定的不允許訪問的URL。
怎麼用呢?
先介紹google的一個工具。
google提供了一個工具,能夠分析robot.txt文件,步驟如下:
1. Sign into Google Webmaster Tools with your Google Account.
創建你的google賬戶
2. On the Dashboard, click the URL for the site you want.
然後輸入你想測試的URL
這裏會返回一個提示:
3. Click Tools, and then click Analyze robots.txt.
點tools按鈕,就可以開始分析robots.txt
一些鏈接
Whitepapers
- [1] "The Web Robots Pages" - http://www.robotstxt.org/
- [2] "How do I block or allow Googlebot?" - http://www.google.com/support/webmasters/bin/answer.py?answer=40364&query=googlebot&topic=&type=
- [3] "(ISC)2 Blog: The Attack of the Spiders from the Clouds" - http://blog.isc2.org/isc2_blog/2008/07/the-attack-of-t.html
- [4] "How do I check that my robots.txt file is working as expected?" - http://www.google.com/support/webmasters/bin/answer.py?answer=35237