CS2911 Week 6, Class 1 Today Map (dict) objects in Python

Slides:



Advertisements
Similar presentations
CPSC 441: FTP & SMTP1 Application Layer: FTP & Instructor: Carey Williamson Office: ICT Class.
Advertisements

Electronic Mail and SMTP
Simple Mail Transfer Protocol (SMTP) CS-328 Dick Steflik.
Chapter 30 Electronic Mail Representation & Transfer
Esimerkki: Sähköposti. Lappeenranta University of Technology / JP, PH, AH Electronic Mail Three major components: user agents mail servers simple mail.
Simple Mail Transfer Protocol
Introduction 1 Lecture 7 Application Layer (FTP, ) slides are modified from J. Kurose & K. Ross University of Nevada – Reno Computer Science & Engineering.
SIMPLE MAIL TRANSFER PROTOCOL SECURITY Guided By Prof : Richard Sinn Bhavesh Jadav Mayur Mulani.
Introduction 1-1 Chapter 2 FTP & Computer Networking: A Top Down Approach 6 th edition Jim Kurose, Keith Ross Addison-Wesley March 2012 IC322 Fall.
2: Application Layer1 Chapter 2 Application Layer These slides derived from Computer Networking: A Top Down Approach, 6 th edition. Jim Kurose, Keith Ross.
SMTP, POP3, IMAP.
1 Application Layer Lecture 5 Imran Ahmed University of Management & Technology.
Mail Services.
CSE401N: Computer Networks Lecture-5 Electronic Mail S. M. Hasibul Haque Lecturer Dept. of CSE, BUET.
IT 424 Networks2 IT 424 Networks2 Ack.: Slides are adapted from the slides of the book: “Computer Networking” – J. Kurose, K. Ross Chapter 2: Application.
Intro to Computer Networks Bob Bradley The University of Tennessee at Martin.
Review: –How do we address “a network end-point”? –What services are provided by the Internet? –What is the network logical topology observed by a network.
Application Layer Protocols Simple Mail Transfer Protocol.
Computer Networking From LANs to WANs: Hardware, Software, and Security Chapter 12 Electronic Mail.
Sending and Receiving Mails
Simple Mail Transfer Protocol (SMTP)
File Transfer Protocol (FTP)
1 SMTP - Simple Mail Transfer Protocol –RFC 821 POP - Post Office Protocol –RFC 1939 Also: –RFC 822 Standard for the Format of ARPA Internet Text.
CS2910 Week 1, Class 2 Today Announce Prof. Michael Vieau’s S-341 6p Thurs Wk 2 Assignment for tomorrow Data Encoding, Part 1 Parsing Data Muddiest Point.
CS2910 Week 1, Class 1 Today Introductions Class/Lab Layout Safety Review - Note about Lab Safety Review Announce Prof. Michael Vieau’s S-341 6p Thurs.
CS 3830 Day 9 Introduction 1-1. Announcements r Quiz #2 this Friday r Demo prog1 and prog2 together starting this Wednesday 2: Application Layer 2.
CS2910 Week 2, Class 1 Today Data Encoding, Part 1 Parsing Data Python Muddiest Point Lab 2 – Bring text In Class, Thursday: Quiz Week 6, Monday: Midterm.
CS2910 Week 5, Class 2 Today DNS Muddy Points More HTTP Headers Review for Midterm Exam This coming Monday: Midterm Exam SE-2811 Slide design: Dr. Mark.
CS2910 Week 2, Class 1 Today Return Lab 1 Muddiest Points Quiz Parsing Data in Python SE-2811 Slide design: Dr. Mark L. Hornick Content: Dr. Hornick Errors:
SMTP - Simple Mail Transfer Protocol RFC 821
CS2910 Week 7, Lab Today SMTP lab Tuesday (Either today or yesterday) Extra office hour at 11 am (right after lab) Friday Office hour cancelled SE-2811.
CS440 Computer Networks 1 Neil Tang 12/01/2008.
Slides based on Carey Williamson’s: FTP & SMTP1 File Transfer Protocol (FTP) r FTP client contacts FTP server at port 21, specifying TCP as transport protocol.
Application Layer 2-1 Chapter 2 Application Layer Computer Networking: A Top Down Approach 6 th edition Jim Kurose, Keith Ross Addison-Wesley March 2012.
CS2910 Week 4, Class 1 Today Encoding in Python – Review Quiz – Encoding in Python Introduction to HTTP SE-2811 Slide design: Dr. Mark L. Hornick Content:
COMP 431 Internet Services & Protocols
CS2910 Week 7, Class 2 Today Quiz on encodings IMAP Encoding "Internet Messages" Tomorrow Office hour cancelled Monday Quiz on IMAP SE-2811 Slide design:
CS2910 Week 4, Class 2 Today Sit by someone you have not yet worked with this quarter. Learn his/her name if unknown. Turn on your laptop and start Wireshark.
CS2910 Week 7, Class 1 Today Capturing SMTP with Thunderbird Tomorrow Extra office hour at 11 am (right after lab) Friday Office hour cancelled SE-2811.
26.1 Electronic Mail Sending/Receiving Mail Addresses User Agent MIME Mail Transfer Agent Mail Access Protocols.
CS2910 Week 6, Lab Today Dictionaries in Python SE-2811 Slide design: Dr. Mark L. Hornick Content: Dr. Hornick Errors: Dr. Yoder 1.
@Yuan Xue A special acknowledge goes to J.F Kurose and K.W. Ross Some of the slides used in this lecture are adapted from their.
Spring 2006 CPE : Application Layer_ 1 Special Topics in Computer Engineering Application layer: Some of these Slides are Based on Slides.
درس مهندسی اینترنت – مهدی عمادی مهندسی اینترنت برنامه‌نویسی در اینترنت 1 SMTP, FTP.
CS2911 Week 6, Lab Today Quiz 3 Review Muddiest Point Finish Lab 6 Start Lab 7 Muddiest Point This week, Lab: Quiz at start of lab Week 7, Monday: Half-Exam.
CS2911 Week 6, Class 2 Today Return Quiz 3 Review Muddiest Point Internet Message ( ) format SMTP IMAP Muddiest Point Week 7, Monday: Half-Exam 2 1.
CS2911 Week 3, Class 2 Today Return Lab 3 Afternoon section: Hand out Lab 4 Checklist Review Muddiest Point Questions on Lab 4? What is a protocol? The.
SMTP - Simple Mail Transfer Protocol POP - Post Office Protocol
SMTP: simple mail transfer protocol
Networking CS 3470, Section 1 Sarah Diesburg
Slide design: Dr. Mark L. Hornick
CS2911 Week 6, Class 1 Today Map (dict) objects in Python
draft-lemonade-imap-submit-01.txt “Forward without Download”
CS2911 Week 6, Class 1 Today This week, Lab: Quiz at start of lab
Slide design: Dr. Mark L. Hornick
CS2911 Week 6, Class 1 Today Map (dict) objects in Python
Slide design: Dr. Mark L. Hornick
Chapter 2: Application layer
The Application Layer: SMTP, FTP
CS2911 Week 5, Class 3 Today Week 6, Lab: Quiz at start of lab
Slide design: Dr. Mark L. Hornick
Slide design: Dr. Mark L. Hornick
CS2911 Week 2, Class 3 Today Return Lab 2 and Quiz 1
CS2911 Week 3, Class 3 (And wk4-c1)
Chapter 7 Network Applications
CS2911 Week 3, Lab Today Thursday Friday Review Muddiest Point Lab 3
Slide design: Dr. Mark L. Hornick
Chapter 2 Application Layer
Slide design: Dr. Mark L. Hornick
CS2911 Week 8, Class 1 Today Week 8, Lab period Muddiest Point
Presentation transcript:

