Re: 2&>1 on Solaris Question

From: look (look_at_doublethreat.net)
Date: 10/18/03

  • Next message: jjl: "unique elements (case insentitive) of an array in perl"
    Date: Fri, 17 Oct 2003 20:07:14 -0400
    
    

    what version of Solaris are you running? Have you installed Perl from
    the companion CD or did you download it from sunfreeware? The reason
    i ask these questions is it could be your box is without ssh because
    it's running solaris 8 or earlier, and your version of Perl is living
    under /opt/bin not /usr/local/bin?

    hope this helps

    In article <c54501de.0306121315.18a1f3a@posting.google.com>, PP133
    <pp133@socal.rr.com> wrote:

    > I created a perl script to go through a range of IP addresses
    > attempting to logon via ssh protocol version 1. The command for this
    > is "ssh -1 <IP_address>". Basically it attempts to connect using and
    > older ssh protocol version. I made the script to store the server
    > reply when trying to connect, then based on the reply it will list
    > those IP addresses that are still listening on protocol version 1. So
    > if we make a connection attempt to 24.24.24.10 (ssh -1 24.24.24.10)
    > and it loads up with the following message:
    >
    > The authenticity of host '24.24.24.10 (24.24.24.10)' can't be
    > established.
    > RSA1 key fingerprint is
    > 04:6d:81:09:bd:b8:2d:d7:c7:9d:44:cc:3c:d1:01:de.
    > Are you sure you want to continue connecting (yes/no)?
    >
    > That means that the IP address is listening on protocol version 1. So
    > I want to keep this IP address in an array of addresses listening for
    > version 1. Now, if the server is not listening on version 1, it'll
    > give a message like this:
    >
    > Protocol major versions differ: 1 vs. 2
    >
    > There is also the possibility that an IP address won't have ssh
    > listening on it, this makes the script sit there and wait for a
    > response. So I made the script to kill the process after 5 seconds,
    > which is usually long enough to get some sort of response from the
    > server.
    >
    > This all worked great on my redhat box, which I was using to code it,
    > but did not work on the solaris box on which it was intended to work
    > on. I'm using the 2&>1 command to get the error to copy to the
    > STDOUT. For some reason, the solaris box doesn't recognize that "The
    > authenticity of host '...." response as either error or output, hence
    > it just times out when I get that response. I'm using the bash shell
    > on both solaris and redhat so I don't know what the problem is.
    >
    > I'll list my code below so as to be thorough.
    >
    >
    > #This script runs ssh -1 on all the ips in the given range. It then
    > #spits out the IP addresses of the servers that return the message
    > #stating that "Protocol major versions differ 1 vs. 2"
    >
    > #Send 3 arguments, the first being the first 3 octets of the IP addy
    > #beginning of the range, the second being the beginning of the range
    > # and the third being the end of the range
    >
    > #For example, to test 24.24.24.2 to 24.24.24.60 call the script
    > #like this: perl sshcheck.pl 24.24.24 10 60
    >
    > #!/usr/bin/perl
    > use warnings;
    > use strict;
    >
    > my @results;
    > my $count=0;
    > my $result_count=0;
    > my @IPS;
    > my @ValidIPS;
    > my $delay = 5; #sleep time in seconds
    > my $PID;
    > my $argnum=scalar @ARGV;
    >
    > die "3 arguments are needed\n" if($argnum!=3);
    > chomp(my $ip = $ARGV[0]);
    > $ip.=".";
    > chomp(my $begin = $ARGV[1]);
    > chomp(my $end = $ARGV[2]);
    >
    > if($begin > $end){
    > my $temp=$begin;
    > $begin=$end;
    > $end=$temp;
    > }
    >
    > for($begin..$end){
    > $IPS[$count]="$ip$_";
    > print "IPS[$count] = $IPS[$count]: Result_count: $result_count\n";
    > $PID=open IN, "ssh -1 $IPS[$count] 2>&1|" or die "Cannot pipe from
    > ssh\n";
    > sleep $delay;
    > kill 2, $PID if (kill 0, $PID);
    > $results[$result_count]=<IN>;
    > close IN;
    > $count++;
    > if (defined($results[$result_count])){
    > if ($results[$result_count] =~ /.*connection .* refused\./i) {
    > print "Connection refused\n";
    > next;
    > }else { $ValidIPS[$result_count++]=$IPS[$count-1];}
    > }else{
    > print "No response\n";
    > next;
    > }
    > }
    >
    > print "\nThe following IPs are using SSH protocol 1\n";
    > for(1..$result_count){
    > if($results[$_-1] =~ /The authenticity.*/){
    > print "$ValidIPS[$_-1]\n";
    > }
    > }
    >
    >
    >
    > I really appreciate any help anyone can provide. Thanks in advance.


  • Next message: jjl: "unique elements (case insentitive) of an array in perl"

    Relevant Pages

    • Re: Connection refused by [127.0.0.1]
      ... I'm not on Linux but Solaris, ... Clearly then not listening on 127.0.0.1. ... In other parts of the thread John Murtari has already "pinpointed" the ...
      (comp.mail.sendmail)
    • Re: Solaris 8: vncconnect
      ... > I am trying to setup a vnc server on my solaris 8 machine that will connect ... To have x11vnc connect to any listening viewers at x11vnc startup use: ...
      (comp.unix.solaris)
    • Re: Problems with localhost
      ... > I have a session in a machine with solaris 8 ... Sounds like whatever is listening on port 80 won't talk back to ... localhost or its shielded off by a firewall. ...
      (comp.unix.solaris)
    • Re: Canīt telnet to Solaris 10
      ... Can you ping it? ... Is something listening on port 23 on your Solaris 10 box? ...
      (comp.unix.solaris)
    • Re: Force a page to refresh after submitting a form.
      ... correct and useful response to a question here. ... his own posts and never actually stops to help anybody else. ... Take a look one comp.unix.solaris and you will see I often contribute there - I know more about Solaris than web development. ... All questions on here recently by me have been aimed at some PHP code I am writing to access Mathematica via the web. ...
      (uk.net.web.authoring)