ajrockefeller / openfpc

Automatically exported from code.google.com/p/openfpc
0 stars 0 forks source link

Suggestion - Store action to save as ZIP #15

Closed GoogleCodeExporter closed 8 years ago

GoogleCodeExporter commented 8 years ago
As mentioned, would be nice to be able to specify a write location and store as 
a zip file when using the "store" action, much like the fetch action currently 
does.

if ("$request->{'action'}" eq "store") {
# Create a tempfilename for this store request
$request->{'tempfile'}="$request->{'filename'}"; #time() . "-" . 
$request->{'rid'} . ".pcap";
print $client "FILENAME: $request->{'tempfile'}\n";

#Added this to look for the request variable "zip" and preform the prepfile 
action
my $prep = prepfile($request);
if ($prep->{'filetype'} eq "ZIP")

I wont show you how we got it to write to another location other than the 
default because we just stole the filename variable from the piped variables 
from request.pm and stuck it on the end of the zip prepfile stuff.... nasty.

Original issue reported on code.google.com by matt.new...@gmail.com on 13 May 2011 at 3:17

GoogleCodeExporter commented 8 years ago
This is tricky to do, and although it was originally implemented it was removed 
for the sake of security.
It's not wise to allow a user to control where a file will be written on a 
remote devices filesystem.

Can you explain the use case some more, maybe there is a more limited way of 
implementing it.

Cheers,

Original comment by leon.j.w...@gmail.com on 1 Jul 2011 at 8:38

GoogleCodeExporter commented 8 years ago
I probably did this the wrong way around, what may be more applicable is to use 
the "fetch" action, however allow that "fetch" action to be queued on the 
sensor. The problem we had, in our scenario, we fetch pcap for each event 
automatically, there is no user interaction, so if we have a steady bout of 
hits over a short period, using the fetch action would create many parallel 
requests on the sensor, thus maxing the resources. The queue action remedies 
this somewhat, and it was easier to patch the code to zip up the results by 
jumping to the relevant piece of code. HTH

Original comment by matt.new...@gmail.com on 1 Jul 2011 at 9:08

GoogleCodeExporter commented 8 years ago
You can of course specify a location to save "stored" files in the openfpc.conf 
file. 
Closing to clean things up.

Original comment by leon.j.w...@gmail.com on 3 Oct 2012 at 9:16