def wids(self): ''' @brief Return the collected information from wids module. ''' # 먼저 진행 중이던 작업을 취소. if self.pentesting: self.pentesting.stop() self.pentesting = None if self.scanner: self.scanner.stop() self.scanner = None if self.fake_ap: self.fake_ap.stop() self.fake_ap = None if not self.wids_handle: self.wids_handle = Wireless_IDS('atear_wids') self.wids_handle.start() if request.method == 'GET': try: return_value = ast.literal_eval(self.wids_handle.get_values()) return json.dumps(return_value, ensure_ascii=False, encoding='EUC-KR') except: return json.dumps([{}])
def scanstatus(self): ''' It responds to the airodump-scan results. ''' # 먼저 진행 중이던 작업을 취소. #print self.scanner, self.pentesting, self.fake_ap, self.wids_handle if self.pentesting: self.pentesting.stop() self.pentesting = None if self.fake_ap: self.fake_ap.stop() self.fake_ap = None if request.method == 'GET': if not self.scanner: # Class Atear-Beta.module.airodump line 106. self.scanner = airodump.Scanner(self.scan_iface) self.scanner.run() # class AtEar-Beta.module.wids.Wireless_IDS # Prepare a file to store the results. print "[*] START AtEar-WIDS" print BASEPATH if not os.path.isdir(BASEPATH + '/log'): os.mkdir(BASEPATH + '/log') wids = Wireless_IDS(self.scan_iface) # def AtEar-Beta.module.wids.Wireless_IDS.run(self) line 78 # Generate wids.run to child process. wids.start() self.wids_handle = True print "[*] START AtEar-UI" return "[]", 200 else: try: # Return the scan results. return Response(json.dumps(self.scanner.get_value(), cls=PythonObjectEncoder, ensure_ascii=False, encoding='EUC-KR'), mimetype='application/json') except: return "[]", 200 elif request.method == 'POST': if self.scanner: self.scanner.stop() self.scanner = None return '', 200 return '', 200
def main(): ''' @brief AtEar main function. ''' wids_process = False from module.network import auto_monitor, stop_monitor try: print "START AtEar-Beta...." # def AtEar-Beta.module.network.stop_monitor() line 314 # Clear the self-made device. stop_monitor() # def AtEar-Beta.module.network.auto_monitor() line 272 # Search for wireless devices, ensure that the support AP mode or monitor mode, # if support makes the device to the supported mode. ret = auto_monitor() if ret == False: # Not supported or Failed to create device in monitor. stop_monitor() return -1 # class AtEar-Beta.module.wids.Wireless_IDS # Prepare a file to store the results. print "[*] START AtEar-WIDS" wids = Wireless_IDS('atear_wids') # def AtEar-Beta.module.wids.Wireless_IDS.run(self) line 78 # Generate wids.run to child process. wids.start() print "[*] START AtEar-UI" # Class "main_app" is a flask module. main_app(wids) # Stop Signal except KeyboardInterrupt: stop_monitor() if wids_process: wids_process.terminate()
return json.dumps([{}]) return '', 200 def hidden(self, wids_option): if request.method == 'GET': if wids_option == '1': recent_val = wids.get_recent_values() try: recent_val = ast.literal_eval(recent_val) return json.dumps({"message": recent_val}) except: return json.dumps({"message": []}) elif wids_option == '0': wids.stop() return json.dumps({"message": []}) return '', 200 if __name__ == '__main__': from module.network import auto_monitor, stop_monitor try: stop_monitor() auto_monitor() wids = Wireless_IDS('atear_wids') wids_process = Process(target=wids.run) wids_process.start() main_app() # Stop Signal except KeyboardInterrupt: stop_monitor() wids_process.terminate()