-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathnc-test.sh
More file actions
executable file
·52 lines (46 loc) · 829 Bytes
/
nc-test.sh
File metadata and controls
executable file
·52 lines (46 loc) · 829 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
src_net_num=`ifconfig | grep "inet 192.168." | awk '{print $2}' | awk -F'.' '{print $3}'`
dest_ip=$1
dest_net_num=`echo $dest_ip | awk -F'.' '{print $3}'`
case $src_net_num in
"99")
src_net="Secure"
;;
"10")
src_net="Home"
;;
"20")
src_net="Gaming"
;;
"0")
src_net="Management"
;;
"100")
src_net="Public"
;;
*)
echo "Unable to determine source network"
;;
esac
case $dest_net_num in
"99")
dest_net="Secure"
;;
"10")
dest_net="Home"
;;
"20")
dest_net="Gaming"
;;
"0")
dest_net="Management"
;;
"100")
dest_net="Public"
;;
*)
echo "Unable to determine destination network"
;;
esac
echo "${src_net} --> ${dest_net}"
echo "Attempting to connect to ${dest_ip}:${2}"
echo "from ${src_net}" | nc -v -G3 $1 $2