Reply

Perl Changing enable secret hash

Authority
Posts: 40
2267     0

Hi,

I am looking for a solution to the problem of special characters such as '$' in a password hash.

PFA the code.

The script fails if $new_enable_secret_hash consist of strings such as '$asdad$asdjjmm\as5a'.

 

 

#!/usr/bin/perl -w 
# BEGIN-SCRIPT-BLOCK 
# Script-Filter: $Vendor == "Cisco" and $type in ["Router","Switch-Router","Switch"] and $sysdescr like /IOS/ 
# 
# Script-Timeout: 1500
#
#
# Script-Login: 
# true 
# 
# Script-Variables: 
# $save_config string "no"
# $new_line_password_hash password 'none'
# $new_enable_secret_hash password 'none'
#
# END-SCRIPT-BLOCK 
use strict; 
use warnings; 
use NetMRI_Easy({ api_version => 2.6 });


#Standard Script Variables
our $easy = new NetMRI_Easy;
our $cli_timeout = 10;
our $new_enable_secret_hash;

$easy->send_command("config terminal");
$easy->send_command("enable secret 5 $new_enable_secret_hash");
$easy->send_command("end");

 

Can you please suggest a solution for this? I want to use hash only and not plain text option of 'enable secret password 0 <abcd>.

 

Also,

Can we access the lists via Perl? Similar to the getListValue( ) Function on CCS?

 

Thanks,

 

 

 

 

 

Showing results for 
Search instead for 
Do you mean 

Recommended for You