Internet Applications. Basic procedures involved in visiting a web site 1.Get the IP address of the...

17
Internet Applications

Transcript of Internet Applications. Basic procedures involved in visiting a web site 1.Get the IP address of the...

Page 1: Internet Applications. Basic procedures involved in visiting a web site 1.Get the IP address of the web server based on the URL that user provides URL:

Internet Applications

Page 2: Internet Applications. Basic procedures involved in visiting a web site 1.Get the IP address of the web server based on the URL that user provides URL:

Internet Applications• Basic procedures involved in visiting a web site

1. Get the IP address of the web server based on the URL that user provides• URL: uniform resource locator of a resource (e.g., machine)

– http://www.psu.edu• IP address: a numerical identification of a resource

– 146.186.157.6 (www.psu.edu)2. Send requests to the server and receive HTML

content • Protocols: HTTP (over TCP)

3. Parse the HTML content and display it

Page 3: Internet Applications. Basic procedures involved in visiting a web site 1.Get the IP address of the web server based on the URL that user provides URL:

Resolve IP Address of URL

• DNS: domain name system– A hierarchical system to resolve named addresses

into IP addresses

Root DNS Servers

com DNS servers org DNS servers edu DNS servers

psu.eduDNS servers

mit.eduDNS servers

yahoo.comDNS servers

amazon.comDNS servers

pbs.orgDNS servers

ist.psu.eduDNS servers

cse.psu.eduDNS servers

Page 4: Internet Applications. Basic procedures involved in visiting a web site 1.Get the IP address of the web server based on the URL that user provides URL:

DNS Servers

• DNS servers: distributed databases to keep information about URL and IP address pairs.

Page 5: Internet Applications. Basic procedures involved in visiting a web site 1.Get the IP address of the web server based on the URL that user provides URL:

DNS root servers

a. Verisign, Los Angeles CA (5 other sites)b. USC-ISI Marina del Rey, CAl. ICANN Los Angeles, CA (41 other sites)

e. NASA Mt View, CAf. Internet Software C.Palo Alto, CA (and 48 other sites)

i. Netnod, Stockholm (37 other sites)

k. RIPE London (17 other sites)

m. WIDE Tokyo(5 other sites)

c. Cogent, Herndon, VA (5 other sites)d. U Maryland College Park, MDh. ARL Aberdeen, MDj. Verisign, Dulles VA (69 other sites )

g. US DoD Columbus, OH (5 other sites)

13 root name “servers” worldwide

Page 6: Internet Applications. Basic procedures involved in visiting a web site 1.Get the IP address of the web server based on the URL that user provides URL:

In-Class Exercise: nslookup• nslookup: an application to query DNS

– Start "nslookup"• Start Run cmd• Type "nslookup"

– Query DNS server • Type URL or IP address

• Tasks– Find out IP address of www.psu.edu– Find out IP address(es) of www.google.com– Are psu.edu and www.psu.edu the same server?– What is the IP address of the DNS server? – Change the DNS server and repeat the queries

• "Server 130.203.1.4"

Page 7: Internet Applications. Basic procedures involved in visiting a web site 1.Get the IP address of the web server based on the URL that user provides URL:

Use IP Address Directly

• http://146.186.157.6– www.psu.edu

• No DNS request involved.

Page 8: Internet Applications. Basic procedures involved in visiting a web site 1.Get the IP address of the web server based on the URL that user provides URL:

Send Request to Server• HTTP (hypertext transfer

protocol): – The primary transfer protocol that a

browser use to interact with a web server

• Establish connection, negotiate methods/parameters of data transmission, send/obtain data, close connection

– Most URLs contain an explicit protocol reference: http://

– An application layer protocol which is above the TCP/IP protocols

• HTTP commands are encapsulated into TCP packets.

Page 9: Internet Applications. Basic procedures involved in visiting a web site 1.Get the IP address of the web server based on the URL that user provides URL:

HTTP Commands

• GET, HEAD, POST, PUT, etc.• These commands are often hidden from users.

Page 10: Internet Applications. Basic procedures involved in visiting a web site 1.Get the IP address of the web server based on the URL that user provides URL:

