1

I administer a few Check Point Firewalls at work that run on the Gaia operating system. Gaia is a hardened, purpose-built Linux OS using the 2.6 kernel.

I am a novice at Python and I need to write a script that will enter "expert mode" from the clish shell. Entering expert mode is similar to invoking su as it gives you root privileges in the BASH shell.

Clish is a Cisco like custom shell made to ease OS configuration changes. I saw a similar discussion at pexpect and ssh: how to format a string of commands after su - root -c, but people responding recommended sudo.

This is not an option for me as sudo is not supported by the OS and if you were to install it, clish would not recognize the command. The goal of my script would be to SSH to the device, login, invoke expert mode, then run grep admin /etc/passwd and date. Again, sudo is not an option.

Community
  • 1
  • 1
  • This is what I have: import... from easygui import passwordbox def showhw (): uname = raw_input('please Enter your username :')#username for your router pwd = passwordbox('Please Enter your password :')#password for your router ff = open("router.txt","r")#pass your file with IP address for host in ff: pat = re.search(r'(\d+\.\d+\.\d+\.\d+)',host) if(pat): host = pat.group() child = pexpect.spawn( 'expert' ) child.expect('Enter expert password') child.sendline(pwd) child.expect('#') – Erik Jacobsen Jan 06 '16 at 01:43

1 Answers1

0

clish does not support SSH. But you can change the shell of your user to /bin/bash instead of /etc/clish.sh

set user <myuser> shell /bin/bash
save config
Guest
  • 1