LinuxQuestions.org
Review your favorite Linux distribution.
Home Forums Tutorials Articles Register
Go Back   LinuxQuestions.org > Forums > Non-*NIX Forums > Programming
User Name
Password
Programming This forum is for all programming questions.
The question does not have to be directly related to Linux and any language is fair game.

Notices


Reply
  Search this Thread
Old 09-30-2003, 03:07 PM   #1
Miky
Member
 
Registered: Dec 2002
Location: London / Paris
Distribution: Debian / OpenBsd
Posts: 74

Rep: Reputation: 15
Help with perl and telnet


Hi,

I'd like to know wether it's possible to execute a script in perl that allows you to log in on a machine, and gives you back control.

exemple :
I often have to do this
$ telnet computer
login : my_login # i enter my login
password : my_password # i enter my password
machine$ls #Now that i'm loggued in i want to sent commands manually such as ls.

And i'd like this to be replaced by
$script_login.pl computer

I'm learning perl at the moment but i don't know the trick so the the script gives me back hand while i'm on the remote machine.
Any detailled help particularly on this part will be very appreciated.

Cheers
 
Old 10-01-2003, 03:50 AM   #2
m0rl0ck
Member
 
Registered: Nov 2002
Distribution: A totally 133t distro :)
Posts: 358

Rep: Reputation: 31
Net::Telnet, version 3.01

Copyright (c) 1997 Jay Rogers. All rights reserved. This program
is free software; you can redistribute it and/or modify it under
the same terms as Perl itself.


What's In It For You
--------------------

. You'd like to communicate with another host or device via a
TELNET port and you'd like some specialized routines to help you
login and do other interactive things.

. You're not familiar with sockets and you want a simple way to
make client connections to TCP services.

. You want to be able to specify your own time-out while
connecting, reading, and writing.

. You're communicating with an interactive program at the other
end of some socket or pipe and you want to wait for certain
patterns to appear.

--------------------------------------------------------------------------
http://www.perl.com/CPAN-local/modules/by-module/Net/

Never tried it my self.
 
Old 10-02-2003, 04:17 AM   #3
Miky
Member
 
Registered: Dec 2002
Location: London / Paris
Distribution: Debian / OpenBsd
Posts: 74

Original Poster
Rep: Reputation: 15
Question 1
Yes i'm actually using net::telnet::cisco, but didn't find the way to do what i want, that's the purpose of my question.

Question 2
I've got fields

field1 field2 field3 field4 field5 field6

I have this in an array @myfields

I know i can use split but i just want the field2 and field6
($field2, field6) = split (/a_smart_regex/, $_) ;
My problem is that i don't find how to write my a_smart_regex

Any Idea ?

Cheers
 
  


Reply



Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off



Similar Threads
Thread Thread Starter Forum Replies Last Post
How is it possible to login as root with Perl script and used telnet.pm manu0573 Linux - Software 1 07-27-2005 05:22 PM
Using Perl NET::TELNET module DannyM Linux - Networking 4 02-15-2005 11:31 AM
Net::Telnet question on perl. mosh Programming 3 08-10-2004 09:43 AM
can not telnet localhost 25 but telnet dowell.exper.dynserv.com 25 exper Linux - Software 0 02-25-2004 05:13 AM
perl(Cwd) perl(File::Basename) perl(File::Copy) perl(strict)....What are those? Baldorg Linux - Software 1 11-09-2003 08:09 PM

LinuxQuestions.org > Forums > Non-*NIX Forums > Programming

All times are GMT -5. The time now is 07:35 AM.

Main Menu
Advertisement
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Open Source Consulting | Domain Registration