Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- $ cat sa/profiles/DLink/DIR/__init__.py
- # -*- coding: utf-8 -*-
- ##----------------------------------------------------------------------
- ## Vendor: D-Link
- ## OS: DIR
- ## Compatible:
- ##----------------------------------------------------------------------
- ## Copyright (C) 2007-2011 The NOC Project
- ## See LICENSE for details
- ##----------------------------------------------------------------------
- """
- """
- import re
- import noc.sa.profiles
- from noc.sa.protocols.sae_pb2 import TELNET
- class Profile(noc.sa.profiles.Profile):
- name="DLink.DIR"
- supported_schemes=[TELNET]
- pattern_username="([Uu]ser ?[Nn]ame|[Ll]ogin):"
- pattern_password="[Pp]ass[Ww]ord:"
- # pattern_username="login:"
- # pattern_password="Password:"
- pattern_more="CTRL\+C.+?a All"
- # pattern_unpriveleged_prompt=r"^\S+:(3|6|user|operator)#"
- pattern_syntax_error=r"Unknown Command !"
- # command_super="enable admin"
- pattern_prompt=r"^CMD>"
- # command_disable_pager="disable clipaging"
- command_more="a"
- command_exit="logout"
- command_save_config="prof save"
- ***********************************************************
- $ telnet 192.168.0.200
- Trying 192.168.0.200...
- Connected to 192.168.0.200.
- Escape character is '^]'.
- ********************************************************************
- D-Link DIR-100 Ver 2.01_sw Fri Oct 02 11:01:04 2009
- ********************************************************************
- login: admin
- Password:
- CMD>
- ************************************************************
- $ python manage.py debug-script get_version 172
- 2011-07-22 13:53:40,642 Setting up 'select' polling method
- 2011-07-22 13:53:40,643 Set up select() poller
- 2011-07-22 13:53:40,643 Loading private ssh key from 'etc/ssh/id_rsa'
- 2011-07-22 13:53:40,644 Loading public ssh key from 'etc/ssh/id_rsa.pub'
- access_profile {
- profile: "DLink.DIR"
- scheme: TELNET
- address: "192.168.0.200"
- user: "admin"
- password: ""
- }
- script: "DLink.DIR.get_version"
- 2011-07-22 13:53:40,645 Running socket factory
- 2011-07-22 13:53:40,646 Running script thread
- 2011-07-22 13:53:40,646 Creating transaction id=1011823388 method=None callback=None
- 2011-07-22 13:53:40,648 [script-192.168.0.200-DLink.DIR.get_version] Running
- 2011-07-22 13:53:40,649 [script-192.168.0.200-DLink.DIR.get_version] Running script: DLink.DIR.get_version ({})
- 2011-07-22 13:53:40,649 [script-192.168.0.200-DLink.DIR.get_version] cli(mft)
- 2011-07-22 13:53:40,649 [script-192.168.0.200-DLink.DIR.get_version] Running new provider
- 2011-07-22 13:53:40,650 [TELNET: 192.168.0.200] ==> START
- 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')])
- 2011-07-22 13:53:40,653 [TELNET: 192.168.0.200] set_timeout(30)
- 2011-07-22 13:53:40,653 register_socket(<noc.sa.script.telnet.CLITelnetSocket object at 0x9f5362c>,None)
- 2011-07-22 13:53:41,647 Tick
- 2011-07-22 13:53:41,647 3 TICKS TO EXIT
- 2011-07-22 13:53:41,647 [TELNET: 192.168.0.200] Initializing socket
- 2011-07-22 13:53:41,648 [TELNET: 192.168.0.200] Connecting 192.168.0.200:23
- 2011-07-22 13:53:41,663 [TELNET: 192.168.0.200] Received IAC DO TTYPE (253 24)
- 2011-07-22 13:53:41,664 [TELNET: 192.168.0.200] Sending IAC WONT TTYPE (252 24)
- 2011-07-22 13:53:41,664 [TELNET: 192.168.0.200] Received IAC WILL ECHO (251 1)
- 2011-07-22 13:53:41,665 [TELNET: 192.168.0.200] Sending IAC DO ECHO (253 1)
- 2011-07-22 13:53:41,667 [TELNET: 192.168.0.200] Received IAC WILL SGA (251 3)
- 2011-07-22 13:53:41,667 [TELNET: 192.168.0.200] Sending IAC DO SGA (253 3)
- 2011-07-22 13:53:42,668 Tick
- 2011-07-22 13:53:43,669 Tick
- 2011-07-22 13:53:44,671 Tick
- 2011-07-22 13:53:45,672 Tick
- 2011-07-22 13:53:46,673 Tick
- 2011-07-22 13:53:47,675 Tick
- 2011-07-22 13:53:48,675 Tick
- 2011-07-22 13:53:49,676 Tick
- 2011-07-22 13:53:50,677 Tick
- 2011-07-22 13:53:51,678 Tick
- 2011-07-22 13:53:52,680 Tick
- 2011-07-22 13:53:53,681 Tick
- 2011-07-22 13:53:54,682 Tick
- 2011-07-22 13:53:55,684 Tick
- 2011-07-22 13:53:56,685 Tick
- 2011-07-22 13:53:57,686 Tick
- 2011-07-22 13:53:58,686 Tick
- 2011-07-22 13:53:59,687 Tick
- 2011-07-22 13:54:00,687 Tick
- 2011-07-22 13:54:01,688 Tick
- 2011-07-22 13:54:02,689 Tick
- 2011-07-22 13:54:03,690 Tick
- 2011-07-22 13:54:04,691 Tick
- 2011-07-22 13:54:05,691 Tick
- 2011-07-22 13:54:06,693 Tick
- 2011-07-22 13:54:07,694 Tick
- 2011-07-22 13:54:08,695 Tick
- 2011-07-22 13:54:09,696 Tick
- 2011-07-22 13:54:10,697 Tick
- 2011-07-22 13:54:11,699 Tick
- 2011-07-22 13:54:12,700 Tick
- 2011-07-22 13:54:13,701 Tick
- 2011-07-22 13:54:13,701 Closing stale socket <noc.sa.script.telnet.CLITelnetSocket object at 0x9f5362c>
- 2011-07-22 13:54:13,701 unregister_socket(<noc.sa.script.telnet.CLITelnetSocket object at 0x9f5362c>)
- 2011-07-22 13:54:13,702 [TELNET: 192.168.0.200] ==> FAILURE
- 2011-07-22 13:54:13,702 [TELNET: 192.168.0.200] set_patterns([])
- 2011-07-22 13:54:13,732 [script-192.168.0.200-DLink.DIR.get_version] CLI Provider is ready
- 2011-07-22 13:54:13,732 [TELNET: 192.168.0.200] submit('mft',bulk_lines=None)
- 2011-07-22 13:54:13,733 [script-192.168.0.200-DLink.DIR.get_version] Login failed: Connection timeout
- 2011-07-22 13:54:13,733 [script-192.168.0.200-DLink.DIR.get_version] Closing
- 2011-07-22 13:54:13,733 Requesting call: <bound method CLITelnetSocket.close of <noc.sa.script.telnet.CLITelnetSocket object at 0x9f5362c>>(*(), **{'flush': True})
- 2011-07-22 13:54:14,703 Tick
- 2011-07-22 13:54:14,704 Calling delayed <bound method CLITelnetSocket.close of <noc.sa.script.telnet.CLITelnetSocket object at 0x9f5362c>>(*(), **{'flush': True})
- 2011-07-22 13:54:14,704 3 TICKS TO EXIT
- 2011-07-22 13:54:15,704 Tick
- 2011-07-22 13:54:15,705 2 TICKS TO EXIT
- 2011-07-22 13:54:16,706 Tick
- 2011-07-22 13:54:16,706 1 TICKS TO EXIT
- 2011-07-22 13:54:17,707 Tick
- 2011-07-22 13:54:17,707 EXIT
- 2011-07-22 13:54:17,708 Shutting down the factory
- 2011-07-22 13:54:17,708 0 TICKS TO EXIT
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement