From: Eduardo Ramos Testillano (ert) Date: Tue, 6 Jul 2021 07:49:38 +0000 (+0200) Subject: Add more utilities for ADML-HTTP image X-Git-Url: https://git.teslayout.com/public/public/public/?a=commitdiff_plain;h=64cc135e716c2ef018227375fc4f15ff0670fdf7;p=anna.git Add more utilities for ADML-HTTP image jq and decode helper are added --- diff --git a/docker-images/anna-adml-http/Dockerfile b/docker-images/anna-adml-http/Dockerfile index 9a3a7a7..c155c3e 100644 --- a/docker-images/anna-adml-http/Dockerfile +++ b/docker-images/anna-adml-http/Dockerfile @@ -7,6 +7,7 @@ RUN DEBIAN_FRONTEND=noninteractive apt-get update && apt-get install -y tshark RUN apt-get update && apt-get install -y \ net-tools \ procps \ + jq \ python3 \ python3-pip diff --git a/example/diameter/launcher/resources/scripts/decode.sh b/example/diameter/launcher/resources/scripts/decode.sh new file mode 100755 index 0000000..c2ca72e --- /dev/null +++ b/example/diameter/launcher/resources/scripts/decode.sh @@ -0,0 +1,21 @@ +#!/bin/bash +# Diameter decoder for ADML-HTTP + +[ -z "$1" ] && echo "Usage: $0 " && exit 1 +PCAP=$(readlink -f $1 2>/dev/null) +[ ! -f "${PCAP}" ] && echo "Invalid or missing file '$1'" && exit 1 +PCAP_BN=$(basename ${PCAP} .pcap) +PCAP_DN=$(dirname ${PCAP}) + +cd $(dirname $0) + +./tsharkDecoder.sh ${PCAP} + +# Decode hex data: +trap "rm -f .body.json" EXIT +for hex in $(ls ${PCAP_DN}/*.hex 2>/dev/null) +do + echo "{\"diameterHex\":\"$(cat ${hex})\"}" > .body.json + curl -s -XPOST --http2-prior-knowledge -d@./.body.json http://localhost:8074/decode | jq -r '.response' | base64 -d > ${hex}.xml +done + diff --git a/tools/build-anna-adml-http b/tools/build-anna-adml-http index 7a42e1c..a7e7e4d 100755 --- a/tools/build-anna-adml-http +++ b/tools/build-anna-adml-http @@ -33,6 +33,7 @@ echo ${AD} | ${REPO_DIR}/example/diameter/launcher/deploy-adml-http.sh ${VARIANT # Add interesting stuff: cp -r ${REPO_DIR}/example/diameter/launcher/resources/rest_api/helpers/diameterJsonHelper ${AD} cp ${REPO_DIR}/example/diameter/pcapDecoder/tsharkDecoder.sh ${AD} +cp ${REPO_DIR}/example/diameter/launcher/resources/scripts/decode.sh ${AD} echo echo "Generate docker image ..."