connection = ConnectHandler(**checkpoint)
time.sleep(1)
connection.send_command_timing(“Tacacs-enable TACP-15”)
time.sleep(1)
output = connection.send_command_timing(“show asset all”)
time.sleep(1)
connection.disconnect()
print(output)
For automation you should certainly use the Gaia API instead of the CLI:
https://sc1.checkpoint.com/documents/latest/GaiaAPIs/#web/show-asset
It is much easier to use the API instead of messing with the interactive CLI interface.
Regarding your code:
- The command is
tacacs_enable
, notTacacs-enable
. - You do not seem to check the result of the command! That is very important.
- Instead of waiting one second you should check if the previous command has finished. One second may be too much or not enough.
- The command may ask you for a password. You do not provide one.
- If you want to continue troubleshooting your code here:
- Post a runnable code (some parts are missing in your code).
- Explain what behaviour you want to get and what you get instead.
- Put the code between lines with triple backticks so that we see it properly. See the post below for details: