Create a Post
cancel
Showing results for 
Search instead for 
Did you mean: 
stevenhunt77
Explorer

Tacacs_Enable with Python

Hey everyone, I am trying to work on a python script that logs onto a firewall, moves into TACP-15 and enters the relevant password.  After which it runs a command.

 

Problem is the script is getting stuck at the password prompt after running: tacacs_enable TACP-15.

I've tried adding \r to no avail.  Has anyone managed this?

 

Relevant part of the script below:

 

# Then send the command and print the output

output = net_connect.send_command('lock database override')
print(output)

output = net_connect.send_command('tacacs_enable TACP-15')
print(output)

output = net_connect.send_command(expert_password)
print(output)

output = net_connect.send_command('show route')
print(output)
0 Kudos
3 Replies
Andre_K
Contributor

Why don't you use the GAIA API instead in combination with Python (requests module)?

For example:

POST https://<server-ip>:<port>/gaia_api/v1.6/show-routes

Documentation:

https://sc1.checkpoint.com/documents/latest/GaiaAPIs/#web/show-routes~v1.6%20

0 Kudos
stevenhunt77
Explorer

Hey, the show route command is just an example.  Really we would want to be doing various configuration commands such as configuring SNMP or tweaking RBA roles etc.

0 Kudos
Art_Zalenekas
Employee
Employee

You can also use run-script for running commands either through the Gaia API or the Management API.

https://sc1.checkpoint.com/documents/latest/GaiaAPIs/#web/run-script~v1.6%20
https://sc1.checkpoint.com/documents/latest/APIs/#cli/run-script~v1.6%20

0 Kudos