netcat serving webpage is it secure ?

fujimapop

New Member
Joined
Apr 20, 2020
Messages
2
Reaction score
1
Credits
0
Hi all, ive just joined. I wasnt sure which area to post this sorry

I have a few game servers running on my linux box, What im trying to do is

If somebody tries to visit the ip address of my servers using a browser
I want to redirect their brower to my website which is hosted externally with a web hosting company

I also am trying to do this with the minimal impact on my server as it is very underpowered (32 bit arm 900MHz and 1GB ram)

What ive managed to do so far is create a webpage with the redirect meta and serve it using netcat (see code below), it seems to work fine but im wondering if it is secure ? is it exploitable ? the last thing i want is my internal network exposed

this is index.html page im serving
Code:
<html>
<head>
<meta http-equiv="Refresh" content="0; url=http://redirectURLhere.com" />
</head>
<body>
</body>
</html>

and this is the code im serving it with
Code:
while true; do { echo -ne "HTTP/1.0 200 OK\r\nContent-Length: $(wc -c <index.html)\r\n\r\n"; cat index.html; } | sudo nc -l -p 80; done

im new to this stuff, maybe theres a better way ?

thanks for your time
 


Top