Can I Run OS Commands on a Public Website?

0
2
Asked By CuriousCoder98 On

Hey everyone! I'm working on a personal project where I'm hosting some basic networking commands on a localhost site using a webpage. I'm teaching myself HTML and trying to create buttons that trigger functions. I've implemented features like ping and traceroute that utilize the ICMP protocol. While they run perfectly on my localhost (127.0.0.1), I'm wondering if these types of OS commands would still function on a publicly hosted site? I know they don't require admin privileges, but I'm unsure about potential issues when running them through a public IP. Thanks for your help!

2 Answers

Answered By CodeGuru2023 On

Your title was a bit misleading, but I get where you're coming from. Browsers operate in a sandboxed environment and can’t directly execute OS commands. However, you can definitely set up your own backend to handle these commands. It’s all about creating proper endpoints—just make sure you use something like JSON/REST to manage inputs and outputs. Always remember to validate and sanitize those inputs for security before going public!

CuriousCoder98 -

Thanks for the reply! I had a tough time with the title. I'm mainly using Python to run commands and some basic JavaScript for animations. I guess I’ll need to dive deeper into JavaScript for frontend work!

Answered By TechSavvyMike On

The thing to keep in mind is that it doesn't matter if your site is public or private—the backend processes requests in the same way. The server will just see that an IP address is connected, without considering if it's public or not. So yes, you can run those commands, but just be cautious about security implications.

CuriousCoder98 -

Makes sense! I just wanted to be sure there wouldn't be issues running OS commands over a public IP. Thanks for the clarification!

Related Questions

LEAVE A REPLY

Please enter your comment!
Please enter your name here

This site uses Akismet to reduce spam. Learn how your comment data is processed.