new_contents: #!/usr/bin/python
  
  import os,time,sys,subprocess
  import argparse
  
  
  #####  BoafiCap.py
  ###  - Capture all wireless networks and output them into csv\pcap files
  ##   - Dependencies : aircrack-ng
  #    - Running in background once started and must be killed with an external script or via bash kill
  #    - Maintains aircrack-ng output format for more compatibility
  
  
  ###  Author: Yessou Sami 
  ###  Project Boafi
  ###  Tested on Raspberry pi 2(Raspian) with ALFA AWUS052NH
  
  parser = argparse.ArgumentParser()
  
  
  
  parser.add_argument('-o', action='store', dest='output',
                      help='Output file name without extension..if empty i will use ( dump.extension ) ')
  
  
  
  parser.add_argument('-csv', action='store_true', default=False,
                      dest='csvmode',
                      help='Set csv mode ')
  
  
  parser.add_argument('-pcap', action='store_true', default=False,
                      dest='pcapmode',
                      help='Set pcap mode')
  
  
  
  
  
  results = parser.parse_args()
  
  csvmode=results.csvmode
  
  if results.output !=" " :
          output_file=results.output
  else :
          output_file="dump"
  
  pcapmode=results.pcapmode
  
  
  
  def EnaMon():
          #Refreshing interfaces
          os.system("airmon-ng stop mon0")
          #Starting Monitor mode mon0
          os.system("airmon-ng start wlan0")
  
  
  
  
  
  EnaMon()
  print "mon0 Enabled \n\n"
  time.sleep(2)
  print "Starting capturing wifi networks  nearby\n\n"
  
  if pcapmode and csvmode :
          cmd="nohup airodump-ng mon0 -w "+output_file+" --output-format csv,cap >/dev/null 2>&1 &"
  elif pcapmode :
          cmd="nohup airodump-ng mon0 -w "+output_file+" --output-format cap >/dev/null 2>&1 &"
  elif csvmode :
          cmd="nohup airodump-ng mon0 -w "+output_file+" --output-format csv  >/dev/null 2>&1 &"
  
  
  os.system(cmd)
  
  print "Starting capturing packets"
  
  
  
  # ill add other options like
  # --ivs save only IV
  # -f time between hopping from one channel to another
  # -C <frequencies>
  
  
  
  
subject: Create BoafiCap.py