-
Notifications
You must be signed in to change notification settings - Fork 2
/
paramset.py
28 lines (26 loc) · 906 Bytes
/
paramset.py
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
#!/usr/bin/python
# -*- coding: utf-8 -*-
import telnetlib
from time import sleep
def paramset(co, fi, par):
if co[:2] == 'ch':
tn = telnetlib.Telnet('10.89.61.20', '5023')
tn.read_until('login'.encode())
tn.write('dadmin\n'.encode())
tn.read_until('Password'.encode())
tn.write('dadmin01\n'.encode())
tn.read_until('Pin'.encode())
tn.write('dadmin01\n'.encode())
tn.read_until('Terminal'.encode())
tn.write('ossi\n'.encode())
tn.read_until('t\n'.encode())
tn.write(('c' + str(co) + '\n').encode())
tn.write((str(fi) + '\n').encode())
tn.write(('d' + str(par) + '\n').encode())
tn.write('t\n'.encode())
tn.write('clogoff\n'.encode())
tn.write('t\n'.encode())
sleep(0.2)
tn.write('y\n'.encode())
else:
print('Error in first function parameter')