Skip to content

Bump all generated-file and reviewed-file DFXML version references #45

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 4 commits into from
Jun 24, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 3 additions & 0 deletions dfxml/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -61,6 +61,9 @@

tsk_virtual_filenames = set(['$FAT1','$FAT2'])

# This version string is the version of the DFXML Schema.
DFXML_VERSION = "2.0.0-beta.0"

XMLNS_DC = "http://purl.org/dc/elements/1.1/"
XMLNS_DFXML = "http://www.forensicswiki.org/wiki/Category:Digital_Forensics_XML"
XMLNS_DELTA = "http://www.forensicswiki.org/wiki/Forensic_Disk_Differencing"
Expand Down
4 changes: 2 additions & 2 deletions dfxml/bin/Extractor.py
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@
#
# We would appreciate acknowledgement if the software is used.

__version__ = "0.5.2"
__version__ = "0.6.0"

import copy
import hashlib
Expand Down Expand Up @@ -70,7 +70,7 @@ def extract_files(image_path, outdir, dfxml_path=None, file_predicate=is_file, f
_path_for_iterparse = dfxml_path or image_path

#Set up base manifest to track extracted files
base_manifest = Objects.DFXMLObject(version="1.2.0")
base_manifest = Objects.DFXMLObject()
base_manifest.program = sys.argv[0]
if sys.argv[0] == os.path.basename(__file__):
base_manifest.program_version = __version__
Expand Down
6 changes: 3 additions & 3 deletions dfxml/bin/cat_fileobjects.py
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@
Make a new DFXML file of all fileobjects in an input DFXML file.
"""

__version__ = "0.3.1"
__version__ = "0.4.0"

import logging
import os
Expand All @@ -39,7 +39,7 @@ def main():
<dfxml
xmlns="%s"
xmlns:delta="%s"
version="1.2.0">
version="%s">
<metadata/>
<creator>
<program>%s</program>
Expand All @@ -51,7 +51,7 @@ def main():
<source>
<image_filename>%s</image_filename>
</source>\
""" % (dfxml.XMLNS_DFXML, dfxml.XMLNS_DELTA, sys.argv[0], __version__, " ".join(sys.argv), args.filename))
""" % (dfxml.XMLNS_DFXML, dfxml.XMLNS_DELTA, dfxml.DFXML_VERSION, sys.argv[0], __version__, " ".join(sys.argv), args.filename))

ET.register_namespace("delta", dfxml.XMLNS_DELTA)

Expand Down
4 changes: 2 additions & 2 deletions dfxml/bin/cat_partitions.py
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@
will create a single DFXML file with two volumes and their file objects contained.
"""

__version__ = "0.2.2"
__version__ = "0.3.0"

import logging
import os
Expand All @@ -39,7 +39,7 @@
_logger = logging.getLogger(os.path.basename(__file__))

def main():
d = Objects.DFXMLObject(version="1.2.0")
d = Objects.DFXMLObject()

d.program = sys.argv[0]
d.program_version = __version__
Expand Down
5 changes: 3 additions & 2 deletions dfxml/bin/idifference.py
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@
4. Replace the old maps with the new maps
"""

__version__ = "0.2.0rfc6"
__version__ = "0.3.0rfc7"

import copy
import logging
Expand Down Expand Up @@ -365,6 +365,7 @@ def to_xml(self):
exit(1)

metadict = dict()
metadict["DFXML_VERSION"] = dfxml.DFXML_VERSION
metadict["XMLNS_DFXML"] = dfxml.XMLNS_DFXML
metadict["XMLNS_DELTA"] = dfxml.XMLNS_DELTA
metadict["program"] = sys.argv[0]
Expand All @@ -377,7 +378,7 @@ def to_xml(self):
xmlfile.write("""\
<?xml version="1.0" encoding="UTF-8"?>
<dfxml
version="1.0"
version="%(DFXML_VERSION)s"
xmlns='%(XMLNS_DFXML)s'
xmlns:dc='http://purl.org/dc/elements/1.1/'
xmlns:delta='%(XMLNS_DELTA)s'
Expand Down
4 changes: 2 additions & 2 deletions dfxml/bin/make_differential_dfxml.py
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@
This program's main purpose is matching files correctly. It only performs enough analysis to determine that a fileobject has changed at all. (This is half of the work done by idifference.py.)
"""

__version__ = "0.12.4"
__version__ = "0.13.0"

import argparse
import collections
Expand Down Expand Up @@ -103,7 +103,7 @@ def make_differential_dfxml(
_logger.debug("diff_mask_set = " + repr(diff_mask_set))

#d: The container DFXMLObject, ultimately returned.
d = Objects.DFXMLObject(version="1.2.0")
d = Objects.DFXMLObject()
if sys.argv[0] == os.path.basename(__file__):
d.program = sys.argv[0]
d.program_version = __version__
Expand Down
4 changes: 2 additions & 2 deletions dfxml/bin/walk_to_dfxml.py
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@
Walk current directory, writing DFXML to stdout.
"""

__version__ = "0.4.4"
__version__ = "0.5.0"

import argparse
import collections
Expand Down Expand Up @@ -210,7 +210,7 @@ def main() -> None:
using_threading = False
_logger.warning("Python queue support not available. (If running Ubuntu, this is in package python3-queuelib.) Running in single thread only.")

dobj = Objects.DFXMLObject(version="1.2.0")
dobj = Objects.DFXMLObject()
dobj.program = sys.argv[0]
dobj.program_version = __version__
dobj.command_line = " ".join(sys.argv)
Expand Down
4 changes: 2 additions & 2 deletions dfxml/objects.py
Original file line number Diff line number Diff line change
Expand Up @@ -232,11 +232,11 @@ def child_objects(self):

class DFXMLObject(AbstractParentObject):

def __init__(self, *args, **kwargs) -> None:
def __init__(self, *args: typing.Any, version: str = dfxml.DFXML_VERSION, **kwargs: typing.Any) -> None:
self.command_line = kwargs.get("command_line")
self.program = kwargs.get("program")
self.program_version = kwargs.get("program_version")
self.version = kwargs.get("version")
self.version = version
self.sources = kwargs.get("sources", [])
self.dc = kwargs.get("dc", dict())
self.externals = kwargs.get("externals", OtherNSElementList())
Expand Down
8 changes: 5 additions & 3 deletions dfxml/writer.py
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,9 @@
import __main__
import psutil

__version__="0.1"
from dfxml import DFXML_VERSION

__version__="0.2.0"

