Welcome to the VanDyke Software Forums

Join the discussion today!


Go Back   VanDyke Software Forums > Scripting

Reply
 
Thread Tools Rating: Thread Rating: 4 votes, 3.00 average. Display Modes
  #1  
Old 07-08-2005, 01:59 PM
kbduvall kbduvall is offline
Registered User
 
Join Date: Jul 2005
Posts: 4
ProgID

I am looking to find the Program ID for Secure CRT. I am trying to use the CreateObject function (object.CreateObject(strProgID[,strPrefix]) ) so I can do some more advanced scripting but I haven't been able to find the ProgID. Can anyone help?
Reply With Quote
  #2  
Old 07-08-2005, 06:53 PM
jdev's Avatar
jdev jdev is offline
VanDyke Technical Support
 
Join Date: Nov 2003
Location: Albuquerque, NM
Posts: 1,039
Can't create a SecureCRT object...

SecureCRT is not registered as an ActiveX object and, as such, there isn't a Program ID that can be used to control SecureCRT from the "outside". More detailed information as to why this is the case can be found here and there, but in summary, it isn't possible to create a SecureCRT object using CreateObject() because SecureCRT doesn't expose it's scripting interface to other applications.

Although this is a capability that we have considered adding to SecureCRT, it isn't currently on the development roadmap. If you'd like to be notified personally should a version of SecureCRT become available that allows you to do this, please send a note to support@vandyke.com referencing this forum post.

There might be a way to accomplish your goals some other way... can you provide more details as to what you are looking to do?
__________________
Jake Devenport
VanDyke Software
Technical Support
YouTube Channel: https://www.youtube.com/vandykesoftware
Email: support@vandyke.com
Web: https://www.vandyke.com/support
Reply With Quote
  #3  
Old 07-08-2005, 07:06 PM
kbduvall kbduvall is offline
Registered User
 
Join Date: Jul 2005
Posts: 4
I made a .vbs script to pull data from a server VIA SecureCRT, as well as pull data from another source VIA an XML feed. It then formats it all, runs some checks through it, and displays the important information consolidated and easier to read, in a dynamicly created web page that is ran on the local machine.

There are certain cases when depending on the data received from the XML feed, we may or may not want to change something on our server VIA SCRT. Because VBS is server side, you can't "store" functions or actions into a web page for later/delayed use. So it prevents me with a major road block when I try to make buttons that will give the user the option of automaticly changing this value. And due to the software enviornment that the users will be working in, it makes it really difficult to accompliosh the same goal any other way. Until I have a better means, I am restricted to creating a solution VIA VBScript, SCRT, HTML, XML, JScript etc etc.

lol I don't know if I articulated that well enough.

Any help would be grateful.
Reply With Quote
  #4  
Old 07-08-2005, 08:11 PM
jdev's Avatar
jdev jdev is offline
VanDyke Technical Support
 
Join Date: Nov 2003
Location: Albuquerque, NM
Posts: 1,039
If I understand your situation correctly, you need to use SecureCRT from within ASP to make a change on a remote machine using a value specified by a visitor connected to the ASP page via a web browser.

Is this correct?

Which protocol is being used to connect (Telnet, SSH1, SSH2) ?

How difficult is the task that needs to be accomplished using SecureCRT?

