Security and blocking file types July 31, 2015 03:14AM |
Registered: 9 years ago Posts: 2 |
Re: Security and blocking file types August 28, 2015 04:03PM |
Registered: 11 years ago Posts: 78 |
Language: Javafiles = UploadUtil.processUpload(new File(outDir), request, false);
Language: Javafiles = UploadUtil.processUpload(new File(outDir), request, false, new String[] {"png", "jpg"});
Re: Security and blocking file types January 29, 2016 06:05AM |
Re: Security and blocking file types January 30, 2016 10:24PM |
Registered: 11 years ago Posts: 78 |
Language: Java# Allowed MAC addresses allowedMacs = "58:94:6b:7c:2x:16 58:94:6b:7c:2x:15"; # Read lines from /proc/net/arp remoteIp = request.socket.getInetAddress().getHostAddress(); br = new BufferedReader(new InputStreamReader(new FileInputStream("/proc/net/arp"))); mac = null; while((line = br.readLine()) != null) { vals = line.split("\\s+"); if(vals[0].equals(remoteIp)) { mac = vals[3]; break; } } # If MAC was found and matches allowed MAC address, upload the file if(mac != null && allowedMacs.contains(mac)) { files = UploadUtil.processUpload(new File(outDir), request, false); }