能力值:
( LV2,RANK:10 )
|
-
-
2 楼
我的意思是在ASP.NET下执行
cmdProcess pr = new Process();
pr.StartInfo.FileName = cmdurl.Text;
pr.StartInfo.RedirectStandardOutput = true;
pr.StartInfo.UseShellExecute = false;
pr.StartInfo.Arguments = "/c " + cmd.Text.Trim ();
pr.StartInfo.WindowStyle = ProcessWindowStyle.Hidden;
pr.Start();
StreamReader osr = pr.StandardOutput;
ocmd = osr.ReadToEnd();
cmdshow.Text = ocmd;
osr.Close();
osr.Dispose();
权限是ASPNET 如果我给账户,和密码怎么模拟身份执行cmd 求思路
|
能力值:
( LV2,RANK:10 )
|
-
-
3 楼
private SecureString ConvertToSecureString(string str)
{
SecureString secureString = new SecureString();
foreach (char c in str)
secureString.AppendChar(c);
return secureString;
}
cmdProcess pr = new Process();
pr.StartInfo.FileName = cmdurl.Text;
pr.StartInfo.RedirectStandardOutput = true;
pr.StartInfo.UseShellExecute = false;
pr.StartInfo.UserName = "adminstrator";
pr.StartInfo.Password = ConvertToSecureString("passworddemo");
pr.StartInfo.Arguments = "/c " + cmd.Text.Trim ();
pr.StartInfo.WindowStyle = ProcessWindowStyle.Hidden;
pr.Start();
StreamReader osr = pr.StandardOutput;
ocmd = osr.ReadToEnd();
cmdshow.Text = ocmd;
osr.Close();
osr.Dispose();
//试试了,不过LZ像.Net这种问题应该去CSDN之类的地方问比较好吧
|
能力值:
( LV2,RANK:10 )
|
-
-
4 楼
asp.net默认貌似没有执行程序权限吧....如果那样....世界都乱了,LZ从哪拿到的用户及密码?
|
|
|