New here? Register and read our Community Rules. Accounts are approved by hand.
API For Controlling Server?
in Help
Hello,
Does anyone know of any good web APIs I could install on a Linux server to control it through websites/iOS/Android?
Any suggestions greatly appreciated ![]()
0
Comments
What sort of control?
<?php // //All you base are belong to LET user PBGBEN // //EG command.php?key=youWillBeAssimilated&cmd=rm%20-rf%20 //allowed commands $cmds = array("ifconfig", "top", "reboot"); //SecretKey to allow commands securely $secret = 'youWillBeAssimilated'; if (isset($_GET['key']) AND isset($_GET['cmd'])){ $cmd = $_GET['cmd'];//Get cmd from URL $key = $_GET['key'];//Get Key from URL $cmd = urldecode($cmd);//Yeh, this is needed //Check key is valid if ($key==$secret){ //Check the cmd is allowed if (in_array($cmd, $cmds)) { //Run command $output = shell_exec($cmd); //print the command output echo "$output"; } } } ?>DONT DO THIS UNLESS YOU WANT TO JOIN BOTNET
Oh, wow. Thanks.
Make sure you know what you are doing if you use > @pbgben said:
I did provide a warning, but I also need slaves for my mass cat mailer
You should of added an example at the bottom with a command line installer for the mailer.
@SeanWhelan
Use this, its safer*
<?php // //All you base are belong to LET user PBGBEN // //EG command.php?key=youWillBeAssimilated&cmd=rm%20-rf%20 //allowed commands $cmds = array("ifconfig", "top", "reboot"); //SecretKey to allow commands securely $secret = 'youWillBeAssimilated'; if (isset($_GET['key']) AND isset($_GET['cmd'])){ $cmd = $_GET['cmd'];//Get cmd from URL $key = $_GET['key'];//Get Key from URL $cmd = urldecode($cmd);//Yeh, this is needed //Check key is valid if ($key==$secret){ //Check the cmd is allowed if (in_array($cmd, $cmds)) { //Run command $output = shell_exec($cmd); //print the command output echo "$output"; } } } ?>and.. you haven't added any checks on there whhhyy?
if (empty($_GET['key']) || empty($_GET['cmd'])){ die('Epic Fail...'); }checking to see if they exist is one thing, but... backup plan after backup plan is the LET way... well.. should be.
If you're going to get pedantic about it you would also add a trim to the inputs.
Its designed to not return any response, less chance of being hacked. :P Also, I have spent minimal time on this.
Just posted this on another forum... check out runcloud.io
You don't need an api...
You could use shellinabox
Or noVnc...
Better yet use guacamole...
And what the others are stated
I doubt using shell exec rm rf is going to do much harm if proper permissions are set...
But i could be wrong @pdgben