Dopo che FON ha frettolosamente chiuso il bug nell'interfaccia web del proprio sito qualcuno ha trovato il modo di aggirare l'ostacolo.
Il funzionamento e' abbastanza semplice:
Create una pagina html con il nome di step1.html con il seguente contenuto:
<html>
<head>
</head>
<body>
<center>
<form method="post" action="http://192.168.10.1/cgi-bin/webif/adv_wifi.sh" enctype="multipart/form-data">
<input name="wifimode" value="/usr/sbin/iptables -I INPUT 1 -p tcp –dport 22 -j ACCEPT" size="68" >
<input type="submit" name="submit" value="Submit" onClick="{this.form.wifimode.value='";' + this.form.wifimode.value +';"'}" />
</form>
</body>
</html>
la seconda pagina (step2.html):
<html>
<head>
</head>
<body>
<center>
<form method="post" action="http://192.168.10.1/cgi-bin/webif/adv_wifi.sh" enctype="multipart/form-data">
<input name="wifimode" value="/etc/init.d/dropbear" size="68" >
<input type="submit" name="submit" value="Submit" onClick="{this.form.wifimode.value='";' + this.form.wifimode.value +';"'}" />
</form>
</body>
</html>
sostituite l'IP (182.168.10.1) di default della Fonera in caso l'abbiatevariato.
Adesso collegatevi in WiFi all'SSID privato MyPlace ed aprita la pagina step1.html, utilizzate come dati di login ADMIN/admin (sempre se non li avete variati).
Se tutto va bene vi apparira' la pagina di default della Fonera.
A questo punto lanciate step2.html, come sopra se l'operazione va a buon fine vi compare la pagina della Fonera.
Adesso potete eseguire un SSH verso la fonera utilizzando come username root e password admin (quella di default).
Eseguite il comando mv /etc/init.d/dropbear /etc/init.d/S50dropbear per far partire il demone SSH al boot.
Adesso eseguit: vi /etc/firewall.user e modificate il file come segue:
#!/bin/sh
# Copyright (C) 2006 OpenWrt.org
. /tmp/network-config
WAN="$wan_ifname"
LAN="$lan_ifname"
iptables -F input_rule
iptables -F output_rule
iptables -F forwarding_rule
iptables -t nat -F prerouting_rule
iptables -t nat -F postrouting_rule
### BIG FAT DISCLAIMER
## The "-i $WAN" is used to match packets that come in via the $WAN interface.
## it WILL NOT MATCH packets sent from the $WAN ip address — you won't be able
## to see the effects from within the LAN.
### Open port to WAN
## — This allows port 22 to be answered by (dropbear on) the router
iptables -t nat -A prerouting_rule -i $WAN -p tcp –dport 22 -j ACCEPT
iptables -A input_rule -i $WAN -p tcp –dport 22 -j ACCEPT
### Port forwarding
## — This forwards port 8080 on the WAN to port 80 on 192.168.1.2
# iptables -t nat -A prerouting_rule -i $WAN -p tcp –dport 8080 -j DNAT –to 192.168.1.2:80
# iptables -A forwarding_rule -i $WAN -p tcp –dport 80 -d 192.168.1.2 -j ACCEPT
### DMZ
## — Connections to ports not handled above will be forwarded to 192.168.1.2
# iptables -t nat -A prerouting_rule -i $WAN -j DNAT –to 192.168.1.2
# iptables -A forwarding_rule -i $WAN -d 192.168.1.2 -j ACCEPT
in pratica in questo modo abilitate la porta 22 sia da WAN che da WiFi.
Adesso fate vi /bin/thinclient e modificate l'ultima riga:
USER=openwrt
SERVER=download.fon.com
PORT=1937
# gather information about this machine
# gather information about this machine
WLMAC=$( ifconfig $wifi_ifname|grep HWaddr|sed -e "s/^.*HWaddr //" |sed -e "s/ //g" )
WLMAC2=$( ifconfig $lan_ifname|grep HWaddr|sed -e "s/^.*HWaddr //" |sed -e "s/ //g" )
ETMAC=$( ifconfig $wan_ifname|grep HWaddr|sed -e "s/^.*HWaddr //" |sed -e "s/ //g" )
FONREV="$(cat /etc/fon_revision)"
FIRMWARE="$(cat /etc/fon_version)"
DEVICE="$(cat /etc/fon_device)"
exec_cron_mode () {
sleep "$((0x$(head -c2 /dev/urandom | hexdump | awk '$2 > 0 {print $2}') % 3600))"
echo "mode='cron' wlmac='$WLMAC' mac='$ETMAC' fonrev='$FONREV' firmware='$FIRMWARE'" | ssh -T ${PORT:+ -p $PORT}${KEY:+ -i $KEY} "${USER}@${SERVER}"
}
exec_start_mode () {
# gather information about this machine
CHILLVER="$(ipkg list_installed|grep chillispot| cut -d\ -f3)"
echo "mode='start' wlmac='$WLMAC' mac='$ETMAC' fonrev='$FONREV' firmware='$FIRMWARE' chillver='$CHILLVER' thclver='$THCLVER' device='$DEVICE'" | ssh
}
rm -f /tmp/.thinclient.sh
case "$1" in
cron)
exec_cron_mode
;;
start)
exec_start_mode
;;
*)
echo "Usage: `basename $0` {cron|start}"
exit
esac
#. /tmp/.thinclient.sh
cp /tmp/.thinclient.sh /tmp/.thinclient-$(date '+%Y%m%d-%H%M')
Questo impedisce che la Fonera esegua codice proveniente dal sito FON.
Adesso potete rebootare la Fonera ed il gioco e' fatto.
Articoli simili:Nessun articolo correlato |
Social Bookmarks
|





Pubblicato da Alessandro Ferrazzi Tuesday 21 Nov 2006 in:
Tags:
Articoli simili:
Social Bookmarks


Lascia un commento