(self)
Initialize AP
Initialize AP
Initialize AP
def initialize(self):
        """Initialize AP"""
        if not util.check_program('airbase-ng'):
            util.Error('\'airbase-ng\' not found in local path.')
            return False

        self.running = True
        ap_proc = None

        try:
            self.mon_adapt = util.get_monitor_adapter()
            if self.mon_adapt is None:
                self.mon_adapt = util.enable_monitor()

            if self.mon_adapt is None:
                util.Error('Could not find a wireless card in monitor mode')
                self.running = False
                return None

            airbase_cmd = [
                        'airbase-ng',
                        '--essid', self.config['ap_essid'].value,
                        self.mon_adapt
                          ]
            ap_proc = util.init_app(airbase_cmd, False)
            util.Msg('Access point %s running.' % \
                                    self.config['ap_essid'].value)
            raw_input()    # block
        except KeyboardInterrupt:
            self.running = False
        except Exception, er:
            util.Error('Error with wireless AP: %s' % er)
        finally:
            util.disable_monitor()
            util.kill_app(ap_proc)
def initialize ( self ) : if not util . check_program ( 'airbase-ng' ) : util . Error ( '\'airbase-ng\' not found in local path.' ) return False self . running = True ap_proc = None try : self . mon_adapt = util . get_monitor_adapter ( ) if self . mon_adapt is None : self . mon_adapt = util . enable_monitor ( ) if self . mon_adapt is None : util . Error ( 'Could not find a wireless card in monitor mode' ) self . running = False return None airbase_cmd = [ 'airbase-ng' , '--essid' , self . config [ 'ap_essid' ] . value , self . mon_adapt ] ap_proc = util . init_app ( airbase_cmd , False ) util . Msg ( 'Access point %s running.' % self . config [ 'ap_essid' ] . value ) raw_input ( ) # block except KeyboardInterrupt : self . running = False except Exception , er : util . Error ( 'Error with wireless AP: %s' % er ) finally : util . disable_monitor ( ) util . kill_app ( ap_proc )