Wifiweasel

From Openmoko

(Difference between revisions)
Jump to: navigation, search
(iwscan bash)
(iwscan bash)
Line 52: Line 52:
 
[[category:Technical ]]
 
[[category:Technical ]]
 
[[category:GTA02 Hardware]]
 
[[category:GTA02 Hardware]]
====iwscan bash====
+
====/bin/sh====
 
(Not Finished)
 
(Not Finished)
 
<pre>  
 
<pre>  
 
#!/bin/sh
 
#!/bin/sh
 +
 +
  #####################
 +
###########################
 +
#/var/wifi/hacker/kd8ikt###
 +
# OMG i'm programming now!#
 +
###########################
 +
###we.trekbeyond.org#######
 +
  #####################
 +
        #KISS#
 +
 +
######wireless interface
 +
IFACE=eth0
 
#
 
#
# Kd8ikt
+
####host to do ping test
 +
HOST=myspace.com
 
#
 
#
 +
## heh ping flood the noobs
 
#
 
#
# grab a list of line seperated open AP's
+
# Func.iwlist.open
for AP in $(
+
##########################
iwlist eth0 scanning \
+
Func_iwlist_open() {
 +
iwlist $IFACE scanning \
 
| awk -F '[ :=]+' '/(ESS|Freq|Qual)/{ printf $3" " } /Encr/{ print $4 }' \
 
| awk -F '[ :=]+' '/(ESS|Freq|Qual)/{ printf $3" " } /Encr/{ print $4 }' \
 
|sort -k4 -k3nr \
 
|sort -k4 -k3nr \
 
|grep off \
 
|grep off \
|awk '{print $1}'
+
|awk '{print $1}' }
);
+
###########################
  do
+
# /Func.iwlist.open
echo $AP
+
###########################
break;
+
#   Func.chk.net (needs reworked) its bad code so speedevil tells me and i'm starting to see it
done;
+
###########################
# $AP is a line separated list of open (free) accesspoints
+
#
+
#
+
#needs more logic?  (connect) while net works do nothing ifnot goto next $AP ? ideas?
+
# ifconfig eth0 essid $AP
+
# udhcpc eth0
+
 
+
 
+
#
+
# is net on/working?
+
 
#  w00t=yes  FAIL=no
 
#  w00t=yes  FAIL=no
 
 
HOSTTT="google.com"
 
HOSTTT="google.com"
 
for Hosts in $HOSTTT
 
for Hosts in $HOSTTT
Line 97: Line 101:
 
echo "w00t"
 
echo "w00t"
 
   fi
 
   fi
 
+
#
done
+

Revision as of 07:54, 22 July 2008

script to Auto connect to Open wirelss 81102 AP's

Contents

TODO

  • determine AP without encryption and sort by best signal
  • using essid of best signal perform connect/udhcpc and chknet every so often

if net is down repeat

  • put it all together

sandbox

iwscan perl

#!/usr/bin/perl
# Tim Osburn - tim@osburn.com
#
# install perl

$iwlist = "/sbin/iwlist eth0 scanning";

open scan, "$iwlist |";
while (<scan>) {
  if (/^\s+Cell (\S+) - Address: (\S+)/) {
    $CELL=$1;
    $ADDRESS=$2;
    # print "$1 $2";
    $INLOOP=1;
    }
  if (/^\s+ESSID:(\S+)/) {
    $ESSID=$1;
    print " $1";
    }
  if (/^\s+Frequency:\S+ \S+ \(Channel (\S+)\)/) {
    $CHAN=$1;
    print " $1";
    }
  if (/^\s+Quality=\S+\s+Signal level=(\S+).*/) {
    $SIGNAL=$1;
    print " $1";
    }
  if (/^\s+Encryption key:(\S+)/) {
    $ENCRYPTION=$1;
    print " $1\n";
    }
  }
close scan;

produces output in the form of "essid" channel signal_strength encryption_status


"ESSID_NAME1" 1 -82 on
"ESSID_NAME2" 1 -49 off

