Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

additional Script For showing Public ip and location for each container #6

Open
mlynxGit opened this issue Mar 4, 2020 · 0 comments

Comments

@mlynxGit
Copy link

mlynxGit commented Mar 4, 2020

Add This To a bash file and install
testProxyDock.zip

curl and jq dependencies and run it to get proxy public ip address and location
`#!/bin/bash

ISHEADER=true
for i in $(docker container ls --format "table {{.Ports}}"); do
if $ISHEADER ; then
ISHEADER=false
printf "%-30s | %-30s | %-30s \n" 'PROXY' 'IP' 'LOCATION'
else
PROXY="$(cut -d'-' -f1 <<< " "$i" ")"
PROXY_NO_WHITESPACE="$(echo -e "${PROXY}" | tr -d '[:space:]')"
HTTP_RESPONSE="$(curl -s -x $PROXY_NO_WHITESPACE -L https://api.myip.com)"
IP="$(jq .ip <<< " "$HTTP_RESPONSE" ")"
LOCATION="$(jq .country <<< " "$HTTP_RESPONSE" ")"
printf "%-30s | %-30s | %-30s \n" "$PROXY_NO_WHITESPACE" "$IP" "$LOCATION"
fi

done`

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant