Check which ports are open to the outside world. Helps make sure that your firewall rules are working as intended.
One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.
<!--- always sort first so the ranges make sense ---> <cfset numbers = listToArray("1,2,3,4,6,7,8,9,10,11,12,15,19,21,22")> <cfset arraySort(numbers, "numeric")> <cfset startAt = 1> <cfset maxPosition = arrayLen(numbers)> <cfset ranges = > <cfloop from="1" to="#maxPosition#" index="pos"> <!--- check difference between current and next number ---> <cfset offset = pos lt maxPosition ? 1 : 0> <cfset gap = numbers[pos+offset] - numbers[pos]> <!--- there was a jump in sequence OR this is the last element ---> <cfif gap gt 1 OR pos eq maxPosition> <cfif startAt lt pos> <!--- range ---> <cfset arrayAppend(ranges, numbers[startAt] &"-"& numbers[pos])> <cfelse> <!--- single value ---> <cfset arrayAppend(ranges, numbers[pos])> </cfif> <cfset startAt = pos + 1> </cfif> </cfloop> List of Ranges: <cfdump var="#arrayToList(ranges, ',')#">