Re: Telnet

2002-05-21 Thread Scott
 On Tue, 2002-04-30 at 17:11, Scott wrote:

 Does anyone know how to make a script to telnet to an IP, authenticate
 (login / pass) and then reconnect every 8 hours or whenever the connection
 is lost.
 
 Its rather important because its the only thing stopping me from fully using
 OSX. I had an applescript that did this with ³MacTelnet² in OS9.
 

 
 Since you're running an operating system capable of running perl, I've
 just spent the last hour making this little script for you:

 
 ---START SCRIPT
 #!/usr/bin/perl
 # v1.0 - May 1, 2002 by Onno Benschop - ITmaze
 # Use this wherever you like, just leave the credit alone.
 #
 # Usage: telnet.pl host user passwd
 #
 # Purpose: keep a telnet connection open
 #
 # Script will connect to host with user and password. As soon
 # as the connection dies, it reconnects. To keep some connections
 # alive longer, it issues an $idleCommand each $idleTime seconds.
 #
 # If you want to just run this in the background, then add  at
 # the end of the command, eg:
 #
 # telnet.pl host user passwd 
 #
 
 use Net::Telnet;
 $idleCommand = 'date' ; # command to run to keep alive
 $idleTime = 5*60 ; # idle time in seconds
 
 sub telnet_connect {
 ($host,$user,$passwd)[EMAIL PROTECTED];
 
 $telnet = new Net::Telnet ( Timeout=10,
 Errmode='return',
 Prompt = '/\$ $/i');
 $telnet-open($host);
 $telnet-login($user, $passwd);
 while () {
 $telnet-cmd($idleCommand) ;
 sleep($idleTime) ;
 }
 }
 
 sub telnet_use {
 print Usage: telnet.pl host user passwd\n ;
 }
 
 if (!$ARGV[2]) {
 telnet_use;
 } else {
 while () {
 telnet_connect ;
 }
 }
 END SCRIPT

 
 You will need to download the Net::Telnet perl module from cpan. The
 manual is here:
 http://www.perldoc.com/cpan/Net/Telnet.html
 
 The software is here:
 http://www.perl.com/CPAN-local/authors/id/J/JR/JROGERS/
 
 Save the script in a file called telnet.pl, then do: chmod +x telnet.pl.
 Finally, just type ./telnet.pl and it should say: Usage: telnet.pl host
 user passwd. Run it with appropriate parameters and it will connect
 everytime it is disconnected and will issue the idleCommand every
 idleTime period.
 
 For those of you wondering why it took so long, it's because my native
 tounge is not perl (I try to avoid it like the plague :-). I needed to
 first find out why telnet -l username hostname didn't work as expected,
 it's supposed to login with your supplied username, but then it prompts
 for a password - not good. Then I figured that I could probably write a
 script, and seeing that it was unlikely that Scott had PHP installed, I
 figured that using perl would be simpler. Then went looking for
 something that allowed me to telnet using perl, then needed to figure
 out how to get command line parameters to the script, since I didn't
 really want Scott to have to change the script.

At first I was unable to get the Net::Telnet module to work. I was presented
with many different errors when trying to install the module in the command
prompt (segmentation error, Perl Library incomplete, package incomplete,
etc.) I didn¹t believe any of these to be true however. The package was
complete and I was quite sure that the OSX Perl Libraries would be too.

I managed to get the Net::Telnet module to install but had to be logged in
as root. I also found a file called perl.h that was not in the OSX Perl
Libraries in the latest release of Perl off a CPAN ftp server.

I placed the perl.h file in the System/Perl/Darwin/CORE folder. (all this
also has to be done logged in as root otherwise you get an error saying the
folder and files cannot be modified) I then tried to install the Net::Telnet
module again.

It works up to the part where you use the make command to create the man
file. I got an error saying No such command I ignored it and tried the
script as I didn¹t think the man file was essential.

I logged back in under my normal account.

I saved the above script (v1.0 - May 1, 2002 by Onno Benschop - Itmaze) in
XperlEdit v1.2 into the Home folder.

I then ran the script and it worked fine but did not display anything in the
Terminal window. (If this does not work make sure that the Telnet.pl file
you have saved does not contain any html or other characters)

The script keeps the telnet session open like it should. It has been running
now for a bit under 24 hours.

Regards,
Scott



Re: Telnet

2002-05-01 Thread hinchlif

