Differences between revisions 14 and 17 (spanning 3 versions)
Revision 14 as of 2006-10-06 20:12:48
Size: 27018
Comment: added a simplified /etc/init.d/S96gpsd
Revision 17 as of 2006-10-06 22:44:57
Size: 28920
Comment: initial workable instructions
Deletions are marked like this. Additions are marked like this.
Line 29: Line 29:
include $(TOPDIR)/rules.mk include \$(TOPDIR)/rules.mk
Line 584: Line 584:
 * Remove annoying OpenWrt-standard files that aren't needed or get in the way:
  * /etc/hotplug.d/block/01-mount
  * /etc/init.d/S50httpd

 * Make a home directory:
 {{{
mkdir -p /home/kismet
 }}}
Line 585: Line 594:
  * /etc/init.d/S90usbfs
  {{{
#!/bin/sh
#
# mount /proc/bus/usb
mount -t usbfs none /proc/bus/usb/
  }}}
Line 587: Line 604:
cat > /etc/init.d/95setclock <<EOF
Line 637: Line 653:
EOF
chmod 755 /etc/init.d/S95setclock
Line 643: Line 657:
echo > /etc/init.d/S96gpsd <<EOF
Line 658: Line 671:
EOF
chmod 755 /etc/init.d/S96gpsd
}}}

  * MORE TO COME
  }}}

  * /etc/init.d/S97kismet
  {{{
#!/bin/sh
#
# Mount usb-storage and start kismet_wrapper

while [ ! -b /dev/sda1 ]; do
        echo "waiting for /dev/sda1"
        sleep 1
done

mount /dev/sda1 /home/kismet
 
cd /home/kismet
 
/usr/sbin/kismet_wrapper &
  }}}

  * /usr/sbin/kismet_wrapper: This version watches for the presence of a USB device (a Linksys DBT-120 bluetooth dongle, but the script can be adapted to look for any vendor id) and starts/stops kismet_server accordingly.
  {{{
#!/bin/sh

# watches for presence of a VENDOR ID on the usb bus to determine
# whether ${CMD} should run

CMD=kismet_server
CMDSTR="/usr/bin/kismet_server -r -f /etc/kismet.conf"
VENDOR="0a12"
INTERVAL=5

while ( true ); do
    echo "starting loop"
    if grep -q "Vendor=${VENDOR}" /proc/bus/usb/devices ; then
        # enable key is inserted
        echo "enable key inserted"
        if ! pidof ${CMD} ; then
            # ${CMD} isn't already running, so execute ${CMDSTR} to start
            echo "starting ${CMD}"
            ${CMDSTR} &
        fi
    else
        # enable key is NOT inserted
        echo "enable key not inserted"
        if pidof ${CMD} ; then
            # ${CMD} is running, so kill it
            echo "killing ${CMD}"
            PID=$(pidof ${CMD})
            
            kill ${PID}
            wait ${PID}
            echo "finished waiting on ${PID}"
        fi
    fi
    echo "sleeping ${INTERVAL} seconds"
    sleep ${INTERVAL}
done
  }}}

  * Make scripts executable:
  {{{
chmod 755 /etc/init.d/S90usbfs
chmod 755 /etc/init.d/S95setclock
chmoe 755 /etc/init.d/S96gpsd
chmod 755 /etc/init.d/S97kismet
chmod 755 /usr/sbin/kismet_wrapper
  }}}

Netgear WGT634U-based Network Stumbler

This is a description of how RussellSenior goes about building a stumbler device based on the NetgearWgt643u and OpenWrt. This is experimental software. Follow these instructions at your own risk. Based on the excellent trailblazing work and example provided by JasonMcArthur.

Hardware

  • Netgear WGT634U
  • USB2 hub
  • USB storage device
  • USB GPS device (such as the GlobalSat BU-353)

  • 3.3V serial console cable for WGT634U
  • random, compact USB device (used as an enable-key)

Building OpenWrt Software

Currently, I am using the buildroot-ng svn tree. This description is based on the already obsolete r4902.

cd /src/openwrt
svn co https://svn.openwrt.org/openwrt/branches/buildroot-ng 
svn co https://svn.openwrt.org/openwrt/packages 
cd /src/openwrt/buildroot-ng/openwrt/package 
for i in $(find ../../../packages -type d | grep -v .svn | awk -F/ 'NF==6') ; do echo $i ; ln -s $i $(echo $i | awk -F/ '{ print $6 }') ; done

