|
| 1 | +jsp File Browser version 1.2 |
| 2 | +-------------------------------------------------------------------------------------- |
| 3 | + |
| 4 | +------------------------IMPORTANT |
| 5 | + |
| 6 | +With this jsp you can destroy important files on your system, it also could be |
| 7 | +a serious security hole on your server. |
| 8 | +Use this script only, if you know what you do. There is no warranty of any kind. |
| 9 | + |
| 10 | +------------------------REQUIREMENTS |
| 11 | + |
| 12 | +To use the File browser, you need a JSP1.1 compatible Web Server like Tomcat, Resin |
| 13 | +or Jetty. |
| 14 | +If you use the browser on webspace provided by an internet service provider, |
| 15 | +it could be, that you are not allowed to go in some directories or execute |
| 16 | +commands on the server, this will result in an exception. |
| 17 | + |
| 18 | +------------------------INSTALLATION |
| 19 | + |
| 20 | +Just copy the jsp file to any configured Web application. The author recommends to |
| 21 | +protect the directory you copy the file into by password, to avoid abuse. |
| 22 | + |
| 23 | +------------------------SETTINGS |
| 24 | + |
| 25 | +If you want to change the standard style, you can create a css file in the directory |
| 26 | +where Browser.jsp is located with the name "Browser.css". If you want choose another name |
| 27 | +change this line in Browser.jsp: |
| 28 | + private static final String CSS_NAME = "Browser.css"; |
| 29 | +For the syntax, look at the example css file. |
| 30 | + |
| 31 | +If you click on a filename, the file will be opened in an new window. If you want that file |
| 32 | +opened in your current window, change this line: |
| 33 | + private static final boolean USE_POPUP = true; |
| 34 | +to |
| 35 | + private static final boolean USE_POPUP = false; |
| 36 | + |
| 37 | +If you hold the mouse cursor over a directory name, a tooltip with |
| 38 | +the first ten entries of this directory show up. This feature can lead to performance issues. If |
| 39 | +you observe slow loading times you should change this line: |
| 40 | + private static final boolean USE_DIR_PREVIEW = true; |
| 41 | +to |
| 42 | + private static final boolean USE_DIR_PREVIEW = false; |
| 43 | + |
| 44 | +You could also change the number of entries in the preview by changing this line: |
| 45 | + private static final int DIR_PREVIEW_NUMBER = 10; |
| 46 | + |
| 47 | +If you would like to execute commands on the server, you have to specify a |
| 48 | +command line interpreter and the parameter to execute a command. |
| 49 | +This is the parameter for windows: |
| 50 | + private static final String[] COMMAND_INTERPRETER = {"cmd","/C"}; |
| 51 | + |
| 52 | +The maximum time in ms a command is allowed to run before it will be terminated is specified |
| 53 | +by this line: |
| 54 | + private static final long MAX_PROCESS_RUNNING_TIME = 30000; |
| 55 | + |
| 56 | +You can restrict file browsing and manipulation by setting |
| 57 | + private static final boolean RESTRICT_BROWSING = true; |
| 58 | +You can choose between whitelist restriction, that means the user is allowed to browse only in |
| 59 | +directories, which are lower than RESTRICT_PATH, or blacklist restriction, which allows |
| 60 | +the user to access all directories besides RESTRICT_PATH. |
| 61 | + private static final boolean RESTRICT_WHITELIST = true; |
| 62 | +You can set more than one directory in RESTRICT_PATH, seperated by semicolon. |
| 63 | + |
| 64 | +It is also possible to make the file browser read-only. All operations which change the |
| 65 | +file structure (besides upload and native command execution) are forbidden and turned off. |
| 66 | +To achieve this change |
| 67 | + private static final boolean READ_ONLY = false; |
| 68 | +to |
| 69 | + private static final boolean READ_ONLY = true; |
| 70 | +. |
| 71 | + |
| 72 | +You can also turn off upload with |
| 73 | + private static final boolean ALLOW_UPLOAD = false; . |
| 74 | + |
| 75 | +If you restrict file access it is also recommend to forbid native command execution by |
| 76 | +changing |
| 77 | + private static final boolean NATIVE_COMMANDS = true; |
| 78 | +to |
| 79 | + private static final boolean NATIVE_COMMANDS = false; |
| 80 | +. |
| 81 | + |
| 82 | +------------------------USAGE |
| 83 | + |
| 84 | +This JSP program allows remote web-based file access and manipulation. |
| 85 | +You can copy, create, move, rename and delete files. |
| 86 | +Text files can be edited and groups of files and folders can be downloaded |
| 87 | +as a single zip file that is created on the fly. |
| 88 | + |
| 89 | +http://server/webapp/Browser.jsp |
| 90 | +or |
| 91 | +http://server/webapp/Browser.jsp?dir=[Directory on the server] |
| 92 | + |
| 93 | +You do not need a javascript capable browser, but it looks nicer with it. |
| 94 | + |
| 95 | +If you want to copy or move a file, please enter the target directory name in the |
| 96 | +edit field (absolute or relative). If you want to create a new file or directory, |
| 97 | +enter the name in the edit field. |
| 98 | + |
| 99 | +If you click on a header name (e.g. size) the entries will be sorted by this property. |
| 100 | +If you click two times, they will be sorted descending. |
| 101 | + |
| 102 | +The button "Download as zip" let you download the selected directories and files packed as |
| 103 | +one zip file. |
| 104 | + |
| 105 | +The buttons "Delete Files", "Move Files", "Copy Files", delete, move and copy also selected |
| 106 | +directories with subdirectories. |
| 107 | + |
| 108 | +If you click on a .zip or .jar filename, you will see the entries of the packed file. |
| 109 | +You can unpack .zip, .jar and .gz direct on the server. For this filetype the entry in the |
| 110 | +last column is "Unpack". If you click at the "Unpack" link, the file will be unpacked in |
| 111 | +the current folder. Note, that you can only unpack a file, if no entry of the packed file |
| 112 | +already exist in the directory (no overwriting). If you want to unpack this file, you have |
| 113 | +to delete the files on the server which correspond to the entries. This feature is very useful, |
| 114 | +if you would like to upload more than one file. Zip the files together on your computer, |
| 115 | +then upload the zip file and extract it on the server. |
| 116 | + |
| 117 | +You can execute commands on the server (if you are allowed to) by clicking the "Launch command" |
| 118 | +button, but beware that you cannot interact with the program. If the execution time of the program |
| 119 | +is longer than MAX_PROCESS_RUNNING_TIME (standard: 30 sec.) the program will be killed. |
| 120 | + |
| 121 | +If you click on a file, it will be shown, if the MIME Type is supported. |
| 122 | +The following MIME Types are supported: |
| 123 | + |
| 124 | +.png image/png |
| 125 | +.jpg, .jpeg image/jpeg |
| 126 | +.gif image/gif |
| 127 | +.tiff image/tiff |
| 128 | +.svg image/svg+xml |
| 129 | +.pdf application/pdf |
| 130 | +.htm, .html, .shtml text/html |
| 131 | +.xml text/xml |
| 132 | +.avi video/x-msvideo |
| 133 | +.mov video/quicktime |
| 134 | +.mpg, .mpeg, .mpe video/mpeg |
| 135 | +.rtf application/rtf |
| 136 | +.mid, .midi, audio/x-midi |
| 137 | +.xl,.xls,.xlv,.xla,.xlb,.xlt,.xlm,.xlk application/excel |
| 138 | +.doc, .dot application/msword |
| 139 | +.mp3 audio/mp3 |
| 140 | +.ogg audio/ogg |
| 141 | +else text/plain |
| 142 | + |
| 143 | +------------------------SHORTKEYS |
| 144 | + |
| 145 | +You can use the following shortkeys for better handling: |
| 146 | + |
| 147 | +r Rename file |
| 148 | +m Move file |
| 149 | +y Copy file |
| 150 | +Del Delete file |
| 151 | +l Launch command |
| 152 | +z Download selected files as zip |
| 153 | +c Create file |
| 154 | +d Create directory |
| 155 | + |
| 156 | +------------------------KNOWN BUGS |
| 157 | + |
| 158 | +The JVM from windows will sometimes displays a message box on the server, |
| 159 | +if you try to access an empty removable drive. There will be no respond from |
| 160 | +the server until the message box is closed. |
| 161 | +If someone knows how to fix this, please write me a mail. |
| 162 | +Removable drives will not be shown on the list, if you add them to this |
| 163 | +property: |
| 164 | + |
| 165 | +private static final String[] FORBIDDEN_DRIVES= {"a:\\"} |
| 166 | +like e.g. |
| 167 | +private static final String[] FORBIDDEN_DRIVES= {"a:\\", "d:\\", "e:\\"} |
| 168 | + |
| 169 | +------------------------CONTACT |
| 170 | + |
| 171 | +Boris von Loesch |
| 172 | + |
| 173 | + |
| 174 | +------------------------CHANGELOG |
| 175 | +1.2 (21.07.2006) |
| 176 | +- Shortkeys |
| 177 | +- Filter file table |
| 178 | +- Fix a bug which appears with Tomcat |
| 179 | +- Add parameter to turn jsp filebrowser to a read-only version |
| 180 | +- Add parameter to disallow uploads (even in the read-only version) |
| 181 | +- Nicer layout |
| 182 | +- Javascript will now be cached by the browser therefore smaller page size |
| 183 | +- Turned off directory preview by default, because it uses too much resources |
| 184 | + |
| 185 | +1.1a (27.08.2004) |
| 186 | +- killed a bug, which appears if you view or download files |
| 187 | +- fix upload time display |
| 188 | + |
| 189 | +1.1 (20.08.2004) |
| 190 | +- Upload monitor |
| 191 | +- Restrict file access |
| 192 | + |
| 193 | +1.0 (13.04.2004) |
| 194 | +- if you click two times on a table header, it will be sorted descending |
| 195 | +- sort parameter is memorized |
| 196 | +- bugfixes (14,11,15) |
| 197 | +- added some mime types |
| 198 | + |
| 199 | +1.0RC2 (02.02.2004) |
| 200 | +- only bugfixes (3,4,6,9) |
| 201 | + |
| 202 | +1.0RC1 (17.11.2003) |
| 203 | +Thanks to David Cowan for code contribution (buffering), bug fixing and testing |
| 204 | +- execute native shell commands |
| 205 | +- quick change to lower directories paths |
| 206 | +- solve homepath problem with Oracle oc4j |
| 207 | +- remove two bugs in the upload routine |
| 208 | +- add war file unpack and view support |
| 209 | +- remove some html errors (page is now valid HTML 4.1 Transitional) |
| 210 | +- add buffering for download of files and zip file creation, this increases the speed |
| 211 | + |
| 212 | +0.6 (14.10.2003) |
| 213 | +Thanks to David Levine for bug fixes |
| 214 | +- Refactor parts of the code |
| 215 | +- Viewing and unpacking of .zip, .jar and .gz files on the server |
| 216 | +- Customizable layout via external css file (optional) |
| 217 | +- Distinction between error and success messages |
| 218 | +- Open File in a new window |
| 219 | +- "Select all" checkbox |
| 220 | +- More options |
| 221 | +- Some small changes and bugfixes |
| 222 | + |
| 223 | +0.5 (20.08.2003) |
| 224 | +Greetings to Taylor Bastien who contributed a lot of code for this release |
| 225 | +- Renaming of files |
| 226 | +- File extension in an extra column |
| 227 | +- variable filesize unit (bytes, KB or MB) |
| 228 | +- Directory preview via tooltip (simple hold the mousecursor over a directory name and |
| 229 | + a tooltip with the first ten entries will appear) |
| 230 | +- Summary (number and size of all files in the current directory) |
| 231 | +- Text editor can save files with dos/windows or unix line ending |
| 232 | +- many small changes |
| 233 | + |
| 234 | +0.4 (17.05.2003) |
| 235 | +- It does not longer need a temporary directory ! |
| 236 | +- Jsp 1.1 compatible (works now also in Tomcat 3) |
| 237 | +- The file editor can now save the edited file with a new name and can make a backup |
| 238 | +- selected row is marked by color and the checkbox can be selected by click at any place in the row |
| 239 | + (works only with Javascript) |
| 240 | +- some new MIME types (xml, png, svg) |
| 241 | +- unreadable files and directories are marked (not selectable) |
| 242 | +- write protected files and directories are marked (italic) |
| 243 | +- if no dir parameter is assigned, the home directory of the browser will be displayed |
| 244 | +- some bugs killed |
| 245 | + |
| 246 | +0.3 |
| 247 | +- Output is HTML 4.01 conform, should now be netscape>4 compatible |
| 248 | +- Messages to indicate the status of an operation |
| 249 | +- Many bugs killed |
| 250 | +- Tooltips |
| 251 | + |
| 252 | +0.2 |
| 253 | +- First release |
| 254 | + |
| 255 | +CREDITS |
| 256 | +Taylor Bastien |
| 257 | +David Levine |
| 258 | +David Cowan |
| 259 | +Lieven Govaerts |
| 260 | + |
| 261 | +LICENSE |
| 262 | + |
| 263 | +jsp File browser |
| 264 | +Copyright (C) 2003-2006 Boris von Loesch |
| 265 | + |
| 266 | +This program is free software; you can redistribute it and/or modify it under |
| 267 | +the terms of the GNU General Public License as published by the |
| 268 | +Free Software Foundation; either version 2 of the License, or (at your option) |
| 269 | +any later version. |
| 270 | + |
| 271 | +This program is distributed in the hope that it will be useful, but |
| 272 | +WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or |
| 273 | +FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. |
| 274 | + |
| 275 | +You should have received a copy of the GNU General Public License along with |
| 276 | +this program; if not, write to the |
| 277 | +Free Software Foundation, Inc., |
| 278 | +59 Temple Place, Suite 330, |
| 279 | +Boston, MA 02111-1307 USA |
0 commit comments