Welcome to the VanDyke Software Forums

Join the discussion today!


Go Back   VanDyke Software Forums > Scripting

Notices

Reply
 
Thread Tools Rate Thread Display Modes
  #1  
Old 01-07-2013, 12:12 PM
francc francc is offline
Registered User
 
Join Date: Nov 2012
Posts: 3
perl script convert for using secure crt?

Hey all.

I have here a script form a collegue, how is using this script on cisco routers.
I need to adapt of course this script for Heuwai routers.

At the moment i am strugling to get secure crt to read the scritp.

I can provide some of the script, not all of it.

Here are some examples on how the script starts:

Code:
use strict;
use Net::SSH2;

code of the script....

close (LOG);
print "\nEnd.\n";
exit;
This script reads from a ip list, scans command list and sets the output to a txt file.
I get the following error in secure crt (version: Version 6.2.1 (build 215) ):

Code:
Unable to determine script engine from file extension and no #$language script header found.
Well, i am a scrpit noob, but not that noob
i have used one of the examples, and added:
Code:
# $language = "PerlScript"
# $interface = "1.0"
As headers. It provided me a error that it could not read the script.

This let me think that the script is or writed on a linux host, and used in a linux host.
Other option, is that it is writed on a cisco host, and used in a cisco envoriment (i suspect the latest).

Is there a way to convert this to a working crt script?
I can read the script, and understand it, but i cannot code (no experience in coding).
Is it possile using a existing perl script, remove the content of that script, copy my script to this file, and run the script?


Or has secure crt a other way of handling perl scripts?
What advise can i follow in this issue?
Reply With Quote
  #2  
Old 01-07-2013, 12:38 PM
rtb rtb is offline
VanDyke Technical Support
 
Join Date: Aug 2008
Posts: 4,305
Hi francc,

Thanks for the question. The script snippet you posted doesn't look like a script for SecureCRT. Without seeing the script code, I can't really say what is possible. It seems likely that you could convert the script to use SecureCRT specific scripting API calls, but this may be more trouble than just writing a new script. Since you are not familiar with coding, you may want to take a look at the scripting manual at the following location:
http://www.vandyke.com/support/tips/...ing/index.html
The scripting manual is in VBScript, but it does illustrate how to use the SecureCRT scripting API, and it also illustrates how to accomplish real world goals which you could adapt to your specific scenario.

To run a PerlScript from within SecureCRT it will be necessary to ensure that an ActiveX scripting engine for the language of the script is installed.

It is also important to make sure that the ActiveX script engine is the same bitness (32-bit or 64-bit) as the version of SecureCRT installed.

Does this help to answer your question?
__________________
--Todd

VanDyke Software
Technical Support
support@vandyke.com
505-332-5730
Reply With Quote
  #3  
Old 01-07-2013, 12:59 PM
francc francc is offline
Registered User
 
Join Date: Nov 2012
Posts: 3
thank you for the reply.
system is 64 bit, the version of crt that i use is 32 bits. no problems in any other things. I already have created a script in vb based on examples here on the forum. That was a simple import script (import ips from ip list to secure crt).

This was done in vb.

The script that i have now, is writen in perl.
The structure of the script:

name of the script: display.pl
it reads the following files:

config.txt
iplist.txt
displaycommands.txt

It writes all the information gathered from the sessions to a *.txt
I can send it to you if it is possible, so you can evaluate the script.
I have found here in the board also other scripts in vb and perl for the task that i need (and this is a nice clean scirpt). However, they where to complicated for the simple task it needs to do (health check on +2000 deviced, each day, mounth and week, depending on the task).

My idea was using a simple (loaded in taskmanager) batch file to load the nessecary script, on the day it needs to be run. I can use the same script. The only thing i need to do, is change the displaycommands.txt for the appropiate commands. And of course, change the display.pl to something else to avoid confussing.
Reply With Quote
  #4  
Old 01-07-2013, 04:02 PM
rtb rtb is offline
VanDyke Technical Support
 
Join Date: Aug 2008
Posts: 4,305
Hi francc,

Thanks for the update. It sounds like you are well on your way to writing a script that will meet your specific needs. If you encounter any specific questions about how to use the SecureCRT scripting API along the way, please let us know.

Additionally, if you are not familiar with scripting, please take a chance to take a look at the scripting manual from beginning to end. It has lots of information that can be helpful in illustrating basic scripting concepts. Chapter 7 specifically talks about reading files which may be helpful and chapter 2.2 talks about passing arguments which is a way that you could write one script and pass in an argument for what action to perform.
__________________
--Todd

VanDyke Software
Technical Support
support@vandyke.com
505-332-5730
Reply With Quote
  #5  
Old 09-18-2014, 02:27 PM
juniorguy juniorguy is offline
Registered User
 
Join Date: Sep 2014
Posts: 1
Hi Franc

Can you provide me with the perl script that you have without having your IP address details in the script? It would be very helpful as I am relying upon such a script for day to day work.
Reply With Quote
Reply

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 03:57 PM.