I've been using the aircrack-ng suite for a little while now and I wanted to make things more automated, so I have made my first little script. I’ve never scripted with bash before but I checked out a skynet.sh script a member posted here and have used a few things from that. Let me know if there are any improvements I can make or what you think about it

Wifiopn-cap is an automated script which allows you to capture the packets of unsecured (open) wireless networks. By changing the options in this script, you can define how long to spend on each network capturing packets, how long airodump-ng will run on all channels and when is a reasonable last seen time for an open network so we can capture packets from that network. As this script runs in another terminal from airodump-ng you can view the networks as per normal in the airodump-ng terminal.

Wifiopn-cap uses the aircrack-ng v0.9.3 suite (specifically airodump-ng).

Instructions:
1. Change the INTERFACE value (in configuration) to suit your wireless card
2. Copy your airodump-ng file (located in /pentest/wireless/aircrack-ng/) and name it as wifiopn-airodump-ng so we can kill this process only
3. Open a shell and have airodump-ng running on any channel and writing to a file name of your choice before excuting this script (e.g airodump-ng -c 1 -w captureopn ath0)
4. Finally open up another shell and run this script

Download the script:
teknecal.t35.com/wifiopn-cap.sh

Video:
If you would like to see this script in action, view the video:
youtube.com/watch?v=HPBUQsZFa1U
rapidshare.de/files/39114572/wifiopn-cap_video.avi.html

View the script's code:
Code:
#!/bin/bash
# Wifiopn-cap - An automated OPN Network capturing script
# Copyright (C) 2008 teknecal (teknecal@gmail.com)
#
# Created: 2008-04-14
# Last Updated: 2008-04-14
# Version 1.0
#
# This program is free software: you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation, either version 3 of the License, or
# (at your option) any later version.
#
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
# GNU General Public License for more details.
#
# You should have received a copy of the GNU General Public License
# along with this program.
#
#
# Description:
# Wifiopn-cap is an automated script which allows you to capture the packets
# of unsecured (open) wireless networks. By changing the options in this script,
# you can define how long to spend on each network capturing packets, how long
# airodump-ng will run on all channels and when is a reasonable last seen time
# for an open network so we can capture packets from that network. As this
# script runs in another terminal from airodump-ng you can view the networks
# as per normal in the airodump-ng terminal.
#
# Wifiopn-cap uses the aircrack-ng v0.9.3 suite (specifically airodump-ng).
#
#
# Instructions:
# 1. Change the INTERFACE value (in configuration) to suit your wireless card
# 2. Copy your airodump-ng file (located in /pentest/wireless/aircrack-ng/)
#    and name it as wifiopn-airodump-ng so we can kill this process only
# 3. Open a shell and have airodump-ng running on any channel and writing
#    to a file name of your choice before excuting this script
#    (e.g airodump-ng -c 1 -w captureopn ath0)
# 4. Finally open up another shell and run this script :)

#
# CONFIGURATION
#

# Last time (in seconds) that the network has last been seen (matching the ALL_CHANNELS_TIME or slighly lower should be fine)
# This means that if a network hasn't been seen for x seconds it won't be included and this also depends on airodump-ng updating the txt file regularly. Increase this number if wifiopn-cap isn't detecting that there are OPN networks.
LAST_TIME_SEEN=20

# Time to spend (in seconds) capturing data on all channels
ALL_CHANNELS_TIME=20

# Time to spend (in seconds) capturing data on each network
CAPTURE_TIME=60

# Interface of wireless card
INTERFACE=ath0

# File Name of capture file
FILENAME=captureopn


# Trap Ctrl+C and then run the killing() function:
trap killing INT

# Kill the wifiopn-airodump-ng program
function killing() {
  killall wifiopn-airodump-ng &> /dev/null
  exit 1
}

# Loop until user exits
while [[ true ]]; do

  # Get the last txt file of our FILENAME and reload it to get new networks
  FILE_LIST=`ls -r | grep $FILENAME | cut -d "." -f 1`
  LAST_FILE=`echo $FILE_LIST | cut -d " " -f 1`
  echo "Using capture file $LAST_FILE.txt"

  # Find all networks that are have no encryption (OPN)
  OPEN_NETWORKS=`grep 'OPN' $LAST_FILE.txt | cut -d "," -f 1,3,4,6,14 | grep 'OPN' | cut -d "," -f 1,2,3,5`

  # Store the current time
  CURRENT_TIME=`date +%s`

  # Active Networks Check
  ACTIVE_NETWORKS=0

  # Loop on all networks found
  x=1
  NETWORK_BSSID=`echo $OPEN_NETWORKS | cut -d "," -f $x | cut -d " " -f 3`
  while [[ $NETWORK_BSSID != "" ]]; do

    # Network BSSID, Name, Channel and Last time seen
    NETWORK_BSSID=`echo $OPEN_NETWORKS | cut -d "," -f $x | cut -d " " -f 3`
    NETWORK_CHANNEL=`echo $OPEN_NETWORKS | cut -d "," -f $(($x+2)) | cut -d " " -f 2`
    NETWORK_LAST_SEEN=`echo $OPEN_NETWORKS | cut -d "," -f $(($x+1)) | cut -c 1-20`
    NETWORK_LAST_SEEN_UNIX=`date +%s -d "$NETWORK_LAST_SEEN"`
    NETWORK_NAME=`echo $OPEN_NETWORKS | cut -d "," -f $(($x+3)) | cut -d " " -f 2`

    NETWORK_TIME_ADDITION=$(($NETWORK_LAST_SEEN_UNIX + $LAST_TIME_SEEN))

    # If the network was seen recently then proceed
    if [[ $NETWORK_TIME_ADDITION > $CURRENT_TIME ]]; then
      echo "Wireless Network $NETWORK_NAME ($NETWORK_BSSID) on channel $NETWORK_CHANNEL is active and using no encryption"

      # Change the channel. Since we are changing the channel we need to kill wifiopn-airodump-ng and then change channels
      killall wifiopn-airodump-ng &> /dev/null
      iwconfig ath0 channel $NETWORK_CHANNEL

      echo "Capturing Wireless Network $NETWORK_NAME ($NETWORK_BSSID) packets for $CAPTURE_TIME seconds"
      sleep $CAPTURE_TIME

      ACTIVE_NETWORKS=$(expr $ACTIVE_NETWORKS + 1)

    fi

    x=$(expr $x + 3)

    NETWORK_BSSID=`echo $OPEN_NETWORKS | cut -d "," -f $x | cut -d " " -f 3`

  done

  if [[ $ACTIVE_NETWORKS == 0 ]]; then
    echo "No active open encryption networks found"
  fi

  # Run wifiopn-airodump-ng on all channels
  wifiopn-airodump-ng --cswitch 0 $INTERFACE &> /dev/null &
  echo "Airodump-ng running for $ALL_CHANNELS_TIME seconds on all channels"
  sleep $ALL_CHANNELS_TIME

done