Skip to content

Commit

Permalink
Support relative paths
Browse files Browse the repository at this point in the history
  • Loading branch information
Tim Walsh committed Jan 10, 2017
1 parent 0cb14c1 commit 2eb79d8
Show file tree
Hide file tree
Showing 3 changed files with 15 additions and 12 deletions.
4 changes: 3 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
## Brunnhilde - A reporting companion to Siegfried

### Version: Brunnhilde 1.4.0
### Version: Brunnhilde 1.4.1

Generates aggregate reports of files in a directory or disk image based on input from Richard Lehane's [Siegfried](http://www.itforarchivists.com/siegfried).

Expand Down Expand Up @@ -70,6 +70,8 @@ optional arguments:

For file paths containing spaces in directory names, enclose the entire path in '' or "" quotes.

In Brunnhilde 1.4.1+, Brunnhilde will accept absolute or relative paths for source and destination.

For example, the command `brunnhilde.py -z "/home/bcadmin/Desktop/Folder to Scan" /home/bcadmin/Desktop brunnhilde-test-0` will result in a new directory "brunnhilde-test-0" on the Bitcurator desktop containing various reports on input source "Folder to Scan".

### Virus scanning
Expand Down
21 changes: 11 additions & 10 deletions brunnhilde.py
Original file line number Diff line number Diff line change
Expand Up @@ -181,7 +181,7 @@ def get_stats(args, source_dir, scan_started, cursor, html, brunnhilde_version,
html.write('\n<body max>')
html.write('\n<h1>Brunnhilde HTML report</h1>')
html.write('\n<h3>Input source (directory or disk image)</h3>')
html.write('\n<p>%s</p>' % os.path.abspath(args.source))
html.write('\n<p>%s</p>' % source)
html.write('\n<h3>Accession/Identifier</h3>')
html.write('\n<p>%s</p>' % basename)
html.write('\n<h2>Provenance information</h2>')
Expand Down Expand Up @@ -451,15 +451,16 @@ def _make_parser(version):

def main():
# system info
brunnhilde_version = 'brunnhilde 1.4.0'
brunnhilde_version = 'brunnhilde 1.4.1'
siegfried_version = subprocess.check_output(["sf", "-version"]).decode()

parser = _make_parser(brunnhilde_version)
args = parser.parse_args()

# global variables
global destination, basename, report_dir, csv_dir, log_dir, bulkext_dir, sf_file
destination = args.destination
global source, destination, basename, report_dir, csv_dir, log_dir, bulkext_dir, sf_file
source = os.path.abspath(args.source)
destination = os.path.abspath(args.destination)
basename = args.basename
report_dir = os.path.join(destination, '%s' % basename)
csv_dir = os.path.join(report_dir, 'csv_reports')
Expand Down Expand Up @@ -513,7 +514,7 @@ def main():

# export disk image contents to tempdir
if args.hfs == True: # hfs disks
carvefiles = "bash /usr/share/hfsexplorer/bin/unhfs -v -resforks APPLEDOUBLE -o '%s' '%s'" % (tempdir, args.source)
carvefiles = "bash /usr/share/hfsexplorer/bin/unhfs -v -resforks APPLEDOUBLE -o '%s' '%s'" % (tempdir, source)
print("\nAttempting to carve files from disk image using HFS Explorer.")
try:
subprocess.call(carvefiles, shell=True)
Expand All @@ -525,7 +526,7 @@ def main():
sys.exit()

else: # non-hfs disks (note: no UDF support yet)
carvefiles = ['tsk_recover', '-a', args.source, tempdir]
carvefiles = ['tsk_recover', '-a', source, tempdir]
print("\nAttempting to carve files from disk image using tsk_recover.")
try:
subprocess.check_output(carvefiles)
Expand All @@ -548,14 +549,14 @@ def main():


else: #source is a directory
if os.path.isdir(args.source) == False:
if os.path.isdir(source) == False:
print("\nSource is not a Directory. If you're processing a disk image, place '-d' before source.")
sys.exit()
if args.noclam == False: # run clamAV virus check unless specified otherwise
run_clamav(args.source)
process_content(args, args.source, cursor, conn, html, brunnhilde_version, siegfried_version)
run_clamav(source)
process_content(args, source, cursor, conn, html, brunnhilde_version, siegfried_version)
if args.bulkextractor == True: # bulk extractor option is chosen
run_bulkext(args.source)
run_bulkext(source)
write_html('Personally Identifiable Information (PII)', '%s' % os.path.join(bulkext_dir, 'pii.txt'), '\t', html)

# close HTML file
Expand Down
2 changes: 1 addition & 1 deletion setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@

setup(
name = 'brunnhilde',
version = '1.4.0',
version = '1.4.1',
url = 'https://github.com/timothyryanwalsh/brunnhilde',
author = 'Tim Walsh',
author_email = '[email protected]',
Expand Down

0 comments on commit 2eb79d8

Please sign in to comment.