On Tuesday, April 30, 2002, at 05:11 PM, Scott wrote:


 Does anyone know how to make a script to telnet to an IP, authenticate
 (login / pass) and then reconnect every 8 hours or whenever the 
 connection
 is lost.


I don't know about the reconnection or authentication stuff, but here's 
a simple script to start the session in the first place:


ignoring application responses
tell application Terminal
activate
do script with command ¬
telnet xxx.xxx.xxx.xxx
end tell
end ignoring

substituting the address of your server for the xxx.xxx.xxx.xxx, of 
course.

--
Peter Hinchliffe
Apwin Computer Services FileMaker Pro Solutions Developer
Perth, 
Western Australia Phone (618) 9332 6482 Fax (618) 9332 0913

Mac because I prefer it -- Windows because I have to.


[Non-text portions of this message have been removed]



Re: Telnet

2002-05-01 Thread Onno Benschop
On Tue, 2002-04-30 at 17:11, Scott wrote:
 Does anyone know how to make a script to telnet to an IP, authenticate
 (login / pass) and then reconnect every 8 hours or whenever the connection
 is lost.
 
 Its rather important because its the only thing stopping me from fully using
 OSX. I had an applescript that did this with ³MacTelnet² in OS9.
 

Since you're running an operating system capable of running perl, I've
just spent the last hour making this little script for you:

---START SCRIPT
#!/usr/bin/perl
# v1.0 - May 1, 2002 by Onno Benschop - ITmaze
# Use this wherever you like, just leave the credit alone.
#
# Usage: telnet.pl host user passwd
#
# Purpose: keep a telnet connection open
#
# Script will connect to host with user and password. As soon
# as the connection dies, it reconnects. To keep some connections
# alive longer, it issues an $idleCommand each $idleTime seconds.
#
# If you want to just run this in the background, then add  at
# the end of the command, eg:
#
# telnet.pl host user passwd 
#

use Net::Telnet;
$idleCommand = 'date' ; # command to run to keep alive
$idleTime = 5*60 ;  # idle time in seconds

sub telnet_connect {
($host,$user,$passwd)[EMAIL PROTECTED];

$telnet = new Net::Telnet ( Timeout=10,
Errmode='return',
Prompt = '/\$ $/i');
$telnet-open($host);
$telnet-login($user, $passwd);
while () {
$telnet-cmd($idleCommand) ;
sleep($idleTime) ;
}
}

sub telnet_use {
print Usage: telnet.pl host user passwd\n ;
}

if (!$ARGV[2]) {
telnet_use;
} else {
while () {
telnet_connect ;
}
}
END SCRIPT

You will need to download the Net::Telnet perl module from cpan. The
manual is here:
http://www.perldoc.com/cpan/Net/Telnet.html

The software is here:
http://www.perl.com/CPAN-local/authors/id/J/JR/JROGERS/

Save the script in a file called telnet.pl, then do: chmod +x telnet.pl.
Finally, just type ./telnet.pl and it should say: Usage: telnet.pl host
user passwd. Run it with appropriate parameters and it will connect
everytime it is disconnected and will issue the idleCommand every
idleTime period.

For those of you wondering why it took so long, it's because my native
tounge is not perl (I try to avoid it like the plague :-). I needed to
first find out why telnet -l username hostname didn't work as expected,
it's supposed to login with your supplied username, but then it prompts
for a password - not good. Then I figured that I could probably write a
script, and seeing that it was unlikely that Scott had PHP installed, I
figured that using perl would be simpler. Then went looking for
something that allowed me to telnet using perl, then needed to figure
out how to get command line parameters to the script, since I didn't
really want Scott to have to change the script.
-- 
()/)/)() ..ASCII for Onno.. 
|? ..EBCDIC for Onno.. 
--- -. -. --- ..Morse for Onno.. 

ITmaze - ABN: 56 178 057 063 - ph: 04 1219  -  
[EMAIL PROTECTED]



Re: Telnet

2002-05-01 Thread Andrew Nielsen
Just a comment about all this telnetting going on - telnet transmits 
information unencrypted. That includes your user name and password. 
ssh is a much more secure alternative. Food for thought.

--

Andrew Nielsen mailto:[EMAIL PROTECTED]
Starfish Technologies Pty Ltd http://www.starfish.net.au/
ACN 076 426 714 / ABN 49 426 849 601 Tel: 0500 555 677
Consultants in Unix, Mac OS, Windows  networking technologies


Re: Telnet

2002-05-01 Thread Shay Telfer

