diff options
author | Daniel Baumann <daniel.baumann@progress-linux.org> | 2024-04-19 17:40:56 +0000 |
---|---|---|
committer | Daniel Baumann <daniel.baumann@progress-linux.org> | 2024-04-19 17:40:56 +0000 |
commit | c248d29056abbc1fc4c5dc178bab48fb8d2c1fcb (patch) | |
tree | 4a13fc30604509224504e1911bc976e5df7bdf05 /test/pcaptohtp.py | |
parent | Initial commit. (diff) | |
download | libhtp-c248d29056abbc1fc4c5dc178bab48fb8d2c1fcb.tar.xz libhtp-c248d29056abbc1fc4c5dc178bab48fb8d2c1fcb.zip |
Adding upstream version 1:0.5.47.upstream/1%0.5.47
Signed-off-by: Daniel Baumann <daniel.baumann@progress-linux.org>
Diffstat (limited to '')
-rw-r--r-- | test/pcaptohtp.py | 17 |
1 files changed, 17 insertions, 0 deletions
diff --git a/test/pcaptohtp.py b/test/pcaptohtp.py new file mode 100644 index 0000000..3686363 --- /dev/null +++ b/test/pcaptohtp.py @@ -0,0 +1,17 @@ +import sys +import binascii + +# Transforms a pcap into a test file for libhtp +# tshark -Tfields -e tcp.dstport -e tcp.payload -r input.pcap > input.txt +# python pcaptohtp.py input.txt > input.t + +f = open(sys.argv[1]) +for l in f.readlines(): + portAndPl=l.split() + if len(portAndPl) == 2: + # determine request or response based on port + if portAndPl[0] == "80": + print(">>>") + else: + print("<<<") + print(binascii.unhexlify(portAndPl[1].replace(":",""))) |