MAKE IT A NETWORK MICRO SERVICE -- PORTS : INPUT=33101 OUTPUT=33102

This commit is contained in:
fred 2022-12-06 22:37:05 +01:00
parent 37d5b86253
commit cf034c533f
1 changed files with 12 additions and 4 deletions

View File

@ -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
<!DOCTYPE html><html><head>
<title>[Astroport] G1BILLET MICRO SERVICE - 33101 - 33102 -</title>
<meta http-equiv="refresh" content="5; url=http://g1billet.localhost:33102" />
<meta http-equiv="refresh" content="5; url='$HNAME':33102" />
</head><body>
<p><a href="http://g1billet.localhost:33102">(♥‿‿♥)</a>.</p>
<p><a href="'$HNAME':33102">(♥‿‿♥)</a>.</p>
</body></html>'
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}'