Commit 05d5a48a authored by Itzhak Daniel's avatar Itzhak Daniel

2nd, Fixed issues when using IP addresses, IPv6 wasn't tested yet. Added some...

2nd, Fixed issues when using IP addresses, IPv6 wasn't tested yet. Added some basic checks for 'module.certview.ip.sh' for people who will use it as a stand-alone.
parent 86536a48
Pipeline #13 skipped
#!/bin/bash
# Source: http://twobit.us/2011/07/validating-ip-addresses/
# Credit: Philip Tricca
#
# usage: ./module.certview.ip.sh <ipv4/ipv6> <IPv4 or IPv6 address to check>
function OPEN() {
if [ -z "$2" ]; then
noarg="1"
fi
if [ "$1" != "ipv4" ] && [ "$1" != "ipv6" ]; then
noarg="1"
fi
if [ "${noarg}" == "1" ]; then
echo -en "Usage examples:\n\n"
echo -en "Check if an IP address is IPv4:\n$0 ipv4 8.8.8.8\n\nCheck if an IP address IPv6:\n$0 ipv6 2001:4860:4860::8888\n"
fi
}
function IS_IPV4() {
QUAD="25[0-5]\|2[0-4][0-9]\|[0-1]\?[0-9]\?[0-9]"
......@@ -71,6 +86,7 @@ function CLOSE() {
fi
}
OPEN ${1} ${2}
MAIN ${1} ${2}
# Disabled, using returned value
#CLOSE
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment