Advertisement
Guest User

Untitled

a guest
Oct 11th, 2017
80
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 5.89 KB | None | 0 0
  1. $ cat sa/profiles/DLink/DIR/__init__.py
  2. # -*- coding: utf-8 -*-
  3. ##----------------------------------------------------------------------
  4. ## Vendor: D-Link
  5. ## OS: DIR
  6. ## Compatible:
  7. ##----------------------------------------------------------------------
  8. ## Copyright (C) 2007-2011 The NOC Project
  9. ## See LICENSE for details
  10. ##----------------------------------------------------------------------
  11. """
  12. """
  13. import re
  14. import noc.sa.profiles
  15. from noc.sa.protocols.sae_pb2 import TELNET
  16.  
  17. class Profile(noc.sa.profiles.Profile):
  18. name="DLink.DIR"
  19. supported_schemes=[TELNET]
  20. pattern_username="([Uu]ser ?[Nn]ame|[Ll]ogin):"
  21. pattern_password="[Pp]ass[Ww]ord:"
  22. # pattern_username="login:"
  23. # pattern_password="Password:"
  24. pattern_more="CTRL\+C.+?a All"
  25. # pattern_unpriveleged_prompt=r"^\S+:(3|6|user|operator)#"
  26. pattern_syntax_error=r"Unknown Command !"
  27. # command_super="enable admin"
  28. pattern_prompt=r"^CMD>"
  29. # command_disable_pager="disable clipaging"
  30. command_more="a"
  31. command_exit="logout"
  32. command_save_config="prof save"
  33.  
  34. ***********************************************************
  35.  
  36. $ telnet 192.168.0.200
  37. Trying 192.168.0.200...
  38. Connected to 192.168.0.200.
  39. Escape character is '^]'.
  40.  
  41. ********************************************************************
  42. D-Link DIR-100 Ver 2.01_sw Fri Oct 02 11:01:04 2009
  43. ********************************************************************
  44. login: admin
  45. Password:
  46.  
  47. CMD>
  48.  
  49.  
  50. ************************************************************
  51.  
  52. $ python manage.py debug-script get_version 172
  53. 2011-07-22 13:53:40,642 Setting up 'select' polling method
  54. 2011-07-22 13:53:40,643 Set up select() poller
  55. 2011-07-22 13:53:40,643 Loading private ssh key from 'etc/ssh/id_rsa'
  56. 2011-07-22 13:53:40,644 Loading public ssh key from 'etc/ssh/id_rsa.pub'
  57. access_profile {
  58. profile: "DLink.DIR"
  59. scheme: TELNET
  60. address: "192.168.0.200"
  61. user: "admin"
  62. password: ""
  63. }
  64. script: "DLink.DIR.get_version"
  65.  
  66. 2011-07-22 13:53:40,645 Running socket factory
  67. 2011-07-22 13:53:40,646 Running script thread
  68. 2011-07-22 13:53:40,646 Creating transaction id=1011823388 method=None callback=None
  69. 2011-07-22 13:53:40,648 [script-192.168.0.200-DLink.DIR.get_version] Running
  70. 2011-07-22 13:53:40,649 [script-192.168.0.200-DLink.DIR.get_version] Running script: DLink.DIR.get_version ({})
  71. 2011-07-22 13:53:40,649 [script-192.168.0.200-DLink.DIR.get_version] cli(mft)
  72. 2011-07-22 13:53:40,649 [script-192.168.0.200-DLink.DIR.get_version] Running new provider
  73. 2011-07-22 13:53:40,650 [TELNET: 192.168.0.200] ==> START
  74. 2011-07-22 13:53:40,650 [TELNET: 192.168.0.200] set_patterns([('([Uu]ser ?[Nn]ame|[Ll]ogin):', 'USERNAME'), ('[Pp]ass[Ww]ord:', 'PASSWORD'), ('^CMD>', 'PROMPT'), ('(CTRL\\+C.+?a All)', 'PAGER')])
  75. 2011-07-22 13:53:40,653 [TELNET: 192.168.0.200] set_timeout(30)
  76. 2011-07-22 13:53:40,653 register_socket(<noc.sa.script.telnet.CLITelnetSocket object at 0x9f5362c>,None)
  77. 2011-07-22 13:53:41,647 Tick
  78. 2011-07-22 13:53:41,647 3 TICKS TO EXIT
  79. 2011-07-22 13:53:41,647 [TELNET: 192.168.0.200] Initializing socket
  80. 2011-07-22 13:53:41,648 [TELNET: 192.168.0.200] Connecting 192.168.0.200:23
  81. 2011-07-22 13:53:41,663 [TELNET: 192.168.0.200] Received IAC DO TTYPE (253 24)
  82. 2011-07-22 13:53:41,664 [TELNET: 192.168.0.200] Sending IAC WONT TTYPE (252 24)
  83. 2011-07-22 13:53:41,664 [TELNET: 192.168.0.200] Received IAC WILL ECHO (251 1)
  84. 2011-07-22 13:53:41,665 [TELNET: 192.168.0.200] Sending IAC DO ECHO (253 1)
  85. 2011-07-22 13:53:41,667 [TELNET: 192.168.0.200] Received IAC WILL SGA (251 3)
  86. 2011-07-22 13:53:41,667 [TELNET: 192.168.0.200] Sending IAC DO SGA (253 3)
  87. 2011-07-22 13:53:42,668 Tick
  88. 2011-07-22 13:53:43,669 Tick
  89. 2011-07-22 13:53:44,671 Tick
  90. 2011-07-22 13:53:45,672 Tick
  91. 2011-07-22 13:53:46,673 Tick
  92. 2011-07-22 13:53:47,675 Tick
  93. 2011-07-22 13:53:48,675 Tick
  94. 2011-07-22 13:53:49,676 Tick
  95. 2011-07-22 13:53:50,677 Tick
  96. 2011-07-22 13:53:51,678 Tick
  97. 2011-07-22 13:53:52,680 Tick
  98. 2011-07-22 13:53:53,681 Tick
  99. 2011-07-22 13:53:54,682 Tick
  100. 2011-07-22 13:53:55,684 Tick
  101. 2011-07-22 13:53:56,685 Tick
  102. 2011-07-22 13:53:57,686 Tick
  103. 2011-07-22 13:53:58,686 Tick
  104. 2011-07-22 13:53:59,687 Tick
  105. 2011-07-22 13:54:00,687 Tick
  106. 2011-07-22 13:54:01,688 Tick
  107. 2011-07-22 13:54:02,689 Tick
  108. 2011-07-22 13:54:03,690 Tick
  109. 2011-07-22 13:54:04,691 Tick
  110. 2011-07-22 13:54:05,691 Tick
  111. 2011-07-22 13:54:06,693 Tick
  112. 2011-07-22 13:54:07,694 Tick
  113. 2011-07-22 13:54:08,695 Tick
  114. 2011-07-22 13:54:09,696 Tick
  115. 2011-07-22 13:54:10,697 Tick
  116. 2011-07-22 13:54:11,699 Tick
  117. 2011-07-22 13:54:12,700 Tick
  118. 2011-07-22 13:54:13,701 Tick
  119. 2011-07-22 13:54:13,701 Closing stale socket <noc.sa.script.telnet.CLITelnetSocket object at 0x9f5362c>
  120. 2011-07-22 13:54:13,701 unregister_socket(<noc.sa.script.telnet.CLITelnetSocket object at 0x9f5362c>)
  121. 2011-07-22 13:54:13,702 [TELNET: 192.168.0.200] ==> FAILURE
  122. 2011-07-22 13:54:13,702 [TELNET: 192.168.0.200] set_patterns([])
  123. 2011-07-22 13:54:13,732 [script-192.168.0.200-DLink.DIR.get_version] CLI Provider is ready
  124. 2011-07-22 13:54:13,732 [TELNET: 192.168.0.200] submit('mft',bulk_lines=None)
  125. 2011-07-22 13:54:13,733 [script-192.168.0.200-DLink.DIR.get_version] Login failed: Connection timeout
  126. 2011-07-22 13:54:13,733 [script-192.168.0.200-DLink.DIR.get_version] Closing
  127. 2011-07-22 13:54:13,733 Requesting call: <bound method CLITelnetSocket.close of <noc.sa.script.telnet.CLITelnetSocket object at 0x9f5362c>>(*(), **{'flush': True})
  128. 2011-07-22 13:54:14,703 Tick
  129. 2011-07-22 13:54:14,704 Calling delayed <bound method CLITelnetSocket.close of <noc.sa.script.telnet.CLITelnetSocket object at 0x9f5362c>>(*(), **{'flush': True})
  130. 2011-07-22 13:54:14,704 3 TICKS TO EXIT
  131. 2011-07-22 13:54:15,704 Tick
  132. 2011-07-22 13:54:15,705 2 TICKS TO EXIT
  133. 2011-07-22 13:54:16,706 Tick
  134. 2011-07-22 13:54:16,706 1 TICKS TO EXIT
  135. 2011-07-22 13:54:17,707 Tick
  136. 2011-07-22 13:54:17,707 EXIT
  137. 2011-07-22 13:54:17,708 Shutting down the factory
  138. 2011-07-22 13:54:17,708 0 TICKS TO EXIT
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement