Last active
August 22, 2020 01:02
-
-
Save truekonrads/8953b4ad5f650594ba631b0a4158e804 to your computer and use it in GitHub Desktop.
Retrieve a particular http2 stream for packet capture
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 pyshark | |
import sys | |
cap=pyshark.FileCapture(sys.argv[1]) | |
targetstream=sys.argv[2] | |
for p in cap: | |
if "http2" in p: | |
i=0 | |
for s in p.http2.stream.all_fields: | |
val=s.showname_value | |
if val.startswith("DATA"): | |
if "Stream ID: {}".format(targetstream) in val: | |
sys.stdout.write(p.http2.data_data.all_fields[i].binary_value) | |
i+=1 | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment