Hi,
The below code is used to connect to the remote machine using Telnet module in perl. - use Net::Telnet;
-
use Net::Ping;
-
$telnet = new Net::Telnet (Timeout=>10,Errmode=>'die');
-
-
open (FILE,"C:/start.txt") or die ("Unable to open start.txt");
-
while(<FILE>)
-
{
-
$cnt++ if !/^\s+?$/;
-
}
-
close(FILE);
-
-
open fin,"C:/start.txt" or die $!;
-
my @data=<fin>;
-
close(fin);
-
-
for(my $s=0;$s<$cnt;$s++)
-
{
-
$addr="$data[$s]";
-
$addr =~s/^\s+//;
-
$addr =~s/\s+$//;
-
$p=Net::Ping->new("tcp");
-
-
if($p->ping($addr))
-
{
-
my $server ="$addr";
-
$telnet->open($server);
-
$telnet->waitfor('/login:/');
-
$telnet->print('root');
-
$telnet->waitfor('/password:/');
-
$telnet->print('password');
-
print $telnet->cmd("uname -a|tr -s ' '|cut -f1 -d ' '");
-
}
-
}
The Start.txt file contains the list of IP Address as shown below, - 192.168.**.1
-
192.168.**.20
-
192.168.**.25
The script will read the IP Address from the file start.txt one by one,by executing the given UserID and Password to produce the output.Suppose the UserID and Password for any of these Machine is wrong then it is exiting out of the Script without reading the Next IP Address.I want the Solution like,if the password is wrong for any of the machine then my script should read the next IP Address from the file instead of exiting out of the script.Please any one help me in this........... ..
Thanks in advance.
Regard's,
Thamayanthi
2 2994 gpraghuram 1,275
Recognized Expert Top Contributor
The default errormode is die in net::telnet.
You can make use of errmode() function in that module to get around that.
Read the documentation for more info about errmode.
Raghuram
Thanks for your reply...
Now,my Script is woking fine........
Sign in to post your reply or Sign up for a free account.
Similar topics |
by: Bob |
last post by:
Hi,
I have a website in a Linux/Apache shared hosting environment and have
been given access to the MySQL server running on the same machine. To
access this database from PHP, I have to call mysql_connect(host,
user, password) where the password is hardcoded into my PHP source
file in clear text.
I see two security problems with this:
|
by: Bart van den Burg |
last post by:
Hi
I'm using mysql-server 4.0.13-3 on Debian.
I wish to be able to connect to that server using a mysql frontend from my
other computer, which is a Win32 box. However, when I try "telnet
192.168.1.40 3306" on the win32 box, or "telnet localhost 3306" on the host
box, I get connection refused.
Can someone give me, or point me to a step-by-step explaination on how this
is achieved?
|
by: Maurice LING |
last post by:
Hi,
I've been using FB1.5 and access the database using Kinterbasdb +
Python. My connection is established using kinterbasdb.connect() method
and the parameters host, dns, database, user, password are all defaulted
to 'None'.
On my own machine running Mac OSX 10.3, I can connect using the following:
host = 'localhost'
database = '<my path to FB database>'
|
by: John Owens |
last post by:
Hi,
I'm looking for a plugin for Visual Studio .NET or another IDE etc that
would allow me to develop on Windows but have the compiler and debugger and
code run on Linux.
e.g.
Code using Windows
Build ( Behind the scenes: FTP updated files over to Linux and then compile
|
by: Ann Marinas |
last post by:
Hi all,
I would like to ask for some help regarding separating the asp.net
webserver and the sql server.
I have created an asp.net application for a certain company. Initially,
we installed both the iis and sql server in a single machine. Not too
long ago, the machine had some hardware problems, and management has
decided to purchase new servers, for both asp.net and sql server.
| |
by: Mike Collins |
last post by:
I am trying to connect to a 2003 Server from an ASP.Net page and am getting
the following error message. Can someone please help get me started on how to
track and fix this error? The code I am using is below the error I am
getting.
Error: System.Data.SqlClient.SqlException: SQL Server does not exist or
access denied. at System.Data.SqlClient.ConnectionPool.GetConnection(Boolean&
isInTransaction) at...
|
by: RvGrah |
last post by:
After much hair-pulling, I've finally found the answer to a problem
that many are fighting with, difficulty connecting from Sql 2005 Server
Management or VS2005 to a remote Sql Server running Sql 2000. In my
case the server I couldn't reach was across a vpn connection, behind
ISA server 2000, (which had port 1433 open).
The answer was in this post:...
|
by: jwwicks |
last post by:
C/C++ Programs and Debugging in Linux
This tutorial will give you a basic idea how to debug a program in Linux using GDB. As you are aware Visual Studio doesn’t run on Linux so you have to use some of the tools provided on the command-line. If you hate the command line tools, get over it since you’re bound to be using them at some point in your career. All commands in Linux ARE case sensitive so capital letters are different from lowercase...
|
by: sherrygomindes |
last post by:
Hi
I have written a perl script using the Telnet module. I need to remotely login in from one windows XP machine to another XP machine.
But i get errors which i can't figure out the reason.
Please someone help me its very very urgent.
here is my code:
#!/usr/bin/perl -w
|
by: marktang |
last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main usage, and What is the difference between ONU and Router. Let’s take a closer look !
Part I. Meaning of...
|
by: Hystou |
last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it.
First, let's disable language synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
| |
by: Oralloy |
last post by:
Hello folks,
I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>".
The problem is that using the GNU compilers, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed.
This is as boiled down as I can make it.
Here is my compilation command:
g++-12 -std=c++20 -Wnarrowing bit_field.cpp
Here is the code in...
|
by: jinu1996 |
last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that captivates audiences and drives business growth.
The Art of Business Website Design
Your website is...
|
by: tracyyun |
last post by:
Dear forum friends,
With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
|
by: agi2029 |
last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then launch it, all on its own....
Now, this would greatly impact the work of software developers. The idea...
|
by: TSSRALBI |
last post by:
Hello
I'm a network technician in training and I need your help.
I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs.
The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols.
I succeeded, with both firewalls in the same network. But I'm wondering if it's possible to do the same thing, with 2 Pfsense firewalls...
|
by: adsilva |
last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
| |
by: 6302768590 |
last post by:
Hai team
i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system
| |