Skip to content

Commit

Permalink
Updated for Python3 compatibility
Browse files Browse the repository at this point in the history
  • Loading branch information
Silv3rHorn committed Nov 21, 2018
1 parent ef979f7 commit 0a233b8
Show file tree
Hide file tree
Showing 3 changed files with 12 additions and 3 deletions.
2 changes: 2 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,4 +1,6 @@
# evtx2json
![](https://img.shields.io/badge/python-2.7-blue.svg) ![](https://img.shields.io/badge/python-3.7-blue.svg)

evtx2json extracts supported events from event logs, dedups them, and exports them
to json.

Expand Down
6 changes: 4 additions & 2 deletions evtl_selector.py
Original file line number Diff line number Diff line change
Expand Up @@ -123,8 +123,10 @@ def get_selection():
if not _validate_input(options):
return False

options.dir = os.path.abspath(options.dir)
options.file = os.path.abspath(options.file)
if options.dir is not None:
options.dir = os.path.abspath(options.dir)
if options.file is not None:
options.file = os.path.abspath(options.file)
options.output = os.path.abspath(options.output)

options.cat = _parse_selection(options.cat)
Expand Down
7 changes: 6 additions & 1 deletion evtx2json.py
Original file line number Diff line number Diff line change
Expand Up @@ -155,7 +155,12 @@ def run(options, output_path):
supported_events = getattr(events, evtl_name)

for _ in node.xpath("/Event/System/EventID"):
event_id = int(node.xpath("/Event/System/EventID")[0].text)
try:
event_id = int(node.xpath("/Event/System/EventID")[0].text)
except TypeError: # e.g. None
event_id = -1
continue

if event_id not in supported_events:
continue # skip record

Expand Down

0 comments on commit 0a233b8

Please sign in to comment.