ainfosec / FISSURE

The RF and reverse engineering framework for everyone. Follow and ★ to show your support!
https://twitter.com/FissureRF
GNU General Public License v3.0
1.56k stars 85 forks source link

Python3-3.10 Hardcoded Log Files #41

Open trwbox opened 1 year ago

trwbox commented 1 year ago

In PR#39 I mentioned hard coded file names. Specifically in the Log tab of the GUI. After reading more code it became clear that the Log section does not have direct access to the logger being used, meaning some more intricate method is likely needed to make it work properly, and wanted to raise this issue in case somebody has a better idea of how to fix it.

There appear to be a few instances of hardcoded logging file names event.log in the code, dashboard.pyL#647, L#1777, L#1808, and L#7178. This log file can be changed in the file handler in logging.yaml, and if it is changed, it would break all these functions, as that file would no longer exist, or at least not be being used for logging. Ideally this would dynamically handle the changes, allowing for the changing of the log file to work properly.

In my mind, something like this could be added to the fissure_server to dynamically give the file names of the log files in use to any requester. Then corresponding changes in the dashboard to handle this, like only getting a single item from the returned list if there was more than a single file being logged to. But not sure if that is the best option at how to resolve the issue.

    def get_logging_files(self) -> list:
        """Gets all the current files the logger is logging to and returns them as a list

        Returns:
            list: List of all the files the logger is logging to
        """
        # A list that will end up getting returned
        return_list = []
        # Get each of the logging handlers
        for handler in logger.handlers:
            # Only file handlers have the baseFilename attribute
            if hasattr(handler, 'baseFilename'):
                # So if it has that attribute, add the file to the list
                return_list.append(handler.baseFilename)

        # Return the list of files
        return return_list

I think this issue also effects the Pyhton3-3.8 branch as well, and a similar fix of dynamically getting the logging file name should also work there too.