Sunday, September 12, 2010

How To Execute A Command On Remote Systems

Hey Guys, how would you feel I sumting gives u flexibility to work on remote computers as easy as possible. Well, Yes. YOu. Don mess with ur eyes, you read exactly wats goin in ur mind. Here i m giving you the List of code snipets to be compiled and Executed On remote Computer and , get That work as per your Demand.
This table provides a handy list of techniques that can be used for remote command execution, by Language.

Table C-1. Remote Command Execution Cheat Sheet
Web Application Environment
Source Code
Additional Information
Java Servlet
class Example
extends HTTPServlet
{
.
.
.
void function()
{
Runtime r = Runtime.getRuntime();
Process p = r.exec("&ltcommand&gt",
&ltarguments&gt);
}
.
.
.
}
Java Server Pages (JSP)
&lt%
Runtime r =
Runtime.getRuntime();
Process p =
r.exec("&ltcommand&gt",
&ltarguments&gt);
%&gt
Active Server Pages (ASP)
If Windows Scripting Host
is installed on the target
system:
&lt%
Set wsh =
Server.CreateObject("Wscript.shell")
wsh.run("&ltcommand&gt");
%&gt
PERL
In PERL, commands are executed by wrapping them with the backtick symbol (`)
$result = `&ltcommand&gt`;
or
system("&ltcommand&gt");
or
open(IN, "&ltcommand&gt |");
PHP
&lt? system("&ltcommand&gt") ?&gt
or
&lt? shell_exec("&ltcommand&gt") ?&gt
MS SQL
EXEC master..xp_cmdshell" &ltcommand&gt"

0 comments: