Skip to content

Instantly share code, notes, and snippets.

@isaidnocookies
Created April 8, 2021 18:28
Show Gist options
  • Save isaidnocookies/e22bf66eb10aaa13345c81f1cedddb6b to your computer and use it in GitHub Desktop.
Save isaidnocookies/e22bf66eb10aaa13345c81f1cedddb6b to your computer and use it in GitHub Desktop.
#!/bin/bash
# Usage: ./reachable_test.sh <ip> <port>
# EX:
# cat ips.txt | while read ip; do ./checkScript.sh $ip <interesting_port> | tee -a scan.txt; done
if timeout 0.8 nc -z $1 $2 2>/dev/null; then
echo "$1 reachable"
else
echo "$1 not reachable"
fi
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment