Telnet script ( probably ot )

Telnet script ( probably ot )

Postby MarcoBoschi » Thu Nov 25, 2010 10:16 am

Hi,
is it possible from a Fivewin program tu run a script like this?
telnet xxx.xxx.xxx.xxx
user admin
password admin
<command1>
<command2>
<command3>
<command4>
<command5>
EXIT
or alternatively run telnet passing a script as a parameter as this sample in ftp
ftp -s:sendfile.ftp


sendfile.ftp
open xxx.xxx.xxx.xxx
admin
admin
<command1>
<command2>
<command3>
<command4>
<command5>
BYE


Thank in advance
User avatar
MarcoBoschi
 
Posts: 1066
Joined: Thu Nov 17, 2005 11:08 am
Location: Padova - Italy

Re: Telnet script "Solved"

Postby MarcoBoschi » Mon Nov 29, 2010 5:15 pm

I send these commands and ...it works fine!
...
...
oTelnet := TSocket():New( nPort )
oTelnet:Connect( cIp )
oTelnet:lDebug := .T.
syswait(1)
oTelnet:GetData()
syswait()
oTelnet:SendData( "admin" + crlf )
SysWait(1)
oTelnet:GetData()
SysWait()
oTelnet:SendData( "admin" + crlf ) // user
oTelnet:SendData( "12345" + crlf ) // password
SysWait(1)
oTelnet:SendData( cComando + crlf )
SysWait()
....
and so on...
User avatar
MarcoBoschi
 
Posts: 1066
Joined: Thu Nov 17, 2005 11:08 am
Location: Padova - Italy

Re: Telnet script ( probably ot )

Postby Rolaci » Tue Dec 20, 2011 2:33 pm

Hi Marco, I´m wondering how can i put the feedback with the eventual terminal in my own window/dialog.
In my case, i´m working with a vms session and trying to automate some things, but with your example the session
is "blind". I hope you understand...
Regards.
Roberto.
Rolaci
 
Posts: 20
Joined: Fri Dec 16, 2011 4:17 pm

Re: Telnet script ( probably ot )

Postby MarcoBoschi » Wed Dec 21, 2011 1:46 pm

In this way
cData := oTelnet:GetData()
you assign to cData variable the content
then you can treat it as a normal variable
User avatar
MarcoBoschi
 
Posts: 1066
Joined: Thu Nov 17, 2005 11:08 am
Location: Padova - Italy


Return to FiveWin for Harbour/xHarbour

Who is online

Users browsing this forum: No registered users and 18 guests

cron