Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
A
Autopsy
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Iterations
Requirements
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Locked files
Build
Pipelines
Jobs
Pipeline schedules
Test cases
Artifacts
Deploy
Releases
Package registry
Model registry
Operate
Environments
Terraform modules
Monitor
Incidents
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Code review analytics
Issue analytics
Insights
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Terms and privacy
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
IRT
Autopsy
Commits
743b360d
Commit
743b360d
authored
9 years ago
by
Brian Carrier
Browse files
Options
Downloads
Patches
Plain Diff
Added more specific exception handling to python example
parent
f595d3fe
No related branches found
No related tags found
No related merge requests found
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
pythonExamples/Aug2015DataSourceTutorial/FindContactsDb.py
+7
-7
7 additions, 7 deletions
pythonExamples/Aug2015DataSourceTutorial/FindContactsDb.py
pythonExamples/Aug2015DataSourceTutorial/RunExe.py
+3
-1
3 additions, 1 deletion
pythonExamples/Aug2015DataSourceTutorial/RunExe.py
with
10 additions
and
8 deletions
pythonExamples/Aug2015DataSourceTutorial/FindContactsDb.py
+
7
−
7
View file @
743b360d
...
...
@@ -135,16 +135,16 @@ def process(self, dataSource, progressBar):
try
:
Class
.
forName
(
"
org.sqlite.JDBC
"
).
newInstance
()
dbConn
=
DriverManager
.
getConnection
(
"
jdbc:sqlite:%s
"
%
lclDbPath
)
except
:
self
.
log
(
Level
.
INFO
,
"
Could not open database file (not SQLite)
"
+
file
.
getName
())
except
SQLException
as
e
:
self
.
log
(
Level
.
INFO
,
"
Could not open database file (not SQLite)
"
+
file
.
getName
()
+
"
(
"
+
e
.
getMessage
()
+
"
)
"
)
return
IngestModule
.
ProcessResult
.
OK
# Query the contacts table in the database and get all columns.
try
:
try
:
stmt
=
dbConn
.
createStatement
()
resultSet
=
stmt
.
executeQuery
(
"
SELECT * FROM contacts
"
)
except
:
self
.
log
(
Level
.
INFO
,
"
Error querying database for contacts table
"
)
except
SQLException
as
e
:
self
.
log
(
Level
.
INFO
,
"
Error querying database for contacts table
(
"
+
e
.
getMessage
()
+
"
)
"
)
return
IngestModule
.
ProcessResult
.
OK
# Cycle through each row and create artifacts
...
...
@@ -153,8 +153,8 @@ def process(self, dataSource, progressBar):
name
=
resultSet
.
getString
(
"
name
"
)
email
=
resultSet
.
getString
(
"
email
"
)
phone
=
resultSet
.
getString
(
"
phone
"
)
except
:
self
.
log
(
Level
.
INFO
,
"
Error getting values from contacts table
"
)
except
SQLException
as
e
:
self
.
log
(
Level
.
INFO
,
"
Error getting values from contacts table
(
"
+
e
.
getMessage
()
+
"
)
"
)
# Make an artifact on the blackboard, TSK_CONTACT and give it attributes for each of the fields
...
...
This diff is collapsed.
Click to expand it.
pythonExamples/Aug2015DataSourceTutorial/RunExe.py
+
3
−
1
View file @
743b360d
...
...
@@ -134,6 +134,8 @@ def process(self, dataSource, progressBar):
reportHandle
=
open
(
reportPath
,
'
w
'
)
# Run the EXE, saving output to the report
# NOTE: we should really be checking for if the module has been
# cancelled and then killing the process.
self
.
log
(
Level
.
INFO
,
"
Running program on data source
"
)
subprocess
.
Popen
([
self
.
path_to_exe
,
imagePaths
[
0
]],
stdout
=
reportHandle
).
communicate
()[
0
]
reportHandle
.
close
()
...
...
@@ -141,4 +143,4 @@ def process(self, dataSource, progressBar):
# Add the report to the case, so it shows up in the tree
Case
.
getCurrentCase
().
addReport
(
reportPath
,
"
Run EXE
"
,
"
img_stat output
"
)
return
IngestModule
.
ProcessResult
.
OK
\ No newline at end of file
return
IngestModule
.
ProcessResult
.
OK
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment