Class FileHandler
-
Nested Class Summary
Nested ClassesModifier and TypeClassDescriptionstatic classClass that holds information about a file type. -
Field Summary
FieldsModifier and TypeFieldDescriptionstatic final StringThe path to the directory where the actual (of this Fuzzer run) log files are stored.static final StringThe path to the directory where the actual log files (of this Fuzzer run) are stored.static final booleanIndicates whether the user wants to clean directories.static final StringThe path to the log_overview.csv file.static intCount the amount of times the fuzzer has run.static final StringThe name of the log file, not the full path!static final StringThe path to the log_errorHistory.csv file.static final StringThe path to the log.csv file.static final StringThe name of the log file, not the full path!static final StringThe path to the log.txt file.static final StringThe path to the log_fullHistory.csv file.static StringThe path to the aboutTheFuzzer.html file in the log_fullHistory_html subdirectory.static StringThe path to the allMaps.html file in the log_fullHistory_html subdirectory.static StringThe path to the log_fullHistory_html subdirectory.static StringThe path to the index.html file in the log_fullHistory_html subdirectory.static StringThe path to the reportAndFuzzLessons.html file in the log_fullHistory_html subdirectory.static StringThe path to the welcome.html file in the log_fullHistory_html subdirectory.static final booleanIndicates whether log history files are generated.static final StringThe path to the log_history.csv file.static final StringThe path to the overall directory where the log files are located.static final StringThe path to the overall directory where the map files are located.static final StringThe path to the directory where the overview log files are stored.static final StringThe path to the directory where the previous log files are stored.static final StringThe path to the directory where the previous log files are stored. -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionstatic StringgetFileName(String filePath) Get the name of the map file on this pathstatic StringgetFileText(String filePath) Gives the full text of the text filevoidUpdates the fuzzAttemptNr with the correct number in its text file.static StringnormalizeFilePath(String filePath) Default values of normalizeFilePath are forward slash and absolute pathstatic PathnormalizeFilePath(String filePath, boolean backlash) Returns a cleaned-up file path as Path object, taking into account different uses of / and \static StringnormalizeFilePath(String filePath, boolean backlash, boolean relative) Returns a clean-up file path as string, taking into account different uses of / and \ and if the path should be relativestatic PathnormalizeFilePath(Path filePath, boolean backlash) Returns a cleaned-up file path as Path object, taking into account different uses of / and \
-
Field Details
-
cleanDirectories
public static final boolean cleanDirectoriesIndicates whether the user wants to clean directories. Default: false.When cleanDirectories is set to true, the maps directory and logs directory are cleaned, removing all files except sample.map, log_history.csv, and log_errorHistory.csv.
If cleanDirectories is set to false, subdirectories (actual_logs and previous_logs) are created in the logs directory to store the current and previous log and CSV files, respectively. Similarly, subdirectories (actual_maps and previous_maps) are created in the maps directory to store the current and previous map files, respectively.
-
logHistory
public static final boolean logHistoryIndicates whether log history files are generated. Default: true.If logHistory is set to true, log_history.csv and log_errorHistory.csv are generated in the main logs directory. These files provide detailed information about the history of previous runs, including timestamps, execution times, exit code counts, and error code and output message combinations.
-
mapsDirectoryPath
The path to the overall directory where the map files are located. Path of the system project root + mapsFilePath=maps default config Default: ${project.root}/fuzzresults/maps -
actualMapsDirectoryPath
The path to the directory where the actual log files (of this Fuzzer run) are stored. Default: ${project.root}/fuzzresults/maps/actual_maps/ -
previousMapsDirectoryPath
The path to the directory where the previous log files are stored. These were already there before Fuzz started to run, whether that be in actual_maps or previous_maps. Default: ${project.root}/fuzzresults/maps/previous_maps/ -
logsDirectoryPath
The path to the overall directory where the log files are located. Path of the system project root + logFilePath=logs default config Default: ${project.root}/fuzzresults/logs -
overviewLogsDirectoryPath
The path to the directory where the overview log files are stored. Default: ${project.root}/fuzzresults/logs/overview_logs/ -
actualLogsDirectoryPath
The path to the directory where the actual (of this Fuzzer run) log files are stored. Default: ${project.root}/fuzzresults/logs/actual_logs/ -
previousLogsDirectoryPath
The path to the directory where the previous log files are stored. These were already there before Fuzz started to run, whether that be in actual_logs or previous_logs. Default: ${project.root}/fuzzresults/logs/previous_logs/ -
logFileName
The name of the log file, not the full path! Only the "log.txt" part. Default: log.txt -
logFilePath
The path to the log.txt file. Default: ${project.root}/fuzzresults/logs/actual_logs/log.txt -
logCSVFileName
The name of the log file, not the full path! Only the "log.csv" part. Default: log.csv -
logFileCSVPath
The path to the log.csv file. Default: ${project.root}/fuzzresults/logs/actual_logs/log.csv -
csvFilePath
The path to the log_overview.csv file. Default: ${project.root}/fuzzresults/logs/actual_logs/log_overview.csv -
logErrorHistoryFilePath
The path to the log_errorHistory.csv file. Default: ${project.root}/fuzzresults/logs/log_errorHistory.csv -
logFullHistoryFilePath
The path to the log_fullHistory.csv file. Default: ${project.root}/fuzzresults/logs/log_fullHistory.csv -
logHistoryFilePath
The path to the log_history.csv file. Default: ${project.root}/fuzzresults/logs/log_history.csv -
logFullHistoryHTMLDirectoryPath
The path to the log_fullHistory_html subdirectory. Default: ${project.root}/fuzzresults/logs/overview_logs/log_fullHistory_html/ -
logFullHistoryHTMLHomeFilePath
The path to the index.html file in the log_fullHistory_html subdirectory. Default: ${project.root}/fuzzresults/logs/overview_logs/log_fullHistory_html/index.html -
logFullHistoryHTMLAboutTheFuzzerFilePath
The path to the aboutTheFuzzer.html file in the log_fullHistory_html subdirectory. Default: ${project.root}/fuzzresults/logs/overview_logs/log_fullHistory_html/aboutTheFuzzer.html -
logFullHistoryHTMLReportAndFuzzLessonsFilePath
The path to the reportAndFuzzLessons.html file in the log_fullHistory_html subdirectory. Default: ${project.root}/fuzzresults/logs/overview_logs/log_fullHistory_html/reportAndFuzzLessons.html -
logFullHistoryHTMLAllMapsFilePath
The path to the allMaps.html file in the log_fullHistory_html subdirectory. Default: ${project.root}/fuzzresults/logs/overview_logs/log_fullHistory_html/allMaps.html -
logFullHistoryHTMLWelcomeFilePath
The path to the welcome.html file in the log_fullHistory_html subdirectory. -
fuzzAttemptNr
public static int fuzzAttemptNrCount the amount of times the fuzzer has run.We could also just count in fuzz class -> would not take into account cleanDirectories and the user deleting * any fuzz-result directory. * We could also just count the highest subDirectory of previous -> would not take into account the user deleting the * actual_maps of his latest run or the user deleting any previous_ directories. We want the count to be accurate when deleting * runs (e.g. deleting run_3 should still give us run_4 and not a new run_3). This is because otherwise the log files * would have the wrong number in their overview files, since the lines of the deleted run_3 will still be in the log files.
-
-
Constructor Details
-
FileHandler
public FileHandler()
-
-
Method Details
-
initializeDirectories
public void initializeDirectories()Updates the fuzzAttemptNr with the correct number in its text file. Initializes the necessary directories for file handling. Creates the overall result, logs, and maps directories. Moves existing files and directories from the actual_logs and actual_maps directories to the previous_logs and previous_maps directories, respectively, based on the clean-up rules. -
getFileName
Get the name of the map file on this path- Parameters:
filePath- Relative filepath- Returns:
- String filename of the map.
-
getFileText
Gives the full text of the text file- Parameters:
filePath- Relative filepath to project, without extension.- Returns:
- String full text of file
-
normalizeFilePath
Returns a clean-up file path as string, taking into account different uses of / and \ and if the path should be relative- Parameters:
filePath- String filePath that needs to be cleaned upbacklash- boolean if backslash should be used instead of forward slashrelative- boolean if the path should be relative- Returns:
- String file path that only has single \ or / in it
-
normalizeFilePath
Default values of normalizeFilePath are forward slash and absolute path- Parameters:
filePath- String absolute file path- Returns:
- filePath String absolute file path with /
-
normalizeFilePath
Returns a cleaned-up file path as Path object, taking into account different uses of / and \- Parameters:
filePath- String absolute file pathbacklash- boolean if backslash should be used instead of forward slash- Returns:
- filePath Path object
-
normalizeFilePath
Returns a cleaned-up file path as Path object, taking into account different uses of / and \- Parameters:
filePath- Path objectbacklash- if backslash should be used instead of forward slash- Returns:
- filePath Path object
-