Exemple #1
0
    def on_any_event(event):
        if event.is_directory:
            return None

        elif event.event_type == 'created':
            # Take any action here when a file is first created.
            print("Received created event - %s." % event.src_path)
            # send the file using the FTP server
            # get results and notify accordingly
            full_path_event = SEARCH_DIR + "\\" +os.path.basename(event.src_path)

            saved_bytes_fname = ml_exe_to_hexbytes.get_hexdump_output(full_path_event)
            ml_result = ml_client.send_file_to_server(saved_bytes_fname)
            print(ml_result)
            sbx_result, signature_list = sbx_client.send_file_to_server(full_path_event)
            print(signature_list)
            if ml_result.__contains__("1") and float(sbx_result)*0.01 >= 0.8:
            # if float(sbx_result) * 0.01 >= 0.8:
                notification_manager.notify(os.path.basename(event.src_path), signature_list)
 def stop(self):
     self.ffmpeg_manager.stop()
     self.thread = None
     notification_manager.notify("Streaming stopped")
 def start(self):
     assert self.thread == None
     self.thread = StreamThread(self)
     self.thread.start()
     notification_manager.notify("Streaming started")