Skip to content
GitLab
Menu
Projects
Groups
Snippets
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
Menu
Open sidebar
oai
openairinterface5G
Commits
66284e57
Commit
66284e57
authored
Oct 01, 2015
by
gauthier
Browse files
added pdml to html
git-svn-id:
http://svn.eurecom.fr/openair4G/trunk@7867
818b1a75-f10b-46b9-bf7c-635c3b92a50f
parent
849fff3d
Changes
1
Hide whitespace changes
Inline
Side-by-side
openair-cn/TEST/EPC_TEST/mme_test_s1_pcap2pdml
View file @
66284e57
...
...
@@ -9,8 +9,8 @@ from datetime import date
import
os
,
errno
import
argparse
import
tempfile
from
lxml
import
etree
from
xml.dom.minidom
import
parse
,
parseString
#from xml.etree.ElementTree import ElementTree
#####################
# program arguments
...
...
@@ -26,8 +26,6 @@ orig_pcap_file_name = args.pcap_file.strip()
orig_pdml_string
=
subprocess
.
check_output
([
"tshark"
,
'-T'
,
'pdml'
,
'-r'
,
orig_pcap_file_name
])
orig_dom
=
parseString
(
orig_pdml_string
)
#orig_etree = ElementTree()
#orig_etree.parse(orig_pcap_pdml_file.name)
#####################
# filtering unwanted packets
...
...
@@ -67,10 +65,28 @@ for line in lines:
cleaned_pdml_string
+=
line
+
'
\r\n
'
#print "'%s'" % cleaned_pdml_string
#####################
# write
x
ml string to pdml file
# write
pd
ml string to pdml file
#####################
out_pdml_file_name
=
os
.
path
.
dirname
(
orig_pcap_file_name
)
+
os
.
path
.
splitext
(
os
.
path
.
basename
(
orig_pcap_file_name
))[
0
]
+
'.pdml'
out_file
=
open
(
out_pdml_file_name
,
"w"
)
out_file
.
write
(
cleaned_pdml_string
)
out_file
.
close
()
############################################################
# DECEIVING HTML BONUS: DO NOT SEEM TO WORK CORRECTLY IN FIREFOX
# DID NOT INVESTIGATE
#####################
# write xml string to html file
#####################
xsl_root
=
etree
.
fromstring
(
open
(
'/usr/share/wireshark/pdml2html.xsl'
).
read
())
transform
=
etree
.
XSLT
(
xsl_root
)
xml_root
=
etree
.
fromstring
(
cleaned_pdml_string
)
trans_root
=
transform
(
xml_root
)
filtered_html_string
=
etree
.
tostring
(
trans_root
)
#####################
# write html string to html file
#####################
out_html_file_name
=
os
.
path
.
dirname
(
orig_pcap_file_name
)
+
os
.
path
.
splitext
(
os
.
path
.
basename
(
orig_pcap_file_name
))[
0
]
+
'.html'
out_file
=
open
(
out_html_file_name
,
"w"
)
out_file
.
write
(
filtered_html_string
)
out_file
.
close
()
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment