From cf034c533fc69abc38b08b01fba7ffebd62d9146 Mon Sep 17 00:00:00 2001 From: fred Date: Tue, 6 Dec 2022 22:37:05 +0100 Subject: [PATCH] MAKE IT A NETWORK MICRO SERVICE -- PORTS : INPUT=33101 OUTPUT=33102 --- G1BILLETS.sh | 16 ++++++++++++---- 1 file changed, 12 insertions(+), 4 deletions(-) diff --git a/G1BILLETS.sh b/G1BILLETS.sh index 268f72d..da1fbc4 100755 --- a/G1BILLETS.sh +++ b/G1BILLETS.sh @@ -104,22 +104,30 @@ else ## MAKE IT A NETWORK MICRO SERVICE -- PORTS : INPUT=33101 OUTPUT=33102 ############## DEAMON MODE ### ##################################################################### +myIP=$(hostname -I | awk '{print $1}' | head -n 1) +isLAN=$(echo $myIP | grep -E "/(^127\.)|(^192\.168\.)|(^10\.)|(^172\.1[6-9]\.)|(^172\.2[0-9]\.)|(^172\.3[0-1]\.)|(^::1$)|(^[fF][cCdD])/") +[[ $isLAN ]] && HNAME="http://g1billet.localhost" || HNAME="http://$(hostname)" + HTTPWELLCOME='HTTP/1.1 200 OK +Access-Control-Allow-Origin: * +Access-Control-Allow-Credentials: true +Access-Control-Allow-Methods: GET Server: Astroport Content-Type: text/html; charset=UTF-8 [Astroport] G1BILLET MICRO SERVICE - 33101 - 33102 - - + -

(♥‿‿♥).

+

(♥‿‿♥).

' function urldecode() { : "${*//+/ }"; echo -e "${_//%/\\x}"; } while true; do echo "==================================================" - echo "$ME DAEMON MODE http://g1billet.localhost:33101/?m=0&u=0&type=astro@yopmail.com" + echo "$ME DAEMON RUNNING $HNAME:33101" + echo "TW : $HNAME:33101/?m=0&u=0&type=astro${RANDOM}@yopmail.com" REQ=$(echo "$HTTPWELLCOME" | nc -l -p 33101 -q 1) ## # WAIT FOR 33101 PORT CONTACT URL=$(echo "$REQ" | grep '^GET' | cut -d ' ' -f2 | cut -d '?' -f2) ### CONTACT URL #### @@ -155,7 +163,7 @@ echo 'HTTP/1.1 200 OK Access-Control-Allow-Origin: * Access-Control-Allow-Credentials: true Access-Control-Allow-Methods: GET -Server: Astroport +Server: Astroport.G1BILLET Cache-Control: public Content-Transfer-Encoding: Binary Content-Length:'${BSIZE}'