|
@@ -23,6 +23,14 @@ parser.add_argument('-d', '--data', type=str, help='Data to execute', required=F
|
|
|
args = parser.parse_args()
|
|
|
|
|
|
if __name__ == "__main__":
|
|
|
+ if args.timeout is None:
|
|
|
+ timeout = 25
|
|
|
+ else:
|
|
|
+ try:
|
|
|
+ val = int(args.timeout)
|
|
|
+ timeout = args.timeout
|
|
|
+ except ValueError:
|
|
|
+ timeout = 25
|
|
|
|
|
|
if args.password_enable is None or args.password_enable is "":
|
|
|
password_enable = args.password
|
|
@@ -36,7 +44,7 @@ if __name__ == "__main__":
|
|
|
time.sleep(1)
|
|
|
nc += 1
|
|
|
print(nc)
|
|
|
- if nc == 60:
|
|
|
+ if nc == timeout:
|
|
|
break
|
|
|
if not os.path.isfile(args.file):
|
|
|
raise ValueError("%s isn't a file!" % args.file)
|
|
@@ -56,15 +64,6 @@ if __name__ == "__main__":
|
|
|
port = 23
|
|
|
obj = ObjectTelnet()
|
|
|
|
|
|
- if args.timeout is None:
|
|
|
- timeout = 25
|
|
|
- else:
|
|
|
- try:
|
|
|
- val = int(args.timeout)
|
|
|
- timeout = args.timeout
|
|
|
- except ValueError:
|
|
|
- timeout = 25
|
|
|
-
|
|
|
obj.initialize(brand=args.brand, model=args.model, hostname=args.host_name, user=args.user_name,
|
|
|
password=args.password, password_enable=password_enable, port=port,
|
|
|
file_name=args.file, data=args.data, timeout=timeout)
|