Got it

Connecting eNSP to Python

Latest reply: Dec 29, 2018 01:09:15 2189 6 1 0 1
This post talks about connecting eNSP to Python. Please see more below.

#!/usr/bin/python
#coding=utf-8
# using telnet login deviceimport telnetlib
import os
import time
import sys
reload(sys)
sys.setdefaultencoding("utf-8") 

### configur login information
_Username = 'huawei'
_Password = 'xxxxxxxx'
_Host = '192.168.1.110'


# instance telnet obiect,
telnetsession = telnetlib.Telnet(_Host) 

#telnetsession.set_debuglevel(2)



login_prompt = 'Username'
response = telnetsession.read_until(login_prompt)
if login_prompt in response:
    #print response
    print '[*] Username: ',_Username
telnetsession.write(_Username + "\n")
time.sleep(2)

password_prompt = 'Password'
response = telnetsession.read_until(password_prompt)
if password_prompt in response:
    #print response
    print '[*] Password: ',_Password
time.sleep(2)
telnetsession.write(_Password+ "\n")

response = telnetsession.read_until(_UsermodTag)
if _UsermodTag in response:
    print response
time.sleep(2)


telnetsession.write("dir\n")
response = telnetsession.read_until(_UsermodTag)
if _UsermodTag in response:
    print response
time.sleep(2)

telnetsession.write("system-view\n")

response = telnetsession.read_until(_SysrmodTag)
if _SysrmodTag in response:
    print response
time.sleep(2)


telnetsession.close()
print '[*] Session Close.'
Enjoy your time! :lol

Connecting eNSP to Python-2693265-1 nice thanks
View more
  • x
  • convention:

Hi , is there a deeper article i still dont know how to use it , is there short tutorial video somewhere in iLearning ?
Thanks
View more
  • x
  • convention:

Posted by Mero89 at 2018-07-15 05:28 Hi , is there a deeper article i still dont know how to use it , is there short tutorial video somew ...
okay i uploading later
View more
  • x
  • convention:

I think there is no tutorial. You have to learn it on your own! Huawei is best device i ever worked on...
View more
  • x
  • convention:

I use - enjoy  8 ( http://www.pricechina.ru/phone/12563/huawei-enjoy-8 )
View more
  • x
  • convention:

Therefore, after learning the network knowledge, you need to start learning programming. Otherwise, we cannot communicate with each other.
View more
  • x
  • convention:

Comment

You need to log in to comment to the post Login | Register
Comment

Notice: To protect the legitimate rights and interests of you, the community, and third parties, do not release content that may bring legal risks to all parties, including but are not limited to the following:
  • Politically sensitive content
  • Content concerning pornography, gambling, and drug abuse
  • Content that may disclose or infringe upon others ' commercial secrets, intellectual properties, including trade marks, copyrights, and patents, and personal privacy
Do not share your account and password with others. All operations performed using your account will be regarded as your own actions and all consequences arising therefrom will be borne by you. For details, see " User Agreement."

My Followers

Login and enjoy all the member benefits

Login

Block
Are you sure to block this user?
Users on your blacklist cannot comment on your post,cannot mention you, cannot send you private messages.
Reminder
Please bind your phone number to obtain invitation bonus.