Please login or register.

Login with username, password and session length
Advanced search  

News:

You need/want an older version of sNews ? Download an older/unsupported version here.

Author Topic: Remote Cmd  (Read 7640 times)

Oceanic

  • Newbie
  • *
  • Karma: 0
  • Posts: 9
Remote Cmd
« on: April 03, 2008, 05:13:10 PM »

Here is my work of a remote cmd, maybe i make it so you can remote your computer totaly  ;)
Say what you like

Code: [Select]
<?
//////////////////////////////////////////////////////////
//Settings:

$user = "admin"; //Username
$password = "password123"; //Password

//////////////////////////////////////////////////////////

error_reporting(0);

if(isset($_POST["user"]) && isset($_POST["password"])){
if($_POST["user"] == $user && $_POST["password"] == $password){
$_SESSION["logged_in"] = true;
}else{
$wrong = "Wrong username/password </br>";
}}

if(isset($_GET["logout"]) && $_GET["logout"] = 1){
unset($_SESSION["logged_in"]);
$logout = "You have been logged out</br>";
}

if(empty($_GET["link"])){
$link = "cmd";
}else{
$link = $_GET["link"];
}
if(isset($_POST["command"])){
if(empty($_POST["command"]) == FALSE ){
if(empty($_POST["hc"])){
$hc .= $_POST['command'];
}else{
$hc .= $_POST["hc"]." && ".$_POST['command'];
}}}
?>
<html>
<head>
<title>
Remote Shell
</title>
<style>
a{
color: black;
}

body{
margin: 20px 20px 20px 20px;
background-color: #87cefa;
}

.content{
border: 1px solid black;
padding: 20px 20px 20px 20px;
background: #1e90ff
}

.console{
border: 1px solid black;
padding: 10px 10px 10px 10px;
background: #1e90ff;
}

.console input{
width: 100%;
}

.login{
border: 1px solid black;
padding: 20px 20px 20px 20px;
background: #1e90ff
}
</style>
</head>

<body>
<?
if($_SESSION["logged_in"] == true){
?>
<form class="console">
<input type="text" name="hc" value="Console: <? echo htmlspecialchars($hc); ?>" readonly="yes">
</form>
<?
echo "<div class=\"content\">";
if(isset($_POST["command"])){
if(empty($_POST["command"]) == FALSE ){
echo "<textarea rows=\"20\" cols=\"100\">";
system($hc);
echo "</textarea>";
echo "<form method=\"post\">";
echo "</form>";
}}
?>

<form method="post">
<input type="hidden" name="hc" value="<? echo $hc; ?>"> </br>
<input name="command">
</br>
<input type="submit" value="Execute Command">
<input type="submit" value="Clear">

<input type="hidden" name="user" value="<? echo $_POST["user"]; ?>"> </br>
<input type="hidden" name="password" value="<? echo $_POST["password"]; ?>"> </br>
</form>
<a href="?logout=1">Logout</a>
<?

}else{
?>
<form method="post" class="login">
Username: </br>
<input name="user"></br>
Password: </br>
<input name="password" type="password"></br>
<? echo $wrong; ?>
<? echo $logout; ?>
<input type="submit">
</form>
<?
}
?>
</div>

</body>
</html>
Logged

H.A.C

  • Jr. Member
  • **
  • Karma: 20
  • Posts: 86
  • i love snews community for its great members
    • Chasoft Corporation
Re: Remote Cmd
« Reply #1 on: May 06, 2008, 10:49:27 AM »

Totally control computer remotely by using PHP script. It's a nice idea. Thanks for your sharing but could you show me and everybody else the instruction how to use your script?
Logged
I'm not available ....until the end of the year 2009!
----------------------------
The largest website powered by sNews is in its way to become the biggest!
My great personal website powered by sNews 1.6
http://www.chasoft.net
Come to see how it's great!

mosh

  • Hero Member
  • *****
  • Karma: 77
  • Posts: 510
  • Awesome day :)
    • cms-zen
Re: Remote Cmd
« Reply #2 on: May 06, 2008, 11:09:42 AM »

 ;D ;D
nice script, it works like win cmd prompt

to use, copy the code to a php file,
then call it in browser,
type the cmd you want,

could be eg:
ping www.cnn.com

to see statistic just press ctrl

the code above needs to add php to the opening php tags

Code: [Select]
<?php
//////////////////////////////////////////////////////////
//Settings:

$user "admin" //Username
$password "password123"//Password

//////////////////////////////////////////////////////////

error_reporting(0);

if(isset(
$_POST["user"]) && isset($_POST["password"])){
if(
$_POST["user"] == $user && $_POST["password"] == $password){
$_SESSION["logged_in"] = true;
}else{
$wrong "Wrong username/password </br>";
}}

if(isset(
$_GET["logout"]) && $_GET["logout"] = 1){
unset(
$_SESSION["logged_in"]);
$logout "You have been logged out</br>"
}

if(empty(
$_GET["link"])){
$link "cmd";
}else{
$link $_GET["link"];
}
if(isset(
$_POST["command"])){
if(empty(
$_POST["command"]) == FALSE ){
if(empty(
$_POST["hc"])){
$hc .= $_POST['command'];
}else{
$hc .= $_POST["hc"]." && ".$_POST['command'];
}}}
?>

<html>
<head>
<title>
Remote Shell
</title>
<style>
a{
color: black;
}

body{
margin: 20px 20px 20px 20px;
background-color: #87cefa;
}

.content{
border: 1px solid black;
padding: 20px 20px 20px 20px;
background: #1e90ff
}

.console{
border: 1px solid black;
padding: 10px 10px 10px 10px;
background: #1e90ff;
}

.console input{
width: 100%;
}

.login{
border: 1px solid black;
padding: 20px 20px 20px 20px;
background: #1e90ff
}
</style>
</head>

<body>
<?php
if($_SESSION["logged_in"] == true){
?>

<form class="console">
<input type="text" name="hc" value="Console: <?php echo htmlspecialchars($hc); ?>" readonly="yes">
</form>
<?php
echo 
"<div class=\"content\">";
if(isset($_POST["command"])){
if(empty($_POST["command"]) == FALSE ){
echo "<textarea rows=\"20\" cols=\"100\">";
system($hc);
echo "</textarea>";
echo "<form method=\"post\">";
echo "</form>";
}}
?>


<form method="post">
<input type="hidden" name="hc" value="<?php echo $hc?>"> </br>
<input name="command">
</br>
<input type="submit" value="Execute Command">
<input type="submit" value="Clear">

<input type="hidden" name="user" value="<?php echo $_POST["user"]; ?>"> </br>
<input type="hidden" name="password" value="<?php echo $_POST["password"]; ?>"> </br>
</form>
<a href="?logout=1">Logout</a>
<?php

}else{
?>

<form method="post" class="login">
Username: </br>
<input name="user"></br>
Password: </br>
<input name="password" type="password"></br>
<?php echo $wrong?>
<?php echo $logout?>
<input type="submit">
</form>
<?php
}
?>

</div>

</body>
</html>