File tree Expand file tree Collapse file tree 2 files changed +10
-2
lines changed
Expand file tree Collapse file tree 2 files changed +10
-2
lines changed Original file line number Diff line number Diff line change 1515# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
1616# See the License for the specific language governing permissions and
1717# limitations under the License.
18+ import sys
1819import string
1920
2021from .Nodes import RootNode
@@ -153,7 +154,10 @@ def rec(root_node):
153154 f = _make_template_xml_view (root_node , cache = cache )
154155 subs_strs = []
155156 for sub in root_node .fast_substitutions ():
156- if isinstance (sub , str ):
157+ # ugly hack for supporting is-string on py2 and py3
158+ if sys .version_info < (3 , ) and isinstance (sub , basestring ):
159+ subs_strs .append (sub )
160+ elif sys .version_info >= (3 , ) and isinstance (sub , str ):
157161 subs_strs .append (sub )
158162 elif isinstance (sub , RootNode ):
159163 subs_strs .append (rec (sub ))
Original file line number Diff line number Diff line change 2626from Evtx .Views import evtx_file_xml_view
2727
2828
29+ def ascii (s ):
30+ return s .encode ('ascii' , 'replace' ).decode ('ascii' )
31+
32+
2933def main ():
3034 parser = argparse .ArgumentParser (
3135 description = "Dump a binary EVTX file into XML." )
@@ -42,7 +46,7 @@ def main():
4246 print ("<?xml version=\" 1.0\" encoding=\" utf-8\" standalone=\" yes\" ?>" )
4347 print ("<Events>" )
4448 for xml , record in evtx_file_xml_view (fh ):
45- print (xml )
49+ print (ascii ( xml ) )
4650 print ("</Events>" )
4751
4852if __name__ == "__main__" :
You can’t perform that action at this time.
0 commit comments