Skip to content

Instantly share code, notes, and snippets.

@cfc1020
Last active June 6, 2020 17:41
Show Gist options
  • Save cfc1020/270a9e3198cebc582304471676b24e75 to your computer and use it in GitHub Desktop.
Save cfc1020/270a9e3198cebc582304471676b24e75 to your computer and use it in GitHub Desktop.
Defanging an IP Address
# @param {String} address
# @return {String}
def defang_i_paddr(address)
address.split('.').join('[.]')
end
# @param {String} address
# @return {String}
def defang_i_paddr2(address)
address.gsub('.', '[.]')
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment