import time
from pywinauto.application import Application
import csv
dictionary = {}
with open(r"C:\Users\pashukl2\Desktop\Telnet1.csv") as f1:
csv_file = csv.DictReader(f1)
for row in csv_file:
dictionary = dict(row)
print(dictionary)
x = dictionary["IP"]
y = dictionary["Username"]
z = dictionary["Password"]
w = dictionary["Enable Password"]
app = Application().Start(cmd_line=u'putty telnet@'f"{x}")
putty = app.PuTTY
time.sleep (1)
putty.TypeKeys (y)
putty.TypeKeys ("{ENTER}")
time.sleep (1)
putty.TypeKeys (z)
putty.TypeKeys ("{ENTER}")
time.sleep (1)
putty.TypeKeys ("en")
putty.TypeKeys ("{ENTER}")
putty.TypeKeys (w)
putty.TypeKeys ("{ENTER}")
5. Run the script
C:\Users\pashukl2\AppData\Local\Programs\Python\Python39\python.exe C:/Users/pashukl2/IdeaProjects/begng/20/4/21.py
{'IP': '10.197.211.62', 'Username': 'cisco123', 'Password': 'cisco123', 'Enable Password': 'cisco'}
C:\Users\pashukl2\IdeaProjects\begng\20\4\21.py:17: DeprecationWarning: Method .Start() is deprecated, use .start() instead.
app = Application().Start(cmd_line=u'putty telnet@'f"{x}")
C:\Users\pashukl2\AppData\Local\Programs\Python\Python39\lib\site-packages\pywinauto\application.py:1085: UserWarning: 32-bit application should be automated using 32-bit Python (you use 64-bit Python)
warnings.warn(
C:\Users\pashukl2\IdeaProjects\begng\20\4\21.py:20: DeprecationWarning: Method .TypeKeys() is deprecated, use .type_keys() instead.
putty.TypeKeys (y)
C:\Users\pashukl2\IdeaProjects\begng\20\4\21.py:21: DeprecationWarning: Method .TypeKeys() is deprecated, use .type_keys() instead.
putty.TypeKeys ("{ENTER}")
C:\Users\pashukl2\IdeaProjects\begng\20\4\21.py:23: DeprecationWarning: Method .TypeKeys() is deprecated, use .type_keys() instead.
putty.TypeKeys (z)
C:\Users\pashukl2\IdeaProjects\begng\20\4\21.py:24: DeprecationWarning: Method .TypeKeys() is deprecated, use .type_keys() instead.
putty.TypeKeys ("{ENTER}")
C:\Users\pashukl2\IdeaProjects\begng\20\4\21.py:26: DeprecationWarning: Method .TypeKeys() is deprecated, use .type_keys() instead.
putty.TypeKeys ("en")
C:\Users\pashukl2\IdeaProjects\begng\20\4\21.py:27: DeprecationWarning: Method .TypeKeys() is deprecated, use .type_keys() instead.
putty.TypeKeys ("{ENTER}")
C:\Users\pashukl2\IdeaProjects\begng\20\4\21.py:28: DeprecationWarning: Method .TypeKeys() is deprecated, use .type_keys() instead.
putty.TypeKeys (w)
C:\Users\pashukl2\IdeaProjects\begng\20\4\21.py:29: DeprecationWarning: Method .TypeKeys() is deprecated, use .type_keys() instead.
putty.TypeKeys ("{ENTER}")
C:\Users\pashukl2\IdeaProjects\begng\20\4\21.py:17: DeprecationWarning: Method .Start() is deprecated, use .start() instead.
app = Application().Start(cmd_line=u'putty telnet@'f"{x}")
C:\Users\pashukl2\AppData\Local\Programs\Python\Python39\lib\site-packages\pywinauto\application.py:1085: UserWarning: 32-bit application should be automated using 32-bit Python (you use 64-bit Python)
warnings.warn(
{'IP': '10.197.210.39', 'Username': 'cisco', 'Password': 'cisco', 'Enable Password': 'cisco'}
C:\Users\pashukl2\IdeaProjects\begng\20\4\21.py:20: DeprecationWarning: Method .TypeKeys() is deprecated, use .type_keys() instead.
putty.TypeKeys (y)
C:\Users\pashukl2\IdeaProjects\begng\20\4\21.py:21: DeprecationWarning: Method .TypeKeys() is deprecated, use .type_keys() instead.
putty.TypeKeys ("{ENTER}")
C:\Users\pashukl2\IdeaProjects\begng\20\4\21.py:23: DeprecationWarning: Method .TypeKeys() is deprecated, use .type_keys() instead.
putty.TypeKeys (z)
C:\Users\pashukl2\IdeaProjects\begng\20\4\21.py:24: DeprecationWarning: Method .TypeKeys() is deprecated, use .type_keys() instead.
putty.TypeKeys ("{ENTER}")
C:\Users\pashukl2\IdeaProjects\begng\20\4\21.py:26: DeprecationWarning: Method .TypeKeys() is deprecated, use .type_keys() instead.
putty.TypeKeys ("en")
C:\Users\pashukl2\IdeaProjects\begng\20\4\21.py:27: DeprecationWarning: Method .TypeKeys() is deprecated, use .type_keys() instead.
putty.TypeKeys ("{ENTER}")
C:\Users\pashukl2\IdeaProjects\begng\20\4\21.py:28: DeprecationWarning: Method .TypeKeys() is deprecated, use .type_keys() instead.
putty.TypeKeys (w)
C:\Users\pashukl2\IdeaProjects\begng\20\4\21.py:29: DeprecationWarning: Method .TypeKeys() is deprecated, use .type_keys() instead.
putty.TypeKeys ("{ENTER}")
{'IP': '10.197.211.98', 'Username': 'cisco', 'Password': 'cisco', 'Enable Password': 'cisco'}
C:\Users\pashukl2\IdeaProjects\begng\20\4\21.py:17: DeprecationWarning: Method .Start() is deprecated, use .start() instead.
app = Application().Start(cmd_line=u'putty telnet@'f"{x}")
C:\Users\pashukl2\AppData\Local\Programs\Python\Python39\lib\site-packages\pywinauto\application.py:1085: UserWarning: 32-bit application should be automated using 32-bit Python (you use 64-bit Python)
warnings.warn(
C:\Users\pashukl2\IdeaProjects\begng\20\4\21.py:20: DeprecationWarning: Method .TypeKeys() is deprecated, use .type_keys() instead.
putty.TypeKeys (y)
C:\Users\pashukl2\IdeaProjects\begng\20\4\21.py:21: DeprecationWarning: Method .TypeKeys() is deprecated, use .type_keys() instead.
putty.TypeKeys ("{ENTER}")
C:\Users\pashukl2\IdeaProjects\begng\20\4\21.py:23: DeprecationWarning: Method .TypeKeys() is deprecated, use .type_keys() instead.
putty.TypeKeys (z)
C:\Users\pashukl2\IdeaProjects\begng\20\4\21.py:24: DeprecationWarning: Method .TypeKeys() is deprecated, use .type_keys() instead.
putty.TypeKeys ("{ENTER}")
C:\Users\pashukl2\IdeaProjects\begng\20\4\21.py:26: DeprecationWarning: Method .TypeKeys() is deprecated, use .type_keys() instead.
putty.TypeKeys ("en")
C:\Users\pashukl2\IdeaProjects\begng\20\4\21.py:27: DeprecationWarning: Method .TypeKeys() is deprecated, use .type_keys() instead.
putty.TypeKeys ("{ENTER}")
C:\Users\pashukl2\IdeaProjects\begng\20\4\21.py:28: DeprecationWarning: Method .TypeKeys() is deprecated, use .type_keys() instead.
putty.TypeKeys (w)
C:\Users\pashukl2\IdeaProjects\begng\20\4\21.py:29: DeprecationWarning: Method .TypeKeys() is deprecated, use .type_keys() instead.
putty.TypeKeys ("{ENTER}")
Comments
Post a Comment