Have you considered creating a separate script (stored on the server side's filesystem) designed specifically to make the necessary change from within SecureCRT?

SecureCRT's /SCRIPT and /ARG command line parameters might be useful in your situation.

Let's say that I have such a "MakeTheNecessaryChanges.vbs" script, that expects an argument to be provided (which argument is supplied by the individual via the web/ASP page).

From within the ASP page, I could launch SecureCRT.exe using a command line similar to what the following example portrays:
<%
On Error Resume Next
Set server_shell = Server.CreateObject("wscript.shell")
If Err.Number <> 0 then
Response.Write "Error: " & Err.Number & ": " & Err.Description
end if

szCmd = """C:\Program Files\SecureCRT\SecureCRT.exe"""
szArgs = " /F C:\SecureCRT\Config " & _
" /SCRIPT ""C:\MakeTheNecessaryChanges.vbs""" & _
" /ARG " & nArg1FromForm & _
" /ARG " & nArg2FromForm

nResult = server_shell.Run(szCmd & szArgs, 0, true)
If Err.Number <> 0 then
Response.Write "Error: " & Err.Number & ": " & Err.Description
else
Response.Write "Success running .exe!" & vblf
end if

if nResult <> 0 then
Response.Write "Error: Unable to complete changes: " & nResult
end if
%>
Then from within your MakeTheNecessaryChanges.vbs script, you would connect to the remote machine and use the crt.Arguments object to access the data passed in via the /ARG command line options. For hypothetical example:
crt.Session.Connect "/S session_name"
szArg1 = crt.Arguments(0)
szArg2 = crt.Arguments(1)
' Do work with szArg1 and szArg2
...
crt.Session.Disconnect
crt.Quit
Would something like this setup work in your situation?
__________________
Jake Devenport
VanDyke Software
Technical Support
YouTube Channel: https://www.youtube.com/vandykesoftware
Email: support@vandyke.com
Web: https://www.vandyke.com/support
Reply With Quote
  #5  
Old 07-11-2005, 02:46 PM
kbduvall kbduvall is offline
Registered User
 
Join Date: Jul 2005
Posts: 4
Thank you for your response.

We are connecting VIA SSH2

It's not being run on a web server however. In this case, it is actually being run using straight VBScript from a local .vbs file. The html output is a generated html page, generated on the local users machine so I don't have the advantage of ASP server functionality unless I wanted to install and configure IIS/ASP on every machine that ran this script, which would be un-feasable.

The reason I am having difficulty running from a web server, is because the functions I need to pull data from SCRT are all built into the SCRT API. Using MS WSH, I can send data to SCRT, but I haven't found a way to listen to the output; so I still need the SCRT API functions.

Heres what it does, in a very basic way.

User maps a key to the scripts path.
They use that mapped key, and SCRT pops up a dialog and asks for a phone number/account number

Then it looks up that number on our server. It pulls allot of data from that server before it pulls data from other servers VIA XML. So it may receive data like this:

line blah
customers name blah
Attached equipment is ___something___

All this data comes from a database. Then the script pulls data from a poller we have that polls real time data from the customer and may return something like..

Attached equipment is ___Something Else___
Being polledreal time, this value would be the correct value and we would need to change this value on our server through SCRT by sending a command IE:

change attached equipment new-id=___Something Else___

Now both data sources are synced up. The only way I have to do this right now is by popping up a yes/no dialog via SCRTs API asking the user if they want to change this data now. I would like to instead, create a button or something on the output HTML which gives them the option instead of interrupting the data pulling process to ask them. There are many other functions that I need the same functionality for, so if I can find a way, it will solve many of my issues.

I really appreciate your help.

Keith
Reply With Quote
  #6  
Old 07-11-2005, 03:01 PM
kbduvall kbduvall is offline
Registered User
 
Join Date: Jul 2005
Posts: 4
Heres some of the code:

'//aggr = the Databases value
'//cmts = the live value
'//sbar = the status bar of the HTML output
'//extract() is a function to pull values from keys that are in a key=value format where "=" can be a " : ", "=", or a " -> "

If Trim(UCase(cmts)) <> Trim(UCase(aggr)) Then
If (MsgBox("Warning, there is a CMTS Mismatch." & nl() & "The AGGR_ID should be changed to " & cmts & nl() & _
"Would you like me to do this now?", 4, "CMTS Mismatch") = 6) Then
cscreen
'//if user clicked yes: Send the command to SCRT to change the value
echo "change mgw id=" & mgw & ";AGGR_ID=" & cmts & nl()
'//Wait for the prompt
If crt.screen.WaitForString("CLI>", 5) Then
'//Check to see if the command processed correctly and the change was good
If extract("Reply") = "Success: CLI change successful" Then
'//color a module in the output green, for good
aggrRBG = green
cmtsRBG = green
aggr = Trim(UCase(cmts))
MsgBox "The AGGR_ID for " & mgw_id & " was successfully changed from " & aggr & " to " & cmts, 0
Else '//The command did not complete successfully
'//color a module in the output red, for bad
aggrRBG = red
cmtsRBG = red
'//Put a warning in the status bar of the output
sbar = "<font color=\'red\'>- CMTS MISMATCH! -</font>" & sbar
MsgBox "There was an error attempting to make the change. Please manualy change this.", 0
End If
Else '//If the prompt didnt' come back in the allotted time
'//Color fields green because existing problem is unknown
aggrRBG = green
cmtsRBG = green
'//Suggest the user manually checks change status
MsgBox "There was a timeout waiting for the BTS to respond. Please check to make sure the change was successful.", 0
End If
Else '//User clicked no when prompted to change incorrect data
'//Color red for bad
aggrRBG = red
cmtsRBG = red
sbar = "<font color=\'red\'>- CMTS MISMATCH! -</font>" & sbar
End If
Else '//Was not a mismatch, no problem found
'//Color field green for good
aggrRBG = green
cmtsRBG = green
End If
Reply With Quote
  #7  
Old 01-15-2006, 08:32 PM
S122 S122 is offline
Registered User
 
Join Date: Jan 2006
Posts: 2
ProgID with a batch file

First of all, try this in windows; run 'cmd' and 'tasklist', u'll see all the programs running, and all the 'PID' or 'ProgID'. Then you could create a batch file like this;

@echo off
Tasklist /FI "Windowtitle eq Name - SecureCRT" > PID.txt
EXIT

The result will be a text file with your info. And finally add some lines to your script to read that text file.
Reply With Quote
  #8  
Old 02-20-2006, 06:43 PM
jdurrett jdurrett is offline
Registered User
 
Join Date: Jul 2005
Location: Dallas, Texas
Posts: 57
Send a message via Yahoo to jdurrett
Tasklist - XP Pro

Unfortunatly, Tasklist is an XP Pro OS command only.
Reply With Quote
  #9  
Old 05-04-2007, 08:45 AM
Chaucer Chaucer is offline
Registered User
 
Join Date: Jun 2005
Posts: 52
Where any of the newer securecrt programs ever registered as an activex object so that createobject could be used?
Reply With Quote
  #10  
Old 05-04-2007, 11:39 AM
jjh jjh is offline
VanDyke Customer Support
 
Join Date: Feb 2004
Posts: 815
Hello Chaucer.

We don't currently offer an external API for any of our
products, but I have created an entry for you in our feature
request database. We will post something here, should we
release versions of our products that expose a scripting
interface. If you would like to be informed via e-mail,
please send a message to us referencing this forum thread.

Thank you

JJH

Last edited by jdev; 05-04-2007 at 07:55 PM.
Reply With Quote
  #11  
Old 12-21-2009, 07:06 PM
Maureen's Avatar
Maureen Maureen is offline
VanDyke Product Director
 
Join Date: Feb 2004
Location: Albuquerque, NM
Posts: 1,591
I wanted to let you know that an SSH2 API is available in the VanDyke ClientPack. This API allows the following types of operations to be scripted
through a COM or .NET interface:
  • Full control over SSH2 connections, including getting the ident string, specifying authentication methods and proxy/firewall settings, etc.
  • Sending a command to an SSH2 server and getting the output produced by the command
  • Tunneling/port forwarding
  • File transfers using SFTP
  • Remote file management, such as controlling file access or retrieving file attributes
  • Adding hostkeys to a hostkey datbase
  • Adding keys to the SSH2 authentication agent
At this time, the API does not support terminal emulation.

The API functions can be called from VBScript, C++, or any scripting platform that supports COM.

If you would be interested in trying the API, you can download the VandDyke Software ClientPack from the following web page.

http://www.vandyke.com/download/clie.../download.html

If you try it, please e-mail me at Maureen.Jett@vandyke.com to let me know how it works for you and if there's additional functionality you would like to see added.

Maureen
Reply With Quote
Reply


Currently Active Users Viewing This Thread: 1 (0 members and 1 guests)
 
Thread Tools
Display Modes Rate This Thread
Rate This Thread:

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 On
HTML code is Off

Forum Jump


All times are GMT -6. The time now is 09:50 AM.