diff --git a/pythonExamples/Registry_Example.py b/pythonExamples/Registry_Example.py index fb06e5c971..c9228d376f 100644 --- a/pythonExamples/Registry_Example.py +++ b/pythonExamples/Registry_Example.py @@ -179,20 +179,16 @@ class RegistryExampleIngestModule(DataSourceIngestModule): artType = skCase.getArtifactType("TSK_REGISTRY_RUN_KEYS") try: - addArtifactAttributeType(String - attrTypeString, TSK_BLACKBOARD_ATTRIBUTE_VALUE_TYPE - valueType, String - displayName) attributeIdRunKeyName = skCase.addArtifactAttributeType("TSK_REG_RUN_KEY_NAME", BlackboardAttribute.TSK_BLACKBOARD_ATTRIBUTE_VALUE_TYPE.STRING, "Run Key Name") - except: + except: self.log(Level.INFO, "Attributes Creation Error, TSK_REG_RUN_KEY_NAME, May already exist. ") try: attributeIdRunKeyValue = skCase.addArtifactAttributeType("TSK_REG_RUN_KEY_VALUE", BlackboardAttribute.TSK_BLACKBOARD_ATTRIBUTE_VALUE_TYPE.STRING, "Run Key Value") - except: + except: self.log(Level.INFO, "Attributes Creation Error, TSK_REG_RUN_KEY_VALUE, May already exist. ") try: attributeIdRegKeyLoc = skCase.addArtifactAttributeType("TSK_REG_KEY_LOCATION", BlackboardAttribute.TSK_BLACKBOARD_ATTRIBUTE_VALUE_TYPE.STRING, "Registry Key Location") - except: + except: self.log(Level.INFO, "Attributes Creation Error, TSK_REG_KEY_LOCATION, May already exist. ") attributeIdRunKeyName = skCase.getAttributeType("TSK_REG_RUN_KEY_NAME") diff --git a/pythonExamples/Sept2015ReportTutorial_CSV/CsvReportModule.py b/pythonExamples/Sept2015ReportTutorial_CSV/CsvReportModule.py index 5cf87cdc93..11bf862b95 100644 --- a/pythonExamples/Sept2015ReportTutorial_CSV/CsvReportModule.py +++ b/pythonExamples/Sept2015ReportTutorial_CSV/CsvReportModule.py @@ -37,6 +37,7 @@ import os +import codecs from java.lang import System from java.util.logging import Level from org.sleuthkit.datamodel import TskData @@ -72,11 +73,11 @@ class CSVReportModule(GeneralReportModuleAdapter): # The 'baseReportDir' object being passed in is a string with the directory that reports are being stored in. Report should go into baseReportDir + getRelativeFilePath(). # The 'progressBar' object is of type ReportProgressPanel. # See: http://sleuthkit.org/autopsy/docs/api-docs/latest/classorg_1_1sleuthkit_1_1autopsy_1_1report_1_1_report_progress_panel.html - def generateReport(self, baseReportDir, progressBar): + def generateReport(self, reportSettings, progressBar): # Open the output file. - fileName = os.path.join(baseReportDir, self.getRelativeFilePath()) - report = open(fileName, 'w') + fileName = os.path.join(reportSettings.getReportDirectoryPath(), self.getRelativeFilePath()) + report = codecs.open(fileName, "w", "utf-8") # Query the database for the files (ignore the directories) sleuthkitCase = Case.getCurrentCase().getSleuthkitCase() diff --git a/pythonExamples/reportmodule.py b/pythonExamples/reportmodule.py index 33c6941eda..b1b194b3c4 100644 --- a/pythonExamples/reportmodule.py +++ b/pythonExamples/reportmodule.py @@ -70,7 +70,7 @@ class SampleGeneralReportModule(GeneralReportModuleAdapter): # The 'baseReportDir' object being passed in is a string with the directory that reports are being stored in. Report should go into baseReportDir + getRelativeFilePath(). # The 'progressBar' object is of type ReportProgressPanel. # See: http://sleuthkit.org/autopsy/docs/api-docs/latest/classorg_1_1sleuthkit_1_1autopsy_1_1report_1_1_report_progress_panel.html - def generateReport(self, baseReportDir, progressBar): + def generateReport(self, reportSettings, progressBar): # For an example, we write a file with the number of files created in the past 2 weeks # Configure progress bar for 2 tasks @@ -95,7 +95,7 @@ class SampleGeneralReportModule(GeneralReportModuleAdapter): progressBar.increment() # Write the count to the report file. - fileName = os.path.join(baseReportDir, self.getRelativeFilePath()) + fileName = os.path.join(reportSettings.getReportDirectoryPath(), self.getRelativeFilePath()) report = open(fileName, 'w') report.write("file count = %d" % fileCount) report.close()