书中的实验链接(含pdf)见这里。
实验一 WireShark入门
- List 3 different protocols that appear in the protocol column in the unfiltered packet-listing window in step 7 above.
- 我看到的有TCP, DNS, ARP, AJP13.
- How long did it take from when the HTTP GET message was sent until the HTTP OK reply was received?
- GET信息发出去的时间为35.031986,接受到OK信息的时间为35.063673,两者相减为0.0031687,根据手册,单位为秒。
- What is the Internet address of the gaia.cs.umass.edu (also known as www-net.cs.umass.edu)? What is the Internet address of your computer?
- 看自家电脑地址可以通过System-preference-network,或者通过Wireshark上get信息一行中的source,为10.197.33.166(由于是内网地址所以写在这里也无所谓);gaia.cs.umass.edu地址为128.119.245.12。
- 不打印了,需要打印的就在File-Print里面选择print as displayed 以及 print selected packages即可。
实验二 HTTP
基本GET命令
- 两个包显示的均为HTTP/1.1
- en,zh-CN,zh-TW
- 我主机:10.197.22.166,gaia.cs.umass.edu的IP:128.119.245.12
- 200
- Last-Modified:Sat, 28 Oct 2017 05:59:01 GMT
- Content-Length:128
-
有趣的事情:In your answer to question 5 above, you might have been surprised to find that the document you just retrieved was last modified within a minute before you downloaded the document. That’s because (for this particular file), the gaia.cs.umass.edu server is setting the file’s last-modified time to be the current time, and is doing so once per minute. Thus, if you wait a minute between accesses, the file will appear to have been recently modified, and hence your browser will download a “new” copy of the document.
Safari 做接下来几个步骤好像有点问题,它不会向服务器发送条件get,而是直接发送get命令。然后我用了Chrome.
条件GET
- No ‘If-Modified-Since’ line.
- Yes, I can tell it because there is line-based text data.
- If-Modified-Since: Sat, 28 Oct 2017 05:59:01 GMT\r\n, the time here is exactly the time of Last-Modified in the first 220 packet from server.
- There is no contents of file, because I cannot see any html-formatted text. And the returned status key is HTTP/1.1 304 Not Modified\r\n.
长文件获取
- My browser sent one request message, it is Trace 22.
- Trace 24 contains ‘HTTP/1.1 200 OK’.
- ‘200’, ‘OK’
- 4: 24, 25, 26, 27.
内嵌对象的HTML获取
- 4 HTTP GET messages. For html file and pearson.png, the IP address is 128.119.245.12. For the ~kurose/cover_5th_ed.jpg, the IP address is 128.119.240.90, then server tells the client that the host is redirected, then the client changes the ‘Host:’ head line and re-send the GET maessage to the same server.
- In my opinion, they work serially. One reason is that the html cites the pearson.png first, and then cites the ~kurose/cover_5th_ed.jpg, which is exactly in the same order of GET message. Another reason is that the time-interval of requesting these two images doesn’t overlap with each other.
HTTP认证
这篇关于HTTP认证的文章挺有趣的,讲到了该如何攻击。(中间人攻击,重放攻击)
- 401 Unauthorized.
- Authorization: Basic d2lyZXNoYXJrLXN0dWRlbnRzOm5ldHdvcms=\r\n
使用python中的
1 | base64.b64decode('d2lyZXNoYXJrLXN0dWRlbnRzOm5ldHdvcms') |
就可以得出当前的用户名和密码,也就是说任何一台装有Wireshark的机器都可以得到用户发给服务器的密码(在使用Basic Access Authentication的方法时)。有没有觉得不太安全?
实验三 DNS
nslookup
1.Run nslookup to obtain the IP address of a Web server in Asia. What is the IP address of that server?
Take baidu tieba as example:
1 | tieba.baidu.com canonical name = post.n.shifen.com. |
2.Run nslookup to determine the authoritative DNS servers for a university in Europe.
Take the website of Oxford University as example:
1 | Non-authoritative answer: |
The IP address of authorative server is 163.1.2.189.
3.Run nslookup so that one of the DNS servers obtained in Question 2 is queried for the mail servers for Yahoo! mail. What is its IP address?
1 | Non-authoritative answer: |
ipconfig
Mac上对应的命令见这里。
Tracing DNS with Wireshark
- It uses User Diagram Protocol, which is UDP.
- Dst Port is 53, Src Port is 50989.
- It send to 152.3.27.40, which is the same local DNS server when using nslookup.
- It queries for type A, Answer RR is 0, so no answer is cotained.
- Answers:
1 | www.ietf.org: type CNAME, class IN, cname www.ietf.org.cdn.cloudflare.net |
- yeah, it’s 104.20.1.85, which is the same in answers.
- No
- Dst Port is 53, Src Port is 50989.
- It’s the same address as the local DNS server.
- DNS query is type ‘A’. It doesn’t include any answers.
- Answers
1 | www.mit.edu: type CNAME, class IN, cname www.mit.edu.edgekey.net |
- 不给看。
- It’s the same address as the local DNS server.
- DNS query is type ‘NS’. It doesn’t include any answers.
- Answers:
1 | mit.edu: type NS, class IN, ns use2.akam.net |
They didn’t include IP address.
- 不给看。
- 此题到最后的题都做不来,自己电脑的nslookup有点问题,输入nslookup host server时host会自动加上后缀(如:host.wireless.duke.edu),因此我yy一下的话申请的类型还是’A’类。DNS Server会改为命令中dns的所在IP.