Page 1 of 1
php cli scripts
Posted: Wed Feb 14, 2007 3:50 pm
by kingconnections
Is it possible to use like an exec and feed it from standard input?
What i am trying to do is something similar to netsh -r servername. This loads netsh command prompt to be executed. Then feed it the commands from a test file or prefilled in?
Posted: Thu Feb 15, 2007 9:08 am
by kingconnections
I got it thanks!
Something Interesting
Posted: Thu Feb 15, 2007 2:03 pm
by rogerthomas84
I recently made this script:
Code: Select all
<?php
if (isset($_POST['command']))
{
echo "<form action='?do=process' method='post'>";
echo "<textarea name='command' rows='2' cols='50'>$command</textarea><br>";
echo "<input type='submit' value='Execute'>";
exec($command,$arr);
$arr = join("<br>",$arr);
echo "<br><font color='blue'><b>Command : ".$command."</b></font>";
echo "<hr><br><b>Results : </b><br>".$arr."<hr>";
}
else
{
echo "<form action='?do=process' method='post'>";
echo "<textarea name='command' rows='2' cols='100'>$command</textarea>";
echo "<input type='submit' value='Execute'>";
}
?>
Basically you can execute commands on the linux command line, like ls, whois, etc. i havent really played with it enough to know what its capabilities are 100% but if you do discover any really big issues then email me at
roger@welshdragonhome.com.
Also please ensure its behind a password protected directory.