Showing results for 
Search instead for 
Did you mean: 
Shaun Roberts
Cisco Employee
Cisco Employee

*Change Log - code cleanup and push to major version. - major code clean and publish. If you need old version, please email me for them. - code cleanup. made a couple archiving changes - Added some number scripts and encoding function. Fixed up some random generators. - Added some new powershell file scripts (check file exists, recursive deletes) and cleaned up some things around targets and archiving - clean up general code - updates and clean of code for use with splunk api - added multiple function calls (see function list) and cleaned up code with those calls, added extension for process queue (see other doc post) - cleaned up HTML extract - added HTML extract updates and cleaning - cleaned up some code for CPO 3.0 base, updated version to match all other 3.0 TAPs - 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. - added Extract GUID back into automation pack. Added in 2x new functions called "Unzip File" and "Zip Folder" - retooled Extract GUID to use XPath query - Added splunk only unique encoding to URL character encoding and cleaned up the process more - Added Unix Function for Find and Replace in text file. Further tidying up of URL encode function - Added rounding function - further program updates to URL character encoding. Fixed bug in Extrat String function - updated convert URL characters to better handle more cases



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




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.

Getting Started

Find answers to your questions by entering keywords or phrases in the Search bar above. New here? Use these resources to familiarize yourself with the community:

Recognize Your Peers