###
### Code for working with Apache Spark
Expand Down Expand Up @@ -84,7 +86,7 @@ def __init__(self,heartbeat=None,filename=None,prettyprint=False):
"""
self.t0 = time.time()
self.tlast = time.time()
self.doc = ET.Element('dfxml')
self.doc = ET.Element('dfxml', {'version': DFXML_VERSION})
self.add_DFXML_creator(self.doc)
self.filename = filename
self.timers = {}
Expand Down Expand Up @@ -122,7 +124,7 @@ def add_application_kva(self,key,value=None,attr=None):

def add_DFXML_creator(self,e):
import __main__
ee = ET.SubElement(e, 'creator', {'version':'1.0'})
ee = ET.SubElement(e, 'creator')
try:
ET.SubElement(ee, 'program').text = str(__main__.__file__)
except AttributeError as e:
Expand Down
2 changes: 1 addition & 1 deletion samples/difference_test_0.xml
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
xmlns='http://www.forensicswiki.org/wiki/Category:Digital_Forensics_XML'
xmlns:dc='http://purl.org/dc/elements/1.1/'
xmlns:xsi='http://www.w3.org/2001/XMLSchema-instance'
version='1.1.1'>
version='2.0.0-beta.0'>
<metadata>
<dc:type>Sample</dc:type>
</metadata>
Expand Down
2 changes: 1 addition & 1 deletion samples/difference_test_1.xml
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
xmlns='http://www.forensicswiki.org/wiki/Category:Digital_Forensics_XML'
xmlns:dc='http://purl.org/dc/elements/1.1/'
xmlns:xsi='http://www.w3.org/2001/XMLSchema-instance'
version='1.1.1'>
version='2.0.0-beta.0'>
<metadata>
<dc:type>Sample</dc:type>
</metadata>
Expand Down
2 changes: 1 addition & 1 deletion samples/difference_test_2.xml
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
<dfxml
xmlns='http://www.forensicswiki.org/wiki/Category:Digital_Forensics_XML'
xmlns:dc='http://purl.org/dc/elements/1.1/'
version='1.1.1'>
version='2.0.0-beta.0'>
<metadata>
<dc:type>Sample</dc:type>
</metadata>
Expand Down
2 changes: 1 addition & 1 deletion samples/difference_test_3.xml
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
<dfxml
xmlns='http://www.forensicswiki.org/wiki/Category:Digital_Forensics_XML'
xmlns:dc='http://purl.org/dc/elements/1.1/'
version='1.1.1'>
version='2.0.0-beta.0'>
<metadata>
<dc:type>Sample</dc:type>
</metadata>
Expand Down
2 changes: 1 addition & 1 deletion samples/tcpflow_zip_generic_header.xml
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
xmlns='http://www.forensicswiki.org/wiki/Category:Digital_Forensics_XML'
xmlns:dc='http://purl.org/dc/elements/1.1/'
xmlns:tcpflow='http://www.forensicswiki.org/wiki/Category:Digital_Forensics_XML#tcpflow'
version='1.1.1'>
version='2.0.0-beta.0'>
<metadata>
<dc:type>Sample</dc:type>
</metadata>
Expand Down
2 changes: 1 addition & 1 deletion tests/misc_object_tests/ByteRun_test.py
Original file line number Diff line number Diff line change
Expand Up @@ -246,7 +246,7 @@ def test_glomming_fill():
raise

def test_hash_properties():
dobj = Objects.DFXMLObject(version="1.2.0")
dobj = Objects.DFXMLObject()

fobj = Objects.FileObject()
dobj.append(fobj)
Expand Down
24 changes: 9 additions & 15 deletions tests/misc_object_tests/DiskImageObject_test.py
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@
ERROR_2 = "Error 2"

def test_empty_object():
dobj = Objects.DFXMLObject(version="1.2.0")
dobj = Objects.DFXMLObject()
diobj = Objects.DiskImageObject()
dobj.append(diobj)

Expand All @@ -43,7 +43,7 @@ def test_empty_object():
os.remove(tmp_filename)

def test_sector_size():
dobj = Objects.DFXMLObject(version="1.2.0")
dobj = Objects.DFXMLObject()
diobj = Objects.DiskImageObject()
dobj.append(diobj)

Expand All @@ -61,8 +61,7 @@ def test_sector_size():
os.remove(tmp_filename)

def test_error():
#TODO Bump version when feature branch merged into schema.
dobj = Objects.DFXMLObject(version="1.2.0+")
dobj = Objects.DFXMLObject()
diobj = Objects.DiskImageObject()
dobj.append(diobj)

Expand All @@ -79,35 +78,30 @@ def test_error():
os.remove(tmp_filename)

def test_error_after_partition_system():
#TODO Bump version when feature branch merged into schema.
dobj = Objects.DFXMLObject(version="1.2.0+")
dobj = Objects.DFXMLObject()
diobj = Objects.DiskImageObject()
dobj.append(diobj)

diobj.error = ERROR_1

psobj = Objects.PartitionSystemObject()
#TODO This should be uncommented after the branch add_partition_system_error is merged.
#psobj.error = ERROR_2
psobj.error = ERROR_2
diobj.append(psobj)

# Do file I/O round trip.
(tmp_filename, dobj_reconst) = libtest.file_round_trip_dfxmlobject(dobj)
try:
diobj_reconst = dobj_reconst.disk_images[0]
#TODO This should be uncommented after the branch add_partition_system_error is merged.
#psobj_reconst = diobj_reconst.partitionsystems[0]
psobj_reconst = diobj_reconst.partition_systems[0]
assert diobj_reconst.error == ERROR_1
#TODO This should be uncommented after the branch add_partition_system_error is merged.
#assert psobj_reconst.error == ERROR_2
assert psobj_reconst.error == ERROR_2
except:
_logger.debug("tmp_filename = %r." % tmp_filename)
raise
os.remove(tmp_filename)

def test_error_after_file_system():
#TODO Bump version when feature branch merged into schema.
dobj = Objects.DFXMLObject(version="1.2.0+")
dobj = Objects.DFXMLObject()
diobj = Objects.DiskImageObject()
dobj.append(diobj)

Expand All @@ -131,7 +125,7 @@ def test_error_after_file_system():

def test_error_after_file():
#TODO Bump version when feature branch merged into schema.
dobj = Objects.DFXMLObject(version="1.2.0+")
dobj = Objects.DFXMLObject()
diobj = Objects.DiskImageObject()
dobj.append(diobj)

Expand Down
4 changes: 2 additions & 2 deletions tests/misc_object_tests/FileObject_test.py
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@


def test_empty_file_object() -> None:
dobj = Objects.DFXMLObject(version="1.2.0")
dobj = Objects.DFXMLObject()
fobj = Objects.FileObject()
dobj.append(fobj)

Expand All @@ -43,7 +43,7 @@ def test_empty_file_object() -> None:


def test_blank_file_object_filename() -> None:
dobj = Objects.DFXMLObject(version="1.2.0")
dobj = Objects.DFXMLObject()
fobj = Objects.FileObject()
dobj.append(fobj)

Expand Down
6 changes: 3 additions & 3 deletions tests/misc_object_tests/PartitionObject_test.py
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@
_logger = logging.getLogger(os.path.basename(__file__))

def test_empty_object():
dobj = Objects.DFXMLObject(version="1.2.0")
dobj = Objects.DFXMLObject()
pobj = Objects.PartitionObject()
dobj.append(pobj)

Expand All @@ -43,7 +43,7 @@ def test_cfreds_macwd_properties():
"""
These were drawn from a CFReDS sample Mac disk image.
"""
dobj = Objects.DFXMLObject(version="1.2.0")
dobj = Objects.DFXMLObject()
pobj = Objects.PartitionObject()
dobj.append(pobj)

Expand All @@ -65,7 +65,7 @@ def test_bsd_disklabel_properties():
"""
These were drawn from a BSD Disk Label sample image.
"""
dobj = Objects.DFXMLObject(version="1.2.0")
dobj = Objects.DFXMLObject()
pobj_a = Objects.PartitionObject()
pobj_c = Objects.PartitionObject()
dobj.append(pobj_a)
Expand Down
5 changes: 2 additions & 3 deletions tests/misc_object_tests/PartitionSystemObject_test.py
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@
_logger = logging.getLogger(os.path.basename(__file__))

def test_empty_object():
dobj = Objects.DFXMLObject(version="1.2.0")
dobj = Objects.DFXMLObject()
psobj = Objects.PartitionSystemObject()
dobj.append(psobj)

Expand All @@ -40,8 +40,7 @@ def test_empty_object():
os.remove(tmp_filename)

def test_error_element_order():
#TODO When schema 1.3.0 is released, update version.
dobj = Objects.DFXMLObject(version="1.2.0+")
dobj = Objects.DFXMLObject()
psobj = Objects.PartitionSystemObject()
fobj = Objects.FileObject()

Expand Down
2 changes: 1 addition & 1 deletion tests/misc_object_tests/VolumeObject_externals_test.py
Original file line number Diff line number Diff line change
Expand Up @@ -101,7 +101,7 @@ def test_externals():

def test_prefixed_externals_round_trip():
_logger = logging.getLogger(os.path.basename(__file__))
dobj = Objects.DFXMLObject(version="1.2.0")
dobj = Objects.DFXMLObject()
vobj = Objects.VolumeObject()
dobj.append(vobj)

Expand Down
2 changes: 1 addition & 1 deletion tests/misc_object_tests/VolumeObject_test.py
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@
_logger = logging.getLogger(os.path.basename(__file__))

def test_empty_object():
dobj = Objects.DFXMLObject(version="1.2.0")
dobj = Objects.DFXMLObject()
vobj = Objects.VolumeObject()
dobj.append(vobj)

Expand Down
Loading
Loading