Example: HTTP Requests via Telnet• Start Command Prompt (Start Runcmd) and type telnet• Call the HTTP service of the server.

Open faculty.ist.psu.edu 80

• Send HTTP command to get Zihan’s personal webpageGET /zzhou/Home.html HTTP/1.1Host: faculty.ist.psu.edu

• Data received from the server– Anything available through the web service

• Even images and videos

• However, Telnet cannot parse non-text data.GET /zzhou/Home_files/psu_blue.png HTTP/1.1Host: faculty.ist.psu.edu

Page 11: Internet Applications. Basic procedures involved in visiting a web site 1.Get the IP address of the web server based on the URL that user provides URL:

Telnet• A network application with command-line interface

– Data is transparent.• Password is transferred as text.

– Very unsafe.• Telnet was the dominant tool to access Unix

servers to get email.– Unix-based email clients.

• SSH replaces telnet.– Data is encrypted.

Page 12: Internet Applications. Basic procedures involved in visiting a web site 1.Get the IP address of the web server based on the URL that user provides URL:

A

TCP A

IP

MAC

ATCP

IP ATCP

A

TCP !_*#!#$!#

IP

MAC

!_*#!#$!#TCP

IP !_*#!#$!#TCP

Client: Telnet Client: SSH

Intended Server

MAC IP ATCPMAC IP ATCP

Unintended Server

Data is encrypted

Page 13: Internet Applications. Basic procedures involved in visiting a web site 1.Get the IP address of the web server based on the URL that user provides URL:

SMTP Protocol: Email

• SMTP (Simple Mail Transfer Protocol) commands– HELO, MAIL, RCPT, DATA, QUIT, VRFY…

• Example– Telnet mail.psu.edu 25

• HELO zuz22.psu.edu• VRFY zuz22

Page 14: Internet Applications. Basic procedures involved in visiting a web site 1.Get the IP address of the web server based on the URL that user provides URL:

Example: Sending Email via Gmail using Command Line

1. Type openssl s_client -connect smtp.gmail.com:4652. Type helo smtp.gmail.com3. Type auth login and you will receive “334 VXNlcm5hbWU6”, which means

“Username:”4. Using a Base 64 encoder such as this one, encode your user name and

enter it. Do the same for your password, which is requested next. If authenticated, you should see: “235 2.7.0 Accepted”

5. Type mail from: <[email protected]>6. Type rcpt to: <[email protected]>7. Type data, then enter your message8. To finish entering the message, press ENTER, then press ., then press ENTER

again9. Type quitNote: If you want to send email via PSU mail server, in step 1 type the following instead:openssl s_client -connect authsmtp.psu.edu:587 -starttls smtp

Page 15: Internet Applications. Basic procedures involved in visiting a web site 1.Get the IP address of the web server based on the URL that user provides URL:

Other Protocols

• FTP (File Transfer Protocol) – Was a dominant tool for file transfer.

• Suffers the same security issues as Telnet.

– Replaced with SFTP (Secured FTP).• Email Access Protocol

– POP3• Download email messages to a local client.

– IMAP• Keep email in email server.

Page 16: Internet Applications. Basic procedures involved in visiting a web site 1.Get the IP address of the web server based on the URL that user provides URL:

After Class Exercise • Just for exploration. No need to turn in anything.

• DNS– Use nslookup to resolve several different URLs.– Check the DNS server names in different places.

• IST, your dorm, coffee shop, etc.– Figure out which organizations these servers.– Think about what may happen if a DNS is hijacked.

• HTTP requests via Telnet– You need to find a system that allows “telnet”.– Use it to access a couple of web sites and see what may happen.

• Sending emails via Openssl– Find out how to use openssl to send emails through your favorite email

service provider (hotmail, yahoo, gmail, aol, etc.)

Page 17: Internet Applications. Basic procedures involved in visiting a web site 1.Get the IP address of the web server based on the URL that user provides URL:

• Friday: group research assignment 1

• Next Monday: Chapters 5 and 6– Involving some math.

• Start earlier.