Build precise queries to find exactly what you need
Press ESC to close
@networkshark
Favorites0
Views
Projects0
I removed ipcalc from the code and replaced it with regex, because ipcalc gave errors of missing parameters. ----- CODE ----- [...] # Variables definition # my PID mypid="$$" html_tmp="/tmp/tmp_html.$mypid" rep_tmp="/tmp/tmp_rep.$mypid" add_uri='https://' end_uri='/' PORT='' exit_code=2 regexIPv4="^[0-9]{1,3}.[0-9]{1,3}.[0-9]{1,3}.[0-9]{1,3}$" regexIPv6=".*:.*" [...] # Give some brain to this script. Detect yourself if we are checking an hostname, an ipv4 or an ipv6 if [[ $1 =~ $regexIPv4 ]] then target=ipv4 elif [[ $1 =~ $regexIPv6 ]]; then target=ipv6 else # we consider here cases in which the passed argument is DNS name target=DNS fi [...] ----- CODE -----
Reviewed 5 years ago