ViewVC Help
View File | Revision Log | Show Annotations | Download File | View Changeset | Root Listing
root/repos/FreeBSDAdmin/VPN/recon.sh
Revision: 869
Committed: 2006-10-31T23:16:58-08:00 (18 years, 8 months ago) by douglas
Content type: text/x-sh
File size: 952 byte(s)
Log Message:
Recon!

File Contents

# User Rev Content
1 douglas 869 #!/usr/local/bin/bash
2     # Recon
3     #
4     # Douglas Thrift
5     #
6     # $Id$
7    
8     declare -a interfaces locals remotes
9    
10     while read interface local remote; do
11     interfaces[${#interfaces[@]}]=$interface
12     locals[${#locals[@]}]=$local
13     remotes[${#remotes[@]}]=$remote
14     done < ~/recon.dat
15    
16     function address()
17     {
18     host $1 | sed -Ee 's/^.* has address ([0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3})$/\1/p;d'
19     }
20    
21     for ((index = 0; index != ${#interfaces[@]}; ++index)); do
22     interface=${interfaces[$index]}
23    
24     eval `grep "^gifconfig_$interface=" /etc/rc.conf | sed -Ee "s/^gifconfig_$interface=\"([0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}) ([0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3})\"$/declare old_local=\1 old_remote=\2/p;d"`
25    
26     new_local=`address ${locals[$index]}`
27     new_remote=`address ${remotes[$index]}`
28    
29     if [[ $old_local != $new_local ]] || [[ $old_remote != $new_remote ]]; then
30     echo 'Here!'
31    
32     if [[ $old_remote != $new_remote ]]; then
33     echo 'There!'
34     fi
35     fi
36     done

Properties

Name Value
svn:executable *
svn:keywords Id