/bin/sh

(Not Finished)

 
#!/bin/sh

   #####################
###########################
#/var/wifi/hacker/kd8ikt###
# OMG i'm programming now!#
###########################
###we.trekbeyond.org#######
  #####################
        #KISS#

######wireless interface
IFACE=eth0
#
####host to do ping test
HOST=myspace.com
#
## heh ping flood the noobs 
#
#  Func.iwlist.open
##########################
Func_iwlist_open()	{
iwlist $IFACE scanning \
| awk -F '[ :=]+' '/(ESS|Freq|Qual)/{ printf $3" " } /Encr/{ print $4 }' \
|sort -k4 -k3nr \
|grep off \
|awk '{print $1}'	}
###########################
#  /Func.iwlist.open
###########################
#   Func.chk.net (needs reworked) its bad code so speedevil tells me and i'm starting to see it
###########################
#  w00t=yes   FAIL=no
HOSTTT="google.com"
for Hosts in $HOSTTT
do
  count=$(ping -c 1 $HOSTTT | grep 'received' | awk -F',' '{ print $2 }' | awk '{ print $1 }')
  if [ $count -eq 0 ]; then
    # 100% failed
    echo "FAIL" 
  fi
  
  if [ $count -eq 1 ]; then
  
	echo "w00t"
  fi
#
Personal tools

script to Auto connect to Open wirelss 81102 AP's

TODO

  • determine AP without encryption and sort by best signal
  • using essid of best signal perform connect/udhcpc and chknet every so often

if net is down repeat

  • put it all together

sandbox

iwscan perl

#!/usr/bin/perl
# Tim Osburn - tim@osburn.com
#
# install perl

$iwlist = "/sbin/iwlist eth0 scanning";

open scan, "$iwlist |";
while (<scan>) {
  if (/^\s+Cell (\S+) - Address: (\S+)/) {
    $CELL=$1;
    $ADDRESS=$2;
    # print "$1 $2";
    $INLOOP=1;
    }
  if (/^\s+ESSID:(\S+)/) {
    $ESSID=$1;
    print " $1";
    }
  if (/^\s+Frequency:\S+ \S+ \(Channel (\S+)\)/) {
    $CHAN=$1;
    print " $1";
    }
  if (/^\s+Quality=\S+\s+Signal level=(\S+).*/) {
    $SIGNAL=$1;
    print " $1";
    }
  if (/^\s+Encryption key:(\S+)/) {
    $ENCRYPTION=$1;
    print " $1\n";
    }
  }
close scan;

produces output in the form of "essid" channel signal_strength encryption_status


"ESSID_NAME1" 1 -82 on
"ESSID_NAME2" 1 -49 off

/bin/sh

(Not Finished)

 
#!/bin/sh

   #####################
###########################
#/var/wifi/hacker/kd8ikt###
# OMG i'm programming now!#
###########################
###we.trekbeyond.org#######
  #####################
        #KISS#

######wireless interface
IFACE=eth0
#
####host to do ping test
HOST=myspace.com
#
## heh ping flood the noobs 
#
#  Func.iwlist.open
##########################
Func_iwlist_open()	{
iwlist $IFACE scanning \
| awk -F '[ :=]+' '/(ESS|Freq|Qual)/{ printf $3" " } /Encr/{ print $4 }' \
|sort -k4 -k3nr \
|grep off \
|awk '{print $1}'	}
###########################
#  /Func.iwlist.open
###########################
#   Func.chk.net (needs reworked) its bad code so speedevil tells me and i'm starting to see it
###########################
#  w00t=yes   FAIL=no
HOSTTT="google.com"
for Hosts in $HOSTTT
do
  count=$(ping -c 1 $HOSTTT | grep 'received' | awk -F',' '{ print $2 }' | awk '{ print $1 }')
  if [ $count -eq 0 ]; then
    # 100% failed
    echo "FAIL" 
  fi
  
  if [ $count -eq 1 ]; then
  
	echo "w00t"
  fi
#
</div>