# add package infrastructure for an older version of gpsd (v2.9)

mkdir /src/openwrt/buildroot-ng/openwrt/package/gpsd-old
cat > /src/openwrt/buildroot-ng/openwrt/package/gpsd-old <<EOF
include \$(TOPDIR)/rules.mk

PKG_NAME:=gpsd-old
PKG_VERSION:=2.9
PKG_RELEASE:=1

PKG_BUILD_DIR:=$(BUILD_DIR)/$(PKG_NAME)-$(PKG_VERSION)
PKG_SOURCE:=$(PKG_NAME)-$(PKG_VERSION).tar.gz
PKG_SOURCE_URL:=http://www.personaltelco.net/~russell/
PKG_MD5SUM:=b676f6cb355d801023f08a62f11a606f
PKG_CAT:=zcat

PKG_BUILDDEP=libpthread uclibcxx

include $(INCLUDE_DIR)/package.mk

define Package/gpsd-old
  SECTION:=net
  CATEGORY:=Network
  TITLE:=gpsd
  DEPENDS:=+libpthread +uclibcxx
  DESCRIPTION:=An interface daemon for GPS receivers
endef

define Build/Configure
        ( cd $(PKG_BUILD_DIR); rm -rf config.cache; \
                $(TARGET_CONFIGURE_OPTS) \
                CFLAGS="$(TARGET_CFLAGS)" \
                CXXFLAGS="$(TARGET_CFLAGS) -fno-builtin -fno-rtti -nostdinc++ -nodefaultlibs"  \
                CPPFLAGS="-I$(STAGING_DIR)/usr/include -I$(STAGING_DIR)/include" \
                LDFLAGS="-nodefaultlibs -L$(STAGING_DIR)/usr/lib -L$(STAGING_DIR)/lib" \
                LIBS="-luClibc++ -lc -lm -lnotimpl" \
                ./configure \
                        --target=$(GNU_TARGET_NAME) \
                        --host=$(GNU_TARGET_NAME) \
                        --build=$(GNU_HOST_NAME) \
                        --program-prefix="" \
                        --program-suffix="" \
                        --prefix=/usr \
                        --exec-prefix=/usr \
                        --bindir=/usr/bin \
                        --datadir=/usr/share \
                        --includedir=/usr/include \
                        --infodir=/usr/share/info \
                        --libdir=/usr/lib \
                        --libexecdir=/usr/lib \
                        --localstatedir=/var \
                        --mandir=/usr/share/man \
                        --sbindir=/usr/sbin \
                        --sysconfdir=/etc \
                        $(DISABLE_LARGEFILE) \
                        $(DISABLE_NLS) \
                        --enable-shared \
                        --enable-static \
                        --with-gnu-ld \
                        --without-x \
        );
endef

define Build/Compile
        cp $(PKG_BUILD_DIR)/libtool $(PKG_BUILD_DIR)/libtool.orig
        sed 's/-lstdc++ //' < $(PKG_BUILD_DIR)/libtool.orig > $(PKG_BUILD_DIR)/libtool
        $(MAKE) -C $(PKG_BUILD_DIR) \
                all
endef

define Package/gpsd-old/install
        install -d -m0755 $(1)/usr/lib
        install -m0755 $(PKG_BUILD_DIR)/.libs/libgps.so* $(1)/usr/lib/
        install -d -m0755 $(1)/usr/sbin/
        install -m0755 $(PKG_BUILD_DIR)/.libs/gpsd $(1)/usr/sbin/
endef

define Build/InstallDev
        mkdir -p $(STAGING_DIR)/usr/include
        $(CP) $(PKG_BUILD_DIR)/gps{,d}.h $(STAGING_DIR)/usr/include/
        mkdir -p $(STAGING_DIR)/usr/lib
        $(CP) $(PKG_BUILD_DIR)/.libs/libgps.{a,so*} $(STAGING_DIR)/usr/lib/
endef

define Build/UninstallDev
        rm -rf $(STAGING_DIR)/usr/include/gps{,d}.h \
                $(STAGING_DIR)/usr/lib/libgps.{a,so*} 
endef

$(eval $(call BuildPackage,gpsd-old))
EOF

cd /src/openwrt/buildroot-ng/openwrt
make menuconfig
make