CS2911 Week 6, Class 1 Today Map (dict) objects in Python 27 April 2019 CS2911 Week 6, Class 1 Today Map (dict) objects in Python Email Protocols 17q1 6-1 1,3,5,6,7,11-16 18q1 6-1 1-4,6-11,13-14 CS2911 Dr. Yoder Dr. Josiah Yoder

Introduction to Python CS2910 4/27/2019 Introduction to Python Python Java ages = dict() OR ages = {} ages["Nancy"] = 5 ages["Bob"] = 10 print "B:",ages["Bob"] for k,v in ages.items(): print k+": "+str(v) Map<String,Integer> ages = new HashMap<>(); ages.put("Nancy", 5); ages.put("Bob", 10); S.o.pl("B: "+ages.get("Bob")); for(Map.Entry<String,Integer> e: ages.entrySet()) { S.o.pl(e.getKey()+": " +e.getValue()); } SE-2811 Dr. Yoder Dr. Josiah Yoder

Dictionaries A Python Dictionary is like a Map in Java You can use an object as an "index" for an item. The index object is called a "key" and the object stored is called a "value" You can use any object – they don't have to be integers, and they aren't stored sequentially in memory You can iterate through all the entries in a dictionary, or look up an item by its key SE-2811 Dr. Yoder

Some important methods items() returns a list of all keys and values, where each item is a tuple holding (key, value) keys() returns a list of all keys values() returns a list of all values has_key(k) returns true if the value is stored in the list SE-2811 Dr.Yoder

Email [Sending email example] CS2911 27 April 2019 Example of sending email Overview of protocols Lab 8 (SMTP) topic – SMTP CS2911 Dr. Yoder Dr. Josiah Yoder

Unencrypted SMTP without Authentication CS2910 4/27/2019 Unencrypted SMTP without Authentication S: 220 aol.com Simple Mail Transfer Service Ready C: EHLO msoe.edu S: 250-aol.com greets msoe.edu S: 250-8BITMIME S: 250-SIZE S: 250-DSN S: 250 HELP C: MAIL FROM: <smith@msoe.edu> S: 250 OK S:<space> and C:<space> not actually sent SE-2811 Dr.Yoder Dr. Josiah Yoder

Unencrypted SMTP without Authentication (cont.) CS2910 4/27/2019 Unencrypted SMTP without Authentication (cont.) C: RCPT TO: <jones@aol.com> S: 250 OK C: RCPT TO: <frank@aol.com> S: 550 No such user here C: DATA S: 354 Start email input; end with <CRLF>.<CRLF> C: Here's my message C: It's a long one C: Now I'm done. But does the server know it? C: . C: QUIT S: 221 aol.com Service closing transmission channel SE-2811 Dr.Yoder Dr. Josiah Yoder

Looking Forward Cryptography Videos: (From Week 7) CS2910 4/27/2019 Looking Forward Cryptography Videos: (From Week 7) Cryptography in network protocols Public key cryptography Modular arithmetic RSA encryption Encryption: Plaintext -> Ciphertext Decryption: Ciphertext -> Plaintext Both require a "key" SE-2811 Dr.Yoder Dr. Josiah Yoder

SMTP with STARTTLS and AUTH LOGIN (1) CS2910 4/27/2019 SMTP with STARTTLS and AUTH LOGIN (1) S: 220 aol.com ESMTP MAIL Service ready … C: EHLO msoe.edu S: 250-aol.com Hello [10.10.10.10] S: 250-PIPELINING S: 250-DSN S: 250-ENHANCEDSTATUSCODES S: 250-STARTTLS S: 250-8BITMIME S: 250 CHUNKING SE-2811 Dr.Yoder Dr. Josiah Yoder

SMTP with STARTTLS and AUTH LOGIN (2) CS2910 4/27/2019 SMTP with STARTTLS and AUTH LOGIN (2) (continued from previous slide) C: STARTTLS S: 220 2.0.0 SMTP server ready ---- Everything beyond this point is sent encrypted ---- C: EHLO msoe.edu S: 250-aol.com Hello [10.10.10.10] S: 250-PIPELINING S: 250-DSN S: 250-ENHANCEDSTATUSCODES S: 250-AUTH LOGIN S: 250-8BITMIME S: 250 CHUNKING (continued from previous slide) added during demo time 18q1 SE-2811 Dr.Yoder Dr. Josiah Yoder

SMTP with STARTTLS with AUTH LOGIN (3) CS2910 4/27/2019 SMTP with STARTTLS with AUTH LOGIN (3) "Username:" (continued from previous slide) C: AUTH LOGIN S: 334 VXN1cm5hbWU6 C: c3R1ZGVudEBtc291LmVkdQ== S: 334 UGFzc3dvcmQ6 C: bW9ua2V5 S: 235 2.7.0 Authentication successful C: MAIL FROM: <student@msoe.edu> … (The rest is the same as unencrypted) "student@msoe.edu" "Password:" "monkey" (continued from previous slide) added during demo time 18q1 SE-2811 Dr.Yoder Dr. Josiah Yoder

CS2910 4/27/2019 Base64 encoding https://tools.ietf.org/html/rfc4648#section-4 Use the base64 package, already imported in the lab template. Use RFC 4648 base-64 encoding, as specified in the latest AUTH LOGIN RFC, RFC 4954. This is the same as the base-64 encoding defined in RFC 3548, the earlier version of RFC 4648. SE-2811 Dr.Yoder Dr. Josiah Yoder

Sending/Receiving Encrypted Data in Python CS2910 4/27/2019 Sending/Receiving Encrypted Data in Python context = ssl.create_default_context() wrapped_socket = context.wrap_socket(old_socket, server_hostname=SMTP_SERVER) SE-2811 Dr.Yoder Dr. Josiah Yoder

