Created
September 7, 2015 12:31
-
-
Save bborysenko/8c87500c92419db40725 to your computer and use it in GitHub Desktop.
Parse tcpflow report to find time of connections
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/env python | |
import untangle | |
import datetime | |
date_format = '%Y-%m-%dT%H:%M:%S.%fZ' | |
obj = untangle.parse('report.xml') | |
for fileobject in obj.dfxml.configuration.fileobject: | |
tcpflow = fileobject.tcpflow | |
startime = datetime.datetime.strptime(tcpflow['startime'], date_format) | |
endtime = datetime.datetime.strptime(tcpflow['endtime'], date_format) | |
delta = endtime - startime | |
print str(delta.seconds) + ":" + str(delta.microseconds) + " | " + str(startime) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment