From 0a5526e8b48e361a51f3590b997d80a8e9dd09a9 Mon Sep 17 00:00:00 2001 From: kexkey Date: Sun, 22 Mar 2020 22:30:58 -0400 Subject: [PATCH] Fixed proxychains output in OTS as well as multiple-line body on POST reqs --- otsclient_docker/script/otsclient.sh | 12 ++++++------ proxy_docker/app/script/requesthandler.sh | 3 ++- 2 files changed, 8 insertions(+), 7 deletions(-) diff --git a/otsclient_docker/script/otsclient.sh b/otsclient_docker/script/otsclient.sh index bdeb254..3601cd8 100644 --- a/otsclient_docker/script/otsclient.sh +++ b/otsclient_docker/script/otsclient.sh @@ -21,11 +21,11 @@ stamp() { if [ "${TESTNET}" -eq "1" ]; then trace "[stamp] ${proxychains} ots-cli.js stamp -c \"https://ots.testnet.kexkey.com\" -d ${hash}" - result=$(cd /otsfiles && sh -c "${proxychains} ots-cli.js stamp -c 'https://ots.testnet.kexkey.com' -d ${hash} 2>&1") + result=$(cd /otsfiles && sh -c "${proxychains} ots-cli.js stamp -c 'https://ots.testnet.kexkey.com' -d ${hash} 2>&1 | sed '/^\[proxychains\].*$/d'") returncode=$? else trace "[stamp] ${proxychains} ots-cli.js stamp -d ${hash}" - result=$(cd /otsfiles && sh -c "${proxychains} ots-cli.js stamp -d ${hash} 2>&1") + result=$(cd /otsfiles && sh -c "${proxychains} ots-cli.js stamp -d ${hash} 2>&1 | sed '/^\[proxychains\].*$/d'") returncode=$? fi trace_rc ${returncode} @@ -71,11 +71,11 @@ upgrade() { if [ "${TESTNET}" -eq "1" ]; then trace "[upgrade] ${proxychains} ots-cli.js -l \"https://testnet.calendar.kexkey.com/\" --no-default-whitelist upgrade -c \"https://testnet.calendar.kexkey.com/\" ${hash}.ots" - result=$(cd /otsfiles && sh -c "${proxychains} ots-cli.js -l 'https://testnet.calendar.kexkey.com/' --no-default-whitelist upgrade -c 'https://testnet.calendar.kexkey.com/' ${hash}.ots 2>&1") + result=$(cd /otsfiles && sh -c "${proxychains} ots-cli.js -l 'https://testnet.calendar.kexkey.com/' --no-default-whitelist upgrade -c 'https://testnet.calendar.kexkey.com/' ${hash}.ots 2>&1 | sed '/^\[proxychains\].*$/d'") returncode=$? else trace "[upgrade] ${proxychains} ots-cli.js upgrade ${hash}.ots" - result=$(cd /otsfiles && sh -c "${proxychains} ots-cli.js upgrade ${hash}.ots 2>&1") + result=$(cd /otsfiles && sh -c "${proxychains} ots-cli.js upgrade ${hash}.ots 2>&1 | sed '/^\[proxychains\].*$/d'") returncode=$? fi trace_rc ${returncode} @@ -129,11 +129,11 @@ verify() { if [ "${TESTNET}" -eq "1" ]; then trace "[verify] ${proxychains} ots-cli.js -l \"https://testnet.calendar.kexkey.com/\" --no-default-whitelist verify -d ${hash} /otsfiles/otsfile-$$.ots" - result=$(sh -c "${proxychains} ots-cli.js -l 'https://testnet.calendar.kexkey.com/' --no-default-whitelist verify -d ${hash} /otsfiles/otsfile-$$.ots 2>&1") + result=$(sh -c "${proxychains} ots-cli.js -l 'https://testnet.calendar.kexkey.com/' --no-default-whitelist verify -d ${hash} /otsfiles/otsfile-$$.ots 2>&1 | sed '/^\[proxychains\].*$/d'") returncode=$? else trace "[verify] ${proxychains} ots-cli.js verify -d ${hash} /otsfiles/otsfile-$$.ots" - result=$(sh -c "${proxychains} ots-cli.js verify -d ${hash} /otsfiles/otsfile-$$.ots 2>&1") + result=$(sh -c "${proxychains} ots-cli.js verify -d ${hash} /otsfiles/otsfile-$$.ots 2>&1 | sed '/^\[proxychains\].*$/d'") returncode=$? fi trace_rc ${returncode} diff --git a/proxy_docker/app/script/requesthandler.sh b/proxy_docker/app/script/requesthandler.sh index 5eedc8e..e110993 100644 --- a/proxy_docker/app/script/requesthandler.sh +++ b/proxy_docker/app/script/requesthandler.sh @@ -67,7 +67,8 @@ main() { if [ ${step} -eq 1 ]; then trace "[main] step=${step}" if [ "${http_method}" = "POST" ]; then - read -n ${content_length} line + read -rd '' -n ${content_length} line + line=$(echo "${line}" | jq -c) trace "[main] line=${line}" fi case "${cmd}" in