-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathb.py
More file actions
90 lines (35 loc) · 844 Bytes
/
b.py
File metadata and controls
90 lines (35 loc) · 844 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
import pexpect
import sys
x = raw_input('Enter IP: ')
y = raw_input('Enter username: ')
z = raw_input('Enter password: ')
try:
c = pexpect.spawn('ssh %s@%s' %(y,x))
c.timeout = 4
c.expect("password: ")
c.logfile = sys.stdout
except pexpect.TIMEOUT:
raise Exception("Fail")
c.sendline(z)
c.expect("vManage1#")
c.sendline("show software")
c.expect("# ")
c.sendline("show version")
c.expect("# ")
c.sendline("show control valid-vedges")
c.expect("# ")
c.sendline("request execute ssh admin@1.1.1.4 ")
c.timeout = 4
c.expect("password: ")
c.sendline("admin")
c.expect("# ")
c.sendline('show version ')
c.expect("# ")
#def a(str):
# for i in range(0,len(str)):
# if str[i].isalpha():
# if str[i-1] != '+' or str[i+1] != '+':
# return 'false'
# return 'True'
#
#print a("+a+b+c+")