Script configurasi in Slackware
#!/usr/bin/bash
#./coba
######################################################
# my name : xxxxxxxx #
# contact version : xxxxxxxxxxxxxxxxxxxxxxxxxxxx #
# AUTHOR : d4dy #
######################################################
# aktikan /etc/hostapd.conf
d4dy='y'
while [ $d4dy == 'y' ] || [ $d4dy == 'Y' ];
do
clear
tput cup 2 10
echo -e "\033[5m\033[44m MENU MAKANAN SLACKWARE \033[0m";
tput cup 3 10
echo "0. Application Terminate";
tput cup 4 10
echo "1. configurasi hostapd";
tput cup 5 10
echo "2. configurasi dhcp_server";
tput cup 6 10
echo "3. configurasi wpa_supplicant";
tput cup 7 10
echo "4. share connect internet";
tput cup 8 10
echo "5. starting samba,sshd,httpd";
tput cup 9 10
echo "6. exit";
tput cup 9 10
tput cup 11 15
read -p "tentukan pilihan anda : " pil;
if [ $pil -eq 0 ];
then
/etc/rc.d/rc.hostapd stop
/etc/rc.d/rc.sshd stop
/etc/rc.d/rc.samba stop
/etc/rc.d/rc.httpd stop
clear
elif [ $pil -eq 1 ];
then
touch /etc/hostapd/hostapd.conf
cd /etc/hostapd/
rm hostapd.conf
tput cup 12 15
read -p "aktifkan interface : " if;
tput cup 13 15
read -p "password wpa : " wpa;
tput cup 14 15
read -p "name hostpot : " host;
echo -e "interface=$if" >> hostapd.conf
echo -e 'driver=nl80211' >> hostapd.conf
echo -e "ssid=$host" >> hostapd.conf
echo -e 'country_code=ID' >> hostapd.conf
echo -e 'hw_mode=g' >> hostapd.conf
echo 'channel=1' >> hostapd.conf
echo 'auth_algs=1' >> hostapd.conf
echo -e 'ignore_broadcast_ssid=0' >> hostapd.conf
echo -e 'wpa=3' >> hostapd.conf
echo -e "wpa_passphrase=$wpa" >> hostapd.conf
echo -e 'wpa_pairwise=TKIP' >> hostapd.conf
echo -e 'rsn_pairwise=CCMP' >> hostapd.conf
hostapd -B -P /var/run/hostapd.pid /etc/hostapd/hostapd.conf
clear
elif [ $pil -eq 2 ];
then
touch /etc/dhcpd.conf
cd /etc/
rm dhcpd.conf
tput cup 12 15
read -p "interface : " face;
echo -e 'option domain-name-servers 192.168.0.1;' >> dhcpd.conf
echo -e 'default-lease-time 600;' >> dhcpd.conf
echo -e 'max-lease-time 7200;' >> dhcpd.conf
echo -e 'ddns-update-style none;' >> dhcpd.conf
echo -e 'subnet 192.168.0.0 netmask 255.255.255.0 {' >> dhcpd.conf
echo -e 'range 192.168.0.100 192.168.0.229;' >> dhcpd.conf
echo -e 'option broadcast-address 192.168.0.255;' >> dhcpd.conf
echo -e 'option routers 192.168.0.1;' >> dhcpd.conf
echo -e '}' >> dhcpd.conf
dhcpd -cf /etc/dhcpd.conf $face
clear
elif [ $pil -eq 3 ];
then
cd /etc
rm wpa_supplicant.conf
touch /etc/wpa_supplicant.conf
tput cup 12 15
read -p "name wpa(hostpot) : " host;
tput cup 13 15
read -p "key wpa(password) : " pass;
tput cup 14 15
read -p "interface : " if;
echo -e 'ctrl_interface=/var/run/wpa_supplicant' >> wpa_supplicant.conf
echo -e 'ctrl_interface_group=0' >> wpa_supplicant.conf
echo -e 'eapol_version=1' >> wpa_supplicant.conf
echo -e 'ap_scan=1' >> wpa_supplicant.conf
echo -e 'fast_reauth=1' >> wpa_supplicant.conf
echo -e 'network={' >> wpa_supplicant.conf
echo -e 'scan_ssid=0' >> wpa_supplicant.conf
echo -e "ssid="$host"" >> wpa_supplicant.conf
echo -e 'proto=WPA RSN' >> wpa_supplicant.conf
echo -e 'key_mgmt=WPA-PSK' >> wpa_supplicant
echo -e 'pairwise=CCMP TKIP' >> wpa_supplicant.conf
echo -e 'group=CCMP TKIP WEP104 WEP40' >> wpa_supplicant
echo -e "psk="$pass"" >> wpa_supplicant.conf
echo -e 'priority=10' >> wpa_supplicant.conf
echo -e '}' >> wpa_supplicant.conf
echo -e 'network={' >> wpa_supplicant.conf
echo -e 'key_mgmt=NONE' >> wpa_supplicant.conf
echo -e 'priority=0' >> wpa_supplicant.conf
echo -e '}' >> wpa_supplicant.conf
wpa_supplicant -i $if -c /etc/wpa_supplicant.conf
clear
elif [ $pil -eq 4 ];
then
tput cup 12 15
read -p "interface : " iface;
ifconfig $iface up
echo 1 > /proc/sys/net/ipv4/ip_forward
iptables -F
iptables -t nat -F
iptables -t nat -A POSTROUTING -s 192.168.1.0/24 -j MASQUERADE
iptables -A FORWARD -s 192.168.1.0/24 -j ACCEPT
elif [ $pil -eq 5 ];
then
/chmod 755 /etc/rc.d/rc.hostapd
/chmod 755 /etc/rc.d/rc.sshd
/chmod 755 /etc/rc.d/rc.samba
/chmod 755 /etc/rc.d/rc.httpd
/etc/rc.d/rc.hostapd start
/etc/rc.d/rc.sshd start
/etc/rc.d/rc.samba start
/etc/rc.d/rc.httpd start
clear
elif [ $pil -eq 6 ];
then
tput cup 12 15
echo -e "\033[5m\033[44m Loading... \033[0m";
tput cup 12 15
read -p "tekan enter untuk keluar : ";
exit 0
else
tput cup 13 15
echo "pilihan anda salah";
exit 1
fi
echo
tput cup 14 15
echo -e "\033[5m\033[44m thanks for user \033[0m";
tput cup 12 15
echo -n "back to configurasi (y/t) :";
read d4dy
while [ $d4dy != 'y' ] && [ $d4dy != 'Y' ] && [ $d4dy != 't' ] && [ $d4dy != 'T' ];
do
tput cup 13 15
echo "maaf,isi lagi bro (y/Y/t/T)";
tput cup 14 15
echo -n "kembali lagi (y/t)";
read d4dy;
done
done
script cupuku
Categories: Pemrograman, Slack|Ware
Komentar (0)
Lacak Balik (0)
Tinggalkan Komentar
Lacak balik