2 # Diameter decoder for ADML-HTTP
4 [ -z "$1" ] && echo "Usage: $0 <pcap file>" && exit 1
5 PCAP=$(readlink -f $1 2>/dev/null)
6 [ ! -f "${PCAP}" ] && echo "Invalid or missing file '$1'" && exit 1
7 PCAP_BN=$(basename ${PCAP} .pcap)
8 PCAP_DN=$(dirname ${PCAP})
12 ./tsharkDecoder.sh ${PCAP}
15 trap "rm -f .body.json" EXIT
16 for hex in $(ls ${PCAP_DN}/*.hex 2>/dev/null)
18 echo "{\"diameterHex\":\"$(cat ${hex})\"}" > .body.json
19 curl -s -XPOST --http2-prior-knowledge -d@./.body.json http://localhost:8074/decode | jq -r '.response' | base64 -d > ${hex}.xml