Sending/Receiving Encrypted Data in Python CS2910 4/27/2019 Sending/Receiving Encrypted Data in Python Some errors if you accidentally receive/send raw/encrypted text when you should send the other: ssl.SSLZeroReturnError: TLS/SSL connection has been closed (EOF) (_ssl.c:590) ssl.SSLError: [SSL: UNKNOWN_PROTOCOL] unknown protocol (_ssl.c:590) ssl.SSLError: [SSL: WRONG_VERSION_NUMBER] wrong version number (_ssl.c:590) SE-2811 Dr.Yoder Dr. Josiah Yoder

Sending/Receiving Encrypted Data in Python CS2910 4/27/2019 Sending/Receiving Encrypted Data in Python Some errors if you use the wrong protocol (which is hard to do with our sample code) ssl.SSLZeroReturnError: TLS/SSL connection has been closed (EOF) (_ssl.c:590) ssl.SSLEOFError: EOF occurred in violation of protocol (_ssl.c:590) SE-2811 Dr.Yoder Dr. Josiah Yoder

Outcomes Describe the operation of the IMAP protocol at a high level CS2911 27 April 2019 Outcomes Describe the operation of the IMAP protocol at a high level Describe the basic format of Internet Messages (email) Describe how character sets are encoded in in internet messages Program an email interface in Python Dr. Josiah Yoder

IMAP Hierarchy of folders Selective listing, fetching, and searching CS2910 4/27/2019 IMAP Hierarchy of folders Selective listing, fetching, and searching Even selective download of part of a message Uploading, copying, and deleting messages Simultaneous access by multiple clients But not … Dr. Josiah Yoder

IMAP Client may make Server may multiple requests CS2910 4/27/2019 IMAP Client may make multiple requests additional requests while waiting for a response Server may reply in a different order than client requested interleave two responses send unsolicited data Dr. Josiah Yoder

IMAP message format C: A341 CLOSE S: A341 OK CLOSE completed CS2910 4/27/2019 IMAP message format C: A341 CLOSE S: A341 OK CLOSE completed SE-2811 Dr.Yoder Dr. Josiah Yoder

CS2910 4/27/2019 IMAP message format C: A202 EXPUNGE S: * 3 EXPUNGE S: * 5 EXPUNGE S: * 8 EXPUNGE S: A202 OK EXPUNGE completed SE-2811 Dr.Yoder Dr. Josiah Yoder

CS2910 4/27/2019 IMAP message format C: A003 APPEND saved-messages (\Seen) {310} S: + Ready for literal data C: Date: Mon, 7 Feb 1994 21:52:25 -0800 (PST) C: From: Fred Foobar <foobar@Blurdybloop.COM> C: Subject: afternoon meeting C: To: mooch@owatagu.siam.edu C: Message-Id: <B27397-0100000@Blurdybloop.COM> C: MIME-Version: 1.0 C: Content-Type: TEXT/PLAIN; CHARSET=US-ASCII C: C: Hello Joe, do you think we can meet at 3:30 tomorrow? S: A003 OK APPEND completed Dr. Josiah Yoder

SMTP Security SMTP STARTTLS SMTP over SSL/TLS RFC 3207 CS2910 4/27/2019 SMTP Security SMTP STARTTLS SMTP over SSL/TLS RFC 3207 (no standard needed) Port 587 465 Security Plain-text IMAP port with ability to switch to TLS Dedicated port for SMTP wrapped in TLS 17q1 corrected after class More info: https://www.fastmail.com/help/technical/ssltlsstarttls.html SE-2811 Dr.Yoder Dr. Josiah Yoder

IMAP Security IMAP over SSL/TLS IMAP STARTTLS RFC (no standard needed) CS2910 4/27/2019 IMAP Security IMAP over SSL/TLS IMAP STARTTLS RFC (no standard needed) RFC 2595, RFC 4616 Port 993 143 Security Dedicated port for IMAP wrapped in TLS Plain-text IMAP port with ability to switch to TLS SE-2811 Dr.Yoder Dr. Josiah Yoder

Muddiest Points Fall 2016 6-3 Lab 7 "Silly Nintendo" CS2911 27 April 2019 Muddiest Points Fall 2016 6-3 What text is sent in base-64? What text is sent encrypted? Lab 7 "Silly Nintendo" Dr. Josiah Yoder

CS2911 27 April 2019 Acknowledgement This course is based on the text Computer Networking: A Top Down Approach 7th edition Jim Kurose, Keith Ross Addison-Wesley Dr. Josiah Yoder