#!/usr/bin/perl use Net::Telnet::Cisco; use Net::Telnet; use strict; my $rtrip = '1.1.1.1'; my $input_log ="input.log"; my $output_log ="output.log"; my $enableyes; #my $cmd = 'show clock'; sub juniperlogin { $rtrip = $_[0]; print "Logging into router $rtrip\n"; my $session = Net::Telnet::Cisco->new(Host => $rtrip, Input_log => $ +input_log, Output_log => $output_log, Timeout => '30'); $session->login(Name => 'login', Password => 'support123', Prompt => ' +/ERX02>$/', Timeout => '30'); #$when = $session->send_wakeup( 'connect' ); if (! my $enableyes) { my $session->cmd('terminal length 0', String => "enables\s+$//5", Pass +word => 'support123', Prompt => '/ERX02#/', Timeout => '30'); } #$session->cmd(String => "set cli screen-length 0", Prompt => '/(?m:^\ +w+@[\w.-]+[>])/', Timeout => '30' Errmode => "return"); } sub junipercmd { my $cmd = $_[0]; #@output = $session->cmd(String => "$cmd", Prompt => '/(?m:^\w+@[\w.-] ++[>])/', Timeout => '60'); my @output = my $session->cmd('terminal length 10', String => "$cmd", + Prompt => '/ERX02#/', Timeout => '30'); return @output; } &juniperlogin("1.1.1.1"); my $output =&junipercmd ("show clock"); print my @output;
am currently trying again to gain access to my juniper and am sure that I have been able to access the routers with normal login, but I can't login in enable mode, If any one has any suggestions, they would be very much appreciated. here is the way how am login to login to my juniper box
"root@reports1 Radiator-3.9# telnet 212.119.67.11

Trying 212.119.67.11...

Connected to 212.119.67.11 (212.119.67.11)

Escape character is '^]'.

Telnet password: **********

Logged in on vty 0 via telnet.

Copyright (c) 1999-2008 Juniper Networks, Inc. All rights reserved.

ERX02>enable 5

Password: **********

ERX02#"

In reply to Re^4: login juniper ERX by Mejaz
in thread login to juniper ERX by Mejaz

Title:
Use:  <p> text here (a paragraph) </p>
and:  <code> code here </code>
to format your post, it's "PerlMonks-approved HTML":



  • Posts are HTML formatted. Put <p> </p> tags around your paragraphs. Put <code> </code> tags around your code and data!
  • Titles consisting of a single word are discouraged, and in most cases are disallowed outright.
  • Read Where should I post X? if you're not absolutely sure you're posting in the right place.
  • Please read these before you post! —
  • Posts may use any of the Perl Monks Approved HTML tags:
    a, abbr, b, big, blockquote, br, caption, center, col, colgroup, dd, del, details, div, dl, dt, em, font, h1, h2, h3, h4, h5, h6, hr, i, ins, li, ol, p, pre, readmore, small, span, spoiler, strike, strong, sub, summary, sup, table, tbody, td, tfoot, th, thead, tr, tt, u, ul, wbr
  • You may need to use entities for some characters, as follows. (Exception: Within code tags, you can put the characters literally.)
            For:     Use:
    & &amp;
    < &lt;
    > &gt;
    [ &#91;
    ] &#93;
  • Link using PerlMonks shortcuts! What shortcuts can I use for linking?
  • See Writeup Formatting Tips and other pages linked from there for more info.