Just a comment about all this telnetting going on - telnet transmits
information unencrypted. That includes your user name and password.
ssh is a much more secure alternative. Food for thought.


Of course, so does POP, but that doesn't seem to worry most of the world

Have fun,
Shay (Bitter that his ISP turned APOP off, even though he was the 
only person using it :)

--
=== Shay Telfer 
Perth, Western Australia Technomancer It must be bunnies!
Opinions for hire [POQ]
[EMAIL PROTECTED] fnord


Re: Telnet

2002-05-01 Thread Geoff Watts
 Of course, so does POP, but that doesn't seem to worry most of the world

Mmm, and I'd be inclined to think that POP was less secure than telnet,
because the password will (usually) live inside one packet, prepended with
the keyword 'PASS', and is incredibly to sniff off the wire. Or off un
WEP'd airports.

Regards,
g.



Re: Telnet

2002-05-01 Thread Peter N Lewis

At 9:32 +0800 1/5/02, Geoff Watts wrote:

 Of course, so does POP, but that doesn't seem to worry most of the world

Mmm, and I'd be inclined to think that POP was less secure than telnet,
because the password will (usually) live inside one packet, prepended with
the keyword 'PASS', and is incredibly to sniff off the wire. Or off un
WEP'd airports.


Except POP access is commonly local (ie, to your local provider, or 
at worst to your ISP), whereas Telnet access is commonly remote.


APOP and ssh are the solutions to both of these, as well as https and 
ssh tunneling for FTP.


Enjoy,
Peter.

--
http://www.interarchy.com/ ftp://ftp.interarchy.com/interarchy.hqx


Telnet

2002-04-30 Thread Scott
Does anyone know how to make a script to telnet to an IP, authenticate
(login / pass) and then reconnect every 8 hours or whenever the connection
is lost.

Its rather important because its the only thing stopping me from fully using
OSX. I had an applescript that did this with ³MacTelnet² in OS9.

Cheers.


[Non-text portions of this message have been removed]



Re: Telnet Automation in OSX

2002-02-09 Thread hinchlif

On Friday, February 8, 2002, at 02:26 PM, Scott wrote:

 Is terminal scriptable?

Looking at Terminal's AppleScript dictionary it's pretty meagre for what 
you want to do. However, it does have doscript which allows you to run 
a UNIX shell script from within Terminal.

--
Peter Hinchliffe
Apwin Computer Services FileMaker Pro Solutions Developer
Perth, 
Western Australia Phone (618) 9332 6482 Fax (618) 9332 0913

Mac because I prefer it -- Windows because I have to.


[Non-text portions of this message have been removed]



Telnet Automation in OSX

2002-02-08 Thread Scott
Hi all,

Wondering if anyone knows how to automate telnet in OSX?

I made this apple script for 9. And then used chronotask to Reload it every
8 hours.

I need something that will log me in every 8 hours. And if the previous
session is active to logout first.

This is my old script

property MyUserName :  -- substitute your log-in name here
property MyHost :  -- substitute your connection host here
property MyPass : *** -- substitute your password here

on run
tell application MacTelnet
connect to MyHost name my automatically-logged-in connection
delay 3 -- give the connection a chance to open
copy connection 1 to my_connection
-- send AYT to my_connection -- sends ³are you there?²
-- wait for [Yes]
send MyUserName to my_connection with newline -- substitute your
user name here
delay 2 -- give the connection a chance to display pass prompt
send MyPass to my_connection with newline
delay 5 -- give the connection a chance to think
end tell
end run

Is terminal scriptable?

Regards,
Scott Palmer 


[Non-text portions of this message have been removed]



Re: Telnet Automation in OSX

2002-02-08 Thread Onno Benschop

At 14:26 8/02/02 +0800, Scott wrote:

Wondering if anyone knows how to automate telnet in OSX?


[Applescript solution deleted]

You're now running a computer with a real operating system, so you can use 
real tools - things like shell scripts :-)


You could do something *like* this in a shell script; it will loop forever 
and wait until the telnet terminates, then starts it again:


while [true] ; do
telnet
wait
done

What I'm really wondering is what you're attempting with a constantly open 
telnet session. Unless both machines are behind the same firewall and 
you've got control over both and the rest of the network, I wouldn't be 
using telnet in this day and age.

--
()/)/)()..ASCII for Onno..
|?  ..EBCDIC for Onno..
--- -. -. ---   ..Morse for Onno..

ITmaze - ABN: 56 178 057 063 - ph: 04 1219  - [EMAIL PROTECTED]