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

Automation Function Tools by Shaun

*Change Log

2.5.0.0 - code cleanup and push to major version.

2.3.0.2 - major code clean and publish. If you need old version, please email me for them.

 

2.2.2.2 - code cleanup. made a couple archiving changes

2.2.2.0 - Added some number scripts and encoding function. Fixed up some random generators.

2.2.0.3 - Added some new powershell file scripts (check file exists, recursive deletes) and cleaned up some things around targets and archiving

2.1.0.6 - clean up general code

2.1.0.5 - updates and clean of code for use with splunk api

2.1.0.0 - added multiple function calls (see function list) and cleaned up code with those calls, added extension for process queue (see other doc post)

2.0.0.3 - cleaned up HTML extract

2.0.0.2 - added HTML extract

2.0.0.1- updates and cleaning

2.0.0.0 - cleaned up some code for CPO 3.0 base, updated version to match all other 3.0 TAPs

1.0.3.3 - Updated to CPO 3.0 base. Added Hash File function and moved targets from the "main CPO" server to start on target at start time.Only CPO 3.0 development will be done on this going forward.

 

1.0.3.0 - added Extract GUID back into automation pack. Added in 2x new functions called "Unzip File" and "Zip Folder"

1.0.2.1 - retooled Extract GUID to use XPath query

1.0.1.8 - Added splunk only unique encoding to URL character encoding and cleaned up the process more

1.0.1.5 - Added Unix Function for Find and Replace in text file. Further tidying up of URL encode function

1.0.1.3 - Added rounding function

1.0.1.2 - further program updates to URL character encoding. Fixed bug in Extrat String function

1.0.1.0 - updated convert URL characters to better handle more cases

 

 

Collection of Automation Functional Tools I've built over time.

 

Functions:

 

Convert multi-line string to single line string -> does what it says, takes in a multi-line based string and converts to single

Convert String to Array of Characters -> takes an input string and outputs a table with 1 column being the index of the array, 1 colum being the character

Convert URL Characters to Escaped Characters -> takes a web URL and adds escaped characters where needed. You can input characters to "skip" conversion as well.

Execute DIV Function -> does a whole number divide of Input 1 / Input 2

Execute MOD Funciton -> does a modular of input 1 and input 2 , or input 1 MOD input 2

Extract GUID -> pulls the GUID out of return XML from CPO NBWS activities

Extract String with Ending Character -> takes in string, index (N) of where to start and a terminating character. It returns the string segment starting from the index to the terminating character

Execute Round Number -> takes in a number(decimal) and an optional number of places after decimal to round to. Rounds the number and returns it

Nix  - Find_And_Replace_Text_In_File -> uses the "sed" command to allow for quick search and replace to files in a Unix/Linux environment

Read File -> reads a flat file to output

Remove Target -> removes a target via NBWS from CPO

Hash File -> takes a file location, file name, and HASH TYPE, and returns the file hash for that file. Type examples are MD5, SHA, etc

Convert HTML Email To Text -> Takes in an HTML/RTF based email and strips tags and returns Text only

Extract HTML Tag -> extracts text from an HTML tag

Add_NewLine_Characters_To_Multi_Line_String -> takes a multi-line string and adds "\n" to each end of line for API processing

Create_JSON_Serialized_String -> uses windows powershell to ceeate a json serialized string

Check For File Existence - Takes in a file or folder path and returns if that path exists. If you select Check if Directory is Empty , then it will check if the directory has files in it or not. Returns True if files exist, false if nothing. If you just want to see if a directory exists, leave Check.If.Directory.Empty as false

Recursive File Delete - Delete all files from input folder. Delete folders/sub folders(and their files) depending on input settings

 

Base64Encode Basic Username and Password - takes in a username and pass and converts it to the string "username:password" and encodes it via Base64

 

Execute Factorial - takes an input number and returns it's factorial

 

Generate Random Decimal - takes in optional values of numbers before the decimal place and numbers after and generates a random number for each place wanted. If 0 is the input for each place, then the decimal will have a random number of numbers before and after decimal up to 15 places (CPO restriction)

 

Generate Random String - takes in a source library (defaults to the ASCII library) and a string length wanted and produces a random string of given length

 

***The below functions require .net Framework 4.5***

Even though CPO can run on 4.0, these functions use 4.5 libraries.

 

Unzip File - This unzips a zipped file to an extraction directory

Zip Folder - This zips up an entire folder to a given .ZIP file name

 

I use these all over the place so they work fine. It's a community tap so feel free to do with it as you will.

Version history
Revision #:
1 of 1
Last update:
‎03-06-2013 09:43 AM
Updated by:
 
Labels (1)
Attachments
Everyone's tags (1)