mirror of
https://github.com/bvanroll/college-pentesting.git
synced 2025-08-29 03:52:43 +00:00
30 lines
507 B
Bash
Executable File
30 lines
507 B
Bash
Executable File
#!/bin/sh
|
|
#
|
|
# $Id: config-dns.sh,v 1.2 2007-10-15 08:26:00 winfred Exp $
|
|
#
|
|
# usage: config-dns.sh [<dns1>] [<dns2>]
|
|
#
|
|
|
|
fname="/etc/resolv.conf"
|
|
fbak="/etc/resolv_conf.bak"
|
|
|
|
# in case no previous file
|
|
touch $fname
|
|
|
|
# backup file without nameserver part
|
|
sed -e '/nameserver/d' $fname > $fbak
|
|
|
|
# set primary and seconday DNS
|
|
if [ "$1" != "" ]; then
|
|
echo "nameserver $1" > $fname
|
|
else # empty dns
|
|
rm -f $fname
|
|
fi
|
|
if [ "$2" != "" ]; then
|
|
echo "nameserver $2" >> $fname
|
|
fi
|
|
|
|
cat $fbak >> $fname
|
|
rm -f $fbak
|
|
|