def fakeap(self): if request.method == 'POST': options = request.get_json() self.fake_ap = APCreate(self.ap_iface, options['enc'], options['ssid'], options['password']) self.fake_ap.run() return '', 200 elif request.method == 'GET': if self.fake_ap: try: connstation = self.fake_ap.get_values_connect() connstation = connstation.replace('\\', '').replace( '\"', '').replace(', ]', ']') loginstation = self.fake_ap.get_values_login() loginstation = loginstation.replace('\\', '').replace( '\"', '').replace(', ]', ']') return json.dumps({ "connstation": connstation, "loginstation": loginstation }) except: return json.dumps({"connstation": '', "loginstation": ''}) else: return json.dumps({"connstation": '', "loginstation": ''}) elif request.method == 'DELETE': self.fake_ap.stop() self.fake_ap = False return '', 200 return '', 200
def fakeap(self): ''' @brief Create fake-AP ''' # 먼저 진행 중이던 작업을 취소. if self.wids_handle: self.wids_handle.terminate() self.wids_handle.join() self.wids_handle = None if self.scanner: self.scanner.stop() self.scanner = None if self.pentesting: self.pentesting.stop() self.pentesting = None if request.method == 'POST': # Create Fake-AP with parameters from user selected. if self.fake_ap: self.fake_ap.stop() monitormode_change(self.scan_iface) options = request.get_json() self.fake_ap = APCreate(self.self.scan_iface, options['enc'], options['ssid'], options['password']) self.fake_ap.run() elif request.method == 'GET': if self.fake_ap: try: # Load the collected device information. connstation = self.fake_ap.get_values_connect() connstation = connstation.replace('\\', '').replace( '\"', '').replace(', ]', ']') # Load the collected user login information. loginstation = self.fake_ap.get_values_login() loginstation = loginstation.replace('\\', '').replace( '\"', '').replace(', ]', ']') return json.dumps({ "connstation": connstation, "loginstation": loginstation }) except: return json.dumps({"connstation": '', "loginstation": ''}) else: return json.dumps({"connstation": '', "loginstation": ''}) elif request.method == 'DELETE': # Stop fake_AP if self.fake_ap: self.fake_ap.stop() self.fake_ap = None return '', 200