In the menuconfig, I set the Target System to (Broadcom BCM47xx/53xx [2.6]), and for kicks I also "Select all packages by default" and enable a few things (which I am currently forgetting) that don't automatically get configured in. Often, you will find packages that won't build for some reason or another. In those cases, open a ticket, deconfigure the package in menuconfig and try again. Run make alone to see abbreviated messages, or make V=99 to get lots of information. The configuration I used for r4902 can be found [http://www.personaltelco.net/~russell/buildroot-ng/config-r4902 here].

When the build is complete, the resulting files will be found thusly:

  • /src/openwrt/buildroot-ng/openwrt/bin contains the flashable images

  • /src/openwrt/buildroot-ng/openwrt/bin/packages contains the .ipk files

Additionally, as of my recent attempts, the Packages file that is needed for the ipkg utility to function properly later on is apparently not constructed (maybe I missed it), but I developed a script that does it for me:

TOPDIR="/src/openwrt/buildroot-ng/openwrt"

CTRLDIR="${TOPDIR}/build_mipsel"
PKGSDIR="${TOPDIR}/bin/packages"
PKGSFIL="${PKGSDIR}/Packages"

rm -f ${PKGSFIL}

for i in $(find ${CTRLDIR} -name 'control' | grep CONTROL) ; 
  do echo $i ; 
  PACKAGE=$(grep ^Package: $i | cut -d' ' -f2) ; 
  VERSION=$(grep ^Version: $i | cut -d' ' -f2) ; 
  ARCH=$(grep ^Architecture: $i | cut -d' ' -f2) ; 
  FILENAME="${PACKAGE}_${VERSION}_${ARCH}.ipk" ;
  IPKG="${PKGSDIR}/${FILENAME}"
  if [ -f ${IPKG} ] ; then
      SIZE=$(wc -c ${IPKG} | cut -d' ' -f1) ; 
      MD5=$(md5sum ${IPKG} | cut -d' ' -f1) ; 
      cat $i >> ${PKGSFIL} ; 
      echo "Filename: ${FILENAME}" >> ${PKGSFIL} ; 
      echo "Size: ${SIZE}" >> ${PKGSFIL} ; 
      echo "MD5Sum: ${MD5}" >> ${PKGSFIL} ; 
      echo "" >> ${PKGSFIL} ; 
  else
      echo "${FILENAME} NOT FOUND!"
  fi
done

Now, you can copy the ipkg repository somewhere wget'able, e.g.:

rsync -v -a -H /src/openwrt/buildroot-ng/openwrt/bin/packages/ donk.personaltelco.net:public_html/buildroot-ng/r4902/

Checking out the WGT634U

If this is a new device, it is probably a good idea to check it out on the stock firmware first to make sure it functions.

  • apply power
  • use another computer to associate over the wireless

The Flash Environment

There is more than one way to flash the newly-built image onto the WGT634U.

CFE TFTP Flash-From-Console Method

This is the method I tend to use. For this, you will need a TFTP server and a serial console cable. On my debian/unstable box, I use the tftpd-hpa package.

  • copy the image file to the TFTP server directory.
    cp /src/openwrt/buildroot-ng/openwrt/bin/openwrt-wgt634u-2.6-jffs2.bin /var/lib/tftpboot/wgt634u/openwrt-wgt634u-2.6-jffs2-r4902.bin
  • open the WGT634U case by removing 4 screws from the bottom. These are either ordinary phillips (often seen on the refurbs) or T-8 torx screws.
  • connect the serial console to the WGT634U
  • connect a LAN network cable to the WAN port (nearest the USB port)
  • while holding Ctrl-C on the serial console, apply power:
    CFE version 1.0.34 for BCM95365R (32bit,SP,LE)
    Build Date: Tue Feb 24 03:21:41 CST 2004 (root@jackylinux)
    Copyright (C) 2000,2001,2002 Broadcom Corporation.
    
    Add MAC client version(DNI).
    Initializing Arena.
    Initializing Devices.
    et0: Broadcom BCM47xx 10/100 Mbps Ethernet Controller
    CPU type 0x29007: 200MHz
    Total memory: 0x2000000 bytes (32MB)
    
    Total memory used by CFE:  0x81BB1280 - 0x82000000 (4517248)
    Initialized Data:          0x81BB1280 - 0x81BB3E90 (11280)
    BSS Area:                  0x81BB3E90 - 0x81BB45D0 (1856)
    Local Heap:                0x81BB45D0 - 0x81FB45D0 (4194304)
    Stack Area:                0x81FB45D0 - 0x81FB65D0 (8192)
    Text (code) segment:       0x81FB65E0 - 0x81FFFFB0 (301520)
    Boot area (physical):      0x01B70000 - 0x01BB0000
    Relocation Factor:         I:E23B65E0 - D:01BB0280
    
    configure vlans
    *****************************************************************
    *********************** VLAN Driver initial  ********************
    *****************************************************************
    Process LAN port(2-5) vlan Architecture...
    SUCCESS: trying to create VLAN 0 for switch
    SUCCESS: trying to add LAN port
    
    Process WAN port(2-5) vlan Architecture...
    SUCCESS: trying to create VLAN 0 for switch
    SUCCESS: trying to add WAN port
    SUCCESS: enable ports  success
    configure vlans...done
    Automatic startup canceled via Ctrl-C
    CFE> ^C
    CFE> 
  • Configure the network. This is easiest if there is a DHCP server on the network:
    CFE> ifconfig eth0 -auto
    Device eth0:  hwaddr 00-0F-B5-97-29-39, ipaddr 192.168.0.145, mask 255.255.255.0
            gateway 192.168.0.1, nameserver 192.168.0.1, domain personaltelco.net
    *** command status = 0
  • You can blank out the flash using specially prepared wipe images. Note that the file size that you can TFTP is limited so this must be done in two steps. This might in fact be unnecessary, but it works for me:
    CFE> flash -noheader 192.168.0.5:wgt634u/wipe-1.img flash0.os
    CFE> flash -noheader -offset=3932160 192.168.0.5:wgt634u/wipe-2.img flash0.os
  • Now, flash the image you want to use and reboot:
    CFE> flash -noheader 192.168.0.5:wgt634u/openwrt-wgt634u-2.6-jffs2-r4902.bin flash0.os
    CFE> reboot

Configuration

  • To get a console prompt, wait until the bootup has finished, and press enter to wake up a shell.
  • You can configure your ethernet network as follows (assuming you have a DHCP server available):
    udhcpc -i eth0
  • In order to take advantage of your buildroot-ng ipkg's, you first need to modify /etc/ipkg.conf:
    src snapshots http://www.personaltelco.net/~russell/buildroot-ng/r4902
    #src snapshots http://openwrt.org/downloads/snapshots/brcm-2.6/packages
    dest root /
    dest ram /tmp
  • To update your WGT634U using this package archive:
    ipkg update
  • Now, start adding packages:
    ipkg install kmod-usb2
    ipkg install kmod-usb-storage
    ipkg install kmod-usb-serial-pl2303
    ipkg install gpsd-old
    ipkg install kmod-fs-vfat
    ipkg install kmod-nls-cp437
    ipkg install kmod-nls-iso8859-1
  • Install the statically-linked MIPS binary of kismet from [http://www.kismetwireless.net/code/kismet-2006-04-R1-wrt54.tar.gz here] and copy it somewhere useful:

    cd /tmp
    wget http://www.kismetwireless.net/code/kismet-2006-04-R1-wrt54.tar.gz
    tar xzvf kismet-2006-04-R1-wrt54.tar.gz
    cp kismet-2006-04-R1-wrt54/kismet_server /usr/bin/
  • add an /etc/kismet.conf. Here's the one I am using, derived from one from JasonMcArthur:

    # Kismet config file
    # Most of the "static" configs have been moved to here -- the command line
    # config was getting way too crowded and cryptic.  We want functionality,
    # not continually reading --help!
    
    # Version of Kismet config
    version=2005.01.R1
    
    # Name of server (Purely for organiational purposes)
    servername=Kismet
    
    # User to setid to (should be your normal user)
    suiduser=root
    
    # Sources are defined as:
    # source=cardtype,interface,name[,initialchannel]
    # Card types and required drivers are listed in the README.
    # The initial channel is optional, if hopping is not enabled it can be used
    # to set the channel the interface listens on.
    # YOU MUST CHANGE THIS TO BE THE SOURCE YOU WANT TO USE
    # source=wrt54g,eth1,wireless
    # For v1 hardware uncomment this:
    # source=wrt54g,eth2,wireless
    source=madwifi_g,wifi0,wgt634u
    
    # Comma-separated list of sources to enable.  This is only needed if you defined
    # multiple sources and only want to enable some of them.  By default, all defined
    # sources are enabled.
    # For example:
    # enablesources=prismsource,ciscosource
    
    # Do we channelhop?
    channelhop=true
    
    # How many channels per second do we hop?  (1-10)
    channelvelocity=5
    
    # By setting the dwell time for channel hopping we override the channelvelocity
    # setting above and dwell on each channel for the given number of seconds.
    #channeldwell=10
    
    # Do we split channels between cards on the same spectrum?  This means if 
    # multiple 802.11b capture sources are defined, they will be offset to cover
    # the most possible spectrum at a given time.  This also controls splitting
    # fine-tuned sourcechannels lines which cover multiple interfaces (see below)
    channelsplit=true
    
    # Basic channel hopping control:
    # These define the channels the cards hop through for various frequency ranges
    # supported by Kismet.   More finegrain control is available via the 
    # "sourcechannels" configuration option.
    # 
    # Don't change the IEEE80211<x> identifiers or channel hopping won't work.
    
    # Users outside the US might want to use this list:
    # defaultchannels=IEEE80211b:1,7,13,2,8,3,14,9,4,10,5,11,6,12
    defaultchannels=IEEE80211b:1,6,11,2,7,3,8,4,9,5,10
    
    # 802.11g uses the same channels as 802.11b...
    defaultchannels=IEEE80211g:1,6,11,2,7,3,8,4,9,5,10
    
    # 802.11a channels are non-overlapping so sequential is fine.  You may want to
    # adjust the list depending on the channels your card actually supports.
    # defaultchannels=IEEE80211a:36,40,44,48,52,56,60,64,100,104,108,112,116,120,124,128,132,136,140,149,153,157,161,184,188,192,196,200,204,208,212,216 
    defaultchannels=IEEE80211a:36,40,44,48,52,56,60,64
    
    # Combo cards like Atheros use both 'a' and 'b/g' channels.  Of course, you
    # can also explicitly override a given source.  You can use the script 
    # extras/listchan.pl to extract all the channels your card supports.
    defaultchannels=IEEE80211ab:1,6,11,2,7,3,8,4,9,5,10,36,40,44,48,52,56,60,64
    
    # Fine-tuning channel hopping control:
    # The sourcechannels option can be used to set the channel hopping for 
    # specific interfaces, and to control what interfaces share a list of 
    # channels for split hopping.  This can also be used to easily lock
    # one card on a single channel while hopping with other cards.
    # Any card without a sourcechannel definition will use the standard hopping
    # list.
    # sourcechannels=sourcename[,sourcename]:ch1,ch2,ch3,...chN
    
    # ie, for us channels on the source 'prism2source' (same as normal channel
    # hopping behavior):
    # sourcechannels=prism2source:1,6,11,2,7,3,8,4,9,5,10
    
    # Given two capture sources, "prism2a" and "prism2b", we want prism2a to stay
    # on channel 6 and prism2b to hop normally.  By not setting a sourcechannels 
    # line for prism2b, it will use the standard hopping.
    # sourcechannels=prism2a:6
    
    # To assign the same custom hop channel to multiple sources, or to split the 
    # same custom hop channel over two sources (if splitchannels is true), list
    # them all on the same sourcechannels line:
    # sourcechannels=prism2a,prism2b,prism2c:1,6,11
    
    # Port to serve GUI data
    tcpport=2501
    # People allowed to connect, comma seperated IP addresses or network/mask
    # blocks.  Netmasks can be expressed as dotted quad (/255.255.255.0) or as
    # numbers (/24)
    allowedhosts=127.0.0.1
    # Maximum number of concurrent GUI's
    maxclients=5
    
    # Do we have a GPS?
    gps=true
    # Host:port that GPSD is running on.  This can be localhost OR remote!
    gpshost=127.0.0.1:2947
    # Do we lock the mode?  This overrides coordinates of lock "0", which will
    # generate some bad information until you get a GPS lock, but it will 
    # fix problems with GPS units with broken NMEA that report lock 0
    gpsmodelock=false
    
    # Packet filtering options:
    # filter_tracker - Packets filtered from the tracker are not processed or
    #                  recorded in any way.
    # filter_dump    - Packets filtered at the dump level are tracked, displayed,
    #                  and written to the csv/xml/network/etc files, but not 
    #                  recorded in the packet dump
    # filter_export  - Controls what packets influence the exported CSV, network,
    #                  xml, gps, etc files.
    # All filtering options take arguments containing the type of address and
    # addresses to be filtered.  Valid address types are 'ANY', 'BSSID',
    # 'SOURCE', and 'DEST'.  Filtering can be inverted by the use of '!' before
    # the address.  For example,
    # filter_tracker=ANY(!00:00:DE:AD:BE:EF)
    # has the same effect as the previous mac_filter config file option.
    # filter_tracker=...
    # filter_dump=...
    # filter_export=...
    
    # Alerts to be reported and the throttling rates.
    # alert=name,throttle/unit,burst
    # The throttle/unit describes the number of alerts of this type that are
    # sent per time unit.  Valid time units are second, minute, hour, and day.
    # Burst describes the number of alerts sent before throttling takes place.
    # For example:
    # alert=FOO,10/min,5
    # Would allow 5 alerts through before throttling is enabled, and will then
    # limit the number of alerts to 10 per minute.
    # A throttle rate of 0 disables throttling of the alert.
    # See the README for a list of alert types.
    alert=NETSTUMBLER,5/min,2
    alert=WELLENREITER,5/min,2
    alert=LUCENTTEST,5/min,2
    alert=DEAUTHFLOOD,5/min,4
    alert=BCASTDISCON,5/min,4
    alert=CHANCHANGE,5/min,4
    alert=AIRJACKSSID,5/min,2
    #alert=PROBENOJOIN,5/min,2
    alert=DISASSOCTRAFFIC,5/min,2
    alert=NULLPROBERESP,5/min,5
    #alert=BSSTIMESTAMP,5/min,5
    
    # Known WEP keys to decrypt, bssid,hexkey.  This is only for networks where
    # the keys are already known, and it may impact throughput on slower hardware.
    # Multiple wepkey lines may be used for multiple BSSIDs.
    # wepkey=00:DE:AD:C0:DE:00,FEEDFACEDEADBEEF01020304050607080900
    
    # Is transmission of the keys to the client allowed?  This may be a security
    # risk for some.  If you disable this, you will not be able to query keys from
    # a client.
    allowkeytransmit=true
    
    # How often (in seconds) do we write all our data files (0 to disable)
    #writeinterval=300
    #writeinterval=20
    writeinterval=600
    
    # Where do we get our manufacturer fingerprints from?  Assumed to be in the
    # default config directory if an absolute path is not given.
    ap_manuf=ap_manuf
    client_manuf=client_manuf
    
    # Use metric measurements in the output?
    metric=false
    
    # Do we write waypoints for gpsdrive to load?  Note:  This is NOT related to
    # recent versions of GPSDrive's native support of Kismet.
    waypoints=false
    # GPSMap waypoint file.  This WILL be truncated.
    waypointdata=%h/.gpsdrive/way_kismet.txt
    
    # How many alerts do we backlog for new clients?  Only change this if you have
    # a -very- low memory system and need those extra bytes, or if you have a high
    # memory system and a huge number of alert conditions.
    alertbacklog=50
    
    # File types to log, comma seperated
    # dump    - raw packet dump
    # network - plaintext detected networks
    # csv     - plaintext detected networks in CSV format
    # xml     - XML formatted network and cisco log
    # weak    - weak packets (in airsnort format)
    # cisco   - cisco equipment CDP broadcasts
    # gps     - gps coordinates
    logtypes=gps,network,csv,xml
    
    # Do we track probe responses and merge probe networks into their owners?
    # This isn't always desireable, depending on the type of monitoring you're
    # trying to do.
    trackprobenets=true
    
    # Do we log "noise" packets that we can't decipher?  I tend to not, since 
    # they don't have anything interesting at all in them.
    noiselog=false
    
    # Do we log corrupt packets?  Corrupt packets have enough header information
    # to see what they are, but someting is wrong with them that prevents us from
    # completely dissecting them.  Logging these is usually not a bad idea.
    corruptlog=true
    
    # Do we log beacon packets or do we filter them out of the dumpfile
    #beaconlog=true
    beaconlog=false
    
    # Do we log PHY layer packets or do we filter them out of the dumpfile
    phylog=true
    
    # Do we mangle packets if we can decrypt them or if they're fuzzy-detected
    mangledatalog=true
    
    # Do we do "fuzzy" crypt detection?  (byte-based detection instead of 802.11
    # frame headers)
    # valid option: Comma seperated list of card types to perform fuzzy detection 
    #  on, or 'all'
    fuzzycrypt=wtapfile,wlanng,wlanng_legacy,wlanng_avs,hostap,wlanng_wext
    
    # What type of dump do we generate? 
    # valid option: "wiretap" 
    dumptype=wiretap
    # Do we limit the size of dump logs?  Sometimes ethereal can't handle big ones.
    # 0 = No limit
    # Anything else = Max number of packets to log to a single file before closing
    # and opening a new one.
    dumplimit=0
    
    # Do we write data packets to a FIFO for an external data-IDS (such as Snort)?
    # See the docs before enabling this.
    #fifo=/tmp/kismet_dump
    
    # Default log title
    logdefault=wgt634u
    
    # logtemplate - Filename logging template.
    # This is, at first glance, really nasty and ugly, but you'll hardly ever
    # have to touch it so don't complain too much.
    #
    # %n is replaced by the logging instance name
    # %d is replaced by the current date as Mon-DD-YYYY
    # %D is replaced by the current date as YYYYMMDD
    # %t is replaced by the starting log time
    # %i is replaced by the increment log in the case of multiple logs
    # %l is replaced by the log type (dump, status, crypt, etc)
    # %h is replaced by the home directory
    # ie, "netlogs/%n-%d-%i.dump" called with a logging name of "Pok" could expand
    # to something like "netlogs/Pok-Dec-20-01-1.dump" for the first instance and 
    # "netlogs/Pok-Dec-20-01-2.%l" for the second logfile generated.
    # %h/netlots/%n-%d-%i.dump could expand to
    # /home/foo/netlogs/Pok-Dec-20-01-2.dump
    #
    # Other possibilities:  Sorting by directory
    # logtemplate=%l/%n-%d-%i
    # Would expand to, for example,
    # dump/Pok-Dec-20-01-1
    # crypt/Pok-Dec-20-01-1
    # and so on.  The "dump", "crypt", etc, dirs must exist before kismet is run
    # in this case.
    logtemplate=%n-%d-%i.%l
    
    # Where do we store the pid file of the server?
    piddir=/var/run/
    
    # Where state info, etc, is stored.  You shouldnt ever need to change this.
    # This is a directory.
    configdir=/tmp/.kismet/
    
    # cloaked SSID file.  You shouldn't ever need to change this.
    ssidmap=ssid_map
    
    # Group map file.  You shouldn't ever need to change this.
    groupmap=group_map
    
    # IP range map file.  You shouldn't ever need to change this.
    ipmap=ip_map
  • Remove annoying OpenWrt-standard files that aren't needed or get in the way:

    • /etc/hotplug.d/block/01-mount
    • /etc/init.d/S50httpd
  • Make a home directory:
    mkdir -p /home/kismet
  • Add various scripts:
    • /etc/init.d/S90usbfs
      #
      # mount /proc/bus/usb
      mount -t usbfs none /proc/bus/usb/
    • /etc/init.d/S95setclock
      #
      # /etc/init.d/S95setclock
      # 
      # Find gps device and set clock via gpsd
      #
      # Russell Senior 2006 <russell@personaltelco.net>
      
      # wait for a usb-serial device to appear
      while [ ! -c /dev/usb/tts/0 ]; do
              echo "waiting for usb-serial device"
              sleep 2
      done
      
      # kill any pre-existing gpsd
      if pidof gpsd ; then 
              echo "killing gpsd"
              PID=$(pidof gpsd)
              kill ${PID}
              wait ${PID}
      fi
      
      # restart gpsd in no-wait mode
      echo "restarting gpsd"
      gpsd -n -p /dev/usb/tts/0
      
      # looking for gps fix
      while [ $(echo "s" | nc 127.0.0.1 2947 | sed 's/^GPSD,S=//') -le "0" ] ; do 
              echo "waiting for a fix"
              sleep 1
      done
      
      # looking for a gps date/time
      while true ; do
              echo "d" | nc 127.0.0.1 2947 | sed 's/^GPSD,D=//' | tr 'ZT:-' '    ' > /tmp/gpsdate
              if [ $(cut -d' ' -f1 /tmp/gpsdate) -ge 2006 ]; then
                      echo "got a date"
                      date -s $(awk '{ printf("%s%s%s%s%s.%d",$2,$3,$4,$5,$1,int($6+0.5)) }' /tmp/gpsdate)
                      break
              fi
              echo "waiting for a date"
              sleep 1
      done
      
      echo "cleaning up"
      PID=$(pidof gpsd)
      kill ${PID}
      wait ${PID}
      rm -f /tmp/gpsdate
    • /etc/init.d/S96gpsd
      #
      # Restart gpsd
      
      if pidof gpsd ; then   
              PID=$(pidof gpsd)
              echo "killing gpsd ${PID}"
              kill ${PID}
              wait ${PID}
      fi
      
      # restarting gpsd in the normal waiting mode
      echo "restarting gpsd"
      gpsd -p /dev/usb/tts/0
    • /etc/init.d/S97kismet
      #
      # Mount usb-storage and start kismet_wrapper
      
      while [ ! -b /dev/sda1 ]; do
              echo "waiting for /dev/sda1"
              sleep 1
      done
      
      mount /dev/sda1 /home/kismet
       
      cd /home/kismet
       
      /usr/sbin/kismet_wrapper &
    • /usr/sbin/kismet_wrapper: This version watches for the presence of a USB device (a Linksys DBT-120 bluetooth dongle, but the script can be adapted to look for any vendor id) and starts/stops kismet_server accordingly.
      # watches for presence of a VENDOR ID on the usb bus to determine
      # whether ${CMD} should run
      
      CMD=kismet_server
      CMDSTR="/usr/bin/kismet_server -r -f /etc/kismet.conf"
      VENDOR="0a12"
      INTERVAL=5
      
      while ( true ); do
          echo "starting loop"
          if grep -q "Vendor=${VENDOR}" /proc/bus/usb/devices ; then
              # enable key is inserted
              echo "enable key inserted"
              if ! pidof ${CMD} ; then
                  # ${CMD} isn't already running, so execute ${CMDSTR} to start
                  echo "starting ${CMD}"
                  ${CMDSTR} &
              fi
          else
              # enable key is NOT inserted
              echo "enable key not inserted"
              if pidof ${CMD} ; then
                  # ${CMD} is running, so kill it
                  echo "killing ${CMD}"
                  PID=$(pidof ${CMD})
                  
                  kill ${PID}
                  wait ${PID}
                  echo "finished waiting on ${PID}"
              fi
          fi
          echo "sleeping ${INTERVAL} seconds"
          sleep ${INTERVAL}
      done
    • Make scripts executable:
      chmod 755 /etc/init.d/S90usbfs
      chmod 755 /etc/init.d/S95setclock
      chmoe 755 /etc/init.d/S96gpsd
      chmod 755 /etc/init.d/S97kismet
      chmod 755 /usr/sbin/kismet_wrapper

Adding Sound

For this, you need a usb-audio device and some additional software:

  • I am using the Turtle Beach Audio Advantage Micro device (CompUSA, roughly $25)
  • Install sound packages:
    ipkg install kmod-alsa
    ipkg install kmod-soundcore
    ipkg install madplay
  • Copy some sound files (compatible with madplay) to /usr/share/kismet/wav. I used audacity to encode the kismet .wav files as .mp3's.
  • Create a wrapper for madplay (to enclose the options). The soundopts feature in the kismet.conf file is broken because of the way they are concatenated in the call to execve().
    cat > /usr/bin/play <<EOF
    #!/bin/sh
    
    /usr/bin/madplay -Q -a -10 --no-tty-control $@
    EOF
    chmod 755 /usr/bin/play
  • Insert the following into /etc/kismet.conf
    # Do we use sound?                                                            
    # Not to be confused with GUI sound parameter, this controls wether or not the
    # server itself will play sound.  Primarily for headless or automated systems.
    sound=true                                                                    
    # Path to sound player                                                        
    soundplay=/usr/bin/play                                                       
    # Optional parameters to pass to the player                                   
    # soundopts=                                                                  
    # soundopts=--volume=.3                                                       
    # New network found                                                           
    sound_new=//usr/share/kismet/wav/new_network.mp3                              
    # Wepped new network                                                          
    # sound_new_wep=${prefix}/com/kismet/wav/new_wep_network.wav                  
    # Network traffic sound                                                       
    sound_traffic=//usr/share/kismet/wav/traffic.mp3                              
    # Network junk traffic found                                                  
    sound_junktraffic=//usr/share/kismet/wav/junk_traffic.mp3   
    # GPS lock aquired sound                                    
    # sound_gpslock=/usr/share/kismet/wav/foo.wav               
    # GPS lock lost sound                                       
    # sound_gpslost=/usr/share/kismet/wav/bar.wav               
    # Alert sound                                                                   
    sound_alert=//usr/share/kismet/wav/alert.mp3                                     

WgtStumbler (last edited 2007-11-23 18:02:18 by localhost)