Last active
November 23, 2022 14:56
-
-
Save andoniaf/1dbcf6a8589aef81f3032a28d2c64f4b to your computer and use it in GitHub Desktop.
ssm_socat.sh
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/bash | |
set -e | |
HOST="$1" | |
socat -v TCP-LISTEN:0,fork,reuseaddr TCP:${HOST}.mq.us-east-1.amazonaws.com:443 & | |
SOCAT_PID="$!" | |
sleep 1 | |
SOCAT_PORT=$(netstat -putona | grep $SOCAT_PID | awk '{print $4}' | cut -d':' -f2) | |
echo "SOCAT PID: $SOCAT_PID" | |
echo "SOCAT PORT: $SOCAT_PORT" |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment