Cisco Support Community
cancel
Showing results for 
Search instead for 
Did you mean: 
New Member

Howto: Scripting and parameter passing

Not sure how to troubleshoot scripts.

My first script:

test.bat

copy d:\one.txt d:\two.txt

When I kick off a high level alarm, behold the file two.txt is created due to it being copied from one.txt

Wonderful..... I'm thinking scripting should work.

Script number 2:

test2.bat

del d:\output.txt

echo %1 >> d:\output.txt

echo %2 >> d:\output.txt

.

.

echo %22 >> d:\output.txt

I do this so that I can see the command line parameters being passed to the script.

When I deliberately fire up a HIGH, using the /etc/passwd matching string, here's the data in the output.txt

4

1001863

1013634894

1013616894

2002/02/13

16:14:54

10008

403

15

40

41

42

43

44

45

46

47

48

49

10018630

10018631

10018632

Using the documentation, I can follow all of the fields up until the OrgID.

Why don't I see all the parameters?

I know some of you have successfully deployed perl scripts and the like, and in fact I took one from a previous post in this converstation group... but it's not working.

I started to troubleshoot, and this is what it boils down to. It looks like all of the parameters are not being passed, or not being passed correctly.

Can anyone shed any light?

Thank you

1 REPLY
Cisco Employee

Re: Howto: Scripting and parameter passing

documented in the case notes, but here's the quick and dirty:

This is a quick and dirty script to write all 22 IDS variables passed by CSPM 2.3i to a script if such notifications are enabled. You need to use the dos "shift" command since not all 22 values can be passed and used all at once to a windows batch file. It's not neccessarily pretty, but the information gets there and is seperated by a row of asterisks.

rem edit file location and name to suit your needs

rem save this as somename.cmd

rem call somename.cmd from the notifications setup

rem

rem modify it to suit your needs, this just gets it rem done

rem

echo %1 %2 %3 %4 %5 %6 %7 %8 %9 >> c:\test.txt

for /L %%i IN (1,1,9) DO shift

echo %1 %2 %3 %4 %5 %6 %7 %8 %9 >> c:\test.txt

for /L %%i IN (1,1,9) DO shift

echo %1 %2 %3 %4 >> c:\test.txt

echo ******** >> c:\test.txt

86
Views
0
Helpful
1
Replies
CreatePlease to create content