1 / 38

Telnet

Telnet. The Telnet Protocol RFC 854. Overview of Telnet. Allow for remote logins to a host computer via the Internet Essentially a raw socket Emulates a virtual terminal Excellent site: http://www.scit.wlv.ac.uk/~jphb/comms/telnet.html

elma
Download Presentation

Telnet

An Image/Link below is provided (as is) to download presentation Download Policy: Content on the Website is provided to you AS IS for your information and personal use and may not be sold / licensed / shared on other websites without getting consent from its author. Content is provided to you AS IS for your information and personal use only. Download presentation by click this link. While downloading, if for some reason you are not able to download a presentation, the publisher may have deleted the file from their server. During download, if you can't get a presentation, the file might be deleted by the publisher.

E N D

Presentation Transcript


  1. Telnet The Telnet Protocol RFC 854

  2. Overview of Telnet • Allow for remote logins to a host computer via the Internet • Essentially a raw socket • Emulates a virtual terminal • Excellent site: • http://www.scit.wlv.ac.uk/~jphb/comms/telnet.html • Note: SSH is Secure SHell – an encrypted version of Telnet (port 22)

  3. Network Virtual Terminals • Mega-Handshake • Determine: • Terminal type • Terminal width/height • Terminal Speed • Remote Flow Control • Environment Variables

  4. WILL / WONT / DO / DONTVirtual Terminal Negotiations • WILL – Sender supports certain functionality • WONT – Sender cannot support the specified functionality • DO – Sender wants the other end to do something • DONT – Sender wants the other end not to do something

  5. Combinations • Sender WILL/Receiver DO: Sender wants to use certain functionality. Receiver says OK. • Sender WILL/Receiver DONT: Receiver cannot support that option • Sender DO/ Receiver WILL: Sender can handle certain functionality if receiver wants. • Sender DO/ Receiver WONT: Receiver cannot support option • Sender WONT/ Receiver DONT: Option disabled • Sender DONT/ Receiver WONT: Option disabled

  6. Telnet Algorithmics • Telnet begins at port 23 • Client and server communicate in eight-bit bytes • Client and server negotiate options • Normal telnet commands are sent

  7. ASCII 0-127

  8. Commands • Distinguished by the most significant bit set! • SE – 240: End subnegotiations • NOP – 241: No operation • AYT – 246: Are you there? • GA – 249: Go ahead. Used in old dialup • SB – 250: Subnegotiations • IAC – 255: Interpret As Command

  9. Negotiable Options • Echo : 1 : RFC 857 • Suppress Go Ahead : 3 : RFC 858 • Status : 5 : RFC 859 • Timing Mark : 6 : RFC 860 • Terminal Type : 24 : RFC 1091 • Window Size : 31 : RFC 1073 • Terminal Speed : 32 : RFC 1079 • Remote Flow Ctrl : 33 : RFC 1372 • Linemode : 34 : RFC 1184 • Environment Vars : 36 : RFC 1408

  10. Negotiable Options • For some options, further negotiations are needed: Client: 255 (IAC), 251 (WILL), 24 (Term Type) Server:255 (IAC), 253 (DO), 24 Server:255 (IAC), 250 (SB), 24, 1 , 255 (IAC), 240 (SE) Client: 255 (IAC), 250 (SB), 24, 0, 'V', 'T', '1', '0', '0', 255 (IAC), 240 (SE)

  11. How Telnet Works Primary Thread Server

  12. Enter the Client Primary Thread Primary Thread Socket (23) Secondary Reader Thread Client Server

  13. Client Bombards with InformationSuppress Go Ahead 255 (IAC), 253 (DO), 3 (SGA) Primary Thread Primary Thread Socket (23) Secondary Reader Thread Client Server

  14. Client Bombards with InformationWill Term Type 255 (IAC), 251 (WILL), 24 (TT) Primary Thread Primary Thread Socket (23) Secondary Reader Thread Client Server

  15. Client Bombards with InformationWill NAWS 255 (IAC), 251 (WILL), 31 (WinSize) Primary Thread Primary Thread Socket (23) Secondary Reader Thread Client Server

  16. Client Bombards with InformationWill TermSpeed 255 (IAC), 251 (WILL), 32 (TS) Primary Thread Primary Thread Socket (23) Secondary Reader Thread Client Server

  17. Client Bombards with InformationWill LineFlow 255 (IAC), 251 (WILL), 33 (LF) Primary Thread Primary Thread Socket (23) Secondary Reader Thread Client Server

  18. Client Bombards with InformationWill LineMode 255 (IAC), 251 (WILL), 34 (LM) Primary Thread Primary Thread Socket (23) Secondary Reader Thread Client Server

  19. Client Bombards with InformationWill New Environment 255 (IAC), 251 (WILL), 36 (NEnv) Primary Thread Primary Thread Socket (23) Secondary Reader Thread Client Server

  20. Client Bombards with InformationWill Status 255 (IAC), 251 (WILL), 5 (Status) Primary Thread Primary Thread Socket (23) Secondary Reader Thread Client Server

  21. Client Bombards with InformationWill XDisplay 255 (IAC), 251 (WILL), 35 (XDisp) Primary Thread Primary Thread Socket (23) Secondary Reader Thread Client Server

  22. Get Ready • Server will now send back a series of DOs • Each option is sub-negotiated

  23. Server Bombards with InformationDO TermType 255 (IAC), 251 (DO), 24 (Type) Primary Thread Primary Thread Socket (23) Secondary Reader Thread Client Server

  24. Server Bombards with InformationInterpret Command and Send Response Primary Thread Primary Thread Socket (23) Secondary Reader Thread Client Server

  25. Server Bombards with Information Interpret Command and Send Response 255 (IAC), 250 (SB), 24 (Type), 0, 'V', 'T', '1', '0', '0', 255, 240 (SE) Primary Thread Primary Thread Socket (23) Secondary Reader Thread Client Server

  26. Server Bombards with InformationDO WinSize 255 (IAC), 251 (DO), 31 (WinSize) Primary Thread Primary Thread Socket (23) Secondary Reader Thread Client Server

  27. Server Bombards with InformationInterpret Command and Send Response Primary Thread Primary Thread Socket (23) Secondary Reader Thread Client Server

  28. Server Bombards with Information Interpret Command and Send Response 255 (IAC), 250 (SB), 31 (WinSize), 0, 80, 0, 24, 255, 240 (SE) Primary Thread Primary Thread Socket (23) Secondary Reader Thread Client Server

  29. Etc… Etc… 255 (IAC), 251 (DO), X Primary Thread Primary Thread Socket (23) Secondary Reader Thread Client Server

  30. Etc… Etc… Primary Thread Primary Thread Socket (23) Secondary Reader Thread Client Server

  31. Etc… Etc… 255 (IAC), 250 (SB), X, X, X, 255, 240 (SE) Primary Thread Primary Thread Socket (23) Secondary Reader Thread Client Server

  32. What if you DONT want to do something? • Send the WONT command • Good default response! • Technically, you can do this for ALL responses • Good if you don't know what the option is • Example: Timing mark…

  33. Server Requests DO 255 (IAC), 251 (DO), 6 (TMark) Primary Thread Primary Thread Socket (23) Secondary Reader Thread Client Server

  34. Interpret Command Primary Thread Primary Thread Socket (23) Secondary Reader Thread Client Server

  35. Send Back WONT 255 (IAC), 252 (WONT), 6 Primary Thread Primary Thread Socket (23) Secondary Reader Thread Client Server

  36. Overall Algorithm • Byte mode: • Optionally send all your DOs • Interpret commands coming over the net • Send appropriate responses • String mode: • Read and send Strings for the rest of the time

  37. Things that Might Save You Time • A class that: • knows all the command codes (constants) • can print out those codes in English • A class that can send terminal info: • Big case statement • Generic sendDO( ), sendDONT( ) • Generic sendWILL( ), send WONT( ) • Specific methods for sending subnegotiated options (like TermType, TermSpeed, etc)

More Related