Jump to content

Javascript or any other language that can shutdown/restart computers

Ploooopp

So essentially i would like to know if you can make a code in wich the webbrowser shuts down your pc. The reasoning behind this is that my teacher kind of challenged me to find this, and im asking the forums because of the knowledge the people here have. 
Thank you :)

So I can put anything here?

Link to comment
Share on other sites

Link to post
Share on other sites

You can execute shell commands through PHP, node.js, Python, Perl, and pretty much every language. 

 

I would say its more simple through PHP than the others. You could write a quick HTTP serving script in node.js that would do it though.

 

Look into SNMP as well.

Link to comment
Share on other sites

Link to post
Share on other sites

You can get programs for your android phone to shutdown your Windows PC,.. sounds similar to what you want, because I think (when I skimmed over it) the base is Java.

 

Setting up a small program as "server" on the PC, then loading the APP (client) on your phone...

 

Great for my mum who streams media from her PC at night to her tablet, and she doesnt have to get up to shutdown the computer.

Maximums - Asus Z97-K /w i5 4690 Bclk @106.9Mhz * x39 = 4.17Ghz, 8GB of 2600Mhz DDR3,.. Gigabyte GTX970 G1-Gaming @ 1550Mhz

 

Link to comment
Share on other sites

Link to post
Share on other sites

You can execute shell commands through PHP, node.js, Python, Perl, and pretty much every language. 

 

I would say its more simple through PHP than the others. You could write a quick HTTP serving script in node.js that would do it though.

 

Look into SNMP as well.

 

I thought this was only possible if the browser process is privileged? Hence why Google Chrome's Linux builds refuse to run as root.

Link to comment
Share on other sites

Link to post
Share on other sites

I thought this was only possible if the browser process is privileged? Hence why Google Chrome's Linux builds refuse to run as root.

By "through the browser" I assumed he meant just using HTTP.

 

You can do somethign like

<?php  if($_GET['shutdown']){    exec(shutdown -h now);} ?>

And run the PHP interpretur, and a HTTP server to run the script.

Link to comment
Share on other sites

Link to post
Share on other sites

well, browserside js can most definitely NOT shut down a computer.

 

 

are you aware of the difference between java and javascript?

Link to comment
Share on other sites

Link to post
Share on other sites

By "through the browser" I assumed he meant just using HTTP.

 

You can do somethign like

<?php  if($_GET['shutdown']){    exec(shutdown -h now);} ?>

And run the PHP interpretur, and a HTTP server to run the script.

 

Yep, definitely get that. I thought OP was thinking more "my friend browses a web page, code runs, shuts down their computer" - so clientside JS shutting down the users computer.

Link to comment
Share on other sites

Link to post
Share on other sites

Yep, definitely get that. I thought OP was thinking more "my friend browses a web page, code runs, shuts down their computer" - so clientside JS shutting down the users computer.

Yeah, that wouldnt work.

 

There is no way to do i that I know of just through clientside Javascript alone. Imagine if there was, it would cause havoc, lol.

Link to comment
Share on other sites

Link to post
Share on other sites

Yeah, that wouldnt work.

 

There is no way to do i that I know of just through clientside Javascript alone. Imagine if there was, it would cause havoc, lol.

 

Yeah, thought so.

 

OP, you can tell your teacher "Well unless you have some exploit that allows remote code execution, no". I'd be interested to see what he thinks.

Link to comment
Share on other sites

Link to post
Share on other sites

Browsers prevent that sort of thing from happening. You COULD try finding a way with ActiveX stuff for old versions of IE though.

Link to comment
Share on other sites

Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

×