Guest User

Untitled

a guest
Jun 25th, 2018
115
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.72 KB | None | 0 0
  1. %%{
  2. machine telnet_nvt_common;
  3. alphtype unsigned char;
  4.  
  5. # Special bytes that must be handled differently from normal text:
  6. CR = "\r"; # Only \0 or \n may follow
  7. IAC = 255; # Telnet command marker
  8. special_byte = CR | IAC;
  9.  
  10. # The only bytes that may follow a CR:
  11. NL = "\n";
  12. NUL = "\0";
  13.  
  14. # The only bytes that may follow an IAC:
  15. SE = 240;
  16. NOP = 241;
  17. DM = 242;
  18. BRK = 243;
  19. IP = 244;
  20. AO = 245;
  21. AYT = 246;
  22. EC = 247;
  23. EL = 248;
  24. GA = 249;
  25. SB = 250;
  26. WILL = 251;
  27. WONT = 252;
  28. DO = 253;
  29. DONT = 254;
  30.  
  31. # Sorting the above IAC commands by type:
  32. basic_command_type = NOP | BRK | IP | AO | AYT | EC | EL | GA;
  33. arg_command_type = WILL | WONT | DO | DONT;
  34. subneg_command_type = SB;
  35.  
  36. ###
  37. # Plain text
  38. ###
  39. plain_text = (^special_byte | IAC IAC) @text;
  40.  
  41. ###
  42. # CR sequence
  43. ###
  44. cr_sequence = CR ( NUL @cr
  45. | NL @newline
  46. | ^(NUL|NL) @{fhold;} @warning_cr @cr
  47. );
  48.  
  49. ###
  50. # IAC sequence
  51. ###
  52. # IAC commands
  53. basic_command = IAC basic_command_type @command_mark @basic_command;
  54. arg_command = IAC arg_command_type @command_mark
  55. any @option_command;
  56. subneg_command = IAC subneg_command_type
  57. any @subneg_command
  58. (cr_sequence|plain_text)*
  59. IAC SE @subneg_command_end;
  60.  
  61. iac_sequence = ( basic_command
  62. | arg_command
  63. | subneg_command
  64. );
  65.  
  66. ###
  67. # Telnet stream
  68. ###
  69. # These are the three basic data formats that will be accepted
  70. # by the telnet parser.
  71. telnet_stream = ( iac_sequence
  72. | cr_sequence
  73. | plain_text
  74. )*;
  75.  
  76. main := telnet_stream;
  77. }%%
Add Comment
Please